diff --git a/.gitattributes b/.gitattributes index 149a7c2ba9a6a..12c0ec188d23c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -11,3 +11,7 @@ packages/core/src/**/*.txt text eol=lf packages/httpapi-codegen/test/generated/*.ts text eol=lf # The site tests compare source text and humans.txt byte for byte, so Windows checkouts keep LF. services/site/** text=auto eol=lf +packages/codemode-rust/conformance/catalog.json linguist-generated=true +packages/codemode-rust/conformance/streaming.json linguist-generated=true +packages/codemode-rust/conformance/tools.json linguist-generated=true +packages/codemode-rust/conformance/cases/*.json linguist-generated=true diff --git a/.github/workflows/check-test.yml b/.github/workflows/check-test.yml index 8b2751cb2eec8..d50ad10229ecf 100644 --- a/.github/workflows/check-test.yml +++ b/.github/workflows/check-test.yml @@ -97,6 +97,23 @@ jobs: # Pull requests diff against the merge's first parent; pushes diff against the previous dev head. fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} + # The Rust port of codemode is checked in this job, on Linux, only when it or its TypeScript reference changed. + # Runs without a base to diff against (manual runs, the release gate, a new branch) check it always. + - name: Decide whether the codemode Rust checks run + id: codemode-rust + if: runner.os == 'Linux' + run: | + paths=(packages/codemode packages/codemode-rust .github/workflows/check-test.yml) + if [ "$AFFECTED" != "true" ] || ! git cat-file -e "${TURBO_SCM_BASE}^{commit}" 2>/dev/null; then + run=true + elif git diff --quiet "$TURBO_SCM_BASE" "$TURBO_SCM_HEAD" -- "${paths[@]}"; then + run=false + else + run=true + fi + echo "run=$run" >> "$GITHUB_OUTPUT" + echo "codemode Rust checks: $run" + - name: Setup Node uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: @@ -155,6 +172,93 @@ jobs: working-directory: packages/protocol run: bun run check:generated + # The toolchain, profile and components come from packages/codemode-rust/rust-toolchain.toml. + - name: Install Rust for codemode + if: runner.os == 'Linux' && steps.codemode-rust.outputs.run == 'true' + working-directory: packages/codemode-rust + run: rustup toolchain install --no-self-update + + # One cache for the debug and release builds below. + - name: Cache codemode Rust builds + if: runner.os == 'Linux' && steps.codemode-rust.outputs.run == 'true' + uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2 + with: + shared-key: codemode-rust + key: ${{ hashFiles('packages/codemode-rust/rust-toolchain.toml') }} + workspaces: packages/codemode-rust -> target + + - name: Check codemode Rust formatting, Clippy and tests + if: runner.os == 'Linux' && steps.codemode-rust.outputs.run == 'true' + timeout-minutes: 15 + working-directory: packages/codemode-rust + run: | + cargo fmt --check + cargo clippy --locked --workspace --all-targets -- -D warnings + # Includes bench/tests/conformance.rs, which checks every conformance case against the reference outcome. + cargo test --locked --workspace + + # Saves and restores every run at each host stop and after 64, 128, 256, ... loop iterations; outcomes must not + # change. Reuses the debug build of the step before and takes seconds. + - name: Check codemode Rust conformance in round-trip mode + if: runner.os == 'Linux' && steps.codemode-rust.outputs.run == 'true' + timeout-minutes: 5 + working-directory: packages/codemode-rust + env: + PSYCHOSCRIPT_ROUNDTRIP: "1" + run: cargo test --locked -p psychoscript-bench --test conformance + + # A change to the reference fails here until the Rust side is updated and the expectations regenerated. + - name: Check codemode Rust conformance expectations match the reference + if: runner.os == 'Linux' && steps.codemode-rust.outputs.run == 'true' + working-directory: packages/codemode-rust + run: | + bun conformance/generate.ts + bun conformance/boundary.ts + bun conformance/streaming.ts + bun conformance/host.ts + git status --porcelain -- conformance + git diff --exit-code -- conformance + test -z "$(git status --porcelain -- conformance)" + + - name: Read the pinned test262 revision + id: test262 + if: runner.os == 'Linux' && steps.codemode-rust.outputs.run == 'true' + run: | + revision=$(jq -r .revision packages/codemode/test/test262/manifest.json) + echo "revision=$revision" >> "$GITHUB_OUTPUT" + echo "checkout=$HOME/.cache/test262-$revision" >> "$GITHUB_OUTPUT" + + - name: Cache the test262 checkout + if: runner.os == 'Linux' && steps.codemode-rust.outputs.run == 'true' + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: ${{ steps.test262.outputs.checkout }} + key: test262-${{ steps.test262.outputs.revision }} + + # Parity both ways, against test262/rust-skipped.txt and test262/reference-gaps.txt; see test262/README.md. + - name: Check codemode Rust test262 parity + if: runner.os == 'Linux' && steps.codemode-rust.outputs.run == 'true' + timeout-minutes: 10 + working-directory: packages/codemode-rust + env: + TEST262_CHECKOUT: ${{ steps.test262.outputs.checkout }} + run: bash test262/run.sh + + # Shared runners are too noisy for a performance gate; the numbers go to the job summary only. + - name: Benchmark codemode Rust against the reference (informational) + if: runner.os == 'Linux' && steps.codemode-rust.outputs.run == 'true' + continue-on-error: true + timeout-minutes: 10 + working-directory: packages/codemode-rust + env: + ITERATIONS: "5" + COLD_RUNS: "5" + PLUGIN_RUNS: "2000" + run: | + [ -x /usr/bin/time ] || (sudo apt-get update && sudo apt-get install -y time) + bash bench/compare.sh + cat bench/RESULTS.md >> "$GITHUB_STEP_SUMMARY" + build: name: build (${{ matrix.settings.name }}) # Compiling the CLI and smoke-testing its service lifecycle is part of the full tier. diff --git a/.oxlintrc.json b/.oxlintrc.json index 0ad3ae0a5cc8c..f45d737de5837 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -216,6 +216,7 @@ "**/*.d.ts", "**/sdk.gen.ts", "packages/plugins/figma/skills/**", + "packages/codemode-rust/conformance/cases/**", ".agent/**", ".agents/**", ".claude/**", diff --git a/.prettierignore b/.prettierignore index 1cc3a11070f1b..518edfe345c37 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,3 +3,6 @@ packages/desktop/src/bindings.ts packages/client/src/generated/ packages/client/src/generated-effect/ packages/plugins/figma/skills/ +packages/codemode-rust/conformance/catalog.json +packages/codemode-rust/conformance/streaming.json +packages/codemode-rust/conformance/tools.json diff --git a/bun.lock b/bun.lock index 5826a5715e76a..ecc1a83413743 100644 --- a/bun.lock +++ b/bun.lock @@ -200,7 +200,7 @@ "name": "@opencode/codemode", "version": "2.3.0", "dependencies": { - "acorn": "8.15.0", + "acorn": "8.16.0", "effect": "catalog:", }, "devDependencies": { @@ -2592,7 +2592,7 @@ "accepts": ["accepts@2.0.0", "", { "dependencies": { "mime-types": "^3.0.0", "negotiator": "^1.0.0" } }, "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng=="], - "acorn": ["acorn@8.15.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="], + "acorn": ["acorn@8.16.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw=="], "acorn-jsx": ["acorn-jsx@5.3.2", "", { "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ=="], diff --git a/packages/codemode-rust/.gitignore b/packages/codemode-rust/.gitignore new file mode 100644 index 0000000000000..2f7896d1d1365 --- /dev/null +++ b/packages/codemode-rust/.gitignore @@ -0,0 +1 @@ +target/ diff --git a/packages/codemode-rust/AGENTS.md b/packages/codemode-rust/AGENTS.md new file mode 100644 index 0000000000000..f3cbdb8ddb3e7 --- /dev/null +++ b/packages/codemode-rust/AGENTS.md @@ -0,0 +1,39 @@ +# PsychoScript (Rust) + +The Rust implementation of the PsychoScript language layer, whose reference implementation is `src/language/` of `packages/codemode` (the `Language` namespace: `Runtime.make`, `Host`, programs, suspend and resume, snapshots). It embeds in Rust programs with no Bun, Node or other JavaScript engine at build or run time. Code Mode (`src/codemode/` of the reference: tools, schemas, the catalog, `search`, OpenAPI, hooks, `maxToolCalls`) is not part of this crate. + +## Parity with the reference language layer + +This package is a second way to run and embed the same language, not a replacement. The two must stay equally capable in both directions. + +- A language feature, built-in or host API lands in both or in neither. Rust-native forms of a reference API (futures instead of Effects, closures or traits instead of services) are fine; Rust-only capabilities are not. +- The public API in `crates/psychoscript/src/lib.rs` is the Rust form of `src/language/index.ts`; the README maps one to the other. Keep that table current. +- Known differences are listed in the README; add to that list only with the owner's agreement, and prefer removing one. + +## Conformance + +The recordings are generated from the reference's language layer; never edit them by hand. CI regenerates them and fails on any difference. Each generator's top comment states the host globals and runtime options it uses, which the Rust replays define the same way (`conformance/reference.ts` and `conformance/reference.rs` share the `tools` namespace): + +- `conformance/cases/*.json` by `bun conformance/generate.ts`, replayed by `bench/tests/conformance.rs`. +- `conformance/host.json` by `bun conformance/host.ts` (host functions: types, keys, idempotent and durable calls across a suspend, namespaces, failures, `run.metadata`, translation, limits, compiled programs), replayed by `crates/psychoscript/tests/host_recording.rs`. +- `conformance/boundary.json` by `bun conformance/boundary.ts` (values crossing the host boundary, globals, module names and imports), replayed by `crates/psychoscript/tests/boundary.rs`. +- `conformance/streaming.json` by `bun conformance/streaming.ts` (streaming responses, host-call arguments, fuel, suspensions), replayed by `crates/psychoscript/tests/streaming.rs`. +- `crates/psychoscript/tests/host.rs` mirrors the reference's `test/language.test.ts`. + +## Scope + +- Pipeline: parse → compile to bytecode → stack VM. Values cross the host boundary as copies (`HostValue`), never shared. +- Out of scope, as in the reference: classes (rejected), `export`, BigInt, Symbol beyond the well-known iterators. + +## Rules + +- Functional style at the API: plugins are programs over data, not objects. Do not add classes to the language. +- Unsupported syntax throws `UnsupportedSyntax` with a location where it runs; never panic on user input. +- No `unsafe` unless measured and justified in a comment. +- Dependencies: pure Rust only, and few. Justify each in the commit that adds it. +- test262 parity runs both ways: `bash test262/run.sh` must pass, and `test262/rust-skipped.txt` and `test262/reference-gaps.txt` may only shrink. +- `cargo fmt --check`, `cargo clippy --workspace --all-targets -- -D warnings`, and `cargo test --workspace` must pass. +- The conformance cases must also pass in round-trip mode, which saves and restores every run at each host stop and after 64, 128, 256, … loop iterations: `PSYCHOSCRIPT_ROUNDTRIP=1 cargo test -p psychoscript-bench --test conformance`. +- Benchmark claims need the command, machine and numbers in `bench/RESULTS.md`, measured against the reference's language layer by `bash bench/compare.sh`. +- CI: the `unit` job of `.github/workflows/check-test.yml` runs these checks, round-trip conformance, conformance freshness, test262 and the informational bench on Linux, whenever `packages/codemode`, `packages/codemode-rust` or that workflow changed. +- Nothing in the repo mentions internal tooling, private chats, home paths, hostnames or secrets. diff --git a/packages/codemode-rust/Cargo.lock b/packages/codemode-rust/Cargo.lock new file mode 100644 index 0000000000000..5e1e57eb491f1 --- /dev/null +++ b/packages/codemode-rust/Cargo.lock @@ -0,0 +1,1073 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "bytecount" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e" + +[[package]] +name = "castaway" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "compact_str" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79fcda08c33bb58b97008b2cdada6622500e949e060f5913361763121abd2416" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "static_assertions", + "zmij", +] + +[[package]] +name = "cow-utils" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417bef24afe1460300965a25ff4a24b8b45ad011948302ec221e8a0a81eb2c79" + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "allocator-api2", +] + +[[package]] +name = "icu_collator" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24cb0205c419b2036da3f9082964905d6849b3f2130dd4a517940c45899a544b" +dependencies = [ + "icu_collator_data", + "icu_collections", + "icu_locale_core", + "icu_locale_fallback", + "icu_normalizer", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "zerovec", +] + +[[package]] +name = "icu_collator_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "183f47e821a327661c1ebe152f61d5b6c2000010d228cadbbf226e0e2b8c2634" + +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "serde", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locale_fallback" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "406e9ae5b95d8aa37db6293405931b766a6172d1848daee22d70eb44aa78a43c" +dependencies = [ + "icu_locale_core", + "icu_locale_fallback_data", + "icu_provider", + "potential_utf", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locale_fallback_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3632ebbd0c5c3637ba1a40bdf8288f2cb9d2268e73441a69d5fc73d7cfbaa87c" + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "serde", + "stable_deref_trait", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_segmenter" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61b195dc605f81aa181bec9b3bd14e26cc71b903e4644f6af578ca9772c7a710" +dependencies = [ + "icu_collections", + "icu_locale_fallback", + "icu_provider", + "icu_segmenter_data", + "potential_utf", + "smallvec", + "utf8_iter", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_segmenter_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "913a7d294ad056474749152107309fdee3ec17d2482d1ab70fdc61a81c64b9a3" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "279259b0ac81c89d11c290495fdcfa96ea3643b7df311c138b6fe8ca5237f0f8" +dependencies = [ + "idna_mapping", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "idna_mapping" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11c13906586a4b339310541a274dd927aff6fcbb5b8e3af90634c4b31681c792" +dependencies = [ + "unicode-joining-type", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "itertools" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "nonmax" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51" + +[[package]] +name = "num-bigint" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93e7820bc0a80a0238e650327316f929ba18d5be054b647490a3a6a339f3e7c0" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "oxc_allocator" +version = "0.159.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaf8c5fa53291fec5f52e179974cc58cd002e45eab0defdbdfb6b36a1809c9ef" +dependencies = [ + "allocator-api2", + "hashbrown", + "oxc_data_structures", + "rustc-hash", +] + +[[package]] +name = "oxc_ast" +version = "0.159.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5ac049e885e553878688ca583184cc2b8de02177914328f59616e59ffc224f" +dependencies = [ + "bitflags", + "oxc_allocator", + "oxc_ast_macros", + "oxc_data_structures", + "oxc_diagnostics", + "oxc_estree", + "oxc_regular_expression", + "oxc_span", + "oxc_str", + "oxc_syntax", +] + +[[package]] +name = "oxc_ast_macros" +version = "0.159.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb36e1df5e540ebd898865ed79ffd8d8f9e06310521dc0d8e5b9cc4567fc6739" +dependencies = [ + "phf", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "oxc_ast_visit" +version = "0.159.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a019293646229f79954cf7c5d022a13324c84e1b874e8ce030c8e7c0a56e5b0f" +dependencies = [ + "oxc_allocator", + "oxc_ast", + "oxc_span", + "oxc_syntax", +] + +[[package]] +name = "oxc_data_structures" +version = "0.159.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8932e4c5ad3c6973548bf2f7750b778315012ecd7086617721d23f17b43e5a55" + +[[package]] +name = "oxc_diagnostics" +version = "0.159.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901588f26a8f1e7a0a8f7ebab60bf311bc9a1d22935e740a1b545c33b020f29f" +dependencies = [ + "bytecount", + "cow-utils", + "itoa", + "memchr", + "oxc_span", + "percent-encoding", + "smallvec", + "textwrap", + "unicode-segmentation", + "unicode-width", +] + +[[package]] +name = "oxc_ecmascript" +version = "0.159.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4127c1685ec3e85c34bcbe9b4055b1ce34bc0e2614c4bf5cf56c52a5424c7fc5" +dependencies = [ + "itoa", + "memchr", + "num-bigint", + "num-traits", + "oxc_ast", + "oxc_data_structures", + "oxc_span", + "oxc_str", + "oxc_syntax", + "zmij_ecma", +] + +[[package]] +name = "oxc_estree" +version = "0.159.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00c806bed591dc97e36678eeaaccb6e85ecc21766eaf6f8a77e7a261a4457a2c" + +[[package]] +name = "oxc_index" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "191884bee6c3744909a51acc7d78d4ae370d817b25875b10642f632327b6296e" +dependencies = [ + "nonmax", + "serde", +] + +[[package]] +name = "oxc_parser" +version = "0.159.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fd93cb9811da8634acfd28a864889d1bf68bce2c546a52372205afabd4a63e7" +dependencies = [ + "bitflags", + "cow-utils", + "memchr", + "num-bigint", + "num-traits", + "oxc_allocator", + "oxc_ast", + "oxc_data_structures", + "oxc_diagnostics", + "oxc_ecmascript", + "oxc_span", + "oxc_str", + "oxc_syntax", + "rustc-hash", + "seq-macro", +] + +[[package]] +name = "oxc_regular_expression" +version = "0.159.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c85fe16e0f852ba1b1085f08efec7b9d611ecaba1851ca6fecb7f91b09631714" +dependencies = [ + "bitflags", + "oxc_allocator", + "oxc_ast_macros", + "oxc_data_structures", + "oxc_diagnostics", + "oxc_span", + "oxc_str", + "phf", + "rustc-hash", + "unicode-id-start", +] + +[[package]] +name = "oxc_semantic" +version = "0.159.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61b34d4fb57e1f91ed099708e09b7450960d34d3a706ee84be55f821da27021" +dependencies = [ + "itertools", + "memchr", + "oxc_allocator", + "oxc_ast", + "oxc_ast_visit", + "oxc_data_structures", + "oxc_diagnostics", + "oxc_ecmascript", + "oxc_index", + "oxc_span", + "oxc_str", + "oxc_syntax", + "rustc-hash", + "self_cell", + "smallvec", +] + +[[package]] +name = "oxc_span" +version = "0.159.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0bb9aed024358d262b9daab20b7aa7ae89b42946e549b52ff92ddfef033d0e1" +dependencies = [ + "oxc_allocator", + "oxc_ast_macros", + "oxc_estree", +] + +[[package]] +name = "oxc_str" +version = "0.159.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b51303dd938569998ad07110fff48d76da59cfe47748a39833c4652424babb4" +dependencies = [ + "compact_str", + "hashbrown", + "memchr", + "oxc_allocator", + "oxc_estree", + "oxc_span", +] + +[[package]] +name = "oxc_syntax" +version = "0.159.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f832591474dac1e451b6619d9e9d6187f08445d9d73c47b331dedc34439eb81" +dependencies = [ + "bitflags", + "cow-utils", + "nonmax", + "oxc_allocator", + "oxc_ast_macros", + "oxc_estree", + "oxc_index", + "oxc_span", + "oxc_str", + "phf", + "unicode-id-start", + "zmij_ecma", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "010378780309880b08997fae13be7834dba947d36393bd372f2b1556deb2a2f6" +dependencies = [ + "phf_macros", + "phf_shared", + "serde", +] + +[[package]] +name = "phf_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb62e0959d5a1bebc965f4d15d9e2b7cea002b6b0f5ba8cde6cc26738467100" +dependencies = [ + "fastrand", + "phf_shared", +] + +[[package]] +name = "phf_macros" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fa8d0ca26d424d27630da600c6624696e7dec8bf7b3b492b383c5dc49e5e085" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_shared" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fd9027e2d9319be6349febd1db4e8d02aa544921200c9b777720ac34a3aa89" +dependencies = [ + "siphasher", +] + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "serde_core", + "writeable", + "zerovec", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "psychoscript" +version = "0.1.0" +dependencies = [ + "icu_collator", + "idna_adapter", + "oxc_allocator", + "oxc_ast", + "oxc_ast_visit", + "oxc_diagnostics", + "oxc_parser", + "oxc_semantic", + "oxc_span", + "oxc_str", + "oxc_syntax", + "psychoscript", + "regress", + "rustc-hash", + "serde_json", + "tz-rs", + "unicode-normalization", + "url", +] + +[[package]] +name = "psychoscript-bench" +version = "0.0.0" +dependencies = [ + "psychoscript", + "serde_json", +] + +[[package]] +name = "psychoscript-test262" +version = "0.0.0" +dependencies = [ + "psychoscript", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regress" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32eef8b209c3c1c15dbad02c1f30f9539f00dc7253e0cbcdaae442a50a09d7c1" +dependencies = [ + "memchr", +] + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "self_cell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813" + +[[package]] +name = "seq-macro" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "foldhash", + "indexmap", + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "siphasher" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" + +[[package]] +name = "smallvec" +version = "1.16.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "149309498a5f7334b12ddae0cad8aba81ce785fe91755068867e017cf98fee46" +dependencies = [ + "serde", +] + +[[package]] +name = "smawk" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8e2fb0f499abb4d162f2bedad68f5ef91a1682b5a03596ddb67efd37768d100" + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "textwrap" +version = "0.16.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ecfad6c3abc80a577f2b91c1e412ee57e7a060d430b553c1b0c940974ebcd49" +dependencies = [ + "icu_segmenter", + "smawk", + "unicode-width", +] + +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "serde_core", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + +[[package]] +name = "tz-rs" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fc6c929ffa10fb34f4a3c7e9a73620a83ef2e85e47f9ec3381b8289e6762f42" + +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-id-start" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0825d2e09dcae814a4273c1e1435979d414ede25b2ee235b1545da6682483765" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "unicode-joining-type" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8d00a78170970967fdb83f9d49b92f959ab2bb829186b113e4f4604ad98e180" + +[[package]] +name = "unicode-normalization" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75cd3fb03d5288b3ba9a1ee103ac7e9cbb59f0b03d64f8ddfcc04dd42758a85d" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "unicode-width" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca718471876992059f251e33aafc334346ada08042b7661dd1fe313a9bced557" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf16_iter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c7de35d9d8757dbc1f5125dc8b51438c68b4430546a735c3a9b91aaaaf9a18a" +dependencies = [ + "utf_types", +] + +[[package]] +name = "utf8_iter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0" +dependencies = [ + "utf_types", +] + +[[package]] +name = "utf_types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "serde", + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" + +[[package]] +name = "zmij_ecma" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "458b3e7a977f14499066b6bdb63d69da30ce337d6c160f077e6c575c82a44db9" diff --git a/packages/codemode-rust/Cargo.toml b/packages/codemode-rust/Cargo.toml new file mode 100644 index 0000000000000..8007589e49914 --- /dev/null +++ b/packages/codemode-rust/Cargo.toml @@ -0,0 +1,11 @@ +[workspace] +resolver = "3" +members = ["crates/psychoscript", "bench", "test262"] + +[workspace.package] +edition = "2024" +license = "MIT" + +[profile.release] +lto = "thin" +codegen-units = 1 diff --git a/packages/codemode-rust/PR.md b/packages/codemode-rust/PR.md new file mode 100644 index 0000000000000..5aa0477f59f53 --- /dev/null +++ b/packages/codemode-rust/PR.md @@ -0,0 +1,46 @@ +# feat: Rust implementation of the PsychoScript language layer + +Adds `psychoscript`, a pure-Rust crate (no JavaScript engine at build or run time) that runs and embeds PsychoScript +as a second implementation of the language layer next to `src/language/`: parser (`oxc_parser`), bytecode compiler, +stack VM, standard library, host functions, and snapshots for suspend and resume. Code Mode stays out of scope. The +README maps each `Language` export to its Rust form and describes threading in full. Both implementations gain +`runtime.compile(code)`, a program compiled once that `program` and `execute` run many times without parsing again. + +## Parity + +The two implementations stay equally capable both ways: a feature lands in both or neither. Every expectation is +recorded from the TypeScript layer, never written by hand, and CI fails if a regenerated recording differs. + +| Recording (generator) | Rust replay | Covers | +|---|---|---| +| `cases/*.json` (`generate.ts`) | `bench/tests/conformance.rs`, also round-trip | 391 programs | +| `host.json` (`host.ts`) | `tests/host_recording.rs` | 80 runs, 22 suspensions | +| `boundary.json` (`boundary.ts`) | `tests/boundary.rs` | 38 programs, 38 configurations, 10 results | +| `streaming.json` (`streaming.ts`) | `tests/streaming.rs` | 693 programs, 63 suspensions | +| test262 (`test262/run.sh`) | both ways | 19521 / 19521 files | + +## Threading + +- Compiling runs on a thread sized by `nesting::bound` (a conservative nesting bound) only when a program is deeper + than the 512 KB budget allows. +- Runs stay on the thread that drives them; call depth matches the reference exactly. +- As futures, compute stretches over 1 ms move to the run's own worker; host code is always handed back to the + executor, in the same order. +- Bench cost stays within 0.5% of single-threaded instruction counts (`bench/RESULTS.md`). + +## Memory + +- Runs collect garbage while they run: an incremental, non-moving mark-sweep, including atoms and deleted Map and Set + entries. Short runs never reach its first threshold; long-lived ones stay near their live data (`bench/GC.md`). + +## Known differences + +- A saved state resumes only in the implementation and build that saved it (the snapshot formats differ). + +## Before merging + +Needs the language/Code Mode split in psychoscript, plus the language-layer TypeScript changes this was recorded +against: seven JavaScript-correctness fixes (ToPrimitive conversions, evaluation order of `new` and assignment, +`delete` on primitives, `in` on array holes, built-in details), acorn 8.16, `runtime.compile`, sync-generator parking in +`generators.ts` (its test moves with Code Mode or is rewritten), and the test262 skip-list, `interpreter-support.md` +and `AGENTS.md` updates. diff --git a/packages/codemode-rust/README.md b/packages/codemode-rust/README.md new file mode 100644 index 0000000000000..5fe0dbbbf9588 --- /dev/null +++ b/packages/codemode-rust/README.md @@ -0,0 +1,148 @@ +# PsychoScript (Rust) + +A Rust implementation of the PsychoScript language layer: the confined, JavaScript-like language whose reference +implementation is `src/language/` of `@opencode/codemode` (the `Language` namespace). Programs run in a bytecode VM +written in pure Rust, with no Bun, Node or other JavaScript engine at build or run time, and reach only the host +functions the embedder gives them. + +Code Mode (tools, schemas, the catalog, `search`, OpenAPI, hooks, `maxToolCalls`) is a layer the reference builds on +the language; it is not part of this crate. A host builds its own layer the same way, from host functions. + +## Use + +```rust +use psychoscript::{HostFunction, HostValue, Namespace, Failure, Runtime, Limits}; + +let runtime = Runtime::make() + // Made when a run starts, and again when it resumes, so globals can keep the run's own state in its metadata. + .globals(|run| { + [ + // Synchronous (the default): the program waits for it. + ("hash", HostFunction::new(|args, _| HostValue::from(sha256(args[0].as_str().unwrap_or(""))))), + // Asynchronous: the program gets a promise. + ("sleep", HostFunction::new_async(|args, _| async move { sleep(args[0].as_f64()).await; Ok(HostValue::Undefined) })), + // Rerun with the same key after a resume. + ("lookup", HostFunction::new_async(|args, call| async move { db_get(&args[0], call.key()).await }).idempotent()), + // A lazy, path-addressed object of functions: `api.issues.list()`. + ("api", Namespace::new(|path| Ok(children_of(path)), |path| fn_at(path).map_or_else( + || Failure::missing(format!("No api.{}", path.join("."))).into(), + Into::into, + )).into()), + ] + }) + .limits(Limits { timeout_ms: Some(5_000), max_output_bytes: Some(64 << 10) }); + +let outcome = runtime.execute("const h = hash('a'); await sleep(1); return h"); +``` + +The API is the Rust form of the reference's `Language` namespace: + +| Reference (`src/language/index.ts`) | Rust (`crates/psychoscript/src/lib.rs`) | +|---|---| +| `Runtime.make({ globals, modules, limits, translate })` | `Runtime::make().globals(..).modules(..).limits(..).translate(..)` | +| `Host.fn(f, { type, idempotent, constructible, takesFunctions, snapshot })` | `HostFunction::new` (sync), `new_async`, `.thenable()` (sync-thenable), `.idempotent()`, `.constructible()`, `.takes_functions()`, `.snapshot(encode, decode)` | +| a sync `Host.fn` returning a value, a Promise, or an Effect | `HostValue`/`HostResult`, `Returned::Pending(future)`, `Returned::Block(future)` | +| `Host.durableFn({ start, wait, cancel })` | `DurableFunction::new(start, wait, cancel)` | +| `Host.namespace({ keys, resolve })` | `Namespace::new(keys, resolve)` | +| `Host.fail(kind, message, suggestions)`, `Host.missing(..)` | `Failure::new(kind, message)`, `Failure::missing(message)`, `.suggestions(..)`, `.kind(..)` | +| `Effect.interrupt` from a host function | `Err(HostValue::Interrupt)` | +| `run.id`, `run.metadata` | `Run::id`, `Run::metadata`, `set_metadata`, `update_metadata` | +| `runtime.execute(code, { bindings, runId })` | `execute(code)`, `execute_with(code, &ProgramOptions)`, `execute_async` | +| `runtime.program(..)`, `program.run()`, `program.suspend()` | `Runtime::program`, `Program::run`/`run_resumable`/`run_async`, `Program::suspender()` → `Suspender::suspend` | +| `runtime.compile(code)`: `{ ok, compiled }` or `{ ok: false, error }`; `program` and `execute` take a `Compiled` or source | `Runtime::compile(code)`: `Result`, `Compiled` an `Arc` to clone and share; `program` and the `execute` methods take `&str` or `&Compiled` (`Code`) | +| `runtime.resume(state \| bytes)` | `Runtime::resume(&Snapshot)`, `resume_bytes` | +| `toBytes`, `fromBytes`, `SnapshotError`, `SuspendError` | `to_bytes`, `from_bytes`, `SnapshotError`, `SuspendError` | +| `StreamingResponse` | `StreamingResponse` over an `HttpBody` | +| `globalNames` | `global_names()` | +| `Diagnostic`, `DiagnosticKind`, `Json` | `Diagnostic`, `DiagnosticKind`, `Json` (`serde_json::Value`) | +| a run's `Result` (`value`, `logs`, ...) | `Outcome`: `result` as `Data` (JSON whose strings are `HostString`s), `logs` as `HostString`s; `Outcome::json` and `Outcome::log_lines` give them lossily as `serde_json::Value` and `String` | +| a JavaScript string crossing as a host value | `HostString`: lossless, including unpaired surrogates; `as_str`, `to_utf16`, `to_string_lossy` | +| `Json` a host passes or keeps (bindings, `run.metadata`, a durable function's data) | `Data`, which keeps unpaired surrogates; it converts from and to `serde_json::Value` | + +Host work is a `Future` instead of an Effect: `Runtime::execute` drives a run on the calling thread, and +`execute_async` and `Program::run_async` run on any executor (see Threading). Values cross the boundary as copies +(`HostValue`); a +string crosses as a `HostString`, which keeps a string with an unpaired surrogate exactly, so a host sees and returns +what the program had. Every string the API hands over that can hold program text is one: values, object keys, error +names and messages, RegExp sources, namespace paths, the result (`Data`), logs, diagnostics and failures, bindings, +run metadata and durable data. URLs, URLSearchParams and Headers stay `String`s, as JavaScript keeps them well +formed too; lossy accessors (`to_string_lossy`, `Data::to_json`, `Outcome::json`, `Outcome::log_lines`, +`Diagnostic::message_lossy`) give Rust `String`s and `serde_json::Value`s when wanted. + +## Parity + +This crate and the reference language layer must stay equally capable in both directions: a language feature or host +API lands in both or in neither. Rust-native forms of a reference API are fine; Rust-only capabilities are not. + +Its expectations are recorded from the reference's language layer, never written by hand (see `AGENTS.md`): + +- `conformance/cases/*.js` → `.json` (`bun conformance/generate.ts`), replayed by `bench/tests/conformance.rs`, also in + round-trip mode (`PSYCHOSCRIPT_ROUNDTRIP=1`, which saves and restores every run at each host stop and loop slice). +- `conformance/host.json` (`bun conformance/host.ts`), replayed by `tests/host_recording.rs`. +- `conformance/boundary.json` (`bun conformance/boundary.ts`), replayed by `tests/boundary.rs`. +- `conformance/streaming.json` (`bun conformance/streaming.ts`), replayed by `tests/streaming.rs`. +- test262, both ways: `bash test262/run.sh`. + +`tests/host.rs` mirrors the reference's `test/language.test.ts`. + +### Known differences + +- A saved state resumes only in the implementation and build that saved it: the snapshot formats differ. + +### Observations on the reference + +Recording the language layer surfaced a few reference behaviours worth a look; Rust matches them: + +- A host function's `length` is the arity of the host's `run` callback, not of the parameters the program sees: a + function written `(args, call) => ...` has `length` 2. +- A namespace's `keys` can throw `Host.fail` (that is how an unknown path fails); `Host.namespace`'s docs don't say so. +- When `resolve` gives `Host.missing`, calling that path throws synchronously, even where the program expects a promise. + +## Threading + +How a run uses threads changes how it runs, never what a program can do or see. + +- **Compiling.** Parsing and compiling recurse once per level of syntax, and the parser has no guard of its own. A + token scan (`nesting::bound`) gives an upper bound on a program's nesting without parsing it. It is conservative + by construction: where it can't tell how the parser reads a `/` (regex or division) or a byte, it counts that + line raw, every opening bracket and no closer, and source it can't tokenize counts raw to the end. A program + compiles on the caller's thread when its bound fits the 512 KB budget, however long it is. A deeper one compiles + on a thread sized to its bound: 1 KiB per unit in release builds and 16 KiB in debug builds, over the measured + worst of 819 B and 12.9 KB (`bench/examples/stack_probe.rs`). Every entry point compiles this way: `execute`, + `program`, `execute_async` and `resume`. +- **Running.** Running needs no native stack for deep syntax, and built-in callbacks are VM frames: re-entrant calls + cost no native stack per level. A run therefore stays on the thread that drives it, with the same 512 KB budget + everywhere. Call depth matches the reference exactly: 10,000 levels at one program frame per level, 5,000 at two, + 3,334 at three. +- **Long runs as futures.** In `execute_async`, `run_async` and `run_resumable_async`, a stretch of compute longer than + 1 ms stops at its next safe point (a loop back-edge or a job boundary). It finishes on a worker thread of the run's + own, so the executor's thread is free meanwhile. The next stretch starts on the executor again. Host code never + runs on the worker; each piece is handed back to the executor while the worker waits, so it runs on the same thread + and in the same order as without the worker: + - a host function's call, and the work a synchronous one blocks on; + - starting an async or durable function, and the first poll of its future; + - namespace `resolve` and `keys`; + - accessors such as a streaming body's `cancel`. + + A handed-back call costs a few microseconds, which only stretches already past 1 ms pay. Dropping a run while it is + on its worker brings it back first, so its calls are cancelled on the executor. A suspend works the same either + way. Blocking `execute` and `Program::run` never use a worker: the caller waits either way. +- **Cost.** To move between threads, a run's state is `Send` (`Arc` instead of `Rc`, byte buffers behind an + uncontended `Mutex`). The nine bench programs stay within 0.5% of the single-threaded instruction counts. The 3 KB + plugin event stops paying for a thread: 9% fewer instructions. + +## Memory + +A run frees what it can no longer reach while it runs. The collector (`collector.rs`) is an incremental, non-moving +mark-sweep collector: it does no work until a run passes its first threshold, works in short steps paced by +allocation, only at safe points, and spends nothing on an idle run. Design, method and numbers are in `bench/GC.md`. + +## Layout + +- `crates/psychoscript/src/`: compiler (`compiler.rs`, on `oxc_parser`), bytecode and VM (`vm.rs`, `ops.rs`), runtime + objects and the standard library (`builtins/`), promises and iteration, host functions and their crossing + (`host_function.rs`, `host.rs`, `cross.rs`, `streaming.rs`), snapshots (`snapshot.rs`), and the runtime and programs + (`runtime.rs`, `program.rs`, `run.rs`). +- `conformance/`: the generators, their recordings, and `reference.ts`/`reference.rs`, the `tools` namespace they share. +- `bench/`: the benchmark runner, `compare.sh` and `RESULTS.md`, measured against the reference's language layer. +- `test262/`: the test262 parity runner. diff --git a/packages/codemode-rust/bench/Cargo.toml b/packages/codemode-rust/bench/Cargo.toml new file mode 100644 index 0000000000000..61666d419079a --- /dev/null +++ b/packages/codemode-rust/bench/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "psychoscript-bench" +version = "0.0.0" +edition.workspace = true +publish = false + +[dependencies] +psychoscript = { path = "../crates/psychoscript" } +serde_json = { version = "1", features = ["float_roundtrip"] } + +[features] +# Per-run heap counts for the memory benchmarks (`examples/gc_bench.rs`). +gc-stats = ["psychoscript/gc-stats"] + +[[example]] +name = "gc_bench" +required-features = ["gc-stats"] diff --git a/packages/codemode-rust/bench/GC.md b/packages/codemode-rust/bench/GC.md new file mode 100644 index 0000000000000..4316d9e974765 --- /dev/null +++ b/packages/codemode-rust/bench/GC.md @@ -0,0 +1,164 @@ +# Automatic memory management + +A run frees what it can no longer reach while it runs. Before, a run kept everything until it ended. That suited a +reducer event, but it killed a long-lived plugin loop: a palette-style loop died at its 2M-object limit after about +6,000 events. + +## Design + +`crates/psychoscript/src/collector.rs` is an incremental, non-moving mark-sweep collector, in the style of Lua 5.1 +and gc-arena. + +- **What it frees:** objects, closure cells, strings and atoms. A freed slot goes on a free list for the next + allocation. Ids never move. +- **When it starts:** a run that never reaches its first threshold (64k slots in use) does no collection work at all. + After a cycle, the next one starts at the live count plus max(live, 64k). +- **Pacing:** work is paid by allocation debt, in steps of bounded size. A run that doesn't allocate does nothing, so + an idle run costs nothing. There are no threads and no timers. +- **Where it runs:** only at safe points, where every live value is in the VM's own structures: + - loop back-edges of the outermost run; + - job boundaries; + - the stop for the host. + + It never runs inside a nested Rust→VM call or a conversion replay. +- **Marking is snapshot-at-the-beginning.** + - The roots are scanned once, at cycle start. + - While a cycle marks, the first write to an object that isn't yet black traces it first. That is one branch in + `Heap`'s `IndexMut`, which every heap write goes through. + - Overwriting a cell shades the old value. Everything allocated during a cycle is black. + - Marking ends when nothing is grey; there is no atomic rescan. + - Properties, elements and Map entries are traced 4,096 slots at a time, so one step stays short whatever an + object's size. +- **Atoms:** an atom lives exactly as long as its own string. Atoms of the fresh runtime and of the compiled program + are permanent. + - Map and Set keep a string key as its atom's string, so tracing an entry keeps the atom alive. + - An interner lookup during a cycle shades the atom it finds. + - `JSON.stringify` keeps the keys it holds as strings. + - A freed atom's id is reused, and snapshots save it as a hole at its exact id. +- **Map and Set:** a delete compacts the entries once deleted ones outnumber the live ones (and 32). Iterators and + `forEach` hold logical positions, which compaction keeps (`OrderedMap::next_entry`). +- **Roots:** `reach.rs` enumerates every reference the VM holds, roots (`roots`) and objects' children (`head`, + `bulk`). Snapshots and the collector share it. +- **Snapshots:** the format keeps its shape. + - A freed slot saves as an empty placeholder, which the resumed run frees in its first cycle. + - A freed atom saves as `null`. + - Map and Set entries save with their logical positions. +- **Stress mode:** `PSYCHOSCRIPT_GC_STRESS=1` collects at every safe point, in tiny steps. + +Still unbounded: +- A single macOS `free()` during a sweep step can take about 1 ms; see the large live set below. +- The barrier traces one huge object in a single go: about 0.8 ms for 2M slots. +- WeakMap and WeakSet hold their entries strongly, as in the reference. + +## Method + +- **Machine:** Apple M5 Max, 18 cores, 48 GiB, macOS 26.7.1; rustc 1.100.0, release profile. +- **Comparison:** the collector, against its parent commit without it. +- **Throughput:** `psychoscript-bench --iterations 21 --json`. + - It reports the median instructions retired per run of each of the nine programs (`proc_pid_rusage`, + `bench/src/counters.rs`), and the median wall time. + - Instruction counts are the comparison. + - Tool fan-out and promise fan-out vary by up to ±5% between runs of the same binary. +- **Plugin event:** `psychoscript-bench --plugin --runs 3000 bench/plugin/reducer.js bench/plugin/reducer-padded.js`, + five alternating runs of each binary, median of their mean instructions per `execute`. +- **Long-lived runs:** `cargo build --release -p psychoscript-bench --features gc-stats --example gc_bench`, then: + - `gc_bench all --events 20000 --frames 4000`; + - `gc_bench loop palette --events 100000`; + - `gc_bench loop large --events 20000`. +- **What gc_bench does:** it drives each program in `bench/gc/` as a future on one thread, looping on + `await nextEvent()` as an OpenTUI plugin does. It reports: + - event (or frame) latency; + - live and peak bytes, from a counting allocator; + - the process footprint; + - each run's live and peak slots, and each collection step's duration (`Run::heap_stats`, `gc-stats` builds only). +- **Correctness:** these all pass: + - `cargo test --workspace`, plain and with `PSYCHOSCRIPT_GC_STRESS=1`; + - the conformance cases in round-trip mode, alone and together with stress; + - test262; + - `gc_bench` under stress, whose results and rendered output equal a normal run's. + +## Results + +Plugin event (instructions per `execute`): + +| Source | No collector | Collector | +|---|---:|---:| +| reducer.js | 495k | 497k (+0.4%) | +| reducer.js, compiled | 409k | 410k (+0.2%) | +| reducer-padded.js | 1,106k | 1,109k (+0.2%) | +| reducer-padded.js, compiled | 429k | 430k (+0.2%) | + +Nine programs (median instructions per run, median ms): + +| Program | No collector | Collector | +|---|---:|---:| +| numeric-loop | 108.8M, 4.3 ms | 108.8M (+0.0%), 3.9 ms | +| closure-recursion | 39.6M, 1.4 ms | 39.6M (+0.0%), 1.4 ms | +| array-callbacks | 288.6M, 9.8 ms | 288.2M (-0.1%), 9.8 ms | +| promise-fan-out | 24.3M, 0.8 ms | 24.5M (+1.1%), 1.0 ms | +| tool-fan-out | 11.9M, 0.4 ms | 11.5M (-3.2%), 0.4 ms | +| json-round-trip | 310.9M, 10.7 ms | 316.6M (+1.8%), 11.0 ms | +| generator-iteration | 36.8M, 1.1 ms | 37.3M (+1.1%), 1.1 ms | +| string-building | 95.7M, 2.7 ms | 97.4M (+1.7%), 2.8 ms | +| map-set-ops | 106.6M, 4.3 ms | 108.9M (+2.1%), 4.3 ms | + +Long-lived runs (20,000 events each): + +| Scenario | Collector? | Events | Live KiB end / max | Peak footprint KiB | Event µs p50 / p99 / max | GC steps | GC ms | Pause µs p50 / p99 / max | +|---|---|---:|---:|---:|---:|---:|---:|---:| +| palette | off | 6,252 † | 159 / 475,142 | 417,648 | 111 / 169 / 595 | 0 | 0.0 | – | +| palette | on | 20,000 | 16,561 / 20,683 | 25,696 | 109 / 252 / 698 | 3,259 | 137.2 | 46 / 76 / 101 | +| growing | off | 20,000 | 184,041 / 184,041 | 159,568 | 4 / 8 / 224 | 0 | 0.0 | – | +| growing | on | 20,000 | 14,797 / 16,054 | 22,656 | 4 / 40 / 135 | 488 | 16.0 | 31 / 76 / 128 | +| map-churn | off | 20,000 | 188,044 / 188,044 | 188,992 | 6 / 16 / 2,143 | 0 | 0.0 | – | +| map-churn | on | 20,000 | 16,853 / 17,503 | 26,144 | 6 / 43 / 298 | 578 | 16.8 | 26 / 55 / 101 | +| strings | off | 17,094 † | 158 / 312,572 | 295,808 | 11 / 23 / 235 | 0 | 0.0 | – | +| strings | on | 20,000 | 6,978 / 8,157 | 9,952 | 10 / 43 / 78 | 810 | 19.0 | 26 / 50 / 59 | +| closures | off | 20,000 | 196,442 / 196,442 | 148,544 | 5 / 12 / 255 | 0 | 0.0 | – | +| closures | on | 20,000 | 10,526 / 12,243 | 14,016 | 5 / 43 / 99 | 602 | 18.2 | 37 / 53 / 66 | +| generators | off | 16,804 † | 159 / 432,336 | 418,512 | 8 / 20 / 248 | 0 | 0.0 | – | +| generators | on | 20,000 | 15,887 / 19,342 | 18,240 | 8 / 38 / 113 | 1,466 | 37.7 | 27 / 40 / 51 | + +50 heaps, 5 active, 4,000 frames: + +| Collector? | Frames | Live KiB setup / end | Peak footprint KiB | Frame µs p50 / p99 / max | GC steps (idle) | GC ms | Pause µs p50 / p99 / max | +|---|---:|---:|---:|---:|---:|---:|---:| +| off | 4,000 | 8,807 / 548,069 | 417,280 | 142 / 208 / 957 | 0 (0) | 0.0 | – | +| on | 4,000 | 8,822 / 67,426 | 76,096 | 138 / 317 / 414 | 1,059 (0) | 47.6 | 43 / 117 / 190 | + +Palette, 100,000 events: + +| Collector? | Events | Live KiB end / max | Peak footprint KiB | Event µs p50 / p99 / max | GC steps | GC ms | Pause µs p50 / p99 / max | Objects live / peak | +|---|---:|---:|---:|---:|---:|---:|---:|---:| +| off | 6,252 † | 784 / 475,767 | 413,904 | 112 / 168 / 396 | 0 | 0.0 | – | 2,000,001 / 2,000,001 | +| on | 100,000 | 15,902 / 21,308 | 26,784 | 108 / 248 / 538 | 16,369 | 666.6 | 44 / 73 / 124 | 13,040 / 66,457 | + +A large live set (about 600k objects and strings), 20,000 events: + +| Collector? | Events | Live KiB end / max | Peak footprint KiB | Event µs p50 / p99 / max | GC steps | GC ms | Pause µs p50 / p99 / max | Objects live / peak | +|---|---:|---:|---:|---:|---:|---:|---:|---:| +| off | 6,273 † | 159 / 459,325 | 440,096 | 23 / 38 / 183 | 0 | 0.0 | – | 2,000,001 / 2,000,001 | +| on | 20,000 | 166,351 / 184,787 | 183,616 | 20 / 101 / 1,125 | 2,705 | 131.4 | 37 / 93 / 1,104 | 622,840 / 778,134 | + +† The run failed at its memory limit after that many events. + +Notes: +- Collection steps take 25–45 µs at p50, and stay under 120 µs at p99 everywhere. +- The 1.1 ms maximum on the large live set is a single macOS `free()` inside a sweep step; a program without the VM + shows the same stalls. +- Live memory in the small programs is mostly the 64k-slot first threshold. + +## Trials + +Three collectors were trialled side by side behind cargo features. Each branch remains as the record. + +- **`rust-gc-incremental`:** this design. +- **`rust-gc-sticky`:** non-moving generational collection with sticky mark bits. It kept the least memory, but its + full collections stop the world: 16 ms with a 600k live set. It cost up to +5% instructions. +- **`rust-gc-nursery`:** a moving nursery that rewrites `u32` handles. Rewriting cost only 2–3 ns per survivor, but + its full compactions stop the world: 17 ms with a 600k live set. + +Reference counting was ruled out: +- `Value` is `Copy` throughout the VM. +- A barrier hooked on mutable access never sees the old value of a heap write. +- Cycles would need a backup trace anyway. diff --git a/packages/codemode-rust/bench/RESULTS.md b/packages/codemode-rust/bench/RESULTS.md new file mode 100644 index 0000000000000..ec9beaac4f5df --- /dev/null +++ b/packages/codemode-rust/bench/RESULTS.md @@ -0,0 +1,123 @@ +# Benchmark results + +Generated by `bench/compare.sh` on 2026-11-19. "n/a" means the Rust side could not run the case. + +Columns say whether they are a median, a min or a mean. Every speed-up and ratio is computed from medians only; +mins and means are shown for spread, never compared. + +## Environment + +- CPU: Apple M5 Max, 18 cores, 48 GiB RAM, macOS 26.7.1 arm64 +- Reference: anomalyco/opencode 39eb3321285d490186fac0e4fd02f5b47ac265c4, `packages/codemode` +- PsychoScript: 39eb3321285d490186fac0e4fd02f5b47ac265c4 +- bun 1.4.4; rustc 1.100.0 (0ef1bc386 2026-11-09); cargo 1.100.0 (3acc79c0c 2026-11-05) + +## (a) Per-case wall time, 11 iterations after one warm-up + +| Case | Reference median ms | Reference min ms | Rust median ms | Rust min ms | Median speedup | +| -------------------------- | ------------------: | ---------------: | -------------: | ----------: | -------------: | +| numeric loop | 9.0 | 6.1 | 4.2 | 4.0 | 2.2x | +| closure recursion (fib 22) | 2.0 | 1.9 | 1.4 | 1.4 | 1.4x | +| array callbacks (50k) | 38.5 | 38.3 | 10.1 | 9.9 | 3.8x | +| promise fan-out (5k) | 3.4 | 2.4 | 0.8 | 0.8 | 4.0x | +| tool fan-out (1k) ¹ | 1.9 | 1.4 | 0.5 | 0.4 | 4.0x | +| JSON round-trip | 21.3 | 19.0 | 11.0 | 10.8 | 1.9x | +| generator iteration | 2.3 | 2.2 | 1.1 | 1.1 | 2.0x | +| string building | 7.8 | 6.7 | 2.8 | 2.7 | 2.8x | +| Map/Set ops | 5.9 | 5.7 | 4.3 | 4.1 | 1.4x | + +¹ `tools.echo` is an async host function in a `Host.namespace` on both sides (`conformance/reference.ts` and +`conformance/reference.rs`); neither validates its input or output. + +## (b) Cold start: process start to the result of `return 1` + +| Implementation | Median wall ms (20 runs) | +| ---------------------------------- | -----------------------: | +| Reference (bun bench/ref/embed.ts) | 67.0 | +| Rust (embed example) | 1.9 | + +## (c) Peak RSS, each case once in a fresh process + +| Case | Reference peak RSS MiB | Rust peak RSS MiB | +| -------------------------- | ---------------------: | ----------------: | +| numeric loop | 89.1 | 3.6 | +| closure recursion (fib 22) | 83.1 | 3.6 | +| array callbacks (50k) | 108.5 | 7.9 | +| promise fan-out (5k) | 98.0 | 8.3 | +| tool fan-out (1k) | 92.6 | 5.6 | +| JSON round-trip | 121.4 | 20.1 | +| generator iteration | 84.7 | 3.6 | +| string building | 112.1 | 7.6 | +| Map/Set ops | 104.4 | 10.1 | + +## (d) Binary size + +| Artifact | Bytes | MiB | +| ---------------------------------------- | -------: | ----: | +| Rust embed example, release, stripped | 6335112 | 6.04 | +| bun executable (what you ship otherwise) | 88660864 | 84.55 | + +## (e) Perturbed variants, 11 iterations after one warm-up + +Each program in `bench/variants/` computes the same result as its original, written differently: renamed +identifiers, equivalent constants, function expressions and named functions for callbacks, and other loop forms. A +variant / original ratio far from the reference's on one side only points at a shape-specific fast path. + +| Case | Reference original median ms | Reference variant median ms | Reference variant / original | Rust original median ms | Rust variant median ms | Rust variant / original | Rust ratio / reference ratio | +| -------------------------- | ---------------------------: | --------------------------: | ---------------------------: | ----------------------: | ---------------------: | ----------------------: | ---------------------------: | +| numeric loop | 9.1 | 6.4 | 0.71 | 4.0 | 4.3 | 1.07 | 1.51x | +| closure recursion (fib 22) | 2.0 | 1.9 | 0.98 | 1.4 | 1.4 | 0.99 | 1.01x | +| array callbacks (50k) | 37.3 | 39.2 | 1.05 | 10.0 | 11.0 | 1.10 | 1.04x | +| promise fan-out (5k) | 3.0 | 2.3 | 0.76 | 0.9 | 1.2 | 1.32 | 1.75x | +| tool fan-out (1k) | 1.8 | 1.3 | 0.76 | 0.4 | 0.5 | 1.09 | 1.43x | +| JSON round-trip | 20.8 | 19.9 | 0.95 | 10.8 | 10.9 | 1.01 | 1.06x | +| generator iteration | 3.1 | 3.0 | 0.97 | 1.1 | 1.1 | 1.03 | 1.06x | +| string building | 7.7 | 7.6 | 0.98 | 2.8 | 3.1 | 1.13 | 1.14x | +| Map/Set ops | 5.6 | 8.5 | 1.53 | 4.3 | 4.7 | 1.10 | 0.72x | + +## (f) Plugin event: µs per execute, 2000 runs after 2000 warm-up runs + +The conformance reducer (`plugin-reducer-*`) handling `{ type: "command", name: "git.status" }` with the async +`tools.git.status` host function, through `execute` once per event. `reducer.js` is its command path; +`reducer-padded.js` is the whole reducer with eleven more command handlers before the matching one, and +`reducer-100k.js` the same with 408 more, about 100 KB. + +| Source | Bytes | Reference median µs | Reference min µs | Reference mean µs | Rust median µs | Rust min µs | Rust mean µs | Median speedup | +| -------------------------------- | -----: | ------------------: | ---------------: | ----------------: | -------------: | ----------: | -----------: | -------------: | +| `bench/plugin/reducer.js` | 226 | 107.7 | 98.7 | 123.8 | 21.3 | 20.8 | 21.7 | 5.0x | +| `bench/plugin/reducer-padded.js` | 2957 | 194.9 | 161.1 | 272.2 | 44.4 | 43.6 | 44.9 | 4.4x | +| `bench/plugin/reducer-100k.js` | 100206 | 3704.0 | 2597.2 | 8032.7 | 809.9 | 784.7 | 811.5 | 4.6x | + +The same events run from the program `runtime.compile` made of the source once, so a run neither parses nor compiles +(medians only): + +| Source | Bytes | Reference from source µs | Reference compiled µs | Rust from source µs | Rust compiled µs | Compiled median speedup | +| -------------------------------- | -----: | -----------------------: | --------------------: | ------------------: | ---------------: | ----------------------: | +| `bench/plugin/reducer.js` | 226 | 107.7 | 100.5 | 21.3 | 17.3 | 5.8x | +| `bench/plugin/reducer-padded.js` | 2957 | 194.9 | 101.2 | 44.4 | 18.0 | 5.6x | +| `bench/plugin/reducer-100k.js` | 100206 | 3704.0 | 123.7 | 809.9 | 36.7 | 3.4x | + +## Commands + +```sh +bash bench/compare.sh # reference at ../codemode, or CODEMODE_REF= +cargo build --release --locked -p psychoscript-bench --bin psychoscript-bench --example embed +# (a) +bun bench/ref/bench.ts --iterations 11 ... +target/release/psychoscript-bench --filter --iterations 11 --json +# (b) 20 timed runs each after one untimed run, wall time from bash $EPOCHREALTIME (perl's clock without it) +bun bench/ref/embed.ts +target/release/examples/embed +# (c) -l instead of -v on macOS +/usr/bin/time -v bun bench/ref/run-case.ts +/usr/bin/time -v target/release/psychoscript-bench --filter --iterations 0 +# (d) stat -f %z on macOS +strip -o embed target/release/examples/embed && stat -c %s embed +stat -c %s "$(readlink -f "$(command -v bun)")" +# (e) values must match their originals, on both sides +bun bench/ref/variants.ts --iterations 11 ... +target/release/psychoscript-bench --cases bench/variants --filter --iterations 11 --json +# (f) +bun bench/ref/plugin.ts --runs 2000 bench/plugin/reducer.js bench/plugin/reducer-padded.js bench/plugin/reducer-100k.js +target/release/psychoscript-bench --plugin --runs 2000 bench/plugin/reducer.js bench/plugin/reducer-padded.js bench/plugin/reducer-100k.js +``` diff --git a/packages/codemode-rust/bench/baseline/meta.txt b/packages/codemode-rust/bench/baseline/meta.txt new file mode 100644 index 0000000000000..9c7eb605628e7 --- /dev/null +++ b/packages/codemode-rust/bench/baseline/meta.txt @@ -0,0 +1,5 @@ +command: cd packages/codemode && bun run script/bench.ts --iterations 11 +reference: anomalyco/opencode a9a35b4b4ce35573d71207e246e770cfa26ff0e1 +bun: 1.4.4 +cpu: AMD EPYC 9554P 64-Core Processor, 8 cores +date: 2026-11-17 diff --git a/packages/codemode-rust/bench/baseline/reference-bench.txt b/packages/codemode-rust/bench/baseline/reference-bench.txt new file mode 100644 index 0000000000000..fc577a8a39e1f --- /dev/null +++ b/packages/codemode-rust/bench/baseline/reference-bench.txt @@ -0,0 +1,9 @@ +numeric loop 15.2 ms (min 14.2 ms) +closure recursion (fib 22) 5.2 ms (min 4.9 ms) +array callbacks (50k) 85.0 ms (min 81.2 ms) +promise fan-out (5k) 11.1 ms (min 9.1 ms) +tool fan-out (1k) 10.7 ms (min 8.7 ms) +JSON round-trip 54.6 ms (min 48.4 ms) +generator iteration 5.2 ms (min 5.1 ms) +string building 18.5 ms (min 15.3 ms) +Map/Set ops 20.6 ms (min 14.0 ms) diff --git a/packages/codemode-rust/bench/compare.sh b/packages/codemode-rust/bench/compare.sh new file mode 100644 index 0000000000000..7a3ed39993ad9 --- /dev/null +++ b/packages/codemode-rust/bench/compare.sh @@ -0,0 +1,260 @@ +#!/usr/bin/env bash +# Measures PsychoScript against the reference's language layer (`Runtime.make` from `src/language/` of the CodeMode +# package) and writes bench/RESULTS.md. Both sides run the programs with the same host global, the `tools` namespace +# of conformance/reference.ts and conformance/reference.rs. +# Usage: bash bench/compare.sh. The reference CodeMode package is ../codemode relative to this workspace; set +# CODEMODE_REF to another package directory to override it. +# Needs bun, cargo, jq, strip and /usr/bin/time; runs on Linux and macOS. Rust columns read "n/a" while the core cannot +# run a case. +# ITERATIONS (11), COLD_RUNS (20) and PLUGIN_RUNS (2000) scale the run; CI uses smaller values. +set -uo pipefail +[ -n "${CODEMODE_REF:-}" ] && CODEMODE_REF=$(cd "$CODEMODE_REF" && pwd) +cd "$(dirname "$0")/.." +REF_PKG=${CODEMODE_REF:-../codemode} +[ -f "$REF_PKG/src/language/index.ts" ] || { echo "reference CodeMode package not found at $REF_PKG" >&2; exit 1; } +ITERATIONS=${ITERATIONS:-11} +COLD_RUNS=${COLD_RUNS:-20} +PLUGIN_RUNS=${PLUGIN_RUNS:-2000} +OUT=bench/RESULTS.md +TMP=$(mktemp -d) +trap 'rm -rf "$TMP"' EXIT + +SLUGS=(numeric-loop closure-recursion array-callbacks promise-fan-out tool-fan-out json-round-trip generator-iteration string-building map-set-ops) +NAMES=("numeric loop" "closure recursion (fib 22)" "array callbacks (50k)" "promise fan-out (5k)" "tool fan-out (1k)" "JSON round-trip" "generator iteration" "string building" "Map/Set ops") +BENCH=target/release/psychoscript-bench +EMBED=target/release/examples/embed + +median() { sort -g | awk '{ v[NR] = $1 } END { print v[int(NR / 2) + 1] }'; } +bytes() { stat -c %s "$1" 2>/dev/null || stat -f %z "$1"; } +fmt() { [ -n "$1" ] && printf '%.1f' "$1" || printf 'n/a'; } +ratio() { # numerator, denominator, [printf format] + [ -n "$1" ] && [ -n "$2" ] && awk -v a="$1" -v b="$2" -v f="${3:-%.2f}" 'BEGIN { printf f, a / b }' || printf 'n/a' +} + +echo "building release binaries" >&2 +cargo build --release --locked -p psychoscript-bench --bin psychoscript-bench --example embed >&2 || echo "Rust build failed" >&2 + +# (a) Per-case median and min. +echo "(a) reference bench" >&2 +bun bench/ref/bench.ts --iterations "$ITERATIONS" "${SLUGS[@]}" >"$TMP/ref-bench.txt" || echo "reference bench failed" >&2 +ref_field() { # slug, field (median_ms or min_ms) + grep -F "\"slug\":\"$1\"" "$TMP/ref-bench.txt" | jq -r ".$2 // empty" +} +TABLE_A="| Case | Reference median ms | Reference min ms | Rust median ms | Rust min ms | Median speedup | +|---|---:|---:|---:|---:|---:|" +for i in "${!SLUGS[@]}"; do + slug=${SLUGS[$i]} name=${NAMES[$i]} + echo "(a) rust $slug" >&2 + rm_med="" rm_min="" + if [ -x "$BENCH" ] && "$BENCH" --filter "$slug" --iterations "$ITERATIONS" --json >"$TMP/rust-$slug.json" 2>/dev/null; then + rm_med=$(jq '.[0].median_ms' "$TMP/rust-$slug.json") rm_min=$(jq '.[0].min_ms' "$TMP/rust-$slug.json") + fi + r_med=$(ref_field "$slug" median_ms) r_min=$(ref_field "$slug" min_ms) + speedup=n/a + [ -n "$rm_med" ] && [ -n "$r_med" ] && speedup=$(awk -v r="$r_med" -v s="$rm_med" 'BEGIN { printf "%.1fx", r / s }') + [ "$slug" = tool-fan-out ] && name+=" ¹" + TABLE_A+=" +| $name | $(fmt "$r_med") | $(fmt "$r_min") | $(fmt "$rm_med") | $(fmt "$rm_min") | $speedup |" +done + +# (e) Perturbed variants: each program and an equivalent, differently written one, on both sides in this run. +echo "(e) variants" >&2 +bun bench/ref/variants.ts --iterations "$ITERATIONS" "${SLUGS[@]}" >"$TMP/ref-variants.txt" || + echo "reference variants failed" >&2 +TABLE_E="| Case | Reference original median ms | Reference variant median ms | Reference variant / original | Rust original median ms | Rust variant median ms | Rust variant / original | Rust ratio / reference ratio | +|---|---:|---:|---:|---:|---:|---:|---:|" +for i in "${!SLUGS[@]}"; do + slug=${SLUGS[$i]} + echo "(e) rust $slug" >&2 + ref_line=$(grep -F "\"slug\":\"$slug\"" "$TMP/ref-variants.txt" || true) + ro_med=$(jq -r '.original.median_ms // empty' <<<"$ref_line") rv_med=$(jq -r '.variant.median_ms // empty' <<<"$ref_line") + so_med="" sv_med="" note="" + if [ -x "$BENCH" ] && + "$BENCH" --filter "$slug" --iterations "$ITERATIONS" --json >"$TMP/orig-$slug.json" 2>/dev/null && + "$BENCH" --cases bench/variants --filter "$slug" --iterations "$ITERATIONS" --json >"$TMP/var-$slug.json" 2>/dev/null; then + so_med=$(jq '.[0].median_ms' "$TMP/orig-$slug.json") sv_med=$(jq '.[0].median_ms' "$TMP/var-$slug.json") + [ "$(jq -c '.[0].value' "$TMP/orig-$slug.json")" = "$(jq -c '.[0].value' "$TMP/var-$slug.json")" ] || + note=" (variant result differs)" + fi + r_ratio=$(ratio "$rv_med" "$ro_med") s_ratio=$(ratio "$sv_med" "$so_med") + rel=n/a + [ "$r_ratio" != n/a ] && [ "$s_ratio" != n/a ] && rel=$(ratio "$(ratio "$sv_med" "$so_med" %.6f)" "$(ratio "$rv_med" "$ro_med" %.6f)" '%.2fx') + TABLE_E+=" +| ${NAMES[$i]}$note | $(fmt "$ro_med") | $(fmt "$rv_med") | $r_ratio | $(fmt "$so_med") | $(fmt "$sv_med") | $s_ratio | $rel |" +done + +# (f) Plugin event: the conformance reducer handling a git.status command, PLUGIN_RUNS warm-up then PLUGIN_RUNS timed. +echo "(f) plugin event" >&2 +PLUGIN_SOURCES=(bench/plugin/reducer.js bench/plugin/reducer-padded.js bench/plugin/reducer-100k.js) +bun bench/ref/plugin.ts --runs "$PLUGIN_RUNS" "${PLUGIN_SOURCES[@]}" >"$TMP/ref-plugin.txt" || echo "reference plugin failed" >&2 +[ -x "$BENCH" ] && "$BENCH" --plugin --runs "$PLUGIN_RUNS" "${PLUGIN_SOURCES[@]}" >"$TMP/rust-plugin.txt" 2>/dev/null || + echo "Rust plugin failed" >&2 +TABLE_F="| Source | Bytes | Reference median µs | Reference min µs | Reference mean µs | Rust median µs | Rust min µs | Rust mean µs | Median speedup | +|---|---:|---:|---:|---:|---:|---:|---:|---:|" +TABLE_F_COMPILED="| Source | Bytes | Reference from source µs | Reference compiled µs | Rust from source µs | Rust compiled µs | Compiled median speedup | +|---|---:|---:|---:|---:|---:|---:|" +for source in "${PLUGIN_SOURCES[@]}"; do + ref_line=$(grep -F "\"source\":\"$source\"" "$TMP/ref-plugin.txt" || true) + rust_line=$(grep -F "\"source\":\"$source\"" "$TMP/rust-plugin.txt" 2>/dev/null || true) + field() { jq -r ".$2 // empty" <<<"$1"; } + r_med=$(field "$ref_line" median_us) s_med=$(field "$rust_line" median_us) + TABLE_F+=" +| \`$source\` | $(bytes "$source") | $(fmt "$r_med") | $(fmt "$(field "$ref_line" min_us)") | $(fmt "$(field "$ref_line" mean_us)") | $(fmt "$s_med") | $(fmt "$(field "$rust_line" min_us)") | $(fmt "$(field "$rust_line" mean_us)") | $(ratio "$r_med" "$s_med" '%.1fx') |" + rc_med=$(field "$ref_line" compiled_median_us) sc_med=$(field "$rust_line" compiled_median_us) + TABLE_F_COMPILED+=" +| \`$source\` | $(bytes "$source") | $(fmt "$r_med") | $(fmt "$rc_med") | $(fmt "$s_med") | $(fmt "$sc_med") | $(ratio "$rc_med" "$sc_med" '%.1fx') |" +done + +# (b) Cold start: process start to a printed result for `return 1`, median of COLD_RUNS processes. Without bash 5's +# $EPOCHREALTIME (macOS ships bash 3.2), perl's clock times each run around the command it starts. +cold() { # command... + "$@" >/dev/null 2>&1 || return 1 + if [ -z "${EPOCHREALTIME:-}" ]; then + perl -MTime::HiRes=time -e 'open(my $out, ">&", \*STDOUT); open(STDOUT, ">", "/dev/null"); open(STDERR, ">", "/dev/null"); + my $n = shift; for (1 .. $n) { my $s = time; system(@ARGV) == 0 or exit 1; printf $out "%.3f\n", (time - $s) * 1000 }' \ + "$COLD_RUNS" "$@" + return + fi + for _ in $(seq "$COLD_RUNS"); do + local start=$EPOCHREALTIME + "$@" >/dev/null 2>&1 || return 1 + awk -v a="$start" -v b="$EPOCHREALTIME" 'BEGIN { printf "%.3f\n", (b - a) * 1000 }' + done +} +echo "(b) cold start" >&2 +ref_cold=$(cold bun bench/ref/embed.ts | median) +rust_cold="" +[ -x "$EMBED" ] && rust_cold=$(cold "$EMBED" | median) +TABLE_B="| Implementation | Median wall ms ($COLD_RUNS runs) | +|---|---:| +| Reference (bun bench/ref/embed.ts) | $(fmt "$ref_cold") | +| Rust (embed example) | $(fmt "$rust_cold") |" + +# (c) Peak RSS per case, each case once in a fresh process: GNU time reports KiB, the BSD time on macOS bytes. +rss() { # command... -> MiB + if [ "$(uname -s)" = Darwin ]; then + /usr/bin/time -l "$@" 2>"$TMP/time.txt" >/dev/null || return 1 + awk '/maximum resident set size/ { printf "%.1f\n", $1 / 1048576 }' "$TMP/time.txt" + return + fi + /usr/bin/time -v "$@" 2>"$TMP/time.txt" >/dev/null || return 1 + awk -F': ' '/Maximum resident set size/ { printf "%.1f\n", $2 / 1024 }' "$TMP/time.txt" +} +echo "(c) peak RSS" >&2 +TABLE_C="| Case | Reference peak RSS MiB | Rust peak RSS MiB | +|---|---:|---:|" +for i in "${!SLUGS[@]}"; do + slug=${SLUGS[$i]} + ref_rss=$(rss bun bench/ref/run-case.ts "$slug") + rust_rss="" + [ -x "$BENCH" ] && rust_rss=$(rss "$BENCH" --filter "$slug" --iterations 0) + TABLE_C+=" +| ${NAMES[$i]} | $(fmt "$ref_rss") | $(fmt "$rust_rss") |" +done + +# (d) Shipped size, once the embed example runs. +BUN_BIN=$(readlink -f "$(command -v bun)") +bun_size=$(bytes "$BUN_BIN") +mib() { awk -v b="$1" 'BEGIN { printf "%.2f", b / 1048576 }'; } +embed_row="| Rust embed example, release, stripped | n/a | n/a |" +if [ -x "$EMBED" ] && "$EMBED" >/dev/null 2>&1; then + strip -o "$TMP/embed" "$EMBED" + embed_size=$(bytes "$TMP/embed") + embed_row="| Rust embed example, release, stripped | $embed_size | $(mib "$embed_size") |" +fi +TABLE_D="| Artifact | Bytes | MiB | +|---|---:|---:| +$embed_row +| bun executable (what you ship otherwise) | $bun_size | $(mib "$bun_size") |" + +if [ -r /proc/cpuinfo ]; then + CPU=$(grep -m1 'model name' /proc/cpuinfo | cut -d: -f2 | sed 's/^ //') + MEM=$(awk '/MemTotal/ { printf "%.0f GiB", $2 / 1048576 }' /proc/meminfo) + CORES=$(nproc) OS="Linux $(uname -r)" +else + CPU=$(sysctl -n machdep.cpu.brand_string) + MEM=$(sysctl -n hw.memsize | awk '{ printf "%.0f GiB", $1 / 1073741824 }') + CORES=$(sysctl -n hw.ncpu) OS="macOS $(sw_vers -productVersion) $(uname -m)" +fi +cat >"$OUT" < +cargo build --release --locked -p psychoscript-bench --bin psychoscript-bench --example embed +# (a) +bun bench/ref/bench.ts --iterations $ITERATIONS ... +target/release/psychoscript-bench --filter --iterations $ITERATIONS --json +# (b) $COLD_RUNS timed runs each after one untimed run, wall time from bash \$EPOCHREALTIME (perl's clock without it) +bun bench/ref/embed.ts +target/release/examples/embed +# (c) -l instead of -v on macOS +/usr/bin/time -v bun bench/ref/run-case.ts +/usr/bin/time -v target/release/psychoscript-bench --filter --iterations 0 +# (d) stat -f %z on macOS +strip -o embed target/release/examples/embed && stat -c %s embed +stat -c %s "\$(readlink -f "\$(command -v bun)")" +# (e) values must match their originals, on both sides +bun bench/ref/variants.ts --iterations $ITERATIONS ... +target/release/psychoscript-bench --cases bench/variants --filter --iterations $ITERATIONS --json +# (f) +bun bench/ref/plugin.ts --runs $PLUGIN_RUNS bench/plugin/reducer.js bench/plugin/reducer-padded.js bench/plugin/reducer-100k.js +target/release/psychoscript-bench --plugin --runs $PLUGIN_RUNS bench/plugin/reducer.js bench/plugin/reducer-padded.js bench/plugin/reducer-100k.js +\`\`\` +EOF +echo "wrote $OUT" >&2 diff --git a/packages/codemode-rust/bench/examples/embed.rs b/packages/codemode-rust/bench/examples/embed.rs new file mode 100644 index 0000000000000..daf81c14bde5d --- /dev/null +++ b/packages/codemode-rust/bench/examples/embed.rs @@ -0,0 +1,24 @@ +//! Minimal embedding: the `tools` namespace of the conformance harness, one program, print the result. + +use psychoscript::{HostValue, Runtime}; + +#[path = "../../conformance/reference.rs"] +mod reference; + +fn main() { + let runtime = Runtime::make().globals(|_| [("tools", HostValue::from(reference::tools()))]); + let code = std::env::args() + .nth(1) + .unwrap_or_else(|| "return 1".to_owned()); + let outcome = runtime.execute(&code); + for line in &outcome.logs { + eprintln!("{line}"); + } + match outcome.result { + Ok(value) => println!("{value}"), + Err(d) => { + eprintln!("{}: {}", d.kind, d.message); + std::process::exit(1); + } + } +} diff --git a/packages/codemode-rust/bench/examples/gc_bench.rs b/packages/codemode-rust/bench/examples/gc_bench.rs new file mode 100644 index 0000000000000..97d1a9eb9a0f2 --- /dev/null +++ b/packages/codemode-rust/bench/examples/gc_bench.rs @@ -0,0 +1,438 @@ +//! Memory benchmarks for long-lived runs: a program looping on `await nextEvent()`, driven as a future on this +//! thread the way an OpenTUI host drives its plugins. Build with `--features gc-stats`. +//! +//! Usage: +//! - `gc_bench loop PROGRAM [--events N]`: one run of `bench/gc/PROGRAM.js` handling N events. +//! - `gc_bench many [--heaps 50] [--active 5] [--frames N]`: 50 runs in one process; 5 get an event each frame and the +//! rest wait, idle. +//! - `gc_bench all [--events N] [--frames N]`: every program, then `many`, each in a fresh process. +//! +//! Each prints one JSON line: event (or frame) latency percentiles, live and peak bytes the allocator counted, the +//! process's physical footprint, the run's heap counts and collection pauses (`Run::heap_stats`), and the allocation +//! rate. A run that fails, for example at its memory limit, reports how many events it handled first. + +use std::alloc::{GlobalAlloc, Layout, System}; +use std::collections::VecDeque; +use std::future::Future; +use std::pin::Pin; +use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; +use std::sync::{Arc, Mutex}; +use std::task::{Context, Poll, Wake, Waker}; +use std::time::{Duration, Instant}; + +use psychoscript::{ + HostFunction, HostValue, Interrupted, Limits, Outcome, ProgramOptions, Run, Runtime, +}; +use serde_json::{Value as Json, json}; + +#[path = "../src/counters.rs"] +mod counters; + +const PROGRAMS: [&str; 7] = [ + "palette", + "growing", + "map-churn", + "strings", + "closures", + "generators", + "large", +]; +const QUERIES: [&str; 8] = ["1", "12", "Com", "k3", "group2", "number 2", "x", "C"]; + +fn main() { + let mut args = std::env::args().skip(1); + let mode = args.next().unwrap_or_else(|| "all".into()); + let mut program = String::from("palette"); + let (mut events, mut frames, mut heaps, mut active) = + (20_000usize, 20_000usize, 50usize, 5usize); + while let Some(arg) = args.next() { + let mut num = || args.next().and_then(|n| n.parse().ok()).expect("a number"); + match arg.as_str() { + "--events" => events = num(), + "--frames" => frames = num(), + "--heaps" => heaps = num(), + "--active" => active = num(), + name if mode == "loop" => program = name.into(), + other => panic!("unknown argument {other}"), + } + } + match mode.as_str() { + "loop" => println!("{}", one_loop(&program, events)), + "many" => println!("{}", many(heaps, active, frames)), + "all" => { + let me = std::env::current_exe().expect("own path"); + let mut runs: Vec> = PROGRAMS + .iter() + .map(|p| { + vec![ + "loop".into(), + p.to_string(), + "--events".into(), + events.to_string(), + ] + }) + .collect(); + runs.push(vec!["many".into(), "--frames".into(), frames.to_string()]); + for run in runs { + let out = std::process::Command::new(&me) + .args(&run) + .output() + .expect("spawn"); + print!("{}", String::from_utf8_lossy(&out.stdout)); + if !out.status.success() { + eprintln!("{run:?} failed: {}", String::from_utf8_lossy(&out.stderr)); + } + } + } + other => panic!("unknown mode {other}"), + } +} + +fn one_loop(program: &str, events: usize) -> Json { + let mut live = LiveRun::start(program); + let total_before = TOTAL.load(Ordering::Relaxed); + let start = Instant::now(); + let mut latencies = Vec::with_capacity(events); + let mut max_live = 0; + let mut curve = Vec::new(); + let mut handled = 0; + for i in 0..events { + let t = Instant::now(); + if !live.event(event(i)) { + break; + } + latencies.push(t.elapsed().as_nanos() as u64); + handled += 1; + let now = LIVE.load(Ordering::Relaxed); + max_live = max_live.max(now); + if (i + 1) % (events / 10).max(1) == 0 { + curve.push(now / 1024); + } + } + let wall = start.elapsed(); + let allocated = TOTAL.load(Ordering::Relaxed) - total_before; + let stats = live.stats(); + let live_end = LIVE.load(Ordering::Relaxed); + let failure = live.finish(); + json!({ + "scenario": format!("loop {program}"), + "events": handled, + "failure": failure, + "wall_ms": wall.as_secs_f64() * 1e3, + "event_us": percentiles(&mut latencies, 1e3), + "alloc_mb_per_s": allocated as f64 / wall.as_secs_f64() / (1 << 20) as f64, + "live_kib_end": live_end / 1024, + "live_kib_max": max_live / 1024, + "live_kib_curve": curve, + "peak_kib": PEAK.load(Ordering::Relaxed) / 1024, + "footprint": footprint(), + "heap": heap_json(&stats), + }) +} + +/// `heaps` runs of the six small programs in turn; the first `active` get an event each frame. +fn many(heaps: usize, active: usize, frames: usize) -> Json { + // The six small programs: `large` is the one-heap case of a big live set. + let mix = &PROGRAMS[..6]; + let mut runs: Vec = (0..heaps) + .map(|k| LiveRun::start(mix[k % mix.len()])) + .collect(); + let idle_before: Vec = runs[active..].iter().map(|r| r.stats().steps).collect(); + let live_setup = LIVE.load(Ordering::Relaxed); + let total_before = TOTAL.load(Ordering::Relaxed); + let start = Instant::now(); + let mut latencies = Vec::with_capacity(frames); + let mut handled = 0; + let mut failures = Vec::new(); + 'frames: for f in 0..frames { + let t = Instant::now(); + for (k, run) in runs[..active].iter_mut().enumerate() { + if !run.event(event(f * active + k)) { + failures.push(json!({ "run": k, "frame": f, "failure": run.failure() })); + break 'frames; + } + } + latencies.push(t.elapsed().as_nanos() as u64); + handled += 1; + } + let wall = start.elapsed(); + let allocated = TOTAL.load(Ordering::Relaxed) - total_before; + let all: Vec<_> = runs.iter().map(|r| r.stats()).collect(); + let idle_steps: u64 = all[active..] + .iter() + .zip(&idle_before) + .map(|(s, b)| s.steps - b) + .sum(); + let mut pauses: Vec = all + .iter() + .flat_map(|s| s.pauses_ns.iter().map(|p| *p as u64)) + .collect(); + json!({ + "scenario": format!("many {heaps} heaps, {active} active"), + "frames": handled, + "failures": failures, + "wall_ms": wall.as_secs_f64() * 1e3, + "frame_us": percentiles(&mut latencies, 1e3), + "alloc_mb_per_s": allocated as f64 / wall.as_secs_f64() / (1 << 20) as f64, + "live_kib_after_setup": live_setup / 1024, + "live_kib_end": LIVE.load(Ordering::Relaxed) / 1024, + "peak_kib": PEAK.load(Ordering::Relaxed) / 1024, + "footprint": footprint(), + "objects": all.iter().map(|s| s.objects).sum::(), + "peak_objects": all.iter().map(|s| s.peak_objects).sum::(), + "strings": all.iter().map(|s| s.strings).sum::(), + "gc_steps": all.iter().map(|s| s.steps).sum::(), + "gc_ms": all.iter().map(|s| s.gc_ns).sum::() as f64 / 1e6, + "gc_steps_while_idle": idle_steps, + "pause_us": percentiles(&mut pauses, 1e3), + }) +} + +fn event(i: usize) -> HostValue { + HostValue::Object(vec![ + ("i".into(), HostValue::from(i as f64)), + ("query".into(), HostValue::from(QUERIES[i % QUERIES.len()])), + ]) +} + +fn heap_json(s: &psychoscript::HeapStats) -> Json { + let mut pauses: Vec = s.pauses_ns.iter().map(|p| *p as u64).collect(); + json!({ + "objects": s.objects, "peak_objects": s.peak_objects, + "cells": s.cells, "peak_cells": s.peak_cells, + "strings": s.strings, "peak_strings": s.peak_strings, + "atoms": s.atoms, "peak_atoms": s.peak_atoms, + "gc_steps": s.steps, "gc_ms": s.gc_ns as f64 / 1e6, + "pause_us": percentiles(&mut pauses, 1e3), + }) +} + +fn percentiles(samples: &mut [u64], unit: f64) -> Json { + if samples.is_empty() { + return Json::Null; + } + samples.sort_unstable(); + let at = |q: f64| samples[((samples.len() - 1) as f64 * q).round() as usize] as f64 / unit; + json!({ "p50": at(0.5), "p99": at(0.99), "max": at(1.0), "n": samples.len() }) +} + +fn footprint() -> Json { + counters::usage().map_or( + Json::Null, + |u| json!({ "kib": u.footprint / 1024, "peak_kib": u.peak_footprint / 1024 }), + ) +} + +/// A long-lived run and its event queue. +struct LiveRun { + feed: Arc, + run: Arc>>, + future: Pin> + 'static>>, + woken: Arc, + done: Option>, +} + +#[derive(Default)] +struct Feed { + inner: Mutex, +} + +#[derive(Default)] +struct FeedInner { + events: VecDeque, + /// The run is waiting in `nextEvent`. + waiting: Option, +} + +impl Feed { + fn lock(&self) -> std::sync::MutexGuard<'_, FeedInner> { + self.inner.lock().unwrap_or_else(|e| e.into_inner()) + } +} + +struct Next(Arc); + +impl Future for Next { + type Output = Result; + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + let mut inner = self.0.lock(); + match inner.events.pop_front() { + Some(e) => { + inner.waiting = None; + Poll::Ready(Ok(e)) + } + None => { + inner.waiting = Some(cx.waker().clone()); + Poll::Pending + } + } + } +} + +/// Wakes the driving thread. +struct Woken { + flag: AtomicBool, + thread: std::thread::Thread, +} + +impl Wake for Woken { + fn wake(self: Arc) { + self.flag.store(true, Ordering::Release); + self.thread.unpark(); + } +} + +impl LiveRun { + /// A runtime whose `nextEvent` serves `feed`, and which hands each run's handle to `slot`. + fn runtime(feed: &Arc, slot: &Arc>>) -> Runtime { + let (feed, slot) = (feed.clone(), slot.clone()); + Runtime::make() + .limits(Limits { + timeout_ms: None, + max_output_bytes: None, + }) + .globals(move |run| { + *slot.lock().unwrap() = Some(run.clone()); + let feed = feed.clone(); + [ + ( + "nextEvent", + HostFunction::new_async(move |_, _| Next(feed.clone())), + ), + ("render", HostFunction::new(|_, _| HostValue::Undefined)), + ] + }) + } + + /// Starts `bench/gc/PROGRAM.js` and runs it until it waits for its first event. + /// The runtime, source and options live as long as the process, which ends after one scenario. + fn start(program: &str) -> Self { + let path = format!("{}/gc/{program}.js", env!("CARGO_MANIFEST_DIR")); + let code = std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{path}: {e}")); + let feed = Arc::new(Feed::default()); + let run = Arc::new(Mutex::new(None)); + let runtime: &'static Runtime = Box::leak(Box::new(Self::runtime(&feed, &run))); + let code: &'static str = Box::leak(code.into_boxed_str()); + let options: &'static ProgramOptions = Box::leak(Box::new(ProgramOptions::new())); + let mut live = LiveRun { + feed, + run, + future: Box::pin(runtime.program(code, options).run_async()), + woken: Arc::new(Woken { + flag: AtomicBool::new(false), + thread: std::thread::current(), + }), + done: None, + }; + live.pump(); + assert!( + live.done.is_none(), + "{program} ended during setup: {:?}", + live.failure() + ); + live + } + + /// Delivers one event and runs until the program waits for the next; false once the run has ended. + fn event(&mut self, e: HostValue) -> bool { + let waker = { + let mut inner = self.feed.lock(); + inner.events.push_back(e); + inner.waiting.take() + }; + if let Some(w) = waker { + w.wake(); + } + self.pump(); + self.done.is_none() + } + + fn pump(&mut self) { + let waker = Waker::from(self.woken.clone()); + let mut cx = Context::from_waker(&waker); + loop { + self.woken.flag.store(false, Ordering::Release); + if let Poll::Ready(o) = self.future.as_mut().poll(&mut cx) { + self.done = Some(o); + return; + } + let idle = { + let inner = self.feed.lock(); + inner.waiting.is_some() && inner.events.is_empty() + }; + if idle { + return; + } + // Away on its worker for a long stretch: wait for it to come back. + while !self.woken.flag.load(Ordering::Acquire) { + std::thread::park_timeout(Duration::from_millis(1)); + } + } + } + + fn stats(&self) -> psychoscript::HeapStats { + self.run + .lock() + .unwrap() + .as_ref() + .map(|r| r.heap_stats()) + .unwrap_or_default() + } + + fn failure(&self) -> Json { + match &self.done { + None => Json::Null, + Some(Err(_)) => json!("interrupted"), + Some(Ok(o)) => match &o.result { + Ok(v) => json!({ "returned": v.to_json() }), + Err(d) => json!(d.message_lossy()), + }, + } + } + + /// Ends the program with a `null` event; its failure, if it had one. + fn finish(mut self) -> Json { + if self.done.is_none() { + self.event(HostValue::Null); + } + match &self.done { + Some(Ok(o)) if o.result.is_ok() => Json::Null, + _ => self.failure(), + } + } +} + +/// Counts the bytes the process holds and has allocated, for live and peak heap and the allocation rate. +struct Counting; + +static LIVE: AtomicUsize = AtomicUsize::new(0); +static PEAK: AtomicUsize = AtomicUsize::new(0); +static TOTAL: AtomicUsize = AtomicUsize::new(0); + +fn grew(n: usize) { + let now = LIVE.fetch_add(n, Ordering::Relaxed) + n; + PEAK.fetch_max(now, Ordering::Relaxed); + TOTAL.fetch_add(n, Ordering::Relaxed); +} + +// SAFETY: every call forwards to the system allocator unchanged; the counters only observe sizes. +unsafe impl GlobalAlloc for Counting { + unsafe fn alloc(&self, layout: Layout) -> *mut u8 { + grew(layout.size()); + unsafe { System.alloc(layout) } + } + + unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { + LIVE.fetch_sub(layout.size(), Ordering::Relaxed); + unsafe { System.dealloc(ptr, layout) } + } + + unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 { + LIVE.fetch_sub(layout.size(), Ordering::Relaxed); + grew(new_size); + unsafe { System.realloc(ptr, layout, new_size) } + } +} + +#[global_allocator] +static ALLOCATOR: Counting = Counting; diff --git a/packages/codemode-rust/bench/examples/stack_probe.rs b/packages/codemode-rust/bench/examples/stack_probe.rs new file mode 100644 index 0000000000000..9ab5aad20eb11 --- /dev/null +++ b/packages/codemode-rust/bench/examples/stack_probe.rs @@ -0,0 +1,155 @@ +//! Measures the native stack a program needs, by running it on threads of different stack sizes in child processes +//! and bisecting for the smallest size that does not overflow. +//! +//! `stack_probe` prints, for each construct, the stack bytes per nesting level of compiling it. +//! `stack_probe [run]` compiles (and with `run`, runs) one program and exits 0. + +use psychoscript::{ProgramOptions, Runtime}; + +const CONSTRUCTS: &[&str] = &[ + "parens", + "arrays", + "objects", + "blocks", + "calls", + "arrows", + "functions", + "if-else", + "if", + "unary", + "ternary", + "assign", + "binary", + "members", + "template", + "typeof", + "void", + "await", + "new", + "negate", + "spread", + "destructure", + "pattern", + "optional", + "labels", + "while", +]; + +fn source(construct: &str, n: usize) -> String { + let rep = |s: &str| s.repeat(n); + match construct { + "parens" => format!("return {}1{}", rep("("), rep(")")), + "arrays" => format!("return {}1{}", rep("["), rep("]")), + "objects" => format!("return {}1{}", rep("{a:"), rep("}")), + "blocks" => format!("{}{}return 1", rep("{"), rep("}")), + "calls" => format!("const f = (x) => x; return {}1{}", rep("f("), rep(")")), + "arrows" => format!("return {}1", rep("() => ")), + "functions" => format!("return {}1{}", rep("function () { return "), rep(" }")), + "if-else" => format!("let a = 1; {}{{}} return 1", rep("if (a) {} else ")), + "if" => format!("let a = 1; {}a = 2; return a", rep("if (a) ")), + "unary" => format!("return {}1", rep("!")), + "ternary" => format!("let a = 1; return {}0", rep("a ? 1 : ")), + "assign" => format!("let a; return {}1", rep("a = ")), + "binary" => format!("return 1{}", rep(" + 1")), + "members" => format!( + "const o = {{ a() {{ return o }} }}; return o{}", + rep(".a()") + ), + "template" => format!("return {}1{}", rep("`${"), rep("}`")), + "typeof" => format!("return {}1", rep("typeof ")), + "void" => format!("return {}1", rep("void ")), + "await" => format!("return {}1", rep("await ")), + "new" => format!("function F() {{}} return {}F{}", rep("new "), rep("()")), + "negate" => format!("return {}1", rep("- ")), + "spread" => format!("return {}1{}", rep("[..."), rep("]")), + "destructure" => format!("const {}a{} = 1; return 1", rep("["), rep("]")), + "pattern" => format!("let a; ({}a{} = {{}}); return 1", rep("{a:"), rep("}")), + "optional" => format!("const o = {{}}; return o{}", rep("?.a")), + "labels" => format!( + "{}break a0; return 1", + (0..n).map(|i| format!("a{i}: ")).collect::() + ), + "while" => format!("let a = 0; {}a = 1; return a", rep("while (a) ")), + // Native re-entrancy at run time: each level calls back into the VM through a built-in. + "map" => { + format!("function f(n) {{ return n ? [n].map((x) => f(x - 1))[0] : 0 }} return f({n})") + } + "sort" => format!( + "function f(n) {{ if (n) [2, 1].sort((a, b) => (f(n - 1), a - b)); return 0 }} return f({n})" + ), + "tostring" => format!( + "function f(n) {{ return n ? String({{ toString() {{ return f(n - 1) }} }}) : '0' }} return f({n})" + ), + "replace" => format!( + "function f(n) {{ return n ? 'a'.replace('a', () => f(n - 1)) : '0' }} return f({n})" + ), + other => panic!("unknown construct {other}"), + } +} + +fn main() { + let args: Vec = std::env::args().skip(1).collect(); + if args.len() >= 3 { + let (construct, depth, stack) = + (&args[0], args[1].parse().unwrap(), args[2].parse().unwrap()); + let run = args.get(3).is_some_and(|a| a == "run"); + let code = source(construct, depth); + let ok = std::thread::Builder::new() + .stack_size(stack) + .spawn(move || { + let rt = Runtime::make(); + let program = rt.program(&code, &ProgramOptions::new()); + if run { + let outcome = program.run().expect("not interrupted"); + if let Err(d) = outcome.result { + eprintln!("{:?}", d.message); + return false; + } + } + true + }) + .unwrap() + .join() + .unwrap(); + std::process::exit(if ok { 0 } else { 2 }); + } + let run = args.first().is_some_and(|a| a == "run"); + let constructs: Vec<&str> = if run { + vec!["map", "sort", "tostring", "replace"] + } else { + CONSTRUCTS.to_vec() + }; + let (lo, hi) = match (run, cfg!(debug_assertions)) { + (true, true) => (500, 4500), + (true, false) => (500, 4500), + _ => (200, 600), + }; + for construct in constructs { + let a = smallest(construct, lo, run); + let b = smallest(construct, hi, run); + let per = (b as f64 - a as f64) / (hi - lo) as f64; + println!("{construct:10} {lo}: {a:>9} B {hi}: {b:>9} B per level: {per:>7.0} B"); + } +} + +/// The smallest thread stack, to 1 KiB, that runs the construct at that depth. +fn smallest(construct: &str, depth: usize, run: bool) -> usize { + let exe = std::env::current_exe().unwrap(); + let ok = |stack: usize| { + let mut cmd = std::process::Command::new(&exe); + cmd.args([construct, &depth.to_string(), &stack.to_string()]); + if run { + cmd.arg("run"); + } + cmd.stderr(std::process::Stdio::null()) + .status() + .is_ok_and(|s| s.success()) + }; + let (mut lo, mut hi) = (16 << 10, 512 << 20); + assert!(ok(hi), "{construct} at {depth} fails even with {hi} bytes"); + while hi - lo > 1024 { + let mid = (lo + hi) / 2; + if ok(mid) { hi = mid } else { lo = mid } + } + hi +} diff --git a/packages/codemode-rust/bench/gc/closures.js b/packages/codemode-rust/bench/gc/closures.js new file mode 100644 index 0000000000000..e149b10f7c256 --- /dev/null +++ b/packages/codemode-rust/bench/gc/closures.js @@ -0,0 +1,18 @@ +// Closures: each event makes handlers that capture its state, and keeps the latest ten. +let handlers = [] +let total = 0 +while (true) { + const e = await nextEvent() + if (e === null) return total + for (let j = 0; j < 30; j++) { + let count = j + const label = e.query + j + handlers.push(() => { + count++ + return label.length + count + }) + } + handlers = handlers.slice(-10) + for (const h of handlers) total += h() + render(String(total)) +} diff --git a/packages/codemode-rust/bench/gc/generators.js b/packages/codemode-rust/bench/gc/generators.js new file mode 100644 index 0000000000000..41f1a6da31339 --- /dev/null +++ b/packages/codemode-rust/bench/gc/generators.js @@ -0,0 +1,17 @@ +// Generators kept alive: a few long-lived ones advance each event, and each event starts and drops short ones. +function* counter(prefix) { + let i = 0 + while (true) yield { text: prefix + i++ } +} +const alive = [counter("a"), counter("b"), counter("c")] +let sum = 0 +while (true) { + const e = await nextEvent() + if (e === null) return sum + for (const g of alive) sum += g.next().value.text.length + for (let j = 0; j < 10; j++) { + const g = counter(e.query) + for (let k = 0; k < 5; k++) sum += g.next().value.text.length + } + render(String(sum)) +} diff --git a/packages/codemode-rust/bench/gc/growing.js b/packages/codemode-rust/bench/gc/growing.js new file mode 100644 index 0000000000000..116d6098fa864 --- /dev/null +++ b/packages/codemode-rust/bench/gc/growing.js @@ -0,0 +1,10 @@ +// A growing live set: each event keeps one record in a log and throws away some scratch work. +const log = [] +while (true) { + const e = await nextEvent() + if (e === null) return log.length + const scratch = [] + for (let j = 0; j < 20; j++) scratch.push({ j, label: "s" + j + ":" + e.i }) + log.push({ i: e.i, query: e.query, tag: "event " + e.i, size: scratch.length }) + render(log[log.length - 1].tag) +} diff --git a/packages/codemode-rust/bench/gc/large.js b/packages/codemode-rust/bench/gc/large.js new file mode 100644 index 0000000000000..5fc8b361a8d24 --- /dev/null +++ b/packages/codemode-rust/bench/gc/large.js @@ -0,0 +1,17 @@ +// A large live set: 200,000 records (about 600,000 objects and strings) stay reachable while each event updates 50 +// of them with new values and throws away a page of derived rows. +const records = [] +for (let i = 0; i < 200000; i++) records.push({ id: i, name: "record " + i, tags: [i % 7, i % 11] }) +let n = 0 +while (true) { + const e = await nextEvent() + if (e === null) return n + for (let j = 0; j < 50; j++) { + const r = records[(e.i * 50 + j) % records.length] + r.tags = [e.i, j] + n += r.name.length + } + const from = (e.i * 7) % 1000 + const page = records.slice(from, from + 200).map((r) => ({ id: r.id, label: r.name + "!" })) + render(String(page.length + n)) +} diff --git a/packages/codemode-rust/bench/gc/map-churn.js b/packages/codemode-rust/bench/gc/map-churn.js new file mode 100644 index 0000000000000..32cac3d53db29 --- /dev/null +++ b/packages/codemode-rust/bench/gc/map-churn.js @@ -0,0 +1,17 @@ +// A churning Map and Set: each event adds entries and deletes old ones, so both stay near 2,000 entries. +const m = new Map() +const s = new Set() +let n = 0 +while (true) { + const e = await nextEvent() + if (e === null) return m.size + s.size + for (let j = 0; j < 20; j++, n++) { + m.set("key" + n, { n, at: e.i }) + s.add(n) + if (n >= 2000) { + m.delete("key" + (n - 2000)) + s.delete(n - 2000) + } + } + render(String(m.size)) +} diff --git a/packages/codemode-rust/bench/gc/palette.js b/packages/codemode-rust/bench/gc/palette.js new file mode 100644 index 0000000000000..e2b2a76ad1bd0 --- /dev/null +++ b/packages/codemode-rust/bench/gc/palette.js @@ -0,0 +1,19 @@ +// A command palette: each event filters 300 commands by a query and renders the top rows. Only the selection +// survives an event; everything else it allocates is garbage by the next one. +const commands = Array.from({ length: 300 }, (_, i) => ({ + id: "cmd." + i, + title: "Command number " + i, + keywords: ["k" + (i % 17), "group" + (i % 5)], +})) +let selected = 0 +while (true) { + const e = await nextEvent() + if (e === null) return { selected } + const q = e.query + const rows = commands + .filter((c) => c.title.includes(q) || c.keywords.some((k) => k.startsWith(q))) + .map((c, i) => ({ key: c.id, text: (i === selected ? "> " : " ") + c.title.toUpperCase(), score: c.title.length - q.length })) + rows.sort((a, b) => a.score - b.score || (a.key < b.key ? -1 : 1)) + selected = (selected + 1) % Math.max(rows.length, 1) + render(rows.slice(0, 20).map((r) => `${r.key}: ${r.text}`).join("\n")) +} diff --git a/packages/codemode-rust/bench/gc/strings.js b/packages/codemode-rust/bench/gc/strings.js new file mode 100644 index 0000000000000..b81d8f8eab419 --- /dev/null +++ b/packages/codemode-rust/bench/gc/strings.js @@ -0,0 +1,10 @@ +// String building: each event builds a few KB of text with += and templates, and keeps only the last one. +let last = "" +while (true) { + const e = await nextEvent() + if (e === null) return last.length + let out = "" + for (let j = 0; j < 60; j++) out += `row ${j} of event ${e.i}: ${e.query.repeat(3)}\n` + last = out.toUpperCase() + render(last.slice(0, 40)) +} diff --git a/packages/codemode-rust/bench/plugin/reducer-100k.js b/packages/codemode-rust/bench/plugin/reducer-100k.js new file mode 100644 index 0000000000000..bca952ec04390 --- /dev/null +++ b/packages/codemode-rust/bench/plugin/reducer-100k.js @@ -0,0 +1,412 @@ +if (event.type === "init") return { state: { runs: 0 }, commands: [{ name: "git.status", key: "ctrl+g" }] } +if (event.type === "command" && event.name === "git.task0") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task0" }, slots: { statusbar: { text: "task0 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task1") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task1" }, slots: { statusbar: { text: "task1 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task2") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task2" }, slots: { statusbar: { text: "task2 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task3") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task3" }, slots: { statusbar: { text: "task3 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task4") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task4" }, slots: { statusbar: { text: "task4 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task5") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task5" }, slots: { statusbar: { text: "task5 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task6") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task6" }, slots: { statusbar: { text: "task6 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task7") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task7" }, slots: { statusbar: { text: "task7 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task8") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task8" }, slots: { statusbar: { text: "task8 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task9") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task9" }, slots: { statusbar: { text: "task9 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task10") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task10" }, slots: { statusbar: { text: "task10 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task11") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task11" }, slots: { statusbar: { text: "task11 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task12") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task12" }, slots: { statusbar: { text: "task12 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task13") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task13" }, slots: { statusbar: { text: "task13 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task14") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task14" }, slots: { statusbar: { text: "task14 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task15") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task15" }, slots: { statusbar: { text: "task15 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task16") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task16" }, slots: { statusbar: { text: "task16 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task17") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task17" }, slots: { statusbar: { text: "task17 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task18") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task18" }, slots: { statusbar: { text: "task18 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task19") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task19" }, slots: { statusbar: { text: "task19 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task20") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task20" }, slots: { statusbar: { text: "task20 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task21") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task21" }, slots: { statusbar: { text: "task21 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task22") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task22" }, slots: { statusbar: { text: "task22 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task23") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task23" }, slots: { statusbar: { text: "task23 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task24") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task24" }, slots: { statusbar: { text: "task24 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task25") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task25" }, slots: { statusbar: { text: "task25 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task26") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task26" }, slots: { statusbar: { text: "task26 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task27") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task27" }, slots: { statusbar: { text: "task27 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task28") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task28" }, slots: { statusbar: { text: "task28 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task29") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task29" }, slots: { statusbar: { text: "task29 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task30") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task30" }, slots: { statusbar: { text: "task30 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task31") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task31" }, slots: { statusbar: { text: "task31 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task32") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task32" }, slots: { statusbar: { text: "task32 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task33") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task33" }, slots: { statusbar: { text: "task33 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task34") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task34" }, slots: { statusbar: { text: "task34 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task35") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task35" }, slots: { statusbar: { text: "task35 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task36") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task36" }, slots: { statusbar: { text: "task36 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task37") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task37" }, slots: { statusbar: { text: "task37 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task38") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task38" }, slots: { statusbar: { text: "task38 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task39") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task39" }, slots: { statusbar: { text: "task39 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task40") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task40" }, slots: { statusbar: { text: "task40 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task41") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task41" }, slots: { statusbar: { text: "task41 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task42") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task42" }, slots: { statusbar: { text: "task42 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task43") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task43" }, slots: { statusbar: { text: "task43 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task44") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task44" }, slots: { statusbar: { text: "task44 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task45") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task45" }, slots: { statusbar: { text: "task45 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task46") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task46" }, slots: { statusbar: { text: "task46 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task47") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task47" }, slots: { statusbar: { text: "task47 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task48") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task48" }, slots: { statusbar: { text: "task48 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task49") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task49" }, slots: { statusbar: { text: "task49 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task50") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task50" }, slots: { statusbar: { text: "task50 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task51") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task51" }, slots: { statusbar: { text: "task51 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task52") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task52" }, slots: { statusbar: { text: "task52 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task53") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task53" }, slots: { statusbar: { text: "task53 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task54") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task54" }, slots: { statusbar: { text: "task54 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task55") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task55" }, slots: { statusbar: { text: "task55 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task56") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task56" }, slots: { statusbar: { text: "task56 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task57") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task57" }, slots: { statusbar: { text: "task57 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task58") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task58" }, slots: { statusbar: { text: "task58 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task59") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task59" }, slots: { statusbar: { text: "task59 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task60") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task60" }, slots: { statusbar: { text: "task60 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task61") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task61" }, slots: { statusbar: { text: "task61 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task62") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task62" }, slots: { statusbar: { text: "task62 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task63") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task63" }, slots: { statusbar: { text: "task63 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task64") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task64" }, slots: { statusbar: { text: "task64 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task65") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task65" }, slots: { statusbar: { text: "task65 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task66") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task66" }, slots: { statusbar: { text: "task66 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task67") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task67" }, slots: { statusbar: { text: "task67 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task68") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task68" }, slots: { statusbar: { text: "task68 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task69") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task69" }, slots: { statusbar: { text: "task69 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task70") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task70" }, slots: { statusbar: { text: "task70 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task71") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task71" }, slots: { statusbar: { text: "task71 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task72") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task72" }, slots: { statusbar: { text: "task72 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task73") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task73" }, slots: { statusbar: { text: "task73 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task74") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task74" }, slots: { statusbar: { text: "task74 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task75") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task75" }, slots: { statusbar: { text: "task75 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task76") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task76" }, slots: { statusbar: { text: "task76 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task77") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task77" }, slots: { statusbar: { text: "task77 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task78") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task78" }, slots: { statusbar: { text: "task78 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task79") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task79" }, slots: { statusbar: { text: "task79 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task80") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task80" }, slots: { statusbar: { text: "task80 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task81") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task81" }, slots: { statusbar: { text: "task81 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task82") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task82" }, slots: { statusbar: { text: "task82 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task83") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task83" }, slots: { statusbar: { text: "task83 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task84") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task84" }, slots: { statusbar: { text: "task84 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task85") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task85" }, slots: { statusbar: { text: "task85 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task86") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task86" }, slots: { statusbar: { text: "task86 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task87") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task87" }, slots: { statusbar: { text: "task87 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task88") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task88" }, slots: { statusbar: { text: "task88 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task89") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task89" }, slots: { statusbar: { text: "task89 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task90") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task90" }, slots: { statusbar: { text: "task90 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task91") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task91" }, slots: { statusbar: { text: "task91 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task92") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task92" }, slots: { statusbar: { text: "task92 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task93") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task93" }, slots: { statusbar: { text: "task93 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task94") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task94" }, slots: { statusbar: { text: "task94 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task95") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task95" }, slots: { statusbar: { text: "task95 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task96") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task96" }, slots: { statusbar: { text: "task96 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task97") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task97" }, slots: { statusbar: { text: "task97 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task98") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task98" }, slots: { statusbar: { text: "task98 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task99") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task99" }, slots: { statusbar: { text: "task99 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task100") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task100" }, slots: { statusbar: { text: "task100 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task101") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task101" }, slots: { statusbar: { text: "task101 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task102") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task102" }, slots: { statusbar: { text: "task102 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task103") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task103" }, slots: { statusbar: { text: "task103 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task104") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task104" }, slots: { statusbar: { text: "task104 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task105") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task105" }, slots: { statusbar: { text: "task105 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task106") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task106" }, slots: { statusbar: { text: "task106 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task107") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task107" }, slots: { statusbar: { text: "task107 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task108") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task108" }, slots: { statusbar: { text: "task108 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task109") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task109" }, slots: { statusbar: { text: "task109 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task110") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task110" }, slots: { statusbar: { text: "task110 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task111") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task111" }, slots: { statusbar: { text: "task111 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task112") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task112" }, slots: { statusbar: { text: "task112 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task113") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task113" }, slots: { statusbar: { text: "task113 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task114") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task114" }, slots: { statusbar: { text: "task114 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task115") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task115" }, slots: { statusbar: { text: "task115 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task116") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task116" }, slots: { statusbar: { text: "task116 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task117") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task117" }, slots: { statusbar: { text: "task117 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task118") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task118" }, slots: { statusbar: { text: "task118 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task119") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task119" }, slots: { statusbar: { text: "task119 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task120") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task120" }, slots: { statusbar: { text: "task120 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task121") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task121" }, slots: { statusbar: { text: "task121 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task122") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task122" }, slots: { statusbar: { text: "task122 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task123") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task123" }, slots: { statusbar: { text: "task123 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task124") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task124" }, slots: { statusbar: { text: "task124 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task125") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task125" }, slots: { statusbar: { text: "task125 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task126") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task126" }, slots: { statusbar: { text: "task126 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task127") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task127" }, slots: { statusbar: { text: "task127 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task128") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task128" }, slots: { statusbar: { text: "task128 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task129") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task129" }, slots: { statusbar: { text: "task129 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task130") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task130" }, slots: { statusbar: { text: "task130 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task131") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task131" }, slots: { statusbar: { text: "task131 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task132") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task132" }, slots: { statusbar: { text: "task132 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task133") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task133" }, slots: { statusbar: { text: "task133 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task134") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task134" }, slots: { statusbar: { text: "task134 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task135") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task135" }, slots: { statusbar: { text: "task135 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task136") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task136" }, slots: { statusbar: { text: "task136 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task137") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task137" }, slots: { statusbar: { text: "task137 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task138") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task138" }, slots: { statusbar: { text: "task138 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task139") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task139" }, slots: { statusbar: { text: "task139 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task140") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task140" }, slots: { statusbar: { text: "task140 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task141") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task141" }, slots: { statusbar: { text: "task141 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task142") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task142" }, slots: { statusbar: { text: "task142 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task143") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task143" }, slots: { statusbar: { text: "task143 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task144") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task144" }, slots: { statusbar: { text: "task144 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task145") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task145" }, slots: { statusbar: { text: "task145 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task146") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task146" }, slots: { statusbar: { text: "task146 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task147") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task147" }, slots: { statusbar: { text: "task147 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task148") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task148" }, slots: { statusbar: { text: "task148 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task149") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task149" }, slots: { statusbar: { text: "task149 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task150") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task150" }, slots: { statusbar: { text: "task150 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task151") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task151" }, slots: { statusbar: { text: "task151 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task152") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task152" }, slots: { statusbar: { text: "task152 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task153") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task153" }, slots: { statusbar: { text: "task153 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task154") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task154" }, slots: { statusbar: { text: "task154 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task155") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task155" }, slots: { statusbar: { text: "task155 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task156") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task156" }, slots: { statusbar: { text: "task156 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task157") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task157" }, slots: { statusbar: { text: "task157 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task158") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task158" }, slots: { statusbar: { text: "task158 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task159") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task159" }, slots: { statusbar: { text: "task159 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task160") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task160" }, slots: { statusbar: { text: "task160 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task161") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task161" }, slots: { statusbar: { text: "task161 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task162") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task162" }, slots: { statusbar: { text: "task162 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task163") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task163" }, slots: { statusbar: { text: "task163 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task164") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task164" }, slots: { statusbar: { text: "task164 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task165") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task165" }, slots: { statusbar: { text: "task165 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task166") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task166" }, slots: { statusbar: { text: "task166 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task167") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task167" }, slots: { statusbar: { text: "task167 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task168") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task168" }, slots: { statusbar: { text: "task168 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task169") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task169" }, slots: { statusbar: { text: "task169 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task170") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task170" }, slots: { statusbar: { text: "task170 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task171") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task171" }, slots: { statusbar: { text: "task171 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task172") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task172" }, slots: { statusbar: { text: "task172 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task173") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task173" }, slots: { statusbar: { text: "task173 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task174") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task174" }, slots: { statusbar: { text: "task174 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task175") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task175" }, slots: { statusbar: { text: "task175 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task176") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task176" }, slots: { statusbar: { text: "task176 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task177") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task177" }, slots: { statusbar: { text: "task177 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task178") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task178" }, slots: { statusbar: { text: "task178 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task179") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task179" }, slots: { statusbar: { text: "task179 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task180") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task180" }, slots: { statusbar: { text: "task180 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task181") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task181" }, slots: { statusbar: { text: "task181 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task182") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task182" }, slots: { statusbar: { text: "task182 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task183") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task183" }, slots: { statusbar: { text: "task183 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task184") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task184" }, slots: { statusbar: { text: "task184 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task185") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task185" }, slots: { statusbar: { text: "task185 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task186") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task186" }, slots: { statusbar: { text: "task186 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task187") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task187" }, slots: { statusbar: { text: "task187 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task188") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task188" }, slots: { statusbar: { text: "task188 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task189") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task189" }, slots: { statusbar: { text: "task189 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task190") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task190" }, slots: { statusbar: { text: "task190 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task191") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task191" }, slots: { statusbar: { text: "task191 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task192") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task192" }, slots: { statusbar: { text: "task192 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task193") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task193" }, slots: { statusbar: { text: "task193 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task194") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task194" }, slots: { statusbar: { text: "task194 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task195") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task195" }, slots: { statusbar: { text: "task195 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task196") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task196" }, slots: { statusbar: { text: "task196 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task197") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task197" }, slots: { statusbar: { text: "task197 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task198") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task198" }, slots: { statusbar: { text: "task198 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task199") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task199" }, slots: { statusbar: { text: "task199 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task200") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task200" }, slots: { statusbar: { text: "task200 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task201") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task201" }, slots: { statusbar: { text: "task201 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task202") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task202" }, slots: { statusbar: { text: "task202 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task203") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task203" }, slots: { statusbar: { text: "task203 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task204") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task204" }, slots: { statusbar: { text: "task204 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task205") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task205" }, slots: { statusbar: { text: "task205 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task206") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task206" }, slots: { statusbar: { text: "task206 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task207") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task207" }, slots: { statusbar: { text: "task207 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task208") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task208" }, slots: { statusbar: { text: "task208 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task209") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task209" }, slots: { statusbar: { text: "task209 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task210") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task210" }, slots: { statusbar: { text: "task210 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task211") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task211" }, slots: { statusbar: { text: "task211 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task212") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task212" }, slots: { statusbar: { text: "task212 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task213") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task213" }, slots: { statusbar: { text: "task213 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task214") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task214" }, slots: { statusbar: { text: "task214 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task215") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task215" }, slots: { statusbar: { text: "task215 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task216") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task216" }, slots: { statusbar: { text: "task216 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task217") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task217" }, slots: { statusbar: { text: "task217 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task218") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task218" }, slots: { statusbar: { text: "task218 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task219") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task219" }, slots: { statusbar: { text: "task219 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task220") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task220" }, slots: { statusbar: { text: "task220 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task221") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task221" }, slots: { statusbar: { text: "task221 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task222") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task222" }, slots: { statusbar: { text: "task222 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task223") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task223" }, slots: { statusbar: { text: "task223 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task224") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task224" }, slots: { statusbar: { text: "task224 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task225") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task225" }, slots: { statusbar: { text: "task225 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task226") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task226" }, slots: { statusbar: { text: "task226 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task227") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task227" }, slots: { statusbar: { text: "task227 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task228") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task228" }, slots: { statusbar: { text: "task228 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task229") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task229" }, slots: { statusbar: { text: "task229 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task230") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task230" }, slots: { statusbar: { text: "task230 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task231") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task231" }, slots: { statusbar: { text: "task231 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task232") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task232" }, slots: { statusbar: { text: "task232 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task233") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task233" }, slots: { statusbar: { text: "task233 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task234") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task234" }, slots: { statusbar: { text: "task234 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task235") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task235" }, slots: { statusbar: { text: "task235 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task236") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task236" }, slots: { statusbar: { text: "task236 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task237") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task237" }, slots: { statusbar: { text: "task237 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task238") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task238" }, slots: { statusbar: { text: "task238 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task239") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task239" }, slots: { statusbar: { text: "task239 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task240") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task240" }, slots: { statusbar: { text: "task240 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task241") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task241" }, slots: { statusbar: { text: "task241 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task242") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task242" }, slots: { statusbar: { text: "task242 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task243") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task243" }, slots: { statusbar: { text: "task243 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task244") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task244" }, slots: { statusbar: { text: "task244 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task245") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task245" }, slots: { statusbar: { text: "task245 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task246") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task246" }, slots: { statusbar: { text: "task246 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task247") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task247" }, slots: { statusbar: { text: "task247 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task248") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task248" }, slots: { statusbar: { text: "task248 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task249") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task249" }, slots: { statusbar: { text: "task249 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task250") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task250" }, slots: { statusbar: { text: "task250 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task251") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task251" }, slots: { statusbar: { text: "task251 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task252") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task252" }, slots: { statusbar: { text: "task252 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task253") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task253" }, slots: { statusbar: { text: "task253 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task254") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task254" }, slots: { statusbar: { text: "task254 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task255") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task255" }, slots: { statusbar: { text: "task255 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task256") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task256" }, slots: { statusbar: { text: "task256 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task257") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task257" }, slots: { statusbar: { text: "task257 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task258") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task258" }, slots: { statusbar: { text: "task258 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task259") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task259" }, slots: { statusbar: { text: "task259 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task260") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task260" }, slots: { statusbar: { text: "task260 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task261") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task261" }, slots: { statusbar: { text: "task261 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task262") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task262" }, slots: { statusbar: { text: "task262 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task263") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task263" }, slots: { statusbar: { text: "task263 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task264") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task264" }, slots: { statusbar: { text: "task264 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task265") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task265" }, slots: { statusbar: { text: "task265 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task266") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task266" }, slots: { statusbar: { text: "task266 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task267") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task267" }, slots: { statusbar: { text: "task267 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task268") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task268" }, slots: { statusbar: { text: "task268 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task269") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task269" }, slots: { statusbar: { text: "task269 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task270") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task270" }, slots: { statusbar: { text: "task270 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task271") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task271" }, slots: { statusbar: { text: "task271 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task272") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task272" }, slots: { statusbar: { text: "task272 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task273") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task273" }, slots: { statusbar: { text: "task273 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task274") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task274" }, slots: { statusbar: { text: "task274 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task275") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task275" }, slots: { statusbar: { text: "task275 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task276") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task276" }, slots: { statusbar: { text: "task276 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task277") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task277" }, slots: { statusbar: { text: "task277 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task278") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task278" }, slots: { statusbar: { text: "task278 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task279") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task279" }, slots: { statusbar: { text: "task279 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task280") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task280" }, slots: { statusbar: { text: "task280 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task281") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task281" }, slots: { statusbar: { text: "task281 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task282") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task282" }, slots: { statusbar: { text: "task282 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task283") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task283" }, slots: { statusbar: { text: "task283 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task284") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task284" }, slots: { statusbar: { text: "task284 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task285") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task285" }, slots: { statusbar: { text: "task285 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task286") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task286" }, slots: { statusbar: { text: "task286 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task287") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task287" }, slots: { statusbar: { text: "task287 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task288") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task288" }, slots: { statusbar: { text: "task288 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task289") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task289" }, slots: { statusbar: { text: "task289 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task290") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task290" }, slots: { statusbar: { text: "task290 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task291") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task291" }, slots: { statusbar: { text: "task291 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task292") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task292" }, slots: { statusbar: { text: "task292 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task293") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task293" }, slots: { statusbar: { text: "task293 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task294") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task294" }, slots: { statusbar: { text: "task294 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task295") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task295" }, slots: { statusbar: { text: "task295 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task296") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task296" }, slots: { statusbar: { text: "task296 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task297") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task297" }, slots: { statusbar: { text: "task297 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task298") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task298" }, slots: { statusbar: { text: "task298 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task299") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task299" }, slots: { statusbar: { text: "task299 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task300") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task300" }, slots: { statusbar: { text: "task300 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task301") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task301" }, slots: { statusbar: { text: "task301 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task302") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task302" }, slots: { statusbar: { text: "task302 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task303") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task303" }, slots: { statusbar: { text: "task303 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task304") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task304" }, slots: { statusbar: { text: "task304 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task305") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task305" }, slots: { statusbar: { text: "task305 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task306") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task306" }, slots: { statusbar: { text: "task306 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task307") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task307" }, slots: { statusbar: { text: "task307 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task308") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task308" }, slots: { statusbar: { text: "task308 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task309") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task309" }, slots: { statusbar: { text: "task309 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task310") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task310" }, slots: { statusbar: { text: "task310 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task311") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task311" }, slots: { statusbar: { text: "task311 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task312") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task312" }, slots: { statusbar: { text: "task312 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task313") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task313" }, slots: { statusbar: { text: "task313 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task314") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task314" }, slots: { statusbar: { text: "task314 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task315") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task315" }, slots: { statusbar: { text: "task315 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task316") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task316" }, slots: { statusbar: { text: "task316 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task317") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task317" }, slots: { statusbar: { text: "task317 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task318") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task318" }, slots: { statusbar: { text: "task318 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task319") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task319" }, slots: { statusbar: { text: "task319 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task320") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task320" }, slots: { statusbar: { text: "task320 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task321") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task321" }, slots: { statusbar: { text: "task321 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task322") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task322" }, slots: { statusbar: { text: "task322 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task323") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task323" }, slots: { statusbar: { text: "task323 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task324") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task324" }, slots: { statusbar: { text: "task324 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task325") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task325" }, slots: { statusbar: { text: "task325 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task326") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task326" }, slots: { statusbar: { text: "task326 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task327") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task327" }, slots: { statusbar: { text: "task327 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task328") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task328" }, slots: { statusbar: { text: "task328 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task329") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task329" }, slots: { statusbar: { text: "task329 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task330") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task330" }, slots: { statusbar: { text: "task330 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task331") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task331" }, slots: { statusbar: { text: "task331 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task332") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task332" }, slots: { statusbar: { text: "task332 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task333") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task333" }, slots: { statusbar: { text: "task333 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task334") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task334" }, slots: { statusbar: { text: "task334 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task335") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task335" }, slots: { statusbar: { text: "task335 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task336") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task336" }, slots: { statusbar: { text: "task336 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task337") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task337" }, slots: { statusbar: { text: "task337 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task338") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task338" }, slots: { statusbar: { text: "task338 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task339") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task339" }, slots: { statusbar: { text: "task339 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task340") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task340" }, slots: { statusbar: { text: "task340 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task341") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task341" }, slots: { statusbar: { text: "task341 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task342") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task342" }, slots: { statusbar: { text: "task342 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task343") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task343" }, slots: { statusbar: { text: "task343 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task344") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task344" }, slots: { statusbar: { text: "task344 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task345") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task345" }, slots: { statusbar: { text: "task345 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task346") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task346" }, slots: { statusbar: { text: "task346 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task347") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task347" }, slots: { statusbar: { text: "task347 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task348") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task348" }, slots: { statusbar: { text: "task348 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task349") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task349" }, slots: { statusbar: { text: "task349 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task350") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task350" }, slots: { statusbar: { text: "task350 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task351") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task351" }, slots: { statusbar: { text: "task351 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task352") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task352" }, slots: { statusbar: { text: "task352 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task353") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task353" }, slots: { statusbar: { text: "task353 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task354") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task354" }, slots: { statusbar: { text: "task354 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task355") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task355" }, slots: { statusbar: { text: "task355 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task356") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task356" }, slots: { statusbar: { text: "task356 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task357") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task357" }, slots: { statusbar: { text: "task357 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task358") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task358" }, slots: { statusbar: { text: "task358 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task359") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task359" }, slots: { statusbar: { text: "task359 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task360") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task360" }, slots: { statusbar: { text: "task360 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task361") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task361" }, slots: { statusbar: { text: "task361 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task362") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task362" }, slots: { statusbar: { text: "task362 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task363") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task363" }, slots: { statusbar: { text: "task363 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task364") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task364" }, slots: { statusbar: { text: "task364 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task365") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task365" }, slots: { statusbar: { text: "task365 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task366") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task366" }, slots: { statusbar: { text: "task366 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task367") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task367" }, slots: { statusbar: { text: "task367 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task368") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task368" }, slots: { statusbar: { text: "task368 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task369") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task369" }, slots: { statusbar: { text: "task369 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task370") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task370" }, slots: { statusbar: { text: "task370 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task371") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task371" }, slots: { statusbar: { text: "task371 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task372") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task372" }, slots: { statusbar: { text: "task372 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task373") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task373" }, slots: { statusbar: { text: "task373 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task374") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task374" }, slots: { statusbar: { text: "task374 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task375") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task375" }, slots: { statusbar: { text: "task375 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task376") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task376" }, slots: { statusbar: { text: "task376 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task377") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task377" }, slots: { statusbar: { text: "task377 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task378") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task378" }, slots: { statusbar: { text: "task378 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task379") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task379" }, slots: { statusbar: { text: "task379 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task380") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task380" }, slots: { statusbar: { text: "task380 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task381") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task381" }, slots: { statusbar: { text: "task381 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task382") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task382" }, slots: { statusbar: { text: "task382 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task383") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task383" }, slots: { statusbar: { text: "task383 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task384") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task384" }, slots: { statusbar: { text: "task384 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task385") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task385" }, slots: { statusbar: { text: "task385 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task386") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task386" }, slots: { statusbar: { text: "task386 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task387") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task387" }, slots: { statusbar: { text: "task387 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task388") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task388" }, slots: { statusbar: { text: "task388 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task389") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task389" }, slots: { statusbar: { text: "task389 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task390") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task390" }, slots: { statusbar: { text: "task390 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task391") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task391" }, slots: { statusbar: { text: "task391 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task392") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task392" }, slots: { statusbar: { text: "task392 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task393") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task393" }, slots: { statusbar: { text: "task393 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task394") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task394" }, slots: { statusbar: { text: "task394 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task395") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task395" }, slots: { statusbar: { text: "task395 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task396") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task396" }, slots: { statusbar: { text: "task396 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task397") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task397" }, slots: { statusbar: { text: "task397 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task398") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task398" }, slots: { statusbar: { text: "task398 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task399") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task399" }, slots: { statusbar: { text: "task399 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task400") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task400" }, slots: { statusbar: { text: "task400 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task401") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task401" }, slots: { statusbar: { text: "task401 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task402") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task402" }, slots: { statusbar: { text: "task402 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task403") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task403" }, slots: { statusbar: { text: "task403 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task404") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task404" }, slots: { statusbar: { text: "task404 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task405") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task405" }, slots: { statusbar: { text: "task405 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task406") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task406" }, slots: { statusbar: { text: "task406 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.task407") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.task407" }, slots: { statusbar: { text: "task407 " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.rebase") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.rebase" }, slots: { statusbar: { text: "rebase " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.status") { const s = await tools.git.status(); return { state: { runs: state.runs + 1 }, slots: { statusbar: { text: s.branch + (s.dirty ? " *" : "") } } } } +return { state } \ No newline at end of file diff --git a/packages/codemode-rust/bench/plugin/reducer-padded.js b/packages/codemode-rust/bench/plugin/reducer-padded.js new file mode 100644 index 0000000000000..2b42208bb4243 --- /dev/null +++ b/packages/codemode-rust/bench/plugin/reducer-padded.js @@ -0,0 +1,14 @@ +if (event.type === "init") return { state: { runs: 0 }, commands: [{ name: "git.status", key: "ctrl+g" }] } +if (event.type === "command" && event.name === "git.log") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.log" }, slots: { statusbar: { text: "log " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.diff") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.diff" }, slots: { statusbar: { text: "diff " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.branch") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.branch" }, slots: { statusbar: { text: "branch " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.stash") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.stash" }, slots: { statusbar: { text: "stash " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.fetch") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.fetch" }, slots: { statusbar: { text: "fetch " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.pull") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.pull" }, slots: { statusbar: { text: "pull " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.push") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.push" }, slots: { statusbar: { text: "push " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.commit") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.commit" }, slots: { statusbar: { text: "commit " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.reset") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.reset" }, slots: { statusbar: { text: "reset " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.merge") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.merge" }, slots: { statusbar: { text: "merge " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.rebase") { const s = await tools.git.status(); return { state: { runs: state.runs + 1, last: "git.rebase" }, slots: { statusbar: { text: "rebase " + s.branch + (s.dirty ? " *" : "") } } } } +if (event.type === "command" && event.name === "git.status") { const s = await tools.git.status(); return { state: { runs: state.runs + 1 }, slots: { statusbar: { text: s.branch + (s.dirty ? " *" : "") } } } } +return { state } \ No newline at end of file diff --git a/packages/codemode-rust/bench/plugin/reducer.js b/packages/codemode-rust/bench/plugin/reducer.js new file mode 100644 index 0000000000000..cba1075313f3f --- /dev/null +++ b/packages/codemode-rust/bench/plugin/reducer.js @@ -0,0 +1,2 @@ +if (event.type === "command" && event.name === "git.status") { const s = await tools.git.status(); return { state: { runs: state.runs + 1 }, slots: { statusbar: { text: s.branch + (s.dirty ? " *" : "") } } } } +return { state } \ No newline at end of file diff --git a/packages/codemode-rust/bench/ref/bench.ts b/packages/codemode-rust/bench/ref/bench.ts new file mode 100644 index 0000000000000..f6262f440a561 --- /dev/null +++ b/packages/codemode-rust/bench/ref/bench.ts @@ -0,0 +1,34 @@ +// The nine bench programs through the reference's language layer, the counterpart of `psychoscript-bench --json`: +// one warm-up run that also checks the program succeeds, then N timed runs. Prints one JSON line per program: its +// value and the median and min ms. +// Usage: bun bench/ref/bench.ts [--iterations N] ... +import { resolve } from "node:path" +import { reference, toolsGlobal } from "../../conformance/reference.ts" + +// The reference's language layer: the CodeMode package from CODEMODE_REF, or by default ../codemode relative to this +// workspace. The programs reach one host global, `tools`, the namespace of conformance/reference.ts (`tools.echo`, +// `tools.git.status`, ... all async). +const ref = await reference(process.env.CODEMODE_REF) +const Effect = ref.Effect +const tools = toolsGlobal(ref) +const runtime = ref.Language.Runtime.make({ globals: () => ({ tools }) }) + +const flag = process.argv.indexOf("--iterations") +const iterations = flag === -1 ? 11 : Number(process.argv[flag + 1]) +const slugs = process.argv.slice(2).filter((arg, i, all) => arg !== "--iterations" && all[i - 1] !== "--iterations") + +for (const slug of slugs) { + const code = await Bun.file(resolve(import.meta.dir, `../../conformance/cases/bench-${slug}.js`)).text() + const warm = await Effect.runPromise(runtime.execute(code)) + if (warm.ok !== true) throw new Error(`${slug} failed: ${JSON.stringify(warm)}`) + const times: Array = [] + for (let i = 0; i < iterations; i++) { + const start = performance.now() + await Effect.runPromise(runtime.execute(code)) + times.push(performance.now() - start) + } + const sorted = [...times].sort((a, b) => a - b) + console.log( + JSON.stringify({ slug, value: warm.value, median_ms: sorted[Math.floor(sorted.length / 2)], min_ms: sorted[0] }), + ) +} diff --git a/packages/codemode-rust/bench/ref/embed.ts b/packages/codemode-rust/bench/ref/embed.ts new file mode 100644 index 0000000000000..cee99443a7f9f --- /dev/null +++ b/packages/codemode-rust/bench/ref/embed.ts @@ -0,0 +1,18 @@ +// Reference counterpart of bench/examples/embed.rs. Usage: bun bench/ref/embed.ts [code] +import { reference, toolsGlobal } from "../../conformance/reference.ts" + +// The reference's language layer: the CodeMode package from CODEMODE_REF, or by default ../codemode relative to this +// workspace. The programs reach one host global, `tools`, the namespace of conformance/reference.ts (`tools.echo`, +// `tools.git.status`, ... all async, as Code Mode tools were). +const ref = await reference(process.env.CODEMODE_REF) +const Effect = ref.Effect +const tools = toolsGlobal(ref) +const runtime = ref.Language.Runtime.make({ globals: () => ({ tools }) }) + +const result = await Effect.runPromise(runtime.execute(process.argv[2] ?? "return 1")) +for (const line of result.logs ?? []) console.error(line) +if (!result.ok) { + console.error(`${result.error.kind}: ${result.error.message}`) + process.exit(1) +} +console.log(JSON.stringify(result.value)) diff --git a/packages/codemode-rust/bench/ref/plugin.ts b/packages/codemode-rust/bench/ref/plugin.ts new file mode 100644 index 0000000000000..528581557ee4e --- /dev/null +++ b/packages/codemode-rust/bench/ref/plugin.ts @@ -0,0 +1,55 @@ +// Plugin-event benchmark, reference side: the conformance reducer handling a `git.status` command event. +// Counterpart of `psychoscript-bench --plugin`. Prints one JSON line per source: median, min and mean µs per execute, +// from the source and from the program `runtime.compile` made of it once (`compiled_*`). +// Usage: bun bench/ref/plugin.ts [--runs N] ... +import { reference, toolsGlobal } from "../../conformance/reference.ts" + +// The reference's language layer: the CodeMode package from CODEMODE_REF, or by default ../codemode relative to this +// workspace. The programs reach one host global, `tools`, the namespace of conformance/reference.ts (`tools.echo`, +// `tools.git.status`, ... all async, as Code Mode tools were). +const ref = await reference(process.env.CODEMODE_REF) +const Effect = ref.Effect +const tools = toolsGlobal(ref) +const runtime = ref.Language.Runtime.make({ globals: () => ({ tools }) }) + +const bindings = { event: { type: "command", name: "git.status" }, state: { runs: 2 } } +const expected = JSON.stringify({ state: { runs: 3 }, slots: { statusbar: { text: "main *" } } }) +const flag = process.argv.indexOf("--runs") +const runs = flag === -1 ? 2000 : Number(process.argv[flag + 1]) +const sources = process.argv.slice(2).filter((arg, i, all) => arg !== "--runs" && all[i - 1] !== "--runs") + +// Warm-up, as many runs as are measured, the first checking the result; then the median, min and mean µs of the runs. +const timed = async (source: string, execute: () => Promise<{ ok: boolean; value?: unknown }>) => { + const warm = await execute() + if (warm.ok !== true || JSON.stringify(warm.value) !== expected) + throw new Error(`${source}: unexpected outcome ${JSON.stringify(warm)}`) + for (let i = 1; i < runs; i++) await execute() + const times: Array = [] + for (let i = 0; i < runs; i++) { + const start = performance.now() + await execute() + times.push((performance.now() - start) * 1000) + } + const sorted = [...times].sort((a, b) => a - b) + return { median: sorted[Math.floor(runs / 2)], min: sorted[0], mean: times.reduce((a, b) => a + b, 0) / runs } +} + +for (const source of sources) { + const code = await Bun.file(source).text() + const compiled = runtime.compile(code) + if (!compiled.ok) throw new Error(`${source}: ${compiled.error.message}`) + const fromSource = await timed(source, () => Effect.runPromise(runtime.execute(code, { bindings }))) + const fromCompiled = await timed(source, () => Effect.runPromise(runtime.execute(compiled.compiled, { bindings }))) + console.log( + JSON.stringify({ + source, + bytes: Buffer.byteLength(code), + median_us: fromSource.median, + min_us: fromSource.min, + mean_us: fromSource.mean, + compiled_median_us: fromCompiled.median, + compiled_min_us: fromCompiled.min, + compiled_mean_us: fromCompiled.mean, + }), + ) +} diff --git a/packages/codemode-rust/bench/ref/run-case.ts b/packages/codemode-rust/bench/ref/run-case.ts new file mode 100644 index 0000000000000..e0d6232650011 --- /dev/null +++ b/packages/codemode-rust/bench/ref/run-case.ts @@ -0,0 +1,16 @@ +// Runs one bench case once through the reference, for one-shot measurements such as peak RSS. +// Usage: bun bench/ref/run-case.ts +import { resolve } from "node:path" +import { reference, toolsGlobal } from "../../conformance/reference.ts" + +// The reference's language layer: the CodeMode package from CODEMODE_REF, or by default ../codemode relative to this +// workspace. The programs reach one host global, `tools`, the namespace of conformance/reference.ts (`tools.echo`, +// `tools.git.status`, ... all async, as Code Mode tools were). +const ref = await reference(process.env.CODEMODE_REF) +const Effect = ref.Effect +const tools = toolsGlobal(ref) +const runtime = ref.Language.Runtime.make({ globals: () => ({ tools }) }) + +const code = await Bun.file(resolve(import.meta.dir, `../../conformance/cases/bench-${process.argv[2]}.js`)).text() +const result = await Effect.runPromise(runtime.execute(code)) +if (!result.ok) throw new Error(`${process.argv[2]} failed: ${JSON.stringify(result)}`) diff --git a/packages/codemode-rust/bench/ref/variants.ts b/packages/codemode-rust/bench/ref/variants.ts new file mode 100644 index 0000000000000..e904e05bdbf4e --- /dev/null +++ b/packages/codemode-rust/bench/ref/variants.ts @@ -0,0 +1,42 @@ +// Runs each bench program and its perturbed variant through the reference, with the `tools` host global. +// Checks the variant returns what the original does, then prints one JSON line per program: median and min ms. +// Usage: bun bench/ref/variants.ts [--iterations N] ... +import { resolve } from "node:path" +import { reference, toolsGlobal } from "../../conformance/reference.ts" + +// The reference's language layer: the CodeMode package from CODEMODE_REF, or by default ../codemode relative to this +// workspace. The programs reach one host global, `tools`, the namespace of conformance/reference.ts (`tools.echo`, +// `tools.git.status`, ... all async, as Code Mode tools were). +const ref = await reference(process.env.CODEMODE_REF) +const Effect = ref.Effect +const tools = toolsGlobal(ref) +const runtime = ref.Language.Runtime.make({ globals: () => ({ tools }) }) + +const flag = process.argv.indexOf("--iterations") +const iterations = flag === -1 ? 11 : Number(process.argv[flag + 1]) +const slugs = process.argv.slice(2).filter((arg, i, all) => arg !== "--iterations" && all[i - 1] !== "--iterations") + +const measure = async (path: string) => { + const code = await Bun.file(path).text() + // One warm-up run, which also checks the program succeeds. + const warm = await Effect.runPromise(runtime.execute(code)) + if (warm.ok !== true) throw new Error(`${path} failed: ${JSON.stringify(warm)}`) + const times: Array = [] + for (let i = 0; i < iterations; i++) { + const start = performance.now() + await Effect.runPromise(runtime.execute(code)) + times.push(performance.now() - start) + } + const sorted = [...times].sort((a, b) => a - b) + return { value: warm.value, median_ms: sorted[Math.floor(sorted.length / 2)], min_ms: sorted[0] } +} + +for (const slug of slugs) { + const original = await measure(resolve(import.meta.dir, `../../conformance/cases/bench-${slug}.js`)) + const variant = await measure(resolve(import.meta.dir, `../variants/bench-${slug}.js`)) + if (JSON.stringify(original.value) !== JSON.stringify(variant.value)) + throw new Error( + `${slug}: the variant returns ${JSON.stringify(variant.value)}, not ${JSON.stringify(original.value)}`, + ) + console.log(JSON.stringify({ slug, original, variant })) +} diff --git a/packages/codemode-rust/bench/src/counters.rs b/packages/codemode-rust/bench/src/counters.rs new file mode 100644 index 0000000000000..e9d29f613f586 --- /dev/null +++ b/packages/codemode-rust/bench/src/counters.rs @@ -0,0 +1,54 @@ +//! Process counters for the benchmarks: instructions retired, physical footprint and its peak. macOS only, through +//! `proc_pid_rusage`; elsewhere every counter reads `None`. Shared by the bench binary and examples, which each use +//! part of it. +#![allow(dead_code)] + +#[derive(Clone, Copy, Debug, Default)] +pub struct Usage { + pub instructions: u64, + pub cycles: u64, + /// Bytes of physical memory the process is charged for now, and at most since it started. + pub footprint: u64, + pub peak_footprint: u64, +} + +#[cfg(target_os = "macos")] +pub fn usage() -> Option { + // `struct rusage_info_v4` of : a 16-byte UUID and 35 u64 fields up to `ri_runnable_time`. + #[repr(C)] + struct RusageInfoV4 { + uuid: [u8; 16], + fields: [u64; 35], + } + const RUSAGE_INFO_V4: i32 = 4; + const PHYS_FOOTPRINT: usize = 7; + const LIFETIME_MAX_PHYS_FOOTPRINT: usize = 28; + const INSTRUCTIONS: usize = 29; + const CYCLES: usize = 30; + unsafe extern "C" { + fn proc_pid_rusage(pid: i32, flavor: i32, buffer: *mut RusageInfoV4) -> i32; + } + let mut info = RusageInfoV4 { + uuid: [0; 16], + fields: [0; 35], + }; + // SAFETY: the kernel fills at most `sizeof(struct rusage_info_v4)` bytes, which `RusageInfoV4` has, for our own + // pid. Only the benchmarks use this; the language crate stays free of `unsafe`. + let r = unsafe { proc_pid_rusage(std::process::id() as i32, RUSAGE_INFO_V4, &mut info) }; + (r == 0).then(|| Usage { + instructions: info.fields[INSTRUCTIONS], + cycles: info.fields[CYCLES], + footprint: info.fields[PHYS_FOOTPRINT], + peak_footprint: info.fields[LIFETIME_MAX_PHYS_FOOTPRINT], + }) +} + +#[cfg(not(target_os = "macos"))] +pub fn usage() -> Option { + None +} + +/// Instructions retired by the process so far, or 0 where they can't be read. +pub fn instructions() -> u64 { + usage().map_or(0, |u| u.instructions) +} diff --git a/packages/codemode-rust/bench/src/main.rs b/packages/codemode-rust/bench/src/main.rs new file mode 100644 index 0000000000000..240582f7d3b4a --- /dev/null +++ b/packages/codemode-rust/bench/src/main.rs @@ -0,0 +1,208 @@ +//! Interpreter benchmarks, mirroring the reference `script/bench.ts`: median and fastest wall-clock milliseconds per +//! program. Each iteration calls `execute` on the source, with one warm-up run that also checks the program succeeds. +//! Usage: psychoscript-bench [--iterations N] [--filter name] [--json] [--cases DIR] [--async] +//! `--iterations 0` runs only the warm-up, for one-shot measurements such as peak RSS. +//! +//! `psychoscript-bench --plugin [--runs N] SOURCE...` is the plugin-event benchmark instead: the conformance +//! reducer handling a `git.status` command, N warm-up runs then N timed runs, as JSON lines of µs per execute: from +//! the source, and from the program `Runtime::compile` made of it once (`compiled_*`). +//! +//! Both report instructions retired too where the platform counts them (macOS): the median per iteration for a +//! program, the mean per execute for the plugin event. + +use std::path::PathBuf; +use std::time::Instant; + +use psychoscript::{HostValue, Json, ProgramOptions, Runtime}; +use serde_json::json; + +mod counters; +#[path = "../../conformance/reference.rs"] +mod reference; + +/// Case files and reference names, in the reference order. +const CASES: [(&str, &str); 9] = [ + ("numeric-loop", "numeric loop"), + ("closure-recursion", "closure recursion (fib 22)"), + ("array-callbacks", "array callbacks (50k)"), + ("promise-fan-out", "promise fan-out (5k)"), + ("tool-fan-out", "tool fan-out (1k)"), + ("json-round-trip", "JSON round-trip"), + ("generator-iteration", "generator iteration"), + ("string-building", "string building"), + ("map-set-ops", "Map/Set ops"), +]; + +/// The bench runtime, as the reference drivers make it: one host global, the `tools` namespace of +/// `conformance/reference.rs` (`tools.echo`, `tools.git.status`, ... all async). +fn runtime() -> Runtime { + Runtime::make().globals(|_| [("tools", HostValue::from(reference::tools()))]) +} + +fn main() { + if std::env::args().nth(1).as_deref() == Some("--plugin") { + return plugin(std::env::args().skip(2)); + } + let mut iterations = 11usize; + let mut filter = String::new(); + let mut json = false; + let mut future = false; + let mut dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../conformance/cases"); + let mut args = std::env::args().skip(1); + while let Some(arg) = args.next() { + match arg.as_str() { + "--iterations" => { + iterations = args + .next() + .and_then(|n| n.parse().ok()) + .expect("--iterations N") + } + "--filter" => filter = args.next().expect("--filter name"), + "--json" => json = true, + "--async" => future = true, + "--cases" => dir = args.next().expect("--cases DIR").into(), + other => panic!("unknown argument {other}"), + } + } + + let runtime = runtime(); + let options = psychoscript::ProgramOptions::new(); + // `--async` drives each run as a future, where a long one computes on a worker thread. + let execute = |code: &str| { + if future { + return block_on(runtime.execute_async(code, &options)).expect("not interrupted"); + } + runtime.execute(code) + }; + let mut report = Vec::new(); + for (slug, name) in CASES { + if !(slug.contains(&filter) || name.contains(&filter)) { + continue; + } + let path = dir.join(format!("bench-{slug}.js")); + let code = + std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{}: {e}", path.display())); + let value = match execute(&code).result { + Ok(value) => value, + Err(d) => panic!("{name} failed: {d:?}"), + }; + let (times, mut instructions): (Vec, Vec) = (0..iterations) + .map(|_| { + let before = counters::instructions(); + let start = Instant::now(); + let _ = execute(&code); + let ms = start.elapsed().as_secs_f64() * 1e3; + (ms, counters::instructions() - before) + }) + .unzip(); + if times.is_empty() { + continue; + } + let mut sorted = times.clone(); + sorted.sort_by(f64::total_cmp); + let (median, min) = (sorted[sorted.len() / 2], sorted[0]); + instructions.sort_unstable(); + let insns = instructions[instructions.len() / 2]; + if json { + report.push(json!({ "slug": slug, "name": name, "value": value.to_json(), "median_ms": median, "min_ms": min, "times_ms": times, "median_instructions": insns })); + } else { + println!("{name:<28} {median:>8.1} ms (min {min:.1} ms) {insns:>12} insns"); + } + } + if json { + println!("{}", Json::from(report)); + } +} + +fn plugin(mut args: impl Iterator) { + let mut runs = 2000usize; + let mut sources = Vec::new(); + while let Some(arg) = args.next() { + match arg.as_str() { + "--runs" => runs = args.next().and_then(|n| n.parse().ok()).expect("--runs N"), + _ => sources.push(arg), + } + } + let runtime = runtime(); + let bindings = + json!({ "event": { "type": "command", "name": "git.status" }, "state": { "runs": 2 } }); + let options = ProgramOptions::new().bindings(bindings.as_object().cloned().unwrap_or_default()); + let expected = + json!({ "state": { "runs": 3 }, "slots": { "statusbar": { "text": "main *" } } }); + for source in sources { + let code = std::fs::read_to_string(&source).unwrap_or_else(|e| panic!("{source}: {e}")); + let compiled = runtime + .compile(&code) + .unwrap_or_else(|d| panic!("{source}: {d:?}")); + let from_source = timed(runs, &source, &expected, || { + runtime.execute_with(&code, &options) + }); + let from_compiled = timed(runs, &source, &expected, || { + runtime.execute_with(&compiled, &options) + }); + println!( + "{}", + json!({ + "source": source, + "bytes": code.len(), + "median_us": from_source.0, + "min_us": from_source.1, + "mean_us": from_source.2, + "mean_instructions": from_source.3, + "compiled_median_us": from_compiled.0, + "compiled_min_us": from_compiled.1, + "compiled_mean_us": from_compiled.2, + "compiled_mean_instructions": from_compiled.3, + }) + ); + } +} + +/// `runs` warm-up runs, the first checking the result, then the median, min and mean µs of `runs` timed ones, and +/// their mean instructions. +fn timed( + runs: usize, + source: &str, + expected: &Json, + mut execute: impl FnMut() -> psychoscript::Outcome, +) -> (f64, f64, f64, u64) { + match execute().result { + Ok(value) if value == *expected => {} + other => panic!("{source}: unexpected outcome {other:?}"), + } + for _ in 1..runs { + let _ = execute(); + } + let before = counters::instructions(); + let times: Vec = (0..runs) + .map(|_| { + let start = Instant::now(); + let _ = execute(); + start.elapsed().as_secs_f64() * 1e6 + }) + .collect(); + let insns = (counters::instructions() - before) / runs.max(1) as u64; + let mut sorted = times.clone(); + sorted.sort_by(f64::total_cmp); + let mean = times.iter().sum::() / runs.max(1) as f64; + (sorted[runs / 2], sorted[0], mean, insns) +} + +/// Polls a future to its end on this thread, parking until it is woken. +fn block_on(future: F) -> F::Output { + struct Unpark(std::thread::Thread); + impl std::task::Wake for Unpark { + fn wake(self: std::sync::Arc) { + self.0.unpark(); + } + } + let waker = std::task::Waker::from(std::sync::Arc::new(Unpark(std::thread::current()))); + let mut cx = std::task::Context::from_waker(&waker); + let mut future = std::pin::pin!(future); + loop { + if let std::task::Poll::Ready(v) = future.as_mut().poll(&mut cx) { + return v; + } + std::thread::park(); + } +} diff --git a/packages/codemode-rust/bench/tests/conformance.rs b/packages/codemode-rust/bench/tests/conformance.rs new file mode 100644 index 0000000000000..c4fbea016ee47 --- /dev/null +++ b/packages/codemode-rust/bench/tests/conformance.rs @@ -0,0 +1,201 @@ +//! Runs every `conformance/cases/.js` through `psychoscript::Runtime` and compares it with the reference outcome +//! in `.json`. Reports every failing case at once. `CONFORMANCE_FILTER=` narrows the run. A case +//! with a `// @platform ""` header is checked only on that OS, where `conformance/generate.ts` records it. Every +//! case runs twice: blocking, and as a future, where a long stretch of compute continues on a worker thread. + +use std::panic::{self, AssertUnwindSafe}; +use std::path::Path; + +use psychoscript::{ + HostValue, Json, Limits, ProgramOptions, Runtime, Translate, TranslateFunctions, + TranslatePromises, +}; + +#[path = "../../conformance/reference.rs"] +mod reference; + +use reference::same; + +/// The reference generator's runtime: only the `tools` namespace, with the case's limits and translation. +fn runtime(limits: Limits, translate: Translate) -> Runtime { + Runtime::make() + .globals(|_| [("tools", HostValue::from(reference::tools()))]) + .limits(limits) + .translate(translate) +} + +fn check(name: &str, code: &str, expected: &Json, future: bool) -> Result<(), String> { + let bindings = expected["bindings"] + .as_object() + .cloned() + .unwrap_or_default(); + let limits = Limits { + timeout_ms: expected["limits"]["timeout_ms"].as_u64(), + max_output_bytes: expected["limits"]["max_output_bytes"] + .as_u64() + .map(|n| n as usize), + }; + let translate = Translate { + functions: match expected["translate"]["functions"].as_str() { + Some("drop") => TranslateFunctions::Drop, + _ => TranslateFunctions::Error, + }, + promises: match expected["translate"]["promises"].as_str() { + Some("await") => TranslatePromises::Await, + _ => TranslatePromises::Error, + }, + }; + let rt = runtime(limits, translate); + let options = ProgramOptions::new().bindings(bindings); + let run = || match future { + true => drive(rt.execute_async(code, &options)).unwrap_or_else(|i| psychoscript::Outcome { + result: Err(psychoscript::Diagnostic { + kind: psychoscript::DiagnosticKind::ExecutionFailure, + message: i.to_string().into(), + location: None, + suggestions: Vec::new(), + }), + warnings: Vec::new(), + logs: Vec::new(), + truncated: false, + metadata: psychoscript::Data::Null, + }), + false => rt.execute_with(code, &options), + }; + let outcome = panic::catch_unwind(AssertUnwindSafe(run)).map_err(|payload| { + let msg = payload + .downcast_ref::() + .cloned() + .or_else(|| payload.downcast_ref::<&str>().map(|s| (*s).to_owned())) + .unwrap_or_default(); + format!("{name}: panicked: {msg}") + })?; + + let mut problems = Vec::new(); + match (&outcome.result, expected["ok"].as_bool()) { + (Ok(value), Some(true)) => { + if !same(&value.to_json(), &expected["value"]) { + problems.push(format!( + "value\n expected: {}\n actual: {value}", + expected["value"] + )); + } + } + (Err(d), Some(false)) => { + if d.kind.name() != expected["kind"] { + problems.push(format!( + "kind: expected {}, got {} ({})", + expected["kind"], + d.kind.name(), + d.message + )); + } + } + (Ok(value), _) => problems.push(format!( + "expected {} error, got ok: {value}", + expected["kind"] + )), + (Err(d), _) => problems.push(format!( + "expected ok {}, got {}: {}", + expected["value"], + d.kind.name(), + d.message + )), + } + if let Some(metadata) = expected.get("metadata") + && !same(&outcome.metadata.to_json(), metadata) + { + problems.push(format!( + "metadata\n expected: {metadata}\n actual: {}", + outcome.metadata + )); + } + if let Some(logs) = expected.get("logs") { + let actual = Json::from(outcome.log_lines()); + if !same(&actual, logs) { + problems.push(format!( + "logs\n expected: {logs}\n actual: {actual}" + )); + } + } + if problems.is_empty() { + Ok(()) + } else { + Err(format!("{name}: {}", problems.join("\n "))) + } +} + +#[test] +fn conformance() { + let dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("../conformance/cases"); + let filter = std::env::var("CONFORMANCE_FILTER").unwrap_or_default(); + let mut names: Vec = std::fs::read_dir(&dir) + .expect("conformance/cases") + .filter_map(|e| { + e.ok()? + .file_name() + .into_string() + .ok()? + .strip_suffix(".js") + .map(str::to_owned) + }) + .filter(|n| n.contains(&filter)) + .collect(); + names.sort(); + assert!(!names.is_empty(), "no conformance cases matched"); + + let hook = panic::take_hook(); + panic::set_hook(Box::new(|_| {})); + let failures: Vec = names + .iter() + .filter_map(|name| { + let code = std::fs::read_to_string(dir.join(format!("{name}.js"))).unwrap(); + let platform = code + .lines() + .find_map(|l| l.strip_prefix("// @platform ")) + .map(|p| serde_json::from_str::(p).unwrap()); + if platform.is_some_and(|p| p != std::env::consts::OS) { + return None; + } + let expected: Json = serde_json::from_str( + &std::fs::read_to_string(dir.join(format!("{name}.json"))).unwrap(), + ) + .unwrap(); + check(name, &code, &expected, false) + .and_then(|()| { + check(name, &code, &expected, true).map_err(|p| format!("as a future: {p}")) + }) + .err() + }) + .collect(); + panic::set_hook(hook); + + if !failures.is_empty() { + panic!( + "{} of {} conformance cases failed:\n{}", + failures.len(), + names.len(), + failures.join("\n") + ); + } + println!("{} conformance cases passed", names.len()); +} + +/// Polls a future to its end on this thread, parking until it is woken. +fn drive(future: F) -> F::Output { + struct Unpark(std::thread::Thread); + impl std::task::Wake for Unpark { + fn wake(self: std::sync::Arc) { + self.0.unpark(); + } + } + let waker = std::task::Waker::from(std::sync::Arc::new(Unpark(std::thread::current()))); + let mut cx = std::task::Context::from_waker(&waker); + let mut future = std::pin::pin!(future); + loop { + if let std::task::Poll::Ready(v) = future.as_mut().poll(&mut cx) { + return v; + } + std::thread::park(); + } +} diff --git a/packages/codemode-rust/bench/variants/bench-array-callbacks.js b/packages/codemode-rust/bench/variants/bench-array-callbacks.js new file mode 100644 index 0000000000000..e72899bed4daf --- /dev/null +++ b/packages/codemode-rust/bench/variants/bench-array-callbacks.js @@ -0,0 +1,19 @@ +const COUNT = 5e4 +const values = Array.from({ length: COUNT }, function (unused, idx) { + return (7919 * idx) % COUNT +}) +function twice(v) { + return v + v +} +const kept = values.map(twice).filter(function (v) { + return v % 3 != 0 +}) +const sum = kept.reduce(function (acc, v) { + return acc + v +}, 0) +function ascending(left, right) { + return left < right ? -1 : left > right ? 1 : 0 +} +const ordered = kept.slice(0, 2e4).sort(ascending) +const last = ordered.length - 1 +return [sum, ordered[0], ordered[last]] diff --git a/packages/codemode-rust/bench/variants/bench-closure-recursion.js b/packages/codemode-rust/bench/variants/bench-closure-recursion.js new file mode 100644 index 0000000000000..ac9319602c165 --- /dev/null +++ b/packages/codemode-rust/bench/variants/bench-closure-recursion.js @@ -0,0 +1,5 @@ +function fibonacci(m) { + if (m <= 1) return m + return fibonacci(m - 2) + fibonacci(m - 1) +} +return fibonacci(2 * 11) diff --git a/packages/codemode-rust/bench/variants/bench-generator-iteration.js b/packages/codemode-rust/bench/variants/bench-generator-iteration.js new file mode 100644 index 0000000000000..602e8c5f869fe --- /dev/null +++ b/packages/codemode-rust/bench/variants/bench-generator-iteration.js @@ -0,0 +1,10 @@ +const numbers = function* (limit) { + let v = 0 + while (v < limit) { + yield v + v++ + } +} +let total = 0 +for (const n of numbers(5e4)) total = total + n +return total diff --git a/packages/codemode-rust/bench/variants/bench-json-round-trip.js b/packages/codemode-rust/bench/variants/bench-json-round-trip.js new file mode 100644 index 0000000000000..7d16e8e95c349 --- /dev/null +++ b/packages/codemode-rust/bench/variants/bench-json-round-trip.js @@ -0,0 +1,12 @@ +function build(level) { + if (level <= 0) return { a: 1, b: "two", c: [1, 2, 3], d: null } + const branch = level - 1 + return { left: build(branch), right: build(branch), list: [level, `${level}`] } +} +let bytes = 0 +let rounds = 20 +while (rounds-- > 0) { + const text = JSON.stringify(build(9)) + bytes += JSON.stringify(JSON.parse(text)).length +} +return bytes diff --git a/packages/codemode-rust/bench/variants/bench-map-set-ops.js b/packages/codemode-rust/bench/variants/bench-map-set-ops.js new file mode 100644 index 0000000000000..59884843acd42 --- /dev/null +++ b/packages/codemode-rust/bench/variants/bench-map-set-ops.js @@ -0,0 +1,20 @@ +const table = new Map() +const seen = new Set() +let i = 0 +while (i < 3e4) { + table.set(`k${i % 5000}`, i) + seen.add(i % 7000) + i++ +} +let acc = 0 +table.forEach(function (value) { + acc += value +}) +seen.forEach((value) => { + acc += value +}) +for (let j = 5000; j > 0; j--) { + table.delete("k" + (j - 1)) + seen.delete(j - 1) +} +return acc + table.size + seen.size diff --git a/packages/codemode-rust/bench/variants/bench-numeric-loop.js b/packages/codemode-rust/bench/variants/bench-numeric-loop.js new file mode 100644 index 0000000000000..0a0de8202e01c --- /dev/null +++ b/packages/codemode-rust/bench/variants/bench-numeric-loop.js @@ -0,0 +1,9 @@ +const LIMIT = 3e5 +const MODULUS = 0xf4243 +let acc = 0 +let k = 0 +while (k < LIMIT) { + acc = (acc + 3 * k) % MODULUS + k += 1 +} +return acc diff --git a/packages/codemode-rust/bench/variants/bench-promise-fan-out.js b/packages/codemode-rust/bench/variants/bench-promise-fan-out.js new file mode 100644 index 0000000000000..967d4f3affc19 --- /dev/null +++ b/packages/codemode-rust/bench/variants/bench-promise-fan-out.js @@ -0,0 +1,8 @@ +async function task(n) { + await undefined + return n + n +} +const pending = [] +for (let j = 0; j < 5e3; j++) pending.push(task(j)) +const settled = await Promise.all(pending) +return settled.length diff --git a/packages/codemode-rust/bench/variants/bench-string-building.js b/packages/codemode-rust/bench/variants/bench-string-building.js new file mode 100644 index 0000000000000..2258e46d58cdf --- /dev/null +++ b/packages/codemode-rust/bench/variants/bench-string-building.js @@ -0,0 +1,10 @@ +const BASE = "a".charCodeAt(0) +let text = "" +let idx = 0 +while (idx < 5e4) { + text = text + String.fromCharCode(BASE + (idx % 26)) + idx++ +} +const pieces = [] +for (let n = 0; n < 2e4; n += 1) pieces.push("item-" + n) +return text.length + pieces.join(",").length diff --git a/packages/codemode-rust/bench/variants/bench-tool-fan-out.js b/packages/codemode-rust/bench/variants/bench-tool-fan-out.js new file mode 100644 index 0000000000000..9a2f54f36b3ce --- /dev/null +++ b/packages/codemode-rust/bench/variants/bench-tool-fan-out.js @@ -0,0 +1,8 @@ +const calls = [] +let n = 0 +while (n < 1e3) { + calls.push(tools.echo({ id: n })) + n++ +} +const answers = await Promise.all(calls) +return answers.length diff --git a/packages/codemode-rust/conformance/boundary.json b/packages/codemode-rust/conformance/boundary.json new file mode 100644 index 0000000000000..8e67178780826 --- /dev/null +++ b/packages/codemode-rust/conformance/boundary.json @@ -0,0 +1,97 @@ +{ + "boundary": { + "samples": {"date":{"date":0},"invalidDate":{"date":"NaN"},"regexp":{"regexp":["a+\\/b","gi"]},"url":{"url":"https://user@a.test:8080/p%20a?q=1&r=%20#h"},"params":{"params":[["a","1"],["b","2"],["a","3"]]},"headers":{"headers":[["x-a","1, 3"],["x-b","2"]]},"bytes":{"bytes":[1,2,3]},"buffer":{"buffer":[104,105]},"arrayBuffer":{"arrayBuffer":[4,5]},"nested":{"object":[["when",{"date":1000000000000}],["links",{"array":[{"url":"https://b.test/x"}]}],["table",{"map":[[{"date":5},{"headers":[["k","v"]]}]]}],["tags",{"set":[{"bytes":[9]}]}],["failure",{"error":{"name":"RangeError","message":"bad","cause":{"date":7},"fields":[["at",{"url":"https://c.test/"}]]}}]]},"lone":{"string":[97,55296,98]},"loneKeys":{"object":[[{"string":[56320]},{"string":[120,55357]}],["pair","😀"],["list",{"array":[{"string":[56319]}]}]]},"loneError":{"error":{"name":"Error","message":{"string":[98,97,100,32,55296]},"fields":[[{"string":[57343]},{"string":[55296]}]]}}}, + "programs": [ + {"code":"const o = { n: 1, list: [1], d: new Date(0), u: new URL(\"https://a.test/\") }; keep(o); o.n = 2; o.list.push(2); return o.n","outcome":{"ok":true,"value":2},"kept":[{"object":[["n",1],["list",{"array":[1]}],["d",{"date":0}],["u",{"url":"https://a.test/"}]]}]}, + {"code":"const h = make(\"headers\"); h.set(\"x-a\", \"2\"); const back = keep(h); back.set(\"x-a\", \"3\"); return [h instanceof Headers, h.get(\"x-a\"), back === h, back.get(\"x-a\"), [...back], [...make(\"headers\")]]","outcome":{"ok":true,"value":[true,"2",false,"3",[["x-a","3"],["x-b","2"]],[["x-a","1, 3"],["x-b","2"]]]},"kept":[{"headers":[["x-a","2"],["x-b","2"]]}]}, + {"code":"const b = make(\"bytes\"); b[0] = 42; const mine = new Uint8Array([5]); const name = kind(mine); return [[...b], [...make(\"bytes\")], [...make(\"arrayBuffer\")], b instanceof Uint8Array, name, mine[0], kind(make(\"arrayBuffer\"))]","outcome":{"ok":true,"value":[[42,2,3],[1,2,3],[4,5],true,"Uint8Array",5,"Uint8Array"]},"kept":[]}, + {"code":"const d = make(\"date\"); return [d instanceof Date, d.getTime(), d.toISOString(), make(\"invalidDate\").getTime(), keep(new Date(86400000)).getTime(), keep(new Date(NaN)).getTime()]","outcome":{"ok":true,"value":[true,0,"1970-01-01T00:00:00.000Z",null,86400000,null]},"kept":[{"date":86400000},{"date":"NaN"}]}, + {"code":"const r = make(\"regexp\"); return [r instanceof RegExp, r.source, r.flags, r.test(\"aa/b\"), keep(/x(y)\\//m).source]","outcome":{"ok":true,"value":[true,"a+\\/b","gi",true,"x(y)\\/"]},"kept":[{"regexp":["x(y)\\/","m"]}]}, + {"code":"const u = make(\"url\"); return [u instanceof URL, u.href, u.pathname, u.port, u.searchParams.get(\"r\"), keep(u).href, keep(u.searchParams).toString()]","outcome":{"ok":true,"value":[true,"https://user@a.test:8080/p%20a?q=1&r=%20#h","/p%20a","8080"," ","https://user@a.test:8080/p%20a?q=1&r=%20#h","q=1&r=+"]},"kept":[{"url":"https://user@a.test:8080/p%20a?q=1&r=%20#h"},{"params":[["q","1"],["r"," "]]}]}, + {"code":"const p = make(\"params\"); return [p instanceof URLSearchParams, p.getAll(\"a\"), p.toString(), keep(new URLSearchParams(\"x=1&x=2\")).toString()]","outcome":{"ok":true,"value":[true,["1","3"],"a=1&b=2&a=3","x=1&x=2"]},"kept":[{"params":[["x","1"],["x","2"]]}]}, + {"code":"const b = make(\"buffer\"); return [Buffer.isBuffer(b), b.toString(), keep(Buffer.from(\"yo\")).length, keep(new Uint8Array([7]))[0], kind(Buffer.from(\"z\")), kind(new Uint8Array(1))]","outcome":{"ok":true,"value":[true,"hi",2,7,"Buffer","Uint8Array"]},"kept":[{"buffer":[121,111]},{"bytes":[7]}]}, + {"code":"return make(\"nested\")","outcome":{"ok":false,"kind":"InvalidDataValue","message":"TypeError: A Uint8Array cannot cross to the host; pass text instead, e.g. `new TextDecoder().decode(bytes)` or `bytes.toBase64()`."},"kept":[]}, + {"code":"const n = make(\"nested\"); return [n.when instanceof Date, n.links[0].host, [...n.table.keys()][0].getTime(), [...n.table.values()][0].get(\"k\"), [...[...n.tags][0]], n.failure instanceof RangeError, n.failure.cause.getTime(), n.failure.at.href]","outcome":{"ok":true,"value":[true,"b.test",5,"v",[9],true,7,"https://c.test/"]},"kept":[]}, + {"code":"keep(make(\"nested\")); return 1","outcome":{"ok":true,"value":1},"kept":[{"object":[["when",{"date":1000000000000}],["links",{"array":[{"url":"https://b.test/x"}]}],["table",{"map":[[{"date":5},{"headers":[["k","v"]]}]]}],["tags",{"set":[{"bytes":[9]}]}],["failure",{"error":{"name":"RangeError","message":"bad","cause":{"date":7},"fields":[["at",{"url":"https://c.test/"}]]}}]]}]}, + {"code":"keep(new Map([[new Date(1), new Set([new URL(\"https://m.test/\")])]])); return 1","outcome":{"ok":true,"value":1},"kept":[{"map":[[{"date":1},{"set":[{"url":"https://m.test/"}]}]]}]}, + {"code":"keep([new Headers({ \"X-Y\": \"1\" }), new URLSearchParams(\"z=9\"), /q/]); return 1","outcome":{"ok":true,"value":1},"kept":[{"array":[{"headers":[["x-y","1"]]},{"params":[["z","9"]]},{"regexp":["q",""]}]}]}, + {"code":"function f() { return keep(arguments) }\nf(1, \"two\"); keep(new WeakMap()); keep(new TextDecoder()); return 1","outcome":{"ok":true,"value":1},"kept":[{"object":[["0",1],["1","two"]]},{"object":[]},{"object":[]}]}, + {"code":"try { keep((function* () {})()) } catch (e) { return e.message }","outcome":{"ok":true,"value":"Argument 1 to keep contains a generator, which cannot be passed to the host."},"kept":[]}, + {"code":"try { keep(new Map().entries()) } catch (e) { return e.message }","outcome":{"ok":true,"value":"Argument 1 to keep contains an iterator, which cannot be passed to the host."},"kept":[]}, + {"code":"try { keep({ p: Promise.resolve(1) }) } catch (e) { return e.message }","outcome":{"ok":true,"value":null},"kept":[{"object":[["p",1]]}]}, + {"code":"return JSON.stringify([make(\"date\"), make(\"url\"), make(\"params\"), make(\"headers\"), make(\"bytes\"), make(\"buffer\"), make(\"regexp\")])","outcome":{"ok":true,"value":"[\"1970-01-01T00:00:00.000Z\",\"https://user@a.test:8080/p%20a?q=1&r=%20#h\",{},{\"x-a\":\"1, 3\",\"x-b\":\"2\"},{\"0\":1,\"1\":2,\"2\":3},{\"type\":\"Buffer\",\"data\":[104,105]},{}]"},"kept":[]}, + {"code":"const s = \"a\\ud800b\"; const back = keep(s); return [back === s, back.length, back.charCodeAt(1), keep(\"\\udc00\") === \"\\udc00\", keep(\"\\ud83d\\ude00\") === \"\\ud83d\\ude00\", keep(\"\\ude00\\ud83d\").length]","outcome":{"ok":true,"value":[true,3,55296,true,true,2]},"kept":[{"string":[97,55296,98]},{"string":[56320]},"😀",{"string":[56832,55357]}]}, + {"code":"const k = \"\\udc00\"; const back = keep({ [k]: \"x\\ud83d\", n: [\"\\udbff\"], m: new Map([[\"\\ud800\", new Set([\"\\udfff\"])]]) }); return [Object.keys(back)[0] === k, back[k] === \"x\\ud83d\", back.n[0] === \"\\udbff\", [...back.m.get(\"\\ud800\")][0] === \"\\udfff\"]","outcome":{"ok":true,"value":[true,true,true,true]},"kept":[{"object":[[{"string":[56320]},{"string":[120,55357]}],["n",{"array":[{"string":[56319]}]}],["m",{"map":[[{"string":[55296]},{"set":[{"string":[57343]}]}]]}]]}]}, + {"code":"const e = new Error(\"bad \\ud800\"); e[\"\\udc00\"] = \"\\udfff\"; const back = keep(e); return [back.message === \"bad \\ud800\", back[\"\\udc00\"] === \"\\udfff\", back instanceof Error]","outcome":{"ok":true,"value":[true,true,true]},"kept":[{"error":{"name":"Error","message":{"string":[98,97,100,32,55296]},"fields":[[{"string":[56320]},{"string":[57343]}]]}}]}, + {"code":"const l = make(\"lone\"); const o = make(\"loneKeys\"); const e = make(\"loneError\"); return [l === \"a\\ud800b\", l.length, Object.keys(o)[0] === \"\\udc00\", o[\"\\udc00\"] === \"x\\ud83d\", o.pair, o.list[0].charCodeAt(0), e.message === \"bad \\ud800\", e[\"\\udfff\"] === \"\\ud800\"]","outcome":{"ok":true,"value":[true,3,true,true,"😀",56319,true,true]},"kept":[]}, + {"code":"const l = make(\"lone\"); return [l.isWellFormed(), l.toWellFormed(), encodeURIComponent(l.toWellFormed()), new TextEncoder().encode(l).length]","outcome":{"ok":true,"value":[false,"a�b","a%EF%BF%BDb",5]},"kept":[]}, + {"code":"const p = tools[\"\\ud800\"]; let m; try { await p() } catch (e) { m = e.message } let k; try { Object.keys(p) } catch (e) { k = e.message } let a; try { await tools[\"\\udc00\"](Symbol.iterator) } catch (e) { a = e.message } return [m === \"No function at tools.\\ud800.\", k === \"No namespace at tools.\\ud800.\", a]","outcome":{"ok":true,"value":[true,true,"Argument 1 to tools[\"\\udc00\"] contains a symbol, which cannot be passed to the host."]},"kept":[]}, + {"code":"const e = new Error(\"m\"); e.name = \"N\\ud800\"; const back = keep(e); return [back.name === \"N\\ud800\", keep(new RegExp(\"a\\ud800\")).source === new RegExp(\"a\\ud800\").source]","outcome":{"ok":true,"value":[true,true]},"kept":[{"error":{"name":{"string":[78,55296]},"message":"m","fields":[["name",{"string":[78,55296]}]]}},{"regexp":[{"string":[97,55296]},""]}]}, + {"code":"keep({ f() {}, a: [1, () => 2, , 3], m: new Map([[\"k\", () => 1], [() => 2, \"v\"]]), s: new Set([() => 1, 2]), n: { g: Math.max, b: keep.bind(null), k: keep } }); keep(() => 1); keep([keep]); return 1","outcome":{"ok":true,"value":1},"kept":[{"object":[["a",{"array":[1,null,{"hole":true},3]}],["m",{"map":[["k",{"undefined":true}],[{"undefined":true},"v"]]}],["s",{"set":[{"undefined":true},2]}],["n",{"object":[]}]]},{"undefined":true},{"array":[null]}]}, + {"code":"const later = (v) => (async () => { await null; return v })()\n keep({ a: Promise.resolve(1), b: [Promise.resolve(2), later(3)], m: new Map([[Promise.resolve(\"k\"), later(\"v\")]]), s: new Set([later(4)]) }); keep(later(5), 6); return 1","outcome":{"ok":true,"value":1},"kept":[{"object":[["a",1],["b",{"array":[2,3]}],["m",{"map":[["k","v"]]}],["s",{"set":[4]}]]},5]}, + {"code":"const inner = (async () => { await null; return [() => 1, \"in\"] })(); keep({ outer: (async () => { await null; return { inner, f: () => 2 } })() }); return 1","outcome":{"ok":true,"value":1},"kept":[{"object":[["outer",{"object":[["inner",{"array":[null,"in"]}]]}]]}]}, + {"code":"try { keep({ p: (async () => { await null; throw new RangeError(\"late\") })() }); return \"no\" } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["RangeError","late"]},"kept":[]}, + {"code":"const o = {}; o.p = Promise.resolve(o); try { keep(o) } catch (e) { return e.message }","outcome":{"ok":true,"value":"Argument 1 to keep contains a circular value."},"kept":[]}, + {"code":"const a = {}; a.p = (async () => { await null; return a })(); try { keep(a) } catch (e) { return e.message }","outcome":{"ok":true,"value":"Argument 1 to keep contains a circular value."},"kept":[]}, + {"code":"const p = Promise.resolve({ v: 1 }); keep({ a: p, b: [p, p] }); return 1","outcome":{"ok":true,"value":1},"kept":[{"object":[["a",{"object":[["v",1]]}],["b",{"array":[{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]}, + {"code":"const e = new TypeError(\"bad\", { cause: (async () => { await null; return new Error(\"root\") })() }); e.code = 7; e.fn = () => 1; e.sym = Symbol.iterator; e.later = Promise.resolve(8)\n keep(e); keep(Object.assign(new Error(\"m\"), { name: \"Custom\", extra: 1 })); keep(new AggregateError([1], \"agg\")); const f = new Error(\"f\"); f.name = \"RangeError\"; keep(f); return 1","outcome":{"ok":true,"value":1},"kept":[{"error":{"name":"TypeError","message":"bad","cause":{"error":{"name":"Error","message":"root","fields":[]}},"fields":[["code",7],["later",8]]}},{"error":{"name":"Custom","message":"m","fields":[["name","Custom"],["extra",1]]}},{"error":{"name":"AggregateError","message":"agg","fields":[]}},{"error":{"name":"RangeError","message":"f","fields":[["name","RangeError"]]}}]}, + {"code":"let o = 1; for (let i = 0; i < 32; i++) o = { o }; keep(o); let p = 1; for (let i = 0; i < 31; i++) p = { p }; keep(Promise.resolve(p)); try { keep(Promise.resolve(o)) } catch (e) { return e.message }","outcome":{"ok":true,"value":"Argument 1 to keep exceeds the maximum value depth of 32."},"kept":[{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",1]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]},{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",{"object":[["p",1]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]}, + {"code":"try { keep({ t: tools }) } catch (e) { return e.message }","outcome":{"ok":true,"value":"Argument 1 to keep contains a namespace reference, which cannot be passed to the host."},"kept":[]}, + {"code":"return [1, 2].map((x) => keep({ x: (async () => { await null; return x })() }))","outcome":{"ok":true,"value":[{"x":1},{"x":2}]},"kept":[{"object":[["x",1]]},{"object":[["x",2]]}]}, + {"code":"const log = []; async function f() { log.push(\"f\"); const v = keep((async () => { await null; log.push(\"v\"); return 1 })()); log.push(\"kept\"); return v } const p = f(); log.push(\"after\"); await p; return log","outcome":{"ok":true,"value":["f","after","v","kept"]},"kept":[1]}, + {"code":"function* g() { yield keep((async () => { await null; return 1 })()) } return [...g()]","outcome":{"ok":true,"value":[1]},"kept":[1]} + ] + }, + "configuration": [ + {"globals":["later","files"],"code":"return [typeof read, typeof later]","modules":null,"outcome":{"ok":true,"value":["function","function"]},"seen":[]}, + {"globals":["later"],"code":"return [typeof read, typeof later, await later(1)]","modules":null,"outcome":{"ok":true,"value":["undefined","function",2]},"seen":[["later",[1]]]}, + {"globals":[],"code":"return [typeof read, typeof later]","modules":null,"outcome":{"ok":true,"value":["undefined","undefined"]},"seen":[]}, + {"globals":["later","files"],"code":"return [read(), await later(2)]","modules":null,"outcome":{"ok":true,"value":["text",3]},"seen":[["read",[]],["later",[2]]]}, + {"globals":["glob"],"code":"const g = new Glob(\".ts\"); return [g.match(\"a.ts\"), g.match(\"a.js\")]","modules":null,"outcome":{"ok":true,"value":[true,false]},"seen":[["Glob",[".ts"]]]}, + {"globals":["glob"],"code":"return Glob(\".ts\").match(\"a.ts\")","modules":null,"outcome":{"ok":true,"value":true},"seen":[["Glob",[".ts"]]]}, + {"globals":["glob"],"code":"return new Glob(...[\".ts\"]).match(\"a.ts\")","modules":null,"outcome":{"ok":true,"value":true},"seen":[["Glob",[".ts"]]]}, + {"globals":["glob"],"code":"new (new Glob(\".ts\").match)(\"a\")","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: new The called value(...) is not supported; call The called value(...) without new instead. (line 1, col 1)"},"seen":[["Glob",[".ts"]]]}, + {"globals":["glob"],"code":"return [typeof Glob, Glob.length, new Glob(\"x\") instanceof Object]","modules":null,"outcome":{"ok":true,"value":["function",1,true]},"seen":[["Glob",["x"]]]}, + {"globals":["sum"],"code":"return new Sum(1, 2).total + 1","modules":null,"outcome":{"ok":true,"value":4},"seen":[["Sum",[1,2]]]}, + {"globals":["sum"],"code":"return new Sum(...[1, 2]).total + 1","modules":null,"outcome":{"ok":true,"value":4},"seen":[["Sum",[1,2]]]}, + {"globals":["sum"],"code":"return new Sum((async () => { await null; return 1 })(), 2).total + 1","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Argument 1 to Sum contains an un-awaited Promise, which cannot be passed to the host. (line 1, col 8)"},"seen":[]}, + {"globals":["sum"],"translate":{"promises":"await"},"code":"return new Sum((async () => { await null; return 1 })(), 2).total + 1","modules":null,"outcome":{"ok":true,"value":4},"seen":[["Sum",[1,2]]]}, + {"globals":["plain"],"code":"new plain()","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: new plain(...) is not supported; call plain(...) without new instead. (line 1, col 1)"},"seen":[]}, + {"globals":["plain","later"],"code":"try { new later(1) } catch (e) { return e.message }","modules":null,"outcome":{"ok":true,"value":"new later(...) is not supported; call later(...) without new instead."},"seen":[]}, + {"globals":["bun"],"code":"import Loaded, { file } from \"bun\"\nreturn [file(\"a\").name, Loaded === Bun, typeof require(\"bun\").file, typeof (await import(\"bun\")).file]","modules":null,"outcome":{"ok":true,"value":["a",true,"function","function"]},"seen":[]}, + {"globals":["bun"],"code":"return [typeof require(\"node:bun\").file, require(\"Bun\") === Bun]","modules":null,"outcome":{"ok":true,"value":["function",true]},"seen":[]}, + {"globals":[],"modules":["bun"],"code":"import { file } from \"bun\"","outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: Cannot import \"bun\": this runtime doesn't provide it. (line 1, col 10)"},"seen":[]}, + {"globals":[],"code":"import { file } from \"bun\"","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: Cannot import \"bun\": this runtime doesn't provide it. (line 1, col 10)"},"seen":[]}, + {"globals":["one","two"],"code":"return require(\"shared\").id()","modules":null,"outcome":{"ok":true,"value":"b"},"seen":[]}, + {"globals":["two","one"],"code":"return require(\"shared\").id()","modules":null,"outcome":{"ok":true,"value":"a"},"seen":[]}, + {"globals":["one"],"code":"return require(\"shared\").id()","modules":null,"outcome":{"ok":true,"value":"a"},"seen":[]}, + {"globals":["fs"],"code":"import yaml from \"yaml\"","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: Cannot import \"yaml\": packages can't be installed here. (line 1, col 8)"},"seen":[]}, + {"globals":["fs"],"code":"import ws from \"ws\"","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: Cannot import \"ws\": packages can't be installed here. (line 1, col 8)"},"seen":[]}, + {"globals":["fs"],"code":"import pkg from \"@scope/pkg\"","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: Cannot import \"@scope/pkg\": packages can't be installed here. (line 1, col 8)"},"seen":[]}, + {"globals":["fs"],"code":"import x from \"./local.js\"","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: Cannot import \"./local.js\": local files can't be imported. (line 1, col 8)"},"seen":[]}, + {"globals":["fs"],"code":"import x from \"../up.js\"","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: Cannot import \"../up.js\": local files can't be imported. (line 1, col 8)"},"seen":[]}, + {"globals":["fs"],"code":"import x from \"/abs.js\"","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: Cannot import \"/abs.js\": local files can't be imported. (line 1, col 8)"},"seen":[]}, + {"globals":["fs"],"code":"import x from \"file:///a.js\"","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: Cannot import \"file:///a.js\": local files can't be imported. (line 1, col 8)"},"seen":[]}, + {"globals":["fs"],"code":"import x from \"node:sqlite\"","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: Cannot import \"node:sqlite\": this runtime doesn't provide it. (line 1, col 8)"},"seen":[]}, + {"globals":["fs"],"code":"import x from \"bun\"","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: Cannot import \"bun\": this runtime doesn't provide it. (line 1, col 8)"},"seen":[]}, + {"globals":["fs"],"code":"import x from \"bun:sqlite\"","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: Cannot import \"bun:sqlite\": this runtime doesn't provide it. (line 1, col 8)"},"seen":[]}, + {"globals":["fs"],"code":"import x from \"fs/extra\"","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: Cannot import \"fs/extra\": this runtime doesn't provide it. (line 1, col 8)"},"seen":[]}, + {"globals":["fs"],"code":"import x from \"zlib\"","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: Cannot import \"zlib\": this runtime doesn't provide it. (line 1, col 8)"},"seen":[]}, + {"globals":["fs"],"code":"try { await import(\"child_process\") } catch (e) { return e.message }","modules":null,"outcome":{"ok":true,"value":"Cannot import \"child_process\": this runtime doesn't provide it."},"seen":[]}, + {"globals":["fs"],"code":"try { require(\"./x\") } catch (e) { return e.message }","modules":null,"outcome":{"ok":true,"value":"Cannot import \"./x\": local files can't be imported."},"seen":[]}, + {"globals":["fs"],"code":"import { writeFile } from \"fs\"","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"SyntaxError: \"fs\" has no export named \"writeFile\". (line 1, col 10)"},"seen":[]}, + {"globals":[],"code":"require(\"fs\")","modules":null,"outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: Cannot import \"fs\": this runtime doesn't provide it. (line 1, col 1)"},"seen":[]} + ], + "results": [ + {"code":"console.log(\"a\\ud800\"); console.log(\"pair \\ud83d\\ude00\", \"\\udc00\"); console.log({ k: \"\\udbff\" })\nreturn { s: \"x\\udbff\", [\"\\udfff\"]: [\"\\ud800\", { k: \"\\ud83d\" }], pair: \"\\ud83d\\ude00\", n: 1 }","value":{"object":[["s",{"string":[120,56319]}],[{"string":[57343]},{"array":[{"string":[55296]},{"object":[["k",{"string":[55357]}]]}]}],["pair","😀"],["n",1]]},"warnings":[],"logs":[{"string":[97,55296]},{"string":[112,97,105,114,32,55357,56832,32,56320]},"{\"k\":\"\\udbff\"}"],"truncated":false}, + {"code":"return \"\\ud800\\udc00\\udc00\"","value":{"string":[55296,56320,56320]},"warnings":[],"logs":[],"truncated":false}, + {"code":"return [\"\\ud800\".repeat(10), 1]","limits":{"maxOutputBytes":20},"value":"[\"\\ud800\\ud800\\ud800 [result truncated: 66 bytes exceeds the 20-byte output limit; return a smaller value]","warnings":[],"logs":[],"truncated":true}, + {"code":"console.log(\"\\ud800\".repeat(4)); console.log(\"b\"); return 1","limits":{"maxOutputBytes":14},"value":1,"warnings":[],"logs":[{"string":[55296,55296,55296,55296]},"[logs truncated: showing 1 of 2 lines]"],"truncated":true}, + {"code":"throw new TypeError(\"bad \\udc00 \\ud83d\\ude00\")","error":{"kind":"ExecutionFailure","message":{"string":[84,121,112,101,69,114,114,111,114,58,32,98,97,100,32,56320,32,55357,56832]}},"warnings":[],"logs":[],"truncated":false}, + {"code":"throw \"y\\ud800\"","error":{"kind":"ExecutionFailure","message":{"string":[85,110,99,97,117,103,104,116,58,32,121,55296]}},"warnings":[],"logs":[],"truncated":false}, + {"code":"throw { a: \"\\udbff\" }","error":{"kind":"ExecutionFailure","message":"Uncaught: {\"a\":\"\\udbff\"}"},"warnings":[],"logs":[],"truncated":false}, + {"code":"Promise.reject(new Error(\"w\\ud800\")); Promise.reject(\"\\udfff\"); return 1","value":1,"warnings":[{"kind":"ExecutionFailure","message":{"string":[85,110,104,97,110,100,108,101,100,32,114,101,106,101,99,116,105,111,110,32,102,114,111,109,32,97,110,32,117,110,45,97,119,97,105,116,101,100,32,112,114,111,109,105,115,101,58,32,69,114,114,111,114,58,32,119,55296]}},{"kind":"ExecutionFailure","message":{"string":[85,110,104,97,110,100,108,101,100,32,114,101,106,101,99,116,105,111,110,32,102,114,111,109,32,97,110,32,117,110,45,97,119,97,105,116,101,100,32,112,114,111,109,105,115,101,58,32,85,110,99,97,117,103,104,116,58,32,57343]}}],"logs":[],"truncated":false}, + {"code":"null[\"\\ud800\"]","error":{"kind":"ExecutionFailure","message":{"string":[84,121,112,101,69,114,114,111,114,58,32,67,97,110,110,111,116,32,114,101,97,100,32,112,114,111,112,101,114,116,105,101,115,32,111,102,32,110,117,108,108,32,40,114,101,97,100,105,110,103,32,39,55296,39,41,46,32,40,108,105,110,101,32,49,44,32,99,111,108,32,49,41]}},"warnings":[],"logs":[],"truncated":false}, + {"code":"return [s === \"a\\ud800\", o[\"\\udc00\"] === \"\\udbff\", s.length]","bindings":{"object":[["s",{"string":[97,55296]}],["o",{"object":[[{"string":[56320]},{"string":[56319]}]]}]]},"value":{"array":[true,true,2]},"warnings":[],"logs":[],"truncated":false} + ] +} diff --git a/packages/codemode-rust/conformance/boundary.ts b/packages/codemode-rust/conformance/boundary.ts new file mode 100644 index 0000000000000..b3c8607567732 --- /dev/null +++ b/packages/codemode-rust/conformance/boundary.ts @@ -0,0 +1,344 @@ +#!/usr/bin/env bun + +// Regenerates conformance/boundary.json from the reference's language layer (`Language.Runtime.make`): host values of +// every type crossing into programs and program values crossing out (`boundary`), and runtimes made with different +// host globals and module names (`configuration`): constructible globals, `import`/`require` by module name, and why +// an import can't be resolved. The Rust tests replay this recording. +// Usage: bun conformance/boundary.ts [reference] — the reference CodeMode package directory, from the argument, +// CODEMODE_REF, or by default ../codemode relative to this workspace. +// +// `boundary` programs run in `Runtime.make({ globals, translate: { functions: "drop", promises: "await" } })`, no +// `modules`, no `limits`, whose `globals()` gives: +// - `tools`: the namespace of conformance/reference.ts. +// - `keep(value)`: `Host.fn`, sync, `takesFunctions: true`; records `describe(value)` (see conformance/reference.ts) +// in the program's `kept` and gives `value` back. +// - `make(name)`: `Host.fn`, sync, `takesFunctions: true`; gives `samples[name]` (a fresh copy crosses each call). +// - `kind(value)`: `Host.fn`, sync, `takesFunctions: true`; gives `value.constructor.name` as the host sees it. +// Each `run` takes one parameter (`length` 1) and is named by its global. +// +// `configuration` entries run in `Runtime.make({ globals, modules, translate? })` (the entry's `translate`, by default +// the reference's; no limits): `globals()` +// gives the globals of every set named in the entry's `globals`, and `modules` merges the module names of every set +// named in its `modules` (the same sets as `globals` when absent), a later set's name winning. Every host function +// below records `[name, args.map(describe)]` in the entry's `seen` when it says so, and its `run` takes as many +// parameters as listed: +// - `later`: `later(n)`, async; records; gives `n + 1`. +// - `files`: `read()`, sync; records; gives `"text"`. +// - `glob`: `Glob(pattern)`, sync, `constructible: true`; records; gives `{ match }`, where `match(name)` is a +// function inside the result giving `name.endsWith(pattern)`. +// - `sum`: `Sum(...values)` (no parameters), sync, `constructible: true`; records; gives +// `Effect.succeed({ total })`, the sum of `values`. +// - `plain`: `plain()`, sync; gives 1. +// - `bun`: `Bun`, a plain object `{ file }` where `file(path)` is sync and gives `{ name: path }`; module names +// `{ bun: "Bun" }`. +// - `one`: `A`, `{ id }` where `id()` gives `"a"`; module names `{ shared: "A" }`. +// - `two`: `B`, `{ id }` where `id()` gives `"b"`; module names `{ shared: "B" }`. +// - `fs`: `fs`, `{ readFile, promises: { readFile } }`: `readFile(path)` sync, giving `"text of "`; +// `promises.readFile(path)` async, giving `path`. +// +// `results` entries run in `Runtime.make({ limits? })` with no globals, and the entry's `bindings` (recorded as +// `describe` writes them): what a program returns and logs when its strings +// have unpaired surrogates, which the result and logs keep, and how the output limit measures them. +// +// boundary.json: `{ boundary: { samples: { name: described }, programs: [{ code, outcome, kept }] }, +// configuration: [{ globals, modules, translate?, code, outcome, seen }], results: [{ code, limits?, value | error, +// warnings, logs, truncated }] }`; `outcome` is `{ ok: true, value }` or `{ ok: false, kind, message }`, `modules` +// `null` when the +// entry names none of its own. A `results` entry's `value` is the result's value as `describe` writes it, `logs` its +// log lines as `describe` writes a string, and `error` (a failed run) and `warnings` its diagnostics: `{ kind, message, +// suggestions? }`, the message and suggestions as `describe` writes a string. + +import { join } from "node:path" +import { writeRecording } from "./recording.ts" +import { describe, reference, toolsGlobal } from "./reference.ts" + +type Json = null | boolean | number | string | Array | { [key: string]: Json } + +const ref = await reference(process.argv[2] ?? process.env.CODEMODE_REF) +const Effect = ref.Effect +const Host = ref.Language.Host +const Runtime = ref.Language.Runtime +const tools = toolsGlobal(ref) + +const outcome = (result: { ok: boolean; value?: unknown; error?: { kind: string; message: string } }) => + result.ok + ? { ok: true, value: result.value } + : { ok: false, kind: result.error!.kind, message: result.error!.message } + +const samples: Record = { + date: new Date(0), + invalidDate: new Date(Number.NaN), + regexp: /a+\/b/gi, + url: new URL("https://user@a.test:8080/p a?q=1&r=%20#h"), + params: new URLSearchParams("a=1&b=2&a=3"), + headers: new Headers([ + ["X-B", "2"], + ["x-a", "1"], + ["X-A", " 3 "], + ]), + bytes: new Uint8Array([1, 2, 3]), + buffer: Buffer.from("hi"), + arrayBuffer: new Uint8Array([4, 5]).buffer, + nested: { + when: new Date(1e12), + links: [new URL("https://b.test/x")], + table: new Map([[new Date(5), new Headers({ k: "v" })]]), + tags: new Set([new Uint8Array([9])]), + failure: Object.assign(new RangeError("bad", { cause: new Date(7) }), { at: new URL("https://c.test/") }), + }, + // Strings with unpaired surrogates, which have no UTF-8 form: as a value, a key, an error's message and field. + lone: "a\ud800b", + loneKeys: { "\udc00": "x\ud83d", pair: "\ud83d\ude00", list: ["\udbff"] }, + loneError: Object.assign(new Error("bad \ud800"), { "\udfff": "\ud800" }), +} +const boundaryPrograms = [ + `const o = { n: 1, list: [1], d: new Date(0), u: new URL("https://a.test/") }; keep(o); o.n = 2; o.list.push(2); return o.n`, + `const h = make("headers"); h.set("x-a", "2"); const back = keep(h); back.set("x-a", "3"); return [h instanceof Headers, h.get("x-a"), back === h, back.get("x-a"), [...back], [...make("headers")]]`, + `const b = make("bytes"); b[0] = 42; const mine = new Uint8Array([5]); const name = kind(mine); return [[...b], [...make("bytes")], [...make("arrayBuffer")], b instanceof Uint8Array, name, mine[0], kind(make("arrayBuffer"))]`, + `const d = make("date"); return [d instanceof Date, d.getTime(), d.toISOString(), make("invalidDate").getTime(), keep(new Date(86400000)).getTime(), keep(new Date(NaN)).getTime()]`, + `const r = make("regexp"); return [r instanceof RegExp, r.source, r.flags, r.test("aa/b"), keep(/x(y)\\//m).source]`, + `const u = make("url"); return [u instanceof URL, u.href, u.pathname, u.port, u.searchParams.get("r"), keep(u).href, keep(u.searchParams).toString()]`, + `const p = make("params"); return [p instanceof URLSearchParams, p.getAll("a"), p.toString(), keep(new URLSearchParams("x=1&x=2")).toString()]`, + `const b = make("buffer"); return [Buffer.isBuffer(b), b.toString(), keep(Buffer.from("yo")).length, keep(new Uint8Array([7]))[0], kind(Buffer.from("z")), kind(new Uint8Array(1))]`, + `return make("nested")`, + `const n = make("nested"); return [n.when instanceof Date, n.links[0].host, [...n.table.keys()][0].getTime(), [...n.table.values()][0].get("k"), [...[...n.tags][0]], n.failure instanceof RangeError, n.failure.cause.getTime(), n.failure.at.href]`, + `keep(make("nested")); return 1`, + `keep(new Map([[new Date(1), new Set([new URL("https://m.test/")])]])); return 1`, + `keep([new Headers({ "X-Y": "1" }), new URLSearchParams("z=9"), /q/]); return 1`, + `function f() { return keep(arguments) }\nf(1, "two"); keep(new WeakMap()); keep(new TextDecoder()); return 1`, + `try { keep((function* () {})()) } catch (e) { return e.message }`, + `try { keep(new Map().entries()) } catch (e) { return e.message }`, + `try { keep({ p: Promise.resolve(1) }) } catch (e) { return e.message }`, + `return JSON.stringify([make("date"), make("url"), make("params"), make("headers"), make("bytes"), make("buffer"), make("regexp")])`, +] +// Strings with unpaired surrogates cross both ways unchanged: the host sees, and gives back, the program's code units. +// The programs return what they compare, as the recording's JSON can't hold such a string. +boundaryPrograms.push( + `const s = "a\\ud800b"; const back = keep(s); return [back === s, back.length, back.charCodeAt(1), keep("\\udc00") === "\\udc00", keep("\\ud83d\\ude00") === "\\ud83d\\ude00", keep("\\ude00\\ud83d").length]`, + `const k = "\\udc00"; const back = keep({ [k]: "x\\ud83d", n: ["\\udbff"], m: new Map([["\\ud800", new Set(["\\udfff"])]]) }); return [Object.keys(back)[0] === k, back[k] === "x\\ud83d", back.n[0] === "\\udbff", [...back.m.get("\\ud800")][0] === "\\udfff"]`, + `const e = new Error("bad \\ud800"); e["\\udc00"] = "\\udfff"; const back = keep(e); return [back.message === "bad \\ud800", back["\\udc00"] === "\\udfff", back instanceof Error]`, + `const l = make("lone"); const o = make("loneKeys"); const e = make("loneError"); return [l === "a\\ud800b", l.length, Object.keys(o)[0] === "\\udc00", o["\\udc00"] === "x\\ud83d", o.pair, o.list[0].charCodeAt(0), e.message === "bad \\ud800", e["\\udfff"] === "\\ud800"]`, + `const l = make("lone"); return [l.isWellFormed(), l.toWellFormed(), encodeURIComponent(l.toWellFormed()), new TextEncoder().encode(l).length]`, + // A namespace path's names reach the host's resolve and keys as the program wrote them; a label escapes them. + `const p = tools["\\ud800"]; let m; try { await p() } catch (e) { m = e.message } let k; try { Object.keys(p) } catch (e) { k = e.message } let a; try { await tools["\\udc00"](Symbol.iterator) } catch (e) { a = e.message } return [m === "No function at tools.\\ud800.", k === "No namespace at tools.\\ud800.", a]`, + // An error's own name and a RegExp's source cross unchanged. + `const e = new Error("m"); e.name = "N\\ud800"; const back = keep(e); return [back.name === "N\\ud800", keep(new RegExp("a\\ud800")).source === new RegExp("a\\ud800").source]`, +) + +// What a host function receives under the runtime's translation: a function is left out (an object's key is skipped, +// an array's item is null, an argument is undefined, a Map's or Set's entry is undefined), a fulfilled promise is its +// value, and the call waits for one that hasn't fulfilled, then crosses its arguments again. +boundaryPrograms.push( + `keep({ f() {}, a: [1, () => 2, , 3], m: new Map([["k", () => 1], [() => 2, "v"]]), s: new Set([() => 1, 2]), n: { g: Math.max, b: keep.bind(null), k: keep } }); keep(() => 1); keep([keep]); return 1`, + `const later = (v) => (async () => { await null; return v })() + keep({ a: Promise.resolve(1), b: [Promise.resolve(2), later(3)], m: new Map([[Promise.resolve("k"), later("v")]]), s: new Set([later(4)]) }); keep(later(5), 6); return 1`, + `const inner = (async () => { await null; return [() => 1, "in"] })(); keep({ outer: (async () => { await null; return { inner, f: () => 2 } })() }); return 1`, + `try { keep({ p: (async () => { await null; throw new RangeError("late") })() }); return "no" } catch (e) { return [e.name, e.message] }`, + `const o = {}; o.p = Promise.resolve(o); try { keep(o) } catch (e) { return e.message }`, + `const a = {}; a.p = (async () => { await null; return a })(); try { keep(a) } catch (e) { return e.message }`, + `const p = Promise.resolve({ v: 1 }); keep({ a: p, b: [p, p] }); return 1`, + `const e = new TypeError("bad", { cause: (async () => { await null; return new Error("root") })() }); e.code = 7; e.fn = () => 1; e.sym = Symbol.iterator; e.later = Promise.resolve(8) + keep(e); keep(Object.assign(new Error("m"), { name: "Custom", extra: 1 })); keep(new AggregateError([1], "agg")); const f = new Error("f"); f.name = "RangeError"; keep(f); return 1`, + `let o = 1; for (let i = 0; i < 32; i++) o = { o }; keep(o); let p = 1; for (let i = 0; i < 31; i++) p = { p }; keep(Promise.resolve(p)); try { keep(Promise.resolve(o)) } catch (e) { return e.message }`, + `try { keep({ t: tools }) } catch (e) { return e.message }`, + `return [1, 2].map((x) => keep({ x: (async () => { await null; return x })() }))`, + `const log = []; async function f() { log.push("f"); const v = keep((async () => { await null; log.push("v"); return 1 })()); log.push("kept"); return v } const p = f(); log.push("after"); await p; return log`, + `function* g() { yield keep((async () => { await null; return 1 })()) } return [...g()]`, +) + +const probe = (kept: Array) => ({ + tools, + keep: Host.fn( + ([value]: ReadonlyArray) => { + kept.push(describe(value)) + return value + }, + { takesFunctions: true }, + ), + make: Host.fn(([name]: ReadonlyArray) => samples[name], { takesFunctions: true }), + kind: Host.fn(([value]: ReadonlyArray<{ constructor: { name: string } }>) => value.constructor.name, { + takesFunctions: true, + }), +}) +const boundary = { + samples: Object.fromEntries(Object.entries(samples).map(([k, v]) => [k, describe(v)])), + programs: [] as Array, +} +for (const code of boundaryPrograms) { + const kept: Array = [] + const runtime = Runtime.make({ globals: () => probe(kept), translate: { functions: "drop", promises: "await" } }) + const result = await Effect.runPromise(runtime.execute(code)) + boundary.programs.push({ code, outcome: outcome(result), kept }) +} + +let seen: Array = [] +const saw = (name: string, args: ReadonlyArray) => void seen.push([name, args.map(describe)]) +const library: Record; modules?: Record }> = { + later: { + globals: { + later: Host.fn( + ([n]: ReadonlyArray) => + Effect.sync(() => { + saw("later", [n]) + return n + 1 + }), + { type: "async" }, + ), + }, + }, + files: { + globals: { + read: Host.fn(() => { + saw("read", []) + return "text" + }), + }, + }, + glob: { + globals: { + Glob: Host.fn( + ([pattern]: ReadonlyArray) => { + saw("Glob", [pattern]) + return { match: (name: string) => name.endsWith(pattern) } + }, + { constructible: true }, + ), + }, + }, + sum: { + globals: { + Sum: Host.fn( + (...[values]: [ReadonlyArray]) => { + saw("Sum", values) + return Effect.succeed({ total: values.reduce((total, value) => total + value, 0) }) + }, + { constructible: true }, + ), + }, + }, + plain: { globals: { plain: Host.fn(() => 1) } }, + bun: { + globals: { Bun: { file: Host.fn(([path]: ReadonlyArray) => ({ name: path })) } }, + modules: { bun: "Bun" }, + }, + one: { globals: { A: { id: Host.fn(() => "a") } }, modules: { shared: "A" } }, + two: { globals: { B: { id: Host.fn(() => "b") } }, modules: { shared: "B" } }, + fs: { + globals: { + fs: { + readFile: Host.fn(([path]: ReadonlyArray) => `text of ${path}`), + promises: { readFile: Host.fn(([path]: ReadonlyArray) => Effect.succeed(path), { type: "async" }) }, + }, + }, + }, +} +type ConfigurationCase = { globals: Array; modules?: Array; translate?: unknown; code: string } +const configurationCases: Array = [ + // A runtime's globals: every set it names, and nothing else. + { globals: ["later", "files"], code: `return [typeof read, typeof later]` }, + { globals: ["later"], code: `return [typeof read, typeof later, await later(1)]` }, + { globals: [], code: `return [typeof read, typeof later]` }, + { globals: ["later", "files"], code: `return [read(), await later(2)]` }, + // A constructible global works with new and gives what the host function returns. + { globals: ["glob"], code: `const g = new Glob(".ts"); return [g.match("a.ts"), g.match("a.js")]` }, + { globals: ["glob"], code: `return Glob(".ts").match("a.ts")` }, + { globals: ["glob"], code: `return new Glob(...[".ts"]).match("a.ts")` }, + { globals: ["glob"], code: `new (new Glob(".ts").match)("a")` }, + { globals: ["glob"], code: `return [typeof Glob, Glob.length, new Glob("x") instanceof Object]` }, + { globals: ["sum"], code: `return new Sum(1, 2).total + 1` }, + { globals: ["sum"], code: `return new Sum(...[1, 2]).total + 1` }, + { globals: ["sum"], code: `return new Sum((async () => { await null; return 1 })(), 2).total + 1` }, + { + globals: ["sum"], + translate: { promises: "await" }, + code: `return new Sum((async () => { await null; return 1 })(), 2).total + 1`, + }, + { globals: ["plain"], code: `new plain()` }, + { globals: ["plain", "later"], code: `try { new later(1) } catch (e) { return e.message }` }, + // Module names load their globals; a name whose global the runtime lacks loads nothing; a later set's name wins. + { + globals: ["bun"], + code: `import Loaded, { file } from "bun" +return [file("a").name, Loaded === Bun, typeof require("bun").file, typeof (await import("bun")).file]`, + }, + { globals: ["bun"], code: `return [typeof require("node:bun").file, require("Bun") === Bun]` }, + { globals: [], modules: ["bun"], code: `import { file } from "bun"` }, + { globals: [], code: `import { file } from "bun"` }, + { globals: ["one", "two"], code: `return require("shared").id()` }, + { globals: ["two", "one"], code: `return require("shared").id()` }, + { globals: ["one"], code: `return require("shared").id()` }, + // An import that can't be resolved says why. + ...[ + `import yaml from "yaml"`, + `import ws from "ws"`, + `import pkg from "@scope/pkg"`, + `import x from "./local.js"`, + `import x from "../up.js"`, + `import x from "/abs.js"`, + `import x from "file:///a.js"`, + `import x from "node:sqlite"`, + `import x from "bun"`, + `import x from "bun:sqlite"`, + `import x from "fs/extra"`, + `import x from "zlib"`, + `try { await import("child_process") } catch (e) { return e.message }`, + `try { require("./x") } catch (e) { return e.message }`, + `import { writeFile } from "fs"`, + ].map((code) => ({ globals: ["fs"], code })), + { globals: [], code: `require("fs")` }, +] +const configuration: Array = [] +for (const item of configurationCases) { + seen = [] + const runtime = Runtime.make({ + globals: () => Object.assign({}, ...item.globals.map((name) => library[name]!.globals)), + modules: Object.assign({}, ...(item.modules ?? item.globals).map((name) => library[name]!.modules ?? {})), + ...(item.translate === undefined ? {} : { translate: item.translate }), + }) + const result = await Effect.runPromise(runtime.execute(item.code)) + configuration.push({ ...item, modules: item.modules ?? null, outcome: outcome(result), seen }) +} + +const resultCases: Array<{ code: string; limits?: { maxOutputBytes: number }; bindings?: Record }> = [ + { + code: `console.log("a\\ud800"); console.log("pair \\ud83d\\ude00", "\\udc00"); console.log({ k: "\\udbff" }) +return { s: "x\\udbff", ["\\udfff"]: ["\\ud800", { k: "\\ud83d" }], pair: "\\ud83d\\ude00", n: 1 }`, + }, + { code: `return "\\ud800\\udc00\\udc00"` }, + { code: `return ["\\ud800".repeat(10), 1]`, limits: { maxOutputBytes: 20 } }, + { code: `console.log("\\ud800".repeat(4)); console.log("b"); return 1`, limits: { maxOutputBytes: 14 } }, + // Diagnostics keep them too: an error's message, an uncaught value, an unhandled rejection's warning. + { code: `throw new TypeError("bad \\udc00 \\ud83d\\ude00")` }, + { code: `throw "y\\ud800"` }, + { code: `throw { a: "\\udbff" }` }, + { code: `Promise.reject(new Error("w\\ud800")); Promise.reject("\\udfff"); return 1` }, + { code: `null["\\ud800"]` }, + // Bindings carry them into the program, as values and as names of an object's keys. + { + code: `return [s === "a\\ud800", o["\\udc00"] === "\\udbff", s.length]`, + bindings: { s: "a\ud800", o: { "\udc00": "\udbff" } }, + }, +] +const results: Array = [] +for (const item of resultCases) { + const runtime = Runtime.make(item.limits === undefined ? {} : { limits: item.limits }) + const result = await Effect.runPromise(runtime.execute(item.code, { bindings: item.bindings })) + const diagnostic = (d: { kind: string; message: string; suggestions?: ReadonlyArray }) => ({ + kind: d.kind, + message: describe(d.message), + ...(d.suggestions === undefined ? {} : { suggestions: d.suggestions.map(describe) }), + }) + results.push({ + ...item, + ...(item.bindings === undefined ? {} : { bindings: describe(item.bindings) }), + ...(result.ok ? { value: describe(result.value) } : { error: diagnostic(result.error) }), + warnings: (result.ok ? (result.warnings ?? []) : []).map(diagnostic), + logs: (result.logs ?? []).map(describe), + truncated: result.truncated === true, + }) +} + +writeRecording(join(import.meta.dir, "boundary.json"), { boundary, configuration, results }) +console.log( + `${boundary.programs.length} boundary programs, ${configuration.length} configurations, ${results.length} results`, +) diff --git a/packages/codemode-rust/conformance/cases/array-basic-methods.js b/packages/codemode-rust/conformance/cases/array-basic-methods.js new file mode 100644 index 0000000000000..f5d2cec94256c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/array-basic-methods.js @@ -0,0 +1,7 @@ +const a = [1, 2, 3] +a.push(4, 5) +const popped = a.pop() +a.unshift(0) +const shifted = a.shift() +const spliced = a.splice(1, 1, "x", "y") +return [a, popped, shifted, spliced, a.slice(1, 3), a.slice(-2), a.concat([9], 10), a.indexOf("x"), a.includes(4), a.join("-"), [3, 1, 2].reverse(), a.length, a.at(-1)] diff --git a/packages/codemode-rust/conformance/cases/array-basic-methods.json b/packages/codemode-rust/conformance/cases/array-basic-methods.json new file mode 100644 index 0000000000000..563fe6e1e0e3b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/array-basic-methods.json @@ -0,0 +1,47 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 1, + "x", + "y", + 3, + 4 + ], + 5, + 0, + [ + 2 + ], + [ + "x", + "y" + ], + [ + 3, + 4 + ], + [ + 1, + "x", + "y", + 3, + 4, + 9, + 10 + ], + 1, + true, + "1-x-y-3-4", + [ + 2, + 1, + 3 + ], + 5, + 4 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/array-callback-methods.js b/packages/codemode-rust/conformance/cases/array-callback-methods.js new file mode 100644 index 0000000000000..0b034a379df0b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/array-callback-methods.js @@ -0,0 +1,4 @@ +const xs = [1, 2, 3, 4, 5] +const seen = [] +xs.forEach((x, i) => seen.push(x * i)) +return [xs.map((x) => x * 2), xs.filter((x) => x % 2), xs.reduce((a, b) => a + b), xs.reduce((a, b) => a + b, 10), xs.find((x) => x > 2), xs.findIndex((x) => x > 2), xs.find((x) => x > 9), xs.some((x) => x > 4), xs.every((x) => x > 0), xs.flatMap((x) => [x, x]), seen] diff --git a/packages/codemode-rust/conformance/cases/array-callback-methods.json b/packages/codemode-rust/conformance/cases/array-callback-methods.json new file mode 100644 index 0000000000000..ae002b09c8a32 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/array-callback-methods.json @@ -0,0 +1,46 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 2, + 4, + 6, + 8, + 10 + ], + [ + 1, + 3, + 5 + ], + 15, + 25, + 3, + 2, + null, + true, + true, + [ + 1, + 1, + 2, + 2, + 3, + 3, + 4, + 4, + 5, + 5 + ], + [ + 0, + 2, + 6, + 12, + 20 + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/array-construct.js b/packages/codemode-rust/conformance/cases/array-construct.js new file mode 100644 index 0000000000000..ff496688656f9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/array-construct.js @@ -0,0 +1 @@ +return [Array.from({ length: 3 }, (_, i) => i * i), Array.from("abc"), Array.from(new Set([1, 1, 2])), Array.isArray([]), Array.isArray("a"), new Array(3).fill(0), [[1, [2]], [3]].flat(), [1, 2, 3].lastIndexOf(3), Array.of(7, 8)] diff --git a/packages/codemode-rust/conformance/cases/array-construct.json b/packages/codemode-rust/conformance/cases/array-construct.json new file mode 100644 index 0000000000000..6ee4e4c4b4a27 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/array-construct.json @@ -0,0 +1,41 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 0, + 1, + 4 + ], + [ + "a", + "b", + "c" + ], + [ + 1, + 2 + ], + true, + false, + [ + 0, + 0, + 0 + ], + [ + 1, + [ + 2 + ], + 3 + ], + 2, + [ + 7, + 8 + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/array-sort.js b/packages/codemode-rust/conformance/cases/array-sort.js new file mode 100644 index 0000000000000..bfdde61193949 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/array-sort.js @@ -0,0 +1,4 @@ +const nums = [10, 1, 5, 100, 25] +const words = ["pear", "Apple", "fig", "banana"] +const people = [{ n: "a", age: 30 }, { n: "b", age: 20 }, { n: "c", age: 30 }, { n: "d", age: 20 }] +return [[...nums].sort(), [...nums].sort((a, b) => a - b), [...nums].sort((a, b) => b - a), [...words].sort(), people.sort((x, y) => x.age - y.age).map((p) => p.n)] diff --git a/packages/codemode-rust/conformance/cases/array-sort.json b/packages/codemode-rust/conformance/cases/array-sort.json new file mode 100644 index 0000000000000..782dc6d58b863 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/array-sort.json @@ -0,0 +1,41 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 1, + 10, + 100, + 25, + 5 + ], + [ + 1, + 5, + 10, + 25, + 100 + ], + [ + 100, + 25, + 10, + 5, + 1 + ], + [ + "Apple", + "banana", + "fig", + "pear" + ], + [ + "b", + "d", + "a", + "c" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/arrow-functions.js b/packages/codemode-rust/conformance/cases/arrow-functions.js new file mode 100644 index 0000000000000..9a4a94a418f15 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/arrow-functions.js @@ -0,0 +1,4 @@ +const sq = (x) => x * x +const add = (a, b = 10) => { return a + b } +const obj = () => ({ k: 1 }) +return [sq(4), add(1), add(1, 2), obj()] diff --git a/packages/codemode-rust/conformance/cases/arrow-functions.json b/packages/codemode-rust/conformance/cases/arrow-functions.json new file mode 100644 index 0000000000000..0aa38562a8f6a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/arrow-functions.json @@ -0,0 +1,14 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 16, + 11, + 3, + { + "k": 1 + } + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/async-functions.js b/packages/codemode-rust/conformance/cases/async-functions.js new file mode 100644 index 0000000000000..bbe8e6fbc7d5d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/async-functions.js @@ -0,0 +1,4 @@ +async function inc(x) { return x + 1 } +const p = inc(1) +const arrow = async (x) => (await inc(x)) * 10 +return [typeof p.then, await p, await arrow(2)] diff --git a/packages/codemode-rust/conformance/cases/async-functions.json b/packages/codemode-rust/conformance/cases/async-functions.json new file mode 100644 index 0000000000000..f5dd586c426d2 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/async-functions.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "function", + 2, + 30 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/await-values.js b/packages/codemode-rust/conformance/cases/await-values.js new file mode 100644 index 0000000000000..48a86cc4568b7 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/await-values.js @@ -0,0 +1,4 @@ +const a = await 1 +const b = await Promise.resolve(2) +const c = await (async () => 3)() +return a + b + c diff --git a/packages/codemode-rust/conformance/cases/await-values.json b/packages/codemode-rust/conformance/cases/await-values.json new file mode 100644 index 0000000000000..b06c503cfda4d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/await-values.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 6, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/bench-array-callbacks.js b/packages/codemode-rust/conformance/cases/bench-array-callbacks.js new file mode 100644 index 0000000000000..d77ab70abcf46 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-array-callbacks.js @@ -0,0 +1,5 @@ +const items = Array.from({ length: 50000 }, (_, i) => (i * 7919) % 50000) +const mapped = items.map((x) => x * 2).filter((x) => x % 3 !== 0) +const total = mapped.reduce((a, b) => a + b, 0) +const sorted = mapped.slice(0, 20000).sort((a, b) => a - b) +return [total, sorted[0], sorted[sorted.length - 1]] diff --git a/packages/codemode-rust/conformance/cases/bench-array-callbacks.json b/packages/codemode-rust/conformance/cases/bench-array-callbacks.json new file mode 100644 index 0000000000000..8a97d12e3bd55 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-array-callbacks.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1666633334, + 2, + 99992 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/bench-closure-recursion.js b/packages/codemode-rust/conformance/cases/bench-closure-recursion.js new file mode 100644 index 0000000000000..197eb49dd323f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-closure-recursion.js @@ -0,0 +1,2 @@ +const fib = (n) => (n < 2 ? n : fib(n - 1) + fib(n - 2)) +return fib(22) diff --git a/packages/codemode-rust/conformance/cases/bench-closure-recursion.json b/packages/codemode-rust/conformance/cases/bench-closure-recursion.json new file mode 100644 index 0000000000000..0b1d73975bc4b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-closure-recursion.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 17711, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/bench-generator-iteration.js b/packages/codemode-rust/conformance/cases/bench-generator-iteration.js new file mode 100644 index 0000000000000..015d7dd73fabc --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-generator-iteration.js @@ -0,0 +1,4 @@ +function* range(n) { for (let i = 0; i < n; i++) yield i } +let sum = 0 +for (const x of range(50000)) sum += x +return sum diff --git a/packages/codemode-rust/conformance/cases/bench-generator-iteration.json b/packages/codemode-rust/conformance/cases/bench-generator-iteration.json new file mode 100644 index 0000000000000..089b3f289940a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-generator-iteration.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 1249975000, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/bench-json-round-trip.js b/packages/codemode-rust/conformance/cases/bench-json-round-trip.js new file mode 100644 index 0000000000000..ee2910ff36572 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-json-round-trip.js @@ -0,0 +1,4 @@ +const make = (depth) => depth === 0 ? { a: 1, b: "two", c: [1, 2, 3], d: null } : { left: make(depth - 1), right: make(depth - 1), list: [depth, String(depth)] } +let size = 0 +for (let i = 0; i < 20; i++) size += JSON.stringify(JSON.parse(JSON.stringify(make(9)))).length +return size diff --git a/packages/codemode-rust/conformance/cases/bench-json-round-trip.json b/packages/codemode-rust/conformance/cases/bench-json-round-trip.json new file mode 100644 index 0000000000000..59a39bdf8a876 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-json-round-trip.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 726380, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/bench-map-set-ops.js b/packages/codemode-rust/conformance/cases/bench-map-set-ops.js new file mode 100644 index 0000000000000..bbb9c0736b305 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-map-set-ops.js @@ -0,0 +1,8 @@ +const map = new Map() +const set = new Set() +for (let i = 0; i < 30000; i++) { map.set("k" + (i % 5000), i); set.add(i % 7000) } +let sum = 0 +for (const [k, v] of map) sum += v +for (const v of set) sum += v +for (let i = 0; i < 5000; i++) { map.delete("k" + i); set.delete(i) } +return sum + map.size + set.size diff --git a/packages/codemode-rust/conformance/cases/bench-map-set-ops.json b/packages/codemode-rust/conformance/cases/bench-map-set-ops.json new file mode 100644 index 0000000000000..9efbe5d5b1e1f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-map-set-ops.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 161996000, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/bench-numeric-loop.js b/packages/codemode-rust/conformance/cases/bench-numeric-loop.js new file mode 100644 index 0000000000000..b43fc3741ce65 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-numeric-loop.js @@ -0,0 +1,3 @@ +let sum = 0 +for (let i = 0; i < 300000; i++) sum = (sum + i * 3) % 1000003 +return sum diff --git a/packages/codemode-rust/conformance/cases/bench-numeric-loop.json b/packages/codemode-rust/conformance/cases/bench-numeric-loop.json new file mode 100644 index 0000000000000..3020a8135f46e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-numeric-loop.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 145003, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/bench-promise-fan-out.js b/packages/codemode-rust/conformance/cases/bench-promise-fan-out.js new file mode 100644 index 0000000000000..cb8f7fd5edee8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-promise-fan-out.js @@ -0,0 +1,3 @@ +const work = async (i) => { await null; return i * 2 } +const results = await Promise.all(Array.from({ length: 5000 }, (_, i) => work(i))) +return results.length diff --git a/packages/codemode-rust/conformance/cases/bench-promise-fan-out.json b/packages/codemode-rust/conformance/cases/bench-promise-fan-out.json new file mode 100644 index 0000000000000..62f54b96d7c90 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-promise-fan-out.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 5000, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/bench-string-building.js b/packages/codemode-rust/conformance/cases/bench-string-building.js new file mode 100644 index 0000000000000..eac8db9e1d0af --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-string-building.js @@ -0,0 +1,5 @@ +let out = "" +for (let i = 0; i < 50000; i++) out += String.fromCharCode(97 + (i % 26)) +const parts = [] +for (let i = 0; i < 20000; i++) parts.push(`item-${i}`) +return out.length + parts.join(",").length diff --git a/packages/codemode-rust/conformance/cases/bench-string-building.json b/packages/codemode-rust/conformance/cases/bench-string-building.json new file mode 100644 index 0000000000000..d24fdfe9d21d2 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-string-building.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 258889, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/bench-tool-fan-out.js b/packages/codemode-rust/conformance/cases/bench-tool-fan-out.js new file mode 100644 index 0000000000000..4392740880558 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-tool-fan-out.js @@ -0,0 +1,2 @@ +const results = await Promise.all(Array.from({ length: 1000 }, (_, i) => tools.echo({ id: i }))) +return results.length diff --git a/packages/codemode-rust/conformance/cases/bench-tool-fan-out.json b/packages/codemode-rust/conformance/cases/bench-tool-fan-out.json new file mode 100644 index 0000000000000..ef6802b40efb4 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bench-tool-fan-out.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 1000, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/bindings.js b/packages/codemode-rust/conformance/cases/bindings.js new file mode 100644 index 0000000000000..92347fec51d3d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bindings.js @@ -0,0 +1,2 @@ +// @bindings {"n": 2, "cfg": {"name": "demo", "tags": ["a", "b"]}, "flag": false, "nothing": null} +return { doubled: n * 2, name: cfg.name.toUpperCase(), tags: cfg.tags.length, flag, nothing } diff --git a/packages/codemode-rust/conformance/cases/bindings.json b/packages/codemode-rust/conformance/cases/bindings.json new file mode 100644 index 0000000000000..9e89a6b3f89e4 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/bindings.json @@ -0,0 +1,24 @@ +{ + "bindings": { + "n": 2, + "cfg": { + "name": "demo", + "tags": [ + "a", + "b" + ] + }, + "flag": false, + "nothing": null + }, + "ok": true, + "value": { + "doubled": 4, + "name": "DEMO", + "tags": 2, + "flag": false, + "nothing": null + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/boundary-builtin-inputs.js b/packages/codemode-rust/conformance/cases/boundary-builtin-inputs.js new file mode 100644 index 0000000000000..3abafdf55d4ad --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-builtin-inputs.js @@ -0,0 +1,20 @@ +// Built-ins given a namespace, a promise, a function or a primitive where they expect something else. +const t = (f) => { try { return f() } catch (e) { return [e.name, e.message] } } +const p = Promise.resolve(1) +const out = [] +for (const v of [tools, tools.git, tools.git.status, p, () => 1, 5, "ab", null, undefined, new Date(0), /a/, { a: 1 }]) { + out.push([ + t(() => Array.from(v)), t(() => Object(v) === v), t(() => new Object(v) === v), + t(() => [Object.isFrozen(v), Object.isSealed(v), Object.isExtensible(v)]), + t(() => Iterator.from(v).toArray()), t(() => String.raw(v)), t(() => String.fromCodePoint(v)), + t(() => new Map(v).size), t(() => new Set(v).size), t(() => new WeakSet(v)), t(() => Object.groupBy(v, (x) => x)), + t(() => new Number(v)), t(() => new String(v)), t(() => new Boolean(v)), t(() => typeof new Promise(v)), + ]) +} +const settled = [] +for (const v of [tools.git, p, 5, null, new Date(0), (function* () {})(), []]) { + for (const f of [Promise.all, Promise.race, Promise.allSettled, Promise.any]) { + settled.push(await f.call(Promise, v).then((x) => ["ok", x], (e) => [e.name, e.message])) + } +} +return [out, settled, t(() => String.fromCodePoint(-1)), t(() => String.fromCodePoint(1.5)), t(() => String.fromCodePoint(0x110000))] diff --git a/packages/codemode-rust/conformance/cases/boundary-builtin-inputs.json b/packages/codemode-rust/conformance/cases/boundary-builtin-inputs.json new file mode 100644 index 0000000000000..3fd1094d6a587 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-builtin-inputs.json @@ -0,0 +1,809 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + [ + [ + "TypeError", + "Array.from expects an iterable or array-like value, received a namespace reference." + ], + [ + "TypeError", + "Object(object) wrapper objects are not supported; use the primitive value directly." + ], + [ + "TypeError", + "Object(object) wrapper objects are not supported; use the primitive value directly." + ], + [ + true, + true, + false + ], + [ + "TypeError", + "Iterator.from expects an iterable or iterator, received a namespace reference." + ], + [ + "TypeError", + "String.raw expects a template object with a raw array." + ], + [ + "RangeError", + "Arguments contain a value that is out of range of code points" + ], + [ + "TypeError", + "for...of requires an iterable value, received a namespace reference." + ], + [ + "TypeError", + "for...of requires an iterable value, received a namespace reference." + ], + [ + "TypeError", + "for...of requires an iterable value, received a namespace reference." + ], + [ + "TypeError", + "for...of requires an iterable value, received a namespace reference." + ], + [ + "TypeError", + "new Number(...) is not supported; call Number(...) without new instead." + ], + [ + "TypeError", + "new String(...) is not supported; call String(...) without new instead." + ], + [ + "TypeError", + "new Boolean(...) is not supported; call Boolean(...) without new instead." + ], + [ + "TypeError", + "new Promise(...) expects an executor function (e.g. new Promise((resolve, reject) => { ... }))." + ] + ], + [ + [ + "TypeError", + "Array.from expects an iterable or array-like value, received a namespace reference." + ], + [ + "TypeError", + "Object(object) wrapper objects are not supported; use the primitive value directly." + ], + [ + "TypeError", + "Object(object) wrapper objects are not supported; use the primitive value directly." + ], + [ + true, + true, + false + ], + [ + "TypeError", + "Iterator.from expects an iterable or iterator, received a namespace reference." + ], + [ + "TypeError", + "String.raw expects a template object with a raw array." + ], + [ + "RangeError", + "Arguments contain a value that is out of range of code points" + ], + [ + "TypeError", + "for...of requires an iterable value, received a namespace reference." + ], + [ + "TypeError", + "for...of requires an iterable value, received a namespace reference." + ], + [ + "TypeError", + "for...of requires an iterable value, received a namespace reference." + ], + [ + "TypeError", + "for...of requires an iterable value, received a namespace reference." + ], + [ + "TypeError", + "new Number(...) is not supported; call Number(...) without new instead." + ], + [ + "TypeError", + "new String(...) is not supported; call String(...) without new instead." + ], + [ + "TypeError", + "new Boolean(...) is not supported; call Boolean(...) without new instead." + ], + [ + "TypeError", + "new Promise(...) expects an executor function (e.g. new Promise((resolve, reject) => { ... }))." + ] + ], + [ + [ + "TypeError", + "Array.from expects an iterable or array-like value, received a namespace reference." + ], + [ + "TypeError", + "Object(object) wrapper objects are not supported; use the primitive value directly." + ], + [ + "TypeError", + "Object(object) wrapper objects are not supported; use the primitive value directly." + ], + [ + true, + true, + false + ], + [ + "TypeError", + "Iterator.from expects an iterable or iterator, received a namespace reference." + ], + [ + "TypeError", + "String.raw expects a template object with a raw array." + ], + [ + "RangeError", + "Arguments contain a value that is out of range of code points" + ], + [ + "TypeError", + "for...of requires an iterable value, received a namespace reference." + ], + [ + "TypeError", + "for...of requires an iterable value, received a namespace reference." + ], + [ + "TypeError", + "for...of requires an iterable value, received a namespace reference." + ], + [ + "TypeError", + "for...of requires an iterable value, received a namespace reference." + ], + [ + "TypeError", + "new Number(...) is not supported; call Number(...) without new instead." + ], + [ + "TypeError", + "new String(...) is not supported; call String(...) without new instead." + ], + [ + "TypeError", + "new Boolean(...) is not supported; call Boolean(...) without new instead." + ], + [ + "TypeError", + "new Promise(...) expects an executor function (e.g. new Promise((resolve, reject) => { ... }))." + ] + ], + [ + [ + "TypeError", + "Array.from expects an iterable or array-like value, received an un-awaited Promise." + ], + true, + true, + [ + false, + false, + true + ], + [ + "TypeError", + "This value is an un-awaited Promise; await it first - e.g. `const result = await load(...)`." + ], + [ + "TypeError", + "String.raw expects a template object with a raw array." + ], + [ + "RangeError", + "Arguments contain a value that is out of range of code points" + ], + [ + "TypeError", + "for...of requires an iterable value, received an un-awaited Promise." + ], + [ + "TypeError", + "for...of requires an iterable value, received an un-awaited Promise." + ], + [ + "TypeError", + "for...of requires an iterable value, received an un-awaited Promise." + ], + [ + "TypeError", + "for...of requires an iterable value, received an un-awaited Promise." + ], + [ + "TypeError", + "new Number(...) is not supported; call Number(...) without new instead." + ], + [ + "TypeError", + "new String(...) is not supported; call String(...) without new instead." + ], + [ + "TypeError", + "new Boolean(...) is not supported; call Boolean(...) without new instead." + ], + [ + "TypeError", + "new Promise(...) expects an executor function (e.g. new Promise((resolve, reject) => { ... }))." + ] + ], + [ + [], + true, + true, + [ + false, + false, + true + ], + [ + "TypeError", + "Iterator.from is not a function." + ], + [ + "TypeError", + "String.raw expects a template object with a raw array." + ], + [ + "RangeError", + "Arguments contain a value that is out of range of code points" + ], + [ + "TypeError", + "for...of requires an iterable value, received a function." + ], + [ + "TypeError", + "for...of requires an iterable value, received a function." + ], + [ + "TypeError", + "for...of requires an iterable value, received a function." + ], + [ + "TypeError", + "for...of requires an iterable value, received a function." + ], + [ + "TypeError", + "new Number(...) is not supported; call Number(...) without new instead." + ], + [ + "TypeError", + "new String(...) is not supported; call String(...) without new instead." + ], + [ + "TypeError", + "new Boolean(...) is not supported; call Boolean(...) without new instead." + ], + "object" + ], + [ + [ + "TypeError", + "Array.from expects an iterable or array-like value, received a number." + ], + [ + "TypeError", + "Object(number) wrapper objects are not supported; use the primitive value directly." + ], + [ + "TypeError", + "Object(number) wrapper objects are not supported; use the primitive value directly." + ], + [ + true, + true, + false + ], + [ + "TypeError", + "Iterator.from expects an iterable or iterator, received a number." + ], + [ + "TypeError", + "String.raw expects a template object with a raw array." + ], + "\u0005", + [ + "TypeError", + "for...of requires an iterable value, received a number." + ], + [ + "TypeError", + "for...of requires an iterable value, received a number." + ], + [ + "TypeError", + "for...of requires an iterable value, received a number." + ], + [ + "TypeError", + "for...of requires an iterable value, received a number." + ], + [ + "TypeError", + "new Number(...) is not supported; call Number(...) without new instead." + ], + [ + "TypeError", + "new String(...) is not supported; call String(...) without new instead." + ], + [ + "TypeError", + "new Boolean(...) is not supported; call Boolean(...) without new instead." + ], + [ + "TypeError", + "new Promise(...) expects an executor function (e.g. new Promise((resolve, reject) => { ... }))." + ] + ], + [ + [ + "a", + "b" + ], + [ + "TypeError", + "Object(string) wrapper objects are not supported; use the primitive value directly." + ], + [ + "TypeError", + "Object(string) wrapper objects are not supported; use the primitive value directly." + ], + [ + true, + true, + false + ], + [ + "a", + "b" + ], + [ + "TypeError", + "String.raw expects a template object with a raw array." + ], + [ + "RangeError", + "Arguments contain a value that is out of range of code points" + ], + [ + "TypeError", + "new Map(...) expects [key, value] pairs as entry objects." + ], + 2, + [ + "TypeError", + "Invalid value used in weak set: a string cannot be held weakly." + ], + { + "a": [ + "a" + ], + "b": [ + "b" + ] + }, + [ + "TypeError", + "new Number(...) is not supported; call Number(...) without new instead." + ], + [ + "TypeError", + "new String(...) is not supported; call String(...) without new instead." + ], + [ + "TypeError", + "new Boolean(...) is not supported; call Boolean(...) without new instead." + ], + [ + "TypeError", + "new Promise(...) expects an executor function (e.g. new Promise((resolve, reject) => { ... }))." + ] + ], + [ + [ + "TypeError", + "Array.from expects an iterable or array-like value, received null." + ], + false, + false, + [ + true, + true, + false + ], + [ + "TypeError", + "Iterator.from expects an iterable or iterator, received null." + ], + [ + "TypeError", + "String.raw expects a template object with a raw array." + ], + "\u0000", + 0, + 0, + {}, + [ + "TypeError", + "Object.groupBy expects an iterable collection." + ], + [ + "TypeError", + "new Number(...) is not supported; call Number(...) without new instead." + ], + [ + "TypeError", + "new String(...) is not supported; call String(...) without new instead." + ], + [ + "TypeError", + "new Boolean(...) is not supported; call Boolean(...) without new instead." + ], + [ + "TypeError", + "new Promise(...) expects an executor function (e.g. new Promise((resolve, reject) => { ... }))." + ] + ], + [ + [ + "TypeError", + "Array.from expects an iterable or array-like value, received undefined." + ], + false, + false, + [ + true, + true, + false + ], + [ + "TypeError", + "Iterator.from expects an iterable or iterator, received undefined." + ], + [ + "TypeError", + "String.raw expects a template object with a raw array." + ], + [ + "RangeError", + "Arguments contain a value that is out of range of code points" + ], + 0, + 0, + {}, + [ + "TypeError", + "Object.groupBy expects an iterable collection." + ], + [ + "TypeError", + "new Number(...) is not supported; call Number(...) without new instead." + ], + [ + "TypeError", + "new String(...) is not supported; call String(...) without new instead." + ], + [ + "TypeError", + "new Boolean(...) is not supported; call Boolean(...) without new instead." + ], + [ + "TypeError", + "new Promise(...) expects an executor function (e.g. new Promise((resolve, reject) => { ... }))." + ] + ], + [ + [], + true, + true, + [ + false, + false, + true + ], + [ + "TypeError", + "Iterator.from is not a function." + ], + [ + "TypeError", + "String.raw expects a template object with a raw array." + ], + "\u0000", + [ + "TypeError", + "for...of requires an iterable value, received a Date." + ], + [ + "TypeError", + "for...of requires an iterable value, received a Date." + ], + [ + "TypeError", + "for...of requires an iterable value, received a Date." + ], + [ + "TypeError", + "for...of requires an iterable value, received a Date." + ], + [ + "TypeError", + "new Number(...) is not supported; call Number(...) without new instead." + ], + [ + "TypeError", + "new String(...) is not supported; call String(...) without new instead." + ], + [ + "TypeError", + "new Boolean(...) is not supported; call Boolean(...) without new instead." + ], + [ + "TypeError", + "new Promise(...) expects an executor function (e.g. new Promise((resolve, reject) => { ... }))." + ] + ], + [ + [], + true, + true, + [ + false, + false, + true + ], + [ + "TypeError", + "Iterator.from is not a function." + ], + [ + "TypeError", + "String.raw expects a template object with a raw array." + ], + [ + "RangeError", + "Arguments contain a value that is out of range of code points" + ], + [ + "TypeError", + "for...of requires an iterable value, received a RegExp." + ], + [ + "TypeError", + "for...of requires an iterable value, received a RegExp." + ], + [ + "TypeError", + "for...of requires an iterable value, received a RegExp." + ], + [ + "TypeError", + "for...of requires an iterable value, received a RegExp." + ], + [ + "TypeError", + "new Number(...) is not supported; call Number(...) without new instead." + ], + [ + "TypeError", + "new String(...) is not supported; call String(...) without new instead." + ], + [ + "TypeError", + "new Boolean(...) is not supported; call Boolean(...) without new instead." + ], + [ + "TypeError", + "new Promise(...) expects an executor function (e.g. new Promise((resolve, reject) => { ... }))." + ] + ], + [ + [], + true, + true, + [ + false, + false, + true + ], + [ + "TypeError", + "Iterator.from is not a function." + ], + [ + "TypeError", + "String.raw expects a template object with a raw array." + ], + [ + "RangeError", + "Arguments contain a value that is out of range of code points" + ], + [ + "TypeError", + "for...of requires an iterable value, received a data object." + ], + [ + "TypeError", + "for...of requires an iterable value, received a data object." + ], + [ + "TypeError", + "for...of requires an iterable value, received a data object." + ], + [ + "TypeError", + "for...of requires an iterable value, received a data object." + ], + [ + "TypeError", + "new Number(...) is not supported; call Number(...) without new instead." + ], + [ + "TypeError", + "new String(...) is not supported; call String(...) without new instead." + ], + [ + "TypeError", + "new Boolean(...) is not supported; call Boolean(...) without new instead." + ], + [ + "TypeError", + "new Promise(...) expects an executor function (e.g. new Promise((resolve, reject) => { ... }))." + ] + ] + ], + [ + [ + "TypeError", + "Promise.all expects a synchronous iterable, received a namespace reference." + ], + [ + "TypeError", + "Promise.race expects a synchronous iterable, received a namespace reference." + ], + [ + "TypeError", + "Promise.allSettled expects a synchronous iterable, received a namespace reference." + ], + [ + "TypeError", + "Promise.any expects a synchronous iterable, received a namespace reference." + ], + [ + "TypeError", + "Promise.all expects a synchronous iterable, received an un-awaited Promise." + ], + [ + "TypeError", + "Promise.race expects a synchronous iterable, received an un-awaited Promise." + ], + [ + "TypeError", + "Promise.allSettled expects a synchronous iterable, received an un-awaited Promise." + ], + [ + "TypeError", + "Promise.any expects a synchronous iterable, received an un-awaited Promise." + ], + [ + "TypeError", + "Promise.all expects a synchronous iterable, received a number." + ], + [ + "TypeError", + "Promise.race expects a synchronous iterable, received a number." + ], + [ + "TypeError", + "Promise.allSettled expects a synchronous iterable, received a number." + ], + [ + "TypeError", + "Promise.any expects a synchronous iterable, received a number." + ], + [ + "TypeError", + "Promise.all expects a synchronous iterable, received null." + ], + [ + "TypeError", + "Promise.race expects a synchronous iterable, received null." + ], + [ + "TypeError", + "Promise.allSettled expects a synchronous iterable, received null." + ], + [ + "TypeError", + "Promise.any expects a synchronous iterable, received null." + ], + [ + "TypeError", + "Promise.all expects a synchronous iterable, received a Date." + ], + [ + "TypeError", + "Promise.race expects a synchronous iterable, received a Date." + ], + [ + "TypeError", + "Promise.allSettled expects a synchronous iterable, received a Date." + ], + [ + "TypeError", + "Promise.any expects a synchronous iterable, received a Date." + ], + [ + "ok", + [] + ], + [ + "TypeError", + "Promise.race([]) would never settle; provide at least one promise or value." + ], + [ + "ok", + [] + ], + [ + "AggregateError", + "All promises were rejected" + ], + [ + "ok", + [] + ], + [ + "TypeError", + "Promise.race([]) would never settle; provide at least one promise or value." + ], + [ + "ok", + [] + ], + [ + "AggregateError", + "All promises were rejected" + ] + ], + [ + "RangeError", + "Arguments contain a value that is out of range of code points" + ], + [ + "RangeError", + "Arguments contain a value that is out of range of code points" + ], + [ + "RangeError", + "Arguments contain a value that is out of range of code points" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/boundary-collections.js b/packages/codemode-rust/conformance/cases/boundary-collections.js new file mode 100644 index 0000000000000..4b3f4ae454a5e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-collections.js @@ -0,0 +1 @@ +return { m: new Map([["a", 1]]), s: new Set(["x", "y"]) } diff --git a/packages/codemode-rust/conformance/cases/boundary-collections.json b/packages/codemode-rust/conformance/cases/boundary-collections.json new file mode 100644 index 0000000000000..eb868c6bf965c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-collections.json @@ -0,0 +1,13 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "m": {}, + "s": [ + "x", + "y" + ] + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/boundary-destructure-nullish.js b/packages/codemode-rust/conformance/cases/boundary-destructure-nullish.js new file mode 100644 index 0000000000000..2419ce5477487 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-destructure-nullish.js @@ -0,0 +1,18 @@ +// Destructuring null or undefined names the value without quotes, in every form. +const t = (f) => { try { return f() } catch (e) { return [e.name, e.message] } } +const out = [] +for (const v of [null, undefined]) { + out.push([ + t(() => { const { a } = v; return a }), + t(() => { const { a = 1, ...r } = v; return a }), + t(() => { const { a: { b } } = { a: v }; return b }), + t(() => { let a; ({ a } = v); return a }), + t(() => (({ a }) => a)(v)), + t(() => (function ({ a }) { return a })(v)), + t(() => { for (const { a } of [v]) return a }), + t(() => { const [{ a }] = [v]; return a }), + t(() => { const [a] = v; return a }), + t(() => { const [[a]] = [v]; return a }), + ]) +} +return out diff --git a/packages/codemode-rust/conformance/cases/boundary-destructure-nullish.json b/packages/codemode-rust/conformance/cases/boundary-destructure-nullish.json new file mode 100644 index 0000000000000..ede47d36f8269 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-destructure-nullish.json @@ -0,0 +1,92 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + [ + "TypeError", + "Cannot destructure null as it is null." + ], + [ + "TypeError", + "Cannot destructure null as it is null." + ], + [ + "TypeError", + "Cannot destructure null as it is null." + ], + [ + "TypeError", + "Cannot destructure null as it is null." + ], + [ + "TypeError", + "Cannot destructure null as it is null." + ], + [ + "TypeError", + "Cannot destructure null as it is null." + ], + [ + "TypeError", + "Cannot destructure null as it is null." + ], + [ + "TypeError", + "Cannot destructure null as it is null." + ], + [ + "TypeError", + "Array destructuring requires a supported iterable value." + ], + [ + "TypeError", + "Array destructuring requires a supported iterable value." + ] + ], + [ + [ + "TypeError", + "Cannot destructure undefined as it is undefined." + ], + [ + "TypeError", + "Cannot destructure undefined as it is undefined." + ], + [ + "TypeError", + "Cannot destructure undefined as it is undefined." + ], + [ + "TypeError", + "Cannot destructure undefined as it is undefined." + ], + [ + "TypeError", + "Cannot destructure undefined as it is undefined." + ], + [ + "TypeError", + "Cannot destructure undefined as it is undefined." + ], + [ + "TypeError", + "Cannot destructure undefined as it is undefined." + ], + [ + "TypeError", + "Cannot destructure undefined as it is undefined." + ], + [ + "TypeError", + "Array destructuring requires a supported iterable value." + ], + [ + "TypeError", + "Array destructuring requires a supported iterable value." + ] + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/boundary-enumeration-sources.js b/packages/codemode-rust/conformance/cases/boundary-enumeration-sources.js new file mode 100644 index 0000000000000..7cd11b15dd88c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-enumeration-sources.js @@ -0,0 +1,18 @@ +// Object.keys/values/entries/assign/hasOwn, for...in, object spread and object rest take their source as the +// reference's enumerableSource does: null and undefined fail, a promise and a namespace are not data, except that +// Object.keys and for...in list a namespace's names. +const t = (f) => { try { return f() } catch (e) { return [e.name, e.message] } } +const p = Promise.resolve(1) +const forIn = (v) => { const ks = []; for (const k in v) ks.push(k); return ks } +const out = [] +for (const v of [null, undefined, p, tools, tools.git, tools.git.status, "ab", 5, true, () => 1]) { + out.push([ + t(() => Object.keys(v)), t(() => Object.values(v)), t(() => Object.entries(v)), + t(() => Object.assign({}, v)), t(() => Object.assign(v, { a: 1 }) === v), t(() => Object.hasOwn(v, "length")), + t(() => forIn(v)), t(() => ({ ...v })), t(() => { const { ...r } = v; return r }), + t(() => { const { a, ...r } = v; return r }), t(() => Object.getPrototypeOf(v) === null), + t(() => Object.create(v) !== null), + ]) +} +out.push(t(() => Object.create(null, {}))) +return out diff --git a/packages/codemode-rust/conformance/cases/boundary-enumeration-sources.json b/packages/codemode-rust/conformance/cases/boundary-enumeration-sources.json new file mode 100644 index 0000000000000..2f87567a0a7b3 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-enumeration-sources.json @@ -0,0 +1,383 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + [ + "TypeError", + "Object.keys(...) cannot convert null to an object." + ], + [ + "TypeError", + "Object.values(...) cannot convert null to an object." + ], + [ + "TypeError", + "Object.entries(...) cannot convert null to an object." + ], + {}, + [ + "TypeError", + "Object.assign expects a data object or array target, received null." + ], + [ + "TypeError", + "Object.hasOwn(...) cannot convert null to an object." + ], + [], + {}, + [ + "TypeError", + "Cannot destructure null as it is null." + ], + [ + "TypeError", + "Cannot destructure null as it is null." + ], + [ + "TypeError", + "Object.getPrototypeOf cannot convert null to an object." + ], + true + ], + [ + [ + "TypeError", + "Object.keys(...) cannot convert undefined to an object." + ], + [ + "TypeError", + "Object.values(...) cannot convert undefined to an object." + ], + [ + "TypeError", + "Object.entries(...) cannot convert undefined to an object." + ], + {}, + [ + "TypeError", + "Object.assign expects a data object or array target, received undefined." + ], + [ + "TypeError", + "Object.hasOwn(...) cannot convert undefined to an object." + ], + [], + {}, + [ + "TypeError", + "Cannot destructure undefined as it is undefined." + ], + [ + "TypeError", + "Cannot destructure undefined as it is undefined." + ], + [ + "TypeError", + "Object.getPrototypeOf cannot convert undefined to an object." + ], + [ + "TypeError", + "Object prototype may only be an Object or null." + ] + ], + [ + [ + "TypeError", + "Object.keys(...) received an un-awaited Promise; await it before inspecting the result." + ], + [ + "TypeError", + "Object.values(...) received an un-awaited Promise; await it before inspecting the result." + ], + [ + "TypeError", + "Object.entries(...) received an un-awaited Promise; await it before inspecting the result." + ], + [ + "TypeError", + "Object.assign(...) received an un-awaited Promise; await it before inspecting the result." + ], + true, + [ + "TypeError", + "Object.hasOwn(...) received an un-awaited Promise; await it before inspecting the result." + ], + [ + "TypeError", + "for...in received an un-awaited Promise; await it before inspecting the result." + ], + [ + "TypeError", + "Object spread received an un-awaited Promise; await it before inspecting the result." + ], + [ + "TypeError", + "Object destructuring received an un-awaited Promise; await it before inspecting the result." + ], + [ + "TypeError", + "Object destructuring received an un-awaited Promise; await it before inspecting the result." + ], + false, + true + ], + [ + [ + "echo", + "fail", + "git" + ], + [ + "TypeError", + "Object.values(...) cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object.entries(...) cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object.assign(...) cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object.assign expects a data object or array target, received a namespace reference." + ], + [ + "TypeError", + "Object.hasOwn(...) cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "echo", + "fail", + "git" + ], + [ + "TypeError", + "Object spread cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object destructuring cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object destructuring cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object.getPrototypeOf cannot convert a namespace reference to an object." + ], + [ + "TypeError", + "Object prototype may only be an Object or null." + ] + ], + [ + [ + "status" + ], + [ + "TypeError", + "Object.values(...) cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object.entries(...) cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object.assign(...) cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object.assign expects a data object or array target, received a namespace reference." + ], + [ + "TypeError", + "Object.hasOwn(...) cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "status" + ], + [ + "TypeError", + "Object spread cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object destructuring cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object destructuring cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object.getPrototypeOf cannot convert a namespace reference to an object." + ], + [ + "TypeError", + "Object prototype may only be an Object or null." + ] + ], + [ + [], + [ + "TypeError", + "Object.values(...) cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object.entries(...) cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object.assign(...) cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object.assign expects a data object or array target, received a namespace reference." + ], + [ + "TypeError", + "Object.hasOwn(...) cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [], + [ + "TypeError", + "Object spread cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object destructuring cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object destructuring cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names." + ], + [ + "TypeError", + "Object.getPrototypeOf cannot convert a namespace reference to an object." + ], + [ + "TypeError", + "Object prototype may only be an Object or null." + ] + ], + [ + [ + "0", + "1" + ], + [ + "a", + "b" + ], + [ + [ + "0", + "a" + ], + [ + "1", + "b" + ] + ], + { + "0": "a", + "1": "b" + }, + [ + "TypeError", + "Object.assign expects a data object or array target, received a string." + ], + true, + [ + "0", + "1" + ], + { + "0": "a", + "1": "b" + }, + { + "0": "a", + "1": "b" + }, + { + "0": "a", + "1": "b" + }, + false, + [ + "TypeError", + "Object prototype may only be an Object or null." + ] + ], + [ + [], + [], + [], + {}, + [ + "TypeError", + "Object.assign expects a data object or array target, received a number." + ], + false, + [], + {}, + {}, + {}, + false, + [ + "TypeError", + "Object prototype may only be an Object or null." + ] + ], + [ + [], + [], + [], + {}, + [ + "TypeError", + "Object.assign expects a data object or array target, received a boolean." + ], + false, + [], + {}, + {}, + {}, + false, + [ + "TypeError", + "Object prototype may only be an Object or null." + ] + ], + [ + [], + [], + [], + {}, + true, + true, + [ + "a" + ], + { + "a": 1 + }, + { + "a": 1 + }, + {}, + false, + true + ], + {} + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/boundary-error.js b/packages/codemode-rust/conformance/cases/boundary-error.js new file mode 100644 index 0000000000000..4bba13d330bfe --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-error.js @@ -0,0 +1,3 @@ +const e = new TypeError("bad") +e.code = 7 +return e diff --git a/packages/codemode-rust/conformance/cases/boundary-error.json b/packages/codemode-rust/conformance/cases/boundary-error.json new file mode 100644 index 0000000000000..4b96bb263403f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-error.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "name": "TypeError", + "message": "bad", + "code": 7 + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/boundary-functions.js b/packages/codemode-rust/conformance/cases/boundary-functions.js new file mode 100644 index 0000000000000..0468709b96a73 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-functions.js @@ -0,0 +1 @@ +return { f: () => 1, list: [() => 2], keep: 1 } diff --git a/packages/codemode-rust/conformance/cases/boundary-functions.json b/packages/codemode-rust/conformance/cases/boundary-functions.json new file mode 100644 index 0000000000000..d500d1677fa40 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-functions.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "list": [ + null + ], + "keep": 1 + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/boundary-method-receivers.js b/packages/codemode-rust/conformance/cases/boundary-method-receivers.js new file mode 100644 index 0000000000000..66f26774c661e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-method-receivers.js @@ -0,0 +1,17 @@ +// Prototype methods called on the wrong receiver or with a namespace, a symbol or a primitive where they need +// something else: the reference's checks, in its order. +const t = (f) => { try { const r = f(); return r === undefined ? "undef" : r } catch (e) { return [e.name, e.message] } } +const f = function (a) { return [this === undefined, a] } +const out = [] +for (const v of [tools, tools.git, Promise.resolve(1), () => 1, null, undefined, Symbol.iterator, 5, "ab"]) { + out.push([ + t(() => Number.prototype.toFixed.call(v, 1)), t(() => Number.prototype.valueOf.call(v)), + t(() => Number.prototype.toLocaleString.call(v)), t(() => new Set([1]).union(v)), t(() => new Set([1]).isSubsetOf(v)), + t(() => Object.prototype.toLocaleString.call(v)), t(() => Function.prototype.call.call(v, 1)), + t(() => Function.prototype.bind.call(v, 1)), t(() => f.apply(1, v)), t(() => new Uint8Array(2).set([1], v)), + t(() => Headers.prototype.set.call(v, 1)), t(() => URLSearchParams.prototype.append.call(v, 1)), + t(() => Headers.prototype.get.call(v)), t(() => URLSearchParams.prototype.has.call(v)), + ]) +} +out.push(t(() => [1, 2].with(5, 0)), t(() => [1, 2].with(-3, 0)), t(() => (5).toString.call("x"))) +return out diff --git a/packages/codemode-rust/conformance/cases/boundary-method-receivers.json b/packages/codemode-rust/conformance/cases/boundary-method-receivers.json new file mode 100644 index 0000000000000..9f228a52226c0 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-method-receivers.json @@ -0,0 +1,494 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + [ + "TypeError", + "Number.prototype.toFixed requires that 'this' be a Number." + ], + [ + "TypeError", + "Number.prototype.valueOf requires that 'this' be a Number." + ], + [ + "TypeError", + "Number.prototype.toLocaleString requires that 'this' be a Number." + ], + [ + "TypeError", + "Set.union expects a Set-like object." + ], + [ + "TypeError", + "Set.isSubsetOf expects a Set-like object." + ], + [ + "TypeError", + "Object.prototype.toLocaleString called on null or undefined." + ], + [ + "TypeError", + "Function.prototype.call called on incompatible receiver a namespace reference." + ], + [ + "TypeError", + "Function.prototype.bind called on incompatible receiver a namespace reference." + ], + [ + "TypeError", + "Function.prototype.apply expects an array-like argument list." + ], + "undef", + [ + "TypeError", + "Headers.set requires 2 arguments." + ], + [ + "TypeError", + "URLSearchParams.append requires 2 arguments." + ], + [ + "TypeError", + "Headers.get requires 1 argument." + ], + [ + "TypeError", + "URLSearchParams.has requires 1 argument." + ] + ], + [ + [ + "TypeError", + "Number.prototype.toFixed requires that 'this' be a Number." + ], + [ + "TypeError", + "Number.prototype.valueOf requires that 'this' be a Number." + ], + [ + "TypeError", + "Number.prototype.toLocaleString requires that 'this' be a Number." + ], + [ + "TypeError", + "Set.union expects a Set-like object." + ], + [ + "TypeError", + "Set.isSubsetOf expects a Set-like object." + ], + [ + "TypeError", + "Object.prototype.toLocaleString called on null or undefined." + ], + [ + "TypeError", + "Function.prototype.call called on incompatible receiver a namespace reference." + ], + [ + "TypeError", + "Function.prototype.bind called on incompatible receiver a namespace reference." + ], + [ + "TypeError", + "Function.prototype.apply expects an array-like argument list." + ], + "undef", + [ + "TypeError", + "Headers.set requires 2 arguments." + ], + [ + "TypeError", + "URLSearchParams.append requires 2 arguments." + ], + [ + "TypeError", + "Headers.get requires 1 argument." + ], + [ + "TypeError", + "URLSearchParams.has requires 1 argument." + ] + ], + [ + [ + "TypeError", + "Number.prototype.toFixed requires that 'this' be a Number." + ], + [ + "TypeError", + "Number.prototype.valueOf requires that 'this' be a Number." + ], + [ + "TypeError", + "Number.prototype.toLocaleString requires that 'this' be a Number." + ], + [ + "TypeError", + "This value is an un-awaited Promise; await it first - e.g. `const result = await load(...)`." + ], + [ + "TypeError", + "This value is an un-awaited Promise; await it first - e.g. `const result = await load(...)`." + ], + "[object Promise]", + [ + "TypeError", + "Function.prototype.call called on incompatible receiver an un-awaited Promise." + ], + [ + "TypeError", + "Function.prototype.bind called on incompatible receiver an un-awaited Promise." + ], + [ + false, + null + ], + "undef", + [ + "TypeError", + "Headers.set requires 2 arguments." + ], + [ + "TypeError", + "URLSearchParams.append requires 2 arguments." + ], + [ + "TypeError", + "Headers.get requires 1 argument." + ], + [ + "TypeError", + "URLSearchParams.has requires 1 argument." + ] + ], + [ + [ + "TypeError", + "Number.prototype.toFixed requires that 'this' be a Number." + ], + [ + "TypeError", + "Number.prototype.valueOf requires that 'this' be a Number." + ], + [ + "TypeError", + "Number.prototype.toLocaleString requires that 'this' be a Number." + ], + [ + "TypeError", + "Set.union received a Set-like object with an invalid size." + ], + [ + "TypeError", + "Set.isSubsetOf received a Set-like object with an invalid size." + ], + "[object Function]", + 1, + null, + [ + false, + null + ], + "undef", + [ + "TypeError", + "Headers.set requires 2 arguments." + ], + [ + "TypeError", + "URLSearchParams.append requires 2 arguments." + ], + [ + "TypeError", + "Headers.get requires 1 argument." + ], + [ + "TypeError", + "URLSearchParams.has requires 1 argument." + ] + ], + [ + [ + "TypeError", + "Number.prototype.toFixed requires that 'this' be a Number." + ], + [ + "TypeError", + "Number.prototype.valueOf requires that 'this' be a Number." + ], + [ + "TypeError", + "Number.prototype.toLocaleString requires that 'this' be a Number." + ], + [ + "TypeError", + "Set.union expects a Set-like object." + ], + [ + "TypeError", + "Set.isSubsetOf expects a Set-like object." + ], + [ + "TypeError", + "Object.prototype.toLocaleString called on null or undefined." + ], + [ + "TypeError", + "Function.prototype.call called on incompatible receiver null." + ], + [ + "TypeError", + "Function.prototype.bind called on incompatible receiver null." + ], + [ + false, + null + ], + "undef", + [ + "TypeError", + "Headers.set requires 2 arguments." + ], + [ + "TypeError", + "URLSearchParams.append requires 2 arguments." + ], + [ + "TypeError", + "Headers.get requires 1 argument." + ], + [ + "TypeError", + "URLSearchParams.has requires 1 argument." + ] + ], + [ + [ + "TypeError", + "Number.prototype.toFixed requires that 'this' be a Number." + ], + [ + "TypeError", + "Number.prototype.valueOf requires that 'this' be a Number." + ], + [ + "TypeError", + "Number.prototype.toLocaleString requires that 'this' be a Number." + ], + [ + "TypeError", + "Set.union expects a Set-like object." + ], + [ + "TypeError", + "Set.isSubsetOf expects a Set-like object." + ], + [ + "TypeError", + "Object.prototype.toLocaleString called on null or undefined." + ], + [ + "TypeError", + "Function.prototype.call called on incompatible receiver undefined." + ], + [ + "TypeError", + "Function.prototype.bind called on incompatible receiver undefined." + ], + [ + false, + null + ], + "undef", + [ + "TypeError", + "Headers.set requires 2 arguments." + ], + [ + "TypeError", + "URLSearchParams.append requires 2 arguments." + ], + [ + "TypeError", + "Headers.get requires 1 argument." + ], + [ + "TypeError", + "URLSearchParams.has requires 1 argument." + ] + ], + [ + [ + "TypeError", + "Number.prototype.toFixed requires that 'this' be a Number." + ], + [ + "TypeError", + "Number.prototype.valueOf requires that 'this' be a Number." + ], + [ + "TypeError", + "Number.prototype.toLocaleString requires that 'this' be a Number." + ], + [ + "TypeError", + "Set.union expects a Set-like object." + ], + [ + "TypeError", + "Set.isSubsetOf expects a Set-like object." + ], + [ + "TypeError", + "Object.prototype.toLocaleString called on null or undefined." + ], + [ + "TypeError", + "Function.prototype.call called on incompatible receiver a symbol." + ], + [ + "TypeError", + "Function.prototype.bind called on incompatible receiver a symbol." + ], + [ + "TypeError", + "Function.prototype.apply expects an array-like argument list." + ], + [ + "TypeError", + "Cannot convert a symbol to a number" + ], + [ + "TypeError", + "Headers.set requires 2 arguments." + ], + [ + "TypeError", + "URLSearchParams.append requires 2 arguments." + ], + [ + "TypeError", + "Headers.get requires 1 argument." + ], + [ + "TypeError", + "URLSearchParams.has requires 1 argument." + ] + ], + [ + "5.0", + 5, + "5", + [ + "TypeError", + "Set.union expects a Set-like object." + ], + [ + "TypeError", + "Set.isSubsetOf expects a Set-like object." + ], + "5", + [ + "TypeError", + "Function.prototype.call called on incompatible receiver a number." + ], + [ + "TypeError", + "Function.prototype.bind called on incompatible receiver a number." + ], + [ + "TypeError", + "Function.prototype.apply expects an array-like argument list." + ], + [ + "RangeError", + "Uint8Array.set: the source does not fit at that offset." + ], + [ + "TypeError", + "Headers.set requires 2 arguments." + ], + [ + "TypeError", + "URLSearchParams.append requires 2 arguments." + ], + [ + "TypeError", + "Headers.get requires 1 argument." + ], + [ + "TypeError", + "URLSearchParams.has requires 1 argument." + ] + ], + [ + [ + "TypeError", + "Number.prototype.toFixed requires that 'this' be a Number." + ], + [ + "TypeError", + "Number.prototype.valueOf requires that 'this' be a Number." + ], + [ + "TypeError", + "Number.prototype.toLocaleString requires that 'this' be a Number." + ], + [ + "TypeError", + "Set.union expects a Set-like object." + ], + [ + "TypeError", + "Set.isSubsetOf expects a Set-like object." + ], + "ab", + [ + "TypeError", + "Function.prototype.call called on incompatible receiver a string." + ], + [ + "TypeError", + "Function.prototype.bind called on incompatible receiver a string." + ], + [ + "TypeError", + "Function.prototype.apply expects an array-like argument list." + ], + "undef", + [ + "TypeError", + "Headers.set requires 2 arguments." + ], + [ + "TypeError", + "URLSearchParams.append requires 2 arguments." + ], + [ + "TypeError", + "Headers.get requires 1 argument." + ], + [ + "TypeError", + "URLSearchParams.has requires 1 argument." + ] + ], + [ + "RangeError", + "Array.with index is out of range." + ], + [ + "RangeError", + "Array.with index is out of range." + ], + [ + "TypeError", + "Number.prototype.toString requires that 'this' be a Number." + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/boundary-namespace-calls.js b/packages/codemode-rust/conformance/cases/boundary-namespace-calls.js new file mode 100644 index 0000000000000..d0fea8e5a88d4 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-namespace-calls.js @@ -0,0 +1,10 @@ +// The namespace itself isn't callable, and its paths take only string names when deleted, as when read. +const out = [] +for (const f of [() => tools(), () => delete tools[0], () => delete tools[Symbol.iterator], () => delete tools.git, () => delete tools["x"]]) { + try { + out.push(f()) + } catch (e) { + out.push([e.name, e.message]) + } +} +return out diff --git a/packages/codemode-rust/conformance/cases/boundary-namespace-calls.json b/packages/codemode-rust/conformance/cases/boundary-namespace-calls.json new file mode 100644 index 0000000000000..a1150101444b7 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-namespace-calls.json @@ -0,0 +1,28 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "TypeError", + "tools is not a function." + ], + [ + "TypeError", + "tools paths must use string property names." + ], + [ + "TypeError", + "tools paths must use string property names." + ], + [ + "TypeError", + "Only data fields may be deleted." + ], + [ + "TypeError", + "Only data fields may be deleted." + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/boundary-namespace-conversion.js b/packages/codemode-rust/conformance/cases/boundary-namespace-conversion.js new file mode 100644 index 0000000000000..460bedcbd489b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-namespace-conversion.js @@ -0,0 +1,28 @@ +// A namespace reference is no object to the built-ins that convert it: it converts without a call, to the text +// "[object Object]" (so NaN as a number), and starts no conversion of its own. +const t = (f) => { try { return f() } catch (e) { return [e.name, e.message] } } +const o = { valueOf: () => 3, toString: () => "o" } +return [ + t(() => String(tools)), + t(() => `${tools.git}`), + t(() => String(tools.git.status)), + t(() => [1, 2].join(tools)), + t(() => [tools, tools.git].join()), + t(() => Math.max(tools)), + t(() => Math.max(o, tools.git, 1)), + t(() => parseInt(tools)), + t(() => Number(tools.git)), + t(() => isNaN(tools)), + t(() => [1].at(tools)), + t(() => String(new Date(tools))), + t(() => new Error(tools).message), + t(() => encodeURIComponent(tools)), + t(() => new Array(tools).length), + t(() => Array.from({ length: tools })), + t(() => String.fromCharCode(tools, 65)), + t(() => ({ [tools]: 1 })), + t(() => { const { [tools.git]: a } = { "[object Object]": 2 }; return a }), + t(() => Object.prototype.toString.call(tools)), + t(() => tools + 1), + t(() => -tools), +] diff --git a/packages/codemode-rust/conformance/cases/boundary-namespace-conversion.json b/packages/codemode-rust/conformance/cases/boundary-namespace-conversion.json new file mode 100644 index 0000000000000..d1214bddddf0e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-namespace-conversion.json @@ -0,0 +1,38 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "[object Object]", + "[object Object]", + "[object Object]", + "1[object Object]2", + "[object Object],[object Object]", + null, + null, + null, + null, + true, + 1, + "Invalid Date", + "[object Object]", + "%5Bobject%20Object%5D", + 1, + [], + "\u0000A", + { + "[object Object]": 1 + }, + 2, + "[object Object]", + [ + "TypeError", + "Binary operators require data values." + ], + [ + "TypeError", + "Unary operators require data values." + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/boundary-namespace-paths.js b/packages/codemode-rust/conformance/cases/boundary-namespace-paths.js new file mode 100644 index 0000000000000..b6a370f73ecf7 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-namespace-paths.js @@ -0,0 +1,15 @@ +// Reading a namespace path: names only, Object.keys and for...in of an unknown one fail, a namespace is not a +// function, and the receivers of Promise.prototype methods are named when they are wrong. +const t = (f) => { try { return f() } catch (e) { return [e.name, e.message] } } +const forIn = (v) => { const ks = []; for (const k in v) ks.push(k); return ks } +return [ + t(() => typeof tools[0]), t(() => typeof tools.git[1.5]), t(() => tools[Symbol.iterator]), t(() => { tools[0] = 1 }), + t(() => typeof tools["0"]), t(() => typeof tools[true]), t(() => typeof tools[{ toString: () => "git" }]), + t(() => Object.keys(tools.nope)), t(() => forIn(tools.git.nope)), t(() => Object.keys(tools.git.status.x)), + t(() => Object.keys(tools.git.status)), t(() => Object.keys(tools.git)), t(() => forIn(tools)), + t(() => Promise.prototype.then.call({}, () => 1)), t(() => Promise.prototype.catch.call(5)), + t(() => Promise.prototype.finally.call(tools)), t(() => Promise.prototype.then.call(null)), + t(() => new URLSearchParams(Symbol.iterator)), t(() => new URLSearchParams(tools)), + t(() => { const n = null; let c = 0; try { n[{ toString() { c++; return "k" } }] } catch (e) { return [e.message, c] } }), + t(() => { const n = undefined; n[[1, 2]] = 1 }), +] diff --git a/packages/codemode-rust/conformance/cases/boundary-namespace-paths.json b/packages/codemode-rust/conformance/cases/boundary-namespace-paths.json new file mode 100644 index 0000000000000..b1af849e0b694 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-namespace-paths.json @@ -0,0 +1,80 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "TypeError", + "tools paths must use string property names." + ], + [ + "TypeError", + "tools paths must use string property names." + ], + [ + "TypeError", + "tools paths must use string property names." + ], + [ + "TypeError", + "tools paths must use string property names." + ], + "function", + "function", + "function", + [ + "Error", + "No namespace at tools.nope." + ], + [ + "Error", + "No namespace at tools.git.nope." + ], + [ + "Error", + "No namespace at tools.git.status.x." + ], + [], + [ + "status" + ], + [ + "echo", + "fail", + "git" + ], + [ + "TypeError", + "Promise.prototype.then called on incompatible receiver a data object." + ], + [ + "TypeError", + "Promise.prototype.catch called on incompatible receiver a number." + ], + [ + "TypeError", + "Promise.prototype.finally called on incompatible receiver a namespace reference." + ], + [ + "TypeError", + "Promise.prototype.then called on incompatible receiver null." + ], + [ + "TypeError", + "new URLSearchParams(...) expects a query string, data object, iterable pairs, or URLSearchParams." + ], + [ + "TypeError", + "new URLSearchParams(...) expects a query string, data object, or synchronous iterable pairs." + ], + [ + "Cannot read properties of null (reading '[object Object]').", + 0 + ], + [ + "TypeError", + "Cannot read properties of undefined (reading '1,2')." + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/boundary-namespace-then.js b/packages/codemode-rust/conformance/cases/boundary-namespace-then.js new file mode 100644 index 0000000000000..af858d2c3e193 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-namespace-then.js @@ -0,0 +1,9 @@ +// `then` names a path in a namespace like any other, and a namespace is never a thenable: awaiting or resolving one +// calls nothing. +const out = [typeof tools.then, typeof tools.git.then, typeof tools.git.then.then] +out.push(typeof (await tools.git)) +out.push(typeof (await Promise.resolve(tools.git))) +out.push(typeof (await new Promise((resolve) => resolve(tools.git)))) +out.push(typeof (await (async () => tools.git)())) +out.push(typeof (await Promise.all([tools.git]))[0]) +return out diff --git a/packages/codemode-rust/conformance/cases/boundary-namespace-then.json b/packages/codemode-rust/conformance/cases/boundary-namespace-then.json new file mode 100644 index 0000000000000..8693568a75dc5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-namespace-then.json @@ -0,0 +1,16 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "function", + "function", + "function", + "function", + "function", + "function", + "function", + "function" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/boundary-promise.js b/packages/codemode-rust/conformance/cases/boundary-promise.js new file mode 100644 index 0000000000000..a76f990f58161 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-promise.js @@ -0,0 +1 @@ +return Promise.resolve({ ok: 1 }) diff --git a/packages/codemode-rust/conformance/cases/boundary-promise.json b/packages/codemode-rust/conformance/cases/boundary-promise.json new file mode 100644 index 0000000000000..7de768485daf5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-promise.json @@ -0,0 +1,9 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "ok": 1 + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/boundary-property-bases.js b/packages/codemode-rust/conformance/cases/boundary-property-bases.js new file mode 100644 index 0000000000000..2bb4fa1a3f865 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-property-bases.js @@ -0,0 +1,18 @@ +// Member writes, deletes, `in` and instanceof on values that are not data objects: null and undefined, primitives, +// a symbol, a promise, a namespace and functions. +const t = (f) => { try { return f() } catch (e) { return [e.name, e.message] } } +const p = Promise.resolve(1) +const sym = Symbol.iterator +const out = [] +for (const v of [null, undefined, "ab", 5, true, sym, p, tools, tools.git, () => 1]) { + out.push([ + t(() => { v.a = 1; return 1 }), t(() => { v["b"] = 2; return 2 }), t(() => delete v.c), + t(() => "a" in v), t(() => v in {}), t(() => v instanceof Object), t(() => ({}) instanceof v), + t(() => v.d), t(() => v?.e), + ]) +} +const k = { toString() { out.push("converted"); return "a" } } +out.push(t(() => k in 5), t(() => k in { a: 1 }), t(() => "then" in p), t(() => p in { "[object Promise]": 1 })) +out.push(t(() => { const o = { [p]: 1, [tools.git]: 2 }; return Object.keys(o) })) +out.push(t(() => Object.assign(p, { a: 1 }).a)) +return out diff --git a/packages/codemode-rust/conformance/cases/boundary-property-bases.json b/packages/codemode-rust/conformance/cases/boundary-property-bases.json new file mode 100644 index 0000000000000..b200841219690 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-property-bases.json @@ -0,0 +1,278 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + [ + "TypeError", + "Cannot read properties of null (reading 'a')." + ], + [ + "TypeError", + "Cannot read properties of null (reading 'b')." + ], + [ + "TypeError", + "Cannot read properties of null (reading 'c')." + ], + [ + "TypeError", + "The 'in' operator requires a data object on the right-hand side." + ], + false, + false, + [ + "TypeError", + "The right-hand side of 'instanceof' is not callable." + ], + [ + "TypeError", + "Cannot read properties of null (reading 'd')." + ], + null + ], + [ + [ + "TypeError", + "Cannot read properties of undefined (reading 'a')." + ], + [ + "TypeError", + "Cannot read properties of undefined (reading 'b')." + ], + [ + "TypeError", + "Cannot read properties of undefined (reading 'c')." + ], + [ + "TypeError", + "The 'in' operator requires a data object on the right-hand side." + ], + false, + false, + [ + "TypeError", + "The right-hand side of 'instanceof' is not callable." + ], + [ + "TypeError", + "Cannot read properties of undefined (reading 'd')." + ], + null + ], + [ + [ + "TypeError", + "Cannot create property 'a' on string 'ab'." + ], + [ + "TypeError", + "Cannot create property 'b' on string 'ab'." + ], + true, + [ + "TypeError", + "The 'in' operator requires a data object on the right-hand side." + ], + false, + false, + [ + "TypeError", + "The right-hand side of 'instanceof' is not callable." + ], + null, + null + ], + [ + [ + "TypeError", + "Cannot create property 'a' on number '5'." + ], + [ + "TypeError", + "Cannot create property 'b' on number '5'." + ], + true, + [ + "TypeError", + "The 'in' operator requires a data object on the right-hand side." + ], + false, + false, + [ + "TypeError", + "The right-hand side of 'instanceof' is not callable." + ], + null, + null + ], + [ + [ + "TypeError", + "Cannot create property 'a' on boolean 'true'." + ], + [ + "TypeError", + "Cannot create property 'b' on boolean 'true'." + ], + true, + [ + "TypeError", + "The 'in' operator requires a data object on the right-hand side." + ], + false, + false, + [ + "TypeError", + "The right-hand side of 'instanceof' is not callable." + ], + null, + null + ], + [ + [ + "TypeError", + "Cannot access a property on a non-object value." + ], + [ + "TypeError", + "Cannot access a property on a non-object value." + ], + [ + "TypeError", + "Cannot access a property on a non-object value." + ], + [ + "TypeError", + "The 'in' operator requires a data object on the right-hand side." + ], + false, + false, + [ + "TypeError", + "The right-hand side of 'instanceof' is not callable." + ], + [ + "TypeError", + "Cannot access a property on a non-object value." + ], + [ + "TypeError", + "Cannot access a property on a non-object value." + ] + ], + [ + [ + "TypeError", + "This value is an un-awaited Promise; await it first - e.g. `const result = await load(...)`." + ], + [ + "TypeError", + "This value is an un-awaited Promise; await it first - e.g. `const result = await load(...)`." + ], + true, + false, + false, + true, + [ + "TypeError", + "The right-hand side of 'instanceof' is not callable." + ], + [ + "TypeError", + "This value is an un-awaited Promise; await it first - e.g. `const result = await load(...)`." + ], + [ + "TypeError", + "This value is an un-awaited Promise; await it first - e.g. `const result = await load(...)`." + ] + ], + [ + [ + "TypeError", + "Only data fields may be assigned." + ], + [ + "TypeError", + "Only data fields may be assigned." + ], + [ + "TypeError", + "Only data fields may be deleted." + ], + [ + "TypeError", + "Binary operators require data values." + ], + [ + "TypeError", + "Binary operators require data values." + ], + false, + [ + "TypeError", + "The right-hand side of 'instanceof' is not callable." + ], + null, + null + ], + [ + [ + "TypeError", + "Only data fields may be assigned." + ], + [ + "TypeError", + "Only data fields may be assigned." + ], + [ + "TypeError", + "Only data fields may be deleted." + ], + [ + "TypeError", + "Binary operators require data values." + ], + [ + "TypeError", + "Binary operators require data values." + ], + false, + [ + "TypeError", + "The right-hand side of 'instanceof' is not callable." + ], + null, + null + ], + [ + 1, + 2, + true, + true, + false, + true, + [ + "TypeError", + "The right-hand side of 'instanceof' has no 'prototype' object." + ], + null, + null + ], + "converted", + [ + "TypeError", + "The 'in' operator requires a data object on the right-hand side." + ], + true, + true, + true, + [ + "[object Promise]", + "[object Object]" + ], + 1 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/boundary-string-arguments.js b/packages/codemode-rust/conformance/cases/boundary-string-arguments.js new file mode 100644 index 0000000000000..96f1fb2cbc5a1 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-string-arguments.js @@ -0,0 +1,23 @@ +// An argument a String method reads that is still a promise or a namespace once the receiver and the arguments +// converted is not data; anything else converts (a function, a generator, a namespace inside an array). +const t = (f) => { try { return f() } catch (e) { return [e.name, e.message] } } +const p = Promise.resolve(1) +const s = "abca" +return [ + t(() => s.indexOf(p)), t(() => s.indexOf("a", tools)), t(() => s.lastIndexOf(tools.git)), + t(() => s.includes(p)), t(() => s.startsWith("a", p)), t(() => s.endsWith(tools)), + t(() => s.at(p)), t(() => s.charAt(tools)), t(() => s.charCodeAt(p)), t(() => s.codePointAt(tools.git.status)), + t(() => s.slice(1, p)), t(() => s.substring(tools)), t(() => s.substr(p)), + t(() => s.padStart(p)), t(() => s.padStart(9, tools)), t(() => s.padEnd(1e10, p)), t(() => s.padEnd(6, p)), + t(() => s.repeat(tools)), t(() => s.split(p)), t(() => s.split("b", tools)), t(() => s.split(undefined, p)), + t(() => s.replace(p, "x")), t(() => s.replace("a", tools)), t(() => s.replaceAll(/a/g, p)), + t(() => s.replaceAll(/a/, p)), t(() => s.replace(p, () => "y")), + t(() => s.concat("x", p)), t(() => s.concat(tools)), t(() => s.localeCompare(p)), t(() => s.normalize(tools)), + t(() => s.toUpperCase(p)), t(() => s.at(undefined)), + t(() => s.indexOf(() => 1)), t(() => s.concat(function* g() {}, [tools], { toString: () => "!" })), + t(() => s.includes((function* () {})())), + t(() => String.prototype.at.call(p, 0)), t(() => String.prototype.slice.call(tools, -3)), + t(() => s.slice({ valueOf() { throw new Error("first") } }, p)), + t(() => String.prototype.trim.call(null)), t(() => String.prototype.toLocaleUpperCase.call(undefined)), + t(() => String.prototype[Symbol.iterator].call(null)), t(() => String.prototype.padEnd.call(null, 2)), +] diff --git a/packages/codemode-rust/conformance/cases/boundary-string-arguments.json b/packages/codemode-rust/conformance/cases/boundary-string-arguments.json new file mode 100644 index 0000000000000..804d906f095d0 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-string-arguments.json @@ -0,0 +1,155 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "TypeError", + "String.indexOf expects argument 1 to be a data value." + ], + [ + "TypeError", + "String.indexOf expects argument 2 to be a data value." + ], + [ + "TypeError", + "String.lastIndexOf expects argument 1 to be a data value." + ], + [ + "TypeError", + "String.includes expects argument 1 to be a data value." + ], + [ + "TypeError", + "String.startsWith expects argument 2 to be a data value." + ], + [ + "TypeError", + "String.endsWith expects argument 1 to be a data value." + ], + [ + "TypeError", + "String.at expects argument 1 to be a data value." + ], + [ + "TypeError", + "String.charAt expects argument 1 to be a data value." + ], + [ + "TypeError", + "String.charCodeAt expects argument 1 to be a data value." + ], + [ + "TypeError", + "String.codePointAt expects argument 1 to be a data value." + ], + [ + "TypeError", + "String.slice expects argument 2 to be a data value." + ], + [ + "TypeError", + "String.substring expects argument 1 to be a data value." + ], + [ + "TypeError", + "String.substr expects argument 1 to be a data value." + ], + [ + "TypeError", + "String.padStart expects argument 1 to be a data value." + ], + [ + "TypeError", + "String.padStart expects argument 2 to be a data value." + ], + [ + "RangeError", + "Invalid string length" + ], + [ + "TypeError", + "String.padEnd expects argument 2 to be a data value." + ], + [ + "TypeError", + "String.repeat expects argument 1 to be a data value." + ], + [ + "TypeError", + "String.split expects argument 1 to be a data value." + ], + [ + "TypeError", + "String.split expects argument 2 to be a data value." + ], + [ + "TypeError", + "String.split expects argument 2 to be a data value." + ], + [ + "TypeError", + "String.replace expects argument 1 to be a data value." + ], + [ + "TypeError", + "String.replace expects argument 2 to be a data value." + ], + [ + "TypeError", + "String.replaceAll expects argument 2 to be a data value." + ], + [ + "TypeError", + "String.replaceAll expects argument 2 to be a data value." + ], + [ + "TypeError", + "String.replace expects argument 1 to be a data value." + ], + [ + "TypeError", + "String.concat expects argument 2 to be a data value." + ], + [ + "TypeError", + "String.concat expects argument 1 to be a data value." + ], + [ + "TypeError", + "String.localeCompare expects argument 1 to be a data value." + ], + [ + "TypeError", + "String.normalize expects argument 1 to be a data value." + ], + "ABCA", + "a", + -1, + "abca[object Function][object Object]!", + false, + "[", + "ct]", + [ + "Error", + "first" + ], + [ + "TypeError", + "String.prototype.trim called on null or undefined." + ], + [ + "TypeError", + "String.prototype.toLocaleUpperCase called on null or undefined." + ], + [ + "TypeError", + "String.prototype.[Symbol.iterator] called on null or undefined." + ], + [ + "TypeError", + "String.prototype.padEnd called on null or undefined." + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/boundary-symbols.js b/packages/codemode-rust/conformance/cases/boundary-symbols.js new file mode 100644 index 0000000000000..97d525bef3166 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-symbols.js @@ -0,0 +1,18 @@ +// The two symbols as the reference's host words them: text where its host's String makes them text, a refusal from +// its `+` and from ToNumber, no properties, and an object with no fields as JSON. +const t = (f) => { try { return f() } catch (e) { return [e.name, e.message] } } +const s = Symbol.iterator +const a = Symbol.asyncIterator +console.log(s, [a], { k: s }) +return [ + t(() => String(s)), t(() => `${a}`), t(() => [s, a].join()), t(() => [1, 2].join(s)), t(() => String([s])), + t(() => "" + s), t(() => s + 1), t(() => s + s), t(() => Number(s)), t(() => +s), t(() => Math.max(s)), + t(() => parseInt(s)), t(() => parseFloat(a)), t(() => isNaN(s)), t(() => [1].at(s)), t(() => new Error(s).message), + t(() => encodeURIComponent(s)), t(() => "abca".split(s, 1)), t(() => "abca".replace("a", s)), t(() => "ab".concat(s)), + t(() => String.prototype.toUpperCase.call(s)), t(() => "ab".localeCompare(s)), t(() => s.description), + t(() => s.toString()), t(() => { s.x = 1 }), t(() => delete s.x), t(() => s?.x), t(() => "x" in s), + t(() => Object.prototype.toString.call(s)), t(() => JSON.stringify(s)), t(() => JSON.stringify({ s, n: [a] })), + t(() => JSON.stringify([s], null, 1)), t(() => [s].sort().length), t(() => Object.entries(s)), t(() => ({ ...s })), + t(() => undefined[s]), t(() => { null[s] = 1 }), t(() => new URLSearchParams(s)), t(() => Object(s)), + t(() => Object.getPrototypeOf(s)), t(() => s == s), t(() => [s].includes(s)), s, [a], +] diff --git a/packages/codemode-rust/conformance/cases/boundary-symbols.json b/packages/codemode-rust/conformance/cases/boundary-symbols.json new file mode 100644 index 0000000000000..9172025c52fc5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-symbols.json @@ -0,0 +1,115 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "Symbol(codemode.iterator)", + "Symbol(codemode.async-iterator)", + "Symbol(codemode.iterator),Symbol(codemode.async-iterator)", + "1Symbol(codemode.iterator)2", + "Symbol(codemode.iterator)", + [ + "TypeError", + "Cannot convert a symbol to a string" + ], + [ + "TypeError", + "Cannot convert a symbol to a number" + ], + [ + "TypeError", + "Cannot convert a symbol to a number" + ], + [ + "TypeError", + "Cannot convert a symbol to a number" + ], + [ + "TypeError", + "Cannot convert a symbol to a number" + ], + [ + "TypeError", + "Cannot convert a symbol to a number" + ], + null, + null, + [ + "TypeError", + "Cannot convert a symbol to a number" + ], + [ + "TypeError", + "Cannot convert a symbol to a number" + ], + "Symbol(codemode.iterator)", + "Symbol(codemode.iterator)", + [ + "abca" + ], + "Symbol(codemode.iterator)bca", + "abSymbol(codemode.iterator)", + "SYMBOL(CODEMODE.ITERATOR)", + -1, + [ + "TypeError", + "Cannot access a property on a non-object value." + ], + [ + "TypeError", + "Cannot access a property on a non-object value." + ], + [ + "TypeError", + "Cannot access a property on a non-object value." + ], + [ + "TypeError", + "Cannot access a property on a non-object value." + ], + [ + "TypeError", + "Cannot access a property on a non-object value." + ], + [ + "TypeError", + "The 'in' operator requires a data object on the right-hand side." + ], + "[object Object]", + "{}", + "{\"s\":{},\"n\":[{}]}", + "[\n {}\n]", + 1, + [], + {}, + [ + "TypeError", + "Cannot read properties of undefined (reading 'Symbol(codemode.iterator)')." + ], + [ + "TypeError", + "Cannot read properties of null (reading 'Symbol(codemode.iterator)')." + ], + [ + "TypeError", + "new URLSearchParams(...) expects a query string, data object, iterable pairs, or URLSearchParams." + ], + [ + "TypeError", + "Object(symbol) wrapper objects are not supported; use the primitive value directly." + ], + [ + "TypeError", + "Object.getPrototypeOf cannot convert a symbol to an object." + ], + true, + true, + {}, + [ + {} + ] + ], + "logs": [ + "Symbol(codemode.iterator) [Symbol(codemode.async-iterator)] {\"k\":Symbol(codemode.iterator)}" + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/boundary-to-json.js b/packages/codemode-rust/conformance/cases/boundary-to-json.js new file mode 100644 index 0000000000000..813bd3278d93e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-to-json.js @@ -0,0 +1 @@ +return { inner: { toJSON() { return ["custom"] } } } diff --git a/packages/codemode-rust/conformance/cases/boundary-to-json.json b/packages/codemode-rust/conformance/cases/boundary-to-json.json new file mode 100644 index 0000000000000..a8c42e656e75b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-to-json.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "inner": [ + "custom" + ] + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/boundary-undefined-null.js b/packages/codemode-rust/conformance/cases/boundary-undefined-null.js new file mode 100644 index 0000000000000..9dcea9340d1cb --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-undefined-null.js @@ -0,0 +1 @@ +return [undefined, null, { a: undefined, b: null }, [undefined], NaN, Infinity, -Infinity, -0] diff --git a/packages/codemode-rust/conformance/cases/boundary-undefined-null.json b/packages/codemode-rust/conformance/cases/boundary-undefined-null.json new file mode 100644 index 0000000000000..912e419c750a3 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/boundary-undefined-null.json @@ -0,0 +1,20 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + null, + null, + { + "b": null + }, + [ + null + ], + null, + null, + null, + 0 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/closure-counter.js b/packages/codemode-rust/conformance/cases/closure-counter.js new file mode 100644 index 0000000000000..10d600cfcee21 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/closure-counter.js @@ -0,0 +1,4 @@ +const counter = () => { let n = 0; return { inc: () => ++n, get: () => n } } +const a = counter(), b = counter() +a.inc(); a.inc(); b.inc() +return [a.get(), b.get()] diff --git a/packages/codemode-rust/conformance/cases/closure-counter.json b/packages/codemode-rust/conformance/cases/closure-counter.json new file mode 100644 index 0000000000000..66f027eeaae1c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/closure-counter.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 2, + 1 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/closure-iife.js b/packages/codemode-rust/conformance/cases/closure-iife.js new file mode 100644 index 0000000000000..45a64b0cb335b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/closure-iife.js @@ -0,0 +1,2 @@ +const mod = (function () { const secret = 41; return { answer: () => secret + 1 } })() +return mod.answer() diff --git a/packages/codemode-rust/conformance/cases/closure-iife.json b/packages/codemode-rust/conformance/cases/closure-iife.json new file mode 100644 index 0000000000000..1a93c28d4a431 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/closure-iife.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 42, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/closure-loop-let.js b/packages/codemode-rust/conformance/cases/closure-loop-let.js new file mode 100644 index 0000000000000..1c66baea72908 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/closure-loop-let.js @@ -0,0 +1,3 @@ +const fns = [] +for (let i = 0; i < 3; i++) fns.push(() => i) +return fns.map((f) => f()) diff --git a/packages/codemode-rust/conformance/cases/closure-loop-let.json b/packages/codemode-rust/conformance/cases/closure-loop-let.json new file mode 100644 index 0000000000000..559250482521b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/closure-loop-let.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 0, + 1, + 2 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/coercion.js b/packages/codemode-rust/conformance/cases/coercion.js new file mode 100644 index 0000000000000..ae2f4efbe6a03 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/coercion.js @@ -0,0 +1 @@ +return ["a" + 1, 1 + "2", 1 + 2 + "3", "3" * "4", [1, 2] + "", ({}) + "", true + 1, null + 1, "5" - 2, +"7", +"", Number(undefined) === Number(undefined)] diff --git a/packages/codemode-rust/conformance/cases/coercion.json b/packages/codemode-rust/conformance/cases/coercion.json new file mode 100644 index 0000000000000..6ad1d4b211d2c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/coercion.json @@ -0,0 +1,20 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "a1", + "12", + "33", + 12, + "1,2", + "[object Object]", + 2, + 1, + 3, + 7, + 0, + false + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/console-log.js b/packages/codemode-rust/conformance/cases/console-log.js new file mode 100644 index 0000000000000..30b97ee289780 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/console-log.js @@ -0,0 +1,5 @@ +console.log("hello") +console.log("multi", 1, true, null, undefined) +console.log({ a: [1, "s"] }, [1, 2]) +console.log(`t${1}`) +return "done" diff --git a/packages/codemode-rust/conformance/cases/console-log.json b/packages/codemode-rust/conformance/cases/console-log.json new file mode 100644 index 0000000000000..cba13c8d1ce21 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/console-log.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [ + "hello", + "multi 1 true null undefined", + "{\"a\":[1,\"s\"]} [1,2]", + "t1" + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/depth-limit-callbacks.js b/packages/codemode-rust/conformance/cases/depth-limit-callbacks.js new file mode 100644 index 0000000000000..3f0370dc40a2a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/depth-limit-callbacks.js @@ -0,0 +1,109 @@ +// The call depth limit where a built-in calls back the recursing function itself, one frame per level, probed from +// the program's top level. +let map +{ + let m = 0 + const f = () => { m++; [0].map(f) } + try { + f() + map = [m, "no error"] + } catch (e) { + map = [m, e.name, e.message] + } +} +let forEach +{ + let m = 0 + const f = () => { m++; [0].forEach(f) } + try { + f() + forEach = [m, "no error"] + } catch (e) { + forEach = [m, e.name, e.message] + } +} +let toString +{ + let m = 0 + const o = { toString() { m++; return String(this) } } + try { + String(o) + toString = [m, "no error"] + } catch (e) { + toString = [m, e.name, e.message] + } +} +let replace +{ + let m = 0 + const f = () => { m++; return "a".replace("a", f) } + try { + f() + replace = [m, "no error"] + } catch (e) { + replace = [m, e.name, e.message] + } +} +let toJSON +{ + let m = 0 + const o = { toJSON() { m++; return JSON.stringify(o) } } + try { + JSON.stringify(o) + toJSON = [m, "no error"] + } catch (e) { + toJSON = [m, e.name, e.message] + } +} +let arrayFrom +{ + let m = 0 + const f = () => { m++; return Array.from([0], f) } + try { + f() + arrayFrom = [m, "no error"] + } catch (e) { + arrayFrom = [m, e.name, e.message] + } +} +let reduce +{ + let m = 0 + const f = () => { m++; return [0, 1].reduce(f) } + try { + f() + reduce = [m, "no error"] + } catch (e) { + reduce = [m, e.name, e.message] + } +} +let sort +{ + let m = 0 + const f = () => { m++; [0, 1].sort(f); return 0 } + try { + f() + sort = [m, "no error"] + } catch (e) { + sort = [m, e.name, e.message] + } +} +let limit +{ + const r = (n) => (n > 1 ? [n - 1].map(r)[0] : n) + try { + limit = r(10000) + } catch (e) { + limit = [e.name, e.message] + } +} +let over +{ + const r = (n) => (n > 1 ? [n - 1].map(r)[0] : n) + try { + over = r(10001) + } catch (e) { + over = [e.name, e.message] + } +} +return { map, forEach, toString, replace, toJSON, arrayFrom, reduce, sort, limit, over } diff --git a/packages/codemode-rust/conformance/cases/depth-limit-callbacks.json b/packages/codemode-rust/conformance/cases/depth-limit-callbacks.json new file mode 100644 index 0000000000000..aa30272cacbde --- /dev/null +++ b/packages/codemode-rust/conformance/cases/depth-limit-callbacks.json @@ -0,0 +1,53 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "map": [ + 10000, + "RangeError", + "Maximum call stack size exceeded" + ], + "forEach": [ + 10000, + "RangeError", + "Maximum call stack size exceeded" + ], + "toString": [ + 10000, + "RangeError", + "Maximum call stack size exceeded" + ], + "replace": [ + 10000, + "RangeError", + "Maximum call stack size exceeded" + ], + "toJSON": [ + 10000, + "RangeError", + "Maximum call stack size exceeded" + ], + "arrayFrom": [ + 10000, + "RangeError", + "Maximum call stack size exceeded" + ], + "reduce": [ + 10000, + "RangeError", + "Maximum call stack size exceeded" + ], + "sort": [ + 10000, + "RangeError", + "Maximum call stack size exceeded" + ], + "limit": 1, + "over": [ + "RangeError", + "Maximum call stack size exceeded" + ] + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/depth-limit-one-frame.js b/packages/codemode-rust/conformance/cases/depth-limit-one-frame.js new file mode 100644 index 0000000000000..496f2bbb0107a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/depth-limit-one-frame.js @@ -0,0 +1,87 @@ +// The call depth limit with one frame per level, probed from the program's top level: the deepest level reached, +// the error there, and exactly the limit succeeding while one more level fails. +let plain +{ + let m = 0 + const f = (n) => { m = n; f(n + 1) } + try { + f(1) + plain = [m, "no error"] + } catch (e) { + plain = [m, e.name, e.message] + } +} +let method +{ + let m = 0 + const o = { f(n) { m = n; this.f(n + 1) } } + try { + o.f(1) + method = [m, "no error"] + } catch (e) { + method = [m, e.name, e.message] + } +} +let call +{ + let m = 0 + function f(n) { m = n; f.call(null, n + 1) } + try { + f(1) + call = [m, "no error"] + } catch (e) { + call = [m, e.name, e.message] + } +} +let apply +{ + let m = 0 + function f(n) { m = n; f.apply(null, [n + 1]) } + try { + f(1) + apply = [m, "no error"] + } catch (e) { + apply = [m, e.name, e.message] + } +} +let generator +{ + let m = 0 + function* g(n) { m = n; yield* g(n + 1) } + try { + [...g(1)] + generator = [m, "no error"] + } catch (e) { + generator = [m, e.name, e.message] + } +} +let asyncFn +{ + let m = 0 + const f = async (n) => { m = n; await f(n + 1) } + try { + await f(1) + asyncFn = [m, "no error"] + } catch (e) { + asyncFn = [m, e.name, e.message] + } +} +let limit +{ + const r = (n) => (n > 1 ? r(n - 1) : n) + try { + limit = r(10000) + } catch (e) { + limit = [e.name, e.message] + } +} +let over +{ + const r = (n) => (n > 1 ? r(n - 1) : n) + try { + over = r(10001) + } catch (e) { + over = [e.name, e.message] + } +} +return { plain, method, call, apply, generator, asyncFn, limit, over } diff --git a/packages/codemode-rust/conformance/cases/depth-limit-one-frame.json b/packages/codemode-rust/conformance/cases/depth-limit-one-frame.json new file mode 100644 index 0000000000000..2602c4501eef0 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/depth-limit-one-frame.json @@ -0,0 +1,43 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "plain": [ + 10000, + "RangeError", + "Maximum call stack size exceeded" + ], + "method": [ + 10000, + "RangeError", + "Maximum call stack size exceeded" + ], + "call": [ + 10000, + "RangeError", + "Maximum call stack size exceeded" + ], + "apply": [ + 10000, + "RangeError", + "Maximum call stack size exceeded" + ], + "generator": [ + 10000, + "RangeError", + "Maximum call stack size exceeded" + ], + "asyncFn": [ + 10000, + "RangeError", + "Maximum call stack size exceeded" + ], + "limit": 1, + "over": [ + "RangeError", + "Maximum call stack size exceeded" + ] + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/depth-limit-two-frames.js b/packages/codemode-rust/conformance/cases/depth-limit-two-frames.js new file mode 100644 index 0000000000000..c065ff1069067 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/depth-limit-two-frames.js @@ -0,0 +1,138 @@ +// The call depth limit with two and three frames per level, probed from the program's top level: the deepest level +// reached, the error there, and exactly the limit succeeding while one more level fails. +let map +{ + let m = 0 + const f = (n) => { m = n; [0].map(() => f(n + 1)) } + try { + f(1) + map = [m, "no error"] + } catch (e) { + map = [m, e.name, e.message] + } +} +let forEach +{ + let m = 0 + const f = (n) => { m = n; [0].forEach(() => f(n + 1)) } + try { + f(1) + forEach = [m, "no error"] + } catch (e) { + forEach = [m, e.name, e.message] + } +} +let reduce +{ + let m = 0 + const f = (n) => { m = n; return [0, 1].reduce(() => f(n + 1)) } + try { + f(1) + reduce = [m, "no error"] + } catch (e) { + reduce = [m, e.name, e.message] + } +} +let sort +{ + let m = 0 + const f = (n) => { m = n; return [0, 1].sort(() => f(n + 1)) } + try { + f(1) + sort = [m, "no error"] + } catch (e) { + sort = [m, e.name, e.message] + } +} +let toString +{ + let m = 0 + const f = (n) => { m = n; return String({ toString: () => f(n + 1) }) } + try { + f(1) + toString = [m, "no error"] + } catch (e) { + toString = [m, e.name, e.message] + } +} +let replace +{ + let m = 0 + const f = (n) => { m = n; return "a".replace("a", () => f(n + 1)) } + try { + f(1) + replace = [m, "no error"] + } catch (e) { + replace = [m, e.name, e.message] + } +} +let toJSON +{ + let m = 0 + const f = (n) => { m = n; return JSON.stringify({ toJSON: () => f(n + 1) }) } + try { + f(1) + toJSON = [m, "no error"] + } catch (e) { + toJSON = [m, e.name, e.message] + } +} +let arrayFrom +{ + let m = 0 + const f = (n) => { m = n; return Array.from([0], () => f(n + 1)) } + try { + f(1) + arrayFrom = [m, "no error"] + } catch (e) { + arrayFrom = [m, e.name, e.message] + } +} +let mapInMap +{ + let m = 0 + const f = (n) => { m = n; [0].map(() => [0].map(() => f(n + 1))) } + try { + f(1) + mapInMap = [m, "no error"] + } catch (e) { + mapInMap = [m, e.name, e.message] + } +} +let limit +{ + const r = (n) => (n > 1 ? [n - 1].map((x) => r(x))[0] : n) + try { + limit = r(5000) + } catch (e) { + limit = [e.name, e.message] + } +} +let over +{ + const r = (n) => (n > 1 ? [n - 1].map((x) => r(x))[0] : n) + try { + over = r(5001) + } catch (e) { + over = [e.name, e.message] + } +} +let threeLimit +{ + const r = (n) => (n > 1 ? [n - 1].map((x) => [x].map((y) => r(y))[0])[0] : n) + try { + threeLimit = r(3334) + } catch (e) { + threeLimit = [e.name, e.message] + } +} +let threeOver +{ + const r = (n) => (n > 1 ? [n - 1].map((x) => [x].map((y) => r(y))[0])[0] : n) + try { + threeOver = r(3335) + } catch (e) { + threeOver = [e.name, e.message] + } +} +return { map, forEach, reduce, sort, toString, replace, toJSON, arrayFrom, mapInMap, limit, over, threeLimit, threeOver } diff --git a/packages/codemode-rust/conformance/cases/depth-limit-two-frames.json b/packages/codemode-rust/conformance/cases/depth-limit-two-frames.json new file mode 100644 index 0000000000000..e5c4bcda47ca8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/depth-limit-two-frames.json @@ -0,0 +1,63 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "map": [ + 5000, + "RangeError", + "Maximum call stack size exceeded" + ], + "forEach": [ + 5000, + "RangeError", + "Maximum call stack size exceeded" + ], + "reduce": [ + 5000, + "RangeError", + "Maximum call stack size exceeded" + ], + "sort": [ + 5000, + "RangeError", + "Maximum call stack size exceeded" + ], + "toString": [ + 5000, + "RangeError", + "Maximum call stack size exceeded" + ], + "replace": [ + 5000, + "RangeError", + "Maximum call stack size exceeded" + ], + "toJSON": [ + 5000, + "RangeError", + "Maximum call stack size exceeded" + ], + "arrayFrom": [ + 5000, + "RangeError", + "Maximum call stack size exceeded" + ], + "mapInMap": [ + 3334, + "RangeError", + "Maximum call stack size exceeded" + ], + "limit": 1, + "over": [ + "RangeError", + "Maximum call stack size exceeded" + ], + "threeLimit": 1, + "threeOver": [ + "RangeError", + "Maximum call stack size exceeded" + ] + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/depth-limit-uncaught.js b/packages/codemode-rust/conformance/cases/depth-limit-uncaught.js new file mode 100644 index 0000000000000..fd811e9b3135c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/depth-limit-uncaught.js @@ -0,0 +1,3 @@ +// The call depth limit's RangeError, uncaught: it ends the run at the call that went over. +const f = (n) => f(n + 1) +f(1) diff --git a/packages/codemode-rust/conformance/cases/depth-limit-uncaught.json b/packages/codemode-rust/conformance/cases/depth-limit-uncaught.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/depth-limit-uncaught.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/destructuring-array.js b/packages/codemode-rust/conformance/cases/destructuring-array.js new file mode 100644 index 0000000000000..e7edb3174eb97 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/destructuring-array.js @@ -0,0 +1,4 @@ +const [first, , third = "t", ...others] = [1, 2, undefined, 4, 5] +let x = 1, y = 2 +;[x, y] = [y, x] +return [first, third, others, x, y] diff --git a/packages/codemode-rust/conformance/cases/destructuring-array.json b/packages/codemode-rust/conformance/cases/destructuring-array.json new file mode 100644 index 0000000000000..a3679cf0db866 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/destructuring-array.json @@ -0,0 +1,16 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + "t", + [ + 4, + 5 + ], + 2, + 1 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/destructuring-object.js b/packages/codemode-rust/conformance/cases/destructuring-object.js new file mode 100644 index 0000000000000..a514dfce75f7f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/destructuring-object.js @@ -0,0 +1,2 @@ +const { a, b: { c, d = 4 }, e: renamed = "def", ...rest } = { a: 1, b: { c: 3 }, x: 9, y: 10 } +return [a, c, d, renamed, rest] diff --git a/packages/codemode-rust/conformance/cases/destructuring-object.json b/packages/codemode-rust/conformance/cases/destructuring-object.json new file mode 100644 index 0000000000000..8599136e87e5b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/destructuring-object.json @@ -0,0 +1,16 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 3, + 4, + "def", + { + "x": 9, + "y": 10 + } + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/destructuring-params.js b/packages/codemode-rust/conformance/cases/destructuring-params.js new file mode 100644 index 0000000000000..696922dc28c7b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/destructuring-params.js @@ -0,0 +1,2 @@ +const f = ({ name, tags: [first] = [] }, [n = 1] = []) => name + ":" + first + ":" + n +return [f({ name: "a", tags: ["t"] }, [5]), f({ name: "b" })] diff --git a/packages/codemode-rust/conformance/cases/destructuring-params.json b/packages/codemode-rust/conformance/cases/destructuring-params.json new file mode 100644 index 0000000000000..fc751cb027643 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/destructuring-params.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "a:t:5", + "b:undefined:1" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/equality.js b/packages/codemode-rust/conformance/cases/equality.js new file mode 100644 index 0000000000000..17d41d091ab6e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/equality.js @@ -0,0 +1 @@ +return [1 == "1", 1 === "1", null == undefined, null === undefined, NaN === NaN, 0 === -0, "a" < "b", "10" < "9", 10 < 9, [] == false] diff --git a/packages/codemode-rust/conformance/cases/equality.json b/packages/codemode-rust/conformance/cases/equality.json new file mode 100644 index 0000000000000..2be74f14a6baf --- /dev/null +++ b/packages/codemode-rust/conformance/cases/equality.json @@ -0,0 +1,18 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + true, + false, + true, + false, + false, + true, + true, + true, + false, + true + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/error-class-uncaught.js b/packages/codemode-rust/conformance/cases/error-class-uncaught.js new file mode 100644 index 0000000000000..c05fc9032bef7 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-class-uncaught.js @@ -0,0 +1,3 @@ +// An uncaught instance of a class extending an Error type fails the run as that error does. +class E extends TypeError { name = "NotFound" } +throw new E("gone") diff --git a/packages/codemode-rust/conformance/cases/error-class-uncaught.json b/packages/codemode-rust/conformance/cases/error-class-uncaught.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-class-uncaught.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/error-class.js b/packages/codemode-rust/conformance/cases/error-class.js new file mode 100644 index 0000000000000..a0b5c31cb5a98 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-class.js @@ -0,0 +1,2 @@ +class Point { constructor(x) { this.x = x } } +return new Point(1) diff --git a/packages/codemode-rust/conformance/cases/error-class.json b/packages/codemode-rust/conformance/cases/error-class.json new file mode 100644 index 0000000000000..22b63feb0bc60 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-class.json @@ -0,0 +1,9 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "x": 1 + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/error-parse.js b/packages/codemode-rust/conformance/cases/error-parse.js new file mode 100644 index 0000000000000..0c79626410a35 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-parse.js @@ -0,0 +1 @@ +const x = (1 + diff --git a/packages/codemode-rust/conformance/cases/error-parse.json b/packages/codemode-rust/conformance/cases/error-parse.json new file mode 100644 index 0000000000000..ded0ebe5c79f8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-parse.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ParseError", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/error-reference.js b/packages/codemode-rust/conformance/cases/error-reference.js new file mode 100644 index 0000000000000..f4dc2ee3db242 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-reference.js @@ -0,0 +1 @@ +return notDefined + 1 diff --git a/packages/codemode-rust/conformance/cases/error-reference.json b/packages/codemode-rust/conformance/cases/error-reference.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-reference.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/error-throw-error.js b/packages/codemode-rust/conformance/cases/error-throw-error.js new file mode 100644 index 0000000000000..a621e5f961ce1 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-throw-error.js @@ -0,0 +1,2 @@ +console.log("before") +throw new RangeError("out of range") diff --git a/packages/codemode-rust/conformance/cases/error-throw-error.json b/packages/codemode-rust/conformance/cases/error-throw-error.json new file mode 100644 index 0000000000000..caf2779bd269f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-throw-error.json @@ -0,0 +1,9 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [ + "before" + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/error-throw-value.js b/packages/codemode-rust/conformance/cases/error-throw-value.js new file mode 100644 index 0000000000000..091f9dd014450 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-throw-value.js @@ -0,0 +1 @@ +throw "plain string" diff --git a/packages/codemode-rust/conformance/cases/error-throw-value.json b/packages/codemode-rust/conformance/cases/error-throw-value.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-throw-value.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/error-tool-caught.js b/packages/codemode-rust/conformance/cases/error-tool-caught.js new file mode 100644 index 0000000000000..87353a011b4e8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-tool-caught.js @@ -0,0 +1 @@ +try { await tools.fail({}) } catch (e) { return [e instanceof Error, e.message] } diff --git a/packages/codemode-rust/conformance/cases/error-tool-caught.json b/packages/codemode-rust/conformance/cases/error-tool-caught.json new file mode 100644 index 0000000000000..d176ffcc7657c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-tool-caught.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + true, + "boom" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/error-tool-uncaught.js b/packages/codemode-rust/conformance/cases/error-tool-uncaught.js new file mode 100644 index 0000000000000..36fe26d5d7524 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-tool-uncaught.js @@ -0,0 +1,2 @@ +const v = await tools.fail({}) +return v diff --git a/packages/codemode-rust/conformance/cases/error-tool-uncaught.json b/packages/codemode-rust/conformance/cases/error-tool-uncaught.json new file mode 100644 index 0000000000000..09ed990d976a5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-tool-uncaught.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "HostFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/error-unknown-tool.js b/packages/codemode-rust/conformance/cases/error-unknown-tool.js new file mode 100644 index 0000000000000..dd77b46412720 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-unknown-tool.js @@ -0,0 +1 @@ +return await tools.nope({}) diff --git a/packages/codemode-rust/conformance/cases/error-unknown-tool.json b/packages/codemode-rust/conformance/cases/error-unknown-tool.json new file mode 100644 index 0000000000000..f11833e7132cc --- /dev/null +++ b/packages/codemode-rust/conformance/cases/error-unknown-tool.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "NotFound", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/finally-overrides.js b/packages/codemode-rust/conformance/cases/finally-overrides.js new file mode 100644 index 0000000000000..c97dc040f40f9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/finally-overrides.js @@ -0,0 +1,3 @@ +const f = () => { try { return "try" } finally { return "finally" } } +const g = () => { for (let i = 0; i < 3; i++) { try { if (i === 1) break } finally { } } return "done" } +return [f(), g()] diff --git a/packages/codemode-rust/conformance/cases/finally-overrides.json b/packages/codemode-rust/conformance/cases/finally-overrides.json new file mode 100644 index 0000000000000..a73dd2fc13e8f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/finally-overrides.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "finally", + "done" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/for-of-for-in.js b/packages/codemode-rust/conformance/cases/for-of-for-in.js new file mode 100644 index 0000000000000..0defbd17be709 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/for-of-for-in.js @@ -0,0 +1,7 @@ +const out = [] +for (const x of [1, 2]) out.push(x) +for (const ch of "ab") out.push(ch) +for (const k in { p: 1, q: 2 }) out.push(k) +for (const i in ["x", "y"]) out.push(i) +for (const [k, v] of Object.entries({ m: 3 })) out.push(k + v) +return out diff --git a/packages/codemode-rust/conformance/cases/for-of-for-in.json b/packages/codemode-rust/conformance/cases/for-of-for-in.json new file mode 100644 index 0000000000000..46671c9d4fd51 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/for-of-for-in.json @@ -0,0 +1,17 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 2, + "a", + "b", + "p", + "q", + "0", + "1", + "m3" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/function-hoisting.js b/packages/codemode-rust/conformance/cases/function-hoisting.js new file mode 100644 index 0000000000000..1fa0543dddb1b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/function-hoisting.js @@ -0,0 +1,2 @@ +return twice(21) +function twice(n) { return n * 2 } diff --git a/packages/codemode-rust/conformance/cases/function-hoisting.json b/packages/codemode-rust/conformance/cases/function-hoisting.json new file mode 100644 index 0000000000000..1a93c28d4a431 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/function-hoisting.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 42, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/generator-for-of-break.js b/packages/codemode-rust/conformance/cases/generator-for-of-break.js new file mode 100644 index 0000000000000..0c6e2765c0cf4 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/generator-for-of-break.js @@ -0,0 +1,4 @@ +function* naturals() { let n = 0; while (true) yield n++ } +const out = [] +for (const n of naturals()) { if (n > 4) break; out.push(n) } +return out diff --git a/packages/codemode-rust/conformance/cases/generator-for-of-break.json b/packages/codemode-rust/conformance/cases/generator-for-of-break.json new file mode 100644 index 0000000000000..1cdadd10a4527 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/generator-for-of-break.json @@ -0,0 +1,13 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 0, + 1, + 2, + 3, + 4 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/generator-protocol.js b/packages/codemode-rust/conformance/cases/generator-protocol.js new file mode 100644 index 0000000000000..12e64f32d43f5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/generator-protocol.js @@ -0,0 +1,3 @@ +function* g() { yield 1; yield 2; return 3 } +const it = g() +return [it.next(), it.next(), it.next(), it.next()] diff --git a/packages/codemode-rust/conformance/cases/generator-protocol.json b/packages/codemode-rust/conformance/cases/generator-protocol.json new file mode 100644 index 0000000000000..c66eb32d077e0 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/generator-protocol.json @@ -0,0 +1,23 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + { + "value": 1, + "done": false + }, + { + "value": 2, + "done": false + }, + { + "value": 3, + "done": true + }, + { + "done": true + } + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/generator-spread.js b/packages/codemode-rust/conformance/cases/generator-spread.js new file mode 100644 index 0000000000000..5cd64dde33fb3 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/generator-spread.js @@ -0,0 +1,2 @@ +function* squares(n) { for (let i = 0; i < n; i++) yield i * i } +return [...squares(5)] diff --git a/packages/codemode-rust/conformance/cases/generator-spread.json b/packages/codemode-rust/conformance/cases/generator-spread.json new file mode 100644 index 0000000000000..ce9aa2878fb44 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/generator-spread.json @@ -0,0 +1,13 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 0, + 1, + 4, + 9, + 16 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/host-args-promise.js b/packages/codemode-rust/conformance/cases/host-args-promise.js new file mode 100644 index 0000000000000..ebfcc2ac3b7d5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/host-args-promise.js @@ -0,0 +1,9 @@ +// @translate {"functions": "drop", "promises": "await"} +// A tool's arguments await a promise inside them, a pending one first, and leave a function out; a rejection fails +// the call with its reason. +const nested = await tools.echo({ id: tools.echo({ id: 1 }) }) +const slow = await tools.echo({ id: (async () => { await null; await null; return 2 })() }) +const fn = await tools.git.status({ f: () => 1 }).then((s) => s.branch, (e) => e.message) +const rejected = await tools.echo({ id: tools.fail({}) }).catch((e) => e.message) +const unknown = await tools.git.stat({ id: tools.echo({ id: 3 }) }).catch((e) => e.message) +return [nested, slow, fn, rejected, unknown] diff --git a/packages/codemode-rust/conformance/cases/host-args-promise.json b/packages/codemode-rust/conformance/cases/host-args-promise.json new file mode 100644 index 0000000000000..a7fde07e16d15 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/host-args-promise.json @@ -0,0 +1,17 @@ +{ + "bindings": {}, + "translate": { + "functions": "drop", + "promises": "await" + }, + "ok": true, + "value": [ + 1, + 2, + "main", + "boom", + "No function at tools.git.stat." + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/host-import-missing.js b/packages/codemode-rust/conformance/cases/host-import-missing.js new file mode 100644 index 0000000000000..66ecc3ca40edf --- /dev/null +++ b/packages/codemode-rust/conformance/cases/host-import-missing.js @@ -0,0 +1,2 @@ +import fs from "node:fs" +return fs diff --git a/packages/codemode-rust/conformance/cases/host-import-missing.json b/packages/codemode-rust/conformance/cases/host-import-missing.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/host-import-missing.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/host-namespace-not-callable.js b/packages/codemode-rust/conformance/cases/host-namespace-not-callable.js new file mode 100644 index 0000000000000..bde1c1d271866 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/host-namespace-not-callable.js @@ -0,0 +1 @@ +return await tools.git({}) diff --git a/packages/codemode-rust/conformance/cases/host-namespace-not-callable.json b/packages/codemode-rust/conformance/cases/host-namespace-not-callable.json new file mode 100644 index 0000000000000..f11833e7132cc --- /dev/null +++ b/packages/codemode-rust/conformance/cases/host-namespace-not-callable.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "NotFound", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/host-require-dynamic-import.js b/packages/codemode-rust/conformance/cases/host-require-dynamic-import.js new file mode 100644 index 0000000000000..1a94cd7ce8e06 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/host-require-dynamic-import.js @@ -0,0 +1,5 @@ +const errors = [] +try { require("fs") } catch (e) { errors.push(e.message) } +try { await import("child_process") } catch (e) { errors.push(e.message) } +try { require(1) } catch (e) { errors.push(e.name) } +return errors diff --git a/packages/codemode-rust/conformance/cases/host-require-dynamic-import.json b/packages/codemode-rust/conformance/cases/host-require-dynamic-import.json new file mode 100644 index 0000000000000..86575eff3372a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/host-require-dynamic-import.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "Cannot import \"fs\": this runtime doesn't provide it.", + "Cannot import \"child_process\": this runtime doesn't provide it.", + "TypeError" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/host-tool-keys.js b/packages/codemode-rust/conformance/cases/host-tool-keys.js new file mode 100644 index 0000000000000..eadb1a829e55c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/host-tool-keys.js @@ -0,0 +1 @@ +return [Object.keys(tools), Object.keys(tools.git), typeof tools.git, typeof tools.git.status] diff --git a/packages/codemode-rust/conformance/cases/host-tool-keys.json b/packages/codemode-rust/conformance/cases/host-tool-keys.json new file mode 100644 index 0000000000000..6e8821b451b7a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/host-tool-keys.json @@ -0,0 +1,18 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "echo", + "fail", + "git" + ], + [ + "status" + ], + "function", + "function" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/if-else-ternary.js b/packages/codemode-rust/conformance/cases/if-else-ternary.js new file mode 100644 index 0000000000000..faacf7aae718b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/if-else-ternary.js @@ -0,0 +1,2 @@ +const classify = (n) => { if (n < 0) return "neg"; else if (n === 0) return "zero"; else return n > 10 ? "big" : "small" } +return [-1, 0, 5, 50].map(classify) diff --git a/packages/codemode-rust/conformance/cases/if-else-ternary.json b/packages/codemode-rust/conformance/cases/if-else-ternary.json new file mode 100644 index 0000000000000..373cefc0dba2f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/if-else-ternary.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "neg", + "zero", + "small", + "big" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/instanceof.js b/packages/codemode-rust/conformance/cases/instanceof.js new file mode 100644 index 0000000000000..76fe4a146d16a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/instanceof.js @@ -0,0 +1,2 @@ +const m = new Map() +return [[] instanceof Array, [] instanceof Object, ({}) instanceof Array, m instanceof Map, new Set() instanceof Set, new Error("x") instanceof Error, new TypeError("x") instanceof Error] diff --git a/packages/codemode-rust/conformance/cases/instanceof.json b/packages/codemode-rust/conformance/cases/instanceof.json new file mode 100644 index 0000000000000..8d80c22432973 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/instanceof.json @@ -0,0 +1,15 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + true, + true, + false, + true, + true, + true, + true + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/json-methods.js b/packages/codemode-rust/conformance/cases/json-methods.js new file mode 100644 index 0000000000000..31a69b54fb013 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/json-methods.js @@ -0,0 +1,3 @@ +const v = { a: [1, "two", null, true], b: { c: 1.5 }, u: undefined, f: () => 1 } +const s = JSON.stringify(v) +return [s, JSON.stringify(v, null, 2), JSON.parse(s), JSON.stringify([undefined, () => 1]), JSON.stringify("q\"uote\n"), JSON.parse("[1, {\"x\": \"y\"}]"), JSON.stringify(undefined) === undefined] diff --git a/packages/codemode-rust/conformance/cases/json-methods.json b/packages/codemode-rust/conformance/cases/json-methods.json new file mode 100644 index 0000000000000..26b4efccae8f8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/json-methods.json @@ -0,0 +1,30 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "{\"a\":[1,\"two\",null,true],\"b\":{\"c\":1.5}}", + "{\n \"a\": [\n 1,\n \"two\",\n null,\n true\n ],\n \"b\": {\n \"c\": 1.5\n }\n}", + { + "a": [ + 1, + "two", + null, + true + ], + "b": { + "c": 1.5 + } + }, + "[null,null]", + "\"q\\\"uote\\n\"", + [ + 1, + { + "x": "y" + } + ], + true + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/json-parse-error.js b/packages/codemode-rust/conformance/cases/json-parse-error.js new file mode 100644 index 0000000000000..4a106a904c068 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/json-parse-error.js @@ -0,0 +1 @@ +try { JSON.parse("{bad") } catch (e) { return [e instanceof SyntaxError, e.name] } diff --git a/packages/codemode-rust/conformance/cases/json-parse-error.json b/packages/codemode-rust/conformance/cases/json-parse-error.json new file mode 100644 index 0000000000000..9981c41f50bef --- /dev/null +++ b/packages/codemode-rust/conformance/cases/json-parse-error.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + true, + "SyntaxError" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/labels.js b/packages/codemode-rust/conformance/cases/labels.js new file mode 100644 index 0000000000000..474dc83f85609 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/labels.js @@ -0,0 +1,10 @@ +const found = [] +outer: for (let i = 0; i < 4; i++) { + inner: for (let j = 0; j < 4; j++) { + if (j === 2) continue outer + if (i === 3) break outer + found.push(i + "" + j) + } +} +block: { found.push("in"); break block; found.push("never") } +return found diff --git a/packages/codemode-rust/conformance/cases/labels.json b/packages/codemode-rust/conformance/cases/labels.json new file mode 100644 index 0000000000000..56969c65c0cf6 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/labels.json @@ -0,0 +1,15 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "00", + "01", + "10", + "11", + "20", + "21", + "in" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-accessor-literal.js b/packages/codemode-rust/conformance/cases/lang-accessor-literal.js new file mode 100644 index 0000000000000..2c95180dccd49 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-accessor-literal.js @@ -0,0 +1,11 @@ +// An accessor in an object literal is defined in order with the properties around it. +let evaluated = 0 +const make = () => ({ a: evaluated++, get b() { return 1 }, c: evaluated++ }) +let error +try { + make() +} catch (e) { + error = String(e) +} +const unused = () => ({ set x(v) {} }) +return [error, evaluated, typeof unused] diff --git a/packages/codemode-rust/conformance/cases/lang-accessor-literal.json b/packages/codemode-rust/conformance/cases/lang-accessor-literal.json new file mode 100644 index 0000000000000..4e9d4d3bf7671 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-accessor-literal.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + null, + 2, + "function" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-arguments-keys.js b/packages/codemode-rust/conformance/cases/lang-arguments-keys.js new file mode 100644 index 0000000000000..99f70aaca1887 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-arguments-keys.js @@ -0,0 +1,29 @@ +function outer(a, b) { + const viaArrow = () => arguments.length + const nested = () => () => arguments[1] + const same = arguments === arguments + arguments[0] = "changed" + return [viaArrow(), nested()(), same, a, arguments[0]] +} +function defaults(x, y = 1) { + arguments[0] = 5 + x = 2 + return [x, arguments[0], arguments.length] +} +function extra() { + arguments[3] = "late" + return [arguments[3], arguments.length] +} +let reads = 0 +const key = { + toString() { + reads++ + return "k" + }, +} +const o = { k: 1 } +o[key] += 1 +o[key]++ +const order = [] +const lit = { [(order.push("key"), { toString: () => (order.push("convert"), "p") })]: order.push("value") } +return [outer(1, 2), defaults(), extra(), reads, o.k, order, Object.keys(lit), "\u{1F600}" < "\uFFFF", "a" < "b"] diff --git a/packages/codemode-rust/conformance/cases/lang-arguments-keys.json b/packages/codemode-rust/conformance/cases/lang-arguments-keys.json new file mode 100644 index 0000000000000..9a32e475b718a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-arguments-keys.json @@ -0,0 +1,36 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 2, + 2, + true, + 1, + "changed" + ], + [ + 2, + 5, + 0 + ], + [ + "late", + 0 + ], + 2, + 3, + [ + "key", + "convert", + "value" + ], + [ + "p" + ], + true, + true + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-arguments-object.js b/packages/codemode-rust/conformance/cases/lang-arguments-object.js new file mode 100644 index 0000000000000..74b391a881891 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-arguments-object.js @@ -0,0 +1,39 @@ +// The arguments object: indexed own properties that delete leaves as holes, a hidden writable length, and a +// binding that can be reassigned. +function f() { + const deleted = delete arguments[1] + arguments.extra = "x" + return { + deleted, + afterDelete: [typeof arguments[1], 1 in arguments, arguments.length], + keys: Object.keys(arguments), + spread: [...arguments], + json: JSON.stringify(arguments), + tag: Object.prototype.toString.call(arguments), + } +} +function g() { + arguments.length = "two" + const lengthWritten = [arguments.length, arguments.hasOwnProperty("length"), Object.keys(arguments).length] + arguments.length = 1 + const applied = ((...xs) => xs).apply(null, arguments) + const deleted = delete arguments.length + return { lengthWritten, applied, deleted, after: arguments.length } +} +function h(a) { + arguments = [9] + const fromArrow = (() => { + arguments = "arrow" + return arguments + })() + return [a, arguments, fromArrow] +} +function frozen() { + Object.freeze(arguments) + try { + arguments[0] = 2 + } catch (error) { + return [String(error), arguments[0]] + } +} +return { f: f(1, 2, 3), g: g(1, 2, 3), h: h(1), frozen: frozen(1) } diff --git a/packages/codemode-rust/conformance/cases/lang-arguments-object.json b/packages/codemode-rust/conformance/cases/lang-arguments-object.json new file mode 100644 index 0000000000000..8479592c78e85 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-arguments-object.json @@ -0,0 +1,48 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "f": { + "deleted": true, + "afterDelete": [ + "undefined", + false, + 3 + ], + "keys": [ + "0", + "2", + "extra" + ], + "spread": [ + 1, + 3, + "x" + ], + "json": "{\"0\":1,\"2\":3,\"extra\":\"x\"}", + "tag": "[object Arguments]" + }, + "g": { + "lengthWritten": [ + "two", + true, + 3 + ], + "applied": [ + 1 + ], + "deleted": true + }, + "h": [ + 1, + "arrow", + "arrow" + ], + "frozen": [ + "TypeError: Cannot assign to read only property '0'.", + 1 + ] + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-array-holes-01.js b/packages/codemode-rust/conformance/cases/lang-array-holes-01.js new file mode 100644 index 0000000000000..8e59f8beb5a9c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-array-holes-01.js @@ -0,0 +1,45 @@ +// Holes from literals, Array(n), delete, length and far writes: reads, `in`, keys, logging and JSON. +const a = [1, , 3] +const b = new Array(3) +b[1] = "x" +const c = [1, 2, 3, 4] +delete c[1] +const d = [] +d[3] = 4 +const e = [1, 2] +e.length = 4 +console.log(a, b, c, d, e) +console.log([1, undefined, null, , 2], { a: [, 1] }) +console.log(JSON.stringify([a, b]), String([, 1]), `${[1, ,]}`) +const seen = [] +const replaced = JSON.stringify([1, , 3], (k, v) => { + seen.push(k + ":" + typeof v) + return v +}) +const forIn = [] +for (const k in a) forIn.push(k) +const shrunk = [1, 2, 3] +shrunk.length = 1 +shrunk.length = 3 +return { + lens: [a.length, b.length, c.length, d.length, e.length, [1, , ].length], + has: [0 in a, 1 in a, a.hasOwnProperty(1), 1 in shrunk], + keys: [Object.keys(a), Object.keys(c), Object.entries(d), Object.values(a), forIn], + spread: [[...a], { ...a }, Object.assign({}, a), [...a.entries()]], + destructure: (() => { + const [x, y = "default", z] = a + return [x, y, z] + })(), + text: [String(a), a.join("-"), d.toString(), [null, undefined, , 1].join()], + replaced, + seen, + from: [Array.from(a), Array.from({ length: 2 }), Array.isArray(new Array(3))], + clone: (() => { + const copy = structuredClone(a) + return [1 in copy, copy.length] + })(), + apply: ((...xs) => [xs.length, 1 in xs]).apply(null, a), + bytes: [...Uint8Array.from(a)], + awaited: await Promise.all([1, , 3]), + result: [a, b, d], +} diff --git a/packages/codemode-rust/conformance/cases/lang-array-holes-01.json b/packages/codemode-rust/conformance/cases/lang-array-holes-01.json new file mode 100644 index 0000000000000..be772e69c8b08 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-array-holes-01.json @@ -0,0 +1,146 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "lens": [ + 3, + 3, + 4, + 4, + 4, + 2 + ], + "has": [ + true, + false, + false, + false + ], + "keys": [ + [ + "0", + "2" + ], + [ + "0", + "2", + "3" + ], + [ + [ + "3", + 4 + ] + ], + [ + 1, + 3 + ], + [ + "0", + "2" + ] + ], + "spread": [ + [ + 1, + null, + 3 + ], + { + "0": 1, + "2": 3 + }, + { + "0": 1, + "2": 3 + }, + [ + [ + 0, + 1 + ], + [ + 1, + null + ], + [ + 2, + 3 + ] + ] + ], + "destructure": [ + 1, + "default", + 3 + ], + "text": [ + "1,,3", + "1--3", + ",,,4", + ",,,1" + ], + "replaced": "[1,null,3]", + "seen": [ + ":object", + "0:number", + "1:undefined", + "2:number" + ], + "from": [ + [ + 1, + null, + 3 + ], + [ + null, + null + ], + true + ], + "clone": [ + false, + 3 + ], + "apply": [ + 3, + true + ], + "bytes": [ + 1, + 0, + 3 + ], + "awaited": [ + 1, + null, + 3 + ], + "result": [ + [ + 1, + null, + 3 + ], + [ + null, + "x", + null + ], + [ + null, + null, + null, + 4 + ] + ] + }, + "logs": [ + "[1,,3] [,\"x\",] [1,,3,4] [,,,4] [1,2,,]", + "[1,null,null,,2] {\"a\":[,1]}", + "[[1,null,3],[null,\"x\",null]] ,1 1," + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-array-holes-02.js b/packages/codemode-rust/conformance/cases/lang-array-holes-02.js new file mode 100644 index 0000000000000..022bf355f4aa9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-array-holes-02.js @@ -0,0 +1,47 @@ +// The callback methods skip holes, except the find methods, which visit them as undefined. +const a = [1, , 3] +const visits = [] +a.forEach((v, i) => visits.push(i)) +const found = [] +a.find((v) => { + found.push(v === undefined ? "hole" : v) + return false +}) +const reduceEmpty = (() => { + try { + return [, , ].reduce((x, y) => x + y) + } catch (error) { + return String(error) + } +})() +const reduceRightEmpty = (() => { + try { + return [, ].reduceRight((x, y) => x + y) + } catch (error) { + return String(error) + } +})() +const big = [] +big[100] = 1 +// Elements deleted while a method runs are skipped when it reaches them. +const shrinking = [1, 2, 3, 4] +const seenShrinking = [] +shrinking.forEach((v) => { + seenShrinking.push(v) + shrinking.length = 2 +}) +return { + visits, + map: [a.map((v) => v * 2), 1 in a.map((v) => v), Array(2).map(() => 1)], + filter: a.filter(() => true), + someEvery: [[, ].every(() => false), [, ].some(() => true)], + reduce: [[1, , 3].reduce((x, y) => x + y), [1, , 3].reduceRight((x, y) => x + "" + y)], + reduceEmpty, + reduceRightEmpty, + found, + findIndex: [[, 5].findIndex((v) => v === undefined), [, 5].findLast((v) => v === undefined)], + flatMap: [1, , 3].flatMap((v) => [v, , v]), + search: [a.indexOf(undefined), a.includes(undefined), a.lastIndexOf(undefined), [].includes(), [].indexOf()], + big: [big.length, 50 in big, big.indexOf(undefined), big.filter(() => true).length], + seenShrinking, +} diff --git a/packages/codemode-rust/conformance/cases/lang-array-holes-02.json b/packages/codemode-rust/conformance/cases/lang-array-holes-02.json new file mode 100644 index 0000000000000..0633a1b46551a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-array-holes-02.json @@ -0,0 +1,70 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "visits": [ + 0, + 2 + ], + "map": [ + [ + 2, + null, + 6 + ], + false, + [ + null, + null + ] + ], + "filter": [ + 1, + 3 + ], + "someEvery": [ + true, + false + ], + "reduce": [ + 4, + "31" + ], + "reduceEmpty": "TypeError: Array.reduce of an empty array with no initial value.", + "reduceRightEmpty": "TypeError: Array.reduceRight of an empty array with no initial value.", + "found": [ + 1, + "hole", + 3 + ], + "findIndex": [ + 0, + null + ], + "flatMap": [ + 1, + 1, + 3, + 3 + ], + "search": [ + -1, + true, + -1, + false, + -1 + ], + "big": [ + 101, + false, + -1, + 1 + ], + "seenShrinking": [ + 1, + 2 + ] + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-array-holes-03.js b/packages/codemode-rust/conformance/cases/lang-array-holes-03.js new file mode 100644 index 0000000000000..ea0a9ac680725 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-array-holes-03.js @@ -0,0 +1,60 @@ +// Mutating and copying methods keep, fill or drop holes like their reference, and holes read through the prototype. +const has = (array, ...indexes) => indexes.map((i) => i in array) +const sorted = [3, , undefined, 1] +sorted.sort() +const compared = [, 2, undefined, 1] +compared.sort((x, y) => x - y) +const shifted = [1, , 3] +shifted.shift() +const unshifted = [1, , 3] +unshifted.unshift(0) +const spliced = [1, , 3, 4] +const removed = spliced.splice(0, 2) +const frozen = (() => { + try { + const n = Object.preventExtensions([1, , 3]) + n[1] = 2 + return n + } catch (error) { + return String(error) + } +})() +const out = { + sorted: [sorted.length, ...has(sorted, 1, 2, 3), sorted[0], sorted[1]], + compared: [compared, ...has(compared, 2, 3)], + toSorted: [3, , 1].toSorted(), + slice: has(a(), 1).concat(has([].concat(a()), 1), has(a().slice(), 1)), + reverse: has([1, , 3, 4].reverse(), 2), + copies: [has([1, , 3].toReversed(), 1), has([1, , 3].toSpliced(0, 0), 1), has([1, , 3].with(0, 9), 1)], + flat: [[1, , 3], , [4]].flat(), + splice: [has(removed, 1), spliced], + copyWithin: has([1, , 3, 4].copyWithin(2, 0), 3), + fill: has(new Array(2).fill(0), 1), + pop: [[, ].pop() === undefined, [1, , ].length], + shift: [has(shifted, 0), shifted.length], + unshift: has(unshifted, 2), + at: a().at(1) === undefined, + frozen, +} +function a() { + return [1, , 3] +} +Array.prototype[1] = "inherited" +const holey = a() +const visited = [] +holey.forEach((v) => visited.push(v)) +out.inherited = { + read: [holey[1], 1 in holey, holey.hasOwnProperty(1), [...holey][1] === undefined, holey.join()], + search: [holey.indexOf("inherited"), holey.includes("inherited")], + visited, + map: holey.map((v) => v), + find: holey.find((v) => v === "inherited"), + filter: holey.filter(() => true), + locale: holey.toLocaleString(), + flat: [[1, , 3]].flat(), + flatMap: [0].flatMap(() => [1, , 3]), + json: JSON.stringify(holey), + pastEnd: [[0][1], [0, , ][1]], +} +delete Array.prototype[1] +return out diff --git a/packages/codemode-rust/conformance/cases/lang-array-holes-03.json b/packages/codemode-rust/conformance/cases/lang-array-holes-03.json new file mode 100644 index 0000000000000..c3dada644e563 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-array-holes-03.json @@ -0,0 +1,129 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "sorted": [ + 4, + true, + true, + false, + 1, + 3 + ], + "compared": [ + [ + 1, + 2, + null, + null + ], + true, + false + ], + "toSorted": [ + 1, + 3, + null + ], + "slice": [ + false, + false, + false + ], + "reverse": [ + false + ], + "copies": [ + [ + true + ], + [ + true + ], + [ + true + ] + ], + "flat": [ + 1, + 3, + 4 + ], + "splice": [ + [ + false + ], + [ + 3, + 4 + ] + ], + "copyWithin": [ + false + ], + "fill": [ + true + ], + "pop": [ + true, + 2 + ], + "shift": [ + [ + false + ], + 2 + ], + "unshift": [ + false + ], + "at": true, + "frozen": "TypeError: Cannot add property 1, object is not extensible.", + "inherited": { + "read": [ + "inherited", + true, + false, + true, + "1,,3" + ], + "search": [ + -1, + false + ], + "visited": [ + 1, + "inherited", + 3 + ], + "map": [ + 1, + "inherited", + 3 + ], + "find": "inherited", + "filter": [ + 1, + "inherited", + 3 + ], + "locale": "1,inherited,3", + "flat": [ + 1, + 3 + ], + "flatMap": [ + 1, + "inherited", + 3 + ], + "json": "[1,null,3]", + "pastEnd": [ + "inherited", + "inherited" + ] + } + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-assign-builtin-global.js b/packages/codemode-rust/conformance/cases/lang-assign-builtin-global.js new file mode 100644 index 0000000000000..4b72c90dda68c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-assign-builtin-global.js @@ -0,0 +1,36 @@ +// Assigning a built-in global, `undefined` included, fails as assigning a constant does; an unknown name is unknown. +const attempt = (f) => { + try { + return f() + } catch (error) { + return String(error) + } +} +return [ + attempt(() => { + undefined = 12 + }), + attempt(() => { + undefined ??= 1 + }), + attempt(() => { + ;[undefined] = [1] + }), + attempt(() => { + for (undefined of [1]); + }), + attempt(() => { + NaN = 1 + }), + attempt(() => { + Math = 1 + }), + attempt(() => { + unknownName = 1 + }), + (() => { + let undefined = 3 + undefined = 4 + return undefined + })(), +] diff --git a/packages/codemode-rust/conformance/cases/lang-assign-builtin-global.json b/packages/codemode-rust/conformance/cases/lang-assign-builtin-global.json new file mode 100644 index 0000000000000..6bc42e5e046e6 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-assign-builtin-global.json @@ -0,0 +1,16 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "TypeError: Cannot assign to constant 'undefined'.", + "TypeError: Cannot assign to constant 'undefined'.", + "TypeError: Cannot assign to constant 'undefined'.", + "TypeError: Cannot assign to constant 'undefined'.", + "TypeError: Cannot assign to constant 'NaN'.", + "TypeError: Cannot assign to constant 'Math'.", + "ReferenceError: Unknown identifier 'unknownName'.", + 4 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-async-generators.js b/packages/codemode-rust/conformance/cases/lang-async-generators.js new file mode 100644 index 0000000000000..ec76a6a9c1d11 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-async-generators.js @@ -0,0 +1,128 @@ +const log = [] + +async function* numbers(n) { + try { + for (let i = 0; i < n; i++) { + const sent = yield await Promise.resolve(i) + if (sent !== undefined) log.push("sent " + sent) + } + return "end" + } finally { + log.push("cleanup " + n) + } +} + +// for await over an async generator +const seen = [] +for await (const x of numbers(3)) seen.push(x) + +// direct next/return/throw calls answer with promises, queued in order +const g = numbers(5) +const queued = await Promise.all([g.next(), g.next("a"), g.return("stop"), g.next()]) + +// throw into a suspended async generator, caught inside +async function* guarded() { + while (true) { + try { + yield "ready" + } catch (e) { + yield "caught " + e + } + } +} +const gd = guarded() +await gd.next() +const thrown = [await gd.throw("x"), await gd.next()] + +// yield* over an async generator and over a sync iterable +async function* outer() { + const r = yield* numbers(2) + yield "inner returned " + r + yield* [Promise.resolve("p"), "q"] +} +const delegated = [] +for await (const v of outer()) delegated.push(v) + +// break closes the generator and awaits its return +for await (const v of numbers(10)) { + if (v === 1) break +} + +// for await over a sync array of promises and plain values +const mixed = [] +for await (const v of [Promise.resolve(1), 2, new Promise((r) => r(3))]) mixed.push(v) + +// a rejection in the iterated array exits through try/catch +let rejected +try { + for await (const v of [Promise.resolve(1), Promise.reject("bad")]) log.push("got " + v) +} catch (e) { + rejected = e +} + +// a custom async iterator +const custom = { + [Symbol.asyncIterator]() { + let i = 0 + return { + next() { + i++ + return Promise.resolve({ value: i * 10, done: i > 3 }) + }, + return() { + log.push("custom return") + return Promise.resolve({ done: true }) + }, + } + }, +} +const fromCustom = [] +for await (const v of custom) { + fromCustom.push(v) + if (v === 20) break +} + +// an error thrown in the body ends the generator and rejects its request +async function* failing() { + yield 1 + throw new TypeError("nope") +} +const fg = failing() +const failed = [await fg.next()] +try { + await fg.next() +} catch (e) { + failed.push(e.name) +} +failed.push(await fg.next()) + +// async generators are not sync iterable, and their prototype chain holds +let notIterable +try { + for (const v of numbers(1)) log.push(v) +} catch (e) { + notIterable = e.name +} +const ag = numbers(1) +const shape = [ + typeof ag.next, + ag[Symbol.asyncIterator]() === ag, + ag instanceof numbers, + Object.getPrototypeOf(numbers.prototype) === Object.getPrototypeOf(guarded.prototype), +] + +// ordering: an async generator's steps interleave with other jobs +const order = [] +async function* ticks() { + order.push("start") + yield 1 + order.push("resumed") +} +const t = ticks() +const p1 = t.next().then((r) => order.push("first " + r.value)) +Promise.resolve().then(() => order.push("job")) +const p2 = t.next().then((r) => order.push("second " + r.done)) +await p1 +await p2 + +return { seen, queued, thrown, delegated, mixed, rejected, fromCustom, failed, notIterable, shape, order, log } diff --git a/packages/codemode-rust/conformance/cases/lang-async-generators.json b/packages/codemode-rust/conformance/cases/lang-async-generators.json new file mode 100644 index 0000000000000..34ad81f73f917 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-async-generators.json @@ -0,0 +1,90 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "seen": [ + 0, + 1, + 2 + ], + "queued": [ + { + "value": 0, + "done": false + }, + { + "value": 1, + "done": false + }, + { + "value": "stop", + "done": true + }, + { + "done": true + } + ], + "thrown": [ + { + "value": "caught x", + "done": false + }, + { + "value": "ready", + "done": false + } + ], + "delegated": [ + 0, + 1, + "inner returned end", + "p", + "q" + ], + "mixed": [ + 1, + 2, + 3 + ], + "rejected": "bad", + "fromCustom": [ + 10, + 20 + ], + "failed": [ + { + "value": 1, + "done": false + }, + "TypeError", + { + "done": true + } + ], + "notIterable": "TypeError", + "shape": [ + "function", + true, + true, + true + ], + "order": [ + "start", + "resumed", + "job", + "first 1", + "second true" + ], + "log": [ + "cleanup 3", + "sent a", + "cleanup 5", + "cleanup 2", + "cleanup 10", + "got 1", + "custom return" + ] + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-await-name-with-await.js b/packages/codemode-rust/conformance/cases/lang-await-name-with-await.js new file mode 100644 index 0000000000000..35cc28af095e0 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-await-name-with-await.js @@ -0,0 +1,25 @@ +// A program may name things `await` and still await at the top level: names inside functions, bindings and escaped +// labels are names; an expression starting with a plain `await` outside every function awaits. +var await = 1 +let escaped = 0 +aw\u0061it: for (;;) { + escaped++ + break aw\u0061it +} +const awaited = await Promise.resolve(5) +function read() { + return await +} +const arrow = () => await +function write() { + await = 7 +} +function await2() { + return typeof await +} +async function inner() { + return await 3 +} +const before = [read(), arrow(), await2()] +write() +return [awaited, escaped, before, read(), await inner()] diff --git a/packages/codemode-rust/conformance/cases/lang-await-name-with-await.json b/packages/codemode-rust/conformance/cases/lang-await-name-with-await.json new file mode 100644 index 0000000000000..5a684e76c6ac9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-await-name-with-await.json @@ -0,0 +1,17 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 5, + 1, + [ + 1, + 1, + "number" + ], + 7, + 3 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-await-name.js b/packages/codemode-rust/conformance/cases/lang-await-name.js new file mode 100644 index 0000000000000..da82e2ee3cd9b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-await-name.js @@ -0,0 +1,14 @@ +// At the top level `await` is a plain name, except where an expression starts with it; escaped, it is a label. +var await +let total = 0 +aw\u0061it: for (const n of [1, 2, 3]) { + if (n === 3) break aw\u0061it + total += n +} +function inner() { + var await = 2 + return await +} +const read = () => await +const o = { await: 4 } +return [read(), total, inner(), o.await] diff --git a/packages/codemode-rust/conformance/cases/lang-await-name.json b/packages/codemode-rust/conformance/cases/lang-await-name.json new file mode 100644 index 0000000000000..6d86385807340 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-await-name.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + null, + 3, + 2, + 4 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-call-errors.js b/packages/codemode-rust/conformance/cases/lang-call-errors.js new file mode 100644 index 0000000000000..d124ca78b9db0 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-call-errors.js @@ -0,0 +1,48 @@ +// Calling or constructing what cannot be: the callee is named like native engines name it, or "The called value". +const attempt = async (f) => { + try { + return await f() + } catch (error) { + return String(error) + } +} +const o = { a: 1, nested: { x: 5 } } +const list = [1] +let nothing +return { + identifier: await attempt(() => nothing()), + member: await attempt(() => o.missing()), + nested: await attempt(() => o.nested.x()), + literalKey: await attempt(() => o["a"]()), + variableKey: await attempt(() => { + const k = "a" + return o[k]() + }), + index: await attempt(() => list[0]()), + callResult: await attempt(() => (() => 1)()()), + chained: await attempt(() => o.nested.deep?.x.y()), + optional: await attempt(() => o.a?.()), + spread: await attempt(() => o.a(...[1])), + tagged: await attempt(() => o.a`x`), + onThis: await attempt(() => function () { return this.x() }.call({ x: 2 })), + builtin: await attempt(() => Math.nope()), + newValue: await attempt(() => new o.a()), + newArrow: await attempt(() => new (() => 1)()), + newBuiltin: await attempt(() => new Math.max()), + receivers: [ + await attempt(() => Function.prototype.call.call(5)), + await attempt(() => Function.prototype.apply.call({})), + await attempt(() => Function.prototype.bind.call("x")), + ], + callbacks: [ + await attempt(() => [1].map(5)), + await attempt(() => [1].reduceRight()), + await attempt(() => [2, 1].sort(5)), + await attempt(() => Array.from([1], 5)), + await attempt(() => new Map([[1, 2]]).forEach(5)), + await attempt(() => new Set([1]).forEach(5)), + await attempt(() => new Promise(5)), + await attempt(() => Promise.try(5)), + await attempt(() => new Uint8Array(2).sort(5)), + ], +} diff --git a/packages/codemode-rust/conformance/cases/lang-call-errors.json b/packages/codemode-rust/conformance/cases/lang-call-errors.json new file mode 100644 index 0000000000000..ad7349fcb059c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-call-errors.json @@ -0,0 +1,39 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "identifier": "TypeError: nothing is not a function.", + "member": "TypeError: o.missing is not a function.", + "nested": "TypeError: o.nested.x is not a function.", + "literalKey": "TypeError: o.a is not a function.", + "variableKey": "TypeError: The called value is not a function.", + "index": "TypeError: The called value is not a function.", + "callResult": "TypeError: The called value is not a function.", + "optional": "TypeError: o.a is not a function.", + "spread": "TypeError: o.a is not a function.", + "tagged": "TypeError: The called value is not a function.", + "onThis": "TypeError: The called value is not a function.", + "builtin": "TypeError: Math.nope is not a function.", + "newValue": "TypeError: o.a is not a constructor.", + "newArrow": "TypeError: The called value is not a constructor: only classes can be constructed with new. Use a class, or call it as a function that returns an object.", + "newBuiltin": "TypeError: new Math.max(...) is not supported; call Math.max(...) without new instead.", + "receivers": [ + "TypeError: Function.prototype.call called on incompatible receiver a number.", + "TypeError: Function.prototype.apply called on incompatible receiver a data object.", + "TypeError: Function.prototype.bind called on incompatible receiver a string." + ], + "callbacks": [ + "TypeError: Array.map expects a function callback.", + "TypeError: Array.reduceRight expects a function callback.", + "TypeError: Array.sort expects a function callback.", + "TypeError: Array.from expects a function callback.", + "TypeError: Map.forEach expects a function callback.", + "TypeError: Set.forEach expects a function callback.", + "TypeError: new Promise(...) expects an executor function (e.g. new Promise((resolve, reject) => { ... })).", + "TypeError: Promise.try expects a function, received a number.", + "TypeError: Uint8Array.sort expects a function callback." + ] + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-circular-values.js b/packages/codemode-rust/conformance/cases/lang-circular-values.js new file mode 100644 index 0000000000000..57496c6dd748d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-circular-values.js @@ -0,0 +1,36 @@ +const out = [] +const attempt = (f) => { + try { + f() + out.push("ok") + } catch (e) { + out.push([e.name, e.message]) + } +} +const a = [1, 2] +attempt(() => (a[1] = a)) +const o = {} +attempt(() => (o.self = o)) +attempt(() => (o.deep = { list: [{ back: o }] })) +attempt(() => (o["computed"] = [o])) +attempt(() => a.push(a)) +attempt(() => a.unshift([a])) +attempt(() => a.splice(0, 0, a)) +attempt(() => a.fill(a, 5)) +attempt(() => Object.assign(o, { again: o })) +const fn = () => 1 +attempt(() => (fn.self = fn)) +const m = new Map() +attempt(() => (o.map = m)) +attempt(() => (m.back = o)) +attempt(() => m.set("x", m)) +attempt(() => { + ;[o.x] = [o] +}) +// shared, non-circular references are fine +const shared = { v: 1 } +attempt(() => (o.p = { a: shared, b: shared })) +attempt(() => { + o.n = o.p +}) +return { out, keys: Object.keys(o), len: a.length } diff --git a/packages/codemode-rust/conformance/cases/lang-circular-values.json b/packages/codemode-rust/conformance/cases/lang-circular-values.json new file mode 100644 index 0000000000000..70d249a23d13d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-circular-values.json @@ -0,0 +1,68 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "out": [ + [ + "TypeError", + "Array assignment result contains a circular value." + ], + [ + "TypeError", + "Object assignment result contains a circular value." + ], + [ + "TypeError", + "Object assignment result contains a circular value." + ], + [ + "TypeError", + "Object assignment result contains a circular value." + ], + [ + "TypeError", + "Array.push result contains a circular value." + ], + [ + "TypeError", + "Array.unshift result contains a circular value." + ], + [ + "TypeError", + "Array.splice result contains a circular value." + ], + [ + "TypeError", + "Array.fill result contains a circular value." + ], + [ + "TypeError", + "Object.assign result contains a circular value." + ], + [ + "TypeError", + "Object assignment result contains a circular value." + ], + "ok", + [ + "TypeError", + "Object assignment result contains a circular value." + ], + "ok", + [ + "TypeError", + "Object assignment result contains a circular value." + ], + "ok", + "ok" + ], + "keys": [ + "map", + "p", + "n" + ], + "len": 2 + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-classes-errors.js b/packages/codemode-rust/conformance/cases/lang-classes-errors.js new file mode 100644 index 0000000000000..f063fbc7c30b7 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-classes-errors.js @@ -0,0 +1,109 @@ +// What classes refuse (the reference's test/classes.test.ts): calls without new, this before super(), return rules, +// refused heritages, and the class syntax that is not supported. +const out = [] +const run = async (f) => { + try { + out.push(await f()) + } catch (e) { + out.push(["threw", e?.name, e?.message]) + } +} +await run(async () => { + class A { f = Object.freeze(this); g = 1 }; new A() +}) +await run(async () => { + class A {}; class B extends A { constructor() { this.x = 1; super() } }; new B() +}) +await run(async () => { + class A {}; class B extends A { constructor() { const f = () => this; f(); super() } }; new B() +}) +await run(async () => { + class A {}; class B extends A { constructor() {} }; new B() +}) +await run(async () => { + class A {}; class B extends A { constructor() { super(); super() } }; new B() +}) +await run(async () => { + class A {}; class B extends A { constructor() { super(); return 1 } }; new B() +}) +await run(async () => { + class A extends null {} +}) +await run(async () => { + class A extends 1 {} +}) +await run(async () => { + function f() {}; class A extends f {} +}) +await run(async () => { + class A { #x = 1 } +}) +await run(async () => { + class A { #m() {} } +}) +await run(async () => { + class A { static { } } +}) +await run(async () => { + function f() { return new.target } + return f() +}) +await run(async () => { + function f() {} + return new f() +}) +await run(async () => { + class A {} + return A() +}) +await run(async () => { + class A extends Map {} +}) +await run(async () => { + class A {} + class B extends A { constructor() { this.x = 1; super() } } + return new B() +}) +await run(async () => { + class A {} + class B extends A { constructor() { super(); super() } } + return new B() +}) +await run(async () => { + class A {} + class B extends A { constructor() { const f = () => super(); f() } } + return new B() +}) +await run(async () => { + class A {} + class B extends A { m() { [super.x] = [1] } } + return new B().m() +}) +await run(async () => { + class A { static ["prototype"]() {} } +}) +await run(async () => { + class A extends Map {} +}) +await run(async () => { + class A extends Set {} +}) +await run(async () => { + class A extends Promise {} +}) +await run(async () => { + class A extends Date {} +}) +await run(async () => { + class A extends RegExp {} +}) +await run(async () => { + class A extends URL {} +}) +await run(async () => { + class A extends Array {} +}) +await run(async () => { + class A extends Object {} +}) +return out diff --git a/packages/codemode-rust/conformance/cases/lang-classes-errors.json b/packages/codemode-rust/conformance/cases/lang-classes-errors.json new file mode 100644 index 0000000000000..28cfee1fea2b9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-classes-errors.json @@ -0,0 +1,153 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "threw", + "TypeError", + "Cannot define property f." + ], + [ + "threw", + "ReferenceError", + "Must call super constructor in derived class before accessing 'this' or returning from derived constructor" + ], + [ + "threw", + "ReferenceError", + "Must call super constructor in derived class before accessing 'this' or returning from derived constructor" + ], + [ + "threw", + "ReferenceError", + "Must call super constructor in derived class before accessing 'this' or returning from derived constructor" + ], + [ + "threw", + "ReferenceError", + "Super constructor may only be called once" + ], + [ + "threw", + "TypeError", + "Derived constructors may only return object or undefined" + ], + [ + "threw", + "TypeError", + "Classes extending null are not supported." + ], + [ + "threw", + "TypeError", + "Class extends value a number is not a constructor or null." + ], + [ + "threw", + "TypeError", + "Class extends value a function is not a constructor or null." + ], + [ + "threw", + "SyntaxError", + "Private class members (#name) are not supported. Use a regular property instead." + ], + [ + "threw", + "SyntaxError", + "Private class members (#name) are not supported. Use a regular property instead." + ], + [ + "threw", + "SyntaxError", + "Class static blocks are not supported. Assign static fields instead." + ], + [ + "threw", + "SyntaxError", + "new.target is not supported." + ], + [ + "threw", + "TypeError", + "f is not a constructor: only classes can be constructed with new. Use a class, or call it as a function that returns an object." + ], + [ + "threw", + "TypeError", + "Class constructor A cannot be invoked without 'new'" + ], + [ + "threw", + "TypeError", + "Extending the built-in Map is not supported. Only classes and Error types can be extended." + ], + [ + "threw", + "ReferenceError", + "Must call super constructor in derived class before accessing 'this' or returning from derived constructor" + ], + [ + "threw", + "ReferenceError", + "Super constructor may only be called once" + ], + [ + "threw", + "SyntaxError", + "super() inside an arrow function is not supported. Call super() directly in the constructor." + ], + [ + "threw", + "SyntaxError", + "Destructuring into super.x is not supported." + ], + [ + "threw", + "TypeError", + "Classes may not have a static property named 'prototype'." + ], + [ + "threw", + "TypeError", + "Extending the built-in Map is not supported. Only classes and Error types can be extended." + ], + [ + "threw", + "TypeError", + "Extending the built-in Set is not supported. Only classes and Error types can be extended." + ], + [ + "threw", + "TypeError", + "Extending the built-in Promise is not supported. Only classes and Error types can be extended." + ], + [ + "threw", + "TypeError", + "Extending the built-in Date is not supported. Only classes and Error types can be extended." + ], + [ + "threw", + "TypeError", + "Extending the built-in RegExp is not supported. Only classes and Error types can be extended." + ], + [ + "threw", + "TypeError", + "Extending the built-in URL is not supported. Only classes and Error types can be extended." + ], + [ + "threw", + "TypeError", + "Extending the built-in Array is not supported. Only classes and Error types can be extended." + ], + [ + "threw", + "TypeError", + "Extending the built-in Object is not supported. Only classes and Error types can be extended." + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-classes.js b/packages/codemode-rust/conformance/cases/lang-classes.js new file mode 100644 index 0000000000000..947b24b0fd9fb --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-classes.js @@ -0,0 +1,277 @@ +// Classes (the reference's test/classes.test.ts): declarations and expressions, constructors, methods, accessors, +// fields, inheritance from classes and Error types, super, and how class values show and copy. +const out = [] +const run = async (f) => { + try { + out.push(await f()) + } catch (e) { + out.push(["threw", e?.name, e?.message]) + } +} +await run(async () => { + class A { get1() { return 1 } } + const B = class { two() { return 2 } } + const C = class Named { self() { return Named } } + return [new A().get1(), new B().two(), B.name, C.name, new C().self() === C, typeof A] +}) +await run(async () => { + class Point { constructor(x, y) { this.x = x; this.y = y } } + const p = new Point(1, 2) + return [p.x, p.y, p, Point.length, Point.name] +}) +await run(async () => { + class A { constructor() { return { other: true } } } class B { constructor() { this.a = 1; return 5 } } return [new A(), new B()] +}) +await run(async () => { + class Counter { + constructor(n) { this.n = n } + inc() { this.n++; return this } + get_() { return this.n } + static make(n) { return new Counter(n) } + static "quoted"() { return this.name } + } + return [Counter.make(1).inc().inc().get_(), Counter.quoted(), Counter.prototype.inc.name, Counter.make.name] +}) +await run(async () => { + class A { constructor() { this.a = 1 } m() {} static s() {} } + const a = new A() + const keys = [] + for (const k in a) keys.push(k) + return [Object.keys(a), JSON.stringify(a), keys, Object.keys(A), Object.keys(A.prototype), + Object.getOwnPropertyDescriptor(A, "prototype").writable, A.prototype.constructor === A] +}) +await run(async () => { + class A {} + const out = [] + try { A() } catch (e) { out.push(e instanceof TypeError, e.message) } + try { [1].map(A) } catch (e) { out.push(e instanceof TypeError) } + try { A.call({}) } catch (e) { out.push(e instanceof TypeError) } + return out +}) +await run(async () => { + class A {} class B {} const a = new A(); return [a instanceof A, a instanceof B, a instanceof Object, Object.getPrototypeOf(a) === A.prototype] +}) +await run(async () => { + const out = [] + try { new A() } catch (e) { out.push(e instanceof ReferenceError) } + { try { B } catch (e) { out.push(e instanceof ReferenceError) } class B {} out.push(typeof B) } + class A {} + return out +}) +await run(async () => { + class A { m() { try { A = 1 } catch (e) { return e instanceof TypeError } } } + const m = new A().m() + A = 2 + return [m, A] +}) +await run(async () => { + class A { constructor(x) { this.x = x } a() { return "a" + this.x } who() { return "A" } } + class B extends A { constructor(x, y) { super(x); this.y = y } b() { return "b" + this.y } who() { return "B" } } + class C extends B { constructor() { super(1, 2) } who() { return "C" } } + const c = new C() + return [ + c.a(), c.b(), c.who(), c, + Object.getPrototypeOf(B.prototype) === A.prototype, Object.getPrototypeOf(C) === B, Object.getPrototypeOf(B) === A, + c.constructor === C, C.name, + ] +}) +await run(async () => { + class A {} + class B extends A {} + class C extends B {} + const b = new B() + return [new C() instanceof A, new C() instanceof B, b instanceof C, b instanceof A, new A() instanceof B] +}) +await run(async () => { + const make = (tag) => class { tag() { return tag } } + class X extends make("t") {} + const Y = class extends (0, X) { get t() { return this.tag() } } + return [new X().tag(), new Y().t] +}) +await run(async () => { + class A { constructor(...args) { this.args = args } } + class B extends A { constructor(a, ...rest) { super(a * 10, ...rest) } } + class C extends A {} + return [new B(1, 2, 3).args, new C(4, 5).args, C.length] +}) +await run(async () => { + class A { + m(n) { return "A.m" + n + this.tag } + get g() { return "A.g" + this.tag } + set s(v) { this.stored = "A:" + v } + static sm() { return "A.sm" + this.name } + static get sg() { return "A.sg" } + } + A.prototype.data = "proto-data" + class B extends A { + constructor() { super(); this.tag = "!" } + m(n) { return "B>" + super.m(n) } + get g() { return "B>" + super.g } + set s(v) { super.s = v + "+" } + d() { return super.data + super["m"](2) } + static sm() { return "B>" + super.sm() } + static get sg() { return "B>" + super.sg } + } + const b = new B() + b.s = "v" + return [b.m(1), b.g, b.stored, b.d(), B.sm(), B.sg] +}) +await run(async () => { + class A {} + class B extends A { set(v) { super.x = v; return [this.x, Object.keys(this)] } } + return new B().set(3) +}) +await run(async () => { + class A { get x() { return this._x ?? 1 } set x(v) { this._x = v } } + class B extends A { + m() { + const r = [super.x++, super.x, ++super.x] + super.x += 10 + super["x"] *= 2 + super.x ||= 5 + super.y ??= 7 + const k = "x" + r.push(this.x, this.y, super[k]--, this.x) + try { delete super.x } catch (e) { r.push(e.name) } + return r + } + } + return new B().m() +}) +await run(async () => { + const C = class { static n = this.name }; return C.n +}) +await run(async () => { + const o = { + n: 1, + has(k) { return super.hasOwnProperty.call(this, k) }, + get g() { return super.toString === Object.prototype.toString }, + ["k"]() { return (() => super.hasOwnProperty("n"))() }, + } + return [o.has("n"), o.has("x"), o.g, o.k()] +}) +await run(async () => { + class A { m() { return "A" + this.n } } + class B extends A { + constructor() { const early = () => this.n; super(); this.n = 1; this.early = early() } + m() { return [1, 2].map((i) => super.m() + i) } + f = () => super.m() + } + const b = new B() + return [b.m(), b.f(), b.early] +}) +await run(async () => { + const log = [] + class A { a = log.push("A.field"); constructor() { log.push("A.ctor") } } + class B extends A { + b = log.push("B.field:" + this.a) + constructor() { log.push("B.before"); super(); log.push("B.after:" + this.b) } + } + class C extends B { c = log.push("C.field") } + new C() + return log +}) +await run(async () => { + class A {} + class Obj extends A { constructor() { super(); return { other: true } } } + class NoSuper extends A { constructor() { return { early: true } } } + class Undef extends A { constructor() { super(); return undefined } } + class Parent { constructor() { return { replaced: 1 } } } + class Child extends Parent { constructor() { super(); this.mine = 2 } } + return [new Obj(), new NoSuper(), new Undef() instanceof A, new Child()] +}) +await run(async () => { + class A { static count = 1; static make() { return new this() } static get label() { return "L" + this.name } } + class B extends A {} + return [B.count, B.make() instanceof B, B.label, Object.keys(B), B.hasOwnProperty("count")] +}) +await run(async () => { + class A extends AggregateError {} + const a = new A([1, 2], "agg") + return [a.errors, a.message, a.name, a instanceof A, a instanceof AggregateError] +}) +await run(async () => { + class A extends TypeError { name = "NotFound" } + class B extends A { constructor(m, cause) { super(m, { cause }); this.code = 404 } } + class G extends RangeError { get name() { return "Got" } } + const b = new B("x", "why") + return [b instanceof A, b instanceof TypeError, b.name, b.toString(), b.code, b.cause, b.hasOwnProperty("cause"), + new A("y").hasOwnProperty("cause"), String(new G("z")), new B().message] +}) +await run(async () => { + class E extends Error {}; try { throw new E("m") } catch (e) { return [e instanceof E, e.message] } +}) +await run(async () => { + class E extends Error { name = "E" }; return new E("x") +}) +await run(async () => { + return new Error("x") +}) +await run(async () => { + class E extends Error {}; return [JSON.stringify(new E("x")), JSON.stringify(new Error("x"))] +}) +await run(async () => { + class A { x = 1; get g() { return 2 } m() {} } + const c = structuredClone(new A()) + return [JSON.stringify(new A()), c, Object.getPrototypeOf(c) === Object.prototype, c instanceof A, typeof c.m] +}) +await run(async () => { + class E extends Error {} + const e = new E("m") + return [e instanceof E, e instanceof Error, e instanceof Error, e.message, e.name, String(e), Object.prototype.toString.call(e), Error.isError(e), e.constructor === E] +}) +await run(async () => { + class E extends TypeError {} + const e = new E("m") + return [e instanceof E, e instanceof TypeError, e instanceof Error, e.message, e.name, String(e), Object.prototype.toString.call(e), Error.isError(e), e.constructor === E] +}) +await run(async () => { + class E extends RangeError {} + const e = new E("m") + return [e instanceof E, e instanceof RangeError, e instanceof Error, e.message, e.name, String(e), Object.prototype.toString.call(e), Error.isError(e), e.constructor === E] +}) +await run(async () => { + class E extends SyntaxError {} + const e = new E("m") + return [e instanceof E, e instanceof SyntaxError, e instanceof Error, e.message, e.name, String(e), Object.prototype.toString.call(e), Error.isError(e), e.constructor === E] +}) +await run(async () => { + class E extends ReferenceError {} + const e = new E("m") + return [e instanceof E, e instanceof ReferenceError, e instanceof Error, e.message, e.name, String(e), Object.prototype.toString.call(e), Error.isError(e), e.constructor === E] +}) +await run(async () => { + class E extends EvalError {} + const e = new E("m") + return [e instanceof E, e instanceof EvalError, e instanceof Error, e.message, e.name, String(e), Object.prototype.toString.call(e), Error.isError(e), e.constructor === E] +}) +await run(async () => { + class E extends URIError {} + const e = new E("m") + return [e instanceof E, e instanceof URIError, e instanceof Error, e.message, e.name, String(e), Object.prototype.toString.call(e), Error.isError(e), e.constructor === E] +}) +await run(async () => { + class Box { + constructor(v) { let s = 0; for (let i = 0; i < 3; i++) s += i; this.v = v + s } + get_() { let s = 0; for (let i = 0; i < 3; i++) s += i; return this.v + s } + static of(v) { return new Box(v) } + } + const a = Box.of(1) + const b = new Box(2) + return [a.get_(), b.get_(), a instanceof Box, Object.getPrototypeOf(a) === Object.getPrototypeOf(b), Object.keys(a)] +}) +await run(async () => { + class Cache { constructor() { this.size = 2 } get g() { return 1 } } + class Empty {} + class Lru extends Cache { hits = 0 } + class E extends Error { name = "E" } + console.log(new Cache()) + console.log(new Empty()) + console.log(new Lru()) + console.log([new Empty(), { c: new Cache() }]) + console.log(Cache, Lru, class {}) + console.log(new E("bad")) + console.log({ a: 1 }) + return 1 +}) +return out diff --git a/packages/codemode-rust/conformance/cases/lang-classes.json b/packages/codemode-rust/conformance/cases/lang-classes.json new file mode 100644 index 0000000000000..67366f9d54324 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-classes.json @@ -0,0 +1,320 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 1, + 2, + "B", + "Named", + true, + "function" + ], + [ + 1, + 2, + { + "x": 1, + "y": 2 + }, + 2, + "Point" + ], + [ + { + "other": true + }, + { + "a": 1 + } + ], + [ + 3, + "Counter", + "inc", + "make" + ], + [ + [ + "a" + ], + "{\"a\":1}", + [ + "a" + ], + [], + [], + false, + true + ], + [ + true, + "Class constructor A cannot be invoked without 'new'", + true, + true + ], + [ + true, + false, + true, + true + ], + [ + true, + true, + "function" + ], + [ + true, + 2 + ], + [ + "a1", + "b2", + "C", + { + "x": 1, + "y": 2 + }, + true, + true, + true, + true, + "C" + ], + [ + true, + true, + false, + true, + false + ], + [ + "t", + "t" + ], + [ + [ + 10, + 2, + 3 + ], + [ + 4, + 5 + ], + 0 + ], + [ + "B>A.m1!", + "B>A.g!", + "A:v+", + "proto-dataA.m2!", + "B>A.smB", + "B>A.sg" + ], + [ + 3, + [ + "x" + ] + ], + [ + 1, + 2, + 3, + 26, + 7, + 26, + 25, + "ReferenceError" + ], + "C", + [ + true, + false, + true, + true + ], + [ + [ + "A11", + "A12" + ], + "A1", + 1 + ], + [ + "B.before", + "A.field", + "A.ctor", + "B.field:2", + "B.after:4", + "C.field" + ], + [ + { + "other": true + }, + { + "early": true + }, + true, + { + "replaced": 1, + "mine": 2 + } + ], + [ + 1, + true, + "LB", + [], + false + ], + [ + [ + 1, + 2 + ], + "agg", + "AggregateError", + true, + true + ], + [ + true, + true, + "NotFound", + "NotFound: x", + 404, + "why", + true, + false, + "Got: z", + "" + ], + [ + true, + "m" + ], + { + "name": "E", + "message": "x" + }, + { + "name": "Error", + "message": "x" + }, + [ + "{\"name\":\"Error\",\"message\":\"x\"}", + "{\"name\":\"Error\",\"message\":\"x\"}" + ], + [ + "{\"x\":1}", + { + "x": 1 + }, + true, + false, + "undefined" + ], + [ + true, + true, + true, + "m", + "Error", + "Error: m", + "[object Error]", + true, + true + ], + [ + true, + true, + true, + "m", + "TypeError", + "TypeError: m", + "[object Error]", + true, + true + ], + [ + true, + true, + true, + "m", + "RangeError", + "RangeError: m", + "[object Error]", + true, + true + ], + [ + true, + true, + true, + "m", + "SyntaxError", + "SyntaxError: m", + "[object Error]", + true, + true + ], + [ + true, + true, + true, + "m", + "ReferenceError", + "ReferenceError: m", + "[object Error]", + true, + true + ], + [ + true, + true, + true, + "m", + "EvalError", + "EvalError: m", + "[object Error]", + true, + true + ], + [ + true, + true, + true, + "m", + "URIError", + "URIError: m", + "[object Error]", + true, + true + ], + [ + 7, + 8, + true, + true, + [ + "v" + ] + ], + 1 + ], + "logs": [ + "Cache {\"size\":2}", + "Empty {}", + "Lru {\"size\":2,\"hits\":0}", + "[Empty {},{\"c\":Cache {\"size\":2}}]", + "[class Cache] [class Lru extends Cache] [class (anonymous)]", + "E: bad", + "{\"a\":1}" + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-constructor-03.js b/packages/codemode-rust/conformance/cases/lang-constructor-03.js new file mode 100644 index 0000000000000..7db02ad1eb5e1 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-constructor-03.js @@ -0,0 +1,2 @@ +const obj = new Object() +return [obj !== undefined, obj.constructor === Object] diff --git a/packages/codemode-rust/conformance/cases/lang-constructor-03.json b/packages/codemode-rust/conformance/cases/lang-constructor-03.json new file mode 100644 index 0000000000000..5606b9511856d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-constructor-03.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + true, + true + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-data-guards.js b/packages/codemode-rust/conformance/cases/lang-data-guards.js new file mode 100644 index 0000000000000..d632991ae22bd --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-data-guards.js @@ -0,0 +1,68 @@ +const t = (f) => { + try { + return f() + } catch (e) { + return [e.name, e.message] + } +} +let p = Promise.resolve(1) +const g = (function* () {})() +const fn = () => 1 +return [ + t(() => p == 1), + t(() => p == p), + t(() => p != null), + t(() => p === p), + t(() => p < 1), + t(() => p + 1), + t(() => p * 2), + t(() => -p), + t(() => +p), + t(() => ~p), + t(() => { + let q = p + q++ + return q + }), + t(() => { + let q = p + q -= 1 + return q + }), + t(() => `${p}`), + t(() => String(p)), + t(() => typeof p.then), + t(() => p.foo), + t(() => p[0]), + t(() => { + p.x = 1 + }), + t(() => { + const q = Promise.resolve(2) + q.then = 5 + return typeof q.then + }), + t(() => "x" in p), + t(() => g + 1), + t(() => fn + ""), + t(() => tools.echo + 1), + t(() => { + for (const k in p) return k + }), + t(() => { + for (const x of { a: 1 }) return x + }), + t(() => { + for (const x of 5) return x + }), + t(() => { + for (const x of fn) return x + }), + t(() => { + const [a] = {} + return a + }), + t(() => [...{}]), + t(() => Math.max(...{})), + t(() => [...(function* () { yield* {} })()]), +] diff --git a/packages/codemode-rust/conformance/cases/lang-data-guards.json b/packages/codemode-rust/conformance/cases/lang-data-guards.json new file mode 100644 index 0000000000000..1409c28883785 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-data-guards.json @@ -0,0 +1,102 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "TypeError", + "Binary operators require data values." + ], + true, + true, + true, + [ + "TypeError", + "Binary operators require data values." + ], + [ + "TypeError", + "Binary operators require data values." + ], + [ + "TypeError", + "Binary operators require data values." + ], + [ + "TypeError", + "Unary operators require data values." + ], + [ + "TypeError", + "Unary operators require data values." + ], + [ + "TypeError", + "Unary operators require data values." + ], + [ + "TypeError", + "'++' requires a data value." + ], + [ + "TypeError", + "Binary operators require data values." + ], + "[object Promise]", + "[object Promise]", + "function", + [ + "TypeError", + "This value is an un-awaited Promise; await it first - e.g. `const result = await load(...)`." + ], + [ + "TypeError", + "This value is an un-awaited Promise; await it first - e.g. `const result = await load(...)`." + ], + [ + "TypeError", + "This value is an un-awaited Promise; await it first - e.g. `const result = await load(...)`." + ], + "number", + false, + "[object Generator]1", + "[object Function]", + [ + "TypeError", + "Binary operators require data values." + ], + [ + "TypeError", + "for...in received an un-awaited Promise; await it before inspecting the result." + ], + [ + "TypeError", + "for...of requires an iterable value, received a data object." + ], + [ + "TypeError", + "for...of requires an iterable value, received a number." + ], + [ + "TypeError", + "for...of requires an iterable value, received a function." + ], + [ + "TypeError", + "Array destructuring requires a supported iterable value." + ], + [ + "TypeError", + "Spread requires a synchronous iterable." + ], + [ + "TypeError", + "Spread requires a synchronous iterable." + ], + [ + "TypeError", + "yield* requires a compatible iterable value." + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-delete.js b/packages/codemode-rust/conformance/cases/lang-delete.js new file mode 100644 index 0000000000000..e2f5432f1d782 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-delete.js @@ -0,0 +1,38 @@ +// delete: what may be deleted, what refuses, and with which errors. +const attempt = (f) => { + try { + return f() + } catch (error) { + return String(error) + } +} +const o = { a: { b: 1 }, c: 2 } +return { + plain: [delete o.c, "c" in o, delete o.missing], + optional: [delete o?.a.b, o.a, delete o.x?.y, delete undefined?.a], + parenthesized: [delete (o.a), "a" in o], + identifier: attempt(() => { + let q = 1 + return delete q + }), + global: attempt(() => delete NaN), + other: [delete 1, delete String(1)], + constants: [attempt(() => delete Math.PI), attempt(() => delete Number.MAX_VALUE), attempt(() => delete Array.prototype)], + configurable: attempt(() => [delete Math.max, typeof Math.max]), + frozen: [attempt(() => delete Object.freeze({ a: 1 }).a), attempt(() => delete Object.seal([1])[0])], + arrayLength: attempt(() => delete [].length), + strings: [attempt(() => delete "abc".length), attempt(() => delete "abc"[0]), delete "abc"[9], delete "abc".foo], + primitives: [delete (5).x, attempt(() => delete null.a)], + bytes: [attempt(() => delete new Uint8Array(2)[0]), delete new Uint8Array(2)[5]], + functionKeys: (() => { + function g(a, b) {} + const before = [g.name, g.length] + const deleted = [delete g.name, delete g.length] + return [before, deleted, g.name, g.length, g.hasOwnProperty("length"), "length" in g] + })(), + nativeKeys: (() => { + const f = Math.min + return [delete f.name, delete f.length, f.name, f.length] + })(), + tools: attempt(() => delete tools.echo), +} diff --git a/packages/codemode-rust/conformance/cases/lang-delete.json b/packages/codemode-rust/conformance/cases/lang-delete.json new file mode 100644 index 0000000000000..66787bc366b70 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-delete.json @@ -0,0 +1,78 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "plain": [ + true, + false, + true + ], + "optional": [ + true, + {}, + true, + true + ], + "parenthesized": [ + true, + false + ], + "identifier": "TypeError: Only data fields may be deleted.", + "global": "TypeError: Only data fields may be deleted.", + "other": [ + true, + true + ], + "constants": [ + "TypeError: Cannot delete property 'PI'.", + "TypeError: Cannot delete property 'MAX_VALUE'.", + "TypeError: Cannot delete property 'prototype'." + ], + "configurable": [ + true, + "undefined" + ], + "frozen": [ + "TypeError: Cannot delete property 'a'.", + "TypeError: Cannot delete property '0'." + ], + "arrayLength": "TypeError: Cannot delete property 'length'.", + "strings": [ + "TypeError: Cannot delete property 'length' of \"abc\".", + "TypeError: Cannot delete property '0' of \"abc\".", + true, + true + ], + "primitives": [ + true, + "TypeError: Cannot read properties of null (reading 'a')." + ], + "bytes": [ + "TypeError: Cannot delete property '0'.", + true + ], + "functionKeys": [ + [ + "g", + 2 + ], + [ + true, + true + ], + "", + 0, + false, + true + ], + "nativeKeys": [ + true, + true, + "", + 0 + ], + "tools": "TypeError: Only data fields may be deleted." + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-entry-errors.js b/packages/codemode-rust/conformance/cases/lang-entry-errors.js new file mode 100644 index 0000000000000..2c07c6f12fe81 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-entry-errors.js @@ -0,0 +1,39 @@ +// new Map and Object.fromEntries reject an entry that is not an object as they reach it, closing the iterator. +const attempt = (f) => { + try { + return f() + } catch (error) { + return String(error) + } +} +const closing = (items) => { + const log = [] + const iterable = { + [Symbol.iterator]() { + let i = 0 + return { + next: () => (i < items.length ? { done: false, value: items[i++] } : { done: true }), + return() { + log.push("closed") + return {} + }, + } + }, + } + return [iterable, log] +} +const [entries, mapLog] = closing([[1, 2], null]) +const [pairs, objectLog] = closing([["a", 1], "ab"]) +return { + map: [attempt(() => new Map([[1, 2], , ])), attempt(() => new Map([1])), attempt(() => new Map(entries)), mapLog], + weakMap: attempt(() => new WeakMap([1])), + fromEntries: [ + attempt(() => Object.fromEntries([["a", 1], , ])), + attempt(() => Object.fromEntries(["ab"])), + attempt(() => Object.fromEntries([() => 1])), + attempt(() => Object.fromEntries([[1, () => 2]])), + attempt(() => Object.fromEntries(pairs)), + objectLog, + ], + fine: Object.fromEntries(new Map([["b", 2]])), +} diff --git a/packages/codemode-rust/conformance/cases/lang-entry-errors.json b/packages/codemode-rust/conformance/cases/lang-entry-errors.json new file mode 100644 index 0000000000000..793ba3490ff00 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-entry-errors.json @@ -0,0 +1,30 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "map": [ + "TypeError: new Map(...) expects [key, value] pairs as entry objects.", + "TypeError: new Map(...) expects [key, value] pairs as entry objects.", + "TypeError: new Map(...) expects [key, value] pairs as entry objects.", + [ + "closed" + ] + ], + "weakMap": "TypeError: new WeakMap(...) expects [key, value] pairs as entry objects.", + "fromEntries": [ + "TypeError: Object.fromEntries expects [key, value] entry objects.", + "TypeError: Object.fromEntries expects [key, value] entry objects.", + "TypeError: Object.fromEntries expects [key, value] entry objects.", + "TypeError: Object.fromEntries expects [key, value] entry objects.", + "TypeError: Object.fromEntries expects [key, value] entry objects.", + [ + "closed" + ] + ], + "fine": { + "b": 2 + } + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-01.js b/packages/codemode-rust/conformance/cases/lang-for-await-01.js new file mode 100644 index 0000000000000..b79fc974e40e3 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-01.js @@ -0,0 +1,5 @@ +const values = [] +for await (const item of [Promise.resolve(1), 2, new Promise((resolve) => resolve(3))]) { + values.push(item) +} +return values diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-01.json b/packages/codemode-rust/conformance/cases/lang-for-await-01.json new file mode 100644 index 0000000000000..1e47b24c5cd55 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-01.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 2, + 3 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-02.js b/packages/codemode-rust/conformance/cases/lang-for-await-02.js new file mode 100644 index 0000000000000..a4895f467fbef --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-02.js @@ -0,0 +1,5 @@ +const events = [] +const before = Promise.resolve().then(() => events.push("before")) +for await (const item of [Promise.resolve(1), 2]) events.push("body " + item) +await before +return events diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-02.json b/packages/codemode-rust/conformance/cases/lang-for-await-02.json new file mode 100644 index 0000000000000..6e1f3d2b8ea1f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-02.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "before", + "body 1", + "body 2" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-03.js b/packages/codemode-rust/conformance/cases/lang-for-await-03.js new file mode 100644 index 0000000000000..be79c97cc8591 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-03.js @@ -0,0 +1,9 @@ +const values = [] +try { + for await (const item of [Promise.resolve(1), Promise.reject("stop"), Promise.resolve(3)]) { + values.push(item) + } +} catch (error) { + return [values, error] +} +return "missed" diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-03.json b/packages/codemode-rust/conformance/cases/lang-for-await-03.json new file mode 100644 index 0000000000000..ab2e2c8504ca2 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-03.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 1 + ], + "stop" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-04.js b/packages/codemode-rust/conformance/cases/lang-for-await-04.js new file mode 100644 index 0000000000000..62399dbdce6a1 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-04.js @@ -0,0 +1,5 @@ +const values = [] +for await (const [first, ...rest] of [Promise.resolve([1, 2, 3])]) { + values.push(first, rest) +} +return values diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-04.json b/packages/codemode-rust/conformance/cases/lang-for-await-04.json new file mode 100644 index 0000000000000..53c568cb51577 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-04.json @@ -0,0 +1,13 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + [ + 2, + 3 + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-05.js b/packages/codemode-rust/conformance/cases/lang-for-await-05.js new file mode 100644 index 0000000000000..91a2ac68269f3 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-05.js @@ -0,0 +1,4 @@ +let first +let rest +for await ([first, ...rest] of [Promise.resolve([1, 2, 3])]) {} +return [first, rest] diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-05.json b/packages/codemode-rust/conformance/cases/lang-for-await-05.json new file mode 100644 index 0000000000000..53c568cb51577 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-05.json @@ -0,0 +1,13 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + [ + 2, + 3 + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-06.js b/packages/codemode-rust/conformance/cases/lang-for-await-06.js new file mode 100644 index 0000000000000..307d8ba004b7d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-06.js @@ -0,0 +1,5 @@ +const reads = [] +for await (const item of [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)]) { + reads.push(() => item) +} +return reads.map((read) => read()) diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-06.json b/packages/codemode-rust/conformance/cases/lang-for-await-06.json new file mode 100644 index 0000000000000..1e47b24c5cd55 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-06.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 2, + 3 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-08.js b/packages/codemode-rust/conformance/cases/lang-for-await-08.js new file mode 100644 index 0000000000000..7c84ee78da6c5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-08.js @@ -0,0 +1,7 @@ +const values = [] +outer: for await (const item of [1, 2, 3, 4]) { + if (item === 2) continue outer + if (item === 4) break outer + values.push(item) +} +return values diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-08.json b/packages/codemode-rust/conformance/cases/lang-for-await-08.json new file mode 100644 index 0000000000000..0434dd9dc9f0e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-08.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 3 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-09.js b/packages/codemode-rust/conformance/cases/lang-for-await-09.js new file mode 100644 index 0000000000000..685a7e292b16f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-09.js @@ -0,0 +1,12 @@ +let index = 0 +const iterator = { + [Symbol.asyncIterator]: () => iterator, + async next() { + index += 1 + if (index > 3) return { done: true } + return { done: false, value: index } + }, +} +const values = [] +for await (const item of iterator) values.push(item) +return values diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-09.json b/packages/codemode-rust/conformance/cases/lang-for-await-09.json new file mode 100644 index 0000000000000..1e47b24c5cd55 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-09.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 2, + 3 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-10.js b/packages/codemode-rust/conformance/cases/lang-for-await-10.js new file mode 100644 index 0000000000000..06bfe421f3a37 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-10.js @@ -0,0 +1,6 @@ +let done = false +const iterator = { + [Symbol.asyncIterator]: () => iterator, + next: async () => done ? { done: true } : (done = true, { done: false, value: Promise.resolve(1) }), +} +for await (const item of iterator) return [item instanceof Promise, await item] diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-10.json b/packages/codemode-rust/conformance/cases/lang-for-await-10.json new file mode 100644 index 0000000000000..9e813507905af --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-10.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + true, + 1 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-11.js b/packages/codemode-rust/conformance/cases/lang-for-await-11.js new file mode 100644 index 0000000000000..cf9d0e7e0dc0b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-11.js @@ -0,0 +1,13 @@ +const events = ["pre"] +const ticks = Promise.resolve() + .then(() => events.push("tick 1")) + .then(() => events.push("tick 2")) +let done = false +const iterator = { + [Symbol.asyncIterator]: () => iterator, + next: () => done ? { done: true } : (done = true, { done: false, value: Promise.resolve(1) }), +} +for await (const item of iterator) events.push(item instanceof Promise ? "loop" : "adopted") +events.push("post") +await ticks +return events diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-11.json b/packages/codemode-rust/conformance/cases/lang-for-await-11.json new file mode 100644 index 0000000000000..c3c827a6ee68e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-11.json @@ -0,0 +1,13 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "pre", + "tick 1", + "loop", + "tick 2", + "post" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-12.js b/packages/codemode-rust/conformance/cases/lang-for-await-12.js new file mode 100644 index 0000000000000..ac7e5f38a3c9d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-12.js @@ -0,0 +1,11 @@ +let index = 0 +const iterator = { + [Symbol.iterator]: () => iterator, + next() { + index += 1 + return index > 2 ? { done: true } : { done: false, value: Promise.resolve(index) } + }, +} +const values = [] +for await (const item of iterator) values.push(item) +return values diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-12.json b/packages/codemode-rust/conformance/cases/lang-for-await-12.json new file mode 100644 index 0000000000000..ef83b7145c25c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-12.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 2 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-13.js b/packages/codemode-rust/conformance/cases/lang-for-await-13.js new file mode 100644 index 0000000000000..31539de8bd9ff --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-13.js @@ -0,0 +1,23 @@ +const terminal = { + [Symbol.iterator]: () => terminal, + next: () => ({ done: true, value: Promise.reject("terminal") }), +} +let terminalError +try { + for await (const item of terminal) {} +} catch (error) { + terminalError = error +} + +const closing = { + [Symbol.iterator]: () => closing, + next: () => ({ done: false, value: 1 }), + return: () => ({ done: true, value: Promise.reject("close") }), +} +let closeError +try { + for await (const item of closing) break +} catch (error) { + closeError = error +} +return [terminalError, closeError] diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-13.json b/packages/codemode-rust/conformance/cases/lang-for-await-13.json new file mode 100644 index 0000000000000..a45364a73dcb4 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-13.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "terminal", + "close" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-14.js b/packages/codemode-rust/conformance/cases/lang-for-await-14.js new file mode 100644 index 0000000000000..2cbf459d63af3 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-14.js @@ -0,0 +1,10 @@ +let count = 0 +const next = () => { + count += 1 + if (count === 1) iterator.next = () => ({ done: true }) + return count > 2 ? { done: true } : { done: false, value: count } +} +const iterator = { [Symbol.iterator]: () => iterator, next } +const values = [] +for await (const item of iterator) values.push(item) +return values diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-14.json b/packages/codemode-rust/conformance/cases/lang-for-await-14.json new file mode 100644 index 0000000000000..ef83b7145c25c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-14.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 2 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-15.js b/packages/codemode-rust/conformance/cases/lang-for-await-15.js new file mode 100644 index 0000000000000..847447f47b2c6 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-15.js @@ -0,0 +1,17 @@ +let count = 0 +const result = { done: false, value: 1 } +const iterator = { + [Symbol.iterator]: () => iterator, + next() { + count += 1 + if (count > 1) return { done: true } + Promise.resolve().then(() => { + result.done = true + result.value = 2 + }) + return result + }, +} +const values = [] +for await (const item of iterator) values.push(item) +return values diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-15.json b/packages/codemode-rust/conformance/cases/lang-for-await-15.json new file mode 100644 index 0000000000000..1fd111f35f12a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-15.json @@ -0,0 +1,9 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-16.js b/packages/codemode-rust/conformance/cases/lang-for-await-16.js new file mode 100644 index 0000000000000..81aa6eba9294d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-16.js @@ -0,0 +1,11 @@ +const events = [] +const iterator = { + [Symbol.iterator]: () => iterator, + next: () => ({ done: false, value: 1 }), +} +for await (const item of iterator) { + Promise.resolve().then(() => events.push("reaction")) + break +} +events.push("after") +return events diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-16.json b/packages/codemode-rust/conformance/cases/lang-for-await-16.json new file mode 100644 index 0000000000000..2321d824c8546 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-16.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "reaction", + "after" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-17.js b/packages/codemode-rust/conformance/cases/lang-for-await-17.js new file mode 100644 index 0000000000000..7ff1a08b683c0 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-17.js @@ -0,0 +1,41 @@ +const events = [] +const throwing = { + [Symbol.iterator]: () => throwing, + next() { + Promise.resolve().then(() => events.push("next reaction")) + throw "next" + }, +} +try { + for await (const item of throwing) {} +} catch (error) { + events.push("next catch") +} + +const malformed = { + [Symbol.iterator]: () => malformed, + next() { + Promise.resolve().then(() => events.push("result reaction")) + return 1 + }, +} +try { + for await (const item of malformed) {} +} catch (error) { + events.push("result catch") +} + +const closing = { + [Symbol.iterator]: () => closing, + next: () => ({ done: false, value: 1 }), + return() { + Promise.resolve().then(() => events.push("return reaction")) + throw "return" + }, +} +try { + for await (const item of closing) break +} catch (error) { + events.push("return catch") +} +return events diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-17.json b/packages/codemode-rust/conformance/cases/lang-for-await-17.json new file mode 100644 index 0000000000000..ebcb443200b27 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-17.json @@ -0,0 +1,14 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "next reaction", + "next catch", + "result reaction", + "result catch", + "return reaction", + "return catch" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-18.js b/packages/codemode-rust/conformance/cases/lang-for-await-18.js new file mode 100644 index 0000000000000..6020d4cdf4a81 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-18.js @@ -0,0 +1,12 @@ +let done = false +const asyncIterator = { + next: async () => done ? { done: true } : (done = true, { done: false, value: "async" }), +} +const syncIterator = { next: () => ({ done: true }) } +const iterable = { + [Symbol.asyncIterator]: () => asyncIterator, + [Symbol.iterator]: () => syncIterator, +} +const values = [] +for await (const item of iterable) values.push(item) +return values diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-18.json b/packages/codemode-rust/conformance/cases/lang-for-await-18.json new file mode 100644 index 0000000000000..0bf0a48ee0109 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-18.json @@ -0,0 +1,9 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "async" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-19.js b/packages/codemode-rust/conformance/cases/lang-for-await-19.js new file mode 100644 index 0000000000000..384345eaae2ab --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-19.js @@ -0,0 +1,11 @@ +let closed = 0 +const iterator = { + [Symbol.asyncIterator]: () => iterator, + next: async () => ({ done: false, value: 1 }), + return: async () => (closed += 1, { done: true }), +} +for await (const item of iterator) break +try { + for await (const item of iterator) throw "stop" +} catch (error) {} +return closed diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-19.json b/packages/codemode-rust/conformance/cases/lang-for-await-19.json new file mode 100644 index 0000000000000..b1e227bee5d89 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-19.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 2, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-20.js b/packages/codemode-rust/conformance/cases/lang-for-await-20.js new file mode 100644 index 0000000000000..6cde66d23b2ed --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-20.js @@ -0,0 +1,11 @@ +let count = 0 +const iterator = { + [Symbol.asyncIterator]: () => iterator, + next: async () => ({ done: false, value: 1 }), + return: null, +} +for await (const item of iterator) { + count += 1 + break +} +return count diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-20.json b/packages/codemode-rust/conformance/cases/lang-for-await-20.json new file mode 100644 index 0000000000000..39c81553f53e6 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-20.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 1, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-21.js b/packages/codemode-rust/conformance/cases/lang-for-await-21.js new file mode 100644 index 0000000000000..8506e56acf9c9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-21.js @@ -0,0 +1,11 @@ +const iterator = { + [Symbol.asyncIterator]: () => iterator, + next: async () => ({ done: false, value: 1 }), + return: true, +} +try { + for await (const item of iterator) break +} catch (error) { + return error.name +} +return "missed" diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-21.json b/packages/codemode-rust/conformance/cases/lang-for-await-21.json new file mode 100644 index 0000000000000..4b096fbc139f9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-21.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "TypeError", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-22.js b/packages/codemode-rust/conformance/cases/lang-for-await-22.js new file mode 100644 index 0000000000000..0d940aeac4db8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-22.js @@ -0,0 +1,11 @@ +const iterator = { + [Symbol.asyncIterator]: () => iterator, + next: async () => ({ done: false, value: 1 }), + return: true, +} +try { + for await (const item of iterator) throw "body" +} catch (error) { + return error +} +return "missed" diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-22.json b/packages/codemode-rust/conformance/cases/lang-for-await-22.json new file mode 100644 index 0000000000000..09704efb8d191 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-22.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "body", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-23.js b/packages/codemode-rust/conformance/cases/lang-for-await-23.js new file mode 100644 index 0000000000000..36bb6668ac755 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-23.js @@ -0,0 +1,11 @@ +const iterator = { + [Symbol.asyncIterator]: () => iterator, + next: async () => ({ done: false, value: 1 }), + return: async () => null, +} +try { + for await (const item of iterator) break +} catch (error) { + return error.name +} +return "missed" diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-23.json b/packages/codemode-rust/conformance/cases/lang-for-await-23.json new file mode 100644 index 0000000000000..4b096fbc139f9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-23.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "TypeError", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-24.js b/packages/codemode-rust/conformance/cases/lang-for-await-24.js new file mode 100644 index 0000000000000..58c90806f0791 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-24.js @@ -0,0 +1,9 @@ +const iterator = { + [Symbol.asyncIterator]: () => { throw "acquire" }, +} +try { + for await (const item of iterator) {} +} catch (error) { + return error +} +return "missed" diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-24.json b/packages/codemode-rust/conformance/cases/lang-for-await-24.json new file mode 100644 index 0000000000000..3505f8e6576b0 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-24.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "acquire", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-25.js b/packages/codemode-rust/conformance/cases/lang-for-await-25.js new file mode 100644 index 0000000000000..c3362bfc98a6e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-25.js @@ -0,0 +1,14 @@ +const names = [] +const invalid = [ + { [Symbol.asyncIterator]: true }, + { [Symbol.asyncIterator]: () => 1 }, + { [Symbol.asyncIterator]: () => ({ next: true }) }, +] +for (const iterator of invalid) { + try { + for await (const item of iterator) {} + } catch (error) { + names.push(error.name) + } +} +return names diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-25.json b/packages/codemode-rust/conformance/cases/lang-for-await-25.json new file mode 100644 index 0000000000000..2ca778f025aa2 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-25.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "TypeError", + "TypeError", + "TypeError" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-26.js b/packages/codemode-rust/conformance/cases/lang-for-await-26.js new file mode 100644 index 0000000000000..8435cea7bceac --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-26.js @@ -0,0 +1,17 @@ +let done = false +const iterable = { + plain: true, + [Symbol.asyncIterator]: () => iterable, + next: async () => done ? { done: true } : (done = true, { done: false, value: 1 }), +} +const spread = { ...iterable } +const { plain, ...rest } = iterable +const assigned = Object.assign({}, iterable) +const values = [] +for await (const item of spread) values.push(item) +return [ + values, + Object.hasOwn(spread, Symbol.asyncIterator), + Object.hasOwn(rest, Symbol.asyncIterator), + Object.hasOwn(assigned, Symbol.asyncIterator), +] diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-26.json b/packages/codemode-rust/conformance/cases/lang-for-await-26.json new file mode 100644 index 0000000000000..91e9b13e4d98a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-26.json @@ -0,0 +1,14 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 1 + ], + true, + true, + true + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-27.js b/packages/codemode-rust/conformance/cases/lang-for-await-27.js new file mode 100644 index 0000000000000..ab017e3e42f1f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-27.js @@ -0,0 +1,5 @@ +const iterator = { + [Symbol.asyncIterator]: () => iterator, + next: async () => 1, +} +for await (const item of iterator) {} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-27.json b/packages/codemode-rust/conformance/cases/lang-for-await-27.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-27.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-28.js b/packages/codemode-rust/conformance/cases/lang-for-await-28.js new file mode 100644 index 0000000000000..e908b60276acf --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-28.js @@ -0,0 +1 @@ +for await (const item of { values: [1, 2] }) {} diff --git a/packages/codemode-rust/conformance/cases/lang-for-await-28.json b/packages/codemode-rust/conformance/cases/lang-for-await-28.json new file mode 100644 index 0000000000000..8e0476d59757b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-for-await-28.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "InvalidDataValue", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-01.js b/packages/codemode-rust/conformance/cases/lang-generator-01.js new file mode 100644 index 0000000000000..d658f9d5fd90b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-01.js @@ -0,0 +1,11 @@ +const log = [] +function* g(a = log.push("param")) { log.push("body"); yield a } +const it = g() +log.push("created") +it.next() +function* bad({ x } = null) { yield x } +async function* asyncBad({ x } = null) { yield x } +let failures = [] +try { bad() } catch (error) { failures.push(error.constructor.name) } +try { asyncBad() } catch (error) { failures.push(error.constructor.name) } +return [log, failures] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-01.json b/packages/codemode-rust/conformance/cases/lang-generator-01.json new file mode 100644 index 0000000000000..5dc0b50825c0e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-01.json @@ -0,0 +1,17 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "param", + "created", + "body" + ], + [ + "TypeError", + "TypeError" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-02.js b/packages/codemode-rust/conformance/cases/lang-generator-02.js new file mode 100644 index 0000000000000..8d4b48e7b26d8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-02.js @@ -0,0 +1,13 @@ +const events = [] +function* generate() { + events.push("start") + const received = yield 1 + (yield 2) + return received +} +const iterator = generate() +const before = events.slice() +const first = iterator.next(99) +const second = iterator.next(3) +const third = iterator.next(7) +const fourth = iterator.next(8) +return [before, events, first, second, third, fourth] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-02.json b/packages/codemode-rust/conformance/cases/lang-generator-02.json new file mode 100644 index 0000000000000..aae11b84dbad1 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-02.json @@ -0,0 +1,27 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [], + [ + "start" + ], + { + "value": 2, + "done": false + }, + { + "value": 4, + "done": false + }, + { + "value": 7, + "done": true + }, + { + "done": true + } + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-03.js b/packages/codemode-rust/conformance/cases/lang-generator-03.js new file mode 100644 index 0000000000000..8525b202d2ef9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-03.js @@ -0,0 +1,9 @@ +function* generate() { + try { + try { yield "try" } catch (error) { yield "caught " + error } + } finally { + yield "finally" + } +} +const iterator = generate() +return [iterator.next(), iterator.throw("boom"), iterator.return("done"), iterator.next()] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-03.json b/packages/codemode-rust/conformance/cases/lang-generator-03.json new file mode 100644 index 0000000000000..e96641419d6c2 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-03.json @@ -0,0 +1,24 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + { + "value": "try", + "done": false + }, + { + "value": "caught boom", + "done": false + }, + { + "value": "finally", + "done": false + }, + { + "value": "done", + "done": true + } + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-04.js b/packages/codemode-rust/conformance/cases/lang-generator-04.js new file mode 100644 index 0000000000000..bbcbf32fdcd89 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-04.js @@ -0,0 +1,8 @@ +function* generate() { yield 1 } +const iterator = generate() +iterator.next() +let suspended +let exhausted +try { iterator.throw("first") } catch (error) { suspended = error } +try { iterator.throw("second") } catch (error) { exhausted = error } +return [suspended, exhausted, iterator.next()] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-04.json b/packages/codemode-rust/conformance/cases/lang-generator-04.json new file mode 100644 index 0000000000000..54fa950fa74ce --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-04.json @@ -0,0 +1,13 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "first", + "second", + { + "done": true + } + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-05.js b/packages/codemode-rust/conformance/cases/lang-generator-05.js new file mode 100644 index 0000000000000..64ea0c14a40c1 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-05.js @@ -0,0 +1,6 @@ +let iterator +function* generate() { + try { iterator.next() } catch (error) { return error.name } +} +iterator = generate() +return iterator.next() diff --git a/packages/codemode-rust/conformance/cases/lang-generator-05.json b/packages/codemode-rust/conformance/cases/lang-generator-05.json new file mode 100644 index 0000000000000..db66dc3f95f32 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-05.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "value": "TypeError", + "done": true + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-06.js b/packages/codemode-rust/conformance/cases/lang-generator-06.js new file mode 100644 index 0000000000000..873696f7af642 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-06.js @@ -0,0 +1,10 @@ +function* inner() { + const input = yield 1 + return input * 2 +} +function* outer() { + const result = yield* inner() + return result + 1 +} +const iterator = outer() +return [iterator.next(), iterator.next(4)] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-06.json b/packages/codemode-rust/conformance/cases/lang-generator-06.json new file mode 100644 index 0000000000000..18abbc5ccae66 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-06.json @@ -0,0 +1,16 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + { + "value": 1, + "done": false + }, + { + "value": 9, + "done": true + } + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-07.js b/packages/codemode-rust/conformance/cases/lang-generator-07.js new file mode 100644 index 0000000000000..df963f6422fdf --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-07.js @@ -0,0 +1,24 @@ +const calls = [] +let step = 0 +const delegate = { + [Symbol.iterator]: () => delegate, + next(...args) { + calls.push(["next", args.length, args[0]]) + step += 1 + return step === 1 ? { value: "one", done: false } : { value: "end", done: true } + }, + throw(value) { + calls.push(["throw", value]) + return { value: "recovered", done: false } + }, + return(value) { + calls.push(["return", value]) + return { value: value + "!", done: true } + }, +} +function* generate() { return yield* delegate } +const iterator = generate() +const first = iterator.next() +const second = iterator.throw("x") +const third = iterator.return("stop") +return [first, second, third, calls] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-07.json b/packages/codemode-rust/conformance/cases/lang-generator-07.json new file mode 100644 index 0000000000000..5d2d93dc8744e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-07.json @@ -0,0 +1,35 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + { + "value": "one", + "done": false + }, + { + "value": "recovered", + "done": false + }, + { + "value": "stop!", + "done": true + }, + [ + [ + "next", + 1, + null + ], + [ + "throw", + "x" + ], + [ + "return", + "stop" + ] + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-08.js b/packages/codemode-rust/conformance/cases/lang-generator-08.js new file mode 100644 index 0000000000000..2097c54d0dd7b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-08.js @@ -0,0 +1,4 @@ +function* generate() { yield* [1, 2] } +const iterator = generate() +iterator.next() +try { iterator.throw("boom") } catch (error) { return error.name } diff --git a/packages/codemode-rust/conformance/cases/lang-generator-08.json b/packages/codemode-rust/conformance/cases/lang-generator-08.json new file mode 100644 index 0000000000000..4b096fbc139f9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-08.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "TypeError", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-09.js b/packages/codemode-rust/conformance/cases/lang-generator-09.js new file mode 100644 index 0000000000000..bf6c5865897bb --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-09.js @@ -0,0 +1,6 @@ +function* generate() { yield 1; yield 2 } +const iterator = generate() +const symbols = [iterator[Symbol.iterator]() === iterator, iterator[Symbol.asyncIterator]] +const values = [] +for (const item of iterator) values.push(item) +return [symbols, values] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-09.json b/packages/codemode-rust/conformance/cases/lang-generator-09.json new file mode 100644 index 0000000000000..10fce9c105c53 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-09.json @@ -0,0 +1,16 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + true, + null + ], + [ + 1, + 2 + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-10.js b/packages/codemode-rust/conformance/cases/lang-generator-10.js new file mode 100644 index 0000000000000..c77795ff7bbde --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-10.js @@ -0,0 +1,10 @@ +const sync = { + *[Symbol.iterator]() { yield 1; yield 2 }, +} +const asynchronous = { + async *[Symbol.asyncIterator]() { yield 3; yield 4 }, +} +const values = [] +for (const item of sync) values.push(item) +for await (const item of asynchronous) values.push(item) +return values diff --git a/packages/codemode-rust/conformance/cases/lang-generator-10.json b/packages/codemode-rust/conformance/cases/lang-generator-10.json new file mode 100644 index 0000000000000..1ee2890a15f63 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-10.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 2, + 3, + 4 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-11.js b/packages/codemode-rust/conformance/cases/lang-generator-11.js new file mode 100644 index 0000000000000..5449e41be7069 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-11.js @@ -0,0 +1,6 @@ +const events = [] +function* generate() { + try { yield 1; yield 2 } finally { events.push("closed") } +} +for (const item of generate()) break +return events diff --git a/packages/codemode-rust/conformance/cases/lang-generator-11.json b/packages/codemode-rust/conformance/cases/lang-generator-11.json new file mode 100644 index 0000000000000..a4e8112e5a241 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-11.json @@ -0,0 +1,9 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "closed" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-12.js b/packages/codemode-rust/conformance/cases/lang-generator-12.js new file mode 100644 index 0000000000000..d97655c4ce3e1 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-12.js @@ -0,0 +1,13 @@ +const events = [] +async function* generate() { + events.push("start") + const input = yield Promise.resolve(1) + events.push("received " + input) + return Promise.resolve(3) +} +const iterator = generate() +const first = iterator.next() +const second = iterator.next(2) +const third = iterator.next(4) +const promiseFlags = [first instanceof Promise, second instanceof Promise, third instanceof Promise] +return [promiseFlags, await Promise.all([first, second, third]), events] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-12.json b/packages/codemode-rust/conformance/cases/lang-generator-12.json new file mode 100644 index 0000000000000..5461e1c46793a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-12.json @@ -0,0 +1,30 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + true, + true, + true + ], + [ + { + "value": 1, + "done": false + }, + { + "value": 3, + "done": true + }, + { + "done": true + } + ], + [ + "start", + "received 2" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-13.js b/packages/codemode-rust/conformance/cases/lang-generator-13.js new file mode 100644 index 0000000000000..2c47d9e16b7d9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-13.js @@ -0,0 +1,15 @@ +const events = [] +let resolve +const pending = new Promise((done) => { resolve = done }) +async function* generate() { return 1 } +const iterator = generate() +const first = iterator.next() +const returned = iterator.return(pending) +const later = first.then(() => iterator.next()).then(() => events.push("later")) +returned.then(() => events.push("returned")) +await first +await Promise.resolve() +const before = events.slice() +resolve(9) +await Promise.all([returned, later]) +return [before, events] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-13.json b/packages/codemode-rust/conformance/cases/lang-generator-13.json new file mode 100644 index 0000000000000..c592c3c0730c9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-13.json @@ -0,0 +1,13 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [], + [ + "returned", + "later" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-14.js b/packages/codemode-rust/conformance/cases/lang-generator-14.js new file mode 100644 index 0000000000000..6ecb9c454cc50 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-14.js @@ -0,0 +1,13 @@ +const events = [] +let resolve +const pending = new Promise((done) => { resolve = done }) +async function* generate() { return 1 } +const iterator = generate() +await iterator.next() +const returned = iterator.return(pending).then(() => events.push("returned")) +const later = iterator.next().then(() => events.push("later")) +await Promise.resolve() +const before = events.slice() +resolve(9) +await Promise.all([returned, later]) +return [before, events] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-14.json b/packages/codemode-rust/conformance/cases/lang-generator-14.json new file mode 100644 index 0000000000000..c592c3c0730c9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-14.json @@ -0,0 +1,13 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [], + [ + "returned", + "later" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-15.js b/packages/codemode-rust/conformance/cases/lang-generator-15.js new file mode 100644 index 0000000000000..6b8536e3bc7d5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-15.js @@ -0,0 +1,15 @@ +async function* yielded() { yield Promise.resolve(1) } +async function* returned() { return Promise.resolve(2) } +async function* pending() { yield 0 } +const first = yielded() +const second = returned() +const third = pending() +const exhausted = returned() +await third.next() +await exhausted.next() +return await Promise.all([ + first.next(), + second.next(), + third.return(Promise.resolve(3)), + exhausted.return(Promise.resolve(4)), +]) diff --git a/packages/codemode-rust/conformance/cases/lang-generator-15.json b/packages/codemode-rust/conformance/cases/lang-generator-15.json new file mode 100644 index 0000000000000..4c3901c527b9e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-15.json @@ -0,0 +1,24 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + { + "value": 1, + "done": false + }, + { + "value": 2, + "done": true + }, + { + "value": 3, + "done": true + }, + { + "value": 4, + "done": true + } + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-16.js b/packages/codemode-rust/conformance/cases/lang-generator-16.js new file mode 100644 index 0000000000000..9fb40fe46a793 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-16.js @@ -0,0 +1,17 @@ +const events = [] +async function* generate() { + try { + yield 1 + } catch (error) { + events.push("caught " + error) + yield "recovered" + } finally { + events.push("finally") + } +} +const iterator = generate() +const first = await iterator.next() +const returned = await iterator.return(Promise.reject("bad")) +const beforeNext = events.slice() +const last = await iterator.next() +return [first, returned, beforeNext, last, events] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-16.json b/packages/codemode-rust/conformance/cases/lang-generator-16.json new file mode 100644 index 0000000000000..b2bb65f4c4685 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-16.json @@ -0,0 +1,26 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + { + "value": 1, + "done": false + }, + { + "value": "recovered", + "done": false + }, + [ + "caught bad" + ], + { + "done": true + }, + [ + "caught bad", + "finally" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-17.js b/packages/codemode-rust/conformance/cases/lang-generator-17.js new file mode 100644 index 0000000000000..67146fed8ba8b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-17.js @@ -0,0 +1,22 @@ +const calls = [] +let syncStep = 0 +const sync = { + [Symbol.iterator]: () => sync, + next(...args) { + calls.push(["sync", args.length]) + syncStep += 1 + return { value: syncStep, done: syncStep > 1 } + }, +} +let asyncStep = 0 +const asynchronous = { + [Symbol.asyncIterator]: () => asynchronous, + async next(...args) { + calls.push(["async", args.length]) + asyncStep += 1 + return { value: asyncStep, done: asyncStep > 1 } + }, +} +for (const item of sync) {} +for await (const item of asynchronous) {} +return calls diff --git a/packages/codemode-rust/conformance/cases/lang-generator-17.json b/packages/codemode-rust/conformance/cases/lang-generator-17.json new file mode 100644 index 0000000000000..2b295338958cb --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-17.json @@ -0,0 +1,24 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "sync", + 0 + ], + [ + "sync", + 0 + ], + [ + "async", + 0 + ], + [ + "async", + 0 + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-18.js b/packages/codemode-rust/conformance/cases/lang-generator-18.js new file mode 100644 index 0000000000000..f9f25a4132e3a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-18.js @@ -0,0 +1,6 @@ +async function* generate() { yield 1; yield await Promise.resolve(2) } +const values = [] +for await (const item of generate()) values.push(item) +let name +try { for (const item of generate()) {} } catch (error) { name = error.name } +return [values, name] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-18.json b/packages/codemode-rust/conformance/cases/lang-generator-18.json new file mode 100644 index 0000000000000..e4ab8943fda9c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-18.json @@ -0,0 +1,13 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 1, + 2 + ], + "TypeError" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-19.js b/packages/codemode-rust/conformance/cases/lang-generator-19.js new file mode 100644 index 0000000000000..7b4fa09269020 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-19.js @@ -0,0 +1 @@ +function* generate() { yield 1 } return generate() diff --git a/packages/codemode-rust/conformance/cases/lang-generator-19.json b/packages/codemode-rust/conformance/cases/lang-generator-19.json new file mode 100644 index 0000000000000..e98f492328df0 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-19.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": {}, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-20.js b/packages/codemode-rust/conformance/cases/lang-generator-20.js new file mode 100644 index 0000000000000..5a4dd30ae3850 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-20.js @@ -0,0 +1,15 @@ +const events = [] +function* generate() { events.push("body"); yield 1 } + +const returned = generate() +const startReturn = returned.return(7) +const afterReturn = returned.next() + +const thrown = generate() +let startThrow +try { thrown.throw("start") } catch (error) { startThrow = error } +const afterThrow = thrown.next() +let completedThrow +try { thrown.throw("completed") } catch (error) { completedThrow = error } + +return [startReturn, afterReturn, startThrow, afterThrow, completedThrow, events] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-20.json b/packages/codemode-rust/conformance/cases/lang-generator-20.json new file mode 100644 index 0000000000000..dbe31309b7a91 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-20.json @@ -0,0 +1,21 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + { + "value": 7, + "done": true + }, + { + "done": true + }, + "start", + { + "done": true + }, + "completed", + [] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-21.js b/packages/codemode-rust/conformance/cases/lang-generator-21.js new file mode 100644 index 0000000000000..5a4ce8c999d7b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-21.js @@ -0,0 +1,15 @@ +const events = [] +async function* generate() { events.push("body"); yield 1 } + +const returned = generate() +const startReturn = await returned.return(Promise.resolve(7)) +const afterReturn = await returned.next() + +const thrown = generate() +let startThrow +try { await thrown.throw("start") } catch (error) { startThrow = error } +const afterThrow = await thrown.next() +let completedThrow +try { await thrown.throw("completed") } catch (error) { completedThrow = error } + +return [startReturn, afterReturn, startThrow, afterThrow, completedThrow, events] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-21.json b/packages/codemode-rust/conformance/cases/lang-generator-21.json new file mode 100644 index 0000000000000..dbe31309b7a91 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-21.json @@ -0,0 +1,21 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + { + "value": 7, + "done": true + }, + { + "done": true + }, + "start", + { + "done": true + }, + "completed", + [] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-22.js b/packages/codemode-rust/conformance/cases/lang-generator-22.js new file mode 100644 index 0000000000000..91848f1247de6 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-22.js @@ -0,0 +1,24 @@ +async function* yielding() { + try { yield 1 } finally { yield 2 } +} +async function* returning() { + try { yield 1 } finally { return "override" } +} +async function* throwing() { + try { yield 1 } finally { throw "override" } +} + +const first = yielding() +await first.next() +const finallyYield = await first.return("sent") +const preservedReturn = await first.next() + +const second = returning() +await second.next() +const overriddenReturn = await second.return("sent") + +const third = throwing() +await third.next() +let overriddenThrow +try { await third.throw("sent") } catch (error) { overriddenThrow = error } +return [finallyYield, preservedReturn, overriddenReturn, overriddenThrow] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-22.json b/packages/codemode-rust/conformance/cases/lang-generator-22.json new file mode 100644 index 0000000000000..a2ca81c317196 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-22.json @@ -0,0 +1,21 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + { + "value": 2, + "done": false + }, + { + "value": "sent", + "done": true + }, + { + "value": "override", + "done": true + }, + "override" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-23.js b/packages/codemode-rust/conformance/cases/lang-generator-23.js new file mode 100644 index 0000000000000..ca8e2a7be6bd3 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-23.js @@ -0,0 +1,8 @@ +async function* direct() { yield Promise.reject("direct") } +async function* delegated() { yield* [Promise.reject("delegated"), "unreachable"] } +const results = [] +for (const iterator of [direct(), delegated()]) { + try { await iterator.next() } catch (error) { results.push(error) } + results.push(await iterator.next()) +} +return results diff --git a/packages/codemode-rust/conformance/cases/lang-generator-23.json b/packages/codemode-rust/conformance/cases/lang-generator-23.json new file mode 100644 index 0000000000000..3f748569afc95 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-23.json @@ -0,0 +1,16 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "direct", + { + "done": true + }, + "delegated", + { + "done": true + } + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-24.js b/packages/codemode-rust/conformance/cases/lang-generator-24.js new file mode 100644 index 0000000000000..518642c83addf --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-24.js @@ -0,0 +1,26 @@ +const events = [] +function* loopSource() { + try { yield Promise.reject("loop") } finally { events.push("loop close") } +} +let loopError +try { for await (const item of loopSource()) {} } catch (error) { loopError = error } + +function* yieldSource() { + try { yield Promise.reject("yield") } finally { events.push("yield close") } +} +async function* delegate() { yield* yieldSource() } +let yieldError +try { await delegate().next() } catch (error) { yieldError = error } + +const throwing = { + [Symbol.iterator]: () => throwing, + next: () => ({ value: 1, done: false }), + throw: () => ({ value: Promise.reject("throw"), done: false }), + return: () => { events.push("throw close"); return {} }, +} +async function* throwDelegate() { yield* throwing } +const iterator = throwDelegate() +await iterator.next() +let throwError +try { await iterator.throw("sent") } catch (error) { throwError = error } +return [loopError, yieldError, throwError, events] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-24.json b/packages/codemode-rust/conformance/cases/lang-generator-24.json new file mode 100644 index 0000000000000..5e5016c9c491d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-24.json @@ -0,0 +1,16 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "loop", + "yield", + "throw", + [ + "loop close", + "yield close", + "throw close" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-25.js b/packages/codemode-rust/conformance/cases/lang-generator-25.js new file mode 100644 index 0000000000000..b08c2373e3be1 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-25.js @@ -0,0 +1,24 @@ +const events = [] +const terminal = { + [Symbol.iterator]: () => terminal, + next: () => ({ value: Promise.reject("terminal"), done: true }), + return: () => { events.push("terminal close"); return {} }, +} +let terminalError +try { for await (const item of terminal) {} } catch (error) { terminalError = error } + +let returnCount = 0 +const returned = { + [Symbol.iterator]: () => returned, + next: () => ({ value: 1, done: false }), + return: () => { + returnCount += 1 + return { value: Promise.reject("return"), done: false } + }, +} +async function* delegate() { yield* returned } +const iterator = delegate() +await iterator.next() +let returnError +try { await iterator.return("sent") } catch (error) { returnError = error } +return [terminalError, returnError, returnCount, events] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-25.json b/packages/codemode-rust/conformance/cases/lang-generator-25.json new file mode 100644 index 0000000000000..2441cb9581d74 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-25.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "terminal", + "return", + 1, + [] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-26.js b/packages/codemode-rust/conformance/cases/lang-generator-26.js new file mode 100644 index 0000000000000..28a82cafabfc9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-26.js @@ -0,0 +1,13 @@ +async function* generate() { + try { + try { yield 1; yield 2 } catch (error) { yield "caught " + error } + } finally { + yield "finally" + } +} +const iterator = generate() +const first = iterator.next() +const thrown = iterator.throw("x") +const returned = iterator.return("done") +const last = iterator.next() +return await Promise.all([first, thrown, returned, last]) diff --git a/packages/codemode-rust/conformance/cases/lang-generator-26.json b/packages/codemode-rust/conformance/cases/lang-generator-26.json new file mode 100644 index 0000000000000..de84428687566 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-26.json @@ -0,0 +1,24 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + { + "value": 1, + "done": false + }, + { + "value": "caught x", + "done": false + }, + { + "value": "finally", + "done": false + }, + { + "value": "done", + "done": true + } + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-27.js b/packages/codemode-rust/conformance/cases/lang-generator-27.js new file mode 100644 index 0000000000000..d7564bd928e32 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-27.js @@ -0,0 +1,30 @@ +const events = [] +let returned, returnRequest +async function* returnWhileExecuting() { + returnRequest = returned.return(42).then((result) => events.push(["return", result])) + yield 1 +} +returned = returnWhileExecuting() +const firstReturn = returned.next().then((result) => events.push(["first return", result])) +await Promise.all([firstReturn, returnRequest]) + +let thrown, throwRequest +async function* throwWhileExecuting() { + throwRequest = thrown.throw("boom").catch((error) => events.push(["throw", error])) + yield 2 +} +thrown = throwWhileExecuting() +const firstThrow = thrown.next().then((result) => events.push(["first throw", result])) +await Promise.all([firstThrow, throwRequest]) + +async function* queued() { yield "first"; yield "second" } +const iterator = queued() +const first = iterator.next() +const second = iterator.next() +const third = iterator.next() +await Promise.all([ + third.then(() => events.push("third")), + second.then(() => events.push("second")), + first.then(() => events.push("first")), +]) +return events diff --git a/packages/codemode-rust/conformance/cases/lang-generator-27.json b/packages/codemode-rust/conformance/cases/lang-generator-27.json new file mode 100644 index 0000000000000..43f336c9aa0d9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-27.json @@ -0,0 +1,36 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "first return", + { + "value": 1, + "done": false + } + ], + [ + "return", + { + "value": 42, + "done": true + } + ], + [ + "first throw", + { + "value": 2, + "done": false + } + ], + [ + "throw", + "boom" + ], + "first", + "second", + "third" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-28.js b/packages/codemode-rust/conformance/cases/lang-generator-28.js new file mode 100644 index 0000000000000..9734ac8bbe774 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-28.js @@ -0,0 +1,14 @@ +const asyncValue = Promise.resolve("async") +const asynchronous = { + [Symbol.asyncIterator]: () => asynchronous, + next: () => ({ value: asyncValue, done: false }), +} +const syncValue = Promise.resolve("sync") +const synchronous = { + [Symbol.iterator]: () => synchronous, + next: () => ({ value: syncValue, done: false }), +} +async function* delegate(value) { yield* value } +const asyncResult = await delegate(asynchronous).next() +const syncResult = await delegate(synchronous).next() +return [asyncResult.value === asyncValue, await asyncResult.value, syncResult] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-28.json b/packages/codemode-rust/conformance/cases/lang-generator-28.json new file mode 100644 index 0000000000000..79ec7bacc60d9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-28.json @@ -0,0 +1,14 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + true, + "async", + { + "value": "sync", + "done": false + } + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-29.js b/packages/codemode-rust/conformance/cases/lang-generator-29.js new file mode 100644 index 0000000000000..0940c30157597 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-29.js @@ -0,0 +1,8 @@ +const result = { value: Promise.resolve(1), done: false } +result.value.then(() => { result.done = true }) +const source = { + [Symbol.iterator]: () => source, + next: () => result, +} +async function* delegate() { yield* source } +return await delegate().next() diff --git a/packages/codemode-rust/conformance/cases/lang-generator-29.json b/packages/codemode-rust/conformance/cases/lang-generator-29.json new file mode 100644 index 0000000000000..bde10d1da8633 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-29.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "value": 1, + "done": false + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-30.js b/packages/codemode-rust/conformance/cases/lang-generator-30.js new file mode 100644 index 0000000000000..99865d881c113 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-30.js @@ -0,0 +1,27 @@ +const calls = [] +const make = (symbol, label) => { + let step = 0 + const iterator = { + [symbol]: () => iterator, + next(...args) { + calls.push([label, "next", args.length, args[0]]) + step += 1 + return { value: step, done: false } + }, + return(value) { + calls.push([label, "return", value]) + return { value: value + "!", done: true } + }, + throw(value) { + calls.push([label, "throw", value]) + return { value: "caught " + value, done: false } + }, + } + return iterator +} +async function* delegate(iterator) { return yield* iterator } +const sync = delegate(make(Symbol.iterator, "sync")) +const asynchronous = delegate(make(Symbol.asyncIterator, "async")) +const results = [await sync.next(9), await sync.next(2), await sync.throw("x"), await sync.return("stop")] +results.push(await asynchronous.next(9), await asynchronous.next(3), await asynchronous.throw("y")) +return [results, calls] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-30.json b/packages/codemode-rust/conformance/cases/lang-generator-30.json new file mode 100644 index 0000000000000..06a584de3873d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-30.json @@ -0,0 +1,79 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + { + "value": 1, + "done": false + }, + { + "value": 2, + "done": false + }, + { + "value": "caught x", + "done": false + }, + { + "value": "stop!", + "done": true + }, + { + "value": 1, + "done": false + }, + { + "value": 2, + "done": false + }, + { + "value": "caught y", + "done": false + } + ], + [ + [ + "sync", + "next", + 1, + null + ], + [ + "sync", + "next", + 1, + 2 + ], + [ + "sync", + "throw", + "x" + ], + [ + "sync", + "return", + "stop" + ], + [ + "async", + "next", + 1, + null + ], + [ + "async", + "next", + 1, + 3 + ], + [ + "async", + "throw", + "y" + ] + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-31.js b/packages/codemode-rust/conformance/cases/lang-generator-31.js new file mode 100644 index 0000000000000..9247cb0c6bbf4 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-31.js @@ -0,0 +1,29 @@ +let returns = 0 +const synchronous = { + [Symbol.iterator]: () => synchronous, + next: () => ({ value: "next", done: false }), + return(value) { + returns += 1 + return { value: returns === 1 ? "return pending" : value, done: returns > 1 } + }, +} +let throws = 0 +const asynchronous = { + [Symbol.asyncIterator]: () => asynchronous, + next: () => ({ value: "next", done: false }), + throw(value) { + throws += 1 + return { value: throws === 1 ? "throw pending" : value, done: throws > 1 } + }, +} +async function* delegate(iterator) { return yield* iterator } +const returned = delegate(synchronous) +const thrown = delegate(asynchronous) +return [ + await returned.next(), + await returned.return("first"), + await returned.return("second"), + await thrown.next(), + await thrown.throw("first"), + await thrown.throw("second"), +] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-31.json b/packages/codemode-rust/conformance/cases/lang-generator-31.json new file mode 100644 index 0000000000000..b193411e84fdc --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-31.json @@ -0,0 +1,32 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + { + "value": "next", + "done": false + }, + { + "value": "return pending", + "done": false + }, + { + "value": "second", + "done": true + }, + { + "value": "next", + "done": false + }, + { + "value": "throw pending", + "done": false + }, + { + "value": "second", + "done": true + } + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-32.js b/packages/codemode-rust/conformance/cases/lang-generator-32.js new file mode 100644 index 0000000000000..883848ddd814e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-32.js @@ -0,0 +1,20 @@ +const run = (iterator, operation) => { + function* generate() { + try { yield* iterator } catch (error) { return error.name } + } + const value = generate() + const first = value.next() + return operation === "next" ? first : value[operation]() +} +const iterable = (fields) => ({ [Symbol.iterator]: () => fields }) +const nextResult = run(iterable({ next: () => 1 }), "next") +const throwResult = run(iterable({ next: () => ({ done: false }), throw: () => 1 }), "throw") +const returnResult = run(iterable({ next: () => ({ done: false }), return: () => 1 }), "return") + +const badAsync = { + [Symbol.asyncIterator]: () => ({ next: 1 }), +} +async function* asynchronous() { + try { yield* badAsync } catch (error) { return error.name } +} +return [nextResult, throwResult, returnResult, await asynchronous().next()] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-32.json b/packages/codemode-rust/conformance/cases/lang-generator-32.json new file mode 100644 index 0000000000000..db45528ba5c0f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-32.json @@ -0,0 +1,24 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + { + "value": "TypeError", + "done": true + }, + { + "value": "TypeError", + "done": true + }, + { + "value": "TypeError", + "done": true + }, + { + "value": "TypeError", + "done": true + } + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-33.js b/packages/codemode-rust/conformance/cases/lang-generator-33.js new file mode 100644 index 0000000000000..83ca8abbb9eab --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-33.js @@ -0,0 +1,5 @@ +const captured = 4 +function* declaration(x, y = x, ...rest) { yield captured + y + rest[0] } +const expression = function* (x, y = x) { yield captured + y } +const object = { *method({ value }, extra = 1) { return captured + value + extra } } +return [declaration(2, undefined, 3).next(), expression(5).next(), object.method({ value: 6 }).next()] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-33.json b/packages/codemode-rust/conformance/cases/lang-generator-33.json new file mode 100644 index 0000000000000..6dd90814103e8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-33.json @@ -0,0 +1,20 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + { + "value": 9, + "done": false + }, + { + "value": 9, + "done": false + }, + { + "value": 11, + "done": true + } + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-34.js b/packages/codemode-rust/conformance/cases/lang-generator-34.js new file mode 100644 index 0000000000000..d36fa77ff4c48 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-34.js @@ -0,0 +1,13 @@ +const events = [] +function* binding() { + try { events.push("b1"); yield 1; events.push("b2"); yield 2; events.push("b3"); yield 3; yield 4 } + finally { events.push("binding close") } +} +const [first, , third] = binding() +function* assignment() { + try { yield 5; yield 6; yield 7 } + finally { events.push("assignment close") } +} +let head, rest +;[head, ...rest] = assignment() +return [first, third, head, rest, events] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-34.json b/packages/codemode-rust/conformance/cases/lang-generator-34.json new file mode 100644 index 0000000000000..032229a687ed9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-34.json @@ -0,0 +1,22 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 3, + 5, + [ + 6, + 7 + ], + [ + "b1", + "b2", + "b3", + "binding close", + "assignment close" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-35.js b/packages/codemode-rust/conformance/cases/lang-generator-35.js new file mode 100644 index 0000000000000..0052caa3f95aa --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-35.js @@ -0,0 +1,11 @@ +const events = [] +const iterator = { + [Symbol.iterator]: () => iterator, + next: () => ({ value: undefined, done: false }), + return: () => { events.push("close"); throw "close error" }, +} +let caught +try { + const [value = (() => { throw "binding error" })()] = iterator +} catch (error) { caught = error } +return [caught, events] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-35.json b/packages/codemode-rust/conformance/cases/lang-generator-35.json new file mode 100644 index 0000000000000..6030f8d3611da --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-35.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "binding error", + [ + "close" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-36.js b/packages/codemode-rust/conformance/cases/lang-generator-36.js new file mode 100644 index 0000000000000..fc2cfdb4b1dce --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-36.js @@ -0,0 +1,8 @@ +const events = [] +const iterator = { + [Symbol.iterator]: () => iterator, + next: () => ({ done: true }), + return: () => { events.push("close"); return {} }, +} +try { const [item = (() => { throw "default" })()] = iterator } catch {} +return events diff --git a/packages/codemode-rust/conformance/cases/lang-generator-36.json b/packages/codemode-rust/conformance/cases/lang-generator-36.json new file mode 100644 index 0000000000000..6e47e3dff4c03 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-36.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": [], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-37.js b/packages/codemode-rust/conformance/cases/lang-generator-37.js new file mode 100644 index 0000000000000..9896163d984c1 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-37.js @@ -0,0 +1,4 @@ +function* values() { yield 1; yield Promise.resolve(2); yield 3 } +const array = [...values()] +const args = ((...items) => items)(...values()) +return [array[0], array[1] instanceof Promise, await array[1], args[2]] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-37.json b/packages/codemode-rust/conformance/cases/lang-generator-37.json new file mode 100644 index 0000000000000..9523c4bdd5f3b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-37.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + true, + 2, + 3 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-41.js b/packages/codemode-rust/conformance/cases/lang-generator-41.js new file mode 100644 index 0000000000000..40583b65c3d32 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-41.js @@ -0,0 +1,12 @@ +const completed = [] +Promise.resolve().then(() => completed.push("reaction")) +for await (const item of []) {} +completed.push("after") + +const closed = [] +for await (const item of [1]) { + Promise.resolve().then(() => closed.push("reaction")) + break +} +closed.push("after") +return [completed, closed] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-41.json b/packages/codemode-rust/conformance/cases/lang-generator-41.json new file mode 100644 index 0000000000000..7d84904de40f5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-41.json @@ -0,0 +1,16 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "reaction", + "after" + ], + [ + "reaction", + "after" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-42.js b/packages/codemode-rust/conformance/cases/lang-generator-42.js new file mode 100644 index 0000000000000..a28f33f30aab9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-42.js @@ -0,0 +1,11 @@ +const events = [] +const iterator = { + [Symbol.iterator]: () => iterator, + next() { + iterator.return = () => { events.push("new"); return {} } + return { value: 1, done: false } + }, + return: () => { events.push("old"); return {} }, +} +const [item] = iterator +return [item, events] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-42.json b/packages/codemode-rust/conformance/cases/lang-generator-42.json new file mode 100644 index 0000000000000..fa76eed11ad7d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-42.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + [ + "new" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-50.js b/packages/codemode-rust/conformance/cases/lang-generator-50.js new file mode 100644 index 0000000000000..b6d5958f6ea22 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-50.js @@ -0,0 +1,8 @@ +function* items() { yield Promise.resolve(1); yield Promise.reject("bad"); yield 3 } +const settled = await Promise.allSettled(items()) +let all, any +try { await Promise.all(items()) } catch (error) { all = error } +try { await Promise.any((function* () { yield Promise.reject("a"); yield Promise.reject("b") })()) } +catch (error) { any = error.errors } +const race = await Promise.race((function* () { yield 4; yield Promise.resolve(5) })()) +return [settled, all, any, race] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-50.json b/packages/codemode-rust/conformance/cases/lang-generator-50.json new file mode 100644 index 0000000000000..d7f419b716f41 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-50.json @@ -0,0 +1,28 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + { + "status": "fulfilled", + "value": 1 + }, + { + "status": "rejected", + "reason": "bad" + }, + { + "status": "fulfilled", + "value": 3 + } + ], + "bad", + [ + "a", + "b" + ], + 4 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-51.js b/packages/codemode-rust/conformance/cases/lang-generator-51.js new file mode 100644 index 0000000000000..bf4e5836f1048 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-51.js @@ -0,0 +1,6 @@ +const events = [] +function* items() { events.push("first"); yield 1; events.push("second"); yield 2 } +const promise = Promise.all(items()) +events.push("after call") +await promise +return events diff --git a/packages/codemode-rust/conformance/cases/lang-generator-51.json b/packages/codemode-rust/conformance/cases/lang-generator-51.json new file mode 100644 index 0000000000000..3ef3252823762 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-51.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "first", + "second", + "after call" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-52.js b/packages/codemode-rust/conformance/cases/lang-generator-52.js new file mode 100644 index 0000000000000..a0dfe15009865 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-52.js @@ -0,0 +1,6 @@ +const events = [] +function* valid() { yield ["a", 1]; yield ["b", 2] } +function* invalid() { try { yield ["a", 1]; yield null; yield ["c", 3] } finally { events.push("close") } } +let name +try { Object.fromEntries(invalid()) } catch (error) { name = error.name } +return [Object.fromEntries(valid()), name, events] diff --git a/packages/codemode-rust/conformance/cases/lang-generator-52.json b/packages/codemode-rust/conformance/cases/lang-generator-52.json new file mode 100644 index 0000000000000..b94d9796dfb7a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-52.json @@ -0,0 +1,16 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + { + "a": 1, + "b": 2 + }, + "TypeError", + [ + "close" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-55.js b/packages/codemode-rust/conformance/cases/lang-generator-55.js new file mode 100644 index 0000000000000..c5ad7cf7fbff4 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-55.js @@ -0,0 +1,11 @@ +const events = [] +const acquisition = { [Symbol.iterator]: () => { events.push("acquire"); throw "acquisition" } } +const malformed = { + [Symbol.iterator]: () => malformed, + next: () => { events.push("next"); return 1 }, + return: () => { events.push("close"); return {} }, +} +for (const source of [acquisition, malformed]) { + try { Array.from(source) } catch {} +} +return events diff --git a/packages/codemode-rust/conformance/cases/lang-generator-55.json b/packages/codemode-rust/conformance/cases/lang-generator-55.json new file mode 100644 index 0000000000000..4aa2e9e3e4707 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-55.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "acquire", + "next" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-56.js b/packages/codemode-rust/conformance/cases/lang-generator-56.js new file mode 100644 index 0000000000000..b69938833bfbf --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-56.js @@ -0,0 +1,9 @@ +const events = [] +Promise.resolve().then(() => events.push("reaction")) +const iterator = { + [Symbol.iterator]: () => iterator, + next: () => { throw "next" }, +} +try { Array.from(iterator) } catch { events.push("catch") } +await Promise.resolve() +return events diff --git a/packages/codemode-rust/conformance/cases/lang-generator-56.json b/packages/codemode-rust/conformance/cases/lang-generator-56.json new file mode 100644 index 0000000000000..38f3b95d80102 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-56.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "catch", + "reaction" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-57.js b/packages/codemode-rust/conformance/cases/lang-generator-57.js new file mode 100644 index 0000000000000..3a864980a4528 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-57.js @@ -0,0 +1,16 @@ +const make = (ret) => ({ [Symbol.iterator]: () => ({ next: () => ({ done: false, value: [1] }), return: ret }) }) +const blanks = (ret) => ({ [Symbol.iterator]: () => ({ next: () => ({ done: false }), return: ret }) }) +const outcomes = [] +for (const [label, ret] of [ + ["null", () => null], + ["throws", () => { throw new RangeError("close") }], + ["ok", () => ({ done: true })], +]) { + function* loop() { for (const [a] of make(ret)) yield a } + function* pattern() { for ([ {} = yield ] of [blanks(ret)]) {} } + for (const g of [loop(), pattern()]) { + g.next() + try { g.return(7); outcomes.push(label + " quiet") } catch (e) { outcomes.push(label + " " + e.constructor.name) } + } +} +return outcomes diff --git a/packages/codemode-rust/conformance/cases/lang-generator-57.json b/packages/codemode-rust/conformance/cases/lang-generator-57.json new file mode 100644 index 0000000000000..c7b658d1e54b8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-57.json @@ -0,0 +1,14 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "null TypeError", + "null TypeError", + "throws RangeError", + "throws RangeError", + "ok quiet", + "ok quiet" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-edges.js b/packages/codemode-rust/conformance/cases/lang-generator-edges.js new file mode 100644 index 0000000000000..31bd7c6519d04 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-edges.js @@ -0,0 +1,105 @@ +const out = [] + +// re-entering a running generator is a TypeError +let self +function* reenter() { + try { + self.next() + } catch (e) { + yield e.constructor.name + } +} +self = reenter() +out.push(self.next().value) + +// throw() into a suspended generator, caught and handled inside +function* guarded() { + while (true) { + try { + yield "waiting" + } catch (e) { + yield "caught " + e + } + } +} +const gd = guarded() +gd.next() +out.push(gd.throw("x").value, gd.next().value, gd.throw("y").value) + +// an exception from a generator being spread is catchable by the spreading code +function* failing() { + yield 1 + throw new RangeError("stop") +} +try { + out.push([...failing()]) +} catch (e) { + out.push(e.name) +} + +// a destructuring default that throws closes the generator +function* tracked() { + try { + yield undefined + yield 2 + } finally { + out.push("closed") + } +} +try { + const [a = (() => { throw "default failed" })()] = tracked() + out.push(a) +} catch (e) { + out.push(e) +} + +// deep recursion through yield* +function* depth(n) { + if (n === 0) { + yield "bottom" + return + } + yield* depth(n - 1) +} +out.push([...depth(200)]) + +// return() while suspended inside try/finally that yields +function* finallyYields() { + try { + yield 1 + } finally { + yield "from finally" + } +} +const fy = finallyYields() +fy.next() +out.push(fy.return(5), fy.next(), fy.next()) + +// a generator consumed partly by for...of, then by next() +function* five() { + for (let i = 0; i < 5; i++) yield i +} +const fv = five() +for (const v of fv) { + if (v === 2) break +} +out.push(fv.next()) + +// the loop variable is a fresh binding each step, as closures see +const fns = [] +for (const v of five()) fns.push(() => v) +out.push(fns.map((f) => f())) + +// a yield inside a template, call argument and object literal +function* exprs() { + const r = `${yield 1}-${yield 2}` + const o = { a: yield 3, b: Math.max(yield 4, 0) } + return [r, o] +} +const ex = exprs() +const seen = [ex.next().value] +seen.push(ex.next("p").value, ex.next("q").value, ex.next(10).value) +seen.push(ex.next(20)) +out.push(seen) + +return out diff --git a/packages/codemode-rust/conformance/cases/lang-generator-edges.json b/packages/codemode-rust/conformance/cases/lang-generator-edges.json new file mode 100644 index 0000000000000..b7c951c165ba5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-edges.json @@ -0,0 +1,55 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "TypeError", + "caught x", + "waiting", + "caught y", + "RangeError", + "closed", + "default failed", + [ + "bottom" + ], + { + "value": "from finally", + "done": false + }, + { + "value": 5, + "done": true + }, + { + "done": true + }, + { + "done": true + }, + [ + 0, + 1, + 2, + 3, + 4 + ], + [ + 1, + 2, + 3, + 4, + { + "value": [ + "p-q", + { + "a": 10, + "b": 20 + } + ], + "done": true + } + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-resume.js b/packages/codemode-rust/conformance/cases/lang-generator-resume.js new file mode 100644 index 0000000000000..f4fb197e06701 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-resume.js @@ -0,0 +1,94 @@ +const log = [] +function* count(n) { + try { + for (let i = 0; i < n; i++) { + const sent = yield i + if (sent !== undefined) log.push("sent " + sent) + } + return "done" + } finally { + log.push("cleanup " + n) + } +} + +// for...of resumes on the same loop, nested generators included +const pairs = [] +for (const a of count(3)) for (const b of count(2)) pairs.push(a * 10 + b) + +// break closes the generator through its finally +for (const x of count(5)) if (x === 1) break + +// spread, rest destructuring, Array.from and Set consume it whole +const spread = [0, ...count(3), 9] +const [first, ...rest] = count(4) +const [p, q] = count(10) +const fromAll = Array.from(count(2)) +const set = new Set(count(3)) +const args = Math.max(...count(6)) + +// direct next() calls, with sent values and return() +const g = count(3) +const steps = [g.next("ignored"), g.next("a"), g.next("b"), g.next(), g.next(), g.return(7)] +const h = count(3) +h.next() +const returned = h.return("early") + +// yield* delegates and receives the completion value +function* outer() { + const r = yield* count(2) + yield "inner returned " + r + yield* [7, 8] +} +const delegated = [...outer()] + +// an exception thrown inside propagates to the consumer and finishes the generator +function* boom() { + yield 1 + throw new Error("bad") +} +let caught = null +const it = boom() +try { + for (const v of it) log.push("got " + v) +} catch (e) { + caught = e.message +} +const after = it.next() + +// generators that call functions and are resumed from callbacks +function* mapped(xs) { + for (const x of xs) yield [x].map((y) => y * 2)[0] +} +const viaCallbacks = [1, 2, 3].map((n) => [...mapped([n, n + 1])].join("+")) + +// a generator running while another is created and consumed inside it +function* nesting() { + const inner = [...count(2)] + yield inner.length + for (const v of count(2)) yield v + 100 +} + +// destructuring an argument and a generator that never yields +function* empty() {} +const [e1 = "default"] = empty() + +return { + pairs, + spread, + first, + rest, + p, + q, + fromAll, + set: [...set], + args, + steps, + returned, + delegated, + caught, + after, + viaCallbacks, + nesting: [...nesting()], + e1, + log, +} diff --git a/packages/codemode-rust/conformance/cases/lang-generator-resume.json b/packages/codemode-rust/conformance/cases/lang-generator-resume.json new file mode 100644 index 0000000000000..f63887dede7be --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-generator-resume.json @@ -0,0 +1,113 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "pairs": [ + 0, + 1, + 10, + 11, + 20, + 21 + ], + "spread": [ + 0, + 0, + 1, + 2, + 9 + ], + "first": 0, + "rest": [ + 1, + 2, + 3 + ], + "p": 0, + "q": 1, + "fromAll": [ + 0, + 1 + ], + "set": [ + 0, + 1, + 2 + ], + "args": 5, + "steps": [ + { + "value": 0, + "done": false + }, + { + "value": 1, + "done": false + }, + { + "value": 2, + "done": false + }, + { + "value": "done", + "done": true + }, + { + "done": true + }, + { + "value": 7, + "done": true + } + ], + "returned": { + "value": "early", + "done": true + }, + "delegated": [ + 0, + 1, + "inner returned done", + 7, + 8 + ], + "caught": "bad", + "after": { + "done": true + }, + "viaCallbacks": [ + "2+4", + "4+6", + "6+8" + ], + "nesting": [ + 2, + 100, + 101 + ], + "e1": "default", + "log": [ + "cleanup 2", + "cleanup 2", + "cleanup 2", + "cleanup 3", + "cleanup 5", + "cleanup 3", + "cleanup 4", + "cleanup 10", + "cleanup 2", + "cleanup 3", + "cleanup 6", + "sent a", + "sent b", + "cleanup 3", + "cleanup 3", + "cleanup 2", + "got 1", + "cleanup 2", + "cleanup 2" + ] + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-getters-setters.js b/packages/codemode-rust/conformance/cases/lang-getters-setters.js new file mode 100644 index 0000000000000..b8d45762b5bd5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-getters-setters.js @@ -0,0 +1,29 @@ +// Getters and setters in object literals: reads and writes through the chain, `this`, computed keys and names, a +// setter's assignment value, inherited setters on primitives, and how display, JSON, spread and iteration see them. +const log = [] +let n = 0 +const k = "z" +const base = { + get x() { log.push("get x"); return ++n }, + set x(v) { log.push("set x " + v); n = v * 10 }, + get [k]() { return this === base ? "base" : "child" }, + set only(v) { log.push("only " + v) }, +} +const child = Object.create(base) +const a = base.x +const assigned = (base.x = 5) +child.only = 3 +const names = [Object.getOwnPropertyDescriptor(base, "x").get.name, Object.getOwnPropertyDescriptor(base, "z").get.name] +let threw +try { const g = { get r() { return 1 } }; g.r = 2 } catch (e) { threw = e.message } +Object.defineProperty(String.prototype, "shout", { get() { return this.toUpperCase() }, set(v) { log.push("str " + v + this) }, configurable: true }) +const shout = "hi".shout +"yo".shout = 1 +delete String.prototype.shout +const it = { [Symbol.iterator]() { let i = 0; return { get next() { log.push("next"); return () => ({ get done() { return i++ > 1 }, get value() { return i } }) } } } } +const json = JSON.stringify({ a: 1, get b() { return [n] }, set c(v) {} }) +const spread = { ...base } +const { x: destructured, ...rest } = base +console.log(base, { inner: { get q() { return 1 } } }) +const thenable = await { get then() { log.push("then"); return (res) => res("adopted") } } +return [a, assigned, n, child.z, base.z, names, threw, shout, [...it], json, Object.keys(spread), destructured, Object.keys(rest), thenable, log] diff --git a/packages/codemode-rust/conformance/cases/lang-getters-setters.json b/packages/codemode-rust/conformance/cases/lang-getters-setters.json new file mode 100644 index 0000000000000..a9578b90c1828 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-getters-setters.json @@ -0,0 +1,47 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 5, + 52, + "child", + "base", + [ + "get x", + "get z" + ], + "Cannot set property 'r' of a data object which has only a getter.", + "HI", + [ + 1, + 2 + ], + "{\"a\":1,\"b\":[50]}", + [ + "x", + "z", + "only" + ], + 52, + [ + "z", + "only" + ], + "adopted", + [ + "get x", + "set x 5", + "only 3", + "str 1yo", + "get x", + "get x", + "then", + "next" + ] + ], + "logs": [ + "{\"x\":[Getter/Setter],\"z\":[Getter],\"only\":[Setter]} {\"inner\":{\"q\":[Getter]}}" + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-iterator-errors.js b/packages/codemode-rust/conformance/cases/lang-iterator-errors.js new file mode 100644 index 0000000000000..85c8cf79d7595 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-iterator-errors.js @@ -0,0 +1,58 @@ +// The errors for iterators that break the protocol, in each place a program opens or steps one. +const attempt = async (f) => { + try { + return await f() + } catch (error) { + return String(error) + } +} +const sync = (iterator) => ({ [Symbol.iterator]: () => iterator }) +const asyncOf = (iterator) => ({ [Symbol.asyncIterator]: () => iterator }) +const step = () => ({ done: false, value: 1 }) +return { + method: await attempt(() => [...{ [Symbol.iterator]: 1 }]), + methodResult: await attempt(() => [...{ [Symbol.iterator]: () => 1 }]), + next: await attempt(() => [...sync({ next: 5 })]), + nextResult: await attempt(() => [...sync({ next: () => 5 })]), + returnMethod: await attempt(() => { + for (const x of sync({ next: step, return: 7 })) break + }), + returnResult: await attempt(() => { + const [a] = sync({ next: step, return: () => 5 }) + }), + bodyErrorWins: await attempt(() => { + for (const x of sync({ next: step, return: 7 })) throw new Error("body") + }), + delegateReturn: await attempt(() => { + const g = (function* () { + yield* sync({ next: step, return: () => 5 }) + })() + g.next() + return g.return(1) + }), + delegateThrow: await attempt(() => { + const g = (function* () { + yield* sync({ next: step, throw: 3 }) + })() + g.next() + return g.throw(new Error("x")) + }), + asyncDelegate: await attempt(async () => { + const g = (async function* () { + yield* 5 + })() + return await g.next() + }), + asyncMethod: await attempt(async () => { + for await (const x of { [Symbol.asyncIterator]: 1 }); + }), + asyncNextResult: await attempt(async () => { + for await (const x of asyncOf({ next: async () => 5 })); + }), + asyncReturn: await attempt(async () => { + for await (const x of asyncOf({ next: async () => step(), return: 7 })) break + }), + asyncReturnResult: await attempt(async () => { + for await (const x of asyncOf({ next: async () => step(), return: () => 5 })) break + }), +} diff --git a/packages/codemode-rust/conformance/cases/lang-iterator-errors.json b/packages/codemode-rust/conformance/cases/lang-iterator-errors.json new file mode 100644 index 0000000000000..b0632777b4495 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-iterator-errors.json @@ -0,0 +1,22 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "method": "TypeError: Iterator method must be a function.", + "methodResult": "TypeError: Iterator method result must be an object.", + "next": "TypeError: Iterator next must be a function.", + "nextResult": "TypeError: Iterator next() result must be an object.", + "returnMethod": "TypeError: Iterator return must be a function.", + "returnResult": "TypeError: Iterator return() result must be an object.", + "bodyErrorWins": "Error: body", + "delegateReturn": "TypeError: Iterator return() result must be an object.", + "delegateThrow": "TypeError: Iterator throw must be a function.", + "asyncDelegate": "TypeError: yield* requires a compatible iterable value.", + "asyncMethod": "TypeError: Iterator method must be a function.", + "asyncNextResult": "TypeError: Iterator next() result must be an object.", + "asyncReturn": "TypeError: Iterator return must be a function.", + "asyncReturnResult": "TypeError: Iterator return() result must be an object." + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-iterator-helper-next.js b/packages/codemode-rust/conformance/cases/lang-iterator-helper-next.js new file mode 100644 index 0000000000000..b680f921d574e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-iterator-helper-next.js @@ -0,0 +1,24 @@ +// An iterator whose `next` is not a function fails when it is stepped, naming the call that made its record. +const attempt = (f) => { + try { + return f() + } catch (error) { + return String(error) + } +} +const helpers = Iterator.prototype +const wrapped = Iterator.from({ next: 5 }) +const mapped = wrapped.map((x) => x) +return { + from: attempt(() => Iterator.from({ next: 5 }).toArray()), + fromIterable: attempt(() => Iterator.from({ [Symbol.iterator]: () => ({}) }).next()), + kept: [attempt(() => wrapped.next()), attempt(() => [...wrapped]), attempt(() => mapped.next())], + helper: attempt(() => helpers.map.call({ next: 5 }, (x) => x).next()), + eager: [attempt(() => helpers.toArray.call({ next: 5 })), attempt(() => helpers.some.call({ next: null }, () => true))], + inner: attempt(() => [1].values().flatMap(() => ({ next: 5 })).next()), + aliased: (() => { + const make = Iterator.from + return attempt(() => make({ next: 5 }).next()) + })(), + nextResult: attempt(() => Iterator.from({ next: () => 5 }).next()), +} diff --git a/packages/codemode-rust/conformance/cases/lang-iterator-helper-next.json b/packages/codemode-rust/conformance/cases/lang-iterator-helper-next.json new file mode 100644 index 0000000000000..87e2c3fdc102b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-iterator-helper-next.json @@ -0,0 +1,25 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "from": "TypeError: Iterator.from is not a function.", + "fromIterable": "TypeError: Iterator.from is not a function.", + "kept": [ + "TypeError: Iterator.from is not a function.", + [], + { + "done": true + } + ], + "helper": "TypeError: helpers.map.call is not a function.", + "eager": [ + "TypeError: helpers.toArray.call is not a function.", + "TypeError: helpers.some.call is not a function." + ], + "inner": "TypeError: The called value is not a function.", + "aliased": "TypeError: make is not a function.", + "nextResult": "TypeError: Iterator next() result must be an object." + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-01.js b/packages/codemode-rust/conformance/cases/lang-labeled-01.js new file mode 100644 index 0000000000000..3a5dd1dccb15f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-01.js @@ -0,0 +1,8 @@ +const visited = [] +target: { + visited.push(1) + break target + visited.push(2) +} +visited.push(3) +return visited diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-01.json b/packages/codemode-rust/conformance/cases/lang-labeled-01.json new file mode 100644 index 0000000000000..0434dd9dc9f0e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-01.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 3 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-02.js b/packages/codemode-rust/conformance/cases/lang-labeled-02.js new file mode 100644 index 0000000000000..0fa78e029a02d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-02.js @@ -0,0 +1,10 @@ +const visited = [] +outer: for (const item of [1, 2, 3]) { + switch (item) { + case 2: + break outer + default: + visited.push(item) + } +} +return visited diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-02.json b/packages/codemode-rust/conformance/cases/lang-labeled-02.json new file mode 100644 index 0000000000000..1fd111f35f12a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-02.json @@ -0,0 +1,9 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-03.js b/packages/codemode-rust/conformance/cases/lang-labeled-03.js new file mode 100644 index 0000000000000..81025cc4eecf3 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-03.js @@ -0,0 +1,22 @@ +const counts = { while: 0, doWhile: 0, for: 0, forOf: 0, forIn: 0 } +whileLabel: while (true) { + counts.while++ + break whileLabel +} +doLabel: do { + counts.doWhile++ + break doLabel +} while (true) +forLabel: for (;;) { + counts.for++ + break forLabel +} +forOfLabel: for (const item of [1, 2]) { + counts.forOf++ + break forOfLabel +} +forInLabel: for (const key in { a: 1, b: 2 }) { + counts.forIn++ + break forInLabel +} +return counts diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-03.json b/packages/codemode-rust/conformance/cases/lang-labeled-03.json new file mode 100644 index 0000000000000..5ca5ef2bad488 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-03.json @@ -0,0 +1,13 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "while": 1, + "doWhile": 1, + "for": 1, + "forOf": 1, + "forIn": 1 + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-04.js b/packages/codemode-rust/conformance/cases/lang-labeled-04.js new file mode 100644 index 0000000000000..417b15b52ed2f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-04.js @@ -0,0 +1,10 @@ +const visited = [] +outer: { + inner: { + visited.push(1) + break outer + } + visited.push(2) +} +visited.push(3) +return visited diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-04.json b/packages/codemode-rust/conformance/cases/lang-labeled-04.json new file mode 100644 index 0000000000000..0434dd9dc9f0e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-04.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 3 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-05.js b/packages/codemode-rust/conformance/cases/lang-labeled-05.js new file mode 100644 index 0000000000000..f65bc9832c620 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-05.js @@ -0,0 +1,6 @@ +let count = 0 +label: for (let index = 0; index < 10; index++) { + count++ + continue label +} +return count diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-05.json b/packages/codemode-rust/conformance/cases/lang-labeled-05.json new file mode 100644 index 0000000000000..11b07e8e7aa76 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-05.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 10, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-06.js b/packages/codemode-rust/conformance/cases/lang-labeled-06.js new file mode 100644 index 0000000000000..b9f1d28327e04 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-06.js @@ -0,0 +1,11 @@ +let count = 0 +outer: for (let x = 0; x < 10; x++) { + let y = 0 + while (true) { + y++ + count++ + if (y === 1) continue outer + throw new Error("inner loop consumed the outer continue") + } +} +return count diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-06.json b/packages/codemode-rust/conformance/cases/lang-labeled-06.json new file mode 100644 index 0000000000000..11b07e8e7aa76 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-06.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 10, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-07.js b/packages/codemode-rust/conformance/cases/lang-labeled-07.js new file mode 100644 index 0000000000000..bf95fa20951cc --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-07.js @@ -0,0 +1,6 @@ +const visited = [] +outer: inner: for (const item of [1, 2, 3]) { + visited.push(item) + continue outer +} +return visited diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-07.json b/packages/codemode-rust/conformance/cases/lang-labeled-07.json new file mode 100644 index 0000000000000..1e47b24c5cd55 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-07.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 2, + 3 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-08.js b/packages/codemode-rust/conformance/cases/lang-labeled-08.js new file mode 100644 index 0000000000000..ffb1997dcf913 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-08.js @@ -0,0 +1,23 @@ +const counts = { while: 0, doWhile: 0, forOf: 0, forIn: 0 } +let index = 0 +whileLabel: while (index++ < 2) { + counts.while++ + continue whileLabel +} + +index = 0 +doLabel: do { + counts.doWhile++ + if (index++ < 1) continue doLabel +} while (index < 2) + +forOfLabel: for (const item of [1, 2]) { + counts.forOf += item + continue forOfLabel +} + +forInLabel: for (const key in { a: 1, b: 2 }) { + counts.forIn++ + continue forInLabel +} +return counts diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-08.json b/packages/codemode-rust/conformance/cases/lang-labeled-08.json new file mode 100644 index 0000000000000..b08c687717688 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-08.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "while": 2, + "doWhile": 2, + "forOf": 3, + "forIn": 2 + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-09.js b/packages/codemode-rust/conformance/cases/lang-labeled-09.js new file mode 100644 index 0000000000000..65b2ece85c3a1 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-09.js @@ -0,0 +1,20 @@ +const classic = [] +classicLabel: for (let index = 0; index < 3; index++) { + classic.push(() => index) + continue classicLabel +} + +const nested = [] +nestedLabel: for (let outer = 0; outer < 3; outer++) { + for (let inner = 0; inner < 2; inner++) { + nested.push(() => outer) + continue nestedLabel + } +} + +const forOf = [] +forOfLabel: for (const item of [1, 2, 3]) { + forOf.push(() => item) + continue forOfLabel +} +return [classic.map((read) => read()), nested.map((read) => read()), forOf.map((read) => read())] diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-09.json b/packages/codemode-rust/conformance/cases/lang-labeled-09.json new file mode 100644 index 0000000000000..2cc0b855a20ee --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-09.json @@ -0,0 +1,23 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 0, + 1, + 2 + ], + [ + 0, + 1, + 2 + ], + [ + 1, + 2, + 3 + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-10.js b/packages/codemode-rust/conformance/cases/lang-labeled-10.js new file mode 100644 index 0000000000000..7235213c294d5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-10.js @@ -0,0 +1,19 @@ +const visited = [] +breakWins: for (const item of [1, 2, 3]) { + try { + continue breakWins + } finally { + visited.push(item) + break breakWins + } +} + +continueWins: for (const item of [4, 5, 6]) { + try { + break continueWins + } finally { + visited.push(item) + continue continueWins + } +} +return visited diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-10.json b/packages/codemode-rust/conformance/cases/lang-labeled-10.json new file mode 100644 index 0000000000000..0f2ec84ab4b5a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-10.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 4, + 5, + 6 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-11.js b/packages/codemode-rust/conformance/cases/lang-labeled-11.js new file mode 100644 index 0000000000000..6f177e4e63164 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-11.js @@ -0,0 +1,5 @@ +do { + target: { + continue target + } +} while (false) diff --git a/packages/codemode-rust/conformance/cases/lang-labeled-11.json b/packages/codemode-rust/conformance/cases/lang-labeled-11.json new file mode 100644 index 0000000000000..ded0ebe5c79f8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-labeled-11.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ParseError", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-01.js b/packages/codemode-rust/conformance/cases/lang-lexical-01.js new file mode 100644 index 0000000000000..b874e459eeb6c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-01.js @@ -0,0 +1,6 @@ +const errors = [] +try { programLet; let programLet } catch (error) { errors.push(error.name) } +try { programConst; const programConst = 1 } catch (error) { errors.push(error.name) } +try { { blockLet; let blockLet } } catch (error) { errors.push(error.name) } +try { { blockConst; const blockConst = 1 } } catch (error) { errors.push(error.name) } +return errors diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-01.json b/packages/codemode-rust/conformance/cases/lang-lexical-01.json new file mode 100644 index 0000000000000..faf88b3b8c3cd --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-01.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "ReferenceError", + "ReferenceError", + "ReferenceError", + "ReferenceError" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-02.js b/packages/codemode-rust/conformance/cases/lang-lexical-02.js new file mode 100644 index 0000000000000..1185f85ab8c64 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-02.js @@ -0,0 +1,11 @@ +const errors = [] +try { { let item = item + 1 } } catch (error) { errors.push(error.name) } +try { { const item = item + 1 } } catch (error) { errors.push(error.name) } +try { + { + function assign() { item = 1 } + assign() + let item + } +} catch (error) { errors.push(error.name) } +return errors diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-02.json b/packages/codemode-rust/conformance/cases/lang-lexical-02.json new file mode 100644 index 0000000000000..4d30508eb5d99 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-02.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "ReferenceError", + "ReferenceError", + "ReferenceError" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-03.js b/packages/codemode-rust/conformance/cases/lang-lexical-03.js new file mode 100644 index 0000000000000..225f3f063f549 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-03.js @@ -0,0 +1,4 @@ +const errors = [] +try { let item = [1]; for (let item of item) {} } catch (error) { errors.push(error.name) } +try { let item = { value: 1 }; for (let item in item) {} } catch (error) { errors.push(error.name) } +return errors diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-03.json b/packages/codemode-rust/conformance/cases/lang-lexical-03.json new file mode 100644 index 0000000000000..45b9640fdc51f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-03.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "ReferenceError", + "ReferenceError" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-04.js b/packages/codemode-rust/conformance/cases/lang-lexical-04.js new file mode 100644 index 0000000000000..b760337041edd --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-04.js @@ -0,0 +1,14 @@ +const single = [] +for (let index = 0; index < 5; ++index) single.push(() => index) + +const left = [] +const right = [] +for (let first = 0, second = 10; first < 5; ++first, ++second) { + left.push(() => first) + right.push(() => second) +} +return [ + single.map((read) => read()), + left.map((read) => read()), + right.map((read) => read()), +] diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-04.json b/packages/codemode-rust/conformance/cases/lang-lexical-04.json new file mode 100644 index 0000000000000..3500970ebac4b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-04.json @@ -0,0 +1,29 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 0, + 1, + 2, + 3, + 4 + ], + [ + 0, + 1, + 2, + 3, + 4 + ], + [ + 10, + 11, + 12, + 13, + 14 + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-05.js b/packages/codemode-rust/conformance/cases/lang-lexical-05.js new file mode 100644 index 0000000000000..bb4abca23d1a7 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-05.js @@ -0,0 +1,6 @@ +const values = [] +for (let item of [1, 2, 3]) values.push(() => item) + +const keys = {} +for (let key in { first: 1, second: 2, third: 3 }) keys[key] = () => key +return [values.map((read) => read()), keys.first(), keys.second(), keys.third()] diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-05.json b/packages/codemode-rust/conformance/cases/lang-lexical-05.json new file mode 100644 index 0000000000000..af11572ad87b5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-05.json @@ -0,0 +1,16 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 1, + 2, + 3 + ], + "first", + "second", + "third" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-06.js b/packages/codemode-rust/conformance/cases/lang-lexical-06.js new file mode 100644 index 0000000000000..6f583a914af44 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-06.js @@ -0,0 +1,11 @@ +let before +let testRead +let bodyRead +let updateRead +let run = true +for ( + let item = "outside", ignored = before = () => item; + run && (item = "inside", testRead = () => item); + updateRead = () => item +) bodyRead = () => item, run = false +return [before(), testRead(), bodyRead(), updateRead()] diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-06.json b/packages/codemode-rust/conformance/cases/lang-lexical-06.json new file mode 100644 index 0000000000000..d74aa59388f9b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-06.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "outside", + "inside", + "inside", + "inside" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-07.js b/packages/codemode-rust/conformance/cases/lang-lexical-07.js new file mode 100644 index 0000000000000..b6f97b50d4f8e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-07.js @@ -0,0 +1,10 @@ +let item = "outside" +let discriminantRead +let selectorRead +let statementRead +switch ((discriminantRead = () => item, null)) { + case (selectorRead = () => item, null): + statementRead = () => item + let item = "inside" +} +return [discriminantRead(), selectorRead(), statementRead()] diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-07.json b/packages/codemode-rust/conformance/cases/lang-lexical-07.json new file mode 100644 index 0000000000000..7a230867263e2 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-07.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "outside", + "inside", + "inside" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-08.js b/packages/codemode-rust/conformance/cases/lang-lexical-08.js new file mode 100644 index 0000000000000..19f9dbc529bfb --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-08.js @@ -0,0 +1,11 @@ +let item = "outside" +let firstRead +let secondRead +switch (null) { + case null: + let item = "inside" + firstRead = () => item + case null: + secondRead = () => item +} +return [firstRead(), secondRead(), item] diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-08.json b/packages/codemode-rust/conformance/cases/lang-lexical-08.json new file mode 100644 index 0000000000000..9ca198e487493 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-08.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "inside", + "inside", + "outside" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-09.js b/packages/codemode-rust/conformance/cases/lang-lexical-09.js new file mode 100644 index 0000000000000..f23350bdc99ec --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-09.js @@ -0,0 +1,7 @@ +function prior(first, second = first, third = second) { return [first, second, third] } +function later(first = second, second) { return first } +function self(item = item) { return item } +function failure(run) { + try { return run() } catch (error) { return error.name } +} +return [prior(3), failure(later), failure(self)] diff --git a/packages/codemode-rust/conformance/cases/lang-lexical-09.json b/packages/codemode-rust/conformance/cases/lang-lexical-09.json new file mode 100644 index 0000000000000..4e44e61faf054 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-lexical-09.json @@ -0,0 +1,15 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 3, + 3, + 3 + ], + "ReferenceError", + "ReferenceError" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-new-01.js b/packages/codemode-rust/conformance/cases/lang-new-01.js new file mode 100644 index 0000000000000..fc6ea2dd2077c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-01.js @@ -0,0 +1 @@ +return new Number(42) diff --git a/packages/codemode-rust/conformance/cases/lang-new-01.json b/packages/codemode-rust/conformance/cases/lang-new-01.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-01.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-new-02.js b/packages/codemode-rust/conformance/cases/lang-new-02.js new file mode 100644 index 0000000000000..d05556ee9c106 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-02.js @@ -0,0 +1 @@ +return new String("a") diff --git a/packages/codemode-rust/conformance/cases/lang-new-02.json b/packages/codemode-rust/conformance/cases/lang-new-02.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-02.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-new-03.js b/packages/codemode-rust/conformance/cases/lang-new-03.js new file mode 100644 index 0000000000000..da15a865fba3b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-03.js @@ -0,0 +1 @@ +return new Math.abs(1) diff --git a/packages/codemode-rust/conformance/cases/lang-new-03.json b/packages/codemode-rust/conformance/cases/lang-new-03.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-03.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-new-04.js b/packages/codemode-rust/conformance/cases/lang-new-04.js new file mode 100644 index 0000000000000..7cf23d0ea7bb2 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-04.js @@ -0,0 +1 @@ +return new tools.echo() diff --git a/packages/codemode-rust/conformance/cases/lang-new-04.json b/packages/codemode-rust/conformance/cases/lang-new-04.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-04.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-new-05.js b/packages/codemode-rust/conformance/cases/lang-new-05.js new file mode 100644 index 0000000000000..3a20be3f87c2c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-05.js @@ -0,0 +1 @@ +return new (1)() diff --git a/packages/codemode-rust/conformance/cases/lang-new-05.json b/packages/codemode-rust/conformance/cases/lang-new-05.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-05.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-new-06.js b/packages/codemode-rust/conformance/cases/lang-new-06.js new file mode 100644 index 0000000000000..d8223e30552e3 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-06.js @@ -0,0 +1 @@ +const Date = 5; return new Date() diff --git a/packages/codemode-rust/conformance/cases/lang-new-06.json b/packages/codemode-rust/conformance/cases/lang-new-06.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-06.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-new-07.js b/packages/codemode-rust/conformance/cases/lang-new-07.js new file mode 100644 index 0000000000000..3e65cc025807a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-07.js @@ -0,0 +1 @@ +function Point(x) { return { x } }; return new Point(1) diff --git a/packages/codemode-rust/conformance/cases/lang-new-07.json b/packages/codemode-rust/conformance/cases/lang-new-07.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-07.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-new-08.js b/packages/codemode-rust/conformance/cases/lang-new-08.js new file mode 100644 index 0000000000000..77b7b72e6f44f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-08.js @@ -0,0 +1 @@ +const make = () => ({}); return new make() diff --git a/packages/codemode-rust/conformance/cases/lang-new-08.json b/packages/codemode-rust/conformance/cases/lang-new-08.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-08.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-new-09.js b/packages/codemode-rust/conformance/cases/lang-new-09.js new file mode 100644 index 0000000000000..3fc387cbde4cc --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-09.js @@ -0,0 +1 @@ +try { new Number(1) } catch (error) { return [error.name, error instanceof TypeError] } diff --git a/packages/codemode-rust/conformance/cases/lang-new-09.json b/packages/codemode-rust/conformance/cases/lang-new-09.json new file mode 100644 index 0000000000000..a129d660eda7e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-09.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "TypeError", + true + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-new-10.js b/packages/codemode-rust/conformance/cases/lang-new-10.js new file mode 100644 index 0000000000000..e57e004f5c7cd --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-10.js @@ -0,0 +1 @@ +return new Function("return 1") diff --git a/packages/codemode-rust/conformance/cases/lang-new-10.json b/packages/codemode-rust/conformance/cases/lang-new-10.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-10.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-new-11.js b/packages/codemode-rust/conformance/cases/lang-new-11.js new file mode 100644 index 0000000000000..e57e004f5c7cd --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-11.js @@ -0,0 +1 @@ +return new Function("return 1") diff --git a/packages/codemode-rust/conformance/cases/lang-new-11.json b/packages/codemode-rust/conformance/cases/lang-new-11.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-11.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-new-12.js b/packages/codemode-rust/conformance/cases/lang-new-12.js new file mode 100644 index 0000000000000..a9e6b97726593 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-12.js @@ -0,0 +1 @@ +class A {}; return new A() diff --git a/packages/codemode-rust/conformance/cases/lang-new-12.json b/packages/codemode-rust/conformance/cases/lang-new-12.json new file mode 100644 index 0000000000000..e98f492328df0 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-new-12.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": {}, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-02.js b/packages/codemode-rust/conformance/cases/lang-promise-02.js new file mode 100644 index 0000000000000..b7b839aa69c63 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-02.js @@ -0,0 +1,8 @@ +const fail = async () => { throw new Error("boom") } +const promise = fail() +try { + await promise + return "no" +} catch (error) { + return error.message +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-02.json b/packages/codemode-rust/conformance/cases/lang-promise-02.json new file mode 100644 index 0000000000000..10038e142c2a1 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-02.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "boom", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-05.js b/packages/codemode-rust/conformance/cases/lang-promise-05.js new file mode 100644 index 0000000000000..ee4f219feac4e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-05.js @@ -0,0 +1 @@ +return await 42 diff --git a/packages/codemode-rust/conformance/cases/lang-promise-05.json b/packages/codemode-rust/conformance/cases/lang-promise-05.json new file mode 100644 index 0000000000000..1a93c28d4a431 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-05.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 42, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-06.js b/packages/codemode-rust/conformance/cases/lang-promise-06.js new file mode 100644 index 0000000000000..f0db77956bb5d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-06.js @@ -0,0 +1 @@ +const x = await "s"; return x diff --git a/packages/codemode-rust/conformance/cases/lang-promise-06.json b/packages/codemode-rust/conformance/cases/lang-promise-06.json new file mode 100644 index 0000000000000..d23cdc286dc37 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-06.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "s", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-07.js b/packages/codemode-rust/conformance/cases/lang-promise-07.js new file mode 100644 index 0000000000000..26c6dfe4288a1 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-07.js @@ -0,0 +1 @@ +return await null diff --git a/packages/codemode-rust/conformance/cases/lang-promise-07.json b/packages/codemode-rust/conformance/cases/lang-promise-07.json new file mode 100644 index 0000000000000..a72fb13f7341c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-07.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": null, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-08.js b/packages/codemode-rust/conformance/cases/lang-promise-08.js new file mode 100644 index 0000000000000..efed0e0e72e9d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-08.js @@ -0,0 +1 @@ +return (await [1, 2]).length diff --git a/packages/codemode-rust/conformance/cases/lang-promise-08.json b/packages/codemode-rust/conformance/cases/lang-promise-08.json new file mode 100644 index 0000000000000..b1e227bee5d89 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-08.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 2, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-10.js b/packages/codemode-rust/conformance/cases/lang-promise-10.js new file mode 100644 index 0000000000000..88d598486f352 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-10.js @@ -0,0 +1,3 @@ +const p = Promise.resolve(1) +console.log(p) +return typeof p diff --git a/packages/codemode-rust/conformance/cases/lang-promise-10.json b/packages/codemode-rust/conformance/cases/lang-promise-10.json new file mode 100644 index 0000000000000..d05e50ae86036 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-10.json @@ -0,0 +1,9 @@ +{ + "bindings": {}, + "ok": true, + "value": "object", + "logs": [ + "[Promise (await it to get its value)]" + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-100.js b/packages/codemode-rust/conformance/cases/lang-promise-100.js new file mode 100644 index 0000000000000..0ecf3aa684538 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-100.js @@ -0,0 +1,4 @@ +const { promise, resolve } = Promise.withResolvers() +tools.host.gated({ id: 1 }).then(resolve) +tools.host.open({ id: 1 }) +return await promise diff --git a/packages/codemode-rust/conformance/cases/lang-promise-100.json b/packages/codemode-rust/conformance/cases/lang-promise-100.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-100.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-11.js b/packages/codemode-rust/conformance/cases/lang-promise-11.js new file mode 100644 index 0000000000000..013ea09bead87 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-11.js @@ -0,0 +1,7 @@ +const p = tools.host.fail({}) +try { + await p + return "no" +} catch (e) { + return e.message +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-11.json b/packages/codemode-rust/conformance/cases/lang-promise-11.json new file mode 100644 index 0000000000000..21c49a3174aaf --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-11.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "No function at tools.host.fail.", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-12.js b/packages/codemode-rust/conformance/cases/lang-promise-12.js new file mode 100644 index 0000000000000..947bd77363632 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-12.js @@ -0,0 +1,2 @@ +tools.host.pending({ id: 1 }) +return "done" diff --git a/packages/codemode-rust/conformance/cases/lang-promise-12.json b/packages/codemode-rust/conformance/cases/lang-promise-12.json new file mode 100644 index 0000000000000..558ca4d312554 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-12.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-13.js b/packages/codemode-rust/conformance/cases/lang-promise-13.js new file mode 100644 index 0000000000000..1ba87314f63ee --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-13.js @@ -0,0 +1,2 @@ +tools.host.fail({}) +return "done" diff --git a/packages/codemode-rust/conformance/cases/lang-promise-13.json b/packages/codemode-rust/conformance/cases/lang-promise-13.json new file mode 100644 index 0000000000000..558ca4d312554 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-13.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-14.js b/packages/codemode-rust/conformance/cases/lang-promise-14.js new file mode 100644 index 0000000000000..76ca051509f2e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-14.js @@ -0,0 +1,3 @@ +const fail = async () => { throw new Error("boom") } +fail() +return "done" diff --git a/packages/codemode-rust/conformance/cases/lang-promise-14.json b/packages/codemode-rust/conformance/cases/lang-promise-14.json new file mode 100644 index 0000000000000..558ca4d312554 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-14.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-15.js b/packages/codemode-rust/conformance/cases/lang-promise-15.js new file mode 100644 index 0000000000000..ca5d2e9653caa --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-15.js @@ -0,0 +1,2 @@ +for (let i = 0; i < 100; i += 1) Promise.reject(new Error("x".repeat(1_000))) +return "done" diff --git a/packages/codemode-rust/conformance/cases/lang-promise-15.json b/packages/codemode-rust/conformance/cases/lang-promise-15.json new file mode 100644 index 0000000000000..558ca4d312554 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-15.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-16.js b/packages/codemode-rust/conformance/cases/lang-promise-16.js new file mode 100644 index 0000000000000..af17cf537c579 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-16.js @@ -0,0 +1,2 @@ +Promise.reject(new Error("boom")) +return "x".repeat(500) diff --git a/packages/codemode-rust/conformance/cases/lang-promise-16.json b/packages/codemode-rust/conformance/cases/lang-promise-16.json new file mode 100644 index 0000000000000..b5dedd5052e56 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-16.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-17.js b/packages/codemode-rust/conformance/cases/lang-promise-17.js new file mode 100644 index 0000000000000..7191e1ed39b94 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-17.js @@ -0,0 +1,6 @@ +const run = async () => { + await tools.host.pending({ id: 1 }) + tools.host.fail({}) +} +run() +return "done" diff --git a/packages/codemode-rust/conformance/cases/lang-promise-17.json b/packages/codemode-rust/conformance/cases/lang-promise-17.json new file mode 100644 index 0000000000000..558ca4d312554 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-17.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-18.js b/packages/codemode-rust/conformance/cases/lang-promise-18.js new file mode 100644 index 0000000000000..1a1373e83f448 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-18.js @@ -0,0 +1,4 @@ +Promise.reject(new Error("first")) +tools.host.fail({}) +Promise.reject(new Error("third")) +return "done" diff --git a/packages/codemode-rust/conformance/cases/lang-promise-18.json b/packages/codemode-rust/conformance/cases/lang-promise-18.json new file mode 100644 index 0000000000000..558ca4d312554 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-18.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-19.js b/packages/codemode-rust/conformance/cases/lang-promise-19.js new file mode 100644 index 0000000000000..c36a121812952 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-19.js @@ -0,0 +1,6 @@ +const outer = async () => { + Promise.reject(new Error("inner")) + throw new Error("outer") +} +outer() +return "done" diff --git a/packages/codemode-rust/conformance/cases/lang-promise-19.json b/packages/codemode-rust/conformance/cases/lang-promise-19.json new file mode 100644 index 0000000000000..558ca4d312554 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-19.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-20.js b/packages/codemode-rust/conformance/cases/lang-promise-20.js new file mode 100644 index 0000000000000..ce041923c264f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-20.js @@ -0,0 +1,3 @@ +tools.host.interrupt({}) +Promise.all([tools.host.interrupt({})]) +return "done" diff --git a/packages/codemode-rust/conformance/cases/lang-promise-20.json b/packages/codemode-rust/conformance/cases/lang-promise-20.json new file mode 100644 index 0000000000000..558ca4d312554 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-20.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-21.js b/packages/codemode-rust/conformance/cases/lang-promise-21.js new file mode 100644 index 0000000000000..b7279665a773a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-21.js @@ -0,0 +1,2 @@ +tools.host.pending({ id: 1 }) +throw new Error("boom") diff --git a/packages/codemode-rust/conformance/cases/lang-promise-21.json b/packages/codemode-rust/conformance/cases/lang-promise-21.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-21.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-22.js b/packages/codemode-rust/conformance/cases/lang-promise-22.js new file mode 100644 index 0000000000000..9d000782477c5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-22.js @@ -0,0 +1,6 @@ +const launch = async () => { + tools.host.pending({ id: 1 }) + Promise.all([tools.host.pending({ id: 2 })]) + return "returned" +} +return await launch() diff --git a/packages/codemode-rust/conformance/cases/lang-promise-22.json b/packages/codemode-rust/conformance/cases/lang-promise-22.json new file mode 100644 index 0000000000000..50a4eb32a2e09 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-22.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "returned", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-29.js b/packages/codemode-rust/conformance/cases/lang-promise-29.js new file mode 100644 index 0000000000000..95b3241f5fd7f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-29.js @@ -0,0 +1 @@ +return Promise.resolve(1) + 1 diff --git a/packages/codemode-rust/conformance/cases/lang-promise-29.json b/packages/codemode-rust/conformance/cases/lang-promise-29.json new file mode 100644 index 0000000000000..8e0476d59757b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-29.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "InvalidDataValue", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-30.js b/packages/codemode-rust/conformance/cases/lang-promise-30.js new file mode 100644 index 0000000000000..6c4d8d02704d1 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-30.js @@ -0,0 +1,5 @@ +const all = Promise.all([Promise.resolve(1)]) +const settled = Promise.allSettled([Promise.reject("no")]) +const race = Promise.race([Promise.resolve(2)]) +const promises = [all instanceof Promise, settled instanceof Promise, race instanceof Promise] +return [promises, await all, await settled, await race] diff --git a/packages/codemode-rust/conformance/cases/lang-promise-30.json b/packages/codemode-rust/conformance/cases/lang-promise-30.json new file mode 100644 index 0000000000000..ce71e20b13edf --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-30.json @@ -0,0 +1,23 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + true, + true, + true + ], + [ + 1 + ], + [ + { + "status": "rejected", + "reason": "no" + } + ], + 2 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-32.js b/packages/codemode-rust/conformance/cases/lang-promise-32.js new file mode 100644 index 0000000000000..58565ac9a3ceb --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-32.js @@ -0,0 +1,7 @@ +const aggregate = Promise.all([tools.host.fail({})]) +try { + await aggregate + return "no" +} catch (error) { + return error.message +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-32.json b/packages/codemode-rust/conformance/cases/lang-promise-32.json new file mode 100644 index 0000000000000..21c49a3174aaf --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-32.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "No function at tools.host.fail.", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-39.js b/packages/codemode-rust/conformance/cases/lang-promise-39.js new file mode 100644 index 0000000000000..d8c0bffb8c7c3 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-39.js @@ -0,0 +1 @@ +return await Promise.all([]) diff --git a/packages/codemode-rust/conformance/cases/lang-promise-39.json b/packages/codemode-rust/conformance/cases/lang-promise-39.json new file mode 100644 index 0000000000000..6e47e3dff4c03 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-39.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": [], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-40.js b/packages/codemode-rust/conformance/cases/lang-promise-40.js new file mode 100644 index 0000000000000..47e6c362fd384 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-40.js @@ -0,0 +1,6 @@ +try { + await Promise.all([tools.host.echo({ id: 1 }), tools.host.fail({})]) + return "no" +} catch (e) { + return e.message +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-40.json b/packages/codemode-rust/conformance/cases/lang-promise-40.json new file mode 100644 index 0000000000000..f92f137434ad0 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-40.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "No function at tools.host.echo.", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-43.js b/packages/codemode-rust/conformance/cases/lang-promise-43.js new file mode 100644 index 0000000000000..6a4f3b9d1686a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-43.js @@ -0,0 +1,11 @@ +const failLater = async () => { + await tools.host.pending({ id: 1 }) + throw new Error("later") +} +const aggregate = Promise.all([Promise.reject(new Error("first")), failLater()]) +try { + await aggregate + return "no" +} catch (error) { + return error.message +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-43.json b/packages/codemode-rust/conformance/cases/lang-promise-43.json new file mode 100644 index 0000000000000..e1fbc5b2a787f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-43.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "first", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-44.js b/packages/codemode-rust/conformance/cases/lang-promise-44.js new file mode 100644 index 0000000000000..f64ea5e5b859b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-44.js @@ -0,0 +1 @@ +return await Promise.all(42) diff --git a/packages/codemode-rust/conformance/cases/lang-promise-44.json b/packages/codemode-rust/conformance/cases/lang-promise-44.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-44.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-46.js b/packages/codemode-rust/conformance/cases/lang-promise-46.js new file mode 100644 index 0000000000000..979cb6e0a9694 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-46.js @@ -0,0 +1,7 @@ +const settled = await Promise.allSettled([ + tools.host.echo({ id: 5 }), + tools.host.fail({}), + "plain", + Promise.reject(new Error("boom")), +]) +return settled diff --git a/packages/codemode-rust/conformance/cases/lang-promise-46.json b/packages/codemode-rust/conformance/cases/lang-promise-46.json new file mode 100644 index 0000000000000..693756702632b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-46.json @@ -0,0 +1,33 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + { + "status": "rejected", + "reason": { + "name": "Error", + "message": "No function at tools.host.echo." + } + }, + { + "status": "rejected", + "reason": { + "name": "Error", + "message": "No function at tools.host.fail." + } + }, + { + "status": "fulfilled", + "value": "plain" + }, + { + "status": "rejected", + "reason": { + "name": "Error", + "message": "boom" + } + } + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-47.js b/packages/codemode-rust/conformance/cases/lang-promise-47.js new file mode 100644 index 0000000000000..48220167cc188 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-47.js @@ -0,0 +1,2 @@ +const settled = await Promise.allSettled([tools.host.fail({}), tools.host.fail({})]) +return settled.filter((s) => s.status === "rejected").length diff --git a/packages/codemode-rust/conformance/cases/lang-promise-47.json b/packages/codemode-rust/conformance/cases/lang-promise-47.json new file mode 100644 index 0000000000000..b1e227bee5d89 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-47.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 2, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-50.js b/packages/codemode-rust/conformance/cases/lang-promise-50.js new file mode 100644 index 0000000000000..77a54850b184d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-50.js @@ -0,0 +1,5 @@ +const nested = Promise.all([ + tools.host.pending({ id: 1 }), + tools.host.pending({ id: 2 }), +]) +return await Promise.race(["immediate", nested]) diff --git a/packages/codemode-rust/conformance/cases/lang-promise-50.json b/packages/codemode-rust/conformance/cases/lang-promise-50.json new file mode 100644 index 0000000000000..132611925683c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-50.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "immediate", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-51.js b/packages/codemode-rust/conformance/cases/lang-promise-51.js new file mode 100644 index 0000000000000..5c72772ab3518 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-51.js @@ -0,0 +1,6 @@ +try { + await Promise.race([tools.host.fail({}), tools.host.pending({ id: 1 })]) + return "no" +} catch (e) { + return e.message +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-51.json b/packages/codemode-rust/conformance/cases/lang-promise-51.json new file mode 100644 index 0000000000000..21c49a3174aaf --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-51.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "No function at tools.host.fail.", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-52.js b/packages/codemode-rust/conformance/cases/lang-promise-52.js new file mode 100644 index 0000000000000..f5185cdd62133 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-52.js @@ -0,0 +1 @@ +return await Promise.race([tools.host.pending({ id: 1 }), "immediate"]) diff --git a/packages/codemode-rust/conformance/cases/lang-promise-52.json b/packages/codemode-rust/conformance/cases/lang-promise-52.json new file mode 100644 index 0000000000000..132611925683c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-52.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "immediate", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-53.js b/packages/codemode-rust/conformance/cases/lang-promise-53.js new file mode 100644 index 0000000000000..e8eaeabe83e56 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-53.js @@ -0,0 +1 @@ +return await Promise.race(["winner", tools.host.fail({})]) diff --git a/packages/codemode-rust/conformance/cases/lang-promise-53.json b/packages/codemode-rust/conformance/cases/lang-promise-53.json new file mode 100644 index 0000000000000..68766d1101019 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-53.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "winner", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-54.js b/packages/codemode-rust/conformance/cases/lang-promise-54.js new file mode 100644 index 0000000000000..92acfebe935ba --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-54.js @@ -0,0 +1 @@ +return await Promise.race([]) diff --git a/packages/codemode-rust/conformance/cases/lang-promise-54.json b/packages/codemode-rust/conformance/cases/lang-promise-54.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-54.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-55.js b/packages/codemode-rust/conformance/cases/lang-promise-55.js new file mode 100644 index 0000000000000..52d8a468a3659 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-55.js @@ -0,0 +1 @@ +return await Promise.resolve(42) diff --git a/packages/codemode-rust/conformance/cases/lang-promise-55.json b/packages/codemode-rust/conformance/cases/lang-promise-55.json new file mode 100644 index 0000000000000..1a93c28d4a431 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-55.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 42, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-56.js b/packages/codemode-rust/conformance/cases/lang-promise-56.js new file mode 100644 index 0000000000000..460fe20fe2000 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-56.js @@ -0,0 +1 @@ +return await Promise.resolve(Promise.resolve("nested")) diff --git a/packages/codemode-rust/conformance/cases/lang-promise-56.json b/packages/codemode-rust/conformance/cases/lang-promise-56.json new file mode 100644 index 0000000000000..ab355a8703c74 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-56.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "nested", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-58.js b/packages/codemode-rust/conformance/cases/lang-promise-58.js new file mode 100644 index 0000000000000..581ad08527a02 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-58.js @@ -0,0 +1 @@ +const promise = Promise.resolve(1); return [promise].includes(Promise.resolve(promise)) diff --git a/packages/codemode-rust/conformance/cases/lang-promise-58.json b/packages/codemode-rust/conformance/cases/lang-promise-58.json new file mode 100644 index 0000000000000..8823965869ad5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-58.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": true, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-59.js b/packages/codemode-rust/conformance/cases/lang-promise-59.js new file mode 100644 index 0000000000000..1be60bc344504 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-59.js @@ -0,0 +1,6 @@ +try { + await Promise.reject("nope") + return "no" +} catch (e) { + return e +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-59.json b/packages/codemode-rust/conformance/cases/lang-promise-59.json new file mode 100644 index 0000000000000..7510e1af6c787 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-59.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "nope", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-61.js b/packages/codemode-rust/conformance/cases/lang-promise-61.js new file mode 100644 index 0000000000000..e4524d92d791f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-61.js @@ -0,0 +1,2 @@ +Promise.reject(new Error("abandoned")) +return "done" diff --git a/packages/codemode-rust/conformance/cases/lang-promise-61.json b/packages/codemode-rust/conformance/cases/lang-promise-61.json new file mode 100644 index 0000000000000..558ca4d312554 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-61.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-64.js b/packages/codemode-rust/conformance/cases/lang-promise-64.js new file mode 100644 index 0000000000000..051a4b9e4b862 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-64.js @@ -0,0 +1 @@ +return await Promise.race(["winner", tools.host.pending({ id: 1 })]) diff --git a/packages/codemode-rust/conformance/cases/lang-promise-64.json b/packages/codemode-rust/conformance/cases/lang-promise-64.json new file mode 100644 index 0000000000000..68766d1101019 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-64.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "winner", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-65.js b/packages/codemode-rust/conformance/cases/lang-promise-65.js new file mode 100644 index 0000000000000..d1e007a4e107b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-65.js @@ -0,0 +1,2 @@ +tools.host.stubborn({ cleanupMs: 400 }) +return "done" diff --git a/packages/codemode-rust/conformance/cases/lang-promise-65.json b/packages/codemode-rust/conformance/cases/lang-promise-65.json new file mode 100644 index 0000000000000..558ca4d312554 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-65.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-66.js b/packages/codemode-rust/conformance/cases/lang-promise-66.js new file mode 100644 index 0000000000000..3f562bad8a03f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-66.js @@ -0,0 +1,3 @@ +tools.host.fail({}) +tools.host.stubborn({ cleanupMs: 400 }) +return "done" diff --git a/packages/codemode-rust/conformance/cases/lang-promise-66.json b/packages/codemode-rust/conformance/cases/lang-promise-66.json new file mode 100644 index 0000000000000..558ca4d312554 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-66.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-68.js b/packages/codemode-rust/conformance/cases/lang-promise-68.js new file mode 100644 index 0000000000000..f6f5b55e68065 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-68.js @@ -0,0 +1,7 @@ +const order = [] +const promise = Promise.resolve(1) +promise.then(() => order.push("h1")) +promise.then(() => order.push("h2")) +order.push("sync") +await promise +return order diff --git a/packages/codemode-rust/conformance/cases/lang-promise-68.json b/packages/codemode-rust/conformance/cases/lang-promise-68.json new file mode 100644 index 0000000000000..5eb67e53c5ebc --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-68.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "sync", + "h1", + "h2" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-69.js b/packages/codemode-rust/conformance/cases/lang-promise-69.js new file mode 100644 index 0000000000000..981dfd03db259 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-69.js @@ -0,0 +1,4 @@ +return [ + await tools.host.fail({}).catch((error) => error.message), + await tools.host.echo({ id: 4 }).catch(() => "unused"), +] diff --git a/packages/codemode-rust/conformance/cases/lang-promise-69.json b/packages/codemode-rust/conformance/cases/lang-promise-69.json new file mode 100644 index 0000000000000..385baaf2f1675 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-69.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "No function at tools.host.fail.", + "unused" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-71.js b/packages/codemode-rust/conformance/cases/lang-promise-71.js new file mode 100644 index 0000000000000..6d514a85af9c2 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-71.js @@ -0,0 +1,3 @@ +Promise.reject(new Error("boom")).then((value) => value) +await Promise.resolve() +return "done" diff --git a/packages/codemode-rust/conformance/cases/lang-promise-71.json b/packages/codemode-rust/conformance/cases/lang-promise-71.json new file mode 100644 index 0000000000000..558ca4d312554 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-71.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-72.js b/packages/codemode-rust/conformance/cases/lang-promise-72.js new file mode 100644 index 0000000000000..304d96e469942 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-72.js @@ -0,0 +1,3 @@ +Promise.reject(new Error("boom")).catch(() => "handled") +await Promise.resolve() +return "done" diff --git a/packages/codemode-rust/conformance/cases/lang-promise-72.json b/packages/codemode-rust/conformance/cases/lang-promise-72.json new file mode 100644 index 0000000000000..558ca4d312554 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-72.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-74.js b/packages/codemode-rust/conformance/cases/lang-promise-74.js new file mode 100644 index 0000000000000..aa6667951534e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-74.js @@ -0,0 +1 @@ +return typeof tools.host.echo({ id: 1 }).then diff --git a/packages/codemode-rust/conformance/cases/lang-promise-74.json b/packages/codemode-rust/conformance/cases/lang-promise-74.json new file mode 100644 index 0000000000000..4af96557d6664 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-74.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "function", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-75.js b/packages/codemode-rust/conformance/cases/lang-promise-75.js new file mode 100644 index 0000000000000..74f2568559f77 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-75.js @@ -0,0 +1,2 @@ +Promise.all([Promise.reject(new Error("boom"))]) +return "done" diff --git a/packages/codemode-rust/conformance/cases/lang-promise-75.json b/packages/codemode-rust/conformance/cases/lang-promise-75.json new file mode 100644 index 0000000000000..558ca4d312554 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-75.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-76.js b/packages/codemode-rust/conformance/cases/lang-promise-76.js new file mode 100644 index 0000000000000..e1ebb54439d93 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-76.js @@ -0,0 +1,8 @@ +const pending = tools.host.pending({ id: 9 }) +const winner = await Promise.race([Promise.all([Promise.resolve(1)]), Promise.resolve(2)]) +try { + const raced = await Promise.race([Promise.all([Promise.reject("x"), pending]), Promise.resolve("ok")]) + return [winner, "fulfilled", raced] +} catch (reason) { + return [winner, "rejected", reason] +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-76.json b/packages/codemode-rust/conformance/cases/lang-promise-76.json new file mode 100644 index 0000000000000..e66ae37aaa57d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-76.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 2, + "fulfilled", + "ok" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-77.js b/packages/codemode-rust/conformance/cases/lang-promise-77.js new file mode 100644 index 0000000000000..6c696464c6591 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-77.js @@ -0,0 +1 @@ +return tools.host.echo({ id: 1 }).value diff --git a/packages/codemode-rust/conformance/cases/lang-promise-77.json b/packages/codemode-rust/conformance/cases/lang-promise-77.json new file mode 100644 index 0000000000000..8e0476d59757b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-77.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "InvalidDataValue", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-78.js b/packages/codemode-rust/conformance/cases/lang-promise-78.js new file mode 100644 index 0000000000000..7bdf79a841102 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-78.js @@ -0,0 +1 @@ +return await Promise.settle(() => 1) diff --git a/packages/codemode-rust/conformance/cases/lang-promise-78.json b/packages/codemode-rust/conformance/cases/lang-promise-78.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-78.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-79.js b/packages/codemode-rust/conformance/cases/lang-promise-79.js new file mode 100644 index 0000000000000..84a30b08fa2b7 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-79.js @@ -0,0 +1,6 @@ +const log = [] +const sum = Promise.try((a, b) => { log.push("ran"); return a + b }, 1, 2) +log.push("after") +let caught +try { await Promise.try(() => { throw new RangeError("boom") }) } catch (e) { caught = e.constructor.name } +return [log, sum instanceof Promise, await sum, caught, await Promise.try(async () => 5), await Promise.try(() => ({ then: (r) => r("thenable") }))] diff --git a/packages/codemode-rust/conformance/cases/lang-promise-79.json b/packages/codemode-rust/conformance/cases/lang-promise-79.json new file mode 100644 index 0000000000000..b9f3c66d9ef5b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-79.json @@ -0,0 +1,17 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "ran", + "after" + ], + true, + 3, + "RangeError", + 5, + "thenable" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-80.js b/packages/codemode-rust/conformance/cases/lang-promise-80.js new file mode 100644 index 0000000000000..b521e0c8ab337 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-80.js @@ -0,0 +1 @@ +return Promise.try(5) diff --git a/packages/codemode-rust/conformance/cases/lang-promise-80.json b/packages/codemode-rust/conformance/cases/lang-promise-80.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-80.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-81.js b/packages/codemode-rust/conformance/cases/lang-promise-81.js new file mode 100644 index 0000000000000..93358a558f607 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-81.js @@ -0,0 +1,8 @@ +const first = Promise.withResolvers() +first.resolve(Promise.resolve("adopted")) +first.resolve("ignored") +const second = Promise.withResolvers() +second.reject(new Error("no")) +let caught +try { await second.promise } catch (e) { caught = e.message } +return [Object.keys(first), first.promise instanceof Promise, await first.promise, caught] diff --git a/packages/codemode-rust/conformance/cases/lang-promise-81.json b/packages/codemode-rust/conformance/cases/lang-promise-81.json new file mode 100644 index 0000000000000..95dae6b0e6a16 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-81.json @@ -0,0 +1,16 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "promise", + "resolve", + "reject" + ], + true, + "adopted", + "no" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-82.js b/packages/codemode-rust/conformance/cases/lang-promise-82.js new file mode 100644 index 0000000000000..0c2903979b12a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-82.js @@ -0,0 +1,6 @@ +const winner = await Promise.any([ + tools.host.fail({}), + tools.host.echo({ id: 1 }), + tools.host.pending({ id: 2 }), +]) +return winner diff --git a/packages/codemode-rust/conformance/cases/lang-promise-82.json b/packages/codemode-rust/conformance/cases/lang-promise-82.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-82.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-83.js b/packages/codemode-rust/conformance/cases/lang-promise-83.js new file mode 100644 index 0000000000000..8238b4fe78df4 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-83.js @@ -0,0 +1,6 @@ +try { + await Promise.any([tools.host.fail({}), Promise.reject("plain")]) + return "fulfilled" +} catch (error) { + return [error.name, error.errors.map((reason) => reason.message ?? reason)] +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-83.json b/packages/codemode-rust/conformance/cases/lang-promise-83.json new file mode 100644 index 0000000000000..8665596e7a6ad --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-83.json @@ -0,0 +1,13 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "AggregateError", + [ + "No function at tools.host.fail.", + "plain" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-84.js b/packages/codemode-rust/conformance/cases/lang-promise-84.js new file mode 100644 index 0000000000000..e481d4d17ca39 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-84.js @@ -0,0 +1 @@ +return await Promise.race([Promise.any([Promise.resolve(1)]), Promise.resolve(2)]) diff --git a/packages/codemode-rust/conformance/cases/lang-promise-84.json b/packages/codemode-rust/conformance/cases/lang-promise-84.json new file mode 100644 index 0000000000000..b1e227bee5d89 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-84.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 2, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-85.js b/packages/codemode-rust/conformance/cases/lang-promise-85.js new file mode 100644 index 0000000000000..5ccf1cda9931d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-85.js @@ -0,0 +1,3 @@ +const first = Promise.resolve().then(() => "one") +const second = Promise.resolve().then(() => "two") +return await Promise.any([second, first]) diff --git a/packages/codemode-rust/conformance/cases/lang-promise-85.json b/packages/codemode-rust/conformance/cases/lang-promise-85.json new file mode 100644 index 0000000000000..844907cd9184c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-85.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "one", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-86.js b/packages/codemode-rust/conformance/cases/lang-promise-86.js new file mode 100644 index 0000000000000..b11efa27cbcb4 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-86.js @@ -0,0 +1,2 @@ +Promise.any([Promise.reject(new Error("boom"))]) +return "done" diff --git a/packages/codemode-rust/conformance/cases/lang-promise-86.json b/packages/codemode-rust/conformance/cases/lang-promise-86.json new file mode 100644 index 0000000000000..558ca4d312554 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-86.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-89.js b/packages/codemode-rust/conformance/cases/lang-promise-89.js new file mode 100644 index 0000000000000..9719f89a69ca7 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-89.js @@ -0,0 +1,7 @@ +let settle +const manual = new Promise((resolve) => { settle = resolve }) +const race = Promise.race([manual, tools.host.pending({ id: 3 })]) +const all = Promise.all([manual, "plain"]) +const any = Promise.any([manual, new Promise(() => {})]) +settle("manual") +return [await race, await all, await any] diff --git a/packages/codemode-rust/conformance/cases/lang-promise-89.json b/packages/codemode-rust/conformance/cases/lang-promise-89.json new file mode 100644 index 0000000000000..70ad1dfa51e8d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-89.json @@ -0,0 +1,14 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "manual", + [ + "manual", + "plain" + ], + "manual" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-90.js b/packages/codemode-rust/conformance/cases/lang-promise-90.js new file mode 100644 index 0000000000000..e6635f2635e97 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-90.js @@ -0,0 +1,10 @@ +let innerResolve, innerReject +const adopted = new Promise((resolve) => resolve(new Promise((resolve) => { innerResolve = resolve }))) +const adoptedRejection = new Promise((resolve) => resolve(new Promise((_, reject) => { innerReject = reject }))) +innerResolve("later") +innerReject("bad") +try { + return [await adopted, await adoptedRejection] +} catch (reason) { + return [await adopted, reason] +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-90.json b/packages/codemode-rust/conformance/cases/lang-promise-90.json new file mode 100644 index 0000000000000..171deafa21c6a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-90.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "later", + "bad" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-91.js b/packages/codemode-rust/conformance/cases/lang-promise-91.js new file mode 100644 index 0000000000000..92252c9f5734c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-91.js @@ -0,0 +1,5 @@ +const result = new Promise(async (resolve) => { + const id = await tools.host.echo({ id: 5 }) + resolve(id * 2) +}) +return await result diff --git a/packages/codemode-rust/conformance/cases/lang-promise-91.json b/packages/codemode-rust/conformance/cases/lang-promise-91.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-91.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-92.js b/packages/codemode-rust/conformance/cases/lang-promise-92.js new file mode 100644 index 0000000000000..0b7c88e3a16fa --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-92.js @@ -0,0 +1,3 @@ +const forever = new Promise(() => {}) +forever.then(() => {}) +return "done" diff --git a/packages/codemode-rust/conformance/cases/lang-promise-92.json b/packages/codemode-rust/conformance/cases/lang-promise-92.json new file mode 100644 index 0000000000000..558ca4d312554 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-92.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-93.js b/packages/codemode-rust/conformance/cases/lang-promise-93.js new file mode 100644 index 0000000000000..105282a2f0e6f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-93.js @@ -0,0 +1,4 @@ +new Promise((_, reject) => reject(new Error("dropped"))) +await Promise.resolve() +await Promise.resolve() +return "done" diff --git a/packages/codemode-rust/conformance/cases/lang-promise-93.json b/packages/codemode-rust/conformance/cases/lang-promise-93.json new file mode 100644 index 0000000000000..558ca4d312554 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-93.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "done", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-94.js b/packages/codemode-rust/conformance/cases/lang-promise-94.js new file mode 100644 index 0000000000000..1c85b28ffc4bf --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-94.js @@ -0,0 +1,3 @@ +let escaped +new Promise((resolve) => { escaped = resolve }) +return { escaped, kind: typeof escaped } diff --git a/packages/codemode-rust/conformance/cases/lang-promise-94.json b/packages/codemode-rust/conformance/cases/lang-promise-94.json new file mode 100644 index 0000000000000..edb30337b92f5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-94.json @@ -0,0 +1,9 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "kind": "function" + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-95.js b/packages/codemode-rust/conformance/cases/lang-promise-95.js new file mode 100644 index 0000000000000..1045b059404f8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-95.js @@ -0,0 +1,7 @@ +let total = 0 +const work = async () => { + await null + for (let i = 0; i < 1000; i++) total = total + 1 +} +await Promise.all([work(), work()]) +return total diff --git a/packages/codemode-rust/conformance/cases/lang-promise-95.json b/packages/codemode-rust/conformance/cases/lang-promise-95.json new file mode 100644 index 0000000000000..8f8e0b5656193 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-95.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 2000, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-96.js b/packages/codemode-rust/conformance/cases/lang-promise-96.js new file mode 100644 index 0000000000000..d4b538f972d09 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-96.js @@ -0,0 +1,7 @@ +let count = 0 +const work = async () => { + for (let i = 0; i < 1000; i++) count = count + 1 + await null +} +work() +return count diff --git a/packages/codemode-rust/conformance/cases/lang-promise-96.json b/packages/codemode-rust/conformance/cases/lang-promise-96.json new file mode 100644 index 0000000000000..ef6802b40efb4 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-96.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 1000, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-98.js b/packages/codemode-rust/conformance/cases/lang-promise-98.js new file mode 100644 index 0000000000000..4816b109d9f5b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-98.js @@ -0,0 +1,2 @@ +const never = async () => { await null; await new Promise(() => {}) } +return await Promise.all([never(), Promise.resolve(1)]) diff --git a/packages/codemode-rust/conformance/cases/lang-promise-98.json b/packages/codemode-rust/conformance/cases/lang-promise-98.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-98.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-99.js b/packages/codemode-rust/conformance/cases/lang-promise-99.js new file mode 100644 index 0000000000000..bd3f8f422ae42 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-99.js @@ -0,0 +1 @@ +try { await new Promise(() => {}) } catch { return "caught" } diff --git a/packages/codemode-rust/conformance/cases/lang-promise-99.json b/packages/codemode-rust/conformance/cases/lang-promise-99.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-99.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-combinator-input.js b/packages/codemode-rust/conformance/cases/lang-promise-combinator-input.js new file mode 100644 index 0000000000000..fea0f964330e7 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-combinator-input.js @@ -0,0 +1,29 @@ +// A combinator rejects, rather than throws, when its input is not iterable or iterating it fails. +const settle = async (name, input) => { + try { + return await Promise[name](input).then( + (value) => ["fulfilled", value], + (error) => ["rejected", String(error)], + ) + } catch (error) { + return ["thrown", String(error)] + } +} +const inputs = [ + 5, + null, + {}, + "ab", + { + [Symbol.iterator]() { + throw new Error("open") + }, + }, + { [Symbol.iterator]: () => ({ next: () => { throw new Error("next") } }) }, +] +const out = {} +for (const name of ["all", "allSettled", "any", "race"]) { + out[name] = [] + for (const input of inputs) out[name].push(await settle(name, input)) +} +return out diff --git a/packages/codemode-rust/conformance/cases/lang-promise-combinator-input.json b/packages/codemode-rust/conformance/cases/lang-promise-combinator-input.json new file mode 100644 index 0000000000000..1d5f8d021d4ae --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-combinator-input.json @@ -0,0 +1,124 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "all": [ + [ + "rejected", + "TypeError: Promise.all expects a synchronous iterable, received a number." + ], + [ + "rejected", + "TypeError: Promise.all expects a synchronous iterable, received null." + ], + [ + "rejected", + "TypeError: Promise.all expects a synchronous iterable, received a data object." + ], + [ + "fulfilled", + [ + "a", + "b" + ] + ], + [ + "rejected", + "Error: open" + ], + [ + "rejected", + "Error: next" + ] + ], + "allSettled": [ + [ + "rejected", + "TypeError: Promise.allSettled expects a synchronous iterable, received a number." + ], + [ + "rejected", + "TypeError: Promise.allSettled expects a synchronous iterable, received null." + ], + [ + "rejected", + "TypeError: Promise.allSettled expects a synchronous iterable, received a data object." + ], + [ + "fulfilled", + [ + { + "status": "fulfilled", + "value": "a" + }, + { + "status": "fulfilled", + "value": "b" + } + ] + ], + [ + "rejected", + "Error: open" + ], + [ + "rejected", + "Error: next" + ] + ], + "any": [ + [ + "rejected", + "TypeError: Promise.any expects a synchronous iterable, received a number." + ], + [ + "rejected", + "TypeError: Promise.any expects a synchronous iterable, received null." + ], + [ + "rejected", + "TypeError: Promise.any expects a synchronous iterable, received a data object." + ], + [ + "fulfilled", + "a" + ], + [ + "rejected", + "Error: open" + ], + [ + "rejected", + "Error: next" + ] + ], + "race": [ + [ + "rejected", + "TypeError: Promise.race expects a synchronous iterable, received a number." + ], + [ + "rejected", + "TypeError: Promise.race expects a synchronous iterable, received null." + ], + [ + "rejected", + "TypeError: Promise.race expects a synchronous iterable, received a data object." + ], + [ + "fulfilled", + "a" + ], + [ + "rejected", + "Error: open" + ], + [ + "rejected", + "Error: next" + ] + ] + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-finally-order.js b/packages/codemode-rust/conformance/cases/lang-promise-finally-order.js new file mode 100644 index 0000000000000..f8aee998ccb25 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-finally-order.js @@ -0,0 +1,10 @@ +const log = [] +const tick = (n) => Promise.resolve().then(() => log.push(n)) +Promise.resolve(1).finally(() => log.push("cleanup")).then((v) => log.push("after " + v)) +Promise.reject(2).finally(() => log.push("cleanup 2")).catch((e) => log.push("caught " + e)) +Promise.resolve(3).finally(() => Promise.resolve(9)).then((v) => log.push("after " + v)) +let p = Promise.resolve() +for (let i = 0; i < 8; i++) p = p.then(() => log.push("tick " + i)) +await p +await tick("end") +return log diff --git a/packages/codemode-rust/conformance/cases/lang-promise-finally-order.json b/packages/codemode-rust/conformance/cases/lang-promise-finally-order.json new file mode 100644 index 0000000000000..d0f58bf683bca --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-finally-order.json @@ -0,0 +1,22 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "cleanup", + "cleanup 2", + "tick 0", + "tick 1", + "tick 2", + "after 1", + "caught 2", + "after 3", + "tick 3", + "tick 4", + "tick 5", + "tick 6", + "tick 7", + "end" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-promise-race-empty.js b/packages/codemode-rust/conformance/cases/lang-promise-race-empty.js new file mode 100644 index 0000000000000..63ba447ff904d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-race-empty.js @@ -0,0 +1,16 @@ +const log = [] +const p = Promise.race([]) +log.push(typeof p.then) +try { + await p +} catch (e) { + log.push([e.name, e.message]) +} +function* none() {} +try { + await Promise.race(none()) +} catch (e) { + log.push(e.message) +} +log.push(await Promise.race([Promise.resolve(1), 2])) +return log diff --git a/packages/codemode-rust/conformance/cases/lang-promise-race-empty.json b/packages/codemode-rust/conformance/cases/lang-promise-race-empty.json new file mode 100644 index 0000000000000..7a3009b593c04 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-promise-race-empty.json @@ -0,0 +1,15 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "function", + [ + "TypeError", + "Promise.race([]) would never settle; provide at least one promise or value." + ], + "Promise.race([]) would never settle; provide at least one promise or value.", + 1 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-tagged-templates.js b/packages/codemode-rust/conformance/cases/lang-tagged-templates.js new file mode 100644 index 0000000000000..c041ed653c6aa --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-tagged-templates.js @@ -0,0 +1,10 @@ +const sites = [] +const tag = function (s, ...v) { sites.push(s); return [s, v, this === undefined, Array.isArray(s), Object.keys(s), s.raw, Array.isArray(s.raw), s.length] } +const r1 = tag`a${1}b\n${2}\unicode` +const f = () => tag`x` +f(); f() +const o = { t(s) { return this === o } } +let w; try { sites[0].raw = 5; w = "ok" } catch (e) { w = e.message } +let w2; try { sites[0].raw[0] = "z"; w2 = sites[0].raw[0] } catch (e) { w2 = e.message } +sites[0][0] = "changed" +return [r1, sites[1] === sites[2], o.t`q`, w, w2, sites[0][0], JSON.stringify(sites[0])] diff --git a/packages/codemode-rust/conformance/cases/lang-tagged-templates.json b/packages/codemode-rust/conformance/cases/lang-tagged-templates.json new file mode 100644 index 0000000000000..1731859720791 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-tagged-templates.json @@ -0,0 +1,39 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + [ + "changed", + "b\n", + null + ], + [ + 1, + 2 + ], + true, + true, + [ + "0", + "1", + "2" + ], + [ + "z", + "b\\n", + "\\unicode" + ], + true, + 3 + ], + true, + true, + "Cannot assign to read only property 'raw'.", + "z", + "changed", + "[\"changed\",\"b\\n\",null]" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-01.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-01.js new file mode 100644 index 0000000000000..d02eecab805db --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-01.js @@ -0,0 +1,8 @@ +__x = __x +__y = __x ? "good fellow" : "liar" +__z = __z === __x ? 1 : 0 +let unknown +try { __something__undefined = __something__undefined } catch (error) { unknown = error.name } +const before = [__y, __z, unknown] +var __x, __y = true, __z = __y ? "smeagol" : "golum" +return [...before, __y, __z] diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-01.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-01.json new file mode 100644 index 0000000000000..859dffc5500da --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-01.json @@ -0,0 +1,13 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "liar", + 1, + "ReferenceError", + true, + "smeagol" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-02.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-02.js new file mode 100644 index 0000000000000..c88d170095c29 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-02.js @@ -0,0 +1,15 @@ +var __var = "OUT" +const inner = (function () { + var __var = "IN" + ;(function () { __var = "INNER_SPACE" })() + ;(function () { var __var = "INNER_SUN" })() + return __var +})() +const after = __var +const assigned = (function () { + __var = "IN" + ;(function () { __var = "INNERED" })() + ;(function () { var __var = "INNAGER" })() + return __var +})() +return [inner, after, assigned, __var] diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-02.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-02.json new file mode 100644 index 0000000000000..96e905943188b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-02.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "INNER_SPACE", + "OUT", + "INNERED", + "INNERED" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-03.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-03.js new file mode 100644 index 0000000000000..f0718de21cc9b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-03.js @@ -0,0 +1,4 @@ +intry__var = intry__var +incatch__var = incatch__var +try { var intry__var } catch (e) { var incatch__var } +return [typeof intry__var, typeof incatch__var] diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-03.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-03.json new file mode 100644 index 0000000000000..4578bab566089 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-03.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "undefined", + "undefined" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-04.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-04.js new file mode 100644 index 0000000000000..ec72ef4999b22 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-04.js @@ -0,0 +1,3 @@ +infor_var = infor_var +for (;;) { break; var infor_var } +return typeof infor_var diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-04.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-04.json new file mode 100644 index 0000000000000..0ceb53b069923 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-04.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "undefined", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-05.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-05.js new file mode 100644 index 0000000000000..6aedfcf313ce0 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-05.js @@ -0,0 +1,3 @@ +__ind = __ind +for (var __ind; ; ) { break } +return typeof __ind diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-05.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-05.json new file mode 100644 index 0000000000000..0ceb53b069923 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-05.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "undefined", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-06.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-06.js new file mode 100644 index 0000000000000..d3419db8417bd --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-06.js @@ -0,0 +1,3 @@ +x = x +do var x; while (false) +return typeof x diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-06.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-06.json new file mode 100644 index 0000000000000..0ceb53b069923 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-06.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "undefined", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-07.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-07.js new file mode 100644 index 0000000000000..9e02388e0c4b4 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-07.js @@ -0,0 +1,5 @@ +function fn() { + { var x = 1; var y } + return [x, typeof y] +} +return fn() diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-07.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-07.json new file mode 100644 index 0000000000000..678142710e032 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-07.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + "undefined" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-08.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-08.js new file mode 100644 index 0000000000000..93783a8cba44b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-08.js @@ -0,0 +1,7 @@ +function fn() { + var a = 1 + let caught + try { throw "stuff3" } catch (a) { caught = a } + return [caught, a] +} +return fn() diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-08.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-08.json new file mode 100644 index 0000000000000..7da73b63e550a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-08.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "stuff3", + 1 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-09.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-09.js new file mode 100644 index 0000000000000..71d226c7ab41c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-09.js @@ -0,0 +1,7 @@ +var iterCount = 0 +var first = true +for (var x; first; first = false) { + var x + iterCount += 1 +} +return iterCount diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-09.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-09.json new file mode 100644 index 0000000000000..39c81553f53e6 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-09.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 1, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-10.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-10.js new file mode 100644 index 0000000000000..ab99431d7f858 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-10.js @@ -0,0 +1,8 @@ +var x = "outside" +var probeParams, probeBody +function f(_ = probeParams = function () { return x }) { + var x = "inside" + probeBody = function () { return x } +} +f() +return [probeParams(), probeBody()] diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-10.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-10.json new file mode 100644 index 0000000000000..35e13686d283b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-10.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "outside", + "inside" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-11.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-11.js new file mode 100644 index 0000000000000..9821283666ec4 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-11.js @@ -0,0 +1,8 @@ +var probe +function f(_ = null) { + var x = "inside" + probe = function () { return x } +} +f() +var x = "outside" +return [probe(), x] diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-11.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-11.json new file mode 100644 index 0000000000000..42ccdf6b28c20 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-11.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "inside", + "outside" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-12.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-12.js new file mode 100644 index 0000000000000..37778b09d8187 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-12.js @@ -0,0 +1 @@ +var a = 1; var a = 2; { var a = 3 } return a diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-12.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-12.json new file mode 100644 index 0000000000000..fe7d29531ec1c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-12.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 3, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-13.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-13.js new file mode 100644 index 0000000000000..1ae438e4f0575 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-13.js @@ -0,0 +1 @@ +var q = 1; { let q = 2 } return q diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-13.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-13.json new file mode 100644 index 0000000000000..39c81553f53e6 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-13.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 1, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-14.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-14.js new file mode 100644 index 0000000000000..ac9f1b971c88a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-14.js @@ -0,0 +1,5 @@ +const byVar = [] +for (var i = 0; i < 3; i++) byVar.push(() => i) +const byLet = [] +for (let j = 0; j < 3; j++) byLet.push(() => j) +return [byVar.map((f) => f()), byLet.map((f) => f())] diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-14.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-14.json new file mode 100644 index 0000000000000..06361458c54b1 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-14.json @@ -0,0 +1,18 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 3, + 3, + 3 + ], + [ + 0, + 1, + 2 + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-15.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-15.js new file mode 100644 index 0000000000000..e7d247ea00a93 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-15.js @@ -0,0 +1 @@ +for (var k in { a: 1 }) {} for (var [p, q] of [[1, 2]]) {} return [k, p, q] diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-15.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-15.json new file mode 100644 index 0000000000000..bb0a7ac73823e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-15.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "a", + 1, + 2 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-16.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-16.js new file mode 100644 index 0000000000000..d54be75e15618 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-16.js @@ -0,0 +1 @@ +var fn = 1; function fn() {} return typeof fn diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-16.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-16.json new file mode 100644 index 0000000000000..0a568fd8a8143 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-16.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "number", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-17.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-17.js new file mode 100644 index 0000000000000..604f00d01a947 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-17.js @@ -0,0 +1 @@ +function fn() {} var fn; return typeof fn diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-17.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-17.json new file mode 100644 index 0000000000000..4af96557d6664 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-17.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "function", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-18.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-18.js new file mode 100644 index 0000000000000..f04ae025940f5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-18.js @@ -0,0 +1 @@ +function h() { var fn = 1; function fn() {} return typeof fn } return h() diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-18.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-18.json new file mode 100644 index 0000000000000..0a568fd8a8143 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-18.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "number", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-19.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-19.js new file mode 100644 index 0000000000000..657d33798b306 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-19.js @@ -0,0 +1 @@ +function f(a) { var a; return a } return f(7) diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-19.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-19.json new file mode 100644 index 0000000000000..4eb6d50c6fdc0 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-19.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 7, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-20.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-20.js new file mode 100644 index 0000000000000..7d45594327894 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-20.js @@ -0,0 +1 @@ +function f(a) { var a = 2; return a } return f(7) diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-20.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-20.json new file mode 100644 index 0000000000000..b1e227bee5d89 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-20.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 2, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-21.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-21.js new file mode 100644 index 0000000000000..1f67c6c98c71f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-21.js @@ -0,0 +1 @@ +return [typeof b, (() => { var b = 1; return b })()]; var b diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-21.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-21.json new file mode 100644 index 0000000000000..7992dad9c1c7c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-21.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "undefined", + 1 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-22.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-22.js new file mode 100644 index 0000000000000..048c9bed39d47 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-22.js @@ -0,0 +1 @@ +function outer() { var o = 1; function inner() { var o = 2; return o } return [inner(), o] } return outer() diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-22.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-22.json new file mode 100644 index 0000000000000..66f027eeaae1c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-22.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 2, + 1 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-23.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-23.js new file mode 100644 index 0000000000000..735da56a08501 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-23.js @@ -0,0 +1 @@ +switch (1) { case 1: var s = 9 } label: { var lb = 1 } return [s, lb] diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-23.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-23.json new file mode 100644 index 0000000000000..57f2a91e63116 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-23.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 9, + 1 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-24.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-24.js new file mode 100644 index 0000000000000..b7c9f463abc89 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-24.js @@ -0,0 +1 @@ +function* gen() { var t = 1; yield t; var t = 2; yield t } return [...gen()] diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-24.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-24.json new file mode 100644 index 0000000000000..ef83b7145c25c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-24.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 2 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-25.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-25.js new file mode 100644 index 0000000000000..259f00c178905 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-25.js @@ -0,0 +1,6 @@ +function f() { return 1 } +const first = f() +function f() { return 2 } +var g = 1 +function g() { return 3 } +return [first, f(), typeof g] diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-25.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-25.json new file mode 100644 index 0000000000000..32a083558c1e2 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-25.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 2, + 2, + "number" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-26.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-26.js new file mode 100644 index 0000000000000..f005fe209bfbf --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-26.js @@ -0,0 +1,5 @@ +const fact = function inner(n) { return n <= 1 ? 1 : n * inner(n - 1) } +const reassign = function inner() { inner = 5 } +let failure +try { reassign() } catch (error) { failure = error.constructor.name } +return [fact(4), typeof inner, failure] diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-26.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-26.json new file mode 100644 index 0000000000000..e69f231c0267c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-26.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 24, + "undefined", + "TypeError" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-27.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-27.js new file mode 100644 index 0000000000000..004f9dcbfcb31 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-27.js @@ -0,0 +1,4 @@ +function* g() {} +async function* ag() {} +function f() {} +return [g() instanceof g, ag() instanceof ag, g.prototype === ag.prototype, typeof g.prototype, typeof f.prototype] diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-27.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-27.json new file mode 100644 index 0000000000000..d13ea87000871 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-27.json @@ -0,0 +1,13 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + true, + true, + false, + "object", + "undefined" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-28.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-28.js new file mode 100644 index 0000000000000..7ab669342ee63 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-28.js @@ -0,0 +1 @@ +switch (1) { case 1: return foo(); function foo() { return "hoisted" } } diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-28.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-28.json new file mode 100644 index 0000000000000..1956bc1cee5da --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-28.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "hoisted", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-29.js b/packages/codemode-rust/conformance/cases/lang-var-hoisting-29.js new file mode 100644 index 0000000000000..e97e0dd6354af --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-29.js @@ -0,0 +1 @@ +switch (2) { case 1: function foo() { return "a" } break; case 2: return foo() } diff --git a/packages/codemode-rust/conformance/cases/lang-var-hoisting-29.json b/packages/codemode-rust/conformance/cases/lang-var-hoisting-29.json new file mode 100644 index 0000000000000..192ccf49a148c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/lang-var-hoisting-29.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": "a", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/let-const-var.js b/packages/codemode-rust/conformance/cases/let-const-var.js new file mode 100644 index 0000000000000..84da0124be05b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/let-const-var.js @@ -0,0 +1,5 @@ +var a = 1 +let b = 2 +const c = 3 +{ let b = 20; var a = 10; const c = 30 } +return [a, b, c] diff --git a/packages/codemode-rust/conformance/cases/let-const-var.json b/packages/codemode-rust/conformance/cases/let-const-var.json new file mode 100644 index 0000000000000..25f03a99a3cf8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/let-const-var.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 10, + 2, + 3 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/logical-nullish.js b/packages/codemode-rust/conformance/cases/logical-nullish.js new file mode 100644 index 0000000000000..6b217d1eeeeba --- /dev/null +++ b/packages/codemode-rust/conformance/cases/logical-nullish.js @@ -0,0 +1,4 @@ +let a = null, b = 0, c = 1 +a ??= "set"; b ||= "falsy"; c &&= "truthy" +const o = { p: { q: 1 } } +return [a, b, c, 0 || "x", 0 ?? "x", "" && "y", o?.p?.q, o.missing?.q, o.missing?.(), null ?? undefined ?? 3, !0, !!""] diff --git a/packages/codemode-rust/conformance/cases/logical-nullish.json b/packages/codemode-rust/conformance/cases/logical-nullish.json new file mode 100644 index 0000000000000..087a04da24764 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/logical-nullish.json @@ -0,0 +1,20 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "set", + "falsy", + "truthy", + "x", + 0, + "", + 1, + null, + null, + 3, + true, + false + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/loops.js b/packages/codemode-rust/conformance/cases/loops.js new file mode 100644 index 0000000000000..0f0533df3ee84 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/loops.js @@ -0,0 +1,9 @@ +let a = 0 +for (let i = 0; i < 5; i++) a += i +let b = 0 +while (b < 7) b += 2 +let c = 0 +do { c++ } while (c < 0) +let d = 0 +for (let i = 0; i < 10; i++) { if (i % 2) continue; if (i > 6) break; d += i } +return [a, b, c, d] diff --git a/packages/codemode-rust/conformance/cases/loops.json b/packages/codemode-rust/conformance/cases/loops.json new file mode 100644 index 0000000000000..8ba47bebf7ef7 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/loops.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 10, + 8, + 1, + 12 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/map-object-keys.js b/packages/codemode-rust/conformance/cases/map-object-keys.js new file mode 100644 index 0000000000000..e81afa8fa2fc8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/map-object-keys.js @@ -0,0 +1,4 @@ +const k1 = { id: 1 }, k2 = { id: 1 } +const m = new Map([[k1, "one"]]) +m.set(1, "number").set("1", "string") +return [m.get(k1), m.get(k2), m.get(1), m.get("1"), m.size] diff --git a/packages/codemode-rust/conformance/cases/map-object-keys.json b/packages/codemode-rust/conformance/cases/map-object-keys.json new file mode 100644 index 0000000000000..6204b38884640 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/map-object-keys.json @@ -0,0 +1,13 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "one", + null, + "number", + "string", + 3 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/map-set.js b/packages/codemode-rust/conformance/cases/map-set.js new file mode 100644 index 0000000000000..d5d280b91326d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/map-set.js @@ -0,0 +1,7 @@ +const m = new Map([["a", 1]]) +m.set("b", 2).set("a", 3) +const s = new Set([3, 1, 3, 2]) +s.add(1).add(4) +const keys = [] +m.forEach((v, k) => keys.push(k + v)) +return [m.get("a"), m.get("zz"), m.has("b"), m.size, [...m.keys()], [...m.values()], [...m.entries()], [...m], m.delete("a"), m.delete("a"), [...s], s.has(2), s.size, keys] diff --git a/packages/codemode-rust/conformance/cases/map-set.json b/packages/codemode-rust/conformance/cases/map-set.json new file mode 100644 index 0000000000000..67d85c894808f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/map-set.json @@ -0,0 +1,54 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 3, + null, + true, + 2, + [ + "a", + "b" + ], + [ + 3, + 2 + ], + [ + [ + "a", + 3 + ], + [ + "b", + 2 + ] + ], + [ + [ + "a", + 3 + ], + [ + "b", + 2 + ] + ], + true, + false, + [ + 3, + 1, + 2, + 4 + ], + true, + 4, + [ + "a3", + "b2" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/math.js b/packages/codemode-rust/conformance/cases/math.js new file mode 100644 index 0000000000000..71260119e4229 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/math.js @@ -0,0 +1 @@ +return [Math.floor(-1.5), Math.ceil(1.2), Math.round(2.5), Math.round(-2.5), Math.max(1, 9, 3), Math.min(), Math.abs(-3), Math.pow(2, 8), Math.sqrt(16), Math.trunc(-4.7), Math.sign(-3), Math.PI.toFixed(5), Math.max()] diff --git a/packages/codemode-rust/conformance/cases/math.json b/packages/codemode-rust/conformance/cases/math.json new file mode 100644 index 0000000000000..e70f51bf506ac --- /dev/null +++ b/packages/codemode-rust/conformance/cases/math.json @@ -0,0 +1,21 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + -2, + 2, + 3, + -2, + 9, + null, + 3, + 256, + 4, + -4, + -1, + "3.14159", + null + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/number-formatting.js b/packages/codemode-rust/conformance/cases/number-formatting.js new file mode 100644 index 0000000000000..470403296cecd --- /dev/null +++ b/packages/codemode-rust/conformance/cases/number-formatting.js @@ -0,0 +1 @@ +return [String(0.1 + 0.2), String(1 / 3), String(1e21), String(123456789012), String(-0), String(1.5e-7), String(100), String(2 ** 53), String(-1e-7), String(1 / 0), 0.1 * 3, 1e308 * 10] diff --git a/packages/codemode-rust/conformance/cases/number-formatting.json b/packages/codemode-rust/conformance/cases/number-formatting.json new file mode 100644 index 0000000000000..edc03ec65cc5c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/number-formatting.json @@ -0,0 +1,20 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "0.30000000000000004", + "0.3333333333333333", + "1e+21", + "123456789012", + "0", + "1.5e-7", + "100", + "9007199254740992", + "-1e-7", + "Infinity", + 0.30000000000000004, + null + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/number-methods.js b/packages/codemode-rust/conformance/cases/number-methods.js new file mode 100644 index 0000000000000..bf1eb86bb44ee --- /dev/null +++ b/packages/codemode-rust/conformance/cases/number-methods.js @@ -0,0 +1 @@ +return [(3.14159).toFixed(2), (2).toFixed(1), Number("3.5"), Number("x"), Number(""), Number(true), parseInt("42px"), parseInt("ff", 16), parseFloat("2.5e1"), Number.isInteger(5), Number.isInteger(5.5), Number.isNaN(NaN), isNaN("x"), Number.isFinite(1 / 0), Number.MAX_SAFE_INTEGER] diff --git a/packages/codemode-rust/conformance/cases/number-methods.json b/packages/codemode-rust/conformance/cases/number-methods.json new file mode 100644 index 0000000000000..7295b3858aa11 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/number-methods.json @@ -0,0 +1,23 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "3.14", + "2.0", + 3.5, + null, + 0, + 1, + 42, + 255, + 25, + true, + false, + true, + true, + false, + 9007199254740991 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/object-literals.js b/packages/codemode-rust/conformance/cases/object-literals.js new file mode 100644 index 0000000000000..61408c387ecd9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/object-literals.js @@ -0,0 +1,5 @@ +const k = "dyn", a = 1 +const o = { a, [k + "Key"]: 2, 3: "three", "quoted-key": 4, m(x) { return x + this.a }, nested: { deep: [1, { z: true }] } } +o.added = 5 +delete o.a +return [o, o.m === undefined, "added" in o, "a" in o, Object.keys(o)] diff --git a/packages/codemode-rust/conformance/cases/object-literals.json b/packages/codemode-rust/conformance/cases/object-literals.json new file mode 100644 index 0000000000000..0b3162f00e262 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/object-literals.json @@ -0,0 +1,33 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + { + "3": "three", + "dynKey": 2, + "quoted-key": 4, + "nested": { + "deep": [ + 1, + { + "z": true + } + ] + }, + "added": 5 + }, + false, + true, + false, + [ + "3", + "dynKey", + "quoted-key", + "m", + "nested", + "added" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/object-methods.js b/packages/codemode-rust/conformance/cases/object-methods.js new file mode 100644 index 0000000000000..8315b07279a00 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/object-methods.js @@ -0,0 +1,2 @@ +const o = { b: 1, a: 2, 10: "ten", 2: "two" } +return [Object.keys(o), Object.values(o), Object.entries({ x: 1, y: [2] }), Object.assign({}, { a: 1 }, { b: 2 }), Object.fromEntries([["p", 1], ["q", 2]]), Object.hasOwn(o, "a"), o.hasOwnProperty("zz")] diff --git a/packages/codemode-rust/conformance/cases/object-methods.json b/packages/codemode-rust/conformance/cases/object-methods.json new file mode 100644 index 0000000000000..35c653c93e7cf --- /dev/null +++ b/packages/codemode-rust/conformance/cases/object-methods.json @@ -0,0 +1,42 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "2", + "10", + "b", + "a" + ], + [ + "two", + "ten", + 1, + 2 + ], + [ + [ + "x", + 1 + ], + [ + "y", + [ + 2 + ] + ] + ], + { + "a": 1, + "b": 2 + }, + { + "p": 1, + "q": 2 + }, + true, + false + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/operators.js b/packages/codemode-rust/conformance/cases/operators.js new file mode 100644 index 0000000000000..6a13ba7f183f3 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/operators.js @@ -0,0 +1,7 @@ +let a = 5 +a += 2; a -= 1; a *= 3; a /= 2; a %= 5 +let b = 2 ** 10 +let i = 0 +const post = i++, pre = ++i +const bits = [5 & 3, 5 | 3, 5 ^ 3, ~5, 1 << 4, -16 >> 2, -16 >>> 28] +return [a, b, post, pre, i, bits, -7 % 3, 7 / 2] diff --git a/packages/codemode-rust/conformance/cases/operators.json b/packages/codemode-rust/conformance/cases/operators.json new file mode 100644 index 0000000000000..5e655779aceea --- /dev/null +++ b/packages/codemode-rust/conformance/cases/operators.json @@ -0,0 +1,24 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 4, + 1024, + 0, + 2, + 2, + [ + 1, + 7, + 6, + -6, + 16, + -4, + 15 + ], + -1, + 3.5 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/plugin-reducer-command.js b/packages/codemode-rust/conformance/cases/plugin-reducer-command.js new file mode 100644 index 0000000000000..8c0d4e2993f82 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/plugin-reducer-command.js @@ -0,0 +1,4 @@ +// @bindings {"event": {"type": "command", "name": "git.status"}, "state": {"runs": 2}} +if (event.type === "init") return { state: { runs: 0 }, commands: [{ name: "git.status", key: "ctrl+g" }] } +if (event.type === "command" && event.name === "git.status") { const s = await tools.git.status(); return { state: { runs: state.runs + 1 }, slots: { statusbar: { text: s.branch + (s.dirty ? " *" : "") } } } } +return { state } diff --git a/packages/codemode-rust/conformance/cases/plugin-reducer-command.json b/packages/codemode-rust/conformance/cases/plugin-reducer-command.json new file mode 100644 index 0000000000000..b672e21a804fe --- /dev/null +++ b/packages/codemode-rust/conformance/cases/plugin-reducer-command.json @@ -0,0 +1,24 @@ +{ + "bindings": { + "event": { + "type": "command", + "name": "git.status" + }, + "state": { + "runs": 2 + } + }, + "ok": true, + "value": { + "state": { + "runs": 3 + }, + "slots": { + "statusbar": { + "text": "main *" + } + } + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/plugin-reducer-init.js b/packages/codemode-rust/conformance/cases/plugin-reducer-init.js new file mode 100644 index 0000000000000..b365668e08abc --- /dev/null +++ b/packages/codemode-rust/conformance/cases/plugin-reducer-init.js @@ -0,0 +1,4 @@ +// @bindings {"event": {"type": "init"}, "state": null} +if (event.type === "init") return { state: { runs: 0 }, commands: [{ name: "git.status", key: "ctrl+g" }] } +if (event.type === "command" && event.name === "git.status") { const s = await tools.git.status(); return { state: { runs: state.runs + 1 }, slots: { statusbar: { text: s.branch + (s.dirty ? " *" : "") } } } } +return { state } diff --git a/packages/codemode-rust/conformance/cases/plugin-reducer-init.json b/packages/codemode-rust/conformance/cases/plugin-reducer-init.json new file mode 100644 index 0000000000000..702bbfc998b67 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/plugin-reducer-init.json @@ -0,0 +1,22 @@ +{ + "bindings": { + "event": { + "type": "init" + }, + "state": null + }, + "ok": true, + "value": { + "state": { + "runs": 0 + }, + "commands": [ + { + "name": "git.status", + "key": "ctrl+g" + } + ] + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/plugin-reducer-other-command.js b/packages/codemode-rust/conformance/cases/plugin-reducer-other-command.js new file mode 100644 index 0000000000000..36a751b759ca6 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/plugin-reducer-other-command.js @@ -0,0 +1,4 @@ +// @bindings {"event": {"type": "command", "name": "git.log"}, "state": {"runs": 2}} +if (event.type === "init") return { state: { runs: 0 }, commands: [{ name: "git.status", key: "ctrl+g" }] } +if (event.type === "command" && event.name === "git.status") { const s = await tools.git.status(); return { state: { runs: state.runs + 1 }, slots: { statusbar: { text: s.branch + (s.dirty ? " *" : "") } } } } +return { state } diff --git a/packages/codemode-rust/conformance/cases/plugin-reducer-other-command.json b/packages/codemode-rust/conformance/cases/plugin-reducer-other-command.json new file mode 100644 index 0000000000000..f6c4669e45f45 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/plugin-reducer-other-command.json @@ -0,0 +1,19 @@ +{ + "bindings": { + "event": { + "type": "command", + "name": "git.log" + }, + "state": { + "runs": 2 + } + }, + "ok": true, + "value": { + "state": { + "runs": 2 + } + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/plugin-reducer-unknown-event.js b/packages/codemode-rust/conformance/cases/plugin-reducer-unknown-event.js new file mode 100644 index 0000000000000..2de4e928ab0ad --- /dev/null +++ b/packages/codemode-rust/conformance/cases/plugin-reducer-unknown-event.js @@ -0,0 +1,4 @@ +// @bindings {"event": {"type": "tick", "at": 5}, "state": {"runs": 7}} +if (event.type === "init") return { state: { runs: 0 }, commands: [{ name: "git.status", key: "ctrl+g" }] } +if (event.type === "command" && event.name === "git.status") { const s = await tools.git.status(); return { state: { runs: state.runs + 1 }, slots: { statusbar: { text: s.branch + (s.dirty ? " *" : "") } } } } +return { state } diff --git a/packages/codemode-rust/conformance/cases/plugin-reducer-unknown-event.json b/packages/codemode-rust/conformance/cases/plugin-reducer-unknown-event.json new file mode 100644 index 0000000000000..50cfc5b0f2436 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/plugin-reducer-unknown-event.json @@ -0,0 +1,19 @@ +{ + "bindings": { + "event": { + "type": "tick", + "at": 5 + }, + "state": { + "runs": 7 + } + }, + "ok": true, + "value": { + "state": { + "runs": 7 + } + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/promise-all.js b/packages/codemode-rust/conformance/cases/promise-all.js new file mode 100644 index 0000000000000..2ff80c2678ef5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/promise-all.js @@ -0,0 +1,2 @@ +const slow = async (x) => { await null; await null; return x } +return await Promise.all([slow(1), 2, Promise.resolve(3), slow(4)]) diff --git a/packages/codemode-rust/conformance/cases/promise-all.json b/packages/codemode-rust/conformance/cases/promise-all.json new file mode 100644 index 0000000000000..1ee2890a15f63 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/promise-all.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 2, + 3, + 4 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/promise-ordering.js b/packages/codemode-rust/conformance/cases/promise-ordering.js new file mode 100644 index 0000000000000..fca1abb47e3da --- /dev/null +++ b/packages/codemode-rust/conformance/cases/promise-ordering.js @@ -0,0 +1,6 @@ +const order = [] +Promise.resolve().then(() => order.push("micro")) +order.push("sync") +await null +order.push("after") +return order diff --git a/packages/codemode-rust/conformance/cases/promise-ordering.json b/packages/codemode-rust/conformance/cases/promise-ordering.json new file mode 100644 index 0000000000000..cb7b9592811f1 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/promise-ordering.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "sync", + "micro", + "after" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/promise-then-chain.js b/packages/codemode-rust/conformance/cases/promise-then-chain.js new file mode 100644 index 0000000000000..71f122a1a92b4 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/promise-then-chain.js @@ -0,0 +1,3 @@ +const v = await Promise.resolve(1).then((x) => x + 1).then((x) => x * 10) +const r = await Promise.reject(new Error("no")).catch((e) => e.message) +return [v, r] diff --git a/packages/codemode-rust/conformance/cases/promise-then-chain.json b/packages/codemode-rust/conformance/cases/promise-then-chain.json new file mode 100644 index 0000000000000..7656b52c38c8f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/promise-then-chain.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 20, + "no" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/recursion.js b/packages/codemode-rust/conformance/cases/recursion.js new file mode 100644 index 0000000000000..a1dba0ee8f7ab --- /dev/null +++ b/packages/codemode-rust/conformance/cases/recursion.js @@ -0,0 +1,4 @@ +function fact(n) { return n <= 1 ? 1 : n * fact(n - 1) } +const even = (n) => (n === 0 ? true : odd(n - 1)) +const odd = (n) => (n === 0 ? false : even(n - 1)) +return [fact(10), even(10), odd(7)] diff --git a/packages/codemode-rust/conformance/cases/recursion.json b/packages/codemode-rust/conformance/cases/recursion.json new file mode 100644 index 0000000000000..b73f5b7a5e106 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/recursion.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 3628800, + true, + true + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/repl-last-expression.js b/packages/codemode-rust/conformance/cases/repl-last-expression.js new file mode 100644 index 0000000000000..1540d67c1c7ca --- /dev/null +++ b/packages/codemode-rust/conformance/cases/repl-last-expression.js @@ -0,0 +1,2 @@ +const a = 2 +a * 21 diff --git a/packages/codemode-rust/conformance/cases/repl-last-expression.json b/packages/codemode-rust/conformance/cases/repl-last-expression.json new file mode 100644 index 0000000000000..1a93c28d4a431 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/repl-last-expression.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": 42, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/repl-no-value.js b/packages/codemode-rust/conformance/cases/repl-no-value.js new file mode 100644 index 0000000000000..0547b3d0eee97 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/repl-no-value.js @@ -0,0 +1 @@ +let x = 1 diff --git a/packages/codemode-rust/conformance/cases/repl-no-value.json b/packages/codemode-rust/conformance/cases/repl-no-value.json new file mode 100644 index 0000000000000..a72fb13f7341c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/repl-no-value.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": null, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/repl-undefined.js b/packages/codemode-rust/conformance/cases/repl-undefined.js new file mode 100644 index 0000000000000..417b7b5370df8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/repl-undefined.js @@ -0,0 +1 @@ +undefined diff --git a/packages/codemode-rust/conformance/cases/repl-undefined.json b/packages/codemode-rust/conformance/cases/repl-undefined.json new file mode 100644 index 0000000000000..a72fb13f7341c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/repl-undefined.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": true, + "value": null, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/runtime-type-error.js b/packages/codemode-rust/conformance/cases/runtime-type-error.js new file mode 100644 index 0000000000000..f21a639bfad68 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/runtime-type-error.js @@ -0,0 +1,5 @@ +const out = [] +try { null.x } catch (e) { out.push(e instanceof TypeError, e.name) } +try { const f = undefined; f() } catch (e) { out.push(e instanceof TypeError) } +try { const c = 1; c = 2 } catch (e) { out.push(e instanceof TypeError) } +return out diff --git a/packages/codemode-rust/conformance/cases/runtime-type-error.json b/packages/codemode-rust/conformance/cases/runtime-type-error.json new file mode 100644 index 0000000000000..56e30170812b4 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/runtime-type-error.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + true, + "TypeError", + true, + true + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/spread-rest.js b/packages/codemode-rust/conformance/cases/spread-rest.js new file mode 100644 index 0000000000000..c5d1456d5db55 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/spread-rest.js @@ -0,0 +1,4 @@ +const sum = (...xs) => xs.reduce((a, b) => a + b, 0) +const arr = [1, 2, 3] +const merged = { ...{ a: 1, b: 2 }, b: 3, ...{ c: 4 } } +return [sum(...arr, 4), [0, ...arr, ...[9]], merged, Math.max(...arr)] diff --git a/packages/codemode-rust/conformance/cases/spread-rest.json b/packages/codemode-rust/conformance/cases/spread-rest.json new file mode 100644 index 0000000000000..e5d905f693101 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/spread-rest.json @@ -0,0 +1,22 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 10, + [ + 0, + 1, + 2, + 3, + 9 + ], + { + "a": 1, + "b": 3, + "c": 4 + }, + 3 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-array-callback-shrink.js b/packages/codemode-rust/conformance/cases/std-array-callback-shrink.js new file mode 100644 index 0000000000000..748f9c4864cec --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-array-callback-shrink.js @@ -0,0 +1,13 @@ +const out = [] +const run = (name, f) => { const a = [1, 2, 3, 4, 5, 6]; const seen = []; const r = a[name]((...xs) => { seen.push(xs[name.startsWith("reduce") ? 2 : 1]); if (seen.length === 2) a.length = 3; return f(...xs) }, ...(name.startsWith("reduce") ? [0] : [])); out.push(name + ":" + seen.join("") + ":" + JSON.stringify(r)) } +for (const n of ["forEach", "map", "filter", "some", "every", "find", "findIndex", "findLast", "findLastIndex", "flatMap", "reduce", "reduceRight"]) run(n, (x) => n === "every" ? true : n === "some" ? false : x) +const b = [1, 2, 3, 4] +b.forEach((x, i) => { if (i === 0) b.push(9) ; out.push(x) }) +const c = [5, 6, 7, 8] +out.push(c.reduceRight((acc, x, i) => { if (i === 3) c.length = 2; return acc + x }, "")) +const d = [1, 2, 3] +out.push(JSON.stringify(d.map((x, i) => { if (i === 0) d.length = 1; return x * 2 })), d.length) + + +const fi = { valueOf() { out.push("v"); return 0 } }; out.push([].includes(1, fi), [].indexOf(1, fi), [].lastIndexOf(1, fi), [1].includes(1, fi), [1].indexOf(1, fi), [1].lastIndexOf(1, fi)); return out + diff --git a/packages/codemode-rust/conformance/cases/std-array-callback-shrink.json b/packages/codemode-rust/conformance/cases/std-array-callback-shrink.json new file mode 100644 index 0000000000000..348f0892c47f5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-array-callback-shrink.json @@ -0,0 +1,36 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "forEach:012:undefined", + "map:012:[1,2,3,null,null,null]", + "filter:012:[1,2,3]", + "some:012:false", + "every:012:true", + "find:0:1", + "findIndex:0:0", + "findLast:5:6", + "findLastIndex:5:5", + "flatMap:012:[1,2,3]", + "reduce:012:0", + "reduceRight:54210:0", + 1, + 2, + 3, + 4, + "865", + "[2,null,null]", + 1, + "v", + "v", + "v", + false, + -1, + -1, + true, + 0, + 0 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-array-from-entries.js b/packages/codemode-rust/conformance/cases/std-array-from-entries.js new file mode 100644 index 0000000000000..85b12df7e00a8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-array-from-entries.js @@ -0,0 +1,31 @@ +const out = [] +for (const [label, a] of [["one", Object.freeze([1])], ["empty", Object.freeze([])], ["two", Object.freeze([1, 2])], ["sealed1", Object.seal([1])], ["ne1", Object.preventExtensions([1])]]) { + try { a.reverse(); out.push(label + " ok") } catch (e) { out.push(label + " " + e.message) } +} +try { Object.fromEntries(["ab"]) } catch (e) { out.push(e.constructor.name + ": " + e.message) } +try { Object.fromEntries([null]) } catch (e) { out.push(e.constructor.name + ": " + e.message) } +let steps = 0, closed = 0 +const it = { [Symbol.iterator]() { return { next() { steps++; return { value: "x", done: false } }, return() { closed++; return {} } } } } +try { Object.fromEntries(it) } catch (e) { out.push(e.message, steps, closed) } +steps = 0; closed = 0 +try { Array.from(it, () => { throw new Error("map") }) } catch (e) { out.push(e.message, steps, closed) } +const src = [127, 4, 8] +out.push(JSON.stringify(Array.from(src, (v, i) => { if (i + 1 < src.length) src[i + 1] = 127; return v }))) +const ar = (function () { return arguments })(1, 2) +Object.preventExtensions(ar) +out.push(Object.isFrozen(ar), Object.isSealed(ar), Object.isFrozen(Object.preventExtensions((function () { return arguments })()))) +out.push(JSON.stringify(Object.fromEntries([["a", 1], new Map([[0, "k"], [1, "v"]])]))) + + +for (const a of [[3, 5], [5], [[1], 7], [{ length: 2 }, "x"]]) { try { out.push(JSON.stringify(Array.from(...a))) } catch (e) { out.push(e.message) } } try { Object.fromEntries(5) } catch (e) { out.push(e.message) } try { Object.fromEntries([() => 1]) ; out.push("fn ok") } catch (e) { out.push(e.message) } + +for (const a of [[function (a, b) {}], [new Date(0)], [new Error("x")], [Promise.resolve(1)], [{ length: 3, 1: "b" }, (v, i) => v ?? i], [new Map([[1, 2]])], ["héllo", (c) => c.toUpperCase()], [new Set([1, 2]).values()], [null], [undefined], [true], [{ length: -1 }], [{ length: "2" }], [[1, 2], undefined], [[1, 2], (x) => x * 2, null]]) { + try { out.push(JSON.stringify(Array.from(...a))) } catch (e) { out.push(e.constructor.name + ": " + e.message) } +} +const gg = (function* () { yield 1; yield 2 })() +out.push(JSON.stringify(Array.from(gg, (x) => x + 1))) +out.push(JSON.stringify(Object.fromEntries(new Map([["a", 1], [2, "b"]])))) +try { Object.fromEntries([[{ toString() { return "k" } }, 1]]) } catch (e) { out.push(e.message) } +out.push(JSON.stringify(Object.fromEntries([[{ a: 1 }, 1], [[1, 2], 2], [null, 3], [undefined, 4], [5, 6]]))) +return out + diff --git a/packages/codemode-rust/conformance/cases/std-array-from-entries.json b/packages/codemode-rust/conformance/cases/std-array-from-entries.json new file mode 100644 index 0000000000000..6e7ea114d966b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-array-from-entries.json @@ -0,0 +1,51 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "one ok", + "empty ok", + "two Cannot assign to read only property '0'.", + "sealed1 ok", + "ne1 ok", + "TypeError: Object.fromEntries expects [key, value] entry objects.", + "TypeError: Object.fromEntries expects [key, value] entry objects.", + "Object.fromEntries expects [key, value] entry objects.", + 1, + 1, + "map", + 1, + 1, + "[127,127,127]", + false, + false, + false, + "{\"a\":1}", + "Array.from expects a function callback.", + "Array.from expects an iterable or array-like value, received a number.", + "Array.from expects a function callback.", + "Array.from expects a function callback.", + "for...of requires an iterable value, received a number.", + "Object.fromEntries expects [key, value] entry objects.", + "[null,null]", + "[]", + "[]", + "TypeError: Array.from expects an iterable or array-like value, received an un-awaited Promise.", + "[0,\"b\",2]", + "[[1,2]]", + "[\"H\",\"É\",\"L\",\"L\",\"O\"]", + "[1,2]", + "TypeError: Array.from expects an iterable or array-like value, received null.", + "TypeError: Array.from expects an iterable or array-like value, received undefined.", + "TypeError: Array.from expects an iterable or array-like value, received a boolean.", + "[]", + "[null,null]", + "[1,2]", + "[2,4]", + "[2,3]", + "{\"2\":\"b\",\"a\":1}", + "Object.fromEntries expects [key, value] entry objects.", + "{\"5\":6,\"[object Object]\":1,\"1,2\":2,\"null\":3,\"undefined\":4}" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-array-frozen-writes.js b/packages/codemode-rust/conformance/cases/std-array-frozen-writes.js new file mode 100644 index 0000000000000..dd9a132899a3a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-array-frozen-writes.js @@ -0,0 +1,11 @@ +const out = [] +const ops = { push: (a) => a.push(9), pop: (a) => a.pop(), shift: (a) => a.shift(), unshift: (a) => a.unshift(0), splice: (a) => a.splice(0, 1), splice0: (a) => a.splice(0, 0), spliceAdd: (a) => a.splice(1, 0, 5), sort: (a) => a.sort(), reverse: (a) => a.reverse(), fill: (a) => a.fill(0), copyWithin: (a) => a.copyWithin(0, 1), pushNone: (a) => a.push(), popEmpty: (a) => a.pop() } +for (const [mk, make] of [["frozen", (x) => Object.freeze(x)], ["sealed", (x) => Object.seal(x)], ["nonext", (x) => Object.preventExtensions(x)]]) { + for (const [name, op] of Object.entries(ops)) { + for (const init of [[], [1], [2, 1]]) { + const a = make([...init]) + try { op(a); out.push(`${mk} ${name} ${init.length} ok ${JSON.stringify(a)}`) } catch (e) { out.push(`${mk} ${name} ${init.length} ${e.message}`) } + } + } +} +return out diff --git a/packages/codemode-rust/conformance/cases/std-array-frozen-writes.json b/packages/codemode-rust/conformance/cases/std-array-frozen-writes.json new file mode 100644 index 0000000000000..3168e89094ebe --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-array-frozen-writes.json @@ -0,0 +1,125 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "frozen push 0 Cannot add property 0, object is not extensible.", + "frozen push 1 Cannot add property 1, object is not extensible.", + "frozen push 2 Cannot add property 2, object is not extensible.", + "frozen pop 0 Cannot assign to read only property 'length'.", + "frozen pop 1 Cannot delete property '0'.", + "frozen pop 2 Cannot delete property '1'.", + "frozen shift 0 Cannot assign to read only property 'length'.", + "frozen shift 1 Cannot delete property '0'.", + "frozen shift 2 Cannot delete property '1'.", + "frozen unshift 0 Cannot add property 0, object is not extensible.", + "frozen unshift 1 Cannot add property 1, object is not extensible.", + "frozen unshift 2 Cannot add property 2, object is not extensible.", + "frozen splice 0 Cannot assign to read only property 'length'.", + "frozen splice 1 Cannot delete property '0'.", + "frozen splice 2 Cannot delete property '1'.", + "frozen splice0 0 Cannot assign to read only property 'length'.", + "frozen splice0 1 Cannot assign to read only property '0'.", + "frozen splice0 2 Cannot assign to read only property '0'.", + "frozen spliceAdd 0 Cannot add property 0, object is not extensible.", + "frozen spliceAdd 1 Cannot add property 1, object is not extensible.", + "frozen spliceAdd 2 Cannot add property 2, object is not extensible.", + "frozen sort 0 ok []", + "frozen sort 1 Cannot assign to read only property '0'.", + "frozen sort 2 Cannot assign to read only property '0'.", + "frozen reverse 0 ok []", + "frozen reverse 1 ok [1]", + "frozen reverse 2 Cannot assign to read only property '0'.", + "frozen fill 0 ok []", + "frozen fill 1 Cannot assign to read only property '0'.", + "frozen fill 2 Cannot assign to read only property '0'.", + "frozen copyWithin 0 ok []", + "frozen copyWithin 1 Cannot assign to read only property '0'.", + "frozen copyWithin 2 Cannot assign to read only property '0'.", + "frozen pushNone 0 Cannot assign to read only property 'length'.", + "frozen pushNone 1 Cannot assign to read only property '0'.", + "frozen pushNone 2 Cannot assign to read only property '0'.", + "frozen popEmpty 0 Cannot assign to read only property 'length'.", + "frozen popEmpty 1 Cannot delete property '0'.", + "frozen popEmpty 2 Cannot delete property '1'.", + "sealed push 0 Cannot add property 0, object is not extensible.", + "sealed push 1 Cannot add property 1, object is not extensible.", + "sealed push 2 Cannot add property 2, object is not extensible.", + "sealed pop 0 ok []", + "sealed pop 1 Cannot delete property '0'.", + "sealed pop 2 Cannot delete property '1'.", + "sealed shift 0 ok []", + "sealed shift 1 Cannot delete property '0'.", + "sealed shift 2 Cannot delete property '1'.", + "sealed unshift 0 Cannot add property 0, object is not extensible.", + "sealed unshift 1 Cannot add property 1, object is not extensible.", + "sealed unshift 2 Cannot add property 2, object is not extensible.", + "sealed splice 0 ok []", + "sealed splice 1 Cannot delete property '0'.", + "sealed splice 2 Cannot delete property '1'.", + "sealed splice0 0 ok []", + "sealed splice0 1 ok [1]", + "sealed splice0 2 ok [2,1]", + "sealed spliceAdd 0 Cannot add property 0, object is not extensible.", + "sealed spliceAdd 1 Cannot add property 1, object is not extensible.", + "sealed spliceAdd 2 Cannot add property 2, object is not extensible.", + "sealed sort 0 ok []", + "sealed sort 1 ok [1]", + "sealed sort 2 ok [1,2]", + "sealed reverse 0 ok []", + "sealed reverse 1 ok [1]", + "sealed reverse 2 ok [1,2]", + "sealed fill 0 ok []", + "sealed fill 1 ok [0]", + "sealed fill 2 ok [0,0]", + "sealed copyWithin 0 ok []", + "sealed copyWithin 1 ok [1]", + "sealed copyWithin 2 ok [1,1]", + "sealed pushNone 0 ok []", + "sealed pushNone 1 ok [1]", + "sealed pushNone 2 ok [2,1]", + "sealed popEmpty 0 ok []", + "sealed popEmpty 1 Cannot delete property '0'.", + "sealed popEmpty 2 Cannot delete property '1'.", + "nonext push 0 Cannot add property 0, object is not extensible.", + "nonext push 1 Cannot add property 1, object is not extensible.", + "nonext push 2 Cannot add property 2, object is not extensible.", + "nonext pop 0 ok []", + "nonext pop 1 ok []", + "nonext pop 2 ok [2]", + "nonext shift 0 ok []", + "nonext shift 1 ok []", + "nonext shift 2 ok [1]", + "nonext unshift 0 Cannot add property 0, object is not extensible.", + "nonext unshift 1 Cannot add property 1, object is not extensible.", + "nonext unshift 2 Cannot add property 2, object is not extensible.", + "nonext splice 0 ok []", + "nonext splice 1 ok []", + "nonext splice 2 ok [1]", + "nonext splice0 0 ok []", + "nonext splice0 1 ok [1]", + "nonext splice0 2 ok [2,1]", + "nonext spliceAdd 0 Cannot add property 0, object is not extensible.", + "nonext spliceAdd 1 Cannot add property 1, object is not extensible.", + "nonext spliceAdd 2 Cannot add property 2, object is not extensible.", + "nonext sort 0 ok []", + "nonext sort 1 ok [1]", + "nonext sort 2 ok [1,2]", + "nonext reverse 0 ok []", + "nonext reverse 1 ok [1]", + "nonext reverse 2 ok [1,2]", + "nonext fill 0 ok []", + "nonext fill 1 ok [0]", + "nonext fill 2 ok [0,0]", + "nonext copyWithin 0 ok []", + "nonext copyWithin 1 ok [1]", + "nonext copyWithin 2 ok [1,1]", + "nonext pushNone 0 ok []", + "nonext pushNone 1 ok [1]", + "nonext pushNone 2 ok [2,1]", + "nonext popEmpty 0 ok []", + "nonext popEmpty 1 ok []", + "nonext popEmpty 2 ok [2]" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-array-index-boundary.js b/packages/codemode-rust/conformance/cases/std-array-index-boundary.js new file mode 100644 index 0000000000000..0ab7521c46351 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-array-index-boundary.js @@ -0,0 +1 @@ +const a = []; a[4294967295] = "x"; a[4294967296] = "y"; a["-1"] = "z"; return [a.length, a[4294967295], a[4294967296], a[-1], Object.keys(a), JSON.stringify(a)] diff --git a/packages/codemode-rust/conformance/cases/std-array-index-boundary.json b/packages/codemode-rust/conformance/cases/std-array-index-boundary.json new file mode 100644 index 0000000000000..64410d1a64e49 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-array-index-boundary.json @@ -0,0 +1,18 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 0, + "x", + "y", + "z", + [ + "4294967295", + "4294967296", + "-1" + ], + "[]" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-array-prototype-array.js b/packages/codemode-rust/conformance/cases/std-array-prototype-array.js new file mode 100644 index 0000000000000..aa54e486e7794 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-array-prototype-array.js @@ -0,0 +1,8 @@ +const out = [Array.isArray(Array.prototype), Array.prototype.length, JSON.stringify(Array.prototype), Object.keys(Array.prototype).length, String(Array.prototype), typeof Array.prototype.map] +Array.prototype[0] = "proto" +const a = [] +out.push(a[0], a.length, Array.prototype.length, [1].concat([2]).length) +Array.prototype.length = 0 +console.log(Array.prototype) +delete Array.prototype[0] +Array.prototype[1] = "p"; const a2 = [0, , 2]; out.push(a2[1], 1 in a2, a2.indexOf("p"), a2.includes("p"), JSON.stringify(a2), a2.map((x) => x).join(), [].concat(a2).length); a2.forEach((x, i) => out.push(i + x)); delete Array.prototype[1]; out.push(a2[1], 1 in a2); return out diff --git a/packages/codemode-rust/conformance/cases/std-array-prototype-array.json b/packages/codemode-rust/conformance/cases/std-array-prototype-array.json new file mode 100644 index 0000000000000..6b6a71ddee750 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-array-prototype-array.json @@ -0,0 +1,32 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + true, + 0, + "[]", + 0, + "", + "function", + "proto", + 0, + 1, + 2, + "p", + true, + -1, + false, + "[0,null,2]", + "0,p,2", + 3, + 0, + "1p", + 4, + null, + false + ], + "logs": [ + "[]" + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-array-receivers.js b/packages/codemode-rust/conformance/cases/std-array-receivers.js new file mode 100644 index 0000000000000..502406453550b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-array-receivers.js @@ -0,0 +1,17 @@ +// Array.prototype methods called on what is not an array name themselves and what they got. +const names = ["at", "concat", "copyWithin", "entries", "every", "fill", "filter", "find", "findIndex", "findLast", + "findLastIndex", "flat", "flatMap", "forEach", "includes", "indexOf", "join", "keys", "lastIndexOf", "map", "pop", "push", + "reduce", "reduceRight", "reverse", "shift", "slice", "some", "sort", "splice", "toLocaleString", "toReversed", + "toSorted", "toSpliced", "toString", "unshift", "values", "with"] +const out = [] +for (const n of names) { + for (const t of [1, "ab", { length: 2, 0: "x", 1: "y" }, null, undefined]) { + try { + Array.prototype[n].call(t, (x) => x, 0) + out.push([n, "ok"]) + } catch (e) { + out.push([n, e.name, e.message]) + } + } +} +return out diff --git a/packages/codemode-rust/conformance/cases/std-array-receivers.json b/packages/codemode-rust/conformance/cases/std-array-receivers.json new file mode 100644 index 0000000000000..39a88550cd979 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-array-receivers.json @@ -0,0 +1,958 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "at", + "TypeError", + "Array.prototype.at called on incompatible receiver a number." + ], + [ + "at", + "TypeError", + "Array.prototype.at called on incompatible receiver a string." + ], + [ + "at", + "TypeError", + "Array.prototype.at called on incompatible receiver a data object." + ], + [ + "at", + "TypeError", + "Array.prototype.at called on incompatible receiver null." + ], + [ + "at", + "TypeError", + "Array.prototype.at called on incompatible receiver undefined." + ], + [ + "concat", + "TypeError", + "Array.prototype.concat called on incompatible receiver a number." + ], + [ + "concat", + "TypeError", + "Array.prototype.concat called on incompatible receiver a string." + ], + [ + "concat", + "TypeError", + "Array.prototype.concat called on incompatible receiver a data object." + ], + [ + "concat", + "TypeError", + "Array.prototype.concat called on incompatible receiver null." + ], + [ + "concat", + "TypeError", + "Array.prototype.concat called on incompatible receiver undefined." + ], + [ + "copyWithin", + "TypeError", + "Array.prototype.copyWithin called on incompatible receiver a number." + ], + [ + "copyWithin", + "TypeError", + "Array.prototype.copyWithin called on incompatible receiver a string." + ], + [ + "copyWithin", + "TypeError", + "Array.prototype.copyWithin called on incompatible receiver a data object." + ], + [ + "copyWithin", + "TypeError", + "Array.prototype.copyWithin called on incompatible receiver null." + ], + [ + "copyWithin", + "TypeError", + "Array.prototype.copyWithin called on incompatible receiver undefined." + ], + [ + "entries", + "TypeError", + "Array.prototype.entries called on incompatible receiver a number." + ], + [ + "entries", + "TypeError", + "Array.prototype.entries called on incompatible receiver a string." + ], + [ + "entries", + "TypeError", + "Array.prototype.entries called on incompatible receiver a data object." + ], + [ + "entries", + "TypeError", + "Array.prototype.entries called on incompatible receiver null." + ], + [ + "entries", + "TypeError", + "Array.prototype.entries called on incompatible receiver undefined." + ], + [ + "every", + "TypeError", + "Array.prototype.every called on incompatible receiver a number." + ], + [ + "every", + "TypeError", + "Array.prototype.every called on incompatible receiver a string." + ], + [ + "every", + "TypeError", + "Array.prototype.every called on incompatible receiver a data object." + ], + [ + "every", + "TypeError", + "Array.prototype.every called on incompatible receiver null." + ], + [ + "every", + "TypeError", + "Array.prototype.every called on incompatible receiver undefined." + ], + [ + "fill", + "TypeError", + "Array.prototype.fill called on incompatible receiver a number." + ], + [ + "fill", + "TypeError", + "Array.prototype.fill called on incompatible receiver a string." + ], + [ + "fill", + "TypeError", + "Array.prototype.fill called on incompatible receiver a data object." + ], + [ + "fill", + "TypeError", + "Array.prototype.fill called on incompatible receiver null." + ], + [ + "fill", + "TypeError", + "Array.prototype.fill called on incompatible receiver undefined." + ], + [ + "filter", + "TypeError", + "Array.prototype.filter called on incompatible receiver a number." + ], + [ + "filter", + "TypeError", + "Array.prototype.filter called on incompatible receiver a string." + ], + [ + "filter", + "TypeError", + "Array.prototype.filter called on incompatible receiver a data object." + ], + [ + "filter", + "TypeError", + "Array.prototype.filter called on incompatible receiver null." + ], + [ + "filter", + "TypeError", + "Array.prototype.filter called on incompatible receiver undefined." + ], + [ + "find", + "TypeError", + "Array.prototype.find called on incompatible receiver a number." + ], + [ + "find", + "TypeError", + "Array.prototype.find called on incompatible receiver a string." + ], + [ + "find", + "TypeError", + "Array.prototype.find called on incompatible receiver a data object." + ], + [ + "find", + "TypeError", + "Array.prototype.find called on incompatible receiver null." + ], + [ + "find", + "TypeError", + "Array.prototype.find called on incompatible receiver undefined." + ], + [ + "findIndex", + "TypeError", + "Array.prototype.findIndex called on incompatible receiver a number." + ], + [ + "findIndex", + "TypeError", + "Array.prototype.findIndex called on incompatible receiver a string." + ], + [ + "findIndex", + "TypeError", + "Array.prototype.findIndex called on incompatible receiver a data object." + ], + [ + "findIndex", + "TypeError", + "Array.prototype.findIndex called on incompatible receiver null." + ], + [ + "findIndex", + "TypeError", + "Array.prototype.findIndex called on incompatible receiver undefined." + ], + [ + "findLast", + "TypeError", + "Array.prototype.findLast called on incompatible receiver a number." + ], + [ + "findLast", + "TypeError", + "Array.prototype.findLast called on incompatible receiver a string." + ], + [ + "findLast", + "TypeError", + "Array.prototype.findLast called on incompatible receiver a data object." + ], + [ + "findLast", + "TypeError", + "Array.prototype.findLast called on incompatible receiver null." + ], + [ + "findLast", + "TypeError", + "Array.prototype.findLast called on incompatible receiver undefined." + ], + [ + "findLastIndex", + "TypeError", + "Array.prototype.findLastIndex called on incompatible receiver a number." + ], + [ + "findLastIndex", + "TypeError", + "Array.prototype.findLastIndex called on incompatible receiver a string." + ], + [ + "findLastIndex", + "TypeError", + "Array.prototype.findLastIndex called on incompatible receiver a data object." + ], + [ + "findLastIndex", + "TypeError", + "Array.prototype.findLastIndex called on incompatible receiver null." + ], + [ + "findLastIndex", + "TypeError", + "Array.prototype.findLastIndex called on incompatible receiver undefined." + ], + [ + "flat", + "TypeError", + "Array.prototype.flat called on incompatible receiver a number." + ], + [ + "flat", + "TypeError", + "Array.prototype.flat called on incompatible receiver a string." + ], + [ + "flat", + "TypeError", + "Array.prototype.flat called on incompatible receiver a data object." + ], + [ + "flat", + "TypeError", + "Array.prototype.flat called on incompatible receiver null." + ], + [ + "flat", + "TypeError", + "Array.prototype.flat called on incompatible receiver undefined." + ], + [ + "flatMap", + "TypeError", + "Array.prototype.flatMap called on incompatible receiver a number." + ], + [ + "flatMap", + "TypeError", + "Array.prototype.flatMap called on incompatible receiver a string." + ], + [ + "flatMap", + "TypeError", + "Array.prototype.flatMap called on incompatible receiver a data object." + ], + [ + "flatMap", + "TypeError", + "Array.prototype.flatMap called on incompatible receiver null." + ], + [ + "flatMap", + "TypeError", + "Array.prototype.flatMap called on incompatible receiver undefined." + ], + [ + "forEach", + "TypeError", + "Array.prototype.forEach called on incompatible receiver a number." + ], + [ + "forEach", + "TypeError", + "Array.prototype.forEach called on incompatible receiver a string." + ], + [ + "forEach", + "TypeError", + "Array.prototype.forEach called on incompatible receiver a data object." + ], + [ + "forEach", + "TypeError", + "Array.prototype.forEach called on incompatible receiver null." + ], + [ + "forEach", + "TypeError", + "Array.prototype.forEach called on incompatible receiver undefined." + ], + [ + "includes", + "TypeError", + "Array.prototype.includes called on incompatible receiver a number." + ], + [ + "includes", + "TypeError", + "Array.prototype.includes called on incompatible receiver a string." + ], + [ + "includes", + "TypeError", + "Array.prototype.includes called on incompatible receiver a data object." + ], + [ + "includes", + "TypeError", + "Array.prototype.includes called on incompatible receiver null." + ], + [ + "includes", + "TypeError", + "Array.prototype.includes called on incompatible receiver undefined." + ], + [ + "indexOf", + "TypeError", + "Array.prototype.indexOf called on incompatible receiver a number." + ], + [ + "indexOf", + "TypeError", + "Array.prototype.indexOf called on incompatible receiver a string." + ], + [ + "indexOf", + "TypeError", + "Array.prototype.indexOf called on incompatible receiver a data object." + ], + [ + "indexOf", + "TypeError", + "Array.prototype.indexOf called on incompatible receiver null." + ], + [ + "indexOf", + "TypeError", + "Array.prototype.indexOf called on incompatible receiver undefined." + ], + [ + "join", + "TypeError", + "Array.prototype.join called on incompatible receiver a number." + ], + [ + "join", + "TypeError", + "Array.prototype.join called on incompatible receiver a string." + ], + [ + "join", + "TypeError", + "Array.prototype.join called on incompatible receiver a data object." + ], + [ + "join", + "TypeError", + "Array.prototype.join called on incompatible receiver null." + ], + [ + "join", + "TypeError", + "Array.prototype.join called on incompatible receiver undefined." + ], + [ + "keys", + "TypeError", + "Array.prototype.keys called on incompatible receiver a number." + ], + [ + "keys", + "TypeError", + "Array.prototype.keys called on incompatible receiver a string." + ], + [ + "keys", + "TypeError", + "Array.prototype.keys called on incompatible receiver a data object." + ], + [ + "keys", + "TypeError", + "Array.prototype.keys called on incompatible receiver null." + ], + [ + "keys", + "TypeError", + "Array.prototype.keys called on incompatible receiver undefined." + ], + [ + "lastIndexOf", + "TypeError", + "Array.prototype.lastIndexOf called on incompatible receiver a number." + ], + [ + "lastIndexOf", + "TypeError", + "Array.prototype.lastIndexOf called on incompatible receiver a string." + ], + [ + "lastIndexOf", + "TypeError", + "Array.prototype.lastIndexOf called on incompatible receiver a data object." + ], + [ + "lastIndexOf", + "TypeError", + "Array.prototype.lastIndexOf called on incompatible receiver null." + ], + [ + "lastIndexOf", + "TypeError", + "Array.prototype.lastIndexOf called on incompatible receiver undefined." + ], + [ + "map", + "TypeError", + "Array.prototype.map called on incompatible receiver a number." + ], + [ + "map", + "TypeError", + "Array.prototype.map called on incompatible receiver a string." + ], + [ + "map", + "TypeError", + "Array.prototype.map called on incompatible receiver a data object." + ], + [ + "map", + "TypeError", + "Array.prototype.map called on incompatible receiver null." + ], + [ + "map", + "TypeError", + "Array.prototype.map called on incompatible receiver undefined." + ], + [ + "pop", + "TypeError", + "Array.prototype.pop called on incompatible receiver a number." + ], + [ + "pop", + "TypeError", + "Array.prototype.pop called on incompatible receiver a string." + ], + [ + "pop", + "TypeError", + "Array.prototype.pop called on incompatible receiver a data object." + ], + [ + "pop", + "TypeError", + "Array.prototype.pop called on incompatible receiver null." + ], + [ + "pop", + "TypeError", + "Array.prototype.pop called on incompatible receiver undefined." + ], + [ + "push", + "TypeError", + "Array.prototype.push called on incompatible receiver a number." + ], + [ + "push", + "TypeError", + "Array.prototype.push called on incompatible receiver a string." + ], + [ + "push", + "TypeError", + "Array.prototype.push called on incompatible receiver a data object." + ], + [ + "push", + "TypeError", + "Array.prototype.push called on incompatible receiver null." + ], + [ + "push", + "TypeError", + "Array.prototype.push called on incompatible receiver undefined." + ], + [ + "reduce", + "TypeError", + "Array.prototype.reduce called on incompatible receiver a number." + ], + [ + "reduce", + "TypeError", + "Array.prototype.reduce called on incompatible receiver a string." + ], + [ + "reduce", + "TypeError", + "Array.prototype.reduce called on incompatible receiver a data object." + ], + [ + "reduce", + "TypeError", + "Array.prototype.reduce called on incompatible receiver null." + ], + [ + "reduce", + "TypeError", + "Array.prototype.reduce called on incompatible receiver undefined." + ], + [ + "reduceRight", + "TypeError", + "Array.prototype.reduceRight called on incompatible receiver a number." + ], + [ + "reduceRight", + "TypeError", + "Array.prototype.reduceRight called on incompatible receiver a string." + ], + [ + "reduceRight", + "TypeError", + "Array.prototype.reduceRight called on incompatible receiver a data object." + ], + [ + "reduceRight", + "TypeError", + "Array.prototype.reduceRight called on incompatible receiver null." + ], + [ + "reduceRight", + "TypeError", + "Array.prototype.reduceRight called on incompatible receiver undefined." + ], + [ + "reverse", + "TypeError", + "Array.prototype.reverse called on incompatible receiver a number." + ], + [ + "reverse", + "TypeError", + "Array.prototype.reverse called on incompatible receiver a string." + ], + [ + "reverse", + "TypeError", + "Array.prototype.reverse called on incompatible receiver a data object." + ], + [ + "reverse", + "TypeError", + "Array.prototype.reverse called on incompatible receiver null." + ], + [ + "reverse", + "TypeError", + "Array.prototype.reverse called on incompatible receiver undefined." + ], + [ + "shift", + "TypeError", + "Array.prototype.shift called on incompatible receiver a number." + ], + [ + "shift", + "TypeError", + "Array.prototype.shift called on incompatible receiver a string." + ], + [ + "shift", + "TypeError", + "Array.prototype.shift called on incompatible receiver a data object." + ], + [ + "shift", + "TypeError", + "Array.prototype.shift called on incompatible receiver null." + ], + [ + "shift", + "TypeError", + "Array.prototype.shift called on incompatible receiver undefined." + ], + [ + "slice", + "TypeError", + "Array.prototype.slice called on incompatible receiver a number." + ], + [ + "slice", + "TypeError", + "Array.prototype.slice called on incompatible receiver a string." + ], + [ + "slice", + "TypeError", + "Array.prototype.slice called on incompatible receiver a data object." + ], + [ + "slice", + "TypeError", + "Array.prototype.slice called on incompatible receiver null." + ], + [ + "slice", + "TypeError", + "Array.prototype.slice called on incompatible receiver undefined." + ], + [ + "some", + "TypeError", + "Array.prototype.some called on incompatible receiver a number." + ], + [ + "some", + "TypeError", + "Array.prototype.some called on incompatible receiver a string." + ], + [ + "some", + "TypeError", + "Array.prototype.some called on incompatible receiver a data object." + ], + [ + "some", + "TypeError", + "Array.prototype.some called on incompatible receiver null." + ], + [ + "some", + "TypeError", + "Array.prototype.some called on incompatible receiver undefined." + ], + [ + "sort", + "TypeError", + "Array.prototype.sort called on incompatible receiver a number." + ], + [ + "sort", + "TypeError", + "Array.prototype.sort called on incompatible receiver a string." + ], + [ + "sort", + "TypeError", + "Array.prototype.sort called on incompatible receiver a data object." + ], + [ + "sort", + "TypeError", + "Array.prototype.sort called on incompatible receiver null." + ], + [ + "sort", + "TypeError", + "Array.prototype.sort called on incompatible receiver undefined." + ], + [ + "splice", + "TypeError", + "Array.prototype.splice called on incompatible receiver a number." + ], + [ + "splice", + "TypeError", + "Array.prototype.splice called on incompatible receiver a string." + ], + [ + "splice", + "TypeError", + "Array.prototype.splice called on incompatible receiver a data object." + ], + [ + "splice", + "TypeError", + "Array.prototype.splice called on incompatible receiver null." + ], + [ + "splice", + "TypeError", + "Array.prototype.splice called on incompatible receiver undefined." + ], + [ + "toLocaleString", + "TypeError", + "Array.prototype.toLocaleString called on incompatible receiver a number." + ], + [ + "toLocaleString", + "TypeError", + "Array.prototype.toLocaleString called on incompatible receiver a string." + ], + [ + "toLocaleString", + "TypeError", + "Array.prototype.toLocaleString called on incompatible receiver a data object." + ], + [ + "toLocaleString", + "TypeError", + "Array.prototype.toLocaleString called on incompatible receiver null." + ], + [ + "toLocaleString", + "TypeError", + "Array.prototype.toLocaleString called on incompatible receiver undefined." + ], + [ + "toReversed", + "TypeError", + "Array.prototype.toReversed called on incompatible receiver a number." + ], + [ + "toReversed", + "TypeError", + "Array.prototype.toReversed called on incompatible receiver a string." + ], + [ + "toReversed", + "TypeError", + "Array.prototype.toReversed called on incompatible receiver a data object." + ], + [ + "toReversed", + "TypeError", + "Array.prototype.toReversed called on incompatible receiver null." + ], + [ + "toReversed", + "TypeError", + "Array.prototype.toReversed called on incompatible receiver undefined." + ], + [ + "toSorted", + "TypeError", + "Array.prototype.toSorted called on incompatible receiver a number." + ], + [ + "toSorted", + "TypeError", + "Array.prototype.toSorted called on incompatible receiver a string." + ], + [ + "toSorted", + "TypeError", + "Array.prototype.toSorted called on incompatible receiver a data object." + ], + [ + "toSorted", + "TypeError", + "Array.prototype.toSorted called on incompatible receiver null." + ], + [ + "toSorted", + "TypeError", + "Array.prototype.toSorted called on incompatible receiver undefined." + ], + [ + "toSpliced", + "TypeError", + "Array.prototype.toSpliced called on incompatible receiver a number." + ], + [ + "toSpliced", + "TypeError", + "Array.prototype.toSpliced called on incompatible receiver a string." + ], + [ + "toSpliced", + "TypeError", + "Array.prototype.toSpliced called on incompatible receiver a data object." + ], + [ + "toSpliced", + "TypeError", + "Array.prototype.toSpliced called on incompatible receiver null." + ], + [ + "toSpliced", + "TypeError", + "Array.prototype.toSpliced called on incompatible receiver undefined." + ], + [ + "toString", + "TypeError", + "Array.prototype.toString called on incompatible receiver a number." + ], + [ + "toString", + "TypeError", + "Array.prototype.toString called on incompatible receiver a string." + ], + [ + "toString", + "TypeError", + "Array.prototype.toString called on incompatible receiver a data object." + ], + [ + "toString", + "TypeError", + "Array.prototype.toString called on incompatible receiver null." + ], + [ + "toString", + "TypeError", + "Array.prototype.toString called on incompatible receiver undefined." + ], + [ + "unshift", + "TypeError", + "Array.prototype.unshift called on incompatible receiver a number." + ], + [ + "unshift", + "TypeError", + "Array.prototype.unshift called on incompatible receiver a string." + ], + [ + "unshift", + "TypeError", + "Array.prototype.unshift called on incompatible receiver a data object." + ], + [ + "unshift", + "TypeError", + "Array.prototype.unshift called on incompatible receiver null." + ], + [ + "unshift", + "TypeError", + "Array.prototype.unshift called on incompatible receiver undefined." + ], + [ + "values", + "TypeError", + "Array.prototype.values called on incompatible receiver a number." + ], + [ + "values", + "TypeError", + "Array.prototype.values called on incompatible receiver a string." + ], + [ + "values", + "TypeError", + "Array.prototype.values called on incompatible receiver a data object." + ], + [ + "values", + "TypeError", + "Array.prototype.values called on incompatible receiver null." + ], + [ + "values", + "TypeError", + "Array.prototype.values called on incompatible receiver undefined." + ], + [ + "with", + "TypeError", + "Array.prototype.with called on incompatible receiver a number." + ], + [ + "with", + "TypeError", + "Array.prototype.with called on incompatible receiver a string." + ], + [ + "with", + "TypeError", + "Array.prototype.with called on incompatible receiver a data object." + ], + [ + "with", + "TypeError", + "Array.prototype.with called on incompatible receiver null." + ], + [ + "with", + "TypeError", + "Array.prototype.with called on incompatible receiver undefined." + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-buffer.js b/packages/codemode-rust/conformance/cases/std-buffer.js new file mode 100644 index 0000000000000..0cc1af97fcc91 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-buffer.js @@ -0,0 +1,32 @@ +const out = [] +const b = Buffer.from("héllo") +out.push([b.length, b.toString(), String(b), `${b}`, b.toString("hex"), b.toString("base64"), Buffer.from("aGk=", "base64").toString(), Buffer.from("6869", "hex").toString(), Buffer.byteLength("é")]) +const c = Buffer.from([1, 2, 3]) +out.push([c instanceof Uint8Array, Buffer.isBuffer(c), Buffer.isBuffer(new Uint8Array(1)), [...c], c[1], Object.prototype.toString.call(c)]) +const d = Buffer.concat([Buffer.from("ab"), Buffer.from("cd")]) +const view = d.subarray(1, 3) +view[0] = 120 +out.push([d.toString(), view.toString(), d.equals(Buffer.from("axcd")), Buffer.compare(Buffer.from("a"), Buffer.from("b")), d.includes("cd"), d.indexOf("c"), Buffer.alloc(3, 1).toString("hex"), Buffer.alloc(4, "ab").toString()]) +const e = Buffer.alloc(4) +e.writeUInt16BE(0x1234, 0) +e.writeInt8(-1, 2) +out.push([e.readUInt16BE(0), e.readUInt16LE(0), e.readInt8(2), e.toString("hex")]) +let code +try { Buffer.from("x", "nope") } catch (err) { code = [err.name, err.code, err.message] } +out.push([JSON.stringify(Buffer.from("hi")), code]) +const f = Buffer.alloc(16) +out.push(f.writeUInt32LE(0xdeadbeef, 0), f.writeInt32BE(-2, 4), f.writeDoubleLE(1.5, 8), f.readUInt32LE(0), f.readInt32BE(4), f.readDoubleLE(8), f.readUIntBE(0, 3), f.readIntLE(4, 2), f.writeUIntBE(0x123456, 0, 3), f.readUIntBE(0, 3), f.writeFloatBE(2.5, 0), f.readFloatBE(0)) +for (const run of [() => f.readUInt8(16), () => f.readUInt8(-1), () => f.readUInt8(1.5), () => f.readUInt8("1"), () => f.writeUInt8(256, 0), () => f.writeInt16LE(40000), () => f.readUIntLE(0, 7), () => Buffer.alloc(-1), () => Buffer.from({}), () => d.equals("x")]) { + try { out.push(run()) } catch (err) { out.push([err.name, err.code, err.message]) } +} +const g = Buffer.from("hello world") +out.push(g.toString("utf8", 6), g.toString("ascii", 0, 5), g.slice(-5).toString(), g.lastIndexOf("o"), g.indexOf("o", 5), g.indexOf(Buffer.from("wor")), g.indexOf(111), g.includes("xyz"), g.indexOf("o", -3), g.lastIndexOf("o", 5)) +const h = Buffer.alloc(8) +out.push(h.write("abc"), h.write("zz", 5), h.write("é", 7), h.toString("hex"), h.write("xy", 1, 1), h.toString()) +out.push(Buffer.from("€", "latin1").toString("hex"), Buffer.from("hi", "utf16le").toString("hex"), Buffer.from("6869", "hex").toString("utf16le"), Buffer.from([0xff, 0x80]).toString("latin1"), Buffer.from([0xc3, 0xa9, 0x80]).toString("ascii"), Buffer.from("_-8", "base64url").toString("hex"), Buffer.from([255, 254]).toString("base64url"), Buffer.from("zz12", "hex").length) +const t = Buffer.alloc(5) +out.push(Buffer.from("abc").copy(t, 1), t.toString("hex"), Buffer.from("abcd").fill("x", 1, 3).toString(), Buffer.from("abcd").fill(0).toString("hex"), Buffer.from([1,2,3,4]).swap16().toString("hex"), Buffer.from("b").compare(Buffer.from("a")), Buffer.from("abc").compare(Buffer.from("xbcx"), 1, 3, 1, 3)) +out.push(Buffer.isEncoding("UTF-8"), Buffer.isEncoding("nope"), Buffer.poolSize, Buffer.byteLength("aGk=", "base64"), Buffer.byteLength(new Uint8Array(3)), Buffer.from(Buffer.from("xyz"), 1, 1).toString(), Buffer.from({ type: "Buffer", data: [65, 66] }).toString(), Buffer.from({ length: 2, 0: 67, 1: 68 }).toString(), Buffer("hey").toString(), new Buffer("hey").toString(), Buffer.allocUnsafe(2).length) +console.log(Buffer.from("hi"), Buffer.alloc(0), Buffer.alloc(52)) +out.push(Buffer.from("ab").slice(0, 1) instanceof Buffer, Buffer.isBuffer(Buffer.from("ab").subarray(1)), Buffer.from("a").toJSON()) +return out diff --git a/packages/codemode-rust/conformance/cases/std-buffer.json b/packages/codemode-rust/conformance/cases/std-buffer.json new file mode 100644 index 0000000000000..25e785d904155 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-buffer.json @@ -0,0 +1,169 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 6, + "héllo", + "héllo", + "héllo", + "68c3a96c6c6f", + "aMOpbGxv", + "hi", + "hi", + 2 + ], + [ + true, + true, + false, + [ + 1, + 2, + 3 + ], + 2, + "[object Uint8Array]" + ], + [ + "axcd", + "xc", + true, + -1, + true, + 2, + "010101", + "abab" + ], + [ + 4660, + 13330, + -1, + "1234ff00" + ], + [ + "{\"type\":\"Buffer\",\"data\":[104,105]}", + [ + "TypeError", + "ERR_UNKNOWN_ENCODING", + "Unknown encoding: nope" + ] + ], + 4, + 8, + 16, + 3735928559, + -2, + 1.5, + 15711917, + -1, + 3, + 1193046, + 4, + 2.5, + [ + "RangeError", + "ERR_OUT_OF_RANGE", + "The value of \"offset\" is out of range. It must be >= 0 and <= 15. Received 16" + ], + [ + "RangeError", + "ERR_OUT_OF_RANGE", + "The value of \"offset\" is out of range. It must be >= 0 and <= 15. Received -1" + ], + [ + "RangeError", + "ERR_OUT_OF_RANGE", + "The value of \"offset\" is out of range. It must be an integer. Received 1.5" + ], + [ + "TypeError", + "ERR_INVALID_ARG_TYPE", + "The \"offset\" argument must be of type number. Received type string ('1')" + ], + [ + "RangeError", + "ERR_OUT_OF_RANGE", + "The value of \"value\" is out of range. It must be >= 0 and <= 255. Received 256" + ], + [ + "RangeError", + "ERR_OUT_OF_RANGE", + "The value of \"value\" is out of range. It must be >= -32768 and <= 32767. Received 40000" + ], + [ + "RangeError", + "ERR_OUT_OF_RANGE", + "The value of \"byteLength\" is out of range. It must be >= 1 and <= 6. Received 7" + ], + [ + "RangeError", + "ERR_OUT_OF_RANGE", + "The argument 'size' is invalid. Received -1" + ], + [ + "TypeError", + "ERR_INVALID_ARG_TYPE", + "The first argument must be of type string or an instance of Buffer, Uint8Array, or Array or an Array-like Object. Received a data object" + ], + [ + "TypeError", + null, + "The \"otherBuffer\" argument must be an instance of Buffer or Uint8Array. Received a string" + ], + "world", + "hello", + "world", + 7, + 7, + 6, + 4, + false, + -1, + 4, + 3, + 2, + 0, + "61626300007a7a00", + 1, + "axc\u0000\u0000zz\u0000", + "ac", + "68006900", + "楨", + "ÿ€", + "C)\u0000", + "ffef", + "__4", + 0, + 3, + "0061626300", + "axxd", + "00000000", + "02010403", + 1, + 0, + true, + false, + 8192, + 2, + 3, + "y", + "AB", + "CD", + "hey", + "hey", + 2, + true, + true, + { + "type": "Buffer", + "data": [ + 97 + ] + } + ], + "logs": [ + " " + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-builtin-key-order.js b/packages/codemode-rust/conformance/cases/std-builtin-key-order.js new file mode 100644 index 0000000000000..770ac883b5ade --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-builtin-key-order.js @@ -0,0 +1,63 @@ +// The own property names of every built-in constructor and prototype, in order (Object.getOwnPropertyNames). +const out = {} +const seen = new Set() +const visit = (label, o) => { + if (o === null || (typeof o !== "object" && typeof o !== "function") || seen.has(o)) return + seen.add(o) + let keys + try { keys = Object.getOwnPropertyNames(o) } catch (e) { return } + out[label] = keys.join(",") + for (const k of keys) { + let d + try { d = Object.getOwnPropertyDescriptor(o, k) } catch (e) { continue } + if (d && "value" in d && (typeof d.value === "function" || (typeof d.value === "object" && d.value !== null)) && (k === "prototype" || /^[A-Z]/.test(k) || label === "globalThis")) visit(label + "." + k, d.value) + } + try { visit(label + ".__proto__", Object.getPrototypeOf(o)) } catch (e) {} +} +try { visit("Buffer", Buffer) } catch (e) {} +try { visit("TextEncoder", TextEncoder) } catch (e) {} +try { visit("TextDecoder", TextDecoder) } catch (e) {} +try { visit("Map", Map) } catch (e) {} +try { visit("Set", Set) } catch (e) {} +try { visit("Object", Object) } catch (e) {} +try { visit("WeakMap", WeakMap) } catch (e) {} +try { visit("URL", URL) } catch (e) {} +try { visit("URLSearchParams", URLSearchParams) } catch (e) {} +try { visit("Object", Object) } catch (e) {} +try { visit("Function", Function) } catch (e) {} +try { visit("Array", Array) } catch (e) {} +try { visit("String", String) } catch (e) {} +try { visit("Number", Number) } catch (e) {} +try { visit("Boolean", Boolean) } catch (e) {} +try { visit("Symbol", Symbol) } catch (e) {} +try { visit("Math", Math) } catch (e) {} +try { visit("JSON", JSON) } catch (e) {} +try { visit("Promise", Promise) } catch (e) {} +try { visit("Map", Map) } catch (e) {} +try { visit("Set", Set) } catch (e) {} +try { visit("Error", Error) } catch (e) {} +try { visit("TypeError", TypeError) } catch (e) {} +try { visit("RangeError", RangeError) } catch (e) {} +try { visit("SyntaxError", SyntaxError) } catch (e) {} +try { visit("ReferenceError", ReferenceError) } catch (e) {} +try { visit("EvalError", EvalError) } catch (e) {} +try { visit("URIError", URIError) } catch (e) {} +try { visit("AggregateError", AggregateError) } catch (e) {} +try { visit("RegExp", RegExp) } catch (e) {} +try { visit("Date", Date) } catch (e) {} +try { visit("Buffer", Buffer) } catch (e) {} +try { visit("WeakMap", WeakMap) } catch (e) {} +try { visit("WeakSet", WeakSet) } catch (e) {} +try { visit("Iterator", Iterator) } catch (e) {} +try { visit("URL", URL) } catch (e) {} +try { visit("URLSearchParams", URLSearchParams) } catch (e) {} +try { visit("Headers", Headers) } catch (e) {} +try { visit("TextEncoder", TextEncoder) } catch (e) {} +try { visit("TextDecoder", TextDecoder) } catch (e) {} +try { visit("console", console) } catch (e) {} +try { visit("NaN", NaN) } catch (e) {} +try { visit("Infinity", Infinity) } catch (e) {} +try { visit("NaN", NaN) } catch (e) {} +try { visit("Infinity", Infinity) } catch (e) {} +for (const [l, x] of [["iter", [][Symbol.iterator]()], ["gen", (function* () {})()], ["agen", (async function* () {})()], ["gf", function* () {}], ["agf", async function* () {}], ["af", async function () {}], ["miter", new Map().entries()], ["siter", ""[Symbol.iterator]()], ["helper", [1].values().map((x) => x)]]) visit(l, Object.getPrototypeOf(x)) +return out diff --git a/packages/codemode-rust/conformance/cases/std-builtin-key-order.json b/packages/codemode-rust/conformance/cases/std-builtin-key-order.json new file mode 100644 index 0000000000000..4c9abc8429858 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-builtin-key-order.json @@ -0,0 +1,79 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "Buffer": "length,name,prototype,BYTES_PER_ELEMENT,from,alloc,allocUnsafe,allocUnsafeSlow,byteLength,concat,isBuffer,isEncoding,compare,poolSize", + "Buffer.prototype": "constructor,toString,toJSON,slice,subarray,equals,compare,indexOf,lastIndexOf,includes,write,fill,copy,readUInt8,readUint8,readInt8,readUInt16LE,readUint16LE,readUInt16BE,readUint16BE,readInt16LE,readInt16BE,readUInt32LE,readUint32LE,readUInt32BE,readUint32BE,readInt32LE,readInt32BE,readFloatLE,readFloatBE,readDoubleLE,readDoubleBE,readUIntLE,readUIntBE,readIntLE,readIntBE,writeUInt8,writeUint8,writeInt8,writeUInt16LE,writeUint16LE,writeUInt16BE,writeUint16BE,writeInt16LE,writeInt16BE,writeUInt32LE,writeUint32LE,writeUInt32BE,writeUint32BE,writeInt32LE,writeInt32BE,writeFloatLE,writeFloatBE,writeDoubleLE,writeDoubleBE,writeUIntLE,writeUIntBE,writeIntLE,writeIntBE,swap16,swap32,swap64", + "Buffer.prototype.__proto__": "constructor,BYTES_PER_ELEMENT,length,at,slice,subarray,set,fill,reverse,sort,indexOf,lastIndexOf,includes,join,toString,toBase64,toHex,keys,values,entries,map,filter,forEach,some,every,find,findIndex,findLast,findLastIndex,reduce,reduceRight", + "Buffer.prototype.__proto__.__proto__": "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toString,toLocaleString,valueOf", + "Buffer.__proto__": "length,name,call,apply,bind,caller,arguments,constructor", + "TextEncoder": "length,name,prototype", + "TextEncoder.prototype": "encoding,encode,constructor", + "TextDecoder": "length,name,prototype", + "TextDecoder.prototype": "encoding,fatal,ignoreBOM,decode,constructor", + "Map": "length,name,prototype,groupBy", + "Map.prototype": "constructor,size,get,has,set,getOrInsert,getOrInsertComputed,delete,clear,keys,values,entries,forEach", + "Set": "length,name,prototype", + "Set.prototype": "constructor,size,has,add,delete,clear,values,entries,keys,forEach,union,intersection,difference,symmetricDifference,isSubsetOf,isSupersetOf,isDisjointFrom", + "Object": "length,name,prototype,keys,values,entries,hasOwn,is,assign,freeze,seal,preventExtensions,isFrozen,isSealed,isExtensible,getPrototypeOf,create,defineProperty,defineProperties,getOwnPropertyDescriptor,getOwnPropertyDescriptors,getOwnPropertyNames,groupBy,fromEntries", + "WeakMap": "length,name,prototype", + "WeakMap.prototype": "constructor,get,has,delete,set,getOrInsert,getOrInsertComputed", + "URL": "length,name,prototype,canParse,parse", + "URL.prototype": "constructor,href,origin,protocol,username,password,host,hostname,port,pathname,search,hash,searchParams,toString,toJSON", + "URLSearchParams": "length,name,prototype", + "URLSearchParams.prototype": "constructor,size,append,delete,get,getAll,has,set,sort,keys,values,entries,toString,forEach", + "Function": "length,name,prototype", + "Array": "length,name,prototype,isArray,of,from", + "Array.prototype": "length,constructor,join,toString,includes,indexOf,lastIndexOf,at,slice,concat,flat,reverse,sort,toSorted,toReversed,with,push,unshift,pop,shift,splice,toSpliced,fill,copyWithin,keys,values,entries,map,filter,forEach,some,every,find,findIndex,findLast,findLastIndex,reduce,reduceRight,flatMap,toLocaleString", + "String": "length,name,prototype,fromCharCode,fromCodePoint,raw", + "String.prototype": "constructor,toString,valueOf,toLowerCase,toUpperCase,toLocaleLowerCase,toLocaleUpperCase,trim,trimStart,trimLeft,trimEnd,trimRight,localeCompare,normalize,split,slice,includes,startsWith,endsWith,indexOf,lastIndexOf,replace,replaceAll,match,matchAll,search,repeat,padStart,padEnd,charAt,at,substring,substr,isWellFormed,toWellFormed,charCodeAt,codePointAt,concat", + "Number": "length,name,prototype,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,MAX_VALUE,MIN_VALUE,EPSILON,NaN,POSITIVE_INFINITY,NEGATIVE_INFINITY,isInteger,isFinite,isNaN,isSafeInteger,parseInt,parseFloat", + "Number.prototype": "constructor,toFixed,toLocaleString,toExponential,toPrecision,toString,valueOf", + "Boolean": "length,name,prototype", + "Boolean.prototype": "constructor,toString,valueOf", + "Symbol": "length,name,asyncIterator,iterator", + "Math": "PI,E,LN2,LN10,LOG2E,LOG10E,SQRT2,SQRT1_2,random,max,min,hypot,abs,acos,acosh,asin,asinh,atan,atan2,atanh,floor,ceil,round,trunc,sign,sqrt,cbrt,pow,cos,cosh,sin,sinh,tan,tanh,log,log2,log10,log1p,exp,expm1,f16round,fround,clz32,imul,sumPrecise", + "JSON": "parse,stringify", + "Promise": "length,name,prototype,all,allSettled,race,any,resolve,reject,withResolvers,try", + "Promise.prototype": "constructor,then,catch,finally", + "Error": "length,name,prototype,isError", + "Error.prototype": "name,message,constructor,toString", + "TypeError": "length,name,prototype", + "TypeError.prototype": "name,message,constructor", + "RangeError": "length,name,prototype", + "RangeError.prototype": "name,message,constructor", + "SyntaxError": "length,name,prototype", + "SyntaxError.prototype": "name,message,constructor", + "ReferenceError": "length,name,prototype", + "ReferenceError.prototype": "name,message,constructor", + "EvalError": "length,name,prototype", + "EvalError.prototype": "name,message,constructor", + "URIError": "length,name,prototype", + "URIError.prototype": "name,message,constructor", + "AggregateError": "length,name,prototype", + "AggregateError.prototype": "name,message,constructor", + "RegExp": "length,name,prototype,escape", + "RegExp.prototype": "constructor,source,flags,lastIndex,hasIndices,global,ignoreCase,multiline,sticky,unicode,unicodeSets,dotAll,exec,test,toString", + "Date": "length,name,prototype,now,parse,UTC", + "Date.prototype": "constructor,getTime,valueOf,toISOString,toJSON,toString,toDateString,toTimeString,toUTCString,toGMTString,toLocaleString,toLocaleDateString,toLocaleTimeString,getFullYear,getMonth,getDate,getDay,getHours,getMinutes,getSeconds,getMilliseconds,getUTCFullYear,getUTCMonth,getUTCDate,getUTCDay,getUTCHours,getUTCMinutes,getUTCSeconds,getUTCMilliseconds,getTimezoneOffset,setTime,setMilliseconds,setUTCMilliseconds,setSeconds,setUTCSeconds,setMinutes,setUTCMinutes,setHours,setUTCHours,setDate,setUTCDate,setMonth,setUTCMonth,setFullYear,setUTCFullYear", + "Date.UTC": "length,name", + "WeakSet": "length,name,prototype", + "WeakSet.prototype": "constructor,has,delete,add", + "Iterator": "length,name,prototype,from", + "Iterator.prototype": "next,constructor,map,filter,take,drop,flatMap,toArray,reduce,forEach,some,every,find", + "Headers": "length,name,prototype", + "Headers.prototype": "constructor,append,delete,get,getSetCookie,has,set,keys,values,entries,forEach", + "console": "log,info,debug,warn,error,dir,table", + "gen": "", + "gen.__proto__": "constructor,next,return,throw", + "agen": "", + "agen.__proto__": "constructor,next,return,throw", + "agen.__proto__.__proto__": "", + "gf": "prototype", + "agf": "prototype", + "af": "", + "helper": "next,return" + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-callback-admission.js b/packages/codemode-rust/conformance/cases/std-callback-admission.js new file mode 100644 index 0000000000000..793e3de5a6b20 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-callback-admission.js @@ -0,0 +1,45 @@ +// Which functions callback sites admit: built-ins, bound functions and closures, but not the Promise statics, Symbol, +// or a tool, each refused with the site's own wording. +const sites = { + map: (f) => [1].map(f), + sort: (f) => [2, 1].sort(f), + then: (f) => Promise.resolve(1).then(f), + catch: (f) => Promise.reject(1).catch(f), + finally: (f) => Promise.resolve(1).finally(f), + replace: (f) => "a".replace("a", f), + replaceAll: (f) => "a".replaceAll("a", f), + parse: (f) => JSON.parse("[1]", f), + stringify: (f) => JSON.stringify([1], f), +} +const callables = { + abs: Math.abs, + string: String, + bound: ((x) => x).bind(null), + arrow: (x) => x, + resolve: Promise.resolve, + all: Promise.all, + withResolvers: Promise.withResolvers, + symbol: Symbol, + tool: tools.echo, + nested: tools.git.status, + number: 5, +} +const out = [] +for (const [s, site] of Object.entries(sites)) { + for (const [c, f] of Object.entries(callables)) { + try { + const v = site(f) + out.push([s, c, v instanceof Promise ? "promise" : v]) + } catch (e) { + out.push([s, c, e.name, e.message]) + } + } +} +for (const f of [() => Symbol("s"), () => new Symbol(), () => (tools.x = 1), () => (tools.git.x = 1)]) { + try { + out.push(f()) + } catch (e) { + out.push([e.name, e.message]) + } +} +return out diff --git a/packages/codemode-rust/conformance/cases/std-callback-admission.json b/packages/codemode-rust/conformance/cases/std-callback-admission.json new file mode 100644 index 0000000000000..213b6c885c231 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-callback-admission.json @@ -0,0 +1,597 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "map", + "abs", + [ + 1 + ] + ], + [ + "map", + "string", + [ + "1" + ] + ], + [ + "map", + "bound", + [ + 1 + ] + ], + [ + "map", + "arrow", + [ + 1 + ] + ], + [ + "map", + "resolve", + "TypeError", + "Array.map cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "map", + "all", + "TypeError", + "Array.map cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "map", + "withResolvers", + "TypeError", + "Array.map cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "map", + "symbol", + "TypeError", + "Array.map cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "map", + "tool", + "TypeError", + "Array.map cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "map", + "nested", + "TypeError", + "Array.map cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "map", + "number", + "TypeError", + "Array.map expects a function callback." + ], + [ + "sort", + "abs", + [ + 1, + 2 + ] + ], + [ + "sort", + "string", + [ + 1, + 2 + ] + ], + [ + "sort", + "bound", + [ + 1, + 2 + ] + ], + [ + "sort", + "arrow", + [ + 1, + 2 + ] + ], + [ + "sort", + "resolve", + "TypeError", + "Array.sort cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "sort", + "all", + "TypeError", + "Array.sort cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "sort", + "withResolvers", + "TypeError", + "Array.sort cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "sort", + "symbol", + "TypeError", + "Array.sort cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "sort", + "tool", + "TypeError", + "Array.sort cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "sort", + "nested", + "TypeError", + "Array.sort cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "sort", + "number", + "TypeError", + "Array.sort expects a function callback." + ], + [ + "then", + "abs", + "promise" + ], + [ + "then", + "string", + "promise" + ], + [ + "then", + "bound", + "promise" + ], + [ + "then", + "arrow", + "promise" + ], + [ + "then", + "resolve", + "TypeError", + "Promise.prototype.then cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "then", + "all", + "TypeError", + "Promise.prototype.then cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "then", + "withResolvers", + "TypeError", + "Promise.prototype.then cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "then", + "symbol", + "TypeError", + "Promise.prototype.then cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "then", + "tool", + "TypeError", + "Promise.prototype.then cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "then", + "nested", + "TypeError", + "Promise.prototype.then cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "then", + "number", + "promise" + ], + [ + "catch", + "abs", + "promise" + ], + [ + "catch", + "string", + "promise" + ], + [ + "catch", + "bound", + "promise" + ], + [ + "catch", + "arrow", + "promise" + ], + [ + "catch", + "resolve", + "TypeError", + "Promise.prototype.catch cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "catch", + "all", + "TypeError", + "Promise.prototype.catch cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "catch", + "withResolvers", + "TypeError", + "Promise.prototype.catch cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "catch", + "symbol", + "TypeError", + "Promise.prototype.catch cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "catch", + "tool", + "TypeError", + "Promise.prototype.catch cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "catch", + "nested", + "TypeError", + "Promise.prototype.catch cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "catch", + "number", + "promise" + ], + [ + "finally", + "abs", + "promise" + ], + [ + "finally", + "string", + "promise" + ], + [ + "finally", + "bound", + "promise" + ], + [ + "finally", + "arrow", + "promise" + ], + [ + "finally", + "resolve", + "TypeError", + "Promise.prototype.finally cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "finally", + "all", + "TypeError", + "Promise.prototype.finally cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "finally", + "withResolvers", + "TypeError", + "Promise.prototype.finally cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "finally", + "symbol", + "TypeError", + "Promise.prototype.finally cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "finally", + "tool", + "TypeError", + "Promise.prototype.finally cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "finally", + "nested", + "TypeError", + "Promise.prototype.finally cannot use this callable as a handler; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "finally", + "number", + "promise" + ], + [ + "replace", + "abs", + "NaN" + ], + [ + "replace", + "string", + "a" + ], + [ + "replace", + "bound", + "a" + ], + [ + "replace", + "arrow", + "a" + ], + [ + "replace", + "resolve", + "TypeError", + "String.replace cannot use this callable as a replacer; wrap it in an arrow function, e.g. (match) => fn(match)." + ], + [ + "replace", + "all", + "TypeError", + "String.replace cannot use this callable as a replacer; wrap it in an arrow function, e.g. (match) => fn(match)." + ], + [ + "replace", + "withResolvers", + "TypeError", + "String.replace cannot use this callable as a replacer; wrap it in an arrow function, e.g. (match) => fn(match)." + ], + [ + "replace", + "symbol", + "TypeError", + "String.replace cannot use this callable as a replacer; wrap it in an arrow function, e.g. (match) => fn(match)." + ], + [ + "replace", + "tool", + "TypeError", + "String.replace cannot use this callable as a replacer; wrap it in an arrow function, e.g. (match) => fn(match)." + ], + [ + "replace", + "nested", + "TypeError", + "String.replace cannot use this callable as a replacer; wrap it in an arrow function, e.g. (match) => fn(match)." + ], + [ + "replace", + "number", + "5" + ], + [ + "replaceAll", + "abs", + "NaN" + ], + [ + "replaceAll", + "string", + "a" + ], + [ + "replaceAll", + "bound", + "a" + ], + [ + "replaceAll", + "arrow", + "a" + ], + [ + "replaceAll", + "resolve", + "TypeError", + "String.replaceAll cannot use this callable as a replacer; wrap it in an arrow function, e.g. (match) => fn(match)." + ], + [ + "replaceAll", + "all", + "TypeError", + "String.replaceAll cannot use this callable as a replacer; wrap it in an arrow function, e.g. (match) => fn(match)." + ], + [ + "replaceAll", + "withResolvers", + "TypeError", + "String.replaceAll cannot use this callable as a replacer; wrap it in an arrow function, e.g. (match) => fn(match)." + ], + [ + "replaceAll", + "symbol", + "TypeError", + "String.replaceAll cannot use this callable as a replacer; wrap it in an arrow function, e.g. (match) => fn(match)." + ], + [ + "replaceAll", + "tool", + "TypeError", + "String.replaceAll cannot use this callable as a replacer; wrap it in an arrow function, e.g. (match) => fn(match)." + ], + [ + "replaceAll", + "nested", + "TypeError", + "String.replaceAll cannot use this callable as a replacer; wrap it in an arrow function, e.g. (match) => fn(match)." + ], + [ + "replaceAll", + "number", + "5" + ], + [ + "parse", + "abs", + 0 + ], + [ + "parse", + "string", + "" + ], + [ + "parse", + "bound", + "" + ], + [ + "parse", + "arrow", + "" + ], + [ + "parse", + "resolve", + "TypeError", + "JSON.parse cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "parse", + "all", + "TypeError", + "JSON.parse cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "parse", + "withResolvers", + "TypeError", + "JSON.parse cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "parse", + "symbol", + "TypeError", + "JSON.parse cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "parse", + "tool", + "TypeError", + "JSON.parse cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "parse", + "nested", + "TypeError", + "JSON.parse cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "parse", + "number", + [ + 1 + ] + ], + [ + "stringify", + "abs", + "0" + ], + [ + "stringify", + "string", + "\"\"" + ], + [ + "stringify", + "bound", + "\"\"" + ], + [ + "stringify", + "arrow", + "\"\"" + ], + [ + "stringify", + "resolve", + "TypeError", + "JSON.stringify cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "stringify", + "all", + "TypeError", + "JSON.stringify cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "stringify", + "withResolvers", + "TypeError", + "JSON.stringify cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "stringify", + "symbol", + "TypeError", + "JSON.stringify cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "stringify", + "tool", + "TypeError", + "JSON.stringify cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "stringify", + "nested", + "TypeError", + "JSON.stringify cannot use this callable as a callback; wrap it in an arrow function, e.g. (value) => fn(value)." + ], + [ + "stringify", + "number", + "[1]" + ], + [ + "TypeError", + "Symbol is not callable; only Symbol.asyncIterator and Symbol.iterator are available." + ], + [ + "TypeError", + "new Symbol(...) is not supported; call Symbol(...) without new instead." + ], + [ + "TypeError", + "Only data fields may be assigned." + ], + [ + "TypeError", + "Only data fields may be assigned." + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-callback-errors.js b/packages/codemode-rust/conformance/cases/std-callback-errors.js new file mode 100644 index 0000000000000..b1392be3a4d2e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-callback-errors.js @@ -0,0 +1,6 @@ +const out = []; for (const f of [(a) => a.map(5), (a) => a.forEach(), (a) => a.find(null), (a) => a.reduce(1), (a) => a.sort(3), (a) => a.flatMap({}), (a) => a.filter("x"), (a) => a.every(), (a) => a.findLastIndex(1), (a) => new Map().forEach(2), (a) => new Set().forEach(), (a) => a.some(Math.max), (a) => a.map(console.log)]) { try { f([1]); out.push("ok") } catch (e) { out.push(e.message) } } + +for (const f of [() => [1].toSorted(3), () => new Uint8Array(2).sort(3), () => new Uint8Array(2).map(3), () => [1].sort(null), () => new URLSearchParams().forEach(1)]) { try { f(); out.push("ok") } catch (e) { out.push(e.message) } } + +const s1 = [5, 3, 4, 1, 2]; try { s1.sort(5) } catch (e) { out.push(e.message) } out.push(JSON.stringify(s1)); let n2 = 0; try { s1.sort((x, y) => { if (++n2 === 3) throw new Error("cmp"); return x - y }) } catch (e) { out.push(e.message) } out.push(JSON.stringify(s1)); const s2 = Array.from({ length: 20 }, (_, i) => 20 - i); n2 = 0; try { s2.sort((x, y) => { if (++n2 === 30) throw new Error("cmp"); return x - y }) } catch (e) { out.push(e.message) } out.push(JSON.stringify(s2)); return out + diff --git a/packages/codemode-rust/conformance/cases/std-callback-errors.json b/packages/codemode-rust/conformance/cases/std-callback-errors.json new file mode 100644 index 0000000000000..538bee1e6ed48 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-callback-errors.json @@ -0,0 +1,34 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "Array.map expects a function callback.", + "Array.forEach expects a function callback.", + "Array.find expects a function callback.", + "Array.reduce expects a function callback.", + "Array.sort expects a function callback.", + "Array.flatMap expects a function callback.", + "Array.filter expects a function callback.", + "Array.every expects a function callback.", + "Array.findLastIndex expects a function callback.", + "Map.forEach expects a function callback.", + "Set.forEach expects a function callback.", + "ok", + "ok", + "Array.toSorted expects a function callback.", + "Uint8Array.sort expects a function callback.", + "Uint8Array.map expects a function callback.", + "Array.sort expects a function callback.", + "URLSearchParams.forEach expects a function callback.", + "Array.sort expects a function callback.", + "[5,3,4,1,2]", + "cmp", + "[5,3,4,1,2]", + "cmp", + "[20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1]" + ], + "logs": [ + "1 0 [1]" + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-collections-iterators.js b/packages/codemode-rust/conformance/cases/std-collections-iterators.js new file mode 100644 index 0000000000000..4c99159d35a10 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-collections-iterators.js @@ -0,0 +1,50 @@ +const out = [] +const groups = new Map() +groups.getOrInsert("a", []).push(1) +groups.getOrInsert("a", []).push(2) +let calls = 0 +const computed = (key) => { calls++; return key + "!" } +out.push([...groups], groups.getOrInsertComputed("b", computed), groups.getOrInsertComputed("b", computed), calls, groups.getOrInsertComputed(-0, (k) => 1 / k === Infinity)) +const m = new Map() +out.push(m.getOrInsertComputed("k", () => { m.set("k", "inner"); return "outer" }), m.get("k")) +try { m.getOrInsertComputed("j", 1) } catch (e) { out.push(e.name, e.message) } +try { Map.prototype.get.call(new Set(), 1) } catch (e) { out.push(e.name, e.message) } +try { Set.prototype.add.call(new Map(), 1) } catch (e) { out.push(e.name, e.message) } +const byParity = Object.groupBy([1, 2, 3, 4], (n) => (n % 2 ? "odd" : "even")) +out.push(byParity, Object.getPrototypeOf(byParity), Object.groupBy("abca", (c) => c), [...Map.groupBy([1, 2, 3], (n) => n > 1)], Object.groupBy(new Set([1.5, 2.5]), Math.floor)) +for (const f of [() => Object.groupBy(null, (x) => x), () => Map.groupBy([1], 5), () => Object.groupBy(5, (x) => x)]) { try { f() } catch (e) { out.push(e.name) } } +const a = new Set([1, 2, 3]), b = new Set([2, 3, 4]) +out.push([...a.union(b)], [...a.intersection(b)], [...a.difference(b)], [...a.symmetricDifference(b)], a.isSubsetOf(b), new Set([2]).isSubsetOf(b), a.isSupersetOf(new Set([1])), a.isDisjointFrom(new Set([9])), [...a.union(new Map([[7, 1]]))]) +for (const f of [() => a.union(1), () => a.union({ size: NaN, has() {}, keys() {} }), () => a.union({ size: -1, has() {}, keys() {} }), () => a.union({ size: 1, has: 1, keys() {} })]) { try { f() } catch (e) { out.push([e.name, e.message]) } } +const k1 = {}, k2 = [], wm = new WeakMap([[k1, 1]]), ws = new WeakSet([k2]) +out.push(wm.get(k1), wm.has(k2), wm.set(k2, 2) === wm, wm.get(k2), wm.delete(k2), wm.has(k2), wm.get(1), wm.has("x"), wm.delete(null), wm.getOrInsert(k2, 5), wm.getOrInsertComputed({}, () => 6)) +out.push(ws.has(k2), ws.has(k1), ws.add(k1) === ws, ws.has(k1), ws.delete(k1), ws.has(k1), ws.has(1), String(wm), Object.prototype.toString.call(ws), JSON.stringify({ wm, ws }), typeof wm.size, wm instanceof WeakMap) +for (const f of [() => wm.set(1, 1), () => ws.add("s"), () => WeakMap(), () => new WeakMap([1]), () => new WeakSet([1]), () => WeakMap.prototype.get.call(new Map(), {}), () => wm.getOrInsert(1, 1)]) { try { f() } catch (e) { out.push([e.name, e.message]) } } +console.log(wm, ws) +const pulled = [] +function* naturals() { let n = 0; while (true) { pulled.push(n); yield n++ } } +const squares = naturals().map((n) => n * n).filter((n) => n % 2 === 0).drop(1).take(3) +out.push(squares.next(), squares.toArray(), squares.next(), pulled) +out.push(new Map([["a", 1], ["b", 2]]).values().map((v, i) => v * 10 + i).toArray(), [1, 2].values().flatMap((n) => [n, [n]]).toArray(), [...new Map([[1, 2]]).entries().map(([k, v]) => k + v)]) +const log = [] +function* g(name) { try { yield 1; yield 2; yield 3 } finally { log.push(name) } } +const seen = [] +g("each").forEach((v, i) => seen.push([v, i])) +out.push(seen, g("r").reduce((x, y) => x + y), g("r2").reduce((x, y) => x + y, 10), g("some").some((v) => v === 2), g("every").every((v) => v < 2), g("find").find((v) => v > 1), g("miss").find((v) => v > 5), log) +const throwing = g("throw").map((v) => { if (v === 2) throw new Error("boom"); return v }) +throwing.next() +try { throwing.next() } catch (e) { out.push(e.message) } +const returned = g("return").map((v) => v) +returned.next() +out.push(throwing.next(), returned.return(), returned.next(), log) +const unstarted = g("unstarted").take(1) +out.push(unstarted.return(), log.at(-1)) +for (const v of g("loop").filter(() => true)) break +out.push(log.at(-1)) +const it = [1, 2, 3].values() +out.push(typeof it.return, it.some((v) => v === 2), it.next().value, typeof it.map((x) => x).return) +let n = 0 +out.push(Iterator.from(it) === it, Iterator.from("ab").toArray(), Iterator.from([1, 2]).map((v) => v * 2).toArray(), Iterator.from({ next: () => ({ done: n > 1, value: n++ }) }).toArray(), it instanceof Iterator, [1].keys().toString()) +for (const f of [() => Iterator(), () => new Iterator(), () => Iterator.from(5), () => [1].values().take(-1), () => [1].values().map(1), () => Iterator.prototype.next.call({})]) { try { f() } catch (e) { out.push([e.name, e.message]) } } +const done = ["a"].entries(); done.next(); done.next(); out.push(done.next()) +return out diff --git a/packages/codemode-rust/conformance/cases/std-collections-iterators.json b/packages/codemode-rust/conformance/cases/std-collections-iterators.json new file mode 100644 index 0000000000000..a3601d9309fdb --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-collections-iterators.json @@ -0,0 +1,316 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + [ + "a", + [ + 1, + 2 + ] + ] + ], + "b!", + "b!", + 1, + true, + "outer", + "outer", + "TypeError", + "Map.getOrInsertComputed expects a function callback.", + "TypeError", + "Map.prototype.get called on incompatible receiver a Set.", + "TypeError", + "Set.prototype.add called on incompatible receiver a Map.", + { + "odd": [ + 1, + 3 + ], + "even": [ + 2, + 4 + ] + }, + null, + { + "a": [ + "a", + "a" + ], + "b": [ + "b" + ], + "c": [ + "c" + ] + }, + [ + [ + false, + [ + 1 + ] + ], + [ + true, + [ + 2, + 3 + ] + ] + ], + { + "1": [ + 1.5 + ], + "2": [ + 2.5 + ] + }, + "TypeError", + "TypeError", + "TypeError", + [ + 1, + 2, + 3, + 4 + ], + [ + 2, + 3 + ], + [ + 1 + ], + [ + 1, + 4 + ], + false, + true, + true, + true, + [ + 1, + 2, + 3, + 7 + ], + [ + "TypeError", + "Set.union expects a Set-like object." + ], + [ + "TypeError", + "Set.union received a Set-like object with an invalid size." + ], + [ + "RangeError", + "Set.union received a Set-like object with a negative size." + ], + [ + "TypeError", + "Set.union expects callable 'has' and 'keys' methods." + ], + 1, + false, + true, + 2, + true, + false, + null, + false, + false, + 5, + 6, + true, + false, + true, + true, + true, + false, + false, + "[object WeakMap]", + "[object WeakSet]", + "{\"wm\":{},\"ws\":{}}", + "undefined", + true, + [ + "TypeError", + "Invalid value used as weak map key: a number cannot be held weakly." + ], + [ + "TypeError", + "Invalid value used in weak set: a string cannot be held weakly." + ], + [ + "TypeError", + "Constructor WeakMap requires 'new'." + ], + [ + "TypeError", + "new WeakMap(...) expects [key, value] pairs as entry objects." + ], + [ + "TypeError", + "Invalid value used in weak set: a number cannot be held weakly." + ], + [ + "TypeError", + "WeakMap.prototype.get called on incompatible receiver a Map." + ], + [ + "TypeError", + "Invalid value used as weak map key: a number cannot be held weakly." + ], + { + "value": 4, + "done": false + }, + [ + 16, + 36 + ], + { + "done": true + }, + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6 + ], + [ + 10, + 21 + ], + [ + 1, + [ + 1 + ], + 2, + [ + 2 + ] + ], + [ + 3 + ], + [ + [ + 1, + 0 + ], + [ + 2, + 1 + ], + [ + 3, + 2 + ] + ], + 6, + 16, + true, + false, + 2, + null, + [ + "each", + "r", + "r2", + "some", + "every", + "find", + "miss", + "throw", + "return", + "loop" + ], + "boom", + { + "done": true + }, + { + "done": true + }, + { + "done": true + }, + [ + "each", + "r", + "r2", + "some", + "every", + "find", + "miss", + "throw", + "return", + "loop" + ], + { + "done": true + }, + "return", + "loop", + "undefined", + true, + 3, + "function", + true, + [ + "a", + "b" + ], + [ + 2, + 4 + ], + [ + 0, + 1 + ], + true, + "[object Array Iterator]", + [ + "TypeError", + "Constructor Iterator requires 'new'." + ], + [ + "TypeError", + "Iterator is abstract; use Iterator.from(...) or a built-in iterator." + ], + [ + "TypeError", + "Iterator.from expects an iterable or iterator, received a number." + ], + [ + "RangeError", + "Iterator.prototype.take expects a non-negative count, received -1." + ], + [ + "TypeError", + "Iterator.prototype.map expects a function callback." + ], + [ + "TypeError", + "Iterator.prototype.next called on incompatible receiver a data object." + ], + { + "done": true + } + ], + "logs": [ + "WeakMap { } WeakSet { }" + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-console-table.js b/packages/codemode-rust/conformance/cases/std-console-table.js new file mode 100644 index 0000000000000..7ae265bd8bb68 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-console-table.js @@ -0,0 +1,15 @@ +console.table([{ a: 1, b: "x" }, { b: 2, c: [1, 2] }, 5, "s", [1, 2]]) +console.table({ r1: { x: 1 }, r2: { y: { z: 1 } }, r3: null }) +console.table([{ a: 1, b: 2 }, { a: 3 }], ["b", "a", "zz"]) +console.table(5) +console.table("str") +console.table() +console.table(undefined) +console.table([{ f: () => 1 }]) +console.table(new Map([[1, 2]])) +console.table([{ 2: "two", 1: "one", b: "b" }, { 10: "ten" }]) +console.table([new Date(0), /x/g, null, undefined, true]) +console.table({ a: { toString() { return 1 } } }, [{ toString() { return "a" } }]) +console.dir() +console.dir(1, 2) +return 1 diff --git a/packages/codemode-rust/conformance/cases/std-console-table.json b/packages/codemode-rust/conformance/cases/std-console-table.json new file mode 100644 index 0000000000000..1c2548d9eee39 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-console-table.json @@ -0,0 +1,22 @@ +{ + "bindings": {}, + "ok": true, + "value": 1, + "logs": [ + "(index)\ta\tb\tc\tValue\n0\t1\tx\t\t\n1\t\t2\t[1,2]\t\n2\t\t\t\t5\n3\t\t\t\ts\n4\t\t\t\t[1,2]", + "(index)\tx\ty\tValue\nr1\t1\t\t\nr2\t\t{\"z\":1}\t\nr3\t\t\tnull", + "(index)\tb\ta\tzz\n0\t2\t1\t\n1\t\t3\t", + "(index)\tValue\n0\t5", + "(index)\tValue\n0\tstr", + "undefined", + "undefined", + "[opaque reference]", + "(index)", + "(index)\t1\t2\tb\t10\n0\tone\ttwo\tb\t\n1\t\t\t\tten", + "(index)\tValue\n0\t\n1\t\n2\tnull\n3\t\n4\ttrue", + "[opaque reference]", + "undefined", + "1" + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-date-setters-test262.js b/packages/codemode-rust/conformance/cases/std-date-setters-test262.js new file mode 100644 index 0000000000000..1e7f7e94dd428 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-date-setters-test262.js @@ -0,0 +1,178 @@ +const out = [] +out.push(await (async () => { + + const create = () => new Date(Date.UTC(2000, 0, 2, 3, 4, 5, 6)) + const result = [] + let date = create() + result.push([date.setTime(1234) === date.getTime(), date.getTime()]) + date = create() + result.push([date.setUTCMilliseconds(10) === date.getTime(), date.getUTCMilliseconds()]) + date = create() + result.push([date.setUTCSeconds(10, 11) === date.getTime(), date.getUTCSeconds(), date.getUTCMilliseconds()]) + date = create() + result.push([date.setUTCMinutes(10, 11, 12) === date.getTime(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds()]) + date = create() + result.push([date.setUTCHours(10, 11, 12, 13) === date.getTime(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds()]) + date = create() + result.push([date.setUTCDate(10) === date.getTime(), date.getUTCDate()]) + date = create() + result.push([date.setUTCMonth(6, 10) === date.getTime(), date.getUTCMonth(), date.getUTCDate()]) + date = create() + result.push([date.setUTCFullYear(2020, 6, 10) === date.getTime(), date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()]) + return result + +})().then((v) => [0, v], (e) => [0, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const create = () => new Date(2000, 0, 2, 3, 4, 5, 6) + const result = [] + let date = create() + date.setMilliseconds(10) + result.push(date.getMilliseconds()) + date = create() + date.setSeconds(10, 11) + result.push([date.getSeconds(), date.getMilliseconds()]) + date = create() + date.setMinutes(10, 11, 12) + result.push([date.getMinutes(), date.getSeconds(), date.getMilliseconds()]) + date = create() + date.setHours(10, 11, 12, 13) + result.push([date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()]) + date = create() + date.setDate(10) + result.push(date.getDate()) + date = create() + date.setMonth(6, 10) + result.push([date.getMonth(), date.getDate()]) + date = create() + date.setFullYear(2020, 6, 10) + result.push([date.getFullYear(), date.getMonth(), date.getDate()]) + return result + +})().then((v) => [1, v], (e) => [1, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const calls = [] + const date = new Date(0) + const returned = date.setUTCSeconds( + { valueOf: () => { calls.push("seconds"); return "2" } }, + { valueOf: () => { calls.push("milliseconds"); return true } }, + ) + const fallback = new Date(0) + fallback.setTime({ valueOf: () => ({}), toString: () => "3" }) + return [returned === date.getTime(), date.getUTCSeconds(), date.getUTCMilliseconds(), fallback.getTime(), calls] + +})().then((v) => [2, v], (e) => [2, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const date = new Date(Date.UTC(2000, 5, 15, 1, 2, 3, 4)) + date.setUTCFullYear({ + valueOf: () => { + date.setTime(Date.UTC(2020, 11, 20)) + return 2001 + }, + }) + + const invalid = new Date(NaN) + invalid.setUTCFullYear({ valueOf: () => { invalid.setTime(0); return 1 } }) + + const effects = [] + const staysInvalid = new Date(NaN) + const result = staysInvalid.setUTCMonth( + { valueOf: () => { effects.push("month"); return 0 } }, + { valueOf: () => { effects.push("date"); return 1 } }, + ) + return [ + date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), + invalid.getUTCFullYear(), invalid.getUTCMonth(), invalid.getUTCDate(), + Number.isNaN(result), Number.isNaN(staysInvalid.getTime()), effects, + ] + +})().then((v) => [3, v], (e) => [3, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const year = new Date(NaN) + const yearResult = year.setFullYear(2016) + const month = new Date(NaN) + const monthResult = month.setFullYear(2016, 6) + const day = new Date(NaN) + const dayResult = day.setFullYear(2016, 6, 7) + return [ + yearResult === year.getTime(), year.getFullYear(), year.getMonth(), year.getDate(), + monthResult === month.getTime(), month.getFullYear(), month.getMonth(), month.getDate(), + dayResult === day.getTime(), day.getFullYear(), day.getMonth(), day.getDate(), + ] + +})().then((v) => [4, v], (e) => [4, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const calls = [] + const failure = { valueOf: () => { throw new Error("stop") } } + const counter = { valueOf: () => { calls.push("counter"); return 1 } } + const results = [] + + const time = new Date(0) + try { time.setTime(failure) } catch (error) { results.push(error.message) } + results.push(time.getTime()) + + const year = new Date(0) + try { year.setFullYear(failure, counter, counter) } catch (error) { results.push(error.message) } + results.push(year.getTime()) + + const month = new Date(0) + try { month.setFullYear(0, failure, counter) } catch (error) { results.push(error.message) } + results.push(month.getTime()) + + const day = new Date(0) + try { day.setFullYear(0, 0, failure) } catch (error) { results.push(error.message) } + results.push(day.getTime(), calls) + return results + +})().then((v) => [5, v], (e) => [5, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const calls = [] + const omittedOptional = new Date(0) + const explicitUndefined = new Date(0) + const noArgument = new Date(0) + const extra = new Date(0) + const clipped = new Date(0) + const badPrimitive = new Date(0) + let conversionError = "" + try { + badPrimitive.setTime({ valueOf: () => ({}), toString: () => ({}) }) + } catch (error) { + conversionError = error.name + } + return [ + omittedOptional.setUTCSeconds(1), + Number.isNaN(explicitUndefined.setUTCSeconds(1, undefined)), + Number.isNaN(noArgument.setTime()), + extra.setTime(1, { valueOf: () => { calls.push("extra"); return 2 } }), + calls, + Number.isNaN(clipped.setTime(8.64e15 + 1)), + Number.isNaN(clipped.getTime()), + conversionError, + ] + +})().then((v) => [6, v], (e) => [6, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const date = new Date(0) + const text = String(date) + return [ + date + date === text + text, + date + 0 === text + "0", + date + true === text + "true", + date == text, + text == date, + date == Number(date), + Number(date) == date, + date != Number(date), + date == date, + date == new Date(0), + date == null, + ] + +})().then((v) => [7, v], (e) => [7, "threw", e?.name, e?.message])) +return out diff --git a/packages/codemode-rust/conformance/cases/std-date-setters-test262.json b/packages/codemode-rust/conformance/cases/std-date-setters-test262.json new file mode 100644 index 0000000000000..b46f53ec51304 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-date-setters-test262.json @@ -0,0 +1,175 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 0, + [ + [ + true, + 1234 + ], + [ + true, + 10 + ], + [ + true, + 10, + 11 + ], + [ + true, + 10, + 11, + 12 + ], + [ + true, + 10, + 11, + 12, + 13 + ], + [ + true, + 10 + ], + [ + true, + 6, + 10 + ], + [ + true, + 2020, + 6, + 10 + ] + ] + ], + [ + 1, + [ + 10, + [ + 10, + 11 + ], + [ + 10, + 11, + 12 + ], + [ + 10, + 11, + 12, + 13 + ], + 10, + [ + 6, + 10 + ], + [ + 2020, + 6, + 10 + ] + ] + ], + [ + 2, + [ + true, + 2, + 1, + 3, + [ + "seconds", + "milliseconds" + ] + ] + ], + [ + 3, + [ + 2001, + 5, + 15, + 1, + 0, + 1, + true, + true, + [ + "month", + "date" + ] + ] + ], + [ + 4, + [ + true, + 2016, + 0, + 1, + true, + 2016, + 6, + 1, + true, + 2016, + 6, + 7 + ] + ], + [ + 5, + [ + "stop", + 0, + "stop", + 0, + "stop", + 0, + "stop", + 0, + [] + ] + ], + [ + 6, + [ + 1000, + true, + true, + 1, + [], + true, + true, + "TypeError" + ] + ], + [ + 7, + [ + true, + true, + true, + true, + true, + false, + false, + true, + true, + false, + false + ] + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-date.js b/packages/codemode-rust/conformance/cases/std-date.js new file mode 100644 index 0000000000000..3c8145deb6fc0 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-date.js @@ -0,0 +1,36 @@ +// Only time-zone-independent results: local forms are checked by round trip. +const out = [] +const d = new Date(0) +out.push(d.toString(), d.toUTCString(), d.toGMTString(), d.toLocaleString(), d.toLocaleDateString(), d.toLocaleTimeString(), d.toISOString(), d.toJSON(), String(d), `${d}`, d + 1, d - 1, +d, d.valueOf(), d.getTime()) +for (const s of ["2024-01-02", "2024-01-02T03:04:05.123+02:00", "+012024-01-02T00:00:00Z", "-000001-01-01T00:00:00Z", "2024", "2024-05", "2024-13-01", "2024-01-32", "Tue, 02 Jan 2024 03:04:05 GMT", "Tue Jan 02 2024 03:04:05 GMT+0100 (CET)", "garbage", "", "2024-01-02T03:04:05.1234567Z", "2024-01-02T03:04:05.1Z", "Thu, 01 Jan 1970 00:00:00 GMT+0130", "Mon, 25 Dec 1995 13:30:00 +0430", "12:00", "2024-01-02T24:00:00Z", "2024-01-02T24:00:01Z", "2024-02-30", "1970-01-01T00:00:00.000Z", "1995-12-17T03:24:00Z", "2024-01-02T03:04Z", "2024-01-02T03:04:05-0800", "Wed, 09 Aug 1995 00:00:00 UTC", "Sat, 01 Jun 2024 12:00:00 PDT"]) out.push([s, Date.parse(s)]) +const local = (s) => { const t = new Date(s); return [t.getFullYear(), t.getMonth(), t.getDate(), t.getHours(), t.getMinutes(), t.getSeconds(), t.getMilliseconds()] } +for (const s of ["2024-01-02T03:04", "Jan 2, 2024", "2 January 2024 10:00", "2024/01/02", "01/02/2024", "1/2/2024 3:04 PM", "1/2/2024 12:30 AM", "2024-01-02 03:04:05", "June 5", "2024-1-2", "Jan 2024", "December 17, 1995 03:24:00", "Wed, 09 Aug 1995 00:00:00", "5", "Tuesday, March 5, 2024 18:30:15"]) out.push([s, local(s)]) +out.push(new Date(-62198755200000).toUTCString(), new Date(-62198755200000).toISOString(), new Date(8.64e15).toISOString(), new Date(-8.64e15).toISOString(), new Date(-1).toISOString(), new Date(8.64e15 + 1).getTime()) +out.push(new Date(Date.UTC(20, 0, 1)).toUTCString(), new Date(NaN).toUTCString(), new Date(NaN).toDateString(), new Date(NaN).toTimeString(), new Date(NaN).toLocaleString(), String(new Date(NaN)), new Date(NaN).toJSON(), new Date(NaN).getDay(), new Date(NaN).getTimezoneOffset()) +out.push(new Date(Date.UTC(2024, 5, 15, 13, 5, 9)).toLocaleString(), new Date(Date.UTC(2024, 5, 15, 0, 5, 9)).toLocaleTimeString(), new Date(Date.UTC(-5, 5, 15)).toLocaleString(), new Date(Date.UTC(-5, 5, 15)).toUTCString()) +const c = new Date(2024, 0, 31, 10, 20, 30, 400) +out.push([c.getFullYear(), c.getMonth(), c.getDate(), c.getDay(), c.getHours(), c.getMinutes(), c.getSeconds(), c.getMilliseconds()]) +c.setMonth(1); out.push(local(c)) +c.setDate(0); out.push(local(c)) +c.setHours(25, 61, 61, 1001); out.push(local(c)) +c.setFullYear(2000, 1, 29); out.push(local(c)) +c.setMinutes(9); c.setSeconds(8); c.setMilliseconds(7); out.push(local(c)) +const u = new Date(Date.UTC(2000, 0, 2, 3, 4, 5, 6)) +out.push(u.setUTCMinutes(5), u.setUTCSeconds(1, 2), u.setUTCHours(3), u.setUTCDate(4), u.setUTCMonth(5, 6), u.setUTCFullYear(1999), u.setUTCMilliseconds(10), u.setTime("5"), u.setUTCHours(1, 2, 3, 4), u.setUTCDate(40), u.toISOString()) +out.push([u.getUTCFullYear(), u.getUTCMonth(), u.getUTCDate(), u.getUTCDay(), u.getUTCHours(), u.getUTCMinutes(), u.getUTCSeconds(), u.getUTCMilliseconds()]) +const bad = new Date(NaN) +out.push(bad.setMonth(1), bad.setUTCDate(3), bad.getTime(), bad.setUTCFullYear(2020), bad.toISOString()) +out.push(new Date(5).setUTCMonth(), new Date(5).setTime(), new Date(5).setUTCSeconds(undefined)) +const order = [] +const date = new Date(0) +date.setUTCMonth({ valueOf() { order.push("m"); return 1 } }, { valueOf() { order.push("d"); return 2 } }) +out.push(order, date.toISOString()) +out.push(Date.UTC(2024), Date.UTC(2024, 1), Date.UTC(99, 0), Date.UTC(), Date.UTC(NaN), Date.UTC(2024, 0, 1, 0, 0, 0, 0, 99), new Date(99, 0).getFullYear(), new Date(2024, 0).getMonth()) +out.push(new Date(true).getTime(), new Date(null).getTime(), new Date(undefined).getTime(), new Date([]).getTime(), new Date(["1970-01-01T00:00:00.000Z"]).getTime(), new Date({}).getTime(), new Date(new Date(5)).getTime(), new Date({ valueOf() { return 7 } }).getTime(), new Date(1.9).getTime(), new Date(-1.9).getTime()) +out.push(typeof Date(), Date().length, typeof Date.now(), new Date(0) instanceof Date, Object.prototype.toString.call(new Date(0)), JSON.stringify({ d: new Date(0), n: new Date(NaN) }), new Date(0) == "1970-01-01T00:00:00.000Z", new Date(5) == 5, new Date(1) < new Date(2), new Date(3000) - new Date(1000), Date.length, Date.name) +try { new Date(NaN).toISOString() } catch (e) { out.push(e.name, e.message) } +try { Date.prototype.getTime.call({}) } catch (e) { out.push(e.name, e.message) } +try { Date.prototype.toISOString.call(5) } catch (e) { out.push(e.name, e.message) } +console.log(new Date(0), [new Date(0)], { d: new Date(NaN) }) +out.push(new Date(0), [new Date(1000)], [new Date(3000), new Date(1000)].sort((a, b) => a - b).map(Number)) +return out diff --git a/packages/codemode-rust/conformance/cases/std-date.json b/packages/codemode-rust/conformance/cases/std-date.json new file mode 100644 index 0000000000000..784d9f5f8223a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-date.json @@ -0,0 +1,461 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "1970-01-01T00:00:00.000Z", + "Thu, 01 Jan 1970 00:00:00 GMT", + "Thu, 01 Jan 1970 00:00:00 GMT", + "1/1/1970, 12:00:00 AM", + "1/1/1970", + "12:00:00 AM", + "1970-01-01T00:00:00.000Z", + "1970-01-01T00:00:00.000Z", + "1970-01-01T00:00:00.000Z", + "1970-01-01T00:00:00.000Z", + "1970-01-01T00:00:00.000Z1", + -1, + 0, + 0, + 0, + [ + "2024-01-02", + 1704153600000 + ], + [ + "2024-01-02T03:04:05.123+02:00", + 1704157445123 + ], + [ + "+012024-01-02T00:00:00Z", + 317273673600000 + ], + [ + "-000001-01-01T00:00:00Z", + -62198755200000 + ], + [ + "2024", + 1704067200000 + ], + [ + "2024-05", + 1714521600000 + ], + [ + "2024-13-01", + null + ], + [ + "2024-01-32", + null + ], + [ + "Tue, 02 Jan 2024 03:04:05 GMT", + 1704164645000 + ], + [ + "Tue Jan 02 2024 03:04:05 GMT+0100 (CET)", + 1704161045000 + ], + [ + "garbage", + null + ], + [ + "", + null + ], + [ + "2024-01-02T03:04:05.1234567Z", + 1704164645123 + ], + [ + "2024-01-02T03:04:05.1Z", + 1704164645100 + ], + [ + "Thu, 01 Jan 1970 00:00:00 GMT+0130", + -5400000 + ], + [ + "Mon, 25 Dec 1995 13:30:00 +0430", + 819882000000 + ], + [ + "12:00", + null + ], + [ + "2024-01-02T24:00:00Z", + 1704240000000 + ], + [ + "2024-01-02T24:00:01Z", + null + ], + [ + "2024-02-30", + 1709251200000 + ], + [ + "1970-01-01T00:00:00.000Z", + 0 + ], + [ + "1995-12-17T03:24:00Z", + 819170640000 + ], + [ + "2024-01-02T03:04Z", + 1704164640000 + ], + [ + "2024-01-02T03:04:05-0800", + 1704193445000 + ], + [ + "Wed, 09 Aug 1995 00:00:00 UTC", + 807926400000 + ], + [ + "Sat, 01 Jun 2024 12:00:00 PDT", + 1717268400000 + ], + [ + "2024-01-02T03:04", + [ + 2024, + 0, + 2, + 3, + 4, + 0, + 0 + ] + ], + [ + "Jan 2, 2024", + [ + 2024, + 0, + 2, + 0, + 0, + 0, + 0 + ] + ], + [ + "2 January 2024 10:00", + [ + 2024, + 0, + 2, + 10, + 0, + 0, + 0 + ] + ], + [ + "2024/01/02", + [ + 2024, + 0, + 2, + 0, + 0, + 0, + 0 + ] + ], + [ + "01/02/2024", + [ + 2024, + 0, + 2, + 0, + 0, + 0, + 0 + ] + ], + [ + "1/2/2024 3:04 PM", + [ + 2024, + 0, + 2, + 15, + 4, + 0, + 0 + ] + ], + [ + "1/2/2024 12:30 AM", + [ + 2024, + 0, + 2, + 0, + 30, + 0, + 0 + ] + ], + [ + "2024-01-02 03:04:05", + [ + 2024, + 0, + 2, + 3, + 4, + 5, + 0 + ] + ], + [ + "June 5", + [ + 2001, + 5, + 5, + 0, + 0, + 0, + 0 + ] + ], + [ + "2024-1-2", + [ + 2024, + 0, + 2, + 0, + 0, + 0, + 0 + ] + ], + [ + "Jan 2024", + [ + 2024, + 0, + 1, + 0, + 0, + 0, + 0 + ] + ], + [ + "December 17, 1995 03:24:00", + [ + 1995, + 11, + 17, + 3, + 24, + 0, + 0 + ] + ], + [ + "Wed, 09 Aug 1995 00:00:00", + [ + 1995, + 7, + 9, + 0, + 0, + 0, + 0 + ] + ], + [ + "5", + [ + 2001, + 4, + 1, + 0, + 0, + 0, + 0 + ] + ], + [ + "Tuesday, March 5, 2024 18:30:15", + [ + 2024, + 2, + 5, + 18, + 30, + 15, + 0 + ] + ], + "Fri, 01 Jan -0001 00:00:00 GMT", + "-000001-01-01T00:00:00.000Z", + "+275760-09-13T00:00:00.000Z", + "-271821-04-20T00:00:00.000Z", + "1969-12-31T23:59:59.999Z", + null, + "Thu, 01 Jan 1920 00:00:00 GMT", + "Invalid Date", + "Invalid Date", + "Invalid Date", + "Invalid Date", + "Invalid Date", + null, + null, + null, + "6/15/2024, 1:05:09 PM", + "12:05:09 AM", + "6/15/6, 12:00:00 AM", + "Thu, 15 Jun -0005 00:00:00 GMT", + [ + 2024, + 0, + 31, + 3, + 10, + 20, + 30, + 400 + ], + [ + 2024, + 2, + 2, + 10, + 20, + 30, + 400 + ], + [ + 2024, + 1, + 29, + 10, + 20, + 30, + 400 + ], + [ + 2024, + 2, + 1, + 2, + 2, + 2, + 1 + ], + [ + 2000, + 1, + 29, + 2, + 2, + 2, + 1 + ], + [ + 2000, + 1, + 29, + 2, + 9, + 8, + 7 + ], + 946782305006, + 946782301002, + 946782301002, + 946955101002, + 960260701002, + 928638301002, + 928638301010, + 5, + 3723004, + 3373323004, + "1970-02-09T01:02:03.004Z", + [ + 1970, + 1, + 9, + 1, + 1, + 2, + 3, + 4 + ], + null, + null, + null, + 1577836800000, + "2020-01-01T00:00:00.000Z", + null, + null, + null, + [ + "m", + "d" + ], + "1970-02-02T00:00:00.000Z", + 1704067200000, + 1706745600000, + 915148800000, + null, + null, + 1704067200000, + 1999, + 0, + 1, + 0, + null, + null, + 0, + null, + 5, + 7, + 1, + -1, + "string", + 24, + "number", + true, + "[object Date]", + "{\"d\":\"1970-01-01T00:00:00.000Z\",\"n\":null}", + true, + false, + true, + 2000, + 7, + "Date", + "RangeError", + "Invalid time value.", + "TypeError", + "Date.prototype.getTime called on incompatible receiver a data object.", + "TypeError", + "Date.prototype.toISOString called on incompatible receiver a number.", + "1970-01-01T00:00:00.000Z", + [ + "1970-01-01T00:00:01.000Z" + ], + [ + 1000, + 3000 + ] + ], + "logs": [ + "1970-01-01T00:00:00.000Z [1970-01-01T00:00:00.000Z] {\"d\":Invalid Date}" + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-delete-errors.js b/packages/codemode-rust/conformance/cases/std-delete-errors.js new file mode 100644 index 0000000000000..040164aa5f60e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-delete-errors.js @@ -0,0 +1,16 @@ +const out = [] +function f(a) {} +Object.freeze(f) +try { out.push(delete f.length) } catch (e) { out.push(e.message) } +const s = function named(b) {} +Object.seal(s) +try { out.push(delete s.name) } catch (e) { out.push(e.message) } +function g() {} +delete g.name +console.log(g, [g], { g }) +const b = g.bind(null) +try { out.push(delete b.name, b.name, b.hasOwnProperty("name")) } catch (e) { out.push(e.message) } +out.push("length" in g, delete g.length, "length" in g, Object.isFrozen(f)) +const o2 = Object.freeze({ a: 1 }); try { delete o2.a } catch (e) { out.push(e.message) }; const a2 = Object.seal([1]); try { delete a2[0] } catch (e) { out.push(e.message) }; try { delete [].length } catch (e) { out.push(e.message) }; +const u = new Uint8Array(2); try { delete u[0] } catch (e) { out.push(e.message) }; try { out.push(delete u[5]) } catch (e) { out.push(e.message) }; try { out.push(delete u.length) } catch (e) { out.push(e.message) } +return out diff --git a/packages/codemode-rust/conformance/cases/std-delete-errors.json b/packages/codemode-rust/conformance/cases/std-delete-errors.json new file mode 100644 index 0000000000000..a33ac5081c806 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-delete-errors.json @@ -0,0 +1,25 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "Cannot delete property 'length'.", + "Cannot delete property 'name'.", + true, + "", + false, + true, + true, + true, + true, + "Cannot delete property 'a'.", + "Cannot delete property '0'.", + "Cannot delete property 'length'.", + "Cannot delete property '0'.", + true, + true + ], + "logs": [ + "[opaque reference] [[opaque reference]] {\"g\":[opaque reference]}" + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-function-name-length.js b/packages/codemode-rust/conformance/cases/std-function-name-length.js new file mode 100644 index 0000000000000..abdc660e51a10 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-function-name-length.js @@ -0,0 +1,22 @@ +const out = [] +const probe = (label, f) => { + const r = [label, f.hasOwnProperty("length"), f.hasOwnProperty("name")] + try { r.push(delete f.length) } catch (e) { r.push("E " + e.message) } + r.push(f.hasOwnProperty("length"), f.length) + try { r.push(delete f.name) } catch (e) { r.push("E " + e.message) } + r.push(f.hasOwnProperty("name"), JSON.stringify(f.name)) + try { f.length = 9; r.push(f.length) } catch (e) { r.push("E " + e.message) } + r.push(Object.keys(f).join(",")) + out.push(r.join(" | ")) +} +probe("native", String.prototype.charAt) +probe("uri", encodeURI) +function g(a, b) {} +probe("closure", g) +probe("arrow", (a) => a) +probe("bound", g.bind(null, 1)) +probe("ctor", Map) +function g3(a, b, c) {} +const b1 = g3.bind(null, 1), b2 = b1.bind(null, 2, 3, 4), b3 = Math.max.bind(null) +out.push(b1.length, b1.name, b2.length, b2.name, b3.length, b3.name, (() => 1).bind().name) +return out diff --git a/packages/codemode-rust/conformance/cases/std-function-name-length.json b/packages/codemode-rust/conformance/cases/std-function-name-length.json new file mode 100644 index 0000000000000..f8e6f36bcde90 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-function-name-length.json @@ -0,0 +1,21 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "native | true | true | true | false | 0 | true | false | \"\" | E Cannot assign to read only property 'length'. | ", + "uri | true | true | true | false | 0 | true | false | \"\" | E Cannot assign to read only property 'length'. | ", + "closure | true | true | true | false | 0 | true | false | \"\" | E Cannot assign to read only property 'length'. | ", + "arrow | true | true | true | false | 0 | true | false | \"\" | E Cannot assign to read only property 'length'. | ", + "bound | true | true | true | false | 0 | true | false | \"\" | E Cannot assign to read only property 'length'. | ", + "ctor | true | true | true | false | 0 | true | false | \"\" | E Cannot assign to read only property 'length'. | ", + 2, + "bound g3", + 0, + "bound bound g3", + 2, + "bound max", + "bound " + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-groupby-test262.js b/packages/codemode-rust/conformance/cases/std-groupby-test262.js new file mode 100644 index 0000000000000..145a05e4b5f81 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-groupby-test262.js @@ -0,0 +1,101 @@ +const out = [] +out.push(await (async () => { + + const values = [1, 2, 3] + const grouped = Object.groupBy(values, (value) => value % 2 === 0 ? "even" : "odd") + const stringable = { toString: () => 1 } + const coerced = Object.groupBy([1, "1", stringable], (value) => value) + const lengths = Object.groupBy(["hello", "test", "world"], (value) => value.length) + return [ + Object.keys(grouped), grouped.even, grouped.odd, grouped.toString === undefined, + Object.keys(coerced), coerced[1].length, + Object.keys(lengths), lengths[5], lengths[4], + ] + +})().then((v) => [0, v], (e) => [0, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const values = [-0, 0, 1, 2, 3] + const seen = [] + Object.groupBy(values, (value, index, ...extra) => { + seen.push([value === values[index], index, extra.length]) + return null + }) + return seen + +})().then((v) => [1, v], (e) => [1, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const grouped = Object.groupBy("🥰💩🙏😈", (char) => char < "🙏" ? "before" : "after") + const empty = Object.groupBy([], () => { throw new Error("not called") }) + return [Object.keys(grouped), grouped.before, grouped.after, Object.keys(empty)] + +})().then((v) => [2, v], (e) => [2, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const messages = [] + try { Object.groupBy({}, () => { throw new Error("not called") }) } catch (error) { messages.push(error.name) } + for (const callback of [null, undefined, {}]) { + try { Object.groupBy([], callback) } catch (error) { messages.push(error.name) } + } + try { Object.groupBy([1], () => { throw new Error("callback") }) } catch (error) { messages.push(error.message) } + try { + Object.groupBy([1], () => ({ + toString: () => { throw new Error("property key") }, + })) + } catch (error) { messages.push(error.message) } + return messages + +})().then((v) => [3, v], (e) => [3, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const stringable = { toString: () => 1 } + const grouped = Map.groupBy([1, "1", stringable], (value) => value) + const parity = Map.groupBy([1, 2, 3], (value) => value % 2 === 0 ? "even" : "odd") + const lengths = Map.groupBy(["hello", "test", "world"], (value) => value.length) + return [ + grouped instanceof Map, + grouped.size, + grouped.get(1), + grouped.get("1"), + grouped.has(stringable), + [...grouped.keys()].length, + parity.get("even"), + parity.get("odd"), + [...lengths.keys()], + lengths.get(5), + lengths.get(4), + ] + +})().then((v) => [4, v], (e) => [4, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const values = [-0, 0, 1, 2, 3] + const seen = [] + const grouped = Map.groupBy(values, (value, index, ...extra) => { + seen.push([value === values[index], index, extra.length]) + return value + }) + return [grouped.size, grouped.get(0), seen] + +})().then((v) => [5, v], (e) => [5, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const grouped = Map.groupBy("🥰💩🙏😈", (char) => char < "🙏" ? "before" : "after") + const empty = Map.groupBy([], () => { throw new Error("not called") }) + return [[...grouped.keys()], grouped.get("before"), grouped.get("after"), empty.size] + +})().then((v) => [6, v], (e) => [6, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const results = [] + try { Map.groupBy({}, () => { throw new Error("not called") }) } catch (error) { results.push(error.name) } + for (const callback of [null, undefined, {}]) { + try { Map.groupBy([], callback) } catch (error) { results.push(error.name) } + } + try { Map.groupBy([1], () => { throw new Error("callback") }) } + catch (error) { results.push(error.message) } + return results + +})().then((v) => [7, v], (e) => [7, "threw", e?.name, e?.message])) +return out diff --git a/packages/codemode-rust/conformance/cases/std-groupby-test262.json b/packages/codemode-rust/conformance/cases/std-groupby-test262.json new file mode 100644 index 0000000000000..27d6207ec6d9a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-groupby-test262.json @@ -0,0 +1,197 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 0, + [ + [ + "odd", + "even" + ], + [ + 2 + ], + [ + 1, + 3 + ], + true, + [ + "1" + ], + 3, + [ + "4", + "5" + ], + [ + "hello", + "world" + ], + [ + "test" + ] + ] + ], + [ + 1, + [ + [ + true, + 0, + 0 + ], + [ + true, + 1, + 0 + ], + [ + true, + 2, + 0 + ], + [ + true, + 3, + 0 + ], + [ + true, + 4, + 0 + ] + ] + ], + [ + 2, + [ + [ + "after", + "before" + ], + [ + "💩", + "😈" + ], + [ + "🥰", + "🙏" + ], + [] + ] + ], + [ + 3, + [ + "TypeError", + "TypeError", + "TypeError", + "TypeError", + "callback", + "property key" + ] + ], + [ + 4, + [ + true, + 3, + [ + 1 + ], + [ + "1" + ], + true, + 3, + [ + 2 + ], + [ + 1, + 3 + ], + [ + 5, + 4 + ], + [ + "hello", + "world" + ], + [ + "test" + ] + ] + ], + [ + 5, + [ + 4, + [ + 0, + 0 + ], + [ + [ + true, + 0, + 0 + ], + [ + true, + 1, + 0 + ], + [ + true, + 2, + 0 + ], + [ + true, + 3, + 0 + ], + [ + true, + 4, + 0 + ] + ] + ] + ], + [ + 6, + [ + [ + "after", + "before" + ], + [ + "💩", + "😈" + ], + [ + "🥰", + "🙏" + ], + 0 + ] + ], + [ + 7, + [ + "TypeError", + "TypeError", + "TypeError", + "TypeError", + "callback" + ] + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-iterator-method-errors.js b/packages/codemode-rust/conformance/cases/std-iterator-method-errors.js new file mode 100644 index 0000000000000..fd88ea03ec5e8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-iterator-method-errors.js @@ -0,0 +1,10 @@ +const out = [] +for (const b of [{ [Symbol.iterator]: () => 1 }, { [Symbol.iterator]: 5 }, "ab"]) { + try { for (const x of b) out.push(x) } catch (e) { out.push(e.message) } + try { out.push([...b].length) } catch (e) { out.push(e.message) } + try { out.push(Array.from(b).length) } catch (e) { out.push(e.message) } + try { const [x] = b; out.push(x) } catch (e) { out.push(e.message) } + try { out.push(new Set(b).size) } catch (e) { out.push(e.message) } +} +out.push(await Promise.all("ab")) +return out diff --git a/packages/codemode-rust/conformance/cases/std-iterator-method-errors.json b/packages/codemode-rust/conformance/cases/std-iterator-method-errors.json new file mode 100644 index 0000000000000..93c074d1a14ed --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-iterator-method-errors.json @@ -0,0 +1,28 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "Iterator method result must be an object.", + "Iterator method result must be an object.", + "Iterator method result must be an object.", + "Iterator method result must be an object.", + "Iterator method result must be an object.", + "Iterator method must be a function.", + "Iterator method must be a function.", + "Iterator method must be a function.", + "Iterator method must be a function.", + "Iterator method must be a function.", + "a", + "b", + 2, + 2, + "a", + 2, + [ + "a", + "b" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-json-parse-errors.js b/packages/codemode-rust/conformance/cases/std-json-parse-errors.js new file mode 100644 index 0000000000000..17b4cbb726edc --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-json-parse-errors.js @@ -0,0 +1,10 @@ +// JSON.parse's errors carry its host runtime's message after the reference's own prefix. +const texts = ["a", "", "{", "[1,]", '{"a":}', "[1 2]", "tru", '"abc', "1e", "01", "{a:1}", "[1]x", " ", "nul", '"\\x"', "-", + '{"a" 1}', "[", '{"a":1,}', '"\t"', "1.", ".5", "[1,,2]", "{,}", '"\\u12"', "Infinity", "NaN", '{"a":1}}', "1 2", "/"] +return texts.map((t) => { + try { + return ["ok", JSON.parse(t)] + } catch (e) { + return [e.name, e.message] + } +}) diff --git a/packages/codemode-rust/conformance/cases/std-json-parse-errors.json b/packages/codemode-rust/conformance/cases/std-json-parse-errors.json new file mode 100644 index 0000000000000..871c1f414bdc7 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-json-parse-errors.json @@ -0,0 +1,128 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unexpected identifier \"a\"" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unexpected EOF" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Expected '}'" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unexpected comma at the end of array expression" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unexpected token '}'" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Expected ']'" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unexpected identifier \"tru\"" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unterminated string" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unable to parse JSON string" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unable to parse JSON string" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Expected '}'" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unable to parse JSON string" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unexpected EOF" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unexpected identifier \"nul\"" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Invalid escape character x" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Invalid number" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Expected ':' before value in object property definition" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unexpected EOF" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Property name must be a string literal" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unterminated string" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Invalid digits after decimal point" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unexpected token '.'" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unexpected token ','" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Expected '}'" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: \\u must be followed by 4 hex digits" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unexpected identifier \"Infinity\"" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unexpected identifier \"NaN\"" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unable to parse JSON string" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unable to parse JSON string" + ], + [ + "SyntaxError", + "JSON.parse received invalid JSON: JSON Parse error: Unrecognized token '/'" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-json-stringify-depth.js b/packages/codemode-rust/conformance/cases/std-json-stringify-depth.js new file mode 100644 index 0000000000000..51f98d8f0120d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-json-stringify-depth.js @@ -0,0 +1,28 @@ +const nest = (n, v, wrap) => { + let o = v + for (let i = 0; i < n; i++) o = wrap(o) + return o +} +const t = (f) => { + try { + return f() + } catch (e) { + return [e.name, e.message] + } +} +const obj = (o) => ({ o }) +const arr = (o) => [o] +return [ + t(() => JSON.stringify(nest(32, 1, obj)).length), + t(() => JSON.stringify(nest(33, 1, obj)).length), + t(() => JSON.stringify(nest(32, {}, obj)).length), + t(() => JSON.stringify(nest(33, {}, obj)).length), + t(() => JSON.stringify(nest(32, 1, arr)).length), + t(() => JSON.stringify(nest(33, 1, arr)).length), + t(() => JSON.stringify(nest(33, undefined, obj)).length), + t(() => JSON.stringify(nest(100, 1, obj), (k, v) => v).length), + t(() => JSON.stringify(nest(101, 1, obj), (k, v) => v).length), + t(() => JSON.stringify(nest(40, 1, obj), null, 1).length), + t(() => JSON.stringify(nest(40, { toJSON: () => 1 }, obj)).length), + t(() => JSON.stringify([nest(20, { toJSON: () => 1 }, obj), nest(40, 1, obj)]).length), +] diff --git a/packages/codemode-rust/conformance/cases/std-json-stringify-depth.json b/packages/codemode-rust/conformance/cases/std-json-stringify-depth.json new file mode 100644 index 0000000000000..17c63d3fba3c8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-json-stringify-depth.json @@ -0,0 +1,41 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 193, + [ + "RangeError", + "Value exceeds the maximum depth of 32." + ], + 194, + [ + "RangeError", + "Value exceeds the maximum depth of 32." + ], + 65, + [ + "RangeError", + "Value exceeds the maximum depth of 32." + ], + [ + "RangeError", + "Value exceeds the maximum depth of 32." + ], + 601, + [ + "RangeError", + "Value exceeds the maximum depth of 100." + ], + [ + "RangeError", + "Value exceeds the maximum depth of 32." + ], + [ + "RangeError", + "Value exceeds the maximum depth of 32." + ], + 365 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-lazy-globals.js b/packages/codemode-rust/conformance/cases/std-lazy-globals.js new file mode 100644 index 0000000000000..ddacb5e9d6593 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-lazy-globals.js @@ -0,0 +1,4 @@ +const b = require("buffer") +const { URL: U } = await import("node:url") +const u = require("util") +return [b.Buffer.from("ab").length, new U("https://a.test/x").pathname, new u.TextEncoder().encode("é").length, "a-b".split(/-/), [..."x1y2".matchAll(/\d/g)].length] diff --git a/packages/codemode-rust/conformance/cases/std-lazy-globals.json b/packages/codemode-rust/conformance/cases/std-lazy-globals.json new file mode 100644 index 0000000000000..70d2a4ae6bff5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-lazy-globals.json @@ -0,0 +1,16 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 2, + "/x", + 2, + [ + "a", + "b" + ], + 2 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-locale-compare.js b/packages/codemode-rust/conformance/cases/std-locale-compare.js new file mode 100644 index 0000000000000..5ebe5c414aa1b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-locale-compare.js @@ -0,0 +1,4 @@ +const words = ["apple", "Apple", "APPLE", "äpple", "resume", "résumé", "Resume", "co-op", "coop", "co op", "a1", "a10", "a2", "file10", "file9", "", "Z", "z", "_x", "-x", "x", "naïve", "naive", "straße", "strasse", "Ab", "aB", "ab", "AB", "é", "é", "Å", "Å", "中", "日", "😀", "ı", "İ", "ß", "ss"] +const sorted = [...words].sort((a, b) => a.localeCompare(b)) +const signs = words.map((a) => words.map((b) => Math.sign(a.localeCompare(b)) + 1).join("")).join("/") +return { sorted, signs, nfd: "\u00e9".localeCompare("e\u0301"), empty: "".localeCompare(""), undef: "undefined".localeCompare() } diff --git a/packages/codemode-rust/conformance/cases/std-locale-compare.json b/packages/codemode-rust/conformance/cases/std-locale-compare.json new file mode 100644 index 0000000000000..ed8e94b47e413 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-locale-compare.json @@ -0,0 +1,54 @@ +{ + "bindings": {}, + "ok": true, + "value": { + "sorted": [ + "", + "_x", + "-x", + "😀", + "Å", + "Å", + "a1", + "a10", + "a2", + "ab", + "aB", + "Ab", + "AB", + "apple", + "Apple", + "APPLE", + "äpple", + "co op", + "co-op", + "coop", + "é", + "é", + "file10", + "file9", + "İ", + "ı", + "naive", + "naïve", + "resume", + "Resume", + "résumé", + "ss", + "ß", + "strasse", + "straße", + "x", + "z", + "Z", + "中", + "日" + ], + "signs": "1000000000222002002200000222200220020000/2100000000222002002200000222200220020000/2210000000222002002200000222200220020000/2221000000222002002200000222200220020000/2222100222222222002202200222222220022200/2222212222222222002202200222222220022200/2222201222222222002202200222222220022200/2222000102222002002200000222200220020000/2222000212222002002200000222200220020000/2222000001222002002200000222200220020000/0000000000100002002200000000000220020000/0000000000210002002200000000000220020000/0000000000221002002200000000000220020000/2222000222222102002200000222222220020000/2222000222222212002200000222222220020000/0000000000000001000000000000000000000000/2222222222222222122222222222222220022222/2222222222222222012222222222222220022222/0000000000000002001000000000000000000000/0000000000000002002100000000000000000000/2222222222222222002212222222222220022222/2222000222222222002201200222222220022200/2222000222222222002200100222222220022200/2222222222222222002202212222222220022222/2222222222222222002202201222222220022222/0000000000222002002200000122000220020000/0000000000222002002200000012000220020000/0000000000222002002200000001000220020000/0000000000222002002200000222100220020000/2222000222222002002200000222211220020000/2222000222222002002200000222211220020000/0000000000000002002200000000000110020000/0000000000000002002200000000000110020000/2222222222222222222222222222222221022222/2222222222222222222222222222222222122222/0000000000000002002200000000000000010000/2222000222222222002200000222222220021200/2222000222222222002200000222222220020100/2222222222222222002202200222222220022212/2222222222222222002202200222222220022201", + "nfd": 0, + "empty": 0, + "undef": 0 + }, + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-lone-surrogates-collation.js b/packages/codemode-rust/conformance/cases/std-lone-surrogates-collation.js new file mode 100644 index 0000000000000..d296110b37fa2 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-lone-surrogates-collation.js @@ -0,0 +1,7 @@ +const H = "\ud83d", L = "\ude00", S = "\ud800" +const others = ["a", "Z", "1", " ", "中", "\ufffd", "\uffff", "\ue000", "\u0378", "\u{40000}", "\u{10000}", "\u{e0001}", "\u{30000}", "😀", "", "\u2fe0", "\ud7fc", "ゝ", "\u{1f9ff}", "\u{e01ef}", "\u{f0000}"] +const out = [] +for (const s of [H, L, S, "\udfff", "a" + H]) out.push(others.map((o) => s.localeCompare(o)).join(",")) +out.push([H.localeCompare(L), S.localeCompare(H), H.localeCompare(H), (H + "a").localeCompare(H + "b"), ("a" + H).localeCompare("a")].join(",")) +out.push(...(() => { const H2 = "\ud83d", L2 = "\ude00"; return [("a" + H2).localeCompare("A" + L2), ("A" + H2).localeCompare("a" + L2), ("é" + H2).localeCompare("e" + L2), [L2, "b" + H2, "B" + L2, H2, "a", "\ue000", "\ufffd", "b" + L2].sort((x, y) => x.localeCompare(y)).map((x) => JSON.stringify(x)).join()] })()) +return out diff --git a/packages/codemode-rust/conformance/cases/std-lone-surrogates-collation.json b/packages/codemode-rust/conformance/cases/std-lone-surrogates-collation.json new file mode 100644 index 0000000000000..b93e49a1bee6d --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-lone-surrogates-collation.json @@ -0,0 +1,18 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "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,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,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,0,-1,1", + -1, + -1, + -1, + "\"a\",\"b\\ud83d\",\"b\\ude00\",\"B\\ude00\",\"\\ud83d\",\"\\ude00\",\"\",\"�\"" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-lone-surrogates-web.js b/packages/codemode-rust/conformance/cases/std-lone-surrogates-web.js new file mode 100644 index 0000000000000..2a62d20b3f1fb --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-lone-surrogates-web.js @@ -0,0 +1,34 @@ +const out = [] +const L = "a\ud800b", P = "\ud83d\ude00" +const t = (f) => { try { const r = f(); out.push(typeof r === "string" ? JSON.stringify(r) : JSON.stringify(r)) } catch (e) { out.push(e.constructor.name + ": " + JSON.stringify(e.message)) } } +t(() => new URL("https://x.test/" + L + "?q=" + L + "#" + L).href) +t(() => { const u = new URL("https://x.test/"); u.pathname = L; u.search = L; u.hash = L; return u.href }) +t(() => new URLSearchParams("a=" + L).get("a")) +t(() => { const p = new URLSearchParams(); p.set(L, L); p.append("k", "\udc00"); return p.toString() }) +t(() => [...new URLSearchParams({ [L]: L }).keys()]) +t(() => new Headers({ x: L }).get("x")) +t(() => new Headers({ [L]: "v" }).get(L)) +t(() => [...new TextEncoder().encode(L)]) +t(() => [...new TextEncoder().encode(P.slice(1))]) +t(() => [...Buffer.from(L)]) +t(() => [...Buffer.from(L, "utf16le")]) +t(() => [...Buffer.from(L, "latin1")]) +t(() => Buffer.from(L).toString()) +t(() => Buffer.byteLength(L)) +t(() => btoa(L)) +t(() => atob("YQ==")) +t(() => encodeURIComponent(L)) +t(() => encodeURI("\udc00")) +t(() => encodeURIComponent(P)) +t(() => decodeURIComponent("%F0%9F%98%80" + L).length) +t(() => [...new TextEncoder().encode(String.fromCharCode(0xdbff, 0xdfff))]) +t(() => new Date(L).getTime()) +t(() => Number(L)) +t(() => parseInt("12" + L)) +t(() => parseFloat("1.5" + L)) +t(() => JSON.parse('"\\ud800"').charCodeAt(0)) +t(() => JSON.parse('"' + L + '"').length) +t(() => JSON.stringify({ [L]: L, p: P, h: P[0] })) +t(() => new Uint8Array(new TextEncoder().encode(L)).length) +t(() => structuredClone ? 1 : 0) +return out diff --git a/packages/codemode-rust/conformance/cases/std-lone-surrogates-web.json b/packages/codemode-rust/conformance/cases/std-lone-surrogates-web.json new file mode 100644 index 0000000000000..546e9b3c88168 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-lone-surrogates-web.json @@ -0,0 +1,38 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "\"https://x.test/a%EF%BF%BDb?q=a%EF%BF%BDb#a%EF%BF%BDb\"", + "\"https://x.test/a%EF%BF%BDb?a%EF%BF%BDb#a%EF%BF%BDb\"", + "\"a�b\"", + "\"a%EF%BF%BDb=a%EF%BF%BDb&k=%EF%BF%BD\"", + "[\"a�b\"]", + "TypeError: \"Header 'x' has invalid value\"", + "TypeError: \"Invalid header name: 'a\\ud800b'\"", + "[97,239,191,189,98]", + "[239,191,189]", + "[97,239,191,189,98]", + "[97,0,0,216,98,0]", + "[97,0,98]", + "\"a�b\"", + "5", + "TypeError: \"The string contains invalid characters.\"", + "\"a\"", + "URIError: \"encodeURIComponent received malformed URI data: String contained an illegal UTF-16 sequence.\"", + "URIError: \"encodeURI received malformed URI data: String contained an illegal UTF-16 sequence.\"", + "\"%F0%9F%98%80\"", + "5", + "[244,143,191,191]", + "null", + "null", + "12", + "1.5", + "55296", + "3", + "\"{\\\"a\\\\ud800b\\\":\\\"a\\\\ud800b\\\",\\\"p\\\":\\\"😀\\\",\\\"h\\\":\\\"\\\\ud83d\\\"}\"", + "5", + "1" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-lone-surrogates.js b/packages/codemode-rust/conformance/cases/std-lone-surrogates.js new file mode 100644 index 0000000000000..b9720ca7946ca --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-lone-surrogates.js @@ -0,0 +1,32 @@ +const out = [] +const e = (v) => JSON.stringify(v) +const t = (label, f) => { try { out.push(label + " " + e(f())) } catch (x) { out.push(label + " " + x.constructor.name + ": " + e(x.message)) } } +const P = "\ud83d\ude00", H = P[0], L = P[1] +t("parts", () => [H.length, L.length, H.charCodeAt(0), L.charCodeAt(0), H + L === P, (H + L).length, H === "\ufffd", "\ud800" === "\udc00", H < L, "\ud800" < "\ue000", P.at(0) === H, P.slice(1) === L]) +t("concat", () => { let s = ""; for (const c of [H, "x", L]) s += c; return [s, s.length, H.concat(L) === P, `${H}${L}` === P, [H, L].join("") === P, H.repeat(2), (H + L).repeat(2) === P + P] }) +t("literal", () => ["\ud800".length, "a\udc00b".charCodeAt(1), "\u{d800}".length, '\ud83d' + '\ude00' === "😀", `\ud800`.charCodeAt(0), String.raw`\ud800`]) +t("iter", () => [[..."a" + H + "b"].length, [...P].length, Array.from(H + L + H).map((c) => c.length), [...(L + H)].map((c) => c.charCodeAt(0))]) +t("cp", () => [H.codePointAt(0), (H + "x").codePointAt(0), P.codePointAt(1), String.fromCodePoint(0x1f600) === P, String.fromCharCode(0xd83d, 0xde00) === P, String.fromCharCode(0xd800).length]) +t("wf", () => [H.isWellFormed(), P.isWellFormed(), ("a" + L).isWellFormed(), H.toWellFormed(), P.toWellFormed() === P, ("x" + H + L).isWellFormed()]) +t("search", () => [P.indexOf(H), P.indexOf(L), P.lastIndexOf(L), P.includes(L), P.startsWith(H), P.endsWith(L), ("a" + H + "b").indexOf(H), ("a" + H + "b").indexOf("b"), (H + "z").search(/z/)]) +t("split", () => [P.split(""), P.split(H), ("a" + H + "b" + H + "c").split(H), (H + L + H).split(L), P.split(L, 1)]) +t("replace", () => [P.replace(H, "x"), P.replace(L, "y"), P.replaceAll("", "-"), ("a" + H + "b").replace(H, L), ("a" + H).replace("a", H), P.replace(H, "$&$&"), P.replace(L, (m, i) => i)]) +t("case", () => [(H + "a").toUpperCase(), ("A" + L).toLowerCase(), (" " + H + " ").trim(), H.padStart(3, "x"), "x".padEnd(3, P), "x".padStart(2, P)]) +t("slice", () => [P.substring(0, 1), P.substr(1), ("ab" + P).slice(-1), P.charAt(1), P[1], P.at(-1)]) +t("norm", () => [(H + "e\u0301").normalize(), ("e" + L + "\u0301").normalize("NFC").length]) +t("cmp", () => [[L, H, "a", P, "\uffff"].sort(), H.localeCompare(L), [H, L].sort((a, b) => a.localeCompare(b)), H == L, Object.is(H, P[0])]) +t("keys", () => { const o = { [H]: 1, [L]: 2, "\ufffd": 3 }; o[H] += 10; return [Object.keys(o), o[P[0]], H in o, Object.keys(o).length, Object.entries({ [P]: 1 })] }) +t("map", () => { const m = new Map([[H, 1], [L, 2]]); const s = new Set([H, P[0], L]); return [m.get(P[0]), m.size, s.size, [...m.keys()]] }) +t("json", () => [JSON.stringify(H), JSON.stringify({ [L]: H + "x" }), JSON.parse('"\\ud800\\udc00"') === "\ud800\udc00", JSON.parse('"\\ud800x"').length, JSON.parse(JSON.stringify(H)) === H, JSON.stringify([P, H + L, L + H])]) +t("regexp", () => [/\ud83d/.test(P), /\ud83d/u.test(P), /^.$/u.test(P), /^.$/.test(H), P.match(/./g).length, P.match(/./gu).length, (H + "x").replace(/x/, "y"), P.replace(/\ude00/, "Z"), new RegExp(H).source === H, /[\ud800-\udbff]/.test(H), RegExp.escape(H), P.split(/(?:)/).length, P.split(/(?:)/u).length, [...P.matchAll(/./g)].map((m) => m.index)]) +t("num", () => [Number(H), parseInt(H), parseFloat("1" + H), +L, H * 1, isNaN(H)]) +t("uri", () => [encodeURIComponent(P), decodeURIComponent("%ED%A0%80"), escape ? 1 : 0]) +t("err", () => { try { null[H] } catch (x) { return [x.message.includes(H), x.message.length] } }) +t("err2", () => { const x = new Error(H + "!"); return [x.message === H + "!", String(x) === "Error: " + H + "!", x.toString().length] }) +t("tmpl", () => [`${H}`.length, `a${L}b`.charCodeAt(1), [H].toString() === H, String([H, L]) === H + "," + L, `${[H, L]}`]) +t("label", () => { const r = []; for (const c of "x" + H) r.push(c.length); return r }) +t("arr", () => [[H, L].join("") === P, [H, L].includes(P[1]), [H, L].indexOf(L), [L, H].sort(), Array.of(H).flat()]) +t("switch", () => { switch (P[0]) { case H: return 1; default: return 0 } }) +t("boundary", () => { const a = "\ud800", b = "\udc00"; return [(a + b).length, (a + b).codePointAt(0), [...(a + b)].length, (a + b).isWellFormed()] }) +t("mark", () => { const m = String.fromCodePoint(0x10ffff); const n = m + H; return [m.length, n.length, n.charCodeAt(2), [...n].length, JSON.stringify(n), (m + m).length, m.codePointAt(0), String.fromCharCode(0xdbff, 0xdfff) === m, "\u{10ffff}" === m, n.slice(0, 2) === m] }) +return out diff --git a/packages/codemode-rust/conformance/cases/std-lone-surrogates.json b/packages/codemode-rust/conformance/cases/std-lone-surrogates.json new file mode 100644 index 0000000000000..632ec61e1153e --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-lone-surrogates.json @@ -0,0 +1,35 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "parts [1,1,55357,56832,true,2,false,false,true,true,true,true]", + "concat [\"\\ud83dx\\ude00\",3,true,true,true,\"\\ud83d\\ud83d\",true]", + "literal [1,56320,1,true,55296,\"\\\\ud800\"]", + "iter [3,1,[2,1],[56832,55357]]", + "cp [55357,55357,56832,true,true,1]", + "wf [false,true,false,\"�\",true,true]", + "search [0,1,1,true,true,true,1,2,1]", + "split [[\"\\ud83d\",\"\\ude00\"],[\"\",\"\\ude00\"],[\"a\",\"b\",\"c\"],[\"\\ud83d\",\"\\ud83d\"],[\"\\ud83d\"]]", + "replace [\"x\\ude00\",\"\\ud83dy\",\"-\\ud83d-\\ude00-\",\"a\\ude00b\",\"\\ud83d\\ud83d\",\"\\ud83d😀\",\"\\ud83d1\"]", + "case [\"\\ud83dA\",\"a\\ude00\",\"\\ud83d\",\"xx\\ud83d\",\"x😀\",\"\\ud83dx\"]", + "slice [\"\\ud83d\",\"\\ude00\",\"\\ude00\",\"\\ude00\",\"\\ude00\",\"\\ude00\"]", + "norm [\"\\ud83dé\",3]", + "cmp [[\"a\",\"\\ud83d\",\"😀\",\"\\ude00\",\"￿\"],-1,[\"\\ud83d\",\"\\ude00\"],false,true]", + "keys [[\"\\ud83d\",\"\\ude00\",\"�\"],11,true,3,[[\"😀\",1]]]", + "map [1,2,2,[\"\\ud83d\",\"\\ude00\"]]", + "json [\"\\\"\\\\ud83d\\\"\",\"{\\\"\\\\ude00\\\":\\\"\\\\ud83dx\\\"}\",true,2,true,\"[\\\"😀\\\",\\\"😀\\\",\\\"\\\\ude00\\\\ud83d\\\"]\"]", + "regexp [true,false,true,true,2,1,\"\\ud83dy\",\"\\ud83dZ\",true,true,\"\\\\ud83d\",2,1,[0,1]]", + "num [null,null,1,null,null,true]", + "uri URIError: \"decodeURIComponent received malformed URI data: URI error\"", + "err [true,45]", + "err2 [true,true,9]", + "tmpl [1,56832,true,true,\"\\ud83d,\\ude00\"]", + "label [1,1]", + "arr [true,true,1,[\"\\ud83d\",\"\\ude00\"],[\"\\ud83d\"]]", + "switch 1", + "boundary [2,65536,1,true]", + "mark [2,3,55357,2,\"\\\"􏿿\\\\ud83d\\\"\",4,1114111,true,true,true]" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-math-copywithin.js b/packages/codemode-rust/conformance/cases/std-math-copywithin.js new file mode 100644 index 0000000000000..14fc798f3fea1 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-math-copywithin.js @@ -0,0 +1,10 @@ +const out = [] +out.push(Math.sumPrecise([1e20, 0.1, -1e20]), Math.sumPrecise([0.1, 0.2, 0.3]), Math.sumPrecise([]), Object.is(Math.sumPrecise([-0, -0]), -0), Math.sumPrecise([1e308, 1e308, -1e308]), Math.sumPrecise([Infinity, 1]), Math.sumPrecise([Infinity, -Infinity]), Math.sumPrecise([NaN]), Math.sumPrecise(new Set([5e-324, 5e-324])), Math.sumPrecise([1, 2 ** 53, 1]), Math.sumPrecise([1.7976931348623157e308, 1e292])) +try { Math.sumPrecise([1, "2"]) } catch (e) { out.push(e.name, e.message) } +try { Math.sumPrecise(5) } catch (e) { out.push(e.name) } +out.push([1.337, 65504, 65520, 65519.99, 5.960464477539063e-8, 2.9802322387695312e-8, 2.98023223876953126e-8, -0, 0.1, 1e-10, -1.5, 1.0009765625, 1.00048828125, 1.00146484375].map(Math.f16round)) +out.push([1, 2, 3, 4, 5].copyWithin(0, 3), [1, 2, 3, 4, 5].copyWithin(-2), [1, 2, 3, 4, 5].copyWithin(1, 0, 3), [1, 2, 3, 4, 5].copyWithin(0, -3, -1), [1, 2, 3].copyWithin(5, 0)) +try { Object.freeze([1, 2]).copyWithin(0, 1) } catch (e) { out.push(e.name) } +let seed = 9; const rnd = () => { seed = (seed * 1103515245 + 12345) % 2147483648; return seed / 2147483648 } +for (let i = 0; i < 50; i++) { const xs = []; for (let j = 0; j < 8; j++) xs.push((rnd() - 0.5) * 10 ** Math.floor(rnd() * 40 - 20)); out.push(Math.sumPrecise(xs)) } +return out.map(String) diff --git a/packages/codemode-rust/conformance/cases/std-math-copywithin.json b/packages/codemode-rust/conformance/cases/std-math-copywithin.json new file mode 100644 index 0000000000000..e20f3119e0439 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-math-copywithin.json @@ -0,0 +1,79 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "0.1", + "0.6", + "0", + "true", + "1e+308", + "Infinity", + "NaN", + "NaN", + "5e-324", + "9007199254740994", + "Infinity", + "TypeError", + "Math.sumPrecise expects an iterable of numbers.", + "TypeError", + "1.3369140625,65504,Infinity,65504,5.960464477539063e-8,0,0,0,0.0999755859375,0,-1.5,1.0009765625,1,1.001953125", + "4,5,3,4,5", + "1,2,3,1,2", + "1,1,2,3,5", + "3,4,3,4,5", + "1,2,3", + "TypeError", + "-2181596466658.771", + "-331533353.23756975", + "-15372578514565086", + "-249882012681486.7", + "-46955845475194650", + "-29457826862420710", + "-656325007565.9758", + "257556915283868540", + "32125841316491.71", + "-476319262556728600", + "-3389744585216918000", + "1422187089920044000", + "-1018150559103488900", + "4032076597241135.5", + "1162632706640023000", + "-244257626599569920", + "-1816714267.6425529", + "14379285411665348", + "-61269897615907390", + "-29503730034609500", + "-652031328519.4344", + "257589041125120420", + "245869101.32956386", + "-3866063830673691600", + "1422187072574220000", + "-1018134094774723100", + "-16464328765869.13", + "4032076597241193.5", + "1162632707102717400", + "-244257627067049600", + "-1812009473.685677", + "14226373033434494", + "-61116985237596100", + "-29504382070084276", + "257556915287349400", + "32125841917276.05", + "-476319262556731700", + "-3389744585213189000", + "1422187089916318700", + "-1018134094774723100", + "-16464328736780.127", + "1166664369106291200", + "414594062085.0411", + "-244257627067473440", + "-147147296080.04468", + "14207717990877908", + "-90602404880833630", + "-162044921510.45975", + "257556915283866460", + "32125841318426.562" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-math-hypot-inexact.js b/packages/codemode-rust/conformance/cases/std-math-hypot-inexact.js new file mode 100644 index 0000000000000..e8cf581b6f021 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-math-hypot-inexact.js @@ -0,0 +1,3 @@ +// @platform "linux" +// Math.hypot rounds through libm and through sums that compilers may fuse, so this case is recorded and checked on Linux only. +const r=[]; try { Math.hypot(Infinity, { valueOf() { throw new Error("x") } }) } catch (e) { r.push(e.message) }; r.push(Math.hypot(), Math.hypot(-0), Math.hypot(3, 4), Math.hypot(NaN, Infinity), Math.hypot(1e200, 1e200), Math.hypot(1, 2, 3), Math.hypot(0.1, 0.2), Math.hypot(-3)); return [r, (() => { let seed = 5; const rnd = () => { seed = (seed * 1103515245 + 12345) % 2147483648; return seed / 2147483648 }; const out = []; for (let i = 0; i < 200; i++) { const n = 1 + Math.floor(rnd() * 5); const xs = []; for (let j = 0; j < n; j++) xs.push((rnd() - 0.5) * 10 ** Math.floor(rnd() * 20 - 10)); out.push(String(Math.hypot(...xs))) } return out })()] diff --git a/packages/codemode-rust/conformance/cases/std-math-hypot-inexact.json b/packages/codemode-rust/conformance/cases/std-math-hypot-inexact.json new file mode 100644 index 0000000000000..00a75069280f4 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-math-hypot-inexact.json @@ -0,0 +1,221 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "x", + 0, + 0, + 5, + null, + 1.414213562373095e+200, + 3.741657386773941, + 0.223606797749979, + 3 + ], + [ + "2425715.937689267", + "0.0029310631869556582", + "4.709880251804046e-8", + "471229642.650609", + "42049822.211265564", + "3548715.1301912875", + "1429.6579592914904", + "26714.05517310587", + "4179930.687163442", + "434882.64083862747", + "6687402.725219727", + "12634548.418925267", + "0.017886112394690297", + "36170020.32697201", + "15878.233313560486", + "19949200.376868248", + "2.5021947628123927e-7", + "17.84530282027033", + "134273.69205753945", + "337316.7514801059", + "43862377.15459415", + "376528263.0920441", + "234776.70550346375", + "4259.144604104167", + "459.8815441261293", + "25554833.142086864", + "0.003849957743078137", + "400.14222906957207", + "98795.57838815851", + "396172732.11479205", + "2.967076003551483e-7", + "2740353.362177818", + "4062372.148036957", + "1930546.1645126343", + "40269.19603483258", + "180618762.9699707", + "3.8514797621363406", + "406771.54064178484", + "12535762.786897475", + "331847.31006622314", + "0.00039557674154639246", + "154.05136932206335", + "28470.38209438324", + "0.0000042596629261970525", + "10476.720178332216", + "2.27320432662965", + "11578240.990638733", + "4.892294530142776", + "18.109703063990388", + "0.3411604761740077", + "3.5258764028549195e-7", + "22.507575154304508", + "3812.2904305663433", + "0.026459862157149478", + "0.8866330210455029", + "3534.5643761794504", + "150387.6476674236", + "1020452.3801803589", + "360168874.2637634", + "38646715.87944031", + "399403363.4663694", + "401.3310670852661", + "0.00019907359690581747", + "32.38384621977026", + "490122.79510498047", + "34.42996740343276", + "437144.04106140137", + "180.25994691633798", + "491390470.306704", + "3263401.985168457", + "3150.9912014016554", + "369.0914511680603", + "0.000041877093744620484", + "5889666.7418700745", + "178709745.4279654", + "46324133.87298584", + "47836.51353483492", + "0.039805889129638866", + "141212105.7510376", + "177734881.6394806", + "0.0003682774603366852", + "0.004651592075824813", + "4568058.4272859655", + "498113.5129928589", + "0.004335252888824075", + "45018384.186550975", + "31730893.25428009", + "23194575.309753418", + "0.0004638471305370331", + "3430.4681420326233", + "360995650.56604415", + "42955876.992225975", + "256128638.62431535", + "344542124.8153949", + "23907647.666241296", + "23080.262541770935", + "19679853.44715123", + "359605744.7227335", + "27.654194831848145", + "39266836.64321919", + "3.2756686210741113", + "49700951.57623291", + "187404513.35906982", + "60657.14770240071", + "3004554.5101166186", + "1266812.8645835984", + "393346913.5871166", + "34873797.768730566", + "299488544.4641829", + "279.8006146603386", + "24.754481892140568", + "145540.08841514587", + "0.000016986474588794163", + "499599307.77549744", + "4.8413316727150667e-8", + "251809926.65424764", + "4461354.496879137", + "18929739.082628675", + "1.0441227055032694", + "2372.9400884632896", + "4011.1249685287476", + "1.5872559323906898", + "0.2300659716129303", + "280034516.00670815", + "225184355.2675475", + "34263.27705383301", + "498820424.0799172", + "12778.288373422114", + "3.5228803753852844", + "239172399.0440389", + "355171759.12301475", + "4.5997801423072815", + "349013776.8404703", + "489.74868655204773", + "102946400.64239502", + "459559022.0775288", + "0.017042303134008802", + "0.0035358832928418997", + "422252581.089396", + "4700854.789788579", + "4772942.066193369", + "3520411.277293722", + "0.028202298283579442", + "2.8128888449089735", + "3644.866943362623", + "0.000002820725326596529", + "81221828.71857566", + "400351792.5745412", + "0.004969972935452662", + "424.44992065429693", + "3101539.6118164062", + "577406.5743791745", + "453.27303186059", + "307379.24732565077", + "153.27894957580384", + "4717025.756835945", + "3756351.2101769447", + "422363877.29644775", + "47119158.50639343", + "23540548.785197638", + "197866.82724952698", + "30071.497016849866", + "23185.420238856514", + "31348240.375540126", + "37954330.44433594", + "0.0006127235117266322", + "167267560.9588623", + "12645280.366991853", + "1.6539683938026428e-7", + "275353193.28308105", + "374.5819509839327", + "0.0010313007235527038", + "3115946.073160337", + "4462212.324142456", + "17734.97280271606", + "0.0003515711791915915", + "4240.049123764046", + "27584181.472981676", + "36806.96189716983", + "432.2205993221509", + "21110823.750496957", + "1436.5634322166443", + "365.53314328193665", + "0.07387414574623108", + "450962.54350606666", + "19.44410822920522", + "3.0004633539228154", + "5349087.715148926", + "122.59626769998303", + "4667.586569618431", + "48.51021803819108", + "1262624.2637634277", + "417037.9407519763", + "3488164.5762452893", + "334764.3136068446", + "47.61821925640106", + "0.24580860137939453", + "4.161347377408503e-11", + "2781.822830438614", + "2.8809394190462716" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-math-hypot.js b/packages/codemode-rust/conformance/cases/std-math-hypot.js new file mode 100644 index 0000000000000..5f33dc7507090 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-math-hypot.js @@ -0,0 +1,8 @@ +// Results that are exact, so every libm and compiler agrees; std-math-hypot-inexact covers rounded ones. +const r = [] +try { Math.hypot(Infinity, { valueOf() { throw new Error("x") } }) } catch (e) { r.push(e.message) } +const ones = (n) => Array.from({ length: n }, () => 1) +r.push(Math.hypot(), Math.hypot(-0), Math.hypot(3, 4), Math.hypot(NaN, Infinity), Math.hypot(3 * 2 ** 1021, 4 * 2 ** 1021), Math.hypot(0.75, -1), Math.hypot(-3)) +r.push(Math.hypot(1, 2, 2), Math.hypot(1, 4, 8), Math.hypot(-2, 4, -4), Math.hypot(2 ** -1000, 2 ** -999, 2 ** -999), Math.hypot(0, 0, 0), Math.hypot(NaN, 1, Infinity)) +r.push(Math.hypot(1, 1, 1, 1), Math.hypot(2, ...ones(12)), Math.hypot(1, 2, ...ones(11)), Math.hypot(-0.5, 0.5, 0.5, 0.5), Math.hypot(2 ** 1000, 2 ** 1000, 2 ** 1000, 2 ** 1000), Math.hypot(0, 0, 0, 0), Math.hypot(NaN, 1, 2, Infinity)) +return r.map(String) diff --git a/packages/codemode-rust/conformance/cases/std-math-hypot.json b/packages/codemode-rust/conformance/cases/std-math-hypot.json new file mode 100644 index 0000000000000..491a96ea7660f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-math-hypot.json @@ -0,0 +1,29 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "x", + "0", + "0", + "5", + "Infinity", + "1.1235582092889474e+308", + "1.25", + "3", + "3", + "9", + "6", + "2.7997908555096566e-301", + "0", + "Infinity", + "2", + "4", + "4", + "1", + "2.1430172143725346e+301", + "0", + "Infinity" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-number-format-random.js b/packages/codemode-rust/conformance/cases/std-number-format-random.js new file mode 100644 index 0000000000000..7c76b5e3092d9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-number-format-random.js @@ -0,0 +1,10 @@ +let seed = 12345 +const rnd = () => { seed = (seed * 1103515245 + 12345) % 2147483648; return seed / 2147483648 } +const out = [] +for (let i = 0; i < 400; i++) { + const x = (rnd() - 0.5) * 10 ** Math.floor(rnd() * 40 - 20) + const r = 2 + Math.floor(rnd() * 35) + const d = Math.floor(rnd() * 20) + out.push([x.toString(r), x.toExponential(d), x.toPrecision(d + 1), x.toFixed(d), x.toExponential(), String(x)].join("|")) +} +return out diff --git a/packages/codemode-rust/conformance/cases/std-number-format-random.json b/packages/codemode-rust/conformance/cases/std-number-format-random.json new file mode 100644 index 0000000000000..0021571229886 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-number-format-random.json @@ -0,0 +1,408 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "0.00000072iklldalg5m|1.5515404846519232148e-9|1.5515404846519232148e-9|0.0000000015515404847|1.5515404846519232e-9|1.5515404846519232e-9", + "536405.36526|1.79461479187011719e+5|179461.479187011719|179461.47918701171875000|1.7946147918701172e+5|179461.47918701172", + "7942iqnml.9i7|2.072738e+12|2.072738e+12|2072738409042.358398|2.0727384090423584e+12|2072738409042.3584", + "0.0000000000h3hejbe2c8al|2.9390e-14|2.9390e-14|0.0000|2.938960790634155e-14|2.938960790634155e-14", + "-r3cqveo.9vm|-2.9105159640312195e+10|-29105159640.312195|-29105159640.3121948242187500|-2.9105159640312195e+10|-29105159640.312195", + "-0.02mddhmfpmieo|-3.8866138e-3|-0.0038866138|-0.0038866|-3.8866138458251956e-3|-0.0038866138458251956", + "-0.0000a0uxubkapwg|-2.20682740211486817e-7|-2.20682740211486817e-7|-0.00000022068274021|-2.2068274021148682e-7|-2.2068274021148682e-7", + "-0.0025bmrlhl9qmj|-8.073e-5|-0.00008073|-0.000|-8.073103427886963e-5|-0.00008073103427886963", + "-0.00000008b55390e5c3487|-3.4168872237e-9|-3.4168872237e-9|-0.0000000034|-3.4168872237205507e-9|-3.4168872237205507e-9", + "0.03jn4h86d373p|4.7297e-3|0.0047297|0.0047|4.729743003845215e-3|0.004729743003845215", + "-9mgm8mk8d.3c|-6.398246e+12|-6.398246e+12|-6398245692253.113281|-6.398245692253113e+12|-6398245692253.113", + "1iel1ione.o92|3.58e+11|3.58e+11|357974767684.94|3.579747676849365e+11|357974767684.9365", + "0.00000000000025eneaofc8g2|8.9247137e-19|8.9247137e-19|0.0000000|8.924713730812073e-19|8.924713730812073e-19", + "0.000000000b7a7c2c59ecb23|1.99660420e-11|1.99660420e-11|0.00000000|1.9966042041778566e-11|1.9966042041778566e-11", + "-e0bgf7c656d5d|-8e+15|-8e+15|-8180892467498779|-8.180892467498779e+15|-8180892467498779", + "-0.00000000000ejij2ohi866|-2e-16|-2e-16|-0|-2.4813542142510416e-16|-2.4813542142510416e-16", + "-0.00000000eb0248af9c3a6|-2.1374e-10|-2.1374e-10|-0.0000|-2.1373936906456948e-10|-2.1373936906456948e-10", + "0.0c2chg3icf1b5|3.0330565571784974e-2|0.030330565571784974|0.0303305655717850|3.0330565571784974e-2|0.030330565571784974", + "100010100101001001111.1000111010100011|1.13313555717e+6|1133135.55717|1133135.55717468262|1.1331355571746826e+6|1133135.5571746826", + "-0.171l53liaj1mh|-5.13183e-2|-0.0513183|-0.05132|-5.131828784942627e-2|-0.05131828784942627", + "-64072331548684241|-1.1960148811e+16|-1.1960148811e+16|-11960148811340332.0000000000|-1.1960148811340332e+16|-11960148811340332", + "111111011110.100111011110100001|4.062616825104e+3|4062.616825104|4062.616825103760|4.0626168251037598e+3|4062.6168251037598", + "0.000165jep9ehrjm|1.4892315864563e-6|0.0000014892315864563|0.0000014892316|1.4892315864562989e-6|0.0000014892315864562989", + "-9zespew.z4zq|-2.173221111e+10|-2.173221111e+10|-21732211112.976074219|-2.1732211112976074e+10|-21732211112.976074", + "-15.o6a947hcg2|-3.09702634811401367e+1|-30.9702634811401367|-30.97026348114013672|-3.0970263481140137e+1|-30.970263481140137", + "141104020.310301340034213|7.223856449127197266e+5|722385.6449127197266|722385.644912719726562500|7.223856449127197e+5|722385.6449127197", + "-0.0000000008569b773g4g81|-4.1254329681396482e-12|-4.1254329681396482e-12|-0.0000000000041254|-4.125432968139648e-12|-4.125432968139648e-12", + "-19023704528808.594|-1.9023704528808594e+13|-19023704528808.594|-19023704528808.5937500000000000|-1.9023704528808594e+13|-19023704528808.594", + "-0.0000000000000101111101110011010111000010100011110101110000101001|-9.102881e-5|-0.00009102881|-0.000091|-9.102880954742432e-5|-0.00009102880954742432", + "44n7elmgn.ss5|2.0838201045989990234e+12|2083820104598.9990234|2083820104598.9990234375000000000|2.083820104598999e+12|2083820104598.999", + "103a217176703.4b8|9e+12|9e+12|9154367446899|9.154367446899414e+12|9154367446899.414", + "-2.anl427lnf|-2.4581286683679e+0|-2.4581286683679|-2.4581286683679|-2.4581286683678627e+0|-2.4581286683678627", + "0.09liaa229e9eb|1.719965934753418108e-2|0.01719965934753418108|0.017199659347534181|1.719965934753418e-2|0.01719965934753418", + "0.0000000000017303b8g54197|1.8219e-16|1.8219e-16|0.0000|1.821894645690918e-16|1.821894645690918e-16", + "0.000506348ccc7320c3|1.7636051774025e-4|0.00017636051774025|0.0001763605177|1.7636051774024962e-4|0.00017636051774024962", + "-0.0000014445471763610841|-1.444547e-6|-0.000001444547|-0.000001|-1.4445471763610841e-6|-0.0000014445471763610841", + "-3.sff32fmir7|-3.81259679794312e+0|-3.81259679794312|-3.81259679794312|-3.8125967979431152e+0|-3.8125967979431152", + "88hm8k27.tnpd|1.812232e+11|1.812232e+11|181223154067.993164|1.8122315406799316e+11|181223154067.99316", + "-0.0002521001441351023205|-2.23268270492553737e-3|-0.00223268270492553737|-0.00223268270492554|-2.2326827049255374e-3|-0.0022326827049255374", + "-0.0000000000000009bjhk8a23f1a|-1.5516472e-21|-1.5516472e-21|-0.0000000|-1.5516471862792968e-21|-1.5516471862792968e-21", + "-0.0000000000000000000125022150552025320113|-4.03e-16|-4.03e-16|-0.00|-4.0317249298095705e-16|-4.0317249298095705e-16", + "271ofg.0353ff|2.6995790e+7|26995790|26995790.0047302|2.6995790004730225e+7|26995790.004730225", + "-0.038jntdo4xvm|-2.813441e-3|-0.002813441|-0.002813|-2.813440561294556e-3|-0.002813440561294556", + "-71d08d6ba623c.6|-4.0468049049377443750e+14|-404680490493774.43750|-404680490493774.4375000000000000000|-4.0468049049377444e+14|-404680490493774.44", + "-0.00000000370a2lk0ailf7|-2.7492904663085937484e-12|-2.7492904663085937484e-12|-0.0000000000027492905|-2.7492904663085937e-12|-2.7492904663085937e-12", + "-6a658153.5479b3|-2.4646139144897461e+8|-246461391.44897461|-246461391.4489746093750000|-2.464613914489746e+8|-246461391.4489746", + "-0.5jqhd8cgneb|-2.1260213852e-1|-0.21260213852|-0.2126021385|-2.126021385192871e-1|-0.2126021385192871", + "1112379.12723283|1.95e+6|1.95e+6|1950364.11|1.950364112854004e+6|1950364.112854004", + "0.0000000000000000000000000433241235541115242105|2.694230378e-20|2.694230378e-20|0.000000000|2.6942303776741026e-20|2.6942303776741026e-20", + "-0.00000ban4b88ep3b|-3.696441650391e-8|-3.696441650391e-8|-0.000000036964|-3.6964416503906246e-8|-3.6964416503906246e-8", + "0.00000032c156712430b|7.69958496e-9|7.69958496e-9|0.00000001|7.6995849609375e-9|7.6995849609375e-9", + "0.000001di05ss66arp|9.049224853515625343e-10|9.049224853515625343e-10|0.000000000904922485|9.049224853515625e-10|9.049224853515625e-10", + "0.000c1c7ifepfti|1.14853e-5|0.0000114853|0.00001|1.148529052734375e-5|0.00001148529052734375", + "-0.00024ae242c179d1d8|-4.573440551757812793e-5|-0.00004573440551757812793|-0.000045734405517578|-4.573440551757813e-5|-0.00004573440551757813", + "0.0000000000000000e0a7b014ce1f4|4.7572553e-20|4.7572553e-20|0.0000000|4.75725531578064e-20|4.75725531578064e-20", + "-30a0b6a00008b4.2|-3.2846939563751218750e+14|-328469395637512.18750|-328469395637512.1875000000000000000|-3.284693956375122e+14|-328469395637512.2", + "64bcrnkjol7jn|2.176506519e+18|2.176506519e+18|2176506519317626880.000000000|2.176506519317627e+18|2176506519317627000", + "16ba49b5680501.09|1.693069934844971e+14|169306993484497.1|169306993484497.062500000000000|1.6930699348449706e+14|169306993484497.06", + "116g.2i1ef348f|9.8e+3|9.8e+3|9844.1|9.844136238098145e+3|9844.136238098145", + "11000011101010001100010111001.1110110001101101|4.1032722592354e+8|410327225.92354|410327225.9235382080078|4.103272259235382e+8|410327225.9235382", + "-k6o1d2gk.a04h|-2.1187674999237060547e+11|-211876749992.37060547|-211876749992.3706054687500000000|-2.118767499923706e+11|-211876749992.3706", + "110487030440803.855|2.56e+13|2.56e+13|25574803352355.96|2.5574803352355957e+13|25574803352355.957", + "-6fqp8c36dhc.f|-2.75529e+15|-2.75529e+15|-2755293250083923.50000|-2.7552932500839235e+15|-2755293250083923.5", + "-169sqhhoko.1h|-1.7681074142456e+13|-17681074142456|-17681074142456.0546875000000|-1.7681074142456055e+13|-17681074142456.055", + "0.000000000gkoeib6l3s7|2.0339250564575195e-14|2.0339250564575195e-14|0.0000000000000203|2.0339250564575195e-14|2.0339250564575195e-14", + "0.000000000000015404441610232561554|2.7e-12|2.7e-12|0.0|2.650836706161499e-12|2.650836706161499e-12", + "-0.000000fb52ecc09bfg4|-2.552517951e-8|-2.552517951e-8|-0.000000026|-2.5525179505348204e-8|-2.5525179505348204e-8", + "-0.000006al84ib655dm|-4.374043941497802838e-8|-4.374043941497802838e-8|-0.000000043740439415|-4.374043941497803e-8|-4.374043941497803e-8", + "-3.132909536361694e-20|-3.132909536361694e-20|-3.132909536361694e-20|-0.000000000000000|-3.132909536361694e-20|-3.132909536361694e-20", + "-6d.1k3k730h738|-1.39e+2|-139|-139.09|-1.3909339904785156e+2|-139.09339904785156", + "0.0046elikif681d|3.093085587025e-4|0.0003093085587025|0.000309308559|3.093085587024689e-4|0.0003093085587024689", + "-0.00000000000052a3kg1di54g9|-1.80755257607e-17|-1.80755257607e-17|-0.00000000000|-1.8075525760650633e-17|-1.8075525760650633e-17", + "0.0000000001121221102222222110110120120022112|2.7561783790588380397e-5|0.000027561783790588380397|0.0000275617837905884|2.756178379058838e-5|0.00002756178379058838", + "29621672630.31006|2.962e+10|2.962e+10|29621672630.310|2.962167263031006e+10|29621672630.31006", + "3c6187ae5bb468|1.699573398e+16|1.699573398e+16|16995733976364136.000000000|1.6995733976364136e+16|16995733976364136", + "48ea2.c04a41487|4.7127866744995e+5|471278.66744995|471278.6674499511719|4.712786674499512e+5|471278.6674499512", + "0.0jbio406f2ic7|2.87737846374512e-2|0.0287737846374512|0.02877378463745|2.8773784637451172e-2|0.028773784637451172", + "-0.00000000000000000000002000000210122122011200100120002121|-2.126e-11|-2.126e-11|-0.000|-2.1255922317504884e-11|-2.1255922317504884e-11", + "0.05c826971aaa8923|4e-2|0.04|0|3.533467650413513e-2|0.03533467650413513", + "-7ehm0em9p0qe4|-3.97856447846e+18|-3.97856447846e+18|-3978564478456973824.00000000000|-3.978564478456974e+18|-3978564478456974000", + "4f1i15bd.a0e6|4.7676658630371094e+10|47676658630.371094|47676658630.3710937500000000|4.767665863037109e+10|47676658630.37109", + "3263.fb4134j3|4.83e+4|4.83e+4|48278.62|4.827861785888672e+4|48278.61785888672", + "0.00002lk1g9nil0m5|2.941036522e-7|2.941036522e-7|0.000000294|2.941036522388458e-7|2.941036522388458e-7", + "0.0000022212221102001222202002010210221|4.0634238719940e-3|0.0040634238719940|0.0040634238720|4.063423871994019e-3|0.004063423871994019", + "-0.000000000dwvn96jhswc|-3.80544424e-15|-3.80544424e-15|-0.00000000|-3.8054442405700685e-15|-3.8054442405700685e-15", + "-0.0000000000004h5ls6mc72w|-5.55210114e-20|-5.55210114e-20|-0.00000000|-5.552101135253907e-20|-5.552101135253907e-20", + "3jb0l0kdbe1ad|1.297892332077026e+18|1.297892332077026e+18|1297892332077026304.000000000000000|1.2978923320770263e+18|1297892332077026300", + "-0.000000000ojcp424226p|-1.2e-13|-1.2e-13|-0.0|-1.2007045745849608e-13|-1.2007045745849608e-13", + "-44ff3522dd6.72|-4.74143117666244531e+12|-4741431176662.44531|-4741431176662.44531250000000000|-4.741431176662445e+12|-4741431176662.445", + "0.0000000000001320001365260260623|1.5e-11|1.5e-11|0.0|1.5165817737579346e-11|1.5165817737579346e-11", + "9.190b1ihdn1|9.1e+0|9.1|9.1|9.054428339004517e+0|9.054428339004517", + "-0.00000000000000031444023002000114412244|-2.227e-11|-2.227e-11|-0.000|-2.2272846102714538e-11|-2.2272846102714538e-11", + "-0.000000aqbqofq7h4k|-3.94e-10|-3.94e-10|-0.00|-3.9440292119979863e-10|-3.9440292119979863e-10", + "-210000021010201222202010101111.0022|-1.60212218761444e+14|-160212218761444|-160212218761444.09375000000000|-1.602122187614441e+14|-160212218761444.1", + "0.00000000000000010010110010000111011110011010011010110101000010110001|1.79e-5|0.0000179|0.00|1.7912936210632324e-5|0.000017912936210632324", + "-3lcfm.jd24l8g|-3.0082726478577e+6|-3008272.6478577|-3008272.6478576660156|-3.008272647857666e+6|-3008272.647857666", + "-0.028334987163543702|-2.833498716354370e-2|-0.02833498716354370|-0.028334987163544|-2.8334987163543702e-2|-0.028334987163543702", + "-0.0000000002baa9b99a4a37224|-4.8328602e-11|-4.8328602e-11|-0.0000000|-4.832860231399536e-11|-4.832860231399536e-11", + "-0.000000110030222013022300020030103|-8e-5|-0.00008|-0|-7.70484209060669e-5|-0.0000770484209060669", + "0.00000000000006b0a5fca|3.998587727546691978e-18|3.998587727546691978e-18|0.000000000000000004|3.998587727546692e-18|3.998587727546692e-18", + "0.000000000000000000000020211012210322333223212221|3.0481e-14|3.0481e-14|0.0000|3.048132658004761e-14|3.048132658004761e-14", + "20788c2ac5.38337|4.2124995589256286621e+10|42124995589.256286621|42124995589.2562866210937500000|4.212499558925629e+10|42124995589.25629", + "-0.00000000000000044b587a6c2d2c7|-1.994478702545e-18|-1.994478702545e-18|-0.000000000000|-1.9944787025451663e-18|-1.9944787025451663e-18", + "-0.000b53c16cba505e|-1.075398921967e-4|-0.0001075398921967|-0.000107539892|-1.0753989219665528e-4|-0.00010753989219665528", + "0.000000000000000514gdg500i18|3.53599786758422820e-21|3.53599786758422820e-21|0.00000000000000000|3.535997867584228e-21|3.535997867584228e-21", + "64b4c4d6b5b2.0b|2.568888664e+13|2.568888664e+13|25688886642456.054687500|2.5688886642456055e+13|25688886642456.055", + "-3.7558ca27b09939|-3.570637703e+0|-3.570637703|-3.570637703|-3.5706377029418945e+0|-3.5706377029418945", + "0.07d2dc99999999c|3.0561244487762453e-2|0.030561244487762453|0.0305612444877625|3.0561244487762453e-2|0.030561244487762453", + "0.0a632411bc12dea|4.62844729e-2|0.0462844729|0.04628447|4.62844729423523e-2|0.0462844729423523", + "w.67dks9fta|3.2182872295379638672e+1|32.182872295379638672|32.1828722953796386719|3.218287229537964e+1|32.18287229537964", + "0.000000000000d1bl7ij314cb|4.62154269218445e-17|4.62154269218445e-17|0.00000000000000|4.621542692184448e-17|4.621542692184448e-17", + "-0.000240553531441440444535|-2.0788407325744631e-3|-0.0020788407325744631|-0.0020788407325745|-2.078840732574463e-3|-0.002078840732574463", + "-0.0000000000000000000000010221225342540045433|-2.2495162487030030e-19|-2.2495162487030030e-19|-0.0000000000000000|-2.249516248703003e-19|-2.249516248703003e-19", + "-0.00000000000000gq1kd8ohm99|-3.32129e-21|-3.32129e-21|-0.00000|-3.321287631988525e-21|-3.321287631988525e-21", + "0.00000000vcp9spqk4v|3.9793491e-13|3.9793491e-13|0.0000000|3.979349136352539e-13|3.979349136352539e-13", + "-0.00017338275145333387|-2.7742684e-4|-0.00027742684|-0.0002774|-2.774268388748169e-4|-0.0002774268388748169", + "0.0foi4ma3l5id|2.1829664707184e-2|0.021829664707184|0.0218296647072|2.1829664707183838e-2|0.021829664707183838", + "2b0enfjidi4k|1.985079e+16|1.985079e+16|19850790500640868.000000|1.9850790500640868e+16|19850790500640868", + "0.0000000000000el4icc3jl3i8|2.40517e-18|2.40517e-18|0.00000|2.4051725864410404e-18|2.4051725864410404e-18", + "-0.0000000000000nk4j85lcmie|-5.6951045990e-21|-5.6951045990e-21|-0.0000000000|-5.6951045989990235e-21|-5.6951045989990235e-21", + "28g60579f2.90g4|2.99692511558533e+11|299692511558.533|299692511558.53271484375000|2.996925115585327e+11|299692511558.5327", + "0.0000000000000ma6cvr1ecgp|8.083e-21|8.083e-21|0.000|8.08337926864624e-21|8.08337926864624e-21", + "-0.00003b44da433c7862|-4.94e-6|-0.00000494|-0.00|-4.941651523113251e-6|-0.000004941651523113251", + "-0.00dh706c7241ci|-1.294817626476288e-3|-0.001294817626476288|-0.001294817626476|-1.294817626476288e-3|-0.001294817626476288", + "0.000000000000007tea55o28c5|3e-22|3e-22|0|3.3881545066833493e-22|3.3881545066833493e-22", + "0.0000000000000000042add4973682038|9.836426e-21|9.836426e-21|0.000000|9.836426004767418e-21|9.836426004767418e-21", + "-0.000000000000018cb956aba1c3ab8|-4.2965853214263918848e-16|-4.2965853214263918848e-16|-0.0000000000000004297|-4.296585321426392e-16|-4.296585321426392e-16", + "4c4dfc4c5d2a.2|8.38978290557861250e+13|83897829055786.1250|83897829055786.12500000000000000|8.389782905578612e+13|83897829055786.12", + "-61egfb039.c1577|-4.26268339e+10|-4.26268339e+10|-42626833915.71044922|-4.262683391571045e+10|-42626833915.71045", + "-ewjauuh.iomc|-1.935581e+10|-1.935581e+10|-19355809688.568115|-1.9355809688568115e+10|-19355809688.568115", + "0.0000000000f748hbm0090k|1.005417109e-14|1.005417109e-14|0.000000000|1.0054171085357666e-14|1.0054171085357666e-14", + "0.0000000000000000007a78aca2738079|5.345488e-21|5.345488e-21|0.000000|5.345487594604492e-21|5.345487594604492e-21", + "0.0000000000001716172502354663724|3.46119403839e-12|3.46119403839e-12|0.00000000000|3.461194038391113e-12|3.461194038391113e-12", + "13cei7fada.e7|3.0298924446105957e+12|3029892444610.5957|3029892444610.5957031250000000|3.0298924446105957e+12|3029892444610.5957", + "-21230102323333032.212001|-3.5161662101746e+11|-351616621017.46|-351616621017.4560546875000|-3.5161662101745605e+11|-351616621017.45605", + "0.0000000000022f2653662h7|2.89498329e-16|2.89498329e-16|0.00000000|2.894983291625977e-16|2.894983291625977e-16", + "5301.1457472521544|3.88916850090026855e+3|3889.16850090026855|3889.16850090026855469|3.8891685009002686e+3|3889.1685009002686", + "-mfk8of5lc2i.6|-2.15841054916381825e+15|-2158410549163818.25|-2158410549163818.25000000000000000|-2.1584105491638182e+15|-2158410549163818.2", + "0.00000000000004dd35pu8iwj|2.4257493019104001562e-21|2.4257493019104001562e-21|0.0000000000000000000|2.4257493019104e-21|2.4257493019104e-21", + "0.000000000003435344344334232635|2.636e-10|2.636e-10|0.000|2.636139392852783e-10|2.636139392852783e-10", + "-0.0000166tpucc7uu|-3.0360156e-8|-3.0360156e-8|-0.0000000|-3.036015629768371e-8|-3.036015629768371e-8", + "0.00000000000659856612897672|2.082353830338e-12|2.082353830338e-12|0.000000000002|2.0823538303375244e-12|2.0823538303375244e-12", + "0.0000da8e9009164cf|9.59172249e-6|0.00000959172249|0.00000959|9.591722488403321e-6|0.000009591722488403321", + "-0.00000016rvuuiuxdvk|-2.28591442108154e-11|-2.28591442108154e-11|-0.00000000002286|-2.285914421081543e-11|-2.285914421081543e-11", + "-0.0000000000010c2c0o7j2m4|-1.7102003097534180e-17|-1.7102003097534180e-17|-0.0000000000000000|-1.710200309753418e-17|-1.710200309753418e-17", + "-111110100000111.101100011011101|-3.200769e+4|-32007.69|-32007.694244|-3.2007694244384766e+4|-32007.694244384766", + "-entauf3apub|-2.2550821304321288e+16|-22550821304321288|-22550821304321288.0000000000000000|-2.255082130432129e+16|-22550821304321290", + "-321a8.1bc88207|-3.271040916e+5|-327104.0916|-327104.091644287|-3.271040916442871e+5|-327104.0916442871", + "6wtpcj74392w|5e+17|5e+17|488999247550964352|4.8899924755096435e+17|488999247550964350", + "0.000000000002ibgcg7l6c41|4.594702981412411e-17|4.594702981412411e-17|0.000000000000000|4.5947029814124105e-17|4.5947029814124105e-17", + "9d9b3.5428758a|3.83337e+5|383337|383337.37850|3.833373785018921e+5|383337.3785018921", + "2gj9.1e2gn601|4.64710593223572e+4|46471.0593223572|46471.05932235717773|4.647105932235718e+4|46471.05932235718", + "-0.0000093j0gjefh4ni|-2.9598772525787353434e-8|-2.9598772525787353434e-8|-0.0000000295987725258|-2.9598772525787353e-8|-2.9598772525787353e-8", + "0.000015351d68c692f7|1.26406431198120119e-6|0.00000126406431198120119|0.00000126406431198|1.2640643119812012e-6|0.0000012640643119812012", + "64aigh8.ga0be8|3.986e+8|3.986e+8|398550748.825|3.9855074882507324e+8|398550748.82507324", + "8489.fh4988a56|4.810588658e+4|48105.88658|48105.886578560|4.8105886578559875e+4|48105.886578559875", + "-a46k.pcb5bcq|-3.639447689056396484e+5|-363944.7689056396484|-363944.768905639648437500|-3.6394476890563965e+5|-363944.76890563965", + "-1moaje1e.g51i|-2.5e+10|-2.5e+10|-24514138698.6|-2.451413869857788e+10|-24514138698.57788", + "-9k.6lgc2d1g45|-2.27301925e+2|-227.301925|-227.30192542|-2.273019254207611e+2|-227.3019254207611", + "-0.6gedc2f4eea18c|-4.1131830e-1|-0.41131830|-0.4113183|-4.11318302154541e-1|-0.411318302154541", + "-2.ul0xutl5q1|-2.9e+0|-2.9|-2.9|-2.9005444049835205e+0|-2.9005444049835205", + "223034014043102443.01432|1.927264034748e+12|1927264034748|1927264034748.077392578125|1.9272640347480774e+12|1927264034748.0774", + "79srle6.89p6a|4.368844e+9|4.368844e+9|4368844032.287598|4.368844032287598e+9|4368844032.287598", + "-0.00000bba8c661432306|-1.57247066e-6|-0.00000157247066|-0.00000157|-1.5724706649780275e-6|-0.0000015724706649780275", + "0.00000000002d63vqevlxv|3.4017e-17|3.4017e-17|0.0000|3.401741981506348e-17|3.401741981506348e-17", + "4aee2k7.fg89cd|3.867591917514801e+8|386759191.7514801|386759191.751480102539063|3.867591917514801e+8|386759191.7514801", + "12kpc8l33710|3.9012194e+16|3.9012194e+16|39012193679809568.0000000|3.901219367980957e+16|39012193679809570", + "-0.00000000000000000000000000000300022202231002110311113102|-2.61e-18|-2.61e-18|-0.00|-2.6110148429870608e-18|-2.6110148429870608e-18", + "0.0000003196b9g9872o|2.9154932e-10|2.9154932e-10|0.0000000|2.9154932498931886e-10|2.9154932498931886e-10", + "0.0000001i42a6epkb3m|1.59867882729e-10|1.59867882729e-10|0.00000000016|1.5986788272857667e-10|1.5986788272857667e-10", + "0.00000000143ncg6l15aa|4.442325830e-13|4.442325830e-13|0.000000000|4.4423258304595945e-13|4.4423258304595945e-13", + "-0.00000000000039b5xxbt9xp|-2.76163578033447e-20|-2.76163578033447e-20|-0.00000000000000|-2.7616357803344726e-20|-2.7616357803344726e-20", + "0.001226r6o4udg4|2.9569315910339356e-5|0.000029569315910339356|0.0000295693159103|2.9569315910339356e-5|0.000029569315910339356", + "5hd56ij.95hf98|3.76522779464721680e+8|376522779.464721680|376522779.46472167968750000|3.765227794647217e+8|376522779.4647217", + "1dr56ta.2dgb|2e+9|2e+9|1832435131|1.832435131072998e+9|1832435131.072998", + "-0.01f3050e4b00di|-5e-3|-0.005|-0|-4.9801180139184e-3|-0.0049801180139184", + "0.0000000000000000013342013012234331101404|4.601421952247619e-13|4.601421952247619e-13|0.000000000000460|4.601421952247619e-13|4.601421952247619e-13", + "-243221404221230203.32342|-2.2428798676e+12|-2.2428798676e+12|-2242879867553.7109375000|-2.242879867553711e+12|-2242879867553.711", + "-0.00000000000021cb5b2b6cd7307|-1.09103798866272e-15|-1.09103798866272e-15|-0.00000000000000|-1.0910379886627197e-15|-1.0910379886627197e-15", + "-0.0000000001c87dee333d7bc|-4.74081e-13|-4.74081e-13|-0.00000|-4.740808010101318e-13|-4.740808010101318e-13", + "5cf.88ebga379|2.472e+3|2472|2472.401|2.472400665283203e+3|2472.400665283203", + "-b4.6275dh29h7|-2.462775409e+2|-246.2775409|-246.277540922|-2.4627754092216492e+2|-246.27754092216492", + "-0.00000000011887129a93a3224|-1.84739947319e-11|-1.84739947319e-11|-0.00000000002|-1.8473994731903078e-11|-1.8473994731903078e-11", + "0.0000000000256kfck6l3035|3.836289644241332675e-15|3.836289644241332675e-15|0.000000000000003836|3.836289644241333e-15|3.836289644241333e-15", + "3.3024032334124424332423|3.6226272583e+0|3.6226272583|3.6226272583|3.6226272583007812e+0|3.6226272583007812", + "-100203001100212322022322102|-4.65762e+15|-4.65762e+15|-4657617807388306.00000|-4.657617807388306e+15|-4657617807388306", + "-1100100011001000100010010101111011101110100011110.0001|-4.415272e+14|-4.415272e+14|-441527247428894.062500|-4.4152724742889406e+14|-441527247428894.06", + "0.000000000000012aik1ek76d3h|1.789422035217285e-19|1.789422035217285e-19|0.000000000000000|1.7894220352172852e-19|1.7894220352172852e-19", + "-2pg7j.75pgtdj|-3.29e+6|-3.29e+6|-3287941.22|-3.2879412174224854e+6|-3287941.2174224854", + "-100000.1101110101100010001011|-3.28647792339e+1|-32.8647792339|-32.86477923393|-3.2864779233932495e+1|-32.864779233932495", + "7efoo90m.7b18|7.89e+10|7.89e+10|78874826431.27|7.887482643127441e+10|78874826431.27441", + "-0.0000191bid3h79b6|-4.512e-8|-4.512e-8|-0.000|-4.512017667293548e-8|-4.512017667293548e-8", + "h5d65.lkk772|6.7270308732986e+6|6727030.8732986|6727030.8732986450195|6.727030873298645e+6|6727030.873298645", + "13hb4bj1h99c.98|2e+14|2e+14|244511485099792|2.4451148509979247e+14|244511485099792.47", + "0.0000000000000000000000000000000000000000000000000000000001000000000011100000001110101110100010010111010001001|3.47e-18|3.47e-18|0.00|3.472414612770081e-18|3.472414612770081e-18", + "-0.0000000005hngj044fdc|-3e-14|-3e-14|-0|-2.7500107884407043e-14|-2.7500107884407043e-14", + "-0.000000000000000000000000000000203333322232132001333301212|-4.87873527687e-19|-4.87873527687e-19|-0.00000000000|-4.87873527687043e-19|-4.87873527687043e-19", + "-2d061n.h4utt8|-6.926989555e+7|-69269895.55|-69269895.553588867|-6.926989555358887e+7|-69269895.55358887", + "0.0000000000000000000133303310333022101331120323|1.80817842483521e-12|1.80817842483521e-12|0.00000000000181|1.808178424835205e-12|1.808178424835205e-12", + "-0.00000000000040001042131120024100321|-3.278344869613648e-9|-3.278344869613648e-9|-0.000000003278345|-3.2783448696136476e-9|-3.2783448696136476e-9", + "0.0000000000000000023120212200000303321232211|4e-11|4e-11|0|4.1416203975677494e-11|4.1416203975677494e-11", + "-32d3ddh8a6ga.a|-2.026e+14|-2.026e+14|-202566329389810.563|-2.0256632938981056e+14|-202566329389810.56", + "-7tn.psaj011t|-7.64983594e+3|-7649.83594|-7649.83594418|-7.64983594417572e+3|-7649.83594417572", + "0.0000ia8fjjeifh9i|4.52879e-6|0.00000452879|0.00000|4.5287942886352546e-6|0.0000045287942886352546", + "-0.00214g5d54701b0d|-4e-4|-0.0004|-0|-3.550581932067871e-4|-0.0003550581932067871", + "170029550790786.75|1.70029550791e+14|1.70029550791e+14|170029550790786.75000000000|1.7002955079078675e+14|170029550790786.75", + "0.000012334a2a845b2a64|4.78021383285523e-6|0.00000478021383285523|0.00000478021383|4.780213832855225e-6|0.000004780213832855225", + "-148.a15a7836b33a|-2.9367280006409e+2|-293.67280006409|-293.6728000640869|-2.936728000640869e+2|-293.6728000640869", + "-a85d.t4e0l5k|-3.0577e+5|-3.0577e+5|-305766.9401|-3.057669401168823e+5|-305766.9401168823", + "-0.0000000000000003h27be89agehf|-3.254237e-20|-3.254237e-20|-0.000000|-3.254236876964569e-20|-3.254236876964569e-20", + "s5ifnto.w4h|4.350637e+10|4.350637e+10|43506371974.945068|4.350637197494507e+10|43506371974.94507", + "-0.00000000003khhp0eeb5q|-3.0413496494293214272e-16|-3.0413496494293214272e-16|-0.0000000000000003041|-3.0413496494293214e-16|-3.0413496494293214e-16", + "34038.11454772949|3.4038114547729e+4|34038.114547729|34038.1145477294922|3.403811454772949e+4|34038.11454772949", + "-442ipo.c8194|-5e+7|-5e+7|-49401402|-4.940140247344971e+7|-49401402.47344971", + "1f0lkb447.69l6|9.24042724e+10|9.24042724e+10|92404272407.29331970|9.240427240729332e+10|92404272407.29332", + "0.00000000225b7135192264b7|4.279e-10|4.279e-10|0.000|4.2794406414031986e-10|4.2794406414031986e-10", + "-33115302125211.5000044|-4.619122445583344e+10|-46191224455.83344|-46191224455.833435058593750|-4.6191224455833435e+10|-46191224455.833435", + "1g0dcm3ia8ma.h|1.6166961e+15|1.6166961e+15|1616696119308471.7500000|1.6166961193084718e+15|1616696119308471.8", + "-0.000000000000000000671315341624332102|-4.786e-17|-4.786e-17|-0.000|-4.785681962966919e-17|-4.785681962966919e-17", + "-3.d58678|-3.834083e+0|-3.834083|-3.834083|-3.834083080291748e+0|-3.834083080291748", + "0.0000001d54bn182hnk|2.50394463539e-10|2.50394463539e-10|0.00000000025|2.5039446353912354e-10|2.5039446353912354e-10", + "-0.00000000000000001667076335663311|-3.1662023067e-18|-3.1662023067e-18|-0.0000000000|-3.1662023067474367e-18|-3.1662023067474367e-18", + "-424443721771240.25|-4.24443721771240250e+14|-424443721771240.250|-424443721771240.25000000000000000|-4.2444372177124025e+14|-424443721771240.25", + "-0.0000000000002m03pif9fcv|-4.8451209068298e-20|-4.8451209068298e-20|-0.0000000000000|-4.845120906829834e-20|-4.845120906829834e-20", + "-0.0000000megd0oiffnh|-7.940673828125000e-12|-7.940673828125000e-12|-0.000000000007941|-7.940673828125e-12|-7.940673828125e-12", + "1edcd1l8403iak|4.707107543945312640e+17|470710754394531264.0|470710754394531264.000000000000000000|4.7071075439453126e+17|470710754394531260", + "1bmqhlr7.84fc|2.4e+10|2.4e+10|24263000488.3|2.426300048828125e+10|24263000488.28125", + "0.000000000g68e832c92d3|3.9e-13|3.9e-13|0.0|3.9291679859161376e-13|3.9291679859161376e-13", + "0.0000004itydk2djyi|7.05e-11|7.05e-11|0.00|7.054415345191956e-11|7.054415345191956e-11", + "pp.842lid5h6|6.753137707710266113e+2|675.3137707710266113|675.313770771026611328|6.753137707710266e+2|675.3137707710266", + "0.000000275bf5hb33ac29|3.9305365e-9|3.9305365e-9|0.0000000|3.93053650856018e-9|3.93053650856018e-9", + "3e.2wvidcegt|1.1908400058746338e+2|119.08400058746338|119.0840005874633789|1.1908400058746338e+2|119.08400058746338", + "-0.00000000000126b89a2c962a1|-8.966958522797e-15|-8.966958522797e-15|-0.000000000000|-8.96695852279663e-15|-8.96695852279663e-15", + "-12657688433.5771736|-4.5479536056518554688e+9|-4547953605.6518554688|-4547953605.6518554687500000000|-4.547953605651855e+9|-4547953605.651855", + "23022012.331110122|4.5702958106994629e+4|45702.958106994629|45702.9581069946289063|4.570295810699463e+4|45702.95810699463", + "0.000000000000073ffe15|4.388099908829e-18|4.388099908829e-18|0.000000000000|4.388099908828736e-18|4.388099908828736e-18", + "0.000002e761e9a0e7b6d|8.2335948944e-8|8.2335948944e-8|0.0000000823|8.233594894409179e-8|8.233594894409179e-8", + "-0.0000000000000000000042262211517020033|-3.8891649246215816560e-20|-3.8891649246215816560e-20|-0.0000000000000000000|-3.8891649246215817e-20|-3.8891649246215817e-20", + "-3h5a.28j32bj15|-3.0910122394562e+4|-30910.122394562|-30910.1223945617676|-3.0910122394561768e+4|-30910.122394561768", + "0.08k0a8l41cjqg|1.1990761756897e-2|0.011990761756897|0.0119907617569|1.1990761756896973e-2|0.011990761756896973", + "-2k5a.jc2kff5c|-4.38857794e+4|-43885.7794|-43885.77938080|-4.388577938079834e+4|-43885.77938079834", + "-e84ddij4feh.f|-9.09284353e+14|-9.09284353e+14|-909284353256225.62500000|-9.092843532562256e+14|-909284353256225.6", + "0.00000000000000000002012443141821533|1.6580260e-19|1.6580260e-19|0.0000000|1.6580259799957278e-19|1.6580259799957278e-19", + "0.000000001101010010100111111000111101011100001010001111010111|3.244870305061e-3|0.003244870305061|0.003244870305|3.2448703050613403e-3|0.0032448703050613403", + "-1g.4qf3pe2od|-4.9145507812500000e+1|-49.145507812500000|-49.1455078125000000|-4.91455078125e+1|-49.1455078125", + "-0.000000000002855364075263a6|-1.13630294799804679e-13|-1.13630294799804679e-13|-0.00000000000011363|-1.1363029479980468e-13|-1.1363029479980468e-13", + "1.dj2aa20aaif|1.69781566e+0|1.69781566|1.69781566|1.6978156566619873e+0|1.6978156566619873", + "chf60d3.bkg52|1.45174860954e+9|1451748609.54|1451748609.54284667969|1.4517486095428467e+9|1451748609.5428467", + "-0.000000000000tg1722hx42|-3.6322713e-19|-3.6322713e-19|-0.0000000|-3.63227128982544e-19|-3.63227128982544e-19", + "-3jk90id46e3gf|-2.9064e+16|-2.9064e+16|-29063534736633300.0000|-2.90635347366333e+16|-29063534736633300", + "-6k626ha0.g5a6|-1.25468105078e+10|-12546810507.8|-12546810507.77435302734|-1.2546810507774353e+10|-12546810507.774353", + "-0.549ppjdjdoc|-1.714763641357e-1|-0.1714763641357|-0.171476364136|-1.714763641357422e-1|-0.1714763641357422", + "0.00319ac5886gbc|2.878513336181641e-4|0.0002878513336181641|0.000287851333618|2.8785133361816407e-4|0.00028785133361816407", + "-0.00000000000001214103102444102110401|-2.4146843e-10|-2.4146843e-10|-0.0000000|-2.414684295654297e-10|-2.414684295654297e-10", + "0.355877256108772875|4e-1|0.4|0|4.0327203273773193e-1|0.40327203273773193", + "0.0000000000000001212010202122012000100022011202102|4.3139534862712022e-8|4.3139534862712022e-8|0.0000000431395349|4.313953486271202e-8|4.313953486271202e-8", + "37r18mgb.okg|1.37953758e+11|1.37953758e+11|137953758239.74609375|1.379537582397461e+11|137953758239.7461", + "-3.rvbtbiaep2|-3.84697914124e+0|-3.84697914124|-3.84697914124|-3.8469791412353516e+0|-3.8469791412353516", + "0.0000053327456221642471|2.07047820091247567e-5|0.0000207047820091247567|0.00002070478200912|2.0704782009124757e-5|0.000020704782009124757", + "-791.jhkfne2hk|-4.6018e+3|-4601.8|-4601.7885|-4.601788520812988e+3|-4601.788520812988", + "-3.920376300811768e-18|-3.9203763008117681e-18|-3.9203763008117681e-18|-0.0000000000000000|-3.920376300811768e-18|-3.920376300811768e-18", + "-1112201111202011001011210111.022101|-1.178368330001831055e+13|-11783683300018.31055|-11783683300018.310546875000000000|-1.178368330001831e+13|-11783683300018.31", + "-0.0000000000000000000010101000001010111001010011011001010000000111100010011|-6.2648296356e-7|-6.2648296356e-7|-0.0000006265|-6.264829635620117e-7|-6.264829635620117e-7", + "-0.0000000000123323122212012131222130212|-4.16e-7|-4.16e-7|-0.00|-4.1616511344909666e-7|-4.1616511344909666e-7", + "gcmgcp3hc8cb|9.15881e+16|9.15881e+16|91588079929351808.00000|9.15880799293518e+16|91588079929351800", + "0.000000000000059fa819e57eab|1.68429136276245137e-18|1.68429136276245137e-18|0.00000000000000000|1.6842913627624514e-18|1.6842913627624514e-18", + "-3cmeji07.476i|-2.1e+10|-2.1e+10|-21460855007.2|-2.146085500717163e+10|-21460855007.17163", + "-2.4649947881698608e-14|-2.4650e-14|-2.4650e-14|-0.0000|-2.4649947881698608e-14|-2.4649947881698608e-14", + "-178.denropdgm|-1.40240e+3|-1402.40|-1402.39507|-1.4023950695991516e+3|-1402.3950695991516", + "ukusbsls0pb|4.69190001e+16|4.69190001e+16|46919000148773192.00000000|4.691900014877319e+16|46919000148773190", + "-8c22211.6b5ae3|-2.1031630039e+8|-210316300.39|-210316300.3921508789|-2.1031630039215088e+8|-210316300.39215088", + "0.asq1me64akeh|3.7918985e-1|0.37918985|0.3791898|3.791898488998413e-1|0.3791898488998413", + "-0.0000000000000581e7d2ed7g367|-3.25279831886292e-17|-3.25279831886292e-17|-0.00000000000000|-3.252798318862915e-17|-3.252798318862915e-17", + "-jlofp.72e|-2e+7|-2e+7|-20636153|-2.063615322113037e+7|-20636153.22113037", + "0.00rfse7ijo6m7|1.01969033479690544e-3|0.00101969033479690544|0.00101969033479691|1.0196903347969054e-3|0.0010196903347969054", + "0.0000000000000009ca92f6854305|5.308e-19|5.308e-19|0.000|5.307877063751221e-19|5.307877063751221e-19", + "-4k2.ptcx8n7k|-5.60273826122e+3|-5602.73826122|-5602.73826122284|-5.602738261222839e+3|-5602.738261222839", + "-0.0000000e809b9bdccae5|-1.3109028e-9|-1.3109028e-9|-0.0000000|-1.3109028339385987e-9|-1.3109028339385987e-9", + "ab49a37a6.d43|4.59796786e+10|4.59796786e+10|45979678630.82885742|4.597967863082886e+10|45979678630.82886", + "-0.00005312622306120100332|-3.24712872505188003e-4|-0.000324712872505188003|-0.00032471287250519|-3.24712872505188e-4|-0.000324712872505188", + "0.0000000000000dh2j51gb52gc|4.25908684730529841e-18|4.25908684730529841e-18|0.00000000000000000|4.2590868473052984e-18|4.2590868473052984e-18", + "0.000000hnng2o4c52a|4.1574811935424805e-10|4.1574811935424805e-10|0.0000000004157481|4.1574811935424805e-10|4.1574811935424805e-10", + "0.0000000000041204012124212030011|1.75575e-8|1.75575e-8|0.00000|1.7557477951049804e-8|1.7557477951049804e-8", + "0.000000000000000000110122330131313100100223102|4.6432006359e-12|4.6432006359e-12|0.0000000000|4.643200635910034e-12|4.643200635910034e-12", + "-0.000004k6kufidb32|-3.5712480545e-9|-3.5712480545e-9|-0.0000000036|-3.5712480545043945e-9|-3.5712480545043945e-9", + "0.0000000000000111210011012200110010022112121111|3.2019984722e-7|3.2019984722e-7|0.0000003202|3.201998472213745e-7|3.201998472213745e-7", + "-2jkodqft4rd2|-2.47141957283020e+17|-2.47141957283020e+17|-247141957283020032.00000000000000|-2.4714195728302003e+17|-247141957283020030", + "0.000000000000000000000000000000000000001121122200021221220201100021022002|4.0e-19|4.0e-19|0.0|3.989684581756592e-19|3.989684581756592e-19", + "-0.0000000000000306b7e6e38289e|-4.199756681919098e-17|-4.199756681919098e-17|-0.000000000000000|-4.199756681919098e-17|-4.199756681919098e-17", + "-1011010111100011010.01111111110100011|-3.725064992905e+5|-372506.4992905|-372506.499290466309|-3.725064992904663e+5|-372506.4992904663", + "57d70e4l8.bbbc|4e+11|4e+11|417358398438|4.173583984375e+11|417358398437.5", + "-0.0013fdffue4l4|-2.5615689530969e-5|-0.000025615689530969|-0.0000256156895|-2.5615689530968667e-5|-0.000025615689530968667", + "0.0000000028c635799ab7467|3e-10|3e-10|0|2.5359439849853516e-10|2.5359439849853516e-10", + "33.83290718b53|3.968909382820129395e+1|39.68909382820129395|39.689093828201293945|3.9689093828201294e+1|39.689093828201294", + "-0.00000000a61d0f461g5be|-3.198281527e-11|-3.198281527e-11|-0.000000000|-3.198281526565552e-11|-3.198281526565552e-11", + "0.000000000000000000013154160226005535362|1.83643579483e-17|1.83643579483e-17|0.00000000000|1.8364357948303224e-17|1.8364357948303224e-17", + "20011330.3003333|3.314876556396484375e+4|33148.76556396484375|33148.765563964843750000|3.3148765563964844e+4|33148.765563964844", + "0.000000dj840l39c3f3|3e-9|3e-9|0|3.0101239681243895e-9|3.0101239681243895e-9", + "0.000000005d5ll8eo3ej|2e-13|2e-13|0|1.5381243545562029e-13|1.5381243545562029e-13", + "29110202155246aa2|1.29909541e+17|1.29909541e+17|129909541457891472.00000000|1.2990954145789147e+17|129909541457891470", + "0.0000000000008rv3thjdkhg|1.08716e-19|1.08716e-19|0.00000|1.0871601104736328e-19|1.0871601104736328e-19", + "85d0.qbk149t|2.208908796310424805e+5|220890.8796310424805|220890.879631042480468750|2.2089087963104248e+5|220890.87963104248", + "-0.0004344a1g63e688|-3.19951176643372e-5|-0.0000319951176643372|-0.00003199511766|-3.199511766433716e-5|-0.00003199511766433716", + "-d1414e7.fdkkj|-1.932036876678467e+9|-1932036876.678467|-1932036876.678466796875000|-1.9320368766784668e+9|-1932036876.6784668", + "-0.000000000006bg59gfb833ce|-1e-14|-1e-14|-0|-1.1505842208862305e-14|-1.1505842208862305e-14", + "1defhajj9fbo|3.67976e+15|3.67976e+15|3679763376712799.00000|3.679763376712799e+15|3679763376712799", + "0.0000000000000000737474314303111054|3.32801818848e-15|3.32801818848e-15|0.00000000000|3.3280181884765624e-15|3.3280181884765624e-15", + "4idashe.5prji|4.0776706e+9|4.0776706e+9|4077670574.1882324|4.0776705741882324e+9|4077670574.1882324", + "0.0000000000000000000000000000122012020011002110112111100012221|2.8e-14|2.8e-14|0.0|2.7836108207702638e-14|2.7836108207702638e-14", + "-3231054321202.203301|-4.6370938420e+10|-46370938420|-46370938420.2957153320|-4.6370938420295715e+10|-46370938420.295715", + "-0.00000000000000000000000000000000000000000010012210001222211110210202110011111|-3.26379776000977e-21|-3.26379776000977e-21|-0.00000000000000|-3.2637977600097655e-21|-3.2637977600097655e-21", + "0.00000000fclv6r35utp|3.314651250839234e-13|3.314651250839234e-13|0.000000000000331|3.3146512508392335e-13|3.3146512508392335e-13", + "-3206601110224.452431|-5e+10|-5e+10|-45755362511|-4.575536251068115e+10|-45755362510.68115", + "0.000000000000000gm5814nkc6a6|1.3969236e-21|1.3969236e-21|0.0000000|1.3969236239790915e-21|1.3969236239790915e-21", + "-21221211020202210212202202220011220|-4.423037767e+16|-4.423037767e+16|-44230377674102784.000000000|-4.423037767410278e+16|-44230377674102780", + "-0.0000000000002ihjq1ap4sp|-3.13615202903747547e-20|-3.13615202903747547e-20|-0.00000000000000000|-3.1361520290374755e-20|-3.1361520290374755e-20", + "1.c3c3b8|1.76470518e+0|1.76470518|1.76470518|1.7647051811218262e+0|1.7647051811218262", + "-110.10101101001101011101|-6.677e+0|-6.677|-6.677|-6.676602363586426e+0|-6.676602363586426", + "-0.00000000015314200443510333002|-3.1830e-8|-3.1830e-8|-0.0000|-3.18300724029541e-8|-3.18300724029541e-8", + "-0.005665644|-1.143577695e-2|-0.01143577695|-0.011435777|-1.1435776948928833e-2|-0.011435776948928833", + "0.00000000003abm0l5bl1gg|1e-16|1e-16|0|1.312462091445923e-16|1.312462091445923e-16", + "3400798141956329500|3.4007981419563295e+18|3.4007981419563295e+18|3400798141956329472.0000000000000000|3.4007981419563295e+18|3400798141956329500", + "-13142515505554.3345542|-2e+10|-2e+10|-20224809647|-2.0224809646606445e+10|-20224809646.606445", + "3c7e1a82g9c86|2.63987481594085680e+16|26398748159408568.0|26398748159408568.00000000000000000|2.639874815940857e+16|26398748159408570", + "0.000127436274324773717|3.340e-4|0.0003340|0.000|3.340122699737549e-4|0.0003340122699737549", + "5if2nkiq6j.bm|4.3e+13|4.3e+13|43369740247726.4|4.336974024772644e+13|43369740247726.44", + "0.00000864104746398591|4.8427870869636537008e-6|0.0000048427870869636537008|0.0000048427870869637|4.842787086963654e-6|0.000004842787086963654", + "7qoh6z.f5stt|4.68075275421143e+8|468075275.421143|468075275.42114257812500|4.680752754211426e+8|468075275.4211426", + "0.000000087633873564baa8|2.006344795227050697e-8|2.006344795227050697e-8|0.000000020063447952|2.0063447952270507e-8|2.0063447952270507e-8", + "-3.544611456034443223|-3.810153008e+0|-3.810153008|-3.810153008|-3.810153007507324e+0|-3.810153007507324", + "-0.00000007l289ik91jcn|-5.14e-11|-5.14e-11|-0.00|-5.140471458435059e-11|-5.140471458435059e-11", + "0.0000023l4bg9k695j|1.92289621e-8|1.92289621e-8|0.00000002|1.9228962063789367e-8|1.9228962063789367e-8", + "-9f96.27f0c|-4.08541560173e+4|-40854.1560173|-40854.15601730347|-4.085415601730347e+4|-40854.15601730347", + "-0.00000000000000c39bbfdb15a0b|-1.06040e-17|-1.06040e-17|-0.00000|-1.0603952407836914e-17|-1.0603952407836914e-17", + "6761345147651116360|1.256e+17|1.256e+17|125588774681091312.000|1.2558877468109131e+17|125588774681091310", + "0.0mdpyquce4s|1.7269403e-2|0.017269403|0.0172694|1.7269402742385864e-2|0.017269402742385864", + "-313102212231323311310.3203|-3.800e+12|-3.800e+12|-3799548149108.887|-3.7995481491088867e+12|-3799548149108.8867", + "0.00000000000c8790f1aa208b8|4.45139229297637930e-14|4.45139229297637930e-14|0.00000000000004451|4.451392292976379e-14|4.451392292976379e-14", + "0.0000000000003la5sa0a4fta|2.3e-19|2.3e-19|0.0|2.327841520309448e-19|2.327841520309448e-19", + "-5ja.6k00gfbh|-3.8842604e+3|-3884.2604|-3884.2603564|-3.884260356426239e+3|-3884.260356426239", + "-0.000000000pc2t0luuezi|-6.930e-15|-6.930e-15|-0.000|-6.929540634155274e-15|-6.929540634155274e-15", + "2rafm.9m5k|2.9926303e+6|2992630.3|2992630.3029060|2.9926303029060364e+6|2992630.3029060364", + "-0.000000000000000b9njo62ilq1e|-1.4249e-22|-1.4249e-22|-0.0000|-1.4248967170715331e-22|-1.4248967170715331e-22", + "0.00000000000001lb7b6cp3acg|2.8280702233315e-20|2.8280702233315e-20|0.0000000000000|2.8280702233314516e-20|2.8280702233314516e-20", + "0.00006c0aaa2d0102e|3.52910399437e-6|0.00000352910399437|0.00000352910|3.5291039943695072e-6|0.0000035291039943695072", + "28mhoiamidd.n|3.30508589744568e+14|330508589744568|330508589744567.87500000000000|3.305085897445679e+14|330508589744567.9", + "-0.08gnak2d9alej|-1e-2|-0.01|-0|-1.2795889377593996e-2|-0.012795889377593996", + "-5r1j3.1lac5po|-3.667303062975e+6|-3667303.062975|-3667303.062975406647|-3.6673030629754066e+6|-3667303.0629754066", + "16eae.7246ch006|1.767333746e+5|176733.3746|176733.374595642|1.767333745956421e+5|176733.3745956421", + "-3l52ss7c7sd.7|-1.569324731826782e+15|-1569324731826782|-1569324731826782.250000000000000|-1.5693247318267822e+15|-1569324731826782.2", + "0.0000004mc5oo5b6da|2.76705145835877e-10|2.76705145835877e-10|0.00000000027671|2.767051458358765e-10|2.767051458358765e-10", + "0.00032481420040130616|3.2481e-4|0.00032481|0.0003|3.2481420040130616e-4|0.00032481420040130616", + "0.0000000042thw2cl3fj|4.01567280293e-14|4.01567280293e-14|0.00000000000|4.01567280292511e-14|4.01567280292511e-14", + "0.00000000000000159d0mb0bij14|2.4262332916259765e-21|2.4262332916259765e-21|0.0000000000000000|2.4262332916259765e-21|2.4262332916259765e-21", + "-2332102201211303221303.032|-1.30766e+13|-1.30766e+13|-13076591491699.21875|-1.3076591491699219e+13|-13076591491699.219", + "43215327.a929129|4.453710317611694e+8|445371031.7611694|445371031.761169433593750|4.4537103176116943e+8|445371031.76116943", + "-0.0000000000000000000000000000000000000001111011101110011110000101101100111111111100111000101|-1.758254e-12|-1.758254e-12|-0.000000|-1.758253574371338e-12|-1.758253574371338e-12", + "-0.0005a74479344312418|-4.07777e-4|-0.000407777|-0.00041|-4.0777742862701415e-4|-0.00040777742862701415", + "a0ia1ae2.lqg|2.191455364227295e+11|219145536422.7295|219145536422.729492187500000|2.191455364227295e+11|219145536422.7295", + "-0.e2uy3a3jtt9|-3.910954e-1|-0.3910954|-0.391095|-3.910953998565674e-1|-0.3910953998565674", + "-0.00000000000001c177i9ahbb27|-3.978395462036e-20|-3.978395462036e-20|-0.000000000000|-3.978395462036133e-20|-3.978395462036133e-20", + "0.00002f2na1gdk86i|1.030076742172241142e-7|1.030076742172241142e-7|0.000000103007674217|1.0300767421722411e-7|1.0300767421722411e-7", + "29ffgcoin.5g6|4.94759917259216e+11|494759917259.216|494759917259.21630859375000|4.947599172592163e+11|494759917259.2163", + "0.0000ed00f54gb9517|3.57952118e-6|0.00000357952118|0.00000358|3.579521179199219e-6|0.000003579521179199219", + "0.000000009j8b360bda1k|1.2494468688965e-11|1.2494468688965e-11|0.0000000000125|1.2494468688964845e-11|1.2494468688964845e-11", + "0.00001845411495998992|6.82201385498046916e-6|0.00000682201385498046916|0.00000682201385498|6.822013854980469e-6|0.000006822013854980469", + "-8h2seda00f.2|-1.246128082275391e+14|-124612808227539.1|-124612808227539.062500000000000|-1.2461280822753906e+14|-124612808227539.06", + "0.000000000000000000000000010110110100000001100010110001101001111010110101011|2e-8|2e-8|0|2.1246147155761717e-8|2.1246147155761717e-8", + "-0.0000000017b1bb1587326277|-3.2188891619444e-10|-3.2188891619444e-10|-0.0000000003219|-3.2188891619443897e-10|-3.2188891619443897e-10", + "-0.00000000000pdigmaihem8|-1.699396371841e-16|-1.699396371841e-16|-0.000000000000|-1.6993963718414307e-16|-1.6993963718414307e-16", + "-0.000000000026631cd8b7d853|-2.806544303894043038e-13|-2.806544303894043038e-13|-0.000000000000280654|-2.806544303894043e-13|-2.806544303894043e-13", + "-5ef.954dcb38f|-2.295463e+3|-2295.463|-2295.463085|-2.2954630851745605e+3|-2295.4630851745605", + "0.000510v23k41gd|3e-6|0.000003|0|2.9938054084777835e-6|0.0000029938054084777835", + "0.000021kaf857lnbga|2.6e-7|2.6e-7|0.0|2.608635686337948e-7|2.608635686337948e-7", + "0.00000235932083a208a46|1.3102e-6|0.0000013102|0.0000|1.3101604580879213e-6|0.0000013101604580879213", + "-1426992540.1775446|-3.26657146215e+9|-3266571462.15|-3266571462.15438842773|-3.2665714621543884e+9|-3266571462.1543884", + "0.00002du4r7lm6ax|4.561965e-8|4.561965e-8|0.000000|4.5619654655456544e-8|4.5619654655456544e-8", + "-175203.734687203033|-1.0878682136535645e+5|-108786.82136535645|-108786.8213653564453125|-1.0878682136535645e+5|-108786.82136535645", + "-0.000000000000000000003440541263532051336|-6.54e-18|-6.54e-18|-0.00|-6.5444827079772945e-18|-6.5444827079772945e-18", + "-43111754026464.042|-1.10503346e+13|-1.10503346e+13|-11050334572792.05273438|-1.1050334572792053e+13|-11050334572792.053", + "0.00000000000043022222412302014000034|4e-9|4e-9|0|3.78470778465271e-9|3.78470778465271e-9", + "0.000009680p8ilwq5|4.21395119745284359e-9|4.21395119745284359e-9|0.00000000421395120|4.213951197452844e-9|4.213951197452844e-9", + "-16300425014610.112645|-1.85894012451172e+11|-185894012451.172|-185894012451.17187500000000|-1.8589401245117188e+11|-185894012451.17188", + "-0.000000423461b1846a782|-6.65136575698852e-8|-6.65136575698852e-8|-0.00000006651366|-6.651365756988524e-8|-6.651365756988524e-8", + "-3.6464178562164303e-17|-3.6e-17|-3.6e-17|-0.0|-3.6464178562164303e-17|-3.6464178562164303e-17", + "-9fmj79535.3ih|-3.61354500e+12|-3.61354500e+12|-3613545000553.13085938|-3.613545000553131e+12|-3613545000553.131", + "-0.00000000000m91917roslj|-1.3354540e-17|-1.3354540e-17|-0.0000000|-1.335453987121582e-17|-1.335453987121582e-17", + "-43104012.043220011221102|-3.63007187843322754e+5|-363007.187843322754|-363007.18784332275390625|-3.6300718784332275e+5|-363007.18784332275", + "-0.00000000jmrqnrl7og6|-1.8737495e-12|-1.8737495e-12|-0.0000000|-1.873749494552612e-12|-1.873749494552612e-12", + "-bkvuw9.0i96a|-5e+8|-5e+8|-455355525|-4.5535552501678467e+8|-455355525.01678467", + "0.000000006bcf3h4202i99|8.2498103e-12|8.2498103e-12|0.0000000|8.249810338020325e-12|8.249810338020325e-12", + "0.01khcf5021fg99|4e-3|0.004|0|4.01943564414978e-3|0.00401943564414978", + "-1yev407ai.i6|-4.5e+12|-4.5e+12|-4466781392693.5|-4.46678139269352e+12|-4466781392693.52", + "-0.000000000000000000011103332125155341511|-3.27e-16|-3.27e-16|-0.00|-3.2745227217674256e-16|-3.2745227217674256e-16", + "-29574ek1cmn9a|-2e+17|-2e+17|-224635809659957888|-2.246358096599579e+17|-224635809659957900", + "-9jh8c.l9gjhf|-3.25863689184188843e+6|-3258636.89184188843|-3258636.89184188842773438|-3.2586368918418884e+6|-3258636.8918418884", + "0.0000000000000187dj8c1i8h|2.6656031608581541861e-21|2.6656031608581541861e-21|0.0000000000000000000|2.665603160858154e-21|2.665603160858154e-21", + "-20ekb2a.hmbhn|-7.8268289566040039063e+8|-782682895.66040039063|-782682895.6604003906250000000|-7.826828956604004e+8|-782682895.6604004", + "0.0000000000000002b497118b483397|1.59559e-17|1.59559e-17|0.00000|1.595590114593506e-17|1.595590114593506e-17", + "0.0000620042231631663626|3.7410128116607664238e-4|0.00037410128116607664238|0.0003741012811660766|3.7410128116607664e-4|0.00037410128116607664" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-number-format.js b/packages/codemode-rust/conformance/cases/std-number-format.js new file mode 100644 index 0000000000000..2a7639f402ed5 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-number-format.js @@ -0,0 +1,5 @@ +const out = [] +for (const f of [() => (1).toExponential(101), () => (1).toPrecision(0), () => (1).toFixed(101), () => (1).toString(1), () => (1).toString(37), () => Infinity.toExponential(1000), () => NaN.toPrecision(0), () => (1).toFixed(Infinity)]) { try { out.push(f()) } catch (e) { out.push([e.name, e.message]) } } +out.push([0.1, 0.5, 1/3, 2/3, 123.456, -0.1, 1e-7, 3.14159, 1e21, 2**60, 2**60+0.5, 1.7976931348623157e308, 5e-324, 0.000001, 255, -255.5, 0.9999999999999999].map(x => [2, 3, 7, 16, 36].map((r) => x.toString(r)).join(" "))) +out.push((1.25).toExponential(1), (1.35).toExponential(1), (9.995).toPrecision(3), (99.99).toPrecision(2), (0.000001).toPrecision(1), (1e-7).toPrecision(1), (123456).toPrecision(2), (-0).toPrecision(2), (0).toExponential(), (-0).toExponential(1), (25).toPrecision(1), (1.0e-10).toExponential(3), (123.456).toExponential(), (123.456).toExponential(0), (5e-324).toExponential(), (-1.5e-7).toExponential(1), (1e21).toPrecision(3), (0.00001234).toPrecision(2), (1.45).toFixed(1), (1e-7).toFixed(10), (999.9).toPrecision(3), (1).toPrecision(100).length, (1/3).toExponential(100).length, (255).toString({ valueOf() { return 16 } }), (1.5).toFixed("2"), (12345.6789).toLocaleString(), (-1e21).toFixed(2), (0.5).toFixed(0), (2.5).toFixed(0), (-0.5).toFixed(0)) +return out diff --git a/packages/codemode-rust/conformance/cases/std-number-format.json b/packages/codemode-rust/conformance/cases/std-number-format.json new file mode 100644 index 0000000000000..eee1e44f241fd --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-number-format.json @@ -0,0 +1,83 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "RangeError", + "toExponential() argument must be between 0 and 100" + ], + [ + "RangeError", + "toPrecision() argument must be between 1 and 100" + ], + [ + "RangeError", + "toFixed() argument must be between 0 and 100" + ], + [ + "RangeError", + "toString() radix argument must be between 2 and 36" + ], + [ + "RangeError", + "toString() radix argument must be between 2 and 36" + ], + "Infinity", + "NaN", + [ + "RangeError", + "toFixed() argument must be between 0 and 100" + ], + [ + "0.0001100110011001100110011001100110011001100110011001101 0.0022002200220022002200220022002201 0.04620462046204620463 0.1999999999999a 0.3lllllllllm", + "0.1 0.11111111111111111111111111111111112 0.3333333333333333334 0.8 0.i", + "0.010101010101010101010101010101010101010101010101010101 0.1 0.2222222222222222222 0.55555555555554 0.c", + "0.10101010101010101010101010101010101010101010101010101 0.2 0.4444444444444444444 0.aaaaaaaaaaaaa8 0.o", + "1111011.0111010010111100011010100111111011111001110111 11120.11002210211000212022212010001 234.312256641535441 7b.74bc6a7ef9dc 3f.gez4w97ry", + "-0.0001100110011001100110011001100110011001100110011001101 -0.0022002200220022002200220022002201 -0.04620462046204620463 -0.1999999999999a -0.3lllllllllm", + "0.0000000000000000000000011010110101111111001010011010101111001010111101001 0.000000000000001102202000221202012122200220020101 0.000000004015062102535220433 0.000001ad7f29abcaf48 0.000061oezo085tj", + "11.00100100001111110011111000000011011100001100110111 10.0102110122202012020010001000221 3.066364631133534554 3.243f3e0370cdc 3.53i0tuycp", + "1101100011010111001001101011011100010111011110101000000000000000000000 100010202110111202020110202012022202010121001 5135235413265003022550266 3635c9adc5dea00000 5v1j4f4ds79m9s", + "1000000000000000000000000000000000000000000000000000000000000 21200101122222021102111220121112212101 2031000661631341065361 1000000000000000 8rc4kbdvss1s", + "1000000000000000000000000000000000000000000000000000000000000 21200101122222021102111220121112212101 2031000661631341065361 1000000000000000 8rc4kbdvss1s", + "1111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 10020200012020012100112000100111021022122212222001221000102201022211210002220120012001210100102121221010102121102012120122212101021201002210000120200221010111201212212100102000000110211220011000211001111011101122010121200202000122010201101100202212110210010010212102001122222220120021022210121002121000012121020221100222012001202111200021110200022201110212120110022120102101120220021102200001222201010202111212222012100102020202121100222110021110221122012020010020002101021002200211100222220102010110112202221110012220210110201122101201000222101001001022220122101120121201002101221011001102020220211200122211111202210111221021101122010102210200202 42326224003605451310554404242624410603406055251244335360504122451145412556002204414340402213252061316665443530166425161224466044502022663322110623024535014021166542443601621160653643446062402342601354252363305333444143005032331550055004054110163453105261322444016604255115302134426043121536061643306155221452533556632312505522062644216061216064405622122411612120255 fffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1a1e4vngaiku6scyil2a1vcbg6qvbzjfseu5nty6qyr6ft0fmxyr3nmwlm21axdq6ed914edar7zmc0m6nphl75ran22ulsb7gk2x0w8eh76j4mr2dvcv9tlpr9qo3ap6my00o4k4hhs2393945uo1rspbz2qhhhvhwp0k4z956e50710y4rp9wvby29lpsvd8xlurk", + "0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003", + "0.000000000000000000010000110001101111011110100000101101011110110110001101 0.0000000000001121001021001121110021122222221002 0.00000005523220033662416626 0.000010c6f7a0b5ed8d 0.0001ogs5wo29m7", + "11111111 100110 513 ff 73", + "-11111111.1 -100110.11111111111111111111111111111 -513.33333333333333333 -ff.8 -73.i", + "0.11111111111111111111111111111111111111111111111111111 0.2222222222222222222222222222222221 0.6666666666666666666 0.fffffffffffff8 0.zzzzzzzzzzl" + ], + "1.3e+0", + "1.4e+0", + "9.99", + "1.0e+2", + "0.000001", + "1e-7", + "1.2e+5", + "0.0", + "0e+0", + "0.0e+0", + "3e+1", + "1.000e-10", + "1.23456e+2", + "1e+2", + "5e-324", + "-1.5e-7", + "1.00e+21", + "0.000012", + "1.4", + "0.0000001000", + "1.00e+3", + 101, + 105, + "ff", + "1.50", + "12,345.679", + "-1e+21", + "1", + "3", + "-1" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-object-prototype-receivers.js b/packages/codemode-rust/conformance/cases/std-object-prototype-receivers.js new file mode 100644 index 0000000000000..db992dcc36865 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-object-prototype-receivers.js @@ -0,0 +1,23 @@ +const out = [] +const P = Object.prototype +const probes = [undefined, null, "abc", 5, true, [1], { a: 1 }, () => 1, new Map(), tools] +for (const name of ["hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toString", "toLocaleString", "valueOf"]) { + for (const v of probes) { + try { const r = P[name].call(v, name === "isPrototypeOf" ? {} : "a"); out.push([name, typeof r === "object" ? typeof r : r]) } catch (e) { out.push([name, e.name, e.message]) } + } +} +out.push([1].hasOwnProperty(0), ({ a: 1 }).propertyIsEnumerable("a"), Object.prototype.isPrototypeOf.call(Object.prototype, [])) +try { out.push(P.isPrototypeOf.call(undefined, 1)) } catch (e) { out.push(e.name, e.message) } +try { out.push(P.isPrototypeOf.call(null, {})) } catch (e) { out.push(e.name, e.message) } + +for (const v of [tools, tools.echo, tools.a.b]) { + out.push(P.toString.call(v)) + try { out.push(P.toLocaleString.call(v)) } catch (e) { out.push([e.name, e.message]) } + try { out.push(typeof P.valueOf.call(v)) } catch (e) { out.push([e.name, e.message]) } +} +try { out.push("abc".hasOwnProperty("length")) } catch (e) { out.push([e.name, e.message]) } +try { out.push((1).propertyIsEnumerable("x")) } catch (e) { out.push([e.name, e.message]) } +const { hasOwnProperty } = Object.prototype +try { hasOwnProperty("x") } catch (e) { out.push([e.name, e.message]) } +out.push(Object.create(null) instanceof Object, Object.prototype.hasOwnProperty.call(Object.create(null), "x")) +return out diff --git a/packages/codemode-rust/conformance/cases/std-object-prototype-receivers.json b/packages/codemode-rust/conformance/cases/std-object-prototype-receivers.json new file mode 100644 index 0000000000000..e137257eea91f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-object-prototype-receivers.json @@ -0,0 +1,310 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "hasOwnProperty", + "TypeError", + "Object.prototype.hasOwnProperty called on incompatible receiver undefined." + ], + [ + "hasOwnProperty", + "TypeError", + "Object.prototype.hasOwnProperty called on incompatible receiver null." + ], + [ + "hasOwnProperty", + "TypeError", + "Object.prototype.hasOwnProperty called on incompatible receiver a string." + ], + [ + "hasOwnProperty", + "TypeError", + "Object.prototype.hasOwnProperty called on incompatible receiver a number." + ], + [ + "hasOwnProperty", + "TypeError", + "Object.prototype.hasOwnProperty called on incompatible receiver a boolean." + ], + [ + "hasOwnProperty", + false + ], + [ + "hasOwnProperty", + true + ], + [ + "hasOwnProperty", + false + ], + [ + "hasOwnProperty", + false + ], + [ + "hasOwnProperty", + "TypeError", + "Object.prototype.hasOwnProperty called on incompatible receiver a namespace reference." + ], + [ + "isPrototypeOf", + "TypeError", + "Object.prototype.isPrototypeOf called on incompatible receiver undefined." + ], + [ + "isPrototypeOf", + "TypeError", + "Object.prototype.isPrototypeOf called on incompatible receiver null." + ], + [ + "isPrototypeOf", + "TypeError", + "Object.prototype.isPrototypeOf called on incompatible receiver a string." + ], + [ + "isPrototypeOf", + "TypeError", + "Object.prototype.isPrototypeOf called on incompatible receiver a number." + ], + [ + "isPrototypeOf", + "TypeError", + "Object.prototype.isPrototypeOf called on incompatible receiver a boolean." + ], + [ + "isPrototypeOf", + false + ], + [ + "isPrototypeOf", + false + ], + [ + "isPrototypeOf", + false + ], + [ + "isPrototypeOf", + false + ], + [ + "isPrototypeOf", + "TypeError", + "Object.prototype.isPrototypeOf called on incompatible receiver a namespace reference." + ], + [ + "propertyIsEnumerable", + "TypeError", + "Object.prototype.propertyIsEnumerable called on incompatible receiver undefined." + ], + [ + "propertyIsEnumerable", + "TypeError", + "Object.prototype.propertyIsEnumerable called on incompatible receiver null." + ], + [ + "propertyIsEnumerable", + "TypeError", + "Object.prototype.propertyIsEnumerable called on incompatible receiver a string." + ], + [ + "propertyIsEnumerable", + "TypeError", + "Object.prototype.propertyIsEnumerable called on incompatible receiver a number." + ], + [ + "propertyIsEnumerable", + "TypeError", + "Object.prototype.propertyIsEnumerable called on incompatible receiver a boolean." + ], + [ + "propertyIsEnumerable", + false + ], + [ + "propertyIsEnumerable", + true + ], + [ + "propertyIsEnumerable", + false + ], + [ + "propertyIsEnumerable", + false + ], + [ + "propertyIsEnumerable", + "TypeError", + "Object.prototype.propertyIsEnumerable called on incompatible receiver a namespace reference." + ], + [ + "toString", + "[object Undefined]" + ], + [ + "toString", + "[object Null]" + ], + [ + "toString", + "[object String]" + ], + [ + "toString", + "[object Number]" + ], + [ + "toString", + "[object Boolean]" + ], + [ + "toString", + "[object Array]" + ], + [ + "toString", + "[object Object]" + ], + [ + "toString", + "[object Function]" + ], + [ + "toString", + "[object Map]" + ], + [ + "toString", + "[object Object]" + ], + [ + "toLocaleString", + "TypeError", + "Object.prototype.toLocaleString called on null or undefined." + ], + [ + "toLocaleString", + "TypeError", + "Object.prototype.toLocaleString called on null or undefined." + ], + [ + "toLocaleString", + "abc" + ], + [ + "toLocaleString", + "5" + ], + [ + "toLocaleString", + "true" + ], + [ + "toLocaleString", + "1" + ], + [ + "toLocaleString", + "[object Object]" + ], + [ + "toLocaleString", + "[object Function]" + ], + [ + "toLocaleString", + "[object Map]" + ], + [ + "toLocaleString", + "TypeError", + "Object.prototype.toLocaleString called on null or undefined." + ], + [ + "valueOf", + "TypeError", + "Object.prototype.valueOf called on null or undefined." + ], + [ + "valueOf", + "TypeError", + "Object.prototype.valueOf called on null or undefined." + ], + [ + "valueOf", + "abc" + ], + [ + "valueOf", + 5 + ], + [ + "valueOf", + true + ], + [ + "valueOf", + "object" + ], + [ + "valueOf", + "object" + ], + [ + "valueOf", + null + ], + [ + "valueOf", + "object" + ], + [ + "valueOf", + "object" + ], + true, + true, + true, + "TypeError", + "Object.prototype.isPrototypeOf called on incompatible receiver undefined.", + "TypeError", + "Object.prototype.isPrototypeOf called on incompatible receiver null.", + "[object Object]", + [ + "TypeError", + "Object.prototype.toLocaleString called on null or undefined." + ], + "object", + "[object Object]", + [ + "TypeError", + "Object.prototype.toLocaleString called on null or undefined." + ], + "function", + "[object Object]", + [ + "TypeError", + "Object.prototype.toLocaleString called on null or undefined." + ], + "function", + [ + "TypeError", + "Object.prototype.hasOwnProperty called on incompatible receiver a string." + ], + [ + "TypeError", + "Object.prototype.propertyIsEnumerable called on incompatible receiver a number." + ], + [ + "TypeError", + "Object.prototype.hasOwnProperty called on incompatible receiver undefined." + ], + false, + false + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-pow-inexact.js b/packages/codemode-rust/conformance/cases/std-pow-inexact.js new file mode 100644 index 0000000000000..6816606094095 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-pow-inexact.js @@ -0,0 +1,6 @@ +// @platform "linux" +// Fractional and negative exponents go to the system libm's pow, and libms round differently, so this case is recorded and checked on Linux only. +const o = [] +for (let k = -330; k <= 310; k += 3) o.push(String(10 ** k), String(Math.pow(1.1, k)), String(2.5 ** (k / 7)), String((-3.3) ** (k % 40))) +o.push(String((-8) ** (1 / 3)), String(0 ** -0.5), String((-0) ** 0.5), String(Infinity ** -0.5), String(4 ** 0.5), String(2 ** 1000), String(2 ** 1001), String(1.0000001 ** 1000), String(NaN ** 0), String(1 ** Infinity), String((-1) ** -Infinity), String(Math.pow(-0, -3)), String(Math.pow(-0, 3)), String(Math.pow(5e-324, 0.5)), String(Math.pow(5e-324, 2))) +return o diff --git a/packages/codemode-rust/conformance/cases/std-pow-inexact.json b/packages/codemode-rust/conformance/cases/std-pow-inexact.json new file mode 100644 index 0000000000000..9d18c5c17b8eb --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-pow-inexact.json @@ -0,0 +1,879 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "0", + "2.189847630928368e-14", + "1.73768487003966e-19", + "0.000006529209460440176", + "0", + "2.9146871967656585e-14", + "2.573455943742625e-19", + "-0.00023464020037983858", + "0", + "3.879448658895092e-14", + "3.811206282893568e-19", + "0.008432264881050257", + "1e-321", + "5.1635461649893696e-14", + "5.644275110318384e-19", + "-0.30303030303030304", + "1e-318", + "6.872679945600852e-14", + "8.358991656775947e-19", + "1.9791116015451296e-20", + "1e-315", + "9.147537007594737e-14", + "1.2379400392853803e-18", + "-7.112333362472731e-19", + "1e-312", + "1.2175371757108596e-13", + "1.8333497672815844e-18", + "2.555959240471825e-17", + "1e-309", + "1.6205419808711548e-13", + "2.7151326094369684e-18", + "-9.185350722483597e-16", + "1e-306", + "2.1569413765395074e-13", + "4.0210249120978515e-18", + "3.3009394891389294e-14", + "1e-303", + "2.870888972174085e-13", + "5.9550098170212e-18", + "-1.1862586242118569e-12", + "1e-300", + "3.821153221963708e-13", + "8.819179859872476e-18", + "4.26305761783015e-11", + "1e-297", + "5.085954938433696e-13", + "1.3060924463712418e-17", + "-1.5320150161196205e-9", + "1e-294", + "6.769406023055252e-13", + "1.9342813113834068e-17", + "5.505602363429079e-8", + "1e-291", + "9.010079416686543e-13", + "2.8646090113774754e-17", + "-0.000001978548321345508", + "1e-288", + "1.199241570360979e-12", + "4.2423947022452634e-17", + "0.00007110309102419351", + "1e-285", + "1.5961905301504635e-12", + "6.282851425152893e-17", + "-0.002555231782136442", + "1e-282", + "2.1245295956302676e-12", + "9.304702839095625e-17", + "0.09182736455463729", + "1e-279", + "2.827748891783887e-12", + "1.3779968531050743e-16", + "-5.99730788347009e-21", + "1e-276", + "3.763733774964354e-12", + "2.0407694474550653e-16", + "2.1552525340826461e-19", + "1e-273", + "5.009529654477557e-12", + "3.0223145490365727e-16", + "-7.745331031732804e-18", + "1e-270", + "6.6676839701096295e-12", + "4.475951580277306e-16", + "2.7834396128738173e-16", + "1e-267", + "8.874687364215918e-12", + "6.628741722258224e-16", + "-1.0002846936784635e-14", + "1e-264", + "1.1812208881771391e-11", + "9.816955351801395e-16", + "3.594723103672294e-13", + "1e-261", + "1.5722050021637726e-11", + "1.4538598186086913e-15", + "-1.2918356417667121e-11", + "1e-258", + "2.092604857879982e-11", + "2.153120082976679e-15", + "4.6424697458170323e-10", + "1e-255", + "2.7852570658382563e-11", + "3.1887022616485393e-15", + "-1.6683643525542665e-8", + "1e-252", + "3.70717715463072e-11", + "4.722366482869645e-15", + "5.995600973774267e-7", + "1e-249", + "4.93425279281349e-11", + "6.99367434418329e-15", + "-0.00002154639121945258", + "1e-246", + "6.567490467234757e-11", + "1.0357408941028475e-14", + "0.0007743126612534672", + "1e-243", + "8.741329811889463e-11", + "1.533899273718968e-14", + "-0.02782647410746585", + "1e-240", + "1.1634709979624878e-10", + "2.2716559665760803e-14", + "1", + "1e-237", + "1.5485798982880715e-10", + "3.3642501296510606e-14", + "-6.531068285098928e-20", + "1e-234", + "2.0611598446214239e-10", + "4.982347283825843e-14", + "2.3470700096160014e-18", + "1e-231", + "2.7434037531911157e-10", + "7.378697629483821e-14", + "-8.434665493557022e-17", + "1e-228", + "3.651470395497376e-10", + "1.092761616278639e-13", + "3.0311657384195865e-15", + "1e-225", + "4.860107096407009e-10", + "1.618345147035699e-13", + "-1.0893100314158467e-13", + "1e-222", + "6.46880254531773e-10", + "2.3967176151858876e-13", + "3.914653459899128e-12", + "1e-219", + "8.609976187817901e-10", + "3.5494624477751253e-13", + "-1.4068090138839492e-10", + "1e-216", + "1.145987830598563e-9", + "5.256640827579764e-13", + "5.0556495531947476e-9", + "1e-213", + "1.5253098025266876e-9", + "7.784917630977905e-13", + "-1.816848779931596e-7", + "1e-210", + "2.0301873471630215e-9", + "1.152921504606847e-12", + "0.000006529209460440176", + "1e-207", + "2.7021793590739824e-9", + "1.707440025435368e-12", + "-0.00023464020037983858", + "1e-204", + "3.5966007269274714e-9", + "2.528664292243288e-12", + "0.008432264881050257", + "1e-201", + "4.787075567540466e-9", + "3.74487127372795e-12", + "-0.30303030303030304", + "1e-198", + "6.371597580396361e-9", + "5.546035074648633e-12", + "1.9791116015451296e-20", + "1e-195", + "8.480596379507559e-9", + "8.213501293093383e-12", + "-7.112333362472731e-19", + "1e-192", + "1.1287673781124564e-8", + "1.2163933798402977e-11", + "2.555959240471825e-17", + "1e-189", + "1.5023893802676798e-8", + "1.8014398509481985e-11", + "-9.185350722483597e-16", + "1e-186", + "1.9996802651362824e-8", + "2.6678750397427624e-11", + "3.3009394891389294e-14", + "1e-183", + "2.6615744328963925e-8", + "3.951037956630138e-11", + "-1.1862586242118569e-12", + "1e-180", + "3.5425555701850993e-8", + "5.85136136519992e-11", + "4.26305761783015e-11", + "1e-177", + "4.715141463916368e-8", + "8.66567980413849e-11", + "-1.5320150161196205e-9", + "1e-174", + "6.275853288472688e-8", + "1.283359577045841e-10", + "5.505602363429079e-8", + "1e-171", + "8.353160726957149e-8", + "1.900614656000465e-10", + "-0.000001978548321345508", + "1e-168", + "1.1118056927579968e-7", + "2.81474976710656e-10", + "0.00007110309102419351", + "1e-165", + "1.479813377060894e-7", + "4.168554749598066e-10", + "-0.002555231782136442", + "1e-162", + "1.9696316048680507e-7", + "6.173496807234591e-10", + "0.09182736455463729", + "1e-159", + "2.621579666079376e-7", + "9.142752133124876e-10", + "-5.99730788347009e-21", + "1e-156", + "3.4893225355516504e-7", + "1.354012469396639e-9", + "2.1552525340826461e-19", + "1e-153", + "4.6442882948192477e-7", + "2.0052493391341266e-9", + "-7.745331031732804e-18", + "1e-150", + "6.18154772040442e-7", + "2.9697104000007265e-9", + "2.7834396128738173e-16", + "1e-147", + "8.227640015858285e-7", + "4.398046511104e-9", + "-1.0002846936784635e-14", + "1e-144", + "0.000001095098886110738", + "6.513366796246979e-9", + "3.594723103672294e-13", + "1e-141", + "0.0000014575766174133925", + "9.646088761304047e-9", + "-1.2918356417667121e-11", + "1e-138", + "0.000001940034477777226", + "1.428555020800762e-8", + "4.6424697458170323e-10", + "1e-135", + "0.0000025821858899214884", + "2.1156444834322484e-8", + "-1.6683643525542665e-8", + "1e-132", + "0.000003436889419485502", + "3.133202092397073e-8", + "5.995600973774267e-7", + "1e-129", + "0.0000045744998173352045", + "4.640172500001135e-8", + "-0.00002154639121945258", + "1e-126", + "0.000006088659256873158", + "6.8719476736e-8", + "0.0007743126612534672", + "1e-123", + "0.000008104005470898176", + "1.0177135619135905e-7", + "-0.02782647410746585", + "1e-120", + "0.000010786431281765475", + "1.5072013689537574e-7", + "1", + "1e-117", + "0.00001435674003602985", + "2.2321172200011906e-7", + "-6.531068285098928e-20", + "1e-114", + "0.000019108820987955737", + "3.3056945053628884e-7", + "2.3470700096160014e-18", + "1e-111", + "0.00002543384073496909", + "4.895628269370427e-7", + "-8.434665493557022e-17", + "1e-108", + "0.000033852442018243866", + "7.250269531251762e-7", + "3.0311657384195865e-15", + "1e-105", + "0.0000450576003262826", + "0.000001073741824", + "-1.0893100314158467e-13", + "1e-102", + "0.000059971666034282155", + "0.0000015901774404899875", + "3.914653459899128e-12", + "1e-99", + "0.00007982228749162957", + "0.0000023550021389902457", + "-1.4068090138839492e-10", + "1e-96", + "0.00010624346465135898", + "0.0000034876831562518656", + "5.0556495531947476e-9", + "1e-93", + "0.00014141005145095883", + "0.000005165147664629505", + "-1.816848779931596e-7", + "1e-90", + "0.00018821677848122623", + "0.000007649419170891291", + "0.000006529209460440176", + "1e-87", + "0.0002505165321585122", + "0.000011328546142580879", + "-0.00023464020037983858", + "1e-84", + "0.0003334375043029798", + "0.000016777216", + "0.008432264881050257", + "1e-81", + "0.00044380531822726623", + "0.000024846522507656058", + "-0.30303030303030304", + "1e-78", + "0.0005907048785604916", + "0.000036796908421722595", + "1.9791116015451296e-20", + "1e-75", + "0.0007862281933640144", + "0.0000544950493164354", + "-7.112333362472731e-19", + "1e-72", + "0.0010464697253675034", + "0.000080705432259836", + "2.555959240471825e-17", + "1e-69", + "0.0013928512044641473", + "0.00011952217454517642", + "-9.185350722483597e-16", + "1e-66", + "0.0018538849531417807", + "0.00017700853347782622", + "3.3009394891389294e-14", + "1e-63", + "0.0024675208726317108", + "0.000262144", + "-1.1862586242118569e-12", + "1e-60", + "0.0032842702814728075", + "0.00038822691418212587", + "4.26305761783015e-11", + "1e-57", + "0.004371363744640308", + "0.0005749516940894155", + "-1.5320150161196205e-9", + "1e-54", + "0.005818285144116251", + "0.0008514851455693025", + "5.505602363429079e-8", + "1e-51", + "0.007744137526818733", + "0.0012610223790599387", + "-0.000001978548321345508", + "1e-48", + "0.010307447048195735", + "0.0018675339772683832", + "0.00007110309102419351", + "1e-45", + "0.013719212021148527", + "0.0027657583355910347", + "-0.002555231782136442", + "1e-42", + "0.018260271200148694", + "0.004096", + "0.09182736455463729", + "1e-39", + "0.02430442096739792", + "0.006066045534095717", + "-5.99730788347009e-21", + "1e-36", + "0.03234918430760664", + "0.00898362022014711", + "2.1552525340826461e-19", + "1e-33", + "0.043056764313424443", + "0.01330445539952035", + "-7.745331031732804e-18", + "1e-30", + "0.05730855330116795", + "0.01970347467281154", + "2.7834396128738173e-16", + "1e-27", + "0.07627768444385455", + "0.029180218394818474", + "-1.0002846936784635e-14", + "1e-24", + "0.10152559799477044", + "0.043214973993609934", + "3.594723103672294e-13", + "1e-21", + "0.13513057093103947", + "0.064", + "-1.2918356417667121e-11", + "1e-18", + "0.1798587899092136", + "0.09478196147024553", + "4.6424697458170323e-10", + "1e-15", + "0.23939204936916336", + "0.14036906593979864", + "-1.6683643525542665e-8", + "1e-12", + "0.3186308177103565", + "0.20788211561750553", + "5.995600973774267e-7", + "1e-9", + "0.4240976183724846", + "0.3078667917626803", + "-0.00002154639121945258", + "0.000001", + "0.5644739300537771", + "0.4559409124190387", + "0.0007743126612534672", + "0.001", + "0.7513148009015775", + "0.6752339686501552", + "-0.02782647410746585", + "1", + "1", + "1", + "1", + "1000", + "1.3310000000000004", + "1.4809681479725867", + "-35.937", + "1000000", + "1.7715610000000008", + "2.193266655309354", + "1291.4679689999996", + "1000000000", + "2.3579476910000015", + "3.2481580565235237", + "-46411.48440195298", + "1000000000000", + "3.1384283767210026", + "4.81041862129188", + "1667889.514952984", + "1000000000000000", + "4.177248169415655", + "7.124076756547479", + "-59938945.49886537", + "1000000000000000000", + "5.559917313492238", + "10.550530760158676", + "2154025884.3927245", + "1e+21", + "7.400249944258171", + "15.625", + "-77409228207.42133", + "1e+24", + "9.849732675807626", + "23.140127312071666", + "2781855434090.0996", + "1e+27", + "13.109994191499956", + "34.26979148920866", + "-99971538734895.9", + "1e+30", + "17.449402268886445", + "50.75246963318005", + "3592677187515953", + "1.0000000000000001e+33", + "23.22515441988786", + "75.16279095768563", + "-129110040087760770", + "1e+36", + "30.91268053287075", + "111.3136993210544", + "4639827510633858000", + "1.0000000000000001e+39", + "41.14477778925098", + "164.85204312747925", + "-166741481249648930000", + "1e+42", + "54.76369923749306", + "244.140625", + "10.889999999999999", + "1.0000000000000001e+45", + "72.89048368510328", + "361.56448925111994", + "-391.3539299999999", + "1e+48", + "97.01723378487247", + "535.465492018885", + "14064.086182409994", + "1e+51", + "129.1299381676653", + "793.0073380184383", + "-505421.0651372679", + "1e+54", + "171.87194770116255", + "1174.418608713838", + "18163316.81783799", + "1.0000000000000002e+57", + "228.7615623902474", + "1739.2765518914737", + "-652735116.4826437", + "1e+60", + "304.4816395414193", + "2575.813173866863", + "23457341881.036766", + "1e+63", + "405.2650622296292", + "3814.697265625", + "-842986495178.8181", + "1.0000000000000001e+66", + "539.4077978276366", + "5649.445144548748", + "30294405677241.184", + "1e+69", + "717.9517789085845", + "8366.648312795085", + "-1088690056823016.2", + "1.0000000000000001e+72", + "955.5938177273262", + "12390.739656538108", + "39124254572048720", + "1.0000000000000001e+75", + "1271.8953713950714", + "18350.290761153705", + "-1406008336555714800", + "1.0000000000000002e+78", + "1692.8927393268405", + "27176.196123304275", + "50527721590802710000", + "1.0000000000000001e+81", + "2253.2402360440246", + "40247.08084166974", + "-3.3", + "1.0000000000000003e+84", + "2999.0627541745976", + "59604.644775390625", + "118.59209999999997", + "1.0000000000000002e+87", + "3991.7525258063906", + "88272.5803835742", + "-4261.844297699999", + "1.0000000000000002e+90", + "5313.022611848307", + "130728.8798874232", + "153157.89852644483", + "1e+93", + "7071.6330963700975", + "193605.30713340794", + "-5504035.399344847", + "1.0000000000000002e+96", + "9412.343651268602", + "286723.2931430266", + "197798520.1462557", + "1.0000000000000001e+99", + "12527.829399838512", + "424628.06442662934", + "-7108285418.495991", + "1.0000000000000001e+102", + "16674.540931185064", + "628860.6381510897", + "255450453084.49036", + "1.0000000000000002e+105", + "22193.81397940732", + "931322.5746154785", + "-9180122932497.328", + "1.0000000000000003e+108", + "29539.966406591153", + "1379259.068493347", + "329906077825156.44", + "1.0000000000000002e+111", + "39317.695287172835", + "2042638.7482409875", + "-11855834718802646", + "1.0000000000000003e+114", + "52331.85242722705", + "3025082.923959494", + "426063132289610500", + "1.0000000000000002e+117", + "69653.69558063922", + "4480051.455359798", + "-15311430785091730000", + "1.0000000000000003e+120", + "92709.0688178308", + "6634813.506666083", + "1", + "1.0000000000000003e+123", + "123395.77059653286", + "9825947.471110791", + "-35.937", + "1.0000000000000002e+126", + "164239.77066398528", + "14551915.228366852", + "1291.4679689999996", + "1.0000000000000003e+129", + "218603.1347537644", + "21550922.94520851", + "-46411.48440195298", + "1.0000000000000003e+132", + "290960.77235726046", + "31916230.44126543", + "1667889.514952984", + "1.0000000000000003e+135", + "387268.78800751385", + "47266920.686867096", + "-59938945.49886537", + "1.0000000000000002e+138", + "515454.75683800096", + "70000803.98999685", + "2154025884.3927245", + "1.0000000000000002e+141", + "686070.2813513794", + "103668961.04165755", + "-77409228207.42133", + "1.0000000000000002e+144", + "913159.5444786862", + "153530429.23610613", + "2781855434090.0996", + "1.0000000000000003e+147", + "1215415.3537011317", + "227373675.44323206", + "-99971538734895.9", + "1.0000000000000003e+150", + "1617717.8357762066", + "336733171.01888293", + "3592677187515953", + "1.0000000000000004e+153", + "2153182.439418131", + "498691100.64477235", + "-129110040087760770", + "1.0000000000000002e+156", + "2865885.8268655334", + "738545635.7322984", + "4639827510633858000", + "1.0000000000000003e+159", + "3814494.0355580254", + "1093762562.3437006", + "-166741481249648930000", + "1.0000000000000003e+162", + "5077091.561327733", + "1619827516.2758992", + "10.889999999999999", + "1.0000000000000003e+165", + "6757608.868127214", + "2398912956.814158", + "-391.3539299999999", + "1.0000000000000004e+168", + "8994377.403477322", + "3552713678.800501", + "14064.086182409994", + "1.0000000000000004e+171", + "11971516.32402832", + "5261455797.170046", + "-505421.0651372679", + "1.0000000000000003e+174", + "15934088.227281697", + "7792048447.574568", + "18163316.81783799", + "1.0000000000000003e+177", + "21208271.430511944", + "11539775558.317162", + "-652735116.4826437", + "1.0000000000000002e+180", + "28228209.274011403", + "17090040036.620323", + "23457341881.036766", + "1.0000000000000003e+183", + "37571746.54370919", + "25309804941.810925", + "-842986495178.8181", + "1.0000000000000003e+186", + "50007994.649676934", + "37483014950.22122", + "30294405677241.184", + "1.0000000000000003e+189", + "66560640.878720015", + "55511151231.25783", + "-1088690056823016.2", + "1.0000000000000004e+192", + "88592213.00957635", + "82210246830.78197", + "39124254572048720", + "1.0000000000000004e+195", + "117916235.51574618", + "121750756993.35263", + "-1406008336555714800", + "1.0000000000000005e+198", + "156946509.47145817", + "180308993098.70566", + "50527721590802710000", + "1.0000000000000004e+201", + "208895804.10651088", + "267031875572.19257", + "-3.3", + "1.0000000000000004e+204", + "278040315.26576596", + "395465702215.7957", + "118.59209999999997", + "1.0000000000000005e+207", + "370071659.6187346", + "585672108597.2065", + "-4261.844297699999", + "1.0000000000000004e+210", + "492565378.9525358", + "867361737988.4036", + "153157.89852644483", + "1.0000000000000004e+213", + "655604519.3858254", + "1284535106730.9683", + "-5504035.399344847", + "1.0000000000000003e+216", + "872609615.3025337", + "1902355578021.1348", + "197798520.1462557", + "1.0000000000000006e+219", + "1161443397.9676728", + "2817328017167.276", + "-7108285418.495991", + "1.0000000000000005e+222", + "1545881162.694973", + "4172373055815.509", + "255450453084.49036", + "1.0000000000000006e+225", + "2057567827.547009", + "6179151597121.828", + "-9180122932497.328", + "1.0000000000000004e+228", + "2738622778.46507", + "9151126696831.322", + "329906077825156.44", + "1.0000000000000004e+231", + "3645106918.1370087", + "13552527156068.807", + "-11855834718802646", + "1.0000000000000005e+234", + "4851637308.0403595", + "20070861042671.445", + "426063132289610500", + "1.0000000000000005e+237", + "6457529257.001719", + "29724305906580.133", + "-15311430785091730000", + "1.0000000000000004e+240", + "8594971441.06929", + "44020750268238.69", + "1", + "1.0000000000000005e+243", + "11439906988.063227", + "65193328997117.32", + "-35.937", + "1.0000000000000005e+246", + "15226516201.112162", + "96549243705028.56", + "1291.4679689999996", + "1.0000000000000007e+249", + "20266493063.68029", + "142986354637989.4", + "-46411.48440195298", + "1.0000000000000003e+252", + "26974702267.758465", + "211758236813575.1", + "1667889.514952984", + "1.0000000000000004e+255", + "35903328718.38653", + "313607203791741.3", + "-59938945.49886537", + "1.0000000000000005e+258", + "47787330524.17248", + "464442279790314.6", + "2154025884.3927245", + "1.0000000000000006e+261", + "63604936927.67358", + "687824222941229.5", + "-77409228207.42133", + "1.0000000000000005e+264", + "84658171050.73355", + "1018645765579958.1", + "2781855434090.0996", + "1.0000000000000005e+267", + "112680025668.5264", + "1508581932891071.2", + "-99971538734895.9", + "1.0000000000000005e+270", + "149977114164.80865", + "2234161791218584.8", + "3592677187515953", + "1.0000000000000005e+273", + "199619538953.36032", + "3308722450212111", + "-129110040087760770", + "1.0000000000000005e+276", + "265693606346.92267", + "4900112559245958", + "4639827510633858000", + "1.0000000000000004e+279", + "353638190047.7542", + "7256910621723666", + "-166741481249648930000", + "1.0000000000000005e+282", + "470692430953.56085", + "10747253483456710", + "10.889999999999999", + "1.0000000000000005e+285", + "626491625599.1896", + "15916340087186846", + "-391.3539299999999", + "1.0000000000000005e+288", + "833860353672.5216", + "23571592701422988", + "14064.086182409994", + "1.0000000000000005e+291", + "1109868130738.1265", + "34908777987790384", + "-505421.0651372679", + "1.0000000000000005e+294", + "1477234482012.4468", + "51698788284564230", + "18163316.81783799", + "1.0000000000000006e+297", + "1966199095558.5667", + "76564258738218100", + "-652735116.4826437", + "1.0000000000000006e+300", + "2617010996188.453", + "113389228464432270", + "23457341881.036766", + "1.0000000000000006e+303", + "3483241635926.8315", + "167925835679011100", + "-842986495178.8181", + "1.0000000000000006e+306", + "4636194617418.614", + "248692813862294460", + "30294405677241.184", + "Infinity", + "6170775035784.177", + "368306135959734200", + "-1088690056823016.2", + "NaN", + "Infinity", + "0", + "0", + "2", + "1.0715086071862673e+301", + "2.1430172143725346e+301", + "1.000100004995219", + "1", + "NaN", + "NaN", + "-Infinity", + "0", + "2.2227587494850775e-162", + "0" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-pow.js b/packages/codemode-rust/conformance/cases/std-pow.js new file mode 100644 index 0000000000000..da7df0edd62c2 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-pow.js @@ -0,0 +1,7 @@ +// Results that are exact, so every libm agrees; std-pow-inexact covers rounded ones. +const o = [] +for (let k = 0; k <= 1000; k += 7) o.push(String(10 ** k), String(Math.pow(1.1, k)), String((-3.3) ** (k % 40))) +for (let k = -1074; k <= 1023; k += 13) o.push(String(2 ** k), String(Math.pow(0.5, -k)), String((-2) ** (k + 51))) +o.push(String(4 ** 1.5), String(16 ** 0.25), String(0.25 ** -511.5), String(2 ** 1024), String((-2) ** 1001), String(2 ** 1001), String(2 ** -1074)) +o.push(String((-8) ** (1 / 3)), String(0 ** -0.5), String((-0) ** 0.5), String(Infinity ** -0.5), String(4 ** 0.5), String(2 ** 1000), String(1.0000001 ** 1000), String(NaN ** 0), String(1 ** Infinity), String((-1) ** -Infinity), String(Math.pow(-0, -3)), String(Math.pow(-0, 3)), String(Math.pow(5e-324, 0.5)), String(Math.pow(5e-324, 2))) +return o diff --git a/packages/codemode-rust/conformance/cases/std-pow.json b/packages/codemode-rust/conformance/cases/std-pow.json new file mode 100644 index 0000000000000..422d1aa503085 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-pow.json @@ -0,0 +1,944 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "1", + "1", + "1", + "10000000", + "1.9487171000000012", + "-4261.844297699999", + "100000000000000", + "3.797498335832414", + "18163316.81783799", + "1e+21", + "7.400249944258171", + "-77409228207.42133", + "1e+28", + "14.420993610649951", + "329906077825156.44", + "1e+35", + "28.10243684806432", + "-1406008336555714800", + "1e+42", + "54.76369923749306", + "10.889999999999999", + "1.0000000000000001e+49", + "106.71895716335973", + "-46411.48440195298", + "1e+56", + "207.9650567184067", + "197798520.1462557", + "1e+63", + "405.2650622296292", + "-842986495178.8181", + "1.0000000000000002e+70", + "789.7469567994431", + "3592677187515953", + "1.0000000000000001e+77", + "1538.9933993880366", + "-15311430785091730000", + "1.0000000000000003e+84", + "2999.0627541745976", + "118.59209999999997", + "1.0000000000000003e+91", + "5844.324873033138", + "-505421.0651372679", + "1.0000000000000003e+98", + "11388.93581803501", + "2154025884.3927245", + "1.0000000000000002e+105", + "22193.81397940732", + "-9180122932497.328", + "1.0000000000000001e+112", + "43249.46481589012", + "39124254572048720", + "1.0000000000000001e+119", + "84280.97165257348", + "-166741481249648930000", + "1.0000000000000002e+126", + "164239.77066398528", + "1291.4679689999996", + "1.0000000000000003e+133", + "320056.8495929866", + "-5504035.399344847", + "1.0000000000000003e+140", + "623700.2557739812", + "23457341881.036766", + "1.0000000000000003e+147", + "1215415.3537011317", + "-99971538734895.9", + "1.0000000000000003e+154", + "2368500.6833599443", + "426063132289610500", + "1.0000000000000004e+161", + "4615537.783025212", + "-3.3", + "1.0000000000000004e+168", + "8994377.403477322", + "14064.086182409994", + "1.0000000000000003e+175", + "17527497.05000987", + "-59938945.49886537", + "1.0000000000000004e+182", + "34156133.2215538", + "255450453084.49036", + "1.0000000000000003e+189", + "66560640.878720015", + "-1088690056823016.2", + "1.0000000000000004e+196", + "129707859.06732078", + "4639827510633858000", + "1.0000000000000003e+203", + "252763922.96887818", + "-35.937", + "1.0000000000000004e+210", + "492565378.9525358", + "153157.89852644483", + "1.0000000000000006e+217", + "959870576.8327873", + "-652735116.4826437", + "1.0000000000000004e+224", + "1870516206.8609173", + "2781855434090.0996", + "1.0000000000000004e+231", + "3645106918.1370087", + "-11855834718802646", + "1.0000000000000005e+238", + "7103282182.701893", + "50527721590802710000", + "1.0000000000000004e+245", + "13842287455.556507", + "-391.3539299999999", + "1.0000000000000003e+252", + "26974702267.758465", + "1667889.514952984", + "1.0000000000000006e+259", + "52566063576.58973", + "-7108285418.495991", + "1.0000000000000005e+266", + "102436386971.38762", + "30294405677241.184", + "1.0000000000000005e+273", + "199619538953.36032", + "-129110040087760770", + "1.0000000000000004e+280", + "389002009052.52954", + "1", + "1.0000000000000004e+287", + "758054866975.0195", + "-4261.844297699999", + "1.0000000000000005e+294", + "1477234482012.4468", + "18163316.81783799", + "1.0000000000000006e+301", + "2878712095807.2983", + "-77409228207.42133", + "1.0000000000000006e+308", + "5609795487076.523", + "329906077825156.44", + "Infinity", + "10931904393168.857", + "-1406008336555714800", + "Infinity", + "21303189026533.28", + "10.889999999999999", + "Infinity", + "41513888740537.78", + "-46411.48440195298", + "Infinity", + "80898824876183.47", + "197798520.1462557", + "Infinity", + "157648923406124.2", + "-842986495178.8181", + "Infinity", + "307213152838104.6", + "3592677187515953", + "Infinity", + "598671524280528.2", + "-15311430785091730000", + "Infinity", + "1166641436648531.2", + "118.59209999999997", + "Infinity", + "2273454117165560.5", + "-505421.0651372679", + "Infinity", + "4430318914185933.5", + "2154025884.3927245", + "Infinity", + "8633438226527565", + "-9180122932497.328", + "Infinity", + "16824128703827948", + "39124254572048720", + "Infinity", + "32785467297750372", + "-166741481249648930000", + "Infinity", + "63889600754616980", + "1291.4679689999996", + "Infinity", + "124502757502695060", + "-5504035.399344847", + "Infinity", + "242620652542655260", + "23457341881.036766", + "Infinity", + "472799014423031040", + "-99971538734895.9", + "Infinity", + "921351524269307600", + "426063132289610500", + "Infinity", + "1795453470454665700", + "-3.3", + "Infinity", + "3498830880129353000", + "14064.086182409994", + "Infinity", + "6818231566116126000", + "-59938945.49886537", + "Infinity", + "13286804444650279000", + "255450453084.49036", + "Infinity", + "25892223025646014000", + "-1088690056823016.2", + "Infinity", + "50456617767090150000", + "4639827510633858000", + "Infinity", + "98325673850892450000", + "-35.937", + "Infinity", + "191608922002257050000", + "153157.89852644483", + "Infinity", + "373391582818364700000", + "-652735116.4826437", + "Infinity", + "727634562434213600000", + "2781855434090.0996", + "Infinity", + "1.4179539143665708e+21", + "-11855834718802646", + "Infinity", + "2.763191039938073e+21", + "50527721590802710000", + "Infinity", + "5.384677630094108e+21", + "-391.3539299999999", + "Infinity", + "1.0493213375751868e+22", + "1667889.514952984", + "Infinity", + "2.0448304339276404e+22", + "-7108285418.495991", + "Infinity", + "3.984796033195215e+22", + "30294405677241.184", + "Infinity", + "7.765240169899686e+22", + "-129110040087760770", + "Infinity", + "1.513225630469043e+23", + "1", + "Infinity", + "2.9488486622533072e+23", + "-4261.844297699999", + "Infinity", + "5.746471813445147e+23", + "18163316.81783799", + "Infinity", + "1.1198247887528571e+24", + "-77409228207.42133", + "Infinity", + "2.1822217148465814e+24", + "329906077825156.44", + "Infinity", + "4.25253277171286e+24", + "-1406008336555714800", + "Infinity", + "8.286983330547249e+24", + "10.889999999999999", + "Infinity", + "1.6148986123652383e+25", + "-46411.48440195298", + "Infinity", + "3.146980540682413e+25", + "197798520.1462557", + "Infinity", + "6.132574792995067e+25", + "-842986495178.8181", + "Infinity", + "1.1950653366138454e+26", + "3592677187515953", + "Infinity", + "2.3288442570766575e+26", + "-15311430785091730000", + "Infinity", + "4.53825862700208e+26", + "118.59209999999997", + "Infinity", + "8.843782190661481e+26", + "-505421.0651372679", + "Infinity", + "1.7234029583617494e+27", + "2154025884.3927245", + "Infinity", + "3.3584248151501304e+27", + "-9180122932497.328", + "Infinity", + "6.544619866347402e+27", + "39124254572048720", + "Infinity", + "1.2753612646550903e+28", + "-166741481249648930000", + "Infinity", + "2.4853183051110013e+28", + "1291.4679689999996", + "Infinity", + "4.843182280112828e+28", + "-5504035.399344847", + "Infinity", + "9.437992127672861e+28", + "23457341881.036766", + "Infinity", + "1.83919766488615e+29", + "-99971538734895.9", + "Infinity", + "3.5840759398437115e+29", + "426063132289610500", + "Infinity", + "6.984350071672015e+29", + "-3.3", + "Infinity", + "1.3610522417053487e+30", + "14064.086182409994", + "Infinity", + "2.6523057774045474e+30", + "-59938945.49886537", + "Infinity", + "5.168593622857038e+30", + "255450453084.49036", + "Infinity", + "1.0072126775812465e+31", + "-1088690056823016.2", + "Infinity", + "1.9627725681393628e+31", + "4639827510633858000", + "Infinity", + "3.8248884669440934e+31", + "-35.937", + "Infinity", + "7.453625561126742e+31", + "153157.89852644483", + "Infinity", + "1.4525007587964784e+32", + "-652735116.4826437", + "Infinity", + "2.8305130664296743e+32", + "2781855434090.0996", + "Infinity", + "5.515869214324946e+32", + "-11855834718802646", + "Infinity", + "1.0748868659318592e+33", + "50527721590802710000", + "Infinity", + "2.0946504162068223e+33", + "-391.3539299999999", + "Infinity", + "4.0818810845843535e+33", + "1667889.514952984", + "Infinity", + "7.954431469696079e+33", + "-7108285418.495991", + "Infinity", + "1.550093662577489e+34", + "30294405677241.184", + "Infinity", + "3.020694026866384e+34", + "-129110040087760770", + "Infinity", + "5.886478104022385e+34", + "1", + "Infinity", + "1.1471080540084005e+35", + "-4261.844297699999", + "Infinity", + "2.235389080393895e+35", + "18163316.81783799", + "Infinity", + "4.356140926116859e+35", + "-77409228207.42133", + "Infinity", + "8.488886312733765e+35", + "329906077825156.44", + "Infinity", + "1.6542437917580244e+36", + "-1406008336555714800", + "Infinity", + "3.223653164567703e+36", + "10.889999999999999", + "Infinity", + "6.2819880462622e+36", + "-46411.48440195298", + "Infinity", + "1.2241817527746743e+37", + "197798520.1462557", + "Infinity", + "2.385583915139982e+37", + "-842986495178.8181", + "Infinity", + "4.648828168918234e+37", + "3592677187515953", + "Infinity", + "9.059250947732653e+37", + "-15311430785091730000", + "Infinity", + "1.765391723503784e+38", + "118.59209999999997", + "Infinity", + "3.440249039790298e+38", + "-505421.0651372679", + "Infinity", + "6.704072132097935e+38", + "2154025884.3927245", + "Infinity", + "1.3064340003452713e+39", + "-9180122932497.328", + "Infinity", + "2.5458702764942365e+39", + "39124254572048720", + "Infinity", + "4.9611809421860496e+39", + "-166741481249648930000", + "Infinity", + "9.667938138232072e+39", + "1291.4679689999996", + "Infinity", + "1.8840076371715009e+40", + "-5504035.399344847", + "Infinity", + "3.6713978990867007e+40", + "23457341881.036766", + "Infinity", + "7.154515866854334e+40", + "-99971538734895.9", + "Infinity", + "1.3942127411960368e+41", + "426063132289610500", + "5e-324", + "5e-324", + "-1.1125369292536007e-308", + "4.0474e-320", + "4.0474e-320", + "9.113902524445497e-305", + "3.3156184e-316", + "3.3156184e-316", + "-7.466108948025751e-301", + "2.716154612436e-312", + "2.716154612436e-312", + "6.116236450222695e-297", + "2.2250738585072014e-308", + "2.2250738585072014e-308", + "-5.010420900022432e-293", + "1.8227805048890994e-304", + "1.8227805048890994e-304", + "4.1045368012983762e-289", + "1.4932217896051502e-300", + "1.4932217896051502e-300", + "-3.36243654762363e-285", + "1.223247290044539e-296", + "1.223247290044539e-296", + "2.7545080198132776e-281", + "1.0020841800044864e-292", + "1.0020841800044864e-292", + "-2.256492969831037e-277", + "8.209073602596753e-289", + "8.209073602596753e-289", + "1.8485190408855855e-273", + "6.72487309524726e-285", + "6.72487309524726e-285", + "-1.5143067982934716e-269", + "5.509016039626555e-281", + "5.509016039626555e-281", + "1.240520129162012e-265", + "4.512985939662074e-277", + "4.512985939662074e-277", + "-1.0162340898095202e-261", + "3.697038081771171e-273", + "3.697038081771171e-273", + "8.32498966371959e-258", + "3.0286135965869433e-269", + "3.0286135965869433e-269", + "-6.819831532519088e-254", + "2.481040258324024e-265", + "2.481040258324024e-265", + "5.586805991439637e-250", + "2.0324681796190404e-261", + "2.0324681796190404e-261", + "-4.5767114681873503e-246", + "1.664997932743918e-257", + "1.664997932743918e-257", + "3.7492420347390774e-242", + "1.3639663065038175e-253", + "1.3639663065038175e-253", + "-3.0713790748582522e-238", + "1.1173611982879273e-249", + "1.1173611982879273e-249", + "2.5160737381238802e-234", + "9.153422936374701e-246", + "9.153422936374701e-246", + "-2.0611676062710827e-230", + "7.498484069478155e-242", + "7.498484069478155e-242", + "1.688508503057271e-226", + "6.142758149716505e-238", + "6.142758149716505e-238", + "-1.3832261657045163e-222", + "5.0321474762477604e-234", + "5.0321474762477604e-234", + "1.1331388749451398e-218", + "4.1223352125421653e-230", + "4.1223352125421653e-230", + "-9.282673663550585e-215", + "3.377017006114542e-226", + "3.377017006114542e-226", + "7.60436626518064e-211", + "2.7664523314090327e-222", + "2.7664523314090327e-222", + "-6.22949684443598e-207", + "2.2662777498902796e-218", + "2.2662777498902796e-218", + "5.103203814961955e-203", + "1.856534732710117e-214", + "1.856534732710117e-214", + "-4.180544565216833e-199", + "1.520873253036128e-210", + "1.520873253036128e-210", + "3.42470210782563e-195", + "1.245899368887196e-206", + "1.245899368887196e-206", + "-2.805515966730756e-191", + "1.020640762992391e-202", + "1.020640762992391e-202", + "2.2982786799458352e-187", + "8.361089130433666e-199", + "8.361089130433666e-199", + "-1.8827498946116282e-183", + "6.84940421565126e-195", + "6.84940421565126e-195", + "1.542348713665846e-179", + "5.611031933461512e-191", + "5.611031933461512e-191", + "-1.263492066235061e-175", + "4.5965573598916705e-187", + "4.5965573598916705e-187", + "1.035052700659762e-171", + "3.7654997892232564e-183", + "3.7654997892232564e-183", + "-8.47915172380477e-168", + "3.084697427331692e-179", + "3.084697427331692e-179", + "6.946121092140867e-164", + "2.526984132470122e-175", + "2.526984132470122e-175", + "-5.6902623986817984e-160", + "2.070105401319524e-171", + "2.070105401319524e-171", + "4.661462957000129e-156", + "1.695830344760954e-167", + "1.695830344760954e-167", + "-3.818670454374506e-152", + "1.3892242184281734e-163", + "1.3892242184281734e-163", + "3.1282548362235952e-148", + "1.1380524797363597e-159", + "1.1380524797363597e-159", + "-2.5626663618343692e-144", + "9.322925914000258e-156", + "9.322925914000258e-156", + "2.0993362836147152e-140", + "7.637340908749012e-152", + "7.637340908749012e-152", + "-1.7197762835371747e-136", + "6.256509672447191e-148", + "6.256509672447191e-148", + "1.4088407314736535e-132", + "5.1253327236687384e-144", + "5.1253327236687384e-144", + "-1.154122327223217e-128", + "4.1986725672294305e-140", + "4.1986725672294305e-140", + "9.454570104612593e-125", + "3.4395525670743494e-136", + "3.4395525670743494e-136", + "-7.745183829698637e-121", + "2.817681462947307e-132", + "2.817681462947307e-132", + "6.344854593289123e-117", + "2.308244654446434e-128", + "2.308244654446434e-128", + "-5.19770488282245e-113", + "1.8909140209225187e-124", + "1.8909140209225187e-124", + "4.257959840008151e-109", + "1.5490367659397273e-120", + "1.5490367659397273e-120", + "-3.488120700934677e-105", + "1.2689709186578246e-116", + "1.2689709186578246e-116", + "2.8574684782056875e-101", + "1.03954097656449e-112", + "1.03954097656449e-112", + "-2.3408381773460992e-97", + "8.515919680016301e-109", + "8.515919680016301e-109", + "1.9176146348819244e-93", + "6.976241401869354e-105", + "6.976241401869354e-105", + "-1.5709099088952725e-89", + "5.714936956411375e-101", + "5.714936956411375e-101", + "1.2868893973670072e-85", + "4.6816763546921983e-97", + "4.6816763546921983e-97", + "-1.0542197943230523e-81", + "3.835229269763849e-93", + "3.835229269763849e-93", + "8.636168555094445e-78", + "3.141819817790545e-89", + "3.141819817790545e-89", + "-7.074749280333369e-74", + "2.5737787947340145e-85", + "2.5737787947340145e-85", + "5.795634610449096e-70", + "2.1084395886461046e-81", + "2.1084395886461046e-81", + "-4.7477838728798994e-66", + "1.727233711018889e-77", + "1.727233711018889e-77", + "3.8893845486632136e-62", + "1.4149498560666738e-73", + "1.4149498560666738e-73", + "-3.1861838222649046e-58", + "1.1591269220898192e-69", + "1.1591269220898192e-69", + "2.61012178719941e-54", + "9.495567745759799e-66", + "9.495567745759799e-66", + "-2.1382117680737565e-50", + "7.778769097326427e-62", + "7.778769097326427e-62", + "1.7516230804060213e-46", + "6.372367644529809e-58", + "6.372367644529809e-58", + "-1.4349296274686127e-42", + "5.22024357439882e-54", + "5.22024357439882e-54", + "1.1754943508222875e-38", + "4.276423536147513e-50", + "4.276423536147513e-50", + "-9.62964972193618e-35", + "3.503246160812043e-46", + "3.503246160812043e-46", + "7.888609052210118e-31", + "2.8698592549372254e-42", + "2.8698592549372254e-42", + "-6.462348535570529e-27", + "2.350988701644575e-38", + "2.350988701644575e-38", + "5.293955920339377e-23", + "1.925929944387236e-34", + "1.925929944387236e-34", + "-4.336808689942018e-19", + "1.5777218104420236e-30", + "1.5777218104420236e-30", + "3.552713678800501e-15", + "1.2924697071141057e-26", + "1.2924697071141057e-26", + "-2.9103830456733704e-11", + "1.0587911840678754e-22", + "1.0587911840678754e-22", + "2.384185791015625e-7", + "8.673617379884035e-19", + "8.673617379884035e-19", + "-0.001953125", + "7.105427357601002e-15", + "7.105427357601002e-15", + "16", + "5.820766091346741e-11", + "5.820766091346741e-11", + "-131072", + "4.76837158203125e-7", + "4.76837158203125e-7", + "1073741824", + "0.00390625", + "0.00390625", + "-8796093022208", + "32", + "32", + "72057594037927940", + "262144", + "262144", + "-590295810358705700000", + "2147483648", + "2147483648", + "4.835703278458517e+24", + "17592186044416", + "17592186044416", + "-3.961408125713217e+28", + "144115188075855870", + "144115188075855870", + "3.2451855365842673e+32", + "1.1805916207174113e+21", + "1.1805916207174113e+21", + "-2.658455991569832e+36", + "9.671406556917033e+24", + "9.671406556917033e+24", + "2.1778071482940062e+40", + "7.922816251426434e+28", + "7.922816251426434e+28", + "-1.78405961588245e+44", + "6.490371073168535e+32", + "6.490371073168535e+32", + "1.461501637330903e+48", + "5.316911983139664e+36", + "5.316911983139664e+36", + "-1.1972621413014757e+52", + "4.3556142965880123e+40", + "4.3556142965880123e+40", + "9.807971461541689e+55", + "3.5681192317649e+44", + "3.5681192317649e+44", + "-8.034690221294951e+59", + "2.923003274661806e+48", + "2.923003274661806e+48", + "6.582018229284824e+63", + "2.3945242826029513e+52", + "2.3945242826029513e+52", + "-5.391989333430128e+67", + "1.9615942923083377e+56", + "1.9615942923083377e+56", + "4.417117661945961e+71", + "1.6069380442589903e+60", + "1.6069380442589903e+60", + "-3.618502788666131e+75", + "1.3164036458569648e+64", + "1.3164036458569648e+64", + "2.9642774844752946e+79", + "1.0783978666860256e+68", + "1.0783978666860256e+68", + "-2.4283361152821613e+83", + "8.834235323891922e+71", + "8.834235323891922e+71", + "1.9892929456391466e+87", + "7.237005577332262e+75", + "7.237005577332262e+75", + "-1.629628781067589e+91", + "5.928554968950589e+79", + "5.928554968950589e+79", + "1.3349918974505688e+95", + "4.856672230564323e+83", + "4.856672230564323e+83", + "-1.093625362391506e+99", + "3.978585891278293e+87", + "3.978585891278293e+87", + "8.958978968711217e+102", + "3.259257562135178e+91", + "3.259257562135178e+91", + "-7.339195571168229e+106", + "2.6699837949011376e+95", + "2.6699837949011376e+95", + "6.012269011901013e+110", + "2.187250724783012e+99", + "2.187250724783012e+99", + "-4.92525077454931e+114", + "1.7917957937422434e+103", + "1.7917957937422434e+103", + "4.034765434510795e+118", + "1.4678391142336458e+107", + "1.4678391142336458e+107", + "-3.305279843951243e+122", + "1.2024538023802026e+111", + "1.2024538023802026e+111", + "2.7076852481648583e+126", + "9.85050154909862e+114", + "9.85050154909862e+114", + "-2.218135755296652e+130", + "8.06953086902159e+118", + "8.06953086902159e+118", + "1.8170968107390172e+134", + "6.610559687902486e+122", + "6.610559687902486e+122", + "-1.488565707357403e+138", + "5.415370496329717e+126", + "5.415370496329717e+126", + "1.2194330274671845e+142", + "4.436271510593304e+130", + "4.436271510593304e+130", + "-9.989595361011175e+145", + "3.6341936214780345e+134", + "3.6341936214780345e+134", + "8.183476519740355e+149", + "2.977131414714806e+138", + "2.977131414714806e+138", + "-6.703903964971299e+153", + "2.438866054934369e+142", + "2.438866054934369e+142", + "5.491838128104488e+157", + "1.997919072202235e+146", + "1.997919072202235e+146", + "-4.4989137945431964e+161", + "1.636695303948071e+150", + "1.636695303948071e+150", + "3.6855101804897865e+165", + "1.3407807929942597e+154", + "1.3407807929942597e+154", + "-3.019169939857233e+169", + "1.0983676256208976e+158", + "1.0983676256208976e+158", + "2.4733040147310453e+173", + "8.997827589086393e+161", + "8.997827589086393e+161", + "-2.0261306488676723e+177", + "7.371020360979573e+165", + "7.371020360979573e+165", + "1.6598062275523972e+181", + "6.038339879714466e+169", + "6.038339879714466e+169", + "-1.3597132616109238e+185", + "4.946608029462091e+173", + "4.946608029462091e+173", + "1.1138771039116688e+189", + "4.052261297735345e+177", + "4.052261297735345e+177", + "-9.12488123524439e+192", + "3.3196124551047944e+181", + "3.3196124551047944e+181", + "7.475102707912205e+196", + "2.7194265232218475e+185", + "2.7194265232218475e+185", + "-6.123604138321678e+200", + "2.2277542078233375e+189", + "2.2277542078233375e+189", + "5.016456510113119e+204", + "1.824976247048878e+193", + "1.824976247048878e+193", + "-4.109481173084667e+208", + "1.495020541582441e+197", + "1.495020541582441e+197", + "3.366486976990959e+212", + "1.2247208276643356e+201", + "1.2247208276643356e+201", + "-2.7578261315509936e+216", + "1.0032913020226237e+205", + "1.0032913020226237e+205", + "2.259211166966574e+220", + "8.218962346169334e+208", + "8.218962346169334e+208", + "-1.8507457879790174e+224", + "6.732973953981918e+212", + "6.732973953981918e+212", + "1.516130949512411e+228", + "5.515652263101987e+216", + "5.515652263101987e+216", + "-1.2420144738405671e+232", + "4.518422333933148e+220", + "4.518422333933148e+220", + "1.0174582569701926e+236", + "3.701491575958035e+224", + "3.701491575958035e+224", + "-8.335018041099818e+239", + "3.032261899024822e+228", + "3.032261899024822e+228", + "6.828046779268971e+243", + "2.4840289476811343e+232", + "2.4840289476811343e+232", + "-5.593535921577141e+247", + "2.0349165139403852e+236", + "2.0349165139403852e+236", + "4.582224626955994e+251", + "1.6670036082199636e+240", + "1.6670036082199636e+240", + "-3.75375841440235e+255", + "1.3656093558537942e+244", + "1.3656093558537942e+244", + "3.0750788930784052e+259", + "1.1187071843154282e+248", + "1.1187071843154282e+248", + "-2.5191046292098296e+263", + "9.164449253911988e+251", + "9.164449253911988e+251", + "2.0636505122486924e+267", + "7.5075168288047e+255", + "7.5075168288047e+255", + "-1.6905424996341288e+271", + "6.150157786156811e+259", + "6.150157786156811e+259", + "1.3848924157002783e+275", + "5.038209258419659e+263", + "5.038209258419659e+263", + "-1.134503866941668e+279", + "4.127301024497385e+267", + "4.127301024497385e+267", + "9.293855677986144e+282", + "3.3810849992682576e+271", + "3.3810849992682576e+271", + "-7.61352657140625e+286", + "2.7697848314005566e+275", + "2.7697848314005566e+275", + "6.237000967296e+290", + "2.269007733883336e+279", + "2.269007733883336e+279", + "-5.109351192408883e+294", + "1.858771135597229e+283", + "1.858771135597229e+283", + "4.185580496821357e+298", + "1.52270531428125e+287", + "1.52270531428125e+287", + "-3.4288275429960554e+302", + "1.2474001934592e+291", + "1.2474001934592e+291", + "2.8088955232223686e+306", + "1.0218702384817765e+295", + "1.0218702384817765e+295", + "-Infinity", + "8.371160993642713e+298", + "8.371160993642713e+298", + "Infinity", + "6.857655085992111e+302", + "6.857655085992111e+302", + "-Infinity", + "5.617791046444737e+306", + "5.617791046444737e+306", + "Infinity", + "8", + "2", + "8.98846567431158e+307", + "Infinity", + "-2.1430172143725346e+301", + "2.1430172143725346e+301", + "5e-324", + "NaN", + "Infinity", + "0", + "0", + "2", + "1.0715086071862673e+301", + "1.000100004995219", + "1", + "NaN", + "NaN", + "-Infinity", + "0", + "2.2227587494850775e-162", + "0" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-promise-combinator-input.js b/packages/codemode-rust/conformance/cases/std-promise-combinator-input.js new file mode 100644 index 0000000000000..9939349dd2e10 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-promise-combinator-input.js @@ -0,0 +1,14 @@ +const out = [] +const bad = [3, null, undefined, true, { [Symbol.iterator]: () => 1 }, { [Symbol.iterator]: () => ({ next() { throw new Error("boom") } }) }, { [Symbol.iterator]: 5 }] +for (const name of ["all", "allSettled", "any", "race"]) { + for (const b of bad) { + let sync = "returned" + try { const p = Promise[name](b); out.push(p instanceof Promise); await p.then(() => out.push("resolved"), (e) => out.push(name + ": " + e.constructor.name + ": " + e.message)) } catch (e) { sync = "threw " + e.message } + if (sync !== "returned") out.push(sync) + } +} +const log = [] +const it = { [Symbol.iterator]() { let i = 0; return { next() { log.push("next" + i); if (i === 2) throw new Error("stop"); return { value: i++, done: false } } } } } +await Promise.all(it).catch((e) => log.push(e.message)) +out.push(log.join(",")) +return out diff --git a/packages/codemode-rust/conformance/cases/std-promise-combinator-input.json b/packages/codemode-rust/conformance/cases/std-promise-combinator-input.json new file mode 100644 index 0000000000000..56f58dd9c248c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-promise-combinator-input.json @@ -0,0 +1,65 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + true, + "all: TypeError: Promise.all expects a synchronous iterable, received a number.", + true, + "all: TypeError: Promise.all expects a synchronous iterable, received null.", + true, + "all: TypeError: Promise.all expects a synchronous iterable, received undefined.", + true, + "all: TypeError: Promise.all expects a synchronous iterable, received a boolean.", + true, + "all: TypeError: Iterator method result must be an object.", + true, + "all: Error: boom", + true, + "all: TypeError: Iterator method must be a function.", + true, + "allSettled: TypeError: Promise.allSettled expects a synchronous iterable, received a number.", + true, + "allSettled: TypeError: Promise.allSettled expects a synchronous iterable, received null.", + true, + "allSettled: TypeError: Promise.allSettled expects a synchronous iterable, received undefined.", + true, + "allSettled: TypeError: Promise.allSettled expects a synchronous iterable, received a boolean.", + true, + "allSettled: TypeError: Iterator method result must be an object.", + true, + "allSettled: Error: boom", + true, + "allSettled: TypeError: Iterator method must be a function.", + true, + "any: TypeError: Promise.any expects a synchronous iterable, received a number.", + true, + "any: TypeError: Promise.any expects a synchronous iterable, received null.", + true, + "any: TypeError: Promise.any expects a synchronous iterable, received undefined.", + true, + "any: TypeError: Promise.any expects a synchronous iterable, received a boolean.", + true, + "any: TypeError: Iterator method result must be an object.", + true, + "any: Error: boom", + true, + "any: TypeError: Iterator method must be a function.", + true, + "race: TypeError: Promise.race expects a synchronous iterable, received a number.", + true, + "race: TypeError: Promise.race expects a synchronous iterable, received null.", + true, + "race: TypeError: Promise.race expects a synchronous iterable, received undefined.", + true, + "race: TypeError: Promise.race expects a synchronous iterable, received a boolean.", + true, + "race: TypeError: Iterator method result must be an object.", + true, + "race: Error: boom", + true, + "race: TypeError: Iterator method must be a function.", + "next0,next1,next2,stop" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-property-descriptors.js b/packages/codemode-rust/conformance/cases/std-property-descriptors.js new file mode 100644 index 0000000000000..f056ca4419692 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-property-descriptors.js @@ -0,0 +1,33 @@ +// Object.defineProperty, defineProperties, getOwnPropertyDescriptor(s), getOwnPropertyNames and Object.create with +// descriptors: data and accessor descriptors, defaults, redefinition rules, array elements and lengths, and the +// integrity checks. +const out = [] +const probe = (f) => { try { out.push(f()) } catch (e) { out.push([e.name, e.message]) } } +const o = { a: 1 } +Object.defineProperty(o, "b", { value: 2 }) +Object.defineProperty(o, "c", { get() { return 3 }, enumerable: true, configurable: true }) +probe(() => [Object.keys(o), o.b, o.c, Object.getOwnPropertyNames(o)]) +probe(() => Object.getOwnPropertyDescriptors(o)) +probe(() => Object.defineProperty(o, "b", { value: 9 })) +probe(() => Object.defineProperty(o, "b", { value: 2 }) === o) +probe(() => { Object.defineProperty(o, "c", { value: 4 }); return Object.getOwnPropertyDescriptor(o, "c") }) +probe(() => Object.defineProperty(o, "d", { get() {}, value: 1 })) +probe(() => Object.defineProperty(o, "d", { get: 1 })) +probe(() => Object.defineProperty(1, "d", {})) +probe(() => { const p = Object.create({}, { x: { get() { return 1 }, enumerable: true }, y: { value: 2, writable: true } }); return [p.x, p.y, Object.keys(p)] }) +probe(() => { const p = {}; Object.defineProperties(p, { a: { value: 1, enumerable: true }, b: { get() { return this.a + 1 } } }); return [p.b, Object.keys(p)] }) +probe(() => { const arr = [1, 2]; Object.defineProperty(arr, 0, { value: 5 }); return arr }) +probe(() => Object.defineProperty([1], 0, { get() {} })) +probe(() => Object.defineProperty([1], 0, { value: 1, enumerable: false })) +probe(() => { const arr = [1, 2, 3]; Object.defineProperty(arr, "length", { value: 1 }); return arr }) +probe(() => Object.defineProperty([], "length", { writable: false })) +probe(() => { function f(a, b) {} return [Object.getOwnPropertyNames(f), Object.getOwnPropertyDescriptor(f, "name")] }) +probe(() => [Object.getOwnPropertyDescriptor("ab", 1), Object.getOwnPropertyNames("ab"), Object.getOwnPropertyDescriptor(Math, "PI")]) +probe(() => { const d = Object.getOwnPropertyDescriptor(Map.prototype, "size"); return [d.get.name, d.set, d.get.call(new Map([[1, 2]]))] }) +probe(() => Object.getOwnPropertyDescriptor(Map.prototype, "size").get.call(new Set())) +probe(() => { const s = {}; Object.defineProperty(s, "a", { value: 1 }); Object.preventExtensions(s); return [Object.isFrozen(s), Object.isSealed(s)] }) +probe(() => { const s = {}; Object.defineProperty(s, "a", { get() {}, set(v) {} }); Object.preventExtensions(s); return [Object.isFrozen(s), Object.isSealed(s)] }) +probe(() => Object.defineProperty(Object.freeze({}), "a", { value: 1 })) +probe(() => Object.getOwnPropertyDescriptor(undefined, "a")) +probe(() => { let read = 0; const desc = { get value() { read++; return 42 }, get enumerable() { read++; return true } }; const t = {}; Object.defineProperty(t, "a", desc); return [t.a, read, Object.keys(t)] }) +return out diff --git a/packages/codemode-rust/conformance/cases/std-property-descriptors.json b/packages/codemode-rust/conformance/cases/std-property-descriptors.json new file mode 100644 index 0000000000000..4a2d6797c8209 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-property-descriptors.json @@ -0,0 +1,157 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + [ + "a", + "c" + ], + 2, + 3, + [ + "a", + "b", + "c" + ] + ], + { + "a": { + "value": 1, + "writable": true, + "enumerable": true, + "configurable": true + }, + "b": { + "value": 2, + "writable": false, + "enumerable": false, + "configurable": false + }, + "c": { + "enumerable": true, + "configurable": true + } + }, + [ + "TypeError", + "Cannot redefine property: b" + ], + true, + { + "value": 4, + "writable": false, + "enumerable": true, + "configurable": true + }, + [ + "TypeError", + "Invalid property descriptor. Cannot both specify accessors and a value or writable attribute." + ], + [ + "TypeError", + "Getter must be a function: a number" + ], + [ + "TypeError", + "Object.defineProperty called on non-object" + ], + [ + 1, + 2, + [ + "x" + ] + ], + [ + 2, + [ + "a" + ] + ], + [ + 5, + 2 + ], + [ + "TypeError", + "Accessor properties are not supported on array elements; store the value or use a plain object." + ], + [ + "TypeError", + "Array elements share their attributes; only writable, enumerable and configurable equal to the array's are supported." + ], + [ + 1 + ], + [ + "TypeError", + "Making an array's length read-only is not supported; use Object.freeze." + ], + [ + [ + "length", + "name" + ], + { + "value": "f", + "writable": false, + "enumerable": false, + "configurable": true + } + ], + [ + { + "value": "b", + "writable": false, + "enumerable": true, + "configurable": false + }, + [ + "0", + "1", + "length" + ], + { + "value": 3.141592653589793, + "writable": false, + "enumerable": false, + "configurable": false + } + ], + [ + "get size", + null, + 1 + ], + [ + "TypeError", + "Map.prototype.size called on incompatible receiver a Set." + ], + [ + true, + true + ], + [ + true, + true + ], + [ + "TypeError", + "Cannot define property a, object is not extensible" + ], + [ + "TypeError", + "Object.getOwnPropertyDescriptor cannot convert undefined to an object." + ], + [ + 42, + 2, + [ + "a" + ] + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-prototype-accessors.js b/packages/codemode-rust/conformance/cases/std-prototype-accessors.js new file mode 100644 index 0000000000000..0b70295474d00 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-prototype-accessors.js @@ -0,0 +1,9 @@ +const out = [] +const probe = (f) => { try { out.push(f()) } catch (e) { out.push([e.name, e.message]) } } +for (const k of ["source", "flags", "lastIndex", "global", "ignoreCase", "multiline", "dotAll", "unicode", "unicodeSets", "sticky", "hasIndices"]) probe(() => RegExp.prototype[k]) +probe(() => Uint8Array.prototype.length); probe(() => Map.prototype.size); probe(() => Set.prototype.size); probe(() => URLSearchParams.prototype.size); probe(() => URL.prototype.href); probe(() => URL.prototype.searchParams); probe(() => TextDecoder.prototype.encoding); probe(() => TextEncoder.prototype.encoding) +probe(() => Object.create(RegExp.prototype).global); probe(() => Object.create(Map.prototype).size) +probe(() => [/a/g.global, /a/.source, new Map([[1, 1]]).size, new Uint8Array(3).length, "global" in RegExp.prototype, RegExp.prototype.hasOwnProperty("global"), Object.keys(RegExp.prototype), /x/y.flags, new URL("https://a.test").href, new TextDecoder().encoding]) +probe(() => { RegExp.prototype.global = 1 }) +probe(() => { const re = /a/g; re.lastIndex = 3; return [re.lastIndex, re.hasOwnProperty("lastIndex")] }) +return out diff --git a/packages/codemode-rust/conformance/cases/std-prototype-accessors.json b/packages/codemode-rust/conformance/cases/std-prototype-accessors.json new file mode 100644 index 0000000000000..5dcdc1011515a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-prototype-accessors.json @@ -0,0 +1,109 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "TypeError", + "RegExp.prototype.source called on incompatible receiver a data object." + ], + [ + "TypeError", + "RegExp.prototype.flags called on incompatible receiver a data object." + ], + [ + "TypeError", + "RegExp.prototype.lastIndex called on incompatible receiver a data object." + ], + [ + "TypeError", + "RegExp.prototype.global called on incompatible receiver a data object." + ], + [ + "TypeError", + "RegExp.prototype.ignoreCase called on incompatible receiver a data object." + ], + [ + "TypeError", + "RegExp.prototype.multiline called on incompatible receiver a data object." + ], + [ + "TypeError", + "RegExp.prototype.dotAll called on incompatible receiver a data object." + ], + [ + "TypeError", + "RegExp.prototype.unicode called on incompatible receiver a data object." + ], + [ + "TypeError", + "RegExp.prototype.unicodeSets called on incompatible receiver a data object." + ], + [ + "TypeError", + "RegExp.prototype.sticky called on incompatible receiver a data object." + ], + [ + "TypeError", + "RegExp.prototype.hasIndices called on incompatible receiver a data object." + ], + [ + "TypeError", + "Uint8Array.prototype.length called on incompatible receiver a data object." + ], + [ + "TypeError", + "Map.prototype.size called on incompatible receiver a data object." + ], + [ + "TypeError", + "Set.prototype.size called on incompatible receiver a data object." + ], + [ + "TypeError", + "URLSearchParams.prototype.size called on incompatible receiver a data object." + ], + [ + "TypeError", + "URL.prototype.href called on incompatible receiver a data object." + ], + [ + "TypeError", + "URL.prototype.searchParams called on incompatible receiver a data object." + ], + [ + "TypeError", + "TextDecoder.prototype.encoding called on incompatible receiver a data object." + ], + "utf-8", + [ + "TypeError", + "RegExp.prototype.global called on incompatible receiver a data object." + ], + [ + "TypeError", + "Map.prototype.size called on incompatible receiver a data object." + ], + [ + true, + "a", + 1, + 3, + true, + true, + [], + "y", + "https://a.test/", + "utf-8" + ], + [ + "TypeError", + "Cannot set property 'global' of a data object which has only a getter." + ], + [ + 3, + false + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-readonly-accessors.js b/packages/codemode-rust/conformance/cases/std-readonly-accessors.js new file mode 100644 index 0000000000000..836d6af68d8a0 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-readonly-accessors.js @@ -0,0 +1,4 @@ +const r = [] +for (const f of [() => { /x/.source = 1 }, () => { new Uint8Array(1).length = 3 }, () => { new URLSearchParams().size = 3 }, () => { new TextDecoder().encoding = "x" }, () => { /x/.lastIndex = 2; return 1 }]) { try { r.push(f()) } catch (e) { r.push(e.message) } } +for (const f of [() => { new Map().size = 1 }, () => { new Set().size = 1 }]) { try { r.push(f()) } catch (e) { r.push(e.message) } } +return r diff --git a/packages/codemode-rust/conformance/cases/std-readonly-accessors.json b/packages/codemode-rust/conformance/cases/std-readonly-accessors.json new file mode 100644 index 0000000000000..1f8e563b502dd --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-readonly-accessors.json @@ -0,0 +1,15 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "Cannot set property 'source' of a RegExp which has only a getter.", + "Cannot set property 'length' of a Uint8Array which has only a getter.", + "Cannot set property 'size' of a URLSearchParams which has only a getter.", + "Cannot set property 'encoding' of a data object which has only a getter.", + 1, + "Cannot set property 'size' of a Map which has only a getter.", + "Cannot set property 'size' of a Set which has only a getter." + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-regexp-duplicate-names.js b/packages/codemode-rust/conformance/cases/std-regexp-duplicate-names.js new file mode 100644 index 0000000000000..87b73ab08ad97 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-regexp-duplicate-names.js @@ -0,0 +1,23 @@ +const out = [] +const t = (src, flags, s) => { try { const m = new RegExp(src, flags).exec(s); out.push(m ? [...m].map(String).join("|") + " " + JSON.stringify(m.groups) : "null") } catch (e) { out.push(e.name) } } +t("(?:(?x)|(?y))\\k", "", "xx") +t("(?:(?x)|(?y))\\k", "", "yy") +t("(?:(?x)|(?y))\\k", "", "xy") +t("(?:(?x)|(?y))\\k", "i", "YY") +t("\\k(?:(?x)|(?y))", "", "y") +t("(?x)|(?y)", "", "y") +t("(?:(?:(?x)|(?y))\\k){2}", "", "xxyy") +t("(?:(?x)|(?y)|(?z))\\k\\k", "", "z") +t("(?<=\\k(?:(?x)|(?y)))z", "", "yyz") +t("(?<=(?:(?x)|(?y))\\k)z", "", "xxz") +t("(?:(?x)|(?y))[\\k]", "", "xk") +t("\\((?x)|(?y)\\)\\k", "", "y)y") +t("(?:(?x)|(?y))[[a-z]--[x]]\\k", "v", "yzy") +t("(?:(?x)|(?y))\\k", "u", "yy") +t("(?:(?x)|(?y))\\k0", "", "yy0") +t("(.)(?:(?x)|(?y))\\k\\1", "", "qyyq") +t("(?x)\\k", "", "xx") +t("(?:(?x)|(?y))\\k", "", "xx") +t("(?x)(?y)", "", "xy") +out.push("xyyx".replace(/(?:(?x)|(?y))\k/g, "[$]")) +return out diff --git a/packages/codemode-rust/conformance/cases/std-regexp-duplicate-names.json b/packages/codemode-rust/conformance/cases/std-regexp-duplicate-names.json new file mode 100644 index 0000000000000..2dfcb8a1c5a45 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-regexp-duplicate-names.json @@ -0,0 +1,28 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "xx|x|undefined {\"a\":\"x\"}", + "yy|undefined|y {\"a\":\"y\"}", + "null", + "YY|undefined|Y {\"a\":\"Y\"}", + "y|undefined|y {\"a\":\"y\"}", + "y|undefined|y {\"a\":\"y\"}", + "xxyy|undefined|y {\"a\":\"y\"}", + "null", + "z|undefined|y {\"a\":\"y\"}", + "z|x|undefined {\"a\":\"x\"}", + "SyntaxError", + "y)y|undefined|y {\"a\":\"y\"}", + "yzy|undefined|y {\"a\":\"y\"}", + "yy|undefined|y {\"a\":\"y\"}", + "yy0|undefined|y {\"a\":\"y\"}", + "qyyq|q|undefined|y {\"a\":\"y\"}", + "xx|x {\"a\":\"x\"}", + "SyntaxError", + "SyntaxError", + "x[y]x" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-regexp-exec.js b/packages/codemode-rust/conformance/cases/std-regexp-exec.js new file mode 100644 index 0000000000000..de9010ac4be73 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-regexp-exec.js @@ -0,0 +1,28 @@ +const out = [] +const r = /(?\d{4})-(?\d\d)/d +const m = r.exec("on 2024-05 ok") +out.push([...m], m.index, m.input, m.groups, m.indices.map((x) => x), m.indices.groups) +out.push("aXbXc".split(/x/i), "abc".split(/(b)/), "".split(/a/), "".split(/(?:)/), "test".split(/(?:)/, 2), "a1b22c".split(/\d+/)) +out.push("x".replace(/x/, "$|$1|$0|$&|$$"), "abc".replace(/(?b)/, "[$]"), "aaa".replace(/a/g, "b"), "abc".replace(/(.)/g, "$1$1")) +out.push("a-b-c".replace(/-/g, (m, off, s) => `${m}${off}`), "John Smith".replace(/(\w+)\s(\w+)/, "$2, $1")) +const g = /o/g +out.push(g.test("foo"), g.lastIndex, g.test("foo"), g.lastIndex, g.test("foo"), g.lastIndex) +out.push("foo bar foo".match(/foo/g), "foo".match(/x/), "abc".match(/b/).index, "abc".search(/c/), "abc".search("z")) +out.push([..."a1b2c3".matchAll(/[a-z](\d)/g)].map((m) => [m[0], m[1], m.index])) +out.push(String(/a\/b/gi), /x/y.flags, /x/.source, new RegExp("a/b", "g").source, new RegExp("").source, RegExp("x", "i").ignoreCase) +out.push(/a/.global, /a/g.global, /a/s.dotAll, /a/m.multiline, /a/u.unicode, /a/y.sticky, /a/d.hasIndices) +const re = /a/g +re.lastIndex = "2" +out.push(re.lastIndex, re.hasOwnProperty("lastIndex"), Object.keys(re), JSON.stringify(re), typeof re, re instanceof RegExp, Object.prototype.toString.call(re)) +out.push("héllo wörld".replace(/ö/, "o"), "héllo".match(/l+/).index, "😀a😀b".split(/[ab]/), "😀".match(/./)[0].length, "😀".match(/./u)[0].length) +out.push(RegExp.escape("1a.b-c"), "a.b.c".replaceAll(".", "!"), "a.b.c".replaceAll(/\./g, "!")) +try { "x".replaceAll(/x/, "y") } catch (e) { out.push(e.name) } +try { new RegExp("(") } catch (e) { out.push(e.name) } +try { "x".includes(/x/) } catch (e) { out.push(e.name) } +console.log(/ab+c/gi, [/x/]) +out.push("a1b2".replace(/(?\d)/g, (...args) => JSON.stringify(args))) +out.push("aaa".lastIndexOf("a"), /\bfoo\b/.test("a foo b"), /^\p{Lu}/u.test("Éa"), /[\u{1F600}]/u.test("😀")) +const sticky = /foo/y +sticky.lastIndex = 3 +out.push(sticky.test("barfoo"), sticky.lastIndex, sticky.test("barfoo"), sticky.lastIndex) +return out diff --git a/packages/codemode-rust/conformance/cases/std-regexp-exec.json b/packages/codemode-rust/conformance/cases/std-regexp-exec.json new file mode 100644 index 0000000000000..86c0099de35a8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-regexp-exec.json @@ -0,0 +1,149 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "2024-05", + "2024", + "05" + ], + 3, + "on 2024-05 ok", + { + "y": "2024", + "m": "05" + }, + [ + [ + 3, + 10 + ], + [ + 3, + 7 + ], + [ + 8, + 10 + ] + ], + { + "y": [ + 3, + 7 + ], + "m": [ + 8, + 10 + ] + }, + [ + "a", + "b", + "c" + ], + [ + "a", + "b", + "c" + ], + [ + "" + ], + [], + [ + "t", + "e" + ], + [ + "a", + "b", + "c" + ], + "$|$1|$0|x|$", + "a[b]c", + "bbb", + "aabbcc", + "a-1b-3c", + "Smith, John", + true, + 2, + true, + 3, + false, + 0, + [ + "foo", + "foo" + ], + null, + 1, + 2, + -1, + [ + [ + "a1", + "1", + 0 + ], + [ + "b2", + "2", + 2 + ], + [ + "c3", + "3", + 4 + ] + ], + "/a\\/b/gi", + "y", + "x", + "a\\/b", + "(?:)", + true, + false, + true, + true, + true, + true, + true, + true, + 2, + false, + [], + "{}", + "object", + true, + "[object RegExp]", + "héllo world", + 2, + [ + "😀", + "😀", + "" + ], + 1, + 2, + "\\x31a\\.b\\x2dc", + "a!b!c", + "a!b!c", + "TypeError", + "SyntaxError", + "TypeError", + "a[\"1\",\"1\",1,\"a1b2\",{\"d\":\"1\"}]b[\"2\",\"2\",3,\"a1b2\",{\"d\":\"2\"}]", + 2, + true, + true, + true, + true, + 6, + false, + 0 + ], + "logs": [ + "/ab+c/gi [/x/]" + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-regexp-string-methods.js b/packages/codemode-rust/conformance/cases/std-regexp-string-methods.js new file mode 100644 index 0000000000000..26e31db21261a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-regexp-string-methods.js @@ -0,0 +1,21 @@ +const out = [] +out.push("a1b".match(1), "xnullx".search(null), "abc".match(), "abc".matchAll ? [..."abc".matchAll()].length : 0, "a.b".match("."), "a+b".search({ toString() { return "\\+" } })) +try { "abc".match("(") } catch (e) { out.push(e.name, e.message.slice(0, 40)) } +try { "abc".matchAll(/a/) } catch (e) { out.push(e.name) } +out.push("3.7".replace(/\d\.\d/, Math.floor), "abc".replace(/b/, () => Promise.resolve(1))) +out.push("aaa".split(/a/), "a,b,c".split(/,/, 2), "abc".split(/(?:)/u), "a b c".split(/\s+/), "Hello".split(/(l)/)) +out.push("x".replace(/(y)?x/, "[$1]"), "abc".replace(/b/, "$`|$'"), "abc".replace(/(b)/, "$01$10$2"), "abc".replace("b", "$&$&"), "abc".replace("b", "$1")) +const r = /a/g; r.lastIndex = 5; out.push("aaa".match(r), r.lastIndex) +const r2 = /a/g; r2.lastIndex = 1; out.push([..."aaa".matchAll(r2)].length, r2.lastIndex) +const r3 = /a/y; out.push("baa".replace(r3, "x"), r3.lastIndex) +out.push(new RegExp(/ab/g).flags, new RegExp(/ab/g, "i").flags, new RegExp(/ab/g).source) +try { new RegExp("a", 1) } catch (e) { out.push(e.name, e.message) } +try { new RegExp("a", "gg") } catch (e) { out.push(e.name, e.message) } +out.push(/[/]/.source, /\//.source, `${/x/g}`, /x/ + "", /(a)|(b)/.exec("b")) +const re = /(\d+)/g +let m, found = [] +while ((m = re.exec("1 22 333")) !== null) found.push(m[1], re.lastIndex) +out.push(found) +out.push("ab".replace(/(?:)/g, "-"), "😀".replace(/(?:)/gu, "-"), "😀".replace(/(?:)/g, "-").length) +out.push(/a/i.test("A"), /ß/i.test("SS"), /\u212A/i.test("k"), /\u212A/iu.test("k")) +return out diff --git a/packages/codemode-rust/conformance/cases/std-regexp-string-methods.json b/packages/codemode-rust/conformance/cases/std-regexp-string-methods.json new file mode 100644 index 0000000000000..0af9f42894834 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-regexp-string-methods.json @@ -0,0 +1,98 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "1" + ], + 1, + [ + "" + ], + 4, + [ + "a" + ], + 1, + "SyntaxError", + "String.match received the string \"(\", wh", + "TypeError", + "3", + "a[object Promise]c", + [ + "", + "", + "", + "" + ], + [ + "a", + "b" + ], + [ + "a", + "b", + "c" + ], + [ + "a", + "b", + "c" + ], + [ + "He", + "l", + "", + "l", + "o" + ], + "[]", + "aa|cc", + "abb0$2c", + "abbc", + "a$1c", + [ + "a", + "a", + "a" + ], + 0, + 2, + 1, + "baa", + 0, + "g", + "i", + "ab", + "SyntaxError", + "RegExp flags must be a string of flag characters (e.g. \"g\", \"gi\"), not number.", + "SyntaxError", + "new RegExp(...) received invalid flags \"gg\" (Invalid flags supplied to RegExp constructor.). Valid flags are d, g, i, m, s, u, v, and y.", + "[/]", + "\\/", + "/x/g", + "/x/", + [ + "b", + null, + "b" + ], + [ + "1", + 1, + "22", + 4, + "333", + 8 + ], + "-a-b-", + "-😀-", + 5, + true, + false, + false, + true + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-regexp-syntax-errors.js b/packages/codemode-rust/conformance/cases/std-regexp-syntax-errors.js new file mode 100644 index 0000000000000..a770e518871db --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-regexp-syntax-errors.js @@ -0,0 +1,8 @@ +const pats = ["(", ")", "a)", "(?", "(?x)", "(?<", "(?x)", "(?x)(?y)", "[", "[b-a]", "a**", "*", "+a", "?", "a{2,1}", "a{99999999999}", "{", "}", "]", "a{1", "\\", "a\\", "\\u{110000}", "\\u{zz}", "\\uzz", "\\k", "(?x)\\k", "(?x)\\k.)", "(?x)", "(?<\\u{61}>x)\\k"] +const out = [] +for (const flags of ["", "u", "v"]) { + for (const p of pats) { + try { new RegExp(p, flags); out.push(flags + " " + JSON.stringify(p) + " ok") } catch (e) { out.push(flags + " " + JSON.stringify(p) + " " + (e.message.match(/\(([^()]*(?:\([^()]*\)[^()]*)*)\)\. To match/) || [, e.message])[1]) } + } +} +return out diff --git a/packages/codemode-rust/conformance/cases/std-regexp-syntax-errors.json b/packages/codemode-rust/conformance/cases/std-regexp-syntax-errors.json new file mode 100644 index 0000000000000..e9dde57c5f8d9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-regexp-syntax-errors.json @@ -0,0 +1,263 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + " \"(\" \", which is not a valid regular expression pattern (missing )", + " \")\" unmatched parentheses", + " \"a)\" unmatched parentheses", + " \"(?\" ?", + " \"(?x)\" ?", + " \"(?<\" invalid group specifier name", + " \"(?x)\" invalid group specifier name", + " \"(?x)(?y)\" duplicate group specifier name", + " \"[\" missing terminating ] for character class", + " \"[b-a]\" range out of order in character class", + " \"a**\" nothing to repeat", + " \"*\" nothing to repeat", + " \"+a\" nothing to repeat", + " \"?\" nothing to repeat", + " \"a{2,1}\" numbers out of order in {} quantifier", + " \"a{99999999999}\" ok", + " \"{\" ok", + " \"}\" ok", + " \"]\" ok", + " \"a{1\" ok", + " \"\\\\\" \\ at end of pattern", + " \"a\\\\\" \\ at end of pattern", + " \"\\\\u{110000}\" ok", + " \"\\\\u{zz}\" ok", + " \"\\\\uzz\" ok", + " \"\\\\k\" ok", + " \"(?x)\\\\k\" invalid \\k<> named backreference", + " \"(?x)\\\\k named backreference", + " \"\\\\k\" ok", + " \"\\\\1\" ok", + " \"(a)\\\\2\" ok", + " \"\\\\c\" ok", + " \"\\\\c1\" ok", + " \"\\\\01\" ok", + " \"\\\\8\" ok", + " \"\\\\-\" ok", + " \"\\\\a\" ok", + " \"\\\\p{Foo}\" ok", + " \"\\\\p{L\" ok", + " \"\\\\P\" ok", + " \"[\\\\d-a]\" ok", + " \"[a-\\\\d]\" ok", + " \"[\\\\w-z]\" ok", + " \"(?=a)*\" ok", + " \"(?<=a)+\" invalid quantifier", + " \"\\\\b*\" nothing to repeat", + " \"^*\" nothing to repeat", + " \"$+\" nothing to repeat", + " \"(?i:a\" ?i:a\", which is not a valid regular expression pattern (missing )", + " \"(?i-i:a)\" invalid regular expression modifier", + " \"(?ii:a)\" invalid regular expression modifier", + " \"(?z:a)\" ?", + " \"(?-:a)\" invalid regular expression modifier", + " \"[\\\\q{a}]\" ok", + " \"[a&&b]\" ok", + " \"[a--b]\" range out of order in character class", + " \"[[a]\" ok", + " \"[a]]\" ok", + " \"[a-]\" ok", + " \"[(]\" ok", + " \"[a&&&b]\" ok", + " \"[^\\\\q{ab}]\" ok", + " \"[a--]\" range out of order in character class", + " \"x{2}{3}\" nothing to repeat", + " \"a{,2}\" ok", + " \"(?:\" ?:\", which is not a valid regular expression pattern (missing )", + " \"(?:a|b\" ?:a|b\", which is not a valid regular expression pattern (missing )", + " \"a|*\" nothing to repeat", + " \"(*)\" nothing to repeat", + " \"[]]\" ok", + " \"\\\\x\" ok", + " \"\\\\x1\" ok", + " \"\\\\u12\" ok", + " \"\\\\u{12\" ok", + " \"[\\\\u{110000}]\" ok", + " \"a{2,\" ok", + " \"a{2,3\" ok", + " \"\\\\p{Script=Foo}\" ok", + " \"\\\\p{RGI_Emoji}\" ok", + " \"[\\\\p{RGI_Emoji}--a]\" range out of order in character class", + " \"\\\\q{a}\" ok", + " \"(?<𝒜>.)\" ok", + " \"(?x)\" ok", + " \"(?<\\\\u{61}>x)\\\\k\" ok", + "u \"(\" \", which is not a valid regular expression pattern (missing )", + "u \")\" unmatched parentheses", + "u \"a)\" unmatched parentheses", + "u \"(?\" ?", + "u \"(?x)\" ?", + "u \"(?<\" invalid group specifier name", + "u \"(?x)\" invalid group specifier name", + "u \"(?x)(?y)\" duplicate group specifier name", + "u \"[\" missing terminating ] for character class", + "u \"[b-a]\" range out of order in character class", + "u \"a**\" nothing to repeat", + "u \"*\" nothing to repeat", + "u \"+a\" nothing to repeat", + "u \"?\" nothing to repeat", + "u \"a{2,1}\" numbers out of order in {} quantifier", + "u \"a{99999999999}\" ok", + "u \"{\" incomplete {} quantifier for Unicode pattern", + "u \"}\" unmatched ] or } bracket for Unicode pattern", + "u \"]\" unmatched ] or } bracket for Unicode pattern", + "u \"a{1\" incomplete {} quantifier for Unicode pattern", + "u \"\\\\\" \\ at end of pattern", + "u \"a\\\\\" \\ at end of pattern", + "u \"\\\\u{110000}\" invalid Unicode code point \\u{} escape", + "u \"\\\\u{zz}\" invalid Unicode code point \\u{} escape", + "u \"\\\\uzz\" invalid Unicode \\u escape", + "u \"\\\\k\" invalid \\k<> named backreference", + "u \"(?x)\\\\k\" invalid \\k<> named backreference", + "u \"(?x)\\\\k.)\" ok", + "u \"(?x)\" ok", + "u \"(?<\\\\u{61}>x)\\\\k\" ok", + "v \"(\" \", which is not a valid regular expression pattern (missing )", + "v \")\" unmatched parentheses", + "v \"a)\" unmatched parentheses", + "v \"(?\" ?", + "v \"(?x)\" ?", + "v \"(?<\" invalid group specifier name", + "v \"(?x)\" invalid group specifier name", + "v \"(?x)(?y)\" duplicate group specifier name", + "v \"[\" missing terminating ] for character class", + "v \"[b-a]\" range out of order in character class", + "v \"a**\" nothing to repeat", + "v \"*\" nothing to repeat", + "v \"+a\" nothing to repeat", + "v \"?\" nothing to repeat", + "v \"a{2,1}\" numbers out of order in {} quantifier", + "v \"a{99999999999}\" ok", + "v \"{\" incomplete {} quantifier for Unicode pattern", + "v \"}\" unmatched ] or } bracket for Unicode pattern", + "v \"]\" unmatched ] or } bracket for Unicode pattern", + "v \"a{1\" incomplete {} quantifier for Unicode pattern", + "v \"\\\\\" \\ at end of pattern", + "v \"a\\\\\" \\ at end of pattern", + "v \"\\\\u{110000}\" invalid Unicode code point \\u{} escape", + "v \"\\\\u{zz}\" invalid Unicode code point \\u{} escape", + "v \"\\\\uzz\" invalid Unicode \\u escape", + "v \"\\\\k\" invalid \\k<> named backreference", + "v \"(?x)\\\\k\" invalid \\k<> named backreference", + "v \"(?x)\\\\k.)\" ok", + "v \"(?x)\" ok", + "v \"(?<\\\\u{61}>x)\\\\k\" ok" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-set-methods-test262.js b/packages/codemode-rust/conformance/cases/std-set-methods-test262.js new file mode 100644 index 0000000000000..3b72ab54f793a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-set-methods-test262.js @@ -0,0 +1,286 @@ +const out = [] +out.push(await (async () => { + + const left = new Set([1, 2]) + const right = new Set([2, 3]) + const union = left.union(right) + const intersection = left.intersection(right) + const difference = left.difference(right) + const symmetric = left.symmetricDifference(right) + return [ + [...union], union instanceof Set, + [...intersection], intersection instanceof Set, + [...difference], difference instanceof Set, + [...symmetric], symmetric instanceof Set, + [...left], [...right], + [...left.union(left)], left.union(left) !== left, + [...left.intersection(left)], left.intersection(left) !== left, + [...left.difference(left)], left.difference(left) !== left, + [...left.symmetricDifference(left)], left.symmetricDifference(left) !== left, + [...left.union(new Set())], [...new Set().union(left)], + ] + +})().then((v) => [0, v], (e) => [0, "threw", e?.name, e?.message])) +out.push(await (async () => { + + return [ + [...new Set([1, 3, 5]).intersection(new Set([3, 2, 1]))], + [...new Set([3, 2, 1, 0]).intersection(new Set([1, 3, 5]))], + [...new Set([1, 2, 3, 4]).difference(new Set([6, 5, 3, 2]))], + [...new Set([6, 5, 3, 2]).difference(new Set([1, 2, 3, 4]))], + [...new Set([1, 2, 3, 4]).symmetricDifference(new Set([6, 5, 4, 3]))], + [...new Set([2, 3]).union(new Set([1, 2]))], + [...new Set([1, 2, -3]).union(new Set([-1, 0]))], + ] + +})().then((v) => [1, v], (e) => [1, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const set = new Set([1, 2]) + const map = new Map([[2, "two"], [3, "three"]]) + return [ + [...set.union(map)], + [...set.intersection(map)], + [...set.difference(map)], + [...set.symmetricDifference(map)], + ] + +})().then((v) => [2, v], (e) => [2, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const keysOnly = { + size: 1, + has: () => { throw new Error("has should not be called") }, + keys: () => [2, 3], + } + const hasOnly = { + size: 2, + has: (value) => value === 2, + keys: () => { throw new Error("keys should not be called") }, + } + const set = new Set([1, 2]) + return [ + [...set.union(keysOnly)], + [...set.intersection(hasOnly)], + [...set.difference(hasOnly)], + [...set.symmetricDifference(keysOnly)], + ] + +})().then((v) => [3, v], (e) => [3, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const setlike = { + size: 1, + has: () => { throw new Error("has should not be called") }, + keys: () => [-0], + } + return [ + 1 / [...new Set([1]).union(setlike)][1] === Infinity, + 1 / [...new Set([0, 1, 2]).intersection(setlike)][0] === Infinity, + [...new Set([0, 1]).difference(setlike)], + 1 / [...new Set([1, 2]).symmetricDifference(setlike)][2] === Infinity, + ] + +})().then((v) => [4, v], (e) => [4, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const other = { + size: 4, + has: () => { throw new Error("has should not be called") }, + keys: () => [2, 2, 3, 3], + } + return [...new Set([1, 2]).symmetricDifference(other)] + +})().then((v) => [5, v], (e) => [5, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const unionBase = new Set(["a", "b", "c", "d", "e"]) + const unionOther = { + size: 2, + has: () => { throw new Error("has should not be called") }, + keys: () => { + unionBase.delete("b") + unionBase.delete("c") + unionBase.add("b") + return ["x", "y"] + }, + } + const union = unionBase.union(unionOther) + + const intersectionBase = new Set(["a", "b", "c", "d", "e"]) + const intersectionOther = { + size: 3, + has: () => { throw new Error("has should not be called") }, + keys: () => { + intersectionBase.delete("b") + intersectionBase.delete("c") + intersectionBase.add("b") + return ["x", "b", "b"] + }, + } + const intersection = intersectionBase.intersection(intersectionOther) + + const differenceBase = new Set(["a", "b", "c", "d", "e"]) + const differenceOther = { + size: 3, + has: () => { throw new Error("has should not be called") }, + keys: () => { + differenceBase.delete("b") + differenceBase.delete("c") + differenceBase.add("b") + return ["x", "b", "b"] + }, + } + const difference = differenceBase.difference(differenceOther) + + const symmetricBase = new Set(["a", "b", "c", "d", "e"]) + const symmetricOther = { + size: 4, + has: () => { throw new Error("has should not be called") }, + keys: () => { + symmetricBase.delete("b") + symmetricBase.delete("c") + symmetricBase.add("b") + return ["x", "b", "c", "c"] + }, + } + const symmetric = symmetricBase.symmetricDifference(symmetricOther) + + return [ + [...union], [...unionBase], + [...intersection], [...intersectionBase], + [...difference], [...differenceBase], + [...symmetric], [...symmetricBase], + ] + +})().then((v) => [6, v], (e) => [6, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const set = new Set([1, 2]) + return [ + set.isSubsetOf(new Set([2, 3])), set.isSubsetOf(new Set([1, 2, 3])), + set.isSupersetOf(new Set([2, 3])), set.isSupersetOf(new Set([1])), + set.isDisjointFrom(new Set([2, 3])), set.isDisjointFrom(new Set([3])), + new Set().isSubsetOf(set), set.isSupersetOf(new Set()), new Set().isDisjointFrom(new Set()), + set.isSubsetOf(set), set.isSupersetOf(set), set.isDisjointFrom(set), + set.isSubsetOf(new Set([1, 2])), set.isSupersetOf(new Set([1, 2])), + ] + +})().then((v) => [7, v], (e) => [7, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const set = new Set([1, 2]) + const map = new Map([[1, "one"], [2, "two"], [3, "three"]]) + const hasOnly = { + size: 2, + has: (value) => value === 1 || value === 2, + keys: () => { throw new Error("keys should not be called") }, + } + const keysOnly = { + size: 1, + has: () => { throw new Error("has should not be called") }, + keys: () => [1], + } + return [ + set.isSubsetOf(map), set.isSupersetOf(map), set.isDisjointFrom(map), + set.isSubsetOf(hasOnly), set.isSupersetOf(keysOnly), set.isDisjointFrom(hasOnly), + ] + +})().then((v) => [8, v], (e) => [8, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const setlike = { + size: 1, + has: () => { throw new Error("has should not be called") }, + keys: () => [-0], + } + return [ + new Set([0, 1]).isSupersetOf(setlike), + new Set([0, 1]).isDisjointFrom(setlike), + ] + +})().then((v) => [9, v], (e) => [9, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const subset = new Set(["a", "b", "c"]) + const subsetOther = { + size: 3, + has: (item) => { + if (item === "a") subset.delete("c") + return ["x", "a", "b"].includes(item) + }, + keys: () => { throw new Error("keys should not be called") }, + } + const disjoint = new Set(["a", "b", "c"]) + const disjointOther = { + size: 3, + has: (item) => { + if (item === "a") { + disjoint.delete("b") + disjoint.delete("c") + disjoint.add("b") + } + if (item === "c") throw new Error("deleted value should not be visited") + return false + }, + keys: () => { throw new Error("keys should not be called") }, + } + return [ + subset.isSubsetOf(subsetOther), [...subset], + disjoint.isDisjointFrom(disjointOther), [...disjoint], + ] + +})().then((v) => [10, v], (e) => [10, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const set = new Set([1]) + const names = [] + let coercionCalls = 0 + const invalid = [ + [], + { size: undefined, has: () => false, keys: () => [] }, + { size: NaN, has: () => false, keys: () => [] }, + { size: { valueOf: () => { coercionCalls += 1; return NaN } }, has: () => false, keys: () => [] }, + { size: "string", has: () => false, keys: () => [] }, + { size: 0, has: undefined, keys: () => [] }, + { size: 0, has: {}, keys: () => [] }, + { size: 0, has: () => false, keys: undefined }, + { size: 0, has: () => false, keys: {} }, + ] + for (const other of invalid) { + try { set.union(other) } catch (error) { names.push(error.name) } + } + return [names, coercionCalls] + +})().then((v) => [11, v], (e) => [11, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const set = new Set([1]) + const invalid = { size: NaN, has: () => false, keys: () => [] } + const names = [] + const operations = [ + () => set.union(invalid), + () => set.intersection(invalid), + () => set.difference(invalid), + () => set.symmetricDifference(invalid), + () => set.isSubsetOf(invalid), + () => set.isSupersetOf(invalid), + () => set.isDisjointFrom(invalid), + ] + for (const operation of operations) { + try { operation() } catch (error) { names.push(error.name) } + } + return names + +})().then((v) => [12, v], (e) => [12, "threw", e?.name, e?.message])) +out.push(await (async () => { + + const set = new Set([1]) + const names = [] + for (const keys of [() => "ab", () => new Set([2]), () => new Map([[2, true]])]) { + try { set.union({ size: 1, has: () => false, keys }) } catch (error) { names.push(error.name) } + } + return names + +})().then((v) => [13, v], (e) => [13, "threw", e?.name, e?.message])) +return out diff --git a/packages/codemode-rust/conformance/cases/std-set-methods-test262.json b/packages/codemode-rust/conformance/cases/std-set-methods-test262.json new file mode 100644 index 0000000000000..7e520cc3dbb90 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-set-methods-test262.json @@ -0,0 +1,302 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 0, + [ + [ + 1, + 2, + 3 + ], + true, + [ + 2 + ], + true, + [ + 1 + ], + true, + [ + 1, + 3 + ], + true, + [ + 1, + 2 + ], + [ + 2, + 3 + ], + [ + 1, + 2 + ], + true, + [ + 1, + 2 + ], + true, + [], + true, + [], + true, + [ + 1, + 2 + ], + [ + 1, + 2 + ] + ] + ], + [ + 1, + [ + [ + 1, + 3 + ], + [ + 1, + 3 + ], + [ + 1, + 4 + ], + [ + 6, + 5 + ], + [ + 1, + 2, + 6, + 5 + ], + [ + 2, + 3, + 1 + ], + [ + 1, + 2, + -3, + -1, + 0 + ] + ] + ], + [ + 2, + [ + [ + 1, + 2, + 3 + ], + [ + 2 + ], + [ + 1 + ], + [ + 1, + 3 + ] + ] + ], + [ + 3, + [ + [ + 1, + 2, + 3 + ], + [ + 2 + ], + [ + 1 + ], + [ + 1, + 3 + ] + ] + ], + [ + 4, + [ + true, + true, + [ + 1 + ], + true + ] + ], + [ + 5, + [ + 1, + 3 + ] + ], + [ + 6, + [ + [ + "a", + "b", + "c", + "d", + "e", + "x", + "y" + ], + [ + "a", + "d", + "e", + "b" + ], + [ + "b" + ], + [ + "a", + "d", + "e", + "b" + ], + [ + "a", + "c", + "d", + "e" + ], + [ + "a", + "d", + "e", + "b" + ], + [ + "a", + "c", + "d", + "e", + "x" + ], + [ + "a", + "d", + "e", + "b" + ] + ] + ], + [ + 7, + [ + false, + true, + false, + true, + false, + true, + true, + true, + true, + true, + true, + false, + true, + true + ] + ], + [ + 8, + [ + true, + false, + false, + true, + true, + false + ] + ], + [ + 9, + [ + true, + false + ] + ], + [ + 10, + [ + true, + [ + "a", + "b" + ], + true, + [ + "a", + "b" + ] + ] + ], + [ + 11, + [ + [ + "TypeError", + "TypeError", + "TypeError", + "TypeError", + "TypeError", + "TypeError", + "TypeError", + "TypeError", + "TypeError" + ], + 1 + ] + ], + [ + 12, + [ + "TypeError", + "TypeError", + "TypeError", + "TypeError", + "TypeError", + "TypeError", + "TypeError" + ] + ], + [ + 13, + [ + "TypeError", + "TypeError", + "TypeError" + ] + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-sparse-arrays.js b/packages/codemode-rust/conformance/cases/std-sparse-arrays.js new file mode 100644 index 0000000000000..bc5163fbbac2b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-sparse-arrays.js @@ -0,0 +1,35 @@ +const out = [] +const t = (label, f) => { try { const r = f(); out.push(label + " " + JSON.stringify(r)) } catch (e) { out.push(label + " " + e.constructor.name + ": " + e.message) } } +const mk = () => { const a = [1, 2]; a[4294967294] = "end"; a.x = 1; return a } +t("len", () => mk().length) +t("get", () => { const a = mk(); return [a[0], a[2], a[4294967294], a[4294967293], 4294967294 in a, 3 in a, a.hasOwnProperty(4294967294)] }) +t("keys", () => Object.keys(mk())) +t("forin", () => { const r = []; for (const k in mk()) r.push(k); return r }) +t("entries", () => Object.entries(mk())) +t("del", () => { const a = mk(); delete a[4294967294]; return [a.length, a[4294967294], Object.keys(a)] }) +t("setlen", () => { const a = mk(); a.length = 3; return [a.length, a[4294967294], Object.keys(a)] }) +t("setlenbig", () => { const a = mk(); a.length = 4294967295; return a.length }) +t("setlenmid", () => { const a = mk(); a.length = 20000000; return a.length }) +t("write2", () => { const a = mk(); a[10] = 5; a[4294967293] = 6; return [a.length, a[10], a[9], Object.keys(a)] }) +t("spread", () => [...mk()].length) +t("map", () => mk().map((x) => x).length) +t("slice", () => mk().slice(0, 3)) +t("sliceEnd", () => mk().slice(-1)) +t("push", () => { const a = mk(); return [a.push(9), a.length] }) +t("push2", () => { const a = []; a[4294967294] = 1; return a.push(1, 2) }) +t("pop", () => { const a = mk(); return [a.pop(), a.length] }) +t("at", () => mk().at(-1)) +t("find", () => mk().findLast((x) => x === "end")) +t("sort", () => mk().sort().length) +t("fill", () => mk().fill(0, 0, 2).slice(0, 2)) +t("isArray", () => Array.isArray(mk())) +t("structured", () => structuredClone(mk()).length) +t("assign", () => Object.keys(Object.assign({}, mk()))) +t("objspread", () => Object.keys({ ...mk() })) +t("freeze", () => { const a = mk(); Object.freeze(a); return Object.isFrozen(a) }) +t("mid", () => { const a = []; a[20000000] = 1; return [a.length, a[20000000]] }) +t("mid2", () => { const a = []; a[5000000] = 1; return a.length }) +t("shrink", () => { const a = []; a[30000000] = "z"; a[5] = "f"; a.length = 10; return [a.length, a[5], Object.keys(a), JSON.stringify(a)] }) +t("pushok", () => { const a = []; a[30000000] = 1; return [a.push(2, 3), a.length, a[30000002], a.pop(), a.length] }) +t("indexOf", () => { const a = mk(); return [a.indexOf("end", 4294967290), a.indexOf(true, Infinity), a.lastIndexOf("end", 4294967294), a.lastIndexOf(2, -4294967294), a.indexOf("end", -1), a.includes("end", 4294967290)] }) +return out diff --git a/packages/codemode-rust/conformance/cases/std-sparse-arrays.json b/packages/codemode-rust/conformance/cases/std-sparse-arrays.json new file mode 100644 index 0000000000000..39ed16c78aee3 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-sparse-arrays.json @@ -0,0 +1,39 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "len 4294967295", + "get [1,null,\"end\",null,true,false,true]", + "keys [\"0\",\"1\",\"4294967294\",\"x\"]", + "forin [\"0\",\"1\",\"4294967294\",\"x\"]", + "entries [[\"0\",1],[\"1\",2],[\"4294967294\",\"end\"],[\"x\",1]]", + "del [4294967295,null,[\"0\",\"1\",\"x\"]]", + "setlen [3,null,[\"0\",\"1\",\"x\"]]", + "setlenbig RangeError: Invalid array length", + "setlenmid RangeError: Invalid array length", + "write2 [4294967295,5,null,[\"0\",\"1\",\"10\",\"4294967293\",\"4294967294\",\"x\"]]", + "spread RangeError: Invalid array length", + "map RangeError: Invalid array length.", + "slice [1,2,null]", + "sliceEnd [\"end\"]", + "push RangeError: Length exceeded the maximum array length", + "push2 RangeError: Invalid array length", + "pop [\"end\",4294967294]", + "at \"end\"", + "find \"end\"", + "sort RangeError: Out of memory", + "fill [0,0]", + "isArray true", + "structured 4294967295", + "assign [\"0\",\"1\",\"4294967294\",\"x\"]", + "objspread [\"0\",\"1\",\"4294967294\",\"x\"]", + "freeze true", + "mid [20000001,1]", + "mid2 5000001", + "shrink [10,\"f\",[\"5\"],\"[null,null,null,null,null,\\\"f\\\",null,null,null,null]\"]", + "pushok [30000003,30000003,3,3,30000002]", + "indexOf [4294967294,-1,4294967294,1,4294967294,true]" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-string-extras.js b/packages/codemode-rust/conformance/cases/std-string-extras.js new file mode 100644 index 0000000000000..eb971fb3ba2c9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-string-extras.js @@ -0,0 +1,10 @@ +const out = [] +out.push("\u0041\u030A".normalize(), "Å".normalize("NFD").length, "fi".normalize("NFKC"), "fi".normalize("NFKD"), "abc".normalize("NFC")) +try { "a".normalize("nope") } catch (e) { out.push(e.name, e.message) } +out.push("abc".isWellFormed(), "abc".toWellFormed()) +out.push(String.raw({ raw: ["x", "y", "z"] }, 1), String.raw({ raw: { length: 2, 0: "p", 1: "q" } }, { toString() { return "!" } })) +try { String.raw({}) } catch (e) { out.push(e.name, e.message) } +try { "a".repeat(-1) } catch (e) { out.push(e.name, e.message) } +try { "a".padStart(2 ** 25) } catch (e) { out.push(e.name, e.message) } +out.push("a".split(undefined, 0), "a".split(undefined)) +return out diff --git a/packages/codemode-rust/conformance/cases/std-string-extras.json b/packages/codemode-rust/conformance/cases/std-string-extras.json new file mode 100644 index 0000000000000..d09c166d7c27f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-string-extras.json @@ -0,0 +1,29 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "Å", + 2, + "fi", + "fi", + "abc", + "RangeError", + "String.normalize expects the form \"NFC\", \"NFD\", \"NFKC\", or \"NFKD\" (got \"nope\").", + true, + "abc", + "x1yz", + "p!q", + "TypeError", + "String.raw expects a template object with a raw array.", + "RangeError", + "String.repeat expects a finite non-negative count.", + "RangeError", + "Invalid string length", + [], + [ + "a" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-sum-precise.js b/packages/codemode-rust/conformance/cases/std-sum-precise.js new file mode 100644 index 0000000000000..364252eeef118 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-sum-precise.js @@ -0,0 +1,5 @@ +let seed = 11; const rnd = () => { seed = (seed * 1103515245 + 12345) % 2147483648; return seed / 2147483648 } +const out = [...[[-1], [-0.1], [1, -1, -1], [-8.8], [-Number.MAX_VALUE]].map((a) => Math.sumPrecise(a)), Math.sumPrecise([-1e-300, 1e-300 * 0.5]), Math.sumPrecise([1e-300, -5e-301]), Math.sumPrecise([]), Object.is(Math.sumPrecise([-0]), -0), Math.sumPrecise([1e308, 1e308, -1e308]), Math.sumPrecise([1e308, 1e308]), Math.sumPrecise([5e-324, -5e-324]), Math.sumPrecise([-5e-324]), Math.sumPrecise([0.1, 0.2, 0.3])] +for (let i = 0; i < 400; i++) { const n = 1 + Math.floor(rnd() * 6); const xs = []; for (let j = 0; j < n; j++) xs.push((rnd() - 0.6) * 10 ** Math.floor(rnd() * 600 - 320)); out.push(String(Math.sumPrecise(xs))) } +for (let i = 0; i < 400; i++) { const n = 1 + Math.floor(rnd() * 4); const xs = []; for (let j = 0; j < n; j++) xs.push((rnd() - 0.5) * 2 ** Math.floor(rnd() * 20 - 10)); out.push(String(Math.sumPrecise(xs))) } +return out.map(String) diff --git a/packages/codemode-rust/conformance/cases/std-sum-precise.json b/packages/codemode-rust/conformance/cases/std-sum-precise.json new file mode 100644 index 0000000000000..6009f007af8ab --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-sum-precise.json @@ -0,0 +1,822 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "-1.0000000000000002", + "-0.10000000000000002", + "-1.0000000000000002", + "-8.800000000000002", + "-Infinity", + "-5.000000000000001e-301", + "5e-301", + "0", + "true", + "1e+308", + "Infinity", + "0", + "-5e-324", + "0.6", + "-2.1838614940643232e+178", + "-5.853192567825322e+248", + "3.08995032310486e+149", + "-3.959891557693482e+131", + "1.1640425547957423e-19", + "6.071412563323997e-130", + "-4.831666707992556e+217", + "-9.454593658447263e+53", + "6.916730999946596e-298", + "1.6332530975341826e+230", + "-3.837953567504884e+198", + "-1.7395455613732338e-102", + "-1.4581451416015626e+88", + "-5.842306375503543e+199", + "-1.7546326518058782e+240", + "-4.399809837341307e+94", + "2.1506466865539552e-8", + "7.505574226379399e+165", + "-4.856703281402588e+209", + "-4.0752599239349375e+75", + "-2.2311953306198125e+164", + "-7.845399379730225e+166", + "-3991118133068.0845", + "-4.339059352874756e-13", + "2.0122143030166637e+254", + "-4.3010172843933115e+138", + "-5.443654067941167e+217", + "-3.89238065481186e+163", + "2.7955152988433856e+273", + "8.748307228088386e+242", + "-5.1371521353721625e-158", + "3.6111068129539506e+244", + "-3.680818773806096e+220", + "-4.423521220684052e+62", + "-1.4364371299743655e+194", + "-1.216096639633179e+205", + "2.5406529903411872e+104", + "3.3164527416229267e+261", + "-1.5681955814361577e+203", + "2.928829133510591e+208", + "3.9379694461822525e+171", + "-5.881277084350588e+120", + "2.350105583667756e+215", + "-2.311332881450654e+221", + "8.417263031005864e+133", + "-1.407669246196747e+93", + "-1.0133124366402626e+172", + "-7.863275185227392e+22", + "-1.6478676199913028e+254", + "-5.3221306800842315e+197", + "-4.488340377807618e+179", + "-5.8968994617462155e+22", + "9.303768873214727e+203", + "3.3209305405616783e+224", + "-2.743161380290986e+120", + "-4.7928041219711297e+188", + "8.311703205108649e+270", + "-3.809304893016817e+141", + "2.9392546e-316", + "-2.403030455112458e+194", + "1.1000456809997565e+229", + "3.909025728702546e-38", + "1.5639057159423838e+236", + "-2.3637598752975444e-70", + "2.134623765945435e+162", + "-4.168039321899415e+70", + "1.889134883880615e-68", + "-474122440814971900", + "-4.1946122646782306e+225", + "8.007302284240724e-71", + "-3.2386187314987185e+101", + "-2.338624358177186e+184", + "-4.768301606178284e-32", + "1.8198504447937023e+245", + "1.4096274375915532e+108", + "4.13848698139191e+129", + "5.929090976715092e+168", + "2.1806621551509277e-128", + "3.221364855766298e+161", + "-4.243192672729492e+267", + "3.620308041572573e-230", + "-7.438073158264159e+136", + "-7.081300616264342e-229", + "-3.4119228124618535e-220", + "2.0250763893127451e+152", + "2.699388504028321e+61", + "-4.123931735754013e-306", + "3.9651664495468146e+41", + "-4.0465111508965487e+34", + "-2.609691083431244e-40", + "-2.6871210932731643e+183", + "3.5495760440826426e+154", + "3.504088163375855e+165", + "-3.4261114001851565e+212", + "1872276604175.5679", + "-2.610634028911592e+277", + "-4.202911615371706e+221", + "-1.5248508424142186e-226", + "-1.7295989990234375e+89", + "2.2282028198242224e+161", + "1.7326202392578135e+147", + "-5.3358623981475855e+184", + "7.711949348449712e+126", + "-2.925477981567384e+184", + "-5.707826375961306e+177", + "-2.6300880908966064e+39", + "2.844532072544099e+95", + "1.4730709195137028e+77", + "-2.2093961238861083e-19", + "-3.008768618106842e-247", + "2.2499587535858155e-9", + "1.1620106697082527e+211", + "-5.119107723236085e+75", + "-4.672299385070803e+241", + "-4.457070591822123e+94", + "-5.260033369064333e+160", + "3.697563946247101e-79", + "2.8852849602699297e+268", + "3.601871967315675e+67", + "3.985868930816653e+262", + "-1.5167460441589357e+127", + "-2.6481792926788342e+221", + "-1.982865333557127e+131", + "2.7693646224215645e+267", + "9.689297676086434e+271", + "-4.243559300899507e+182", + "-3.0589947700499896e+91", + "2.866595029830933e+78", + "2.3441129922866843e-185", + "-1.3531962633132932e-84", + "-2.7703819274902352e+191", + "-3.938152290880682e+271", + "3.372411072254181e-283", + "-3.581536173820496e-221", + "-1.3072047233581547e+245", + "-4.479535281658173e+49", + "2.607654651641847e+195", + "-3.0013436675071724e+124", + "2.0544519424438487e+195", + "2.4212771654129054e+64", + "-4.563338220119477e+39", + "-4.2426348017325883e+186", + "-2.0320162773132332e+272", + "-1.706766843795777e+171", + "-1.750474929809571e+216", + "3.914484284818172e-45", + "-2.7181214094161982e+199", + "2.203586339950563e+267", + "-5.931226670742036e+116", + "-1.6944927573204048e+264", + "1.2571179866790796e+56", + "1.1593999862670907e+272", + "-4.21463906764984e-102", + "-4.913753867149353e+262", + "-1.8059968948364042e+213", + "-5.62412804365158e-82", + "1.3469057679176335e+187", + "-1.6420340538024888e+210", + "-5.573721885681154e+144", + "2.3179357647895816e-119", + "-4.821085393428803e-267", + "2.685331344604503e+77", + "-2.0099136829376228e+263", + "-5.3039608001709e+166", + "3.9344146251678477e+220", + "-2.555463314056395e+127", + "1.2689819335937508e+240", + "-1.8898818492711575e+162", + "9.991075992584234e+108", + "3.989137947559358e+251", + "2.697842717170718e+80", + "-5.221750199794771e+215", + "0.1941255569458008", + "5.127849578857426e+184", + "-4.1769895553588875e+126", + "31543636322021508", + "1.961663603782654e-181", + "8.848192691802981e-166", + "-8.621314764022825e-167", + "-1.890095829963684e+106", + "-1.8683371543884277e+118", + "-4.057601451873781e+262", + "-2.1253905296325692e+217", + "-20459029674530028", + "2.3890503644943247e+176", + "9.824221730232241e-25", + "1.8977904319763215e+119", + "-1.8932802081108095e+116", + "-5.7035205364227315e+152", + "-4.257497787475585e+193", + "-4.2113399505615214e+54", + "1.0227779322862647e+91", + "-4.4964659810066226e-241", + "3.1809082031250006e-16", + "-1.7257771492422222e+62", + "2.4382969141006477e+71", + "2.168795192241669e-271", + "-5.698747038841246e+69", + "1.064595222473145e+144", + "1.3656755831241614e+184", + "-5.246331751346588e-198", + "20574360489845277000", + "-2.2098681926727304e+275", + "2.781985044479371e+155", + "2.2076302170753493e+270", + "-4.69838446378708e+119", + "-5.098291136324406e+136", + "2.208396425247194e+217", + "3.987801015377045e-52", + "-2.280269622802735e+190", + "-3.305479645729066e+213", + "1.955070495605472e+259", + "3.6387767791748067e+217", + "1.6810553669929505e-12", + "-546733444929122900000", + "-6.1388468742370604e+203", + "-5.219211041927339e+180", + "-4.881451785564423e+92", + "-1.1169586181640626e+88", + "-1.3383445739746098e+252", + "-5.901391267776492e+236", + "1.6748573780059824e+268", + "-3.446269989013673e+203", + "-4.9429089426994336e+104", + "3.661990702152253e+91", + "2.1687545776367204e+224", + "-1.3259599357843389e+257", + "-23136065006256100", + "-3.2326865792274484e+129", + "-3.754259109497072e+218", + "-4.4479861677563186e-226", + "-1.1933693885803223e+86", + "-5.350025653839114e+269", + "-3.9783475399017353e+267", + "2.675232231616974e-231", + "-2.656648516654968e-246", + "-2.477060914039613e+192", + "-3.6805830001831067e+207", + "9.48669254779816e-16", + "2.3696535229682927e+156", + "-2.5385428071022034e-185", + "-4.047407865524292e+138", + "-2.6308146715164183e-129", + "-4.2357859611507727e+117", + "-4.466070592403412e+41", + "-5.055889844894411e+226", + "-6.114516258239747e+237", + "-3.0796665549278267e+106", + "-5.794673621654513e+201", + "1.1939146518707282e+253", + "2.1771674379706393e+202", + "-4.939935207366943e+214", + "-1.9140682220458985e+99", + "8.16244423389435e-31", + "-4.0172574520111094e+195", + "1.330970764160157e+213", + "1.7773857116699228e+223", + "9.116973876953127e+46", + "5.1578694581985516e+151", + "1.345715761184693e+153", + "-4.890928030014039e+79", + "-3.9035851359367367e-181", + "8.418455123901372e+89", + "-4.218700885772706e+186", + "-3.590813636779787e+270", + "-339579.31995391846", + "-3.8535613417625433e-212", + "1.5536549091339116e+140", + "-3.3169466853141784e+33", + "-5.375601480960848e+263", + "-5.876263141632082e+253", + "9.425535202026373e+204", + "3.66624762864e-313", + "3.4807198643684394e-87", + "1.2949802875518807e+236", + "-3.054354190826415e+198", + "3.5760237689574017e+195", + "2.654693663120271e+162", + "2.9114344120025647e+186", + "-5.291466474533082e+95", + "-1.891249179840088e+156", + "-4.366901849452292e+160", + "-4.01342010498047e+252", + "2.9451062679290774e-33", + "-1.601445436477661e+87", + "1.7629200220108053e-202", + "-2.319566369056703e+276", + "2.0963611602783214e+242", + "-1.1533206701278665e+26", + "-1.3341011181473734e+211", + "7.562184333801294e+95", + "-5.4188019633293154e-92", + "-4.620281219482423e+165", + "3.9793261289596573e+167", + "3.958552122116089e-29", + "-3.957000732421876e+116", + "-3.0349702611565604e+200", + "2.6955213546752937e+165", + "2.8936290740966835e+257", + "-4.942387938499449e+56", + "-9.57973659253165e-146", + "-7.294414043426516e+276", + "3.908757507801058e+211", + "-5.41193163394928e+101", + "-6.119942665100079e+259", + "-4.769818246364595e+234", + "-5.428192615509033e+253", + "2.964408934116364e-249", + "2.7275469303131116e+222", + "2.2662025094032296e+122", + "2.527883052825931e+196", + "3.1041519865393657e+275", + "-3.9787778854370126e+96", + "3.295688897709216e+167", + "-1.2547955513000492e+265", + "-2.12970733642578e+199", + "1.5685501098632821e+205", + "-1.297870635986328e+108", + "-2.8797597661614415e+45", + "-4.698094276982524e+199", + "5.483096241950994e+234", + "-8.061407062456611e+261", + "-1.0200748443603518e+171", + "-4.873115777969362e+180", + "3.1589179635047915e-296", + "-2.767001748085023e+161", + "-2.506787553429602e-210", + "-1.8849483728408814e-50", + "-0.056305155754089356", + "-2.9438192248344425e+91", + "3.5145797728815764e+232", + "3.7682288289070144e+239", + "8.711709976196293e+90", + "-4.783241212368012e-223", + "-2.151692867279053e+182", + "9.958806037902836e+186", + "-5.989246129989629e+248", + "-5.498567581176759e+189", + "-4.945329189300538e+162", + "-3.616174221038819e+189", + "2.734218180179596e-22", + "-3.9779824614524856e+245", + "-4.108974397182465e-238", + "-5.466594457626345e+145", + "-4.890122175216677e+263", + "2.8137343168258686e+224", + "-8.55377674102783e+61", + "-3.37066123634577e+276", + "-5.968852698802949e-219", + "-5.915559291839601e+204", + "3.8765480467343347e+232", + "0.0383961820602417", + "-5.384608864784242e+239", + "3.2071401923894917e+248", + "-4.452445901930334e+259", + "3.078688621520997e+186", + "-3.587494552135468e-300", + "-1.8565869331359845e-229", + "2.225117921829225e+198", + "9.690096378326422e+152", + "3.708257675170901e+139", + "-2.5952536463737487e+74", + "1.9797125470160497e+237", + "1.9802572727203383e+247", + "3.2374527454376238e+252", + "-4.280271291732789e+89", + "5.410330519080164e-273", + "-4.1817132234573366e+140", + "2.3117294311523448e+254", + "-1.5281311273574826e-45", + "3.7058269381523133e-227", + "2.545002017798425e+222", + "-5.862139225006104e+92", + "-3.780389786218074e+240", + "-1.0006330013275147e+182", + "-3.715799763193488e-296", + "-4.0929412841796875e+254", + "1.3206901550292977e+278", + "5.232455730438235e+81", + "2.5885846614837653e+94", + "-4.7304803729057316e-182", + "-1.3653988242149352e-203", + "3.574995040893556e+184", + "-3.3488700151443483e+102", + "-1.487270057201386e+185", + "141.42113327980044", + "2.828821182250978e+278", + "-4.000113964080812e+212", + "1.4557127735171565e+207", + "2.2827630639076235e-217", + "-1.4716157913208016e+248", + "3.185670912265779e+113", + "9.242789968848231e-101", + "2.7201714515686036e+28", + "-5.553598165512088e+264", + "-1.96714735031128e+265", + "-2.709914207458497e+244", + "-4.5677742958068866e+210", + "2.9946649074554477e+152", + "-2.5744411945343014e-53", + "37.4913123100996", + "-2.3107405817136173", + "-0.27440248709172016", + "-0.013323193648830058", + "-0.31016370654106146", + "-5.476581033319236", + "0.0012718516518361866", + "-30.853389149531726", + "3.2548799254000187", + "29.190228620544076", + "-0.24844333529472354", + "-95.01458568871023", + "-118.01466131210329", + "-70.9394128099084", + "-1.7225743657909336", + "1.2586251497268677", + "-0.0022343400341924284", + "-20.82682037353516", + "0.09086986444890499", + "-0.17348672449588778", + "-0.019439578056335453", + "-118.92181896790864", + "-0.1327820784354117", + "-129.9799387919484", + "29.16255757212639", + "0.00005258040619082749", + "0.13090397417545319", + "-0.0093299534637481", + "22.796597074950114", + "0.08125689998269081", + "0.0006382626597769558", + "0.9180797560838982", + "-3.6413122266530995", + "-9.039724349975588", + "3.1573441401124", + "-35.43613201379777", + "160.34690028091427", + "-1.4604534506797793", + "-0.04124614968895913", + "37.39390207082033", + "0.07112866640090942", + "24.295455696061254", + "-1.1760010845027866", + "-0.1142154890112579", + "-31.61090183258057", + "-15.489298367872836", + "28.36089324951172", + "-0.5206655537476764", + "17.291172050638124", + "2.9655919782817364", + "-3.8551014917902653", + "-1.9740552157163622", + "0.024991799145936966", + "3.246677875518799", + "11.17682821454946", + "-55.801692876964815", + "-119.22509002685548", + "-0.04426216334104539", + "-113.98891550768168", + "-3.4895658493041997", + "-254.4462757110596", + "-6.6001880390103915", + "-43.277816772460945", + "70.0752948927693", + "-0.02140419185161591", + "-0.009484688984230162", + "0.0005923930439166725", + "-16.770487219095234", + "-1.4264239072799685", + "6.299182891845703", + "0.3223479092121124", + "12.430929714464583", + "0.22651036083698273", + "-2.81588363647461", + "-1.4358800649642947", + "-163.28941413760188", + "15.73794937133789", + "-113.93039480969311", + "4.165374991716817", + "-50.63767951018236", + "22.369632244110107", + "-217.9108373038471", + "0.014090140350162983", + "242.00443545286544", + "0.290915310382843", + "-0.4147960878908635", + "-4.404459353536368", + "0.23920266376808286", + "-0.3997377693885938", + "0.43973711133003235", + "4.990156088024378", + "-74.40413260972129", + "-37.58786177728326", + "10.34019172936678", + "118.62681865692139", + "-13.459676608443262", + "159.9797775116749", + "-10.991510391235353", + "-120.89464569091798", + "-261.14824581146246", + "-87.40742671000773", + "34.945977210998535", + "-1.2096652910113337", + "-0.495321968337521", + "6.7971615344285965", + "0.1305276801576838", + "-6.438770800828935", + "2.664801260223612", + "-0.028685314580798153", + "-9.053630795329811", + "-117.17746896948667", + "1.574013315141201", + "1.9708161503076553", + "0.0002634116681292653", + "-0.5719741173088552", + "18.110482402145863", + "-0.3813620507717133", + "1.2077016532421112", + "-0.22695469297468665", + "14.229049682617188", + "23.625011301861377", + "-475.3311729431153", + "-63.27948156185449", + "-0.0013664712896570565", + "8.172042846679688", + "-1.6931582875549795", + "-0.02924016315955669", + "-0.26003596931695944", + "-7.676882959902287", + "0.0003062230534851551", + "-10.27805489767343", + "-2.4219313412904744", + "-4.832996368408204", + "4.547081236727536", + "13.065828283346491", + "-222.19049072265628", + "0.000537012965651229", + "-15.51556780189276", + "-1.3282998800277712", + "47.39942409098148", + "-1.2006110697984698", + "-0.0006138317985460163", + "-7.6684827134013185", + "3.838244915008545", + "0.8934619948267937", + "-1.5074847936630251", + "-0.12206099927425386", + "-1.3116877976062826", + "3.2359752655029297", + "16.815424514003098", + "-1.3855861425399782", + "50.414371490478516", + "-2.7299077510833745", + "0.0001322203315794468", + "0.9586312770843506", + "-180.64309876877817", + "-70.67631244659425", + "-0.8459603786468507", + "51.309198655188084", + "2.6038738489151", + "8.4887800142169", + "53.62009334564209", + "-1.943757772445679", + "-88.41392946243288", + "-0.0008378787388210186", + "0.045230109710246325", + "-0.0026014323811978106", + "-0.006685942644253374", + "28.834522485733032", + "-0.012051906785927715", + "0.08005238696932793", + "20.44059008359909", + "-2.0236018387367953", + "0.0008322637295350432", + "14.34309146553278", + "-44.102979626506574", + "-12.290012341924013", + "0.007822009269148111", + "67.86573622748256", + "-0.0005773261655122043", + "175.49365182965994", + "3.4166607364313677", + "120.85336515307426", + "-1.5975430905818941", + "16.274242634419352", + "-3.4862721189856534", + "-0.0071312710642814645", + "0.24141664057970047", + "-91.31758967810312", + "-105.93267059326173", + "-16.62292268685997", + "-0.5405081510543824", + "0.11103154812008142", + "-107.53464175201954", + "-0.2477346300147474", + "-146.8027083873749", + "254.85360168956686", + "-22.200313568115238", + "0.4851785060018301", + "0.023931335657835007", + "-0.09567600488662721", + "-6.882541179656983", + "-6.185835838317872", + "-0.42377048614434903", + "-0.38364768028259283", + "-244.0607959730551", + "-0.9001345278229566", + "7.720511928433552", + "0.001521404250524938", + "-1.8186217043548825", + "-205.4547320911661", + "0.5509469886310399", + "0.044380841543897986", + "-12.365843564271929", + "53.00354031473398", + "169.09673386486247", + "9.022452153265476", + "0.20392215251922607", + "-0.1272619739174843", + "-3.591483728960157", + "0.45594311199965887", + "36.008143946528435", + "-61.81058072298766", + "0.015511184930801392", + "94.10695736785419", + "1.3340946631506085", + "-0.0008650549279991538", + "-0.12403469346463682", + "0.06279908120632172", + "0.0010203967103734612", + "-8.784217113628985", + "-0.28107416629791265", + "27.51976203918457", + "0.5630624890327454", + "122.27384185791016", + "-0.0008075048681348563", + "112.14086078107357", + "-1.1640345081686976", + "-3.827903747558594", + "-100.80987441539766", + "11.932136535644531", + "0.008910289907362312", + "18.731645584106445", + "0.36077473359182477", + "1.715543657541275", + "15.049148321151733", + "-0.009968095459043981", + "9.072696805000305", + "35.368037927895784", + "-0.0015732578467577698", + "43.58363988995552", + "56.44952529668808", + "-3.1612529754638676", + "242.92688962444663", + "156.64461279660463", + "12.438169479370117", + "-0.1779602020978928", + "2.955066367983818", + "-5.474287748336793", + "-129.08697509765628", + "-44.28349400311709", + "0.01435867790132761", + "97.85285949707031", + "10.323982238769531", + "-173.7166065173224", + "-120.22512054443361", + "-0.0027183993697690316", + "-0.8762969449162484", + "22.617906509898603", + "0.5532393262255937", + "0.0911698266863823", + "0.006763415818568319", + "-21.81767648085952", + "63.25366926006973", + "-0.008224038188927809", + "-77.48323822021486", + "-23.731140397023413", + "53.553916931152344", + "0.07238960266113281", + "-0.11412469297647478", + "12.076147815678269", + "-27.744973294436935", + "0.003013639940036228", + "-109.38617424294354", + "-341.5246887207032", + "-0.018329914659261707", + "-9.75445079803467", + "-0.009743621572852136", + "-27.793941497802738", + "-48.696805149316795", + "-1.2425011396408083", + "0.4041498781298287", + "-15.62874909490347", + "0.10278511047363281", + "0.01115043053869158", + "0.00903755720355548", + "0.0006363838911056519", + "-27.15245206654072", + "-0.02373480537789874", + "-79.9569786139764", + "0.02485835738480091", + "74.364536434412", + "-0.432000607252121", + "-172.90801239013675", + "95.16988191055134", + "-1.393748760223389", + "87.31360919773579", + "4.867788620318606", + "3.18648624420166", + "0.004687720909714699", + "-0.09786754881497474", + "1.3903047654312104", + "2.0618391279131174", + "-190.05737358331683", + "0.8504086136817932", + "0.6425454765558243", + "-0.07709211111068727", + "-386.9481811523438", + "-0.8664493121905253", + "-114.30018413811923", + "228.86202716827393", + "0.00008815765613690019", + "3.4430088996887207", + "-72.29415484238417", + "1.079421043395996", + "0.00003076530992984772", + "-61.48415333032609", + "-0.03666436299681664", + "27.59716033935547", + "-0.0016065740492194893", + "-0.001615635817870498", + "0.010347574949264526", + "-44.64341116277502", + "0.20774045796133578", + "18.284037947654724", + "-1.2164419889450075", + "0.2864265590906143", + "-0.1909991502761841", + "15.711748946458101", + "-1.4218915756791832", + "-64.3110827697674", + "0.00039664661017013714", + "3.381623648107052", + "-125.75694510713221", + "-0.17924861609935763", + "-40.36874342197553", + "40.50726556777954", + "0.9503308832645416", + "0.003583371639251709", + "2.8310680389404297", + "46.14029311412014", + "15.00196857843548", + "3.7906381022185087", + "-16.22139817476273", + "0.8236373105319217", + "6.877297327853739", + "-15.133230130682934", + "-0.7957256436347963", + "-14.0888669192791", + "20.658037185668945", + "0.39338958263397217", + "-82.04680252075197", + "0.00004505462129600346", + "0.0004847586387768388", + "-43.89720345428214", + "0.25715279020369053", + "-0.005826903507113458", + "-0.00037520221667364245", + "0.003631439059972763", + "-21.53053140640259", + "3.411598354578018", + "0.20289428532123566", + "0.0019410736858844757", + "-0.00575246207881719", + "0.33329318545293063", + "-47.9271731376648", + "-0.0019122183439321818", + "-0.007326290477067233", + "-0.06172554939985276", + "-0.0014746425586054104", + "-0.017731875181198124", + "-0.00024291028967127207", + "-99.15152802690865", + "16.879215240478516", + "0.0006530527025461197", + "-6.78618940076558", + "-2.4458737373352055", + "38.114352226257324", + "-0.9325729906558992", + "0.1669013798236847", + "-0.0004779341106768698", + "-0.0007142627146095039", + "8.383076384779997", + "8.523920059204102", + "0.1161539814202115", + "0.40378537774086", + "-0.3095291871577502", + "0.04859345918521285", + "-11.032249847427012", + "2.361630916595459" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-uint8array.js b/packages/codemode-rust/conformance/cases/std-uint8array.js new file mode 100644 index 0000000000000..10271d62a8d6c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-uint8array.js @@ -0,0 +1,29 @@ +const out = [] +const b = new Uint8Array([1, 2, 300, -1, 1.7]) +out.push([...b], b.length, b[2], b[9], Object.keys(b), JSON.stringify(b), String(b), Array.isArray(b), b instanceof Uint8Array, typeof b) +b[0] = 257; b[10] = 5; out.push([...b], b.length, 0 in b, 9 in b, b.hasOwnProperty("1"), b.hasOwnProperty("length")) +try { delete b[0] } catch (e) { out.push(e.name) } +out.push(new Uint8Array(3).join("-"), new Uint8Array().length, new Uint8Array("2").length, new Uint8Array(null).length, Uint8Array.of(1, 256, "3").join(), Uint8Array.from([1, 2], (x, i) => x * 10 + i).join(), Uint8Array.from("12").join(), Uint8Array.from(new Set([5, 6])).join()) +for (const f of [() => new Uint8Array(-1), () => new Uint8Array(1.5), () => Uint8Array(2), () => new Uint8Array({ length: 2 }), () => Uint8Array.fromHex("abc"), () => Uint8Array.fromBase64("@@"), () => Uint8Array.fromBase64(1), () => new Uint8Array(2).set([1, 2, 3]), () => new Uint8Array(2).reduce((a, b) => a), () => new Uint8Array().reduce((a, b) => a), () => new Uint8Array(1).map(5)]) { + try { out.push(f()) } catch (e) { out.push([e.name, e.message]) } +} +const s = new Uint8Array([10, 9, 1, 2, 3]) +out.push(s.at(-1), s.slice(1, 3).join(), s.subarray(-2).join(), s.indexOf(9), s.indexOf("9"), s.lastIndexOf(1), s.lastIndexOf(1, undefined), s.includes(3), s.includes(3, -1), [...s.keys()], [...s.entries()].join("|"), s.toHex(), s.toBase64()) +const v = s.subarray(1, 3); v[0] = 99; out.push(s.join(), v.length) +s.set([7, 8], 3); out.push(s.join()); s.set(new Uint8Array([4]), 0); out.push(s.join()) +out.push(s.fill(1, 1, 2).join(), s.reverse().join(), new Uint8Array([10, 9, 1]).sort().join(), new Uint8Array([1, 2, 3]).sort((a, b) => b - a).join()) +out.push(s.map((x) => x * 100).join(), s.filter((x) => x > 4).join(), s.find((x) => x > 4), s.findIndex((x) => x > 100), s.findLast((x) => x > 4), s.findLastIndex((x) => x > 4), s.some((x) => x > 4), s.every((x) => x > 0), s.reduce((a, b) => a + b), s.reduceRight((a, b) => a + "," + b, "")) +const seen = []; s.forEach((x, i, arr) => seen.push([x, i, arr === s])); out.push(seen) +out.push(Uint8Array.fromHex("ff00A1").join(), Uint8Array.fromBase64("aGVsbG8=").join(), Uint8Array.fromBase64(" aGVs bG8 ").join(), new TextDecoder().decode(Uint8Array.fromBase64("aGVsbG8"))) +out.push(atob("aGk="), btoa("hi"), atob(" aG k "), btoa("\u00ff")) +for (const f of [() => atob("a"), () => btoa("€"), () => atob()]) { try { f() } catch (e) { out.push([e.name, e.message]) } } +const enc = new TextEncoder() +out.push(enc.encoding, [...enc.encode("hé€😀")], enc.encode().length, [...enc.encode(12)]) +const dec = new TextDecoder() +out.push(dec.encoding, dec.fatal, dec.ignoreBOM, dec.decode(new Uint8Array([0xef, 0xbb, 0xbf, 0x68, 0xff, 0x69])), new TextDecoder("utf-8", { ignoreBOM: true }).decode(new Uint8Array([0xef, 0xbb, 0xbf, 0x41])).length, dec.decode()) +const st = new TextDecoder() +out.push(st.decode(new Uint8Array([0xe2, 0x82]), { stream: true }), st.decode(new Uint8Array([0xac]), { stream: true }), st.decode()) +for (const f of [() => new TextDecoder("latin1"), () => new TextDecoder("utf-8", { fatal: true }).decode(new Uint8Array([0xff])), () => dec.decode([1]), () => TextDecoder()]) { try { f() } catch (e) { out.push([e.name, e.message]) } } +out.push(new TextDecoder(" UTF8 ").encoding, Object.prototype.toString.call(new Uint8Array(1)), new Uint8Array([1, 2]).toLocaleString()) +console.log(new Uint8Array([1, 2]), [new Uint8Array(0)]) +return out diff --git a/packages/codemode-rust/conformance/cases/std-uint8array.json b/packages/codemode-rust/conformance/cases/std-uint8array.json new file mode 100644 index 0000000000000..c5f1a571279eb --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-uint8array.json @@ -0,0 +1,224 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + 1, + 2, + 44, + 255, + 1 + ], + 5, + 44, + null, + [ + "0", + "1", + "2", + "3", + "4" + ], + "{\"0\":1,\"1\":2,\"2\":44,\"3\":255,\"4\":1}", + "1,2,44,255,1", + false, + true, + "object", + [ + 1, + 2, + 44, + 255, + 1 + ], + 5, + true, + false, + true, + false, + "TypeError", + "0-0-0", + 0, + 2, + 0, + "1,0,3", + "10,21", + "1,2", + "5,6", + [ + "RangeError", + "Invalid typed array length: -1" + ], + [ + "RangeError", + "Invalid typed array length: 1.5" + ], + [ + "TypeError", + "Constructor Uint8Array requires 'new'." + ], + [ + "TypeError", + "new Uint8Array(...) expects a Uint8Array, an array, or an iterable of numbers, received a data object." + ], + [ + "SyntaxError", + "Uint8Array.fromHex: the string is not valid hex." + ], + [ + "SyntaxError", + "Uint8Array.fromBase64: the string is not valid base64." + ], + [ + "TypeError", + "Uint8Array.fromBase64 expects a string." + ], + [ + "RangeError", + "Uint8Array.set: the source does not fit at that offset." + ], + 0, + [ + "TypeError", + "Uint8Array.reduce of an empty array with no initial value." + ], + [ + "TypeError", + "Uint8Array.map expects a function callback." + ], + 3, + "9,1", + "2,3", + 1, + -1, + 2, + -1, + true, + true, + [ + 0, + 1, + 2, + 3, + 4 + ], + "0,10|1,9|2,1|3,2|4,3", + "0a09010203", + "CgkBAgM=", + "10,99,1,2,3", + 2, + "10,99,1,7,8", + "4,99,1,7,8", + "4,1,1,7,8", + "8,7,1,1,4", + "1,9,10", + "3,2,1", + "32,188,100,100,144", + "8,7", + 8, + -1, + 7, + 1, + true, + true, + 21, + ",4,1,1,7,8", + [ + [ + 8, + 0, + true + ], + [ + 7, + 1, + true + ], + [ + 1, + 2, + true + ], + [ + 1, + 3, + true + ], + [ + 4, + 4, + true + ] + ], + "255,0,161", + "104,101,108,108,111", + "104,101,108,108,111", + "hello", + "hi", + "aGk=", + "hi", + "/w==", + [ + "TypeError", + "The string contains invalid characters." + ], + [ + "TypeError", + "The string contains invalid characters." + ], + [ + "TypeError", + "atob requires 1 argument (a string)" + ], + "utf-8", + [ + 104, + 195, + 169, + 226, + 130, + 172, + 240, + 159, + 152, + 128 + ], + 0, + [ + 49, + 50 + ], + "utf-8", + false, + false, + "h�i", + 2, + "", + "", + "€", + "", + [ + "RangeError", + "The \"latin1\" encoding is not supported; only UTF-8 is." + ], + [ + "TypeError", + "TextDecoder.decode: the input is not valid utf-8." + ], + [ + "TypeError", + "TextDecoder.decode expects a Uint8Array, received an array." + ], + [ + "TypeError", + "Constructor TextDecoder requires 'new'." + ], + "utf-8", + "[object Uint8Array]", + "1,2" + ], + "logs": [ + "Uint8Array(2) [1,2] [Uint8Array(0) []]" + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-uri.js b/packages/codemode-rust/conformance/cases/std-uri.js new file mode 100644 index 0000000000000..29b025c251076 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-uri.js @@ -0,0 +1,6 @@ +const out = [] +const s = "https://ex.test/a b?q=1&r=é€😀#h;/,+" +out.push(encodeURI(s), encodeURIComponent(s), decodeURI(encodeURI(s)), decodeURIComponent(encodeURIComponent(s)), decodeURI("%3B%2F%3f%41%23"), decodeURIComponent("%3B%2F%3f%41%23"), encodeURIComponent("-_.!~*'()"), encodeURI(1), decodeURI(undefined), encodeURIComponent({ toString() { return "a b" } })) +for (const f of [() => decodeURIComponent("%"), () => decodeURI("%E0%A4%A"), () => decodeURI("%C0%80"), () => decodeURI("%ED%A0%80"), () => decodeURI("%F8%80%80%80"), () => decodeURIComponent("%zz"), () => decodeURIComponent("%E2%82")]) { try { out.push(f()) } catch (e) { out.push([e.name, e.message, e instanceof URIError]) } } +out.push(["a b", "c/d"].map(encodeURIComponent)) +return out diff --git a/packages/codemode-rust/conformance/cases/std-uri.json b/packages/codemode-rust/conformance/cases/std-uri.json new file mode 100644 index 0000000000000..f4a69cb4732b3 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-uri.json @@ -0,0 +1,57 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "https://ex.test/a%20b?q=1&r=%C3%A9%E2%82%AC%F0%9F%98%80#h;/,+", + "https%3A%2F%2Fex.test%2Fa%20b%3Fq%3D1%26r%3D%C3%A9%E2%82%AC%F0%9F%98%80%23h%3B%2F%2C%2B", + "https://ex.test/a b?q=1&r=é€😀#h;/,+", + "https://ex.test/a b?q=1&r=é€😀#h;/,+", + "%3B%2F%3fA%23", + ";/?A#", + "-_.!~*'()", + "1", + "undefined", + "%5Bobject%20Object%5D", + [ + "URIError", + "decodeURIComponent received malformed URI data: URI error", + true + ], + [ + "URIError", + "decodeURI received malformed URI data: URI error", + true + ], + [ + "URIError", + "decodeURI received malformed URI data: URI error", + true + ], + [ + "URIError", + "decodeURI received malformed URI data: URI error", + true + ], + [ + "URIError", + "decodeURI received malformed URI data: URI error", + true + ], + [ + "URIError", + "decodeURIComponent received malformed URI data: URI error", + true + ], + [ + "URIError", + "decodeURIComponent received malformed URI data: URI error", + true + ], + [ + "a%20b", + "c%2Fd" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/std-url-headers-clone.js b/packages/codemode-rust/conformance/cases/std-url-headers-clone.js new file mode 100644 index 0000000000000..a4819e9422b41 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-url-headers-clone.js @@ -0,0 +1,32 @@ +const out = [] +const u = new URL("https://user:pw@example.com:8080/p/a?x=1#h") +for (const k of ["href","origin","protocol","username","password","host","hostname","port","pathname","search","hash"]) out.push(u[k]) +u.port = "443"; u.protocol = "http"; u.search = "?a b"; u.hash = "x y"; u.pathname = "a b"; u.host = "foo:99"; out.push(u.href, u.searchParams.get("a b")) +u.searchParams.append("k", "v w"); out.push(u.href, u.search); u.search = ""; out.push(u.searchParams.size, String(u), JSON.stringify({ u }), u.toJSON(), u instanceof URL, Object.prototype.toString.call(u), Object.keys(u)) +out.push(new URL("../x?y#z", "http://a/b/c/d").href, new URL("HTTP://EXAMPLE.com/./a/../b").href, new URL("http://[::1]:80/").href, new URL("file:///C:/a").href, new URL("mailto:x@y").pathname, new URL("http://bücher.de").hostname, new URL("blob:https://a.com/x").origin, new URL("/q", new URL("https://z.test/a")).href) +out.push(URL.canParse("nope"), URL.canParse("x", "https://a.test"), URL.parse("nope"), URL.parse("https://a.test/b").pathname) +for (const f of [() => new URL("nope"), () => new URL("x", "nope"), () => new URL(), () => URL("https://a"), () => { u.href = "nope" }, () => { u.origin = "x" }, () => { u.searchParams = 1 }]) { try { out.push(f()) } catch (e) { out.push([e.name, e.message]) } } +u.port = "nope"; u.protocol = "1x"; out.push(u.href) +const p = new URLSearchParams("?a=1&b=2&a=3&c=%20+d") +out.push(p.toString(), p.get("c"), p.getAll("a"), p.size, p.has("a", "3"), p.has("z"), p.get("z")) +p.sort(); out.push(String(p)); p.delete("a", "1"); p.set("b", "9"); p.append("e", "x/y é"); out.push(p.toString(), [...p.keys()], [...p.values()], [...p], [...p.entries()].length, Object.fromEntries(p)) +const seen = []; p.forEach((v, k, self) => seen.push(k + "=" + v + (self === p))); out.push(seen) +out.push(new URLSearchParams({ x: 1, y: [1, 2] }).toString(), new URLSearchParams([["a", "1"], ["b", { toString() { return "t" } }]]).toString(), new URLSearchParams(new Map([["m", "n"]])).toString(), new URLSearchParams(p).toString(), new URLSearchParams(null).toString(), new URLSearchParams(5).toString(), new URLSearchParams("").size) +for (const f of [() => new URLSearchParams([["a"]]), () => new URLSearchParams(() => 1), () => p.append("a"), () => p.get(), () => URLSearchParams()]) { try { out.push(f()) } catch (e) { out.push([e.name, e.message]) } } +const h = new Headers({ "Content-Type": "text/plain", "X-Count": 1, "X-Null": null }) +h.append("Accept", "text/html"); h.append("accept", "application/json"); h.set("x-count", "2"); h.delete("x-null"); h.append("Set-Cookie", "a=1"); h.append("set-cookie", "b=2") +out.push(h.get("content-type"), h.get("x-missing"), h.get("ACCEPT"), h.has("Accept"), h.has("x-null"), h.get("set-cookie"), h.getSetCookie(), [...h], [...h.keys()], [...h.values()], JSON.stringify(h), String(h), Object.fromEntries(h), new Headers(h).get("accept"), new Headers([["a", " b \t"]]).get("a")) +const hs = []; h.forEach((v, k) => hs.push(k)); out.push(hs) +for (const f of [() => new Headers([["a b", "c"]]), () => new Headers({ a: "x\ny" }), () => h.get("a b"), () => h.append("", "x"), () => new Headers(1), () => new Headers("a=1"), () => new Headers(null), () => new Headers(() => 1), () => new Headers([["a", "b", "c"]]), () => Headers(), () => h.append("a")]) { try { out.push(f()) } catch (e) { out.push([e.name, e.message]) } } +console.log(u, p, h, new Headers()) +const src = { n: 1, a: [1, , 3], m: new Map([[1, { d: new Date(0) }]]), s: new Set(["x"]), r: /x/gi, b: new Uint8Array([1, 2]), e: new TypeError("bad", { cause: { c: 1 } }), buf: Buffer.from("hi") } +src.a.extra = "e"; src.again = src.m +const c = structuredClone(src) +out.push(c !== src, c.again === c.m, c.a.length, c.a.extra, c.m.get(1).d.getTime(), c.m.get(1).d instanceof Date, [...c.s], String(c.r), c.r.lastIndex, [...c.b], c.e instanceof TypeError, c.e.message, c.e.cause, Object.keys(c.e), Buffer.isBuffer(c.buf), c.buf instanceof Uint8Array, Object.isFrozen(structuredClone(Object.freeze({ x: 1 })))) +for (const v of [() => 1, Promise.resolve(1), new URL("https://a"), h, p, new WeakMap(), [1].values(), tools, Symbol.iterator]) { try { structuredClone(v) } catch (e) { out.push([e.name, e.message]) } } +try { structuredClone() } catch (e) { out.push([e.name, e.message]) } +out.push(structuredClone(5), structuredClone("s"), structuredClone(null), structuredClone(undefined)) +const id = crypto.randomUUID() +out.push(/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(id), crypto.getRandomValues(new Uint8Array(4)).length) +try { crypto.getRandomValues([1]) } catch (e) { out.push([e.name, e.message]) } +return out diff --git a/packages/codemode-rust/conformance/cases/std-url-headers-clone.json b/packages/codemode-rust/conformance/cases/std-url-headers-clone.json new file mode 100644 index 0000000000000..3aaf90bb67c51 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/std-url-headers-clone.json @@ -0,0 +1,336 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "https://user:pw@example.com:8080/p/a?x=1#h", + "https://example.com:8080", + "https:", + "user", + "pw", + "example.com:8080", + "example.com", + "8080", + "/p/a", + "?x=1", + "#h", + "http://user:pw@foo:99/a%20b?a%20b#x%20y", + "", + "http://user:pw@foo:99/a%20b?a+b=&k=v+w#x%20y", + "?a+b=&k=v+w", + 0, + "http://user:pw@foo:99/a%20b#x%20y", + "{\"u\":\"http://user:pw@foo:99/a%20b#x%20y\"}", + "http://user:pw@foo:99/a%20b#x%20y", + true, + "[object URL]", + [], + "http://a/b/x?y#z", + "http://example.com/b", + "http://[::1]/", + "file:///C:/a", + "x@y", + "xn--bcher-kva.de", + "https://a.com", + "https://z.test/q", + false, + true, + null, + "/b", + [ + "TypeError", + "new URL(...) received an invalid URL." + ], + [ + "TypeError", + "new URL(...) received an invalid URL or base URL." + ], + [ + "TypeError", + "new URL(...) requires a URL string and an optional base URL." + ], + [ + "TypeError", + "Constructor URL requires 'new'." + ], + [ + "TypeError", + "URL.href received an invalid value." + ], + [ + "TypeError", + "Cannot set property 'origin' of a URL which has only a getter." + ], + [ + "TypeError", + "Cannot set property 'searchParams' of a URL which has only a getter." + ], + "http://user:pw@foo:99/a%20b#x%20y", + "a=1&b=2&a=3&c=++d", + " d", + [ + "1", + "3" + ], + 4, + true, + false, + null, + "a=1&a=3&b=2&c=++d", + "a=3&b=9&c=++d&e=x%2Fy+%C3%A9", + [ + "a", + "b", + "c", + "e" + ], + [ + "3", + "9", + " d", + "x/y é" + ], + [ + [ + "a", + "3" + ], + [ + "b", + "9" + ], + [ + "c", + " d" + ], + [ + "e", + "x/y é" + ] + ], + 4, + { + "a": "3", + "b": "9", + "c": " d", + "e": "x/y é" + }, + [ + "a=3true", + "b=9true", + "c= dtrue", + "e=x/y étrue" + ], + "x=1&y=1%2C2", + "a=1&b=t", + "m=n", + "a=3&b=9&c=++d&e=x%2Fy+%C3%A9", + "null=", + "5=", + 0, + [ + "TypeError", + "new URLSearchParams(...) expects iterable [name, value] pairs." + ], + [ + "TypeError", + "new URLSearchParams(...) expects a query string, data object, or synchronous iterable pairs." + ], + [ + "TypeError", + "URLSearchParams.append requires 2 arguments." + ], + [ + "TypeError", + "URLSearchParams.get requires 1 argument." + ], + [ + "TypeError", + "Constructor URLSearchParams requires 'new'." + ], + "text/plain", + null, + "text/html, application/json", + true, + false, + "a=1, b=2", + [ + "a=1", + "b=2" + ], + [ + [ + "accept", + "text/html, application/json" + ], + [ + "content-type", + "text/plain" + ], + [ + "x-count", + "2" + ], + [ + "set-cookie", + "a=1" + ], + [ + "set-cookie", + "b=2" + ] + ], + [ + "accept", + "content-type", + "x-count", + "set-cookie", + "set-cookie" + ], + [ + "text/html, application/json", + "text/plain", + "2", + "a=1", + "b=2" + ], + "{\"accept\":\"text/html, application/json\",\"content-type\":\"text/plain\",\"x-count\":\"2\",\"set-cookie\":\"b=2\"}", + "[object Headers]", + { + "accept": "text/html, application/json", + "content-type": "text/plain", + "x-count": "2", + "set-cookie": "b=2" + }, + "text/html, application/json", + "b", + [ + "accept", + "content-type", + "x-count", + "set-cookie", + "set-cookie" + ], + [ + "TypeError", + "Invalid header name: 'a b'" + ], + [ + "TypeError", + "Header 'a' has invalid value" + ], + [ + "TypeError", + "Invalid header name: 'a b'" + ], + [ + "TypeError", + "Invalid header name: ''" + ], + [ + "TypeError", + "new Headers(...) expects a record of names to values, iterable [name, value] pairs, or Headers." + ], + [ + "TypeError", + "new Headers(...) expects a record of names to values, iterable [name, value] pairs, or Headers." + ], + [ + "TypeError", + "new Headers(...) expects a record of names to values, iterable [name, value] pairs, or Headers." + ], + [ + "TypeError", + "new Headers(...) expects a record of names to values, iterable [name, value] pairs, or Headers." + ], + [ + "TypeError", + "new Headers(...) expects iterable [name, value] pairs." + ], + [ + "TypeError", + "Constructor Headers requires 'new'." + ], + [ + "TypeError", + "Headers.append requires 2 arguments." + ], + true, + true, + 3, + "e", + 0, + true, + [ + "x" + ], + "/x/gi", + 0, + [ + 1, + 2 + ], + true, + "bad", + { + "c": 1 + }, + [], + false, + true, + false, + [ + "TypeError", + "DataCloneError: a function could not be cloned." + ], + [ + "TypeError", + "DataCloneError: an un-awaited Promise could not be cloned." + ], + [ + "TypeError", + "DataCloneError: a URL could not be cloned." + ], + [ + "TypeError", + "DataCloneError: a Headers could not be cloned." + ], + [ + "TypeError", + "DataCloneError: a URLSearchParams could not be cloned." + ], + [ + "TypeError", + "DataCloneError: a WeakMap could not be cloned." + ], + [ + "TypeError", + "DataCloneError: an iterator could not be cloned." + ], + [ + "TypeError", + "DataCloneError: a namespace reference could not be cloned." + ], + [ + "TypeError", + "DataCloneError: a symbol could not be cloned." + ], + [ + "TypeError", + "structuredClone requires 1 argument" + ], + 5, + "s", + null, + null, + true, + 4, + [ + "TypeError", + "crypto.getRandomValues expects a Uint8Array, received an array." + ] + ], + "logs": [ + "http://user:pw@foo:99/a%20b#x%20y a=3&b=9&c=++d&e=x%2Fy+%C3%A9 Headers {\"accept\":\"text/html, application/json\",\"content-type\":\"text/plain\",\"x-count\":\"2\",\"set-cookie\":\"b=2\"} Headers {}" + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/string-from-char-code.js b/packages/codemode-rust/conformance/cases/string-from-char-code.js new file mode 100644 index 0000000000000..73c6d9f23c3f9 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/string-from-char-code.js @@ -0,0 +1,3 @@ +let s = "" +for (let i = 0; i < 5; i++) s += String.fromCharCode(97 + i) +return [s, String.fromCharCode(72, 105), "€".length, "z".charCodeAt(0), String(123), String(null), String([1, [2, 3]]), (12).toString(), (255).toString(16)] diff --git a/packages/codemode-rust/conformance/cases/string-from-char-code.json b/packages/codemode-rust/conformance/cases/string-from-char-code.json new file mode 100644 index 0000000000000..05274e72ae8b6 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/string-from-char-code.json @@ -0,0 +1,17 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "abcde", + "Hi", + 1, + 122, + "123", + "null", + "1,2,3", + "12", + "ff" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/string-methods.js b/packages/codemode-rust/conformance/cases/string-methods.js new file mode 100644 index 0000000000000..64c1659a7c240 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/string-methods.js @@ -0,0 +1,3 @@ +const s = " Hello, World " +const t = s.trim() +return [t, t.length, t.toUpperCase(), t.toLowerCase(), t.slice(0, 5), t.slice(-5), t.substring(7, 12), t.indexOf("o"), t.lastIndexOf("o"), t.includes("World"), t.startsWith("Hell"), t.endsWith("!"), t.split(", "), "a,b,,c".split(","), "abc".split(""), "7".padStart(3, "0"), "x".padEnd(3, "."), "ab".repeat(3), t.replace("o", "0"), t.replaceAll("o", "0"), t.charAt(1), t.charCodeAt(0), t.at(-1), s.trimStart(), s.trimEnd()] diff --git a/packages/codemode-rust/conformance/cases/string-methods.json b/packages/codemode-rust/conformance/cases/string-methods.json new file mode 100644 index 0000000000000..3b4ea9eb0278b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/string-methods.json @@ -0,0 +1,45 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "Hello, World", + 12, + "HELLO, WORLD", + "hello, world", + "Hello", + "World", + "World", + 4, + 8, + true, + true, + false, + [ + "Hello", + "World" + ], + [ + "a", + "b", + "", + "c" + ], + [ + "a", + "b", + "c" + ], + "007", + "x..", + "ababab", + "Hell0, World", + "Hell0, W0rld", + "e", + 72, + "d", + "Hello, World ", + " Hello, World" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/switch.js b/packages/codemode-rust/conformance/cases/switch.js new file mode 100644 index 0000000000000..308e3c09876ec --- /dev/null +++ b/packages/codemode-rust/conformance/cases/switch.js @@ -0,0 +1,12 @@ +const f = (x) => { + const out = [] + switch (x) { + case 1: out.push("one") + case 2: out.push("two"); break + case "3": out.push("string three"); break + default: out.push("default") + case 4: out.push("four") + } + return out.join(",") +} +return [f(1), f(2), f(3), f("3"), f(4), f(9)] diff --git a/packages/codemode-rust/conformance/cases/switch.json b/packages/codemode-rust/conformance/cases/switch.json new file mode 100644 index 0000000000000..a7e0d52952f99 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/switch.json @@ -0,0 +1,14 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "one,two", + "two", + "default,four", + "string three", + "four", + "default,four" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/syntax-class-decorator.js b/packages/codemode-rust/conformance/cases/syntax-class-decorator.js new file mode 100644 index 0000000000000..fadccd2ecb4df --- /dev/null +++ b/packages/codemode-rust/conformance/cases/syntax-class-decorator.js @@ -0,0 +1,2 @@ +// Decorators are not parsed. +class A { @dec m() {} } diff --git a/packages/codemode-rust/conformance/cases/syntax-class-decorator.json b/packages/codemode-rust/conformance/cases/syntax-class-decorator.json new file mode 100644 index 0000000000000..ded0ebe5c79f8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/syntax-class-decorator.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ParseError", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/syntax-class-private-in.js b/packages/codemode-rust/conformance/cases/syntax-class-private-in.js new file mode 100644 index 0000000000000..999d8fa88b49a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/syntax-class-private-in.js @@ -0,0 +1,2 @@ +// A private name outside a class that declares it is a parse error. +class A { has(o) { return #x in o } } diff --git a/packages/codemode-rust/conformance/cases/syntax-class-private-in.json b/packages/codemode-rust/conformance/cases/syntax-class-private-in.json new file mode 100644 index 0000000000000..ded0ebe5c79f8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/syntax-class-private-in.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ParseError", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/syntax-parse-acorn.js b/packages/codemode-rust/conformance/cases/syntax-parse-acorn.js new file mode 100644 index 0000000000000..18de833281568 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/syntax-parse-acorn.js @@ -0,0 +1,2 @@ +let a = 1 +let a = 2 diff --git a/packages/codemode-rust/conformance/cases/syntax-parse-acorn.json b/packages/codemode-rust/conformance/cases/syntax-parse-acorn.json new file mode 100644 index 0000000000000..ded0ebe5c79f8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/syntax-parse-acorn.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ParseError", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/syntax-unsupported-bindings.js b/packages/codemode-rust/conformance/cases/syntax-unsupported-bindings.js new file mode 100644 index 0000000000000..d432ad2b5d73c --- /dev/null +++ b/packages/codemode-rust/conformance/cases/syntax-unsupported-bindings.js @@ -0,0 +1,20 @@ +// A class's name is not a binding, nor is a var only a with body declares; using is a const nothing disposes; an +// import below the top level does nothing in the program. +const r = [typeof Map, typeof Point] +var y = 1 +if (false) with ({}) { var y = 2; var z = 3 } +r.push(y) +try { z } catch (e) { r.push(e.name) } +{ + using u = { v: 1 } + await using w = 2 + r.push(u.v, w) + try { u = 3 } catch (e) { r.push(e.message) } +} +{ import q from "nope" } +r.push(typeof q) +function f() { import q from "fs" } +try { f() } catch (e) { r.push([e.name, e.message]) } +return r +class Map {} +{ class Point {} } diff --git a/packages/codemode-rust/conformance/cases/syntax-unsupported-bindings.json b/packages/codemode-rust/conformance/cases/syntax-unsupported-bindings.json new file mode 100644 index 0000000000000..84c14ee986503 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/syntax-unsupported-bindings.json @@ -0,0 +1,7 @@ +{ + "bindings": {}, + "ok": false, + "kind": "ExecutionFailure", + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/syntax-unsupported-caught.js b/packages/codemode-rust/conformance/cases/syntax-unsupported-caught.js new file mode 100644 index 0000000000000..e92458ae35f97 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/syntax-unsupported-caught.js @@ -0,0 +1,18 @@ +// The SyntaxError it throws is catchable, names the ESTree node type, and runs after earlier statements. +const r = [] +for (const run of [ + () => { class A {} }, + () => { with ({}) {} }, + () => { debugger }, + function () { return new.target }, + () => (class {}), + () => ({ m() { return super.m() } }).m(), +]) { + try { + r.push(run()) + } catch (e) { + r.push([e.name, e instanceof SyntaxError, e.message.split(".")[0]]) + } +} +console.log("done") +return r diff --git a/packages/codemode-rust/conformance/cases/syntax-unsupported-caught.json b/packages/codemode-rust/conformance/cases/syntax-unsupported-caught.json new file mode 100644 index 0000000000000..7d023ef759375 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/syntax-unsupported-caught.json @@ -0,0 +1,32 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + null, + [ + "SyntaxError", + true, + "Syntax 'WithStatement' is not supported" + ], + [ + "SyntaxError", + true, + "Syntax 'DebuggerStatement' is not supported" + ], + [ + "SyntaxError", + true, + "new" + ], + null, + [ + "TypeError", + false, + "The called value is not a function" + ] + ], + "logs": [ + "done" + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/syntax-unsupported-uncaught.js b/packages/codemode-rust/conformance/cases/syntax-unsupported-uncaught.js new file mode 100644 index 0000000000000..9e43b097fb3b8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/syntax-unsupported-uncaught.js @@ -0,0 +1,3 @@ +console.log("before") +class Point { constructor(x) { this.x = x } } +console.log("after") diff --git a/packages/codemode-rust/conformance/cases/syntax-unsupported-uncaught.json b/packages/codemode-rust/conformance/cases/syntax-unsupported-uncaught.json new file mode 100644 index 0000000000000..0c746fa138d96 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/syntax-unsupported-uncaught.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": null, + "logs": [ + "before", + "after" + ], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/syntax-unsupported-unreached.js b/packages/codemode-rust/conformance/cases/syntax-unsupported-unreached.js new file mode 100644 index 0000000000000..d72de60ed0aba --- /dev/null +++ b/packages/codemode-rust/conformance/cases/syntax-unsupported-unreached.js @@ -0,0 +1,13 @@ +// Unsupported syntax fails only where it runs: unreached classes, with, debugger, new.target, import.meta and super +// leave the rest of the program running. +const r = [] +if (false) { class A {} } +if (false) with (o) {} +if (false) debugger +function f() { return new.target } +function g() { return import.meta } +const o = { m() { return super.x } } +const h = () => class {} +r.push(typeof f, typeof g, typeof o.m, typeof h) +switch (1) { case 2: class B {} } +return r diff --git a/packages/codemode-rust/conformance/cases/syntax-unsupported-unreached.json b/packages/codemode-rust/conformance/cases/syntax-unsupported-unreached.json new file mode 100644 index 0000000000000..b46975d9849fe --- /dev/null +++ b/packages/codemode-rust/conformance/cases/syntax-unsupported-unreached.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "function", + "function", + "function", + "function" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/template-literals.js b/packages/codemode-rust/conformance/cases/template-literals.js new file mode 100644 index 0000000000000..e82c3516c69cd --- /dev/null +++ b/packages/codemode-rust/conformance/cases/template-literals.js @@ -0,0 +1,4 @@ +const name = "world", n = 3 +const nested = `a${`b${n}`}c` +return [`hello ${name}!`, `${n} * 2 = ${n * 2}`, nested, `line1 +line2`] diff --git a/packages/codemode-rust/conformance/cases/template-literals.json b/packages/codemode-rust/conformance/cases/template-literals.json new file mode 100644 index 0000000000000..70d616c591992 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/template-literals.json @@ -0,0 +1,12 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "hello world!", + "3 * 2 = 6", + "ab3c", + "line1\nline2" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/throw-errors.js b/packages/codemode-rust/conformance/cases/throw-errors.js new file mode 100644 index 0000000000000..e29ccb4c94e52 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/throw-errors.js @@ -0,0 +1,2 @@ +const kinds = [() => { throw new Error("e") }, () => { throw new TypeError("t") }, () => { throw new RangeError("r") }] +return kinds.map((f) => { try { f() } catch (e) { return [e.name, e.message, String(e), e instanceof Error, e instanceof TypeError, e instanceof RangeError] } }) diff --git a/packages/codemode-rust/conformance/cases/throw-errors.json b/packages/codemode-rust/conformance/cases/throw-errors.json new file mode 100644 index 0000000000000..e6b56fc0d1fa2 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/throw-errors.json @@ -0,0 +1,32 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + [ + "Error", + "e", + "Error: e", + true, + false, + false + ], + [ + "TypeError", + "t", + "TypeError: t", + true, + true, + false + ], + [ + "RangeError", + "r", + "RangeError: r", + true, + false, + true + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/throw-values.js b/packages/codemode-rust/conformance/cases/throw-values.js new file mode 100644 index 0000000000000..c6c14b71a6c14 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/throw-values.js @@ -0,0 +1,3 @@ +const out = [] +for (const v of ["str", 42, { code: 7 }, null]) { try { throw v } catch (e) { out.push(e) } } +return out diff --git a/packages/codemode-rust/conformance/cases/throw-values.json b/packages/codemode-rust/conformance/cases/throw-values.json new file mode 100644 index 0000000000000..5e554512ed7ea --- /dev/null +++ b/packages/codemode-rust/conformance/cases/throw-values.json @@ -0,0 +1,14 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "str", + 42, + { + "code": 7 + }, + null + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/tool-calls.js b/packages/codemode-rust/conformance/cases/tool-calls.js new file mode 100644 index 0000000000000..5670e11eb207a --- /dev/null +++ b/packages/codemode-rust/conformance/cases/tool-calls.js @@ -0,0 +1,4 @@ +const a = await tools.echo({ id: 1 }) +const b = await tools["echo"]({ id: 2 }) +const s = await tools.git.status() +return [a, b, s, s.branch] diff --git a/packages/codemode-rust/conformance/cases/tool-calls.json b/packages/codemode-rust/conformance/cases/tool-calls.json new file mode 100644 index 0000000000000..3555cb5767d30 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/tool-calls.json @@ -0,0 +1,15 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 1, + 2, + { + "branch": "main", + "dirty": true + }, + "main" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/tool-concurrent.js b/packages/codemode-rust/conformance/cases/tool-concurrent.js new file mode 100644 index 0000000000000..5979e827aa15f --- /dev/null +++ b/packages/codemode-rust/conformance/cases/tool-concurrent.js @@ -0,0 +1,2 @@ +const results = await Promise.all([3, 1, 2].map((id) => tools.echo({ id }))) +return results diff --git a/packages/codemode-rust/conformance/cases/tool-concurrent.json b/packages/codemode-rust/conformance/cases/tool-concurrent.json new file mode 100644 index 0000000000000..98448d0dade29 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/tool-concurrent.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + 3, + 1, + 2 + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/tool-result-copy.js b/packages/codemode-rust/conformance/cases/tool-result-copy.js new file mode 100644 index 0000000000000..d0a9aba077be7 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/tool-result-copy.js @@ -0,0 +1,4 @@ +const s = await tools.git.status() +s.branch = "changed" +const t = await tools.git.status() +return [s.branch, t.branch] diff --git a/packages/codemode-rust/conformance/cases/tool-result-copy.json b/packages/codemode-rust/conformance/cases/tool-result-copy.json new file mode 100644 index 0000000000000..8f221c0d11246 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/tool-result-copy.json @@ -0,0 +1,10 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "changed", + "main" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/try-catch-finally.js b/packages/codemode-rust/conformance/cases/try-catch-finally.js new file mode 100644 index 0000000000000..24f518de0d2e8 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/try-catch-finally.js @@ -0,0 +1,5 @@ +const log = [] +const f = () => { try { log.push("try"); throw new Error("x") } catch (e) { log.push("catch " + e.message); return "from catch" } finally { log.push("finally") } } +const r = f() +try { log.push("no throw") } catch { log.push("unreachable") } finally { log.push("finally2") } +return [r, log] diff --git a/packages/codemode-rust/conformance/cases/try-catch-finally.json b/packages/codemode-rust/conformance/cases/try-catch-finally.json new file mode 100644 index 0000000000000..10a4348314c1b --- /dev/null +++ b/packages/codemode-rust/conformance/cases/try-catch-finally.json @@ -0,0 +1,16 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "from catch", + [ + "try", + "catch x", + "finally", + "no throw", + "finally2" + ] + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/typeof.js b/packages/codemode-rust/conformance/cases/typeof.js new file mode 100644 index 0000000000000..77d3755629416 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/typeof.js @@ -0,0 +1 @@ +return [typeof 1, typeof "s", typeof true, typeof undefined, typeof null, typeof {}, typeof [], typeof (() => 1), typeof function* () {}, typeof undeclaredName, typeof tools.echo] diff --git a/packages/codemode-rust/conformance/cases/typeof.json b/packages/codemode-rust/conformance/cases/typeof.json new file mode 100644 index 0000000000000..aa153bcdb2a43 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/typeof.json @@ -0,0 +1,19 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "number", + "string", + "boolean", + "undefined", + "object", + "object", + "object", + "function", + "function", + "undefined", + "function" + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/cases/var-hoisting.js b/packages/codemode-rust/conformance/cases/var-hoisting.js new file mode 100644 index 0000000000000..2119d851c2db0 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/var-hoisting.js @@ -0,0 +1,4 @@ +const before = typeof x +var x = 5 +function f() { if (false) { var y = 1 } return y } +return [before, x, f() === undefined] diff --git a/packages/codemode-rust/conformance/cases/var-hoisting.json b/packages/codemode-rust/conformance/cases/var-hoisting.json new file mode 100644 index 0000000000000..47c995702e1c4 --- /dev/null +++ b/packages/codemode-rust/conformance/cases/var-hoisting.json @@ -0,0 +1,11 @@ +{ + "bindings": {}, + "ok": true, + "value": [ + "undefined", + 5, + true + ], + "logs": [], + "metadata": null +} diff --git a/packages/codemode-rust/conformance/frames/arrays.ts b/packages/codemode-rust/conformance/frames/arrays.ts new file mode 100644 index 0000000000000..07575d4f50e62 --- /dev/null +++ b/packages/codemode-rust/conformance/frames/arrays.ts @@ -0,0 +1,46 @@ +// Arrays and Uint8Array: cases for conformance/streaming.ts (see its `holding`, `after` and `during`). +type Helpers = { + after: (setup: string, work: string) => string + during: (setup: string, loop: string) => string + text: unknown +} + +const holdingIterable = + "{ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) }), return: () => ({}) } } }" + +export default (_: Helpers) => ({ + holds: [ + "[...new Uint8Array([1, 2]).map((x) => S(x) + x)]", + "(() => { const r = []; new Uint8Array([1, 2]).forEach((x, i) => r.push(S(x) + i)); return r })()", + "[...new Uint8Array([1, 2, 3]).filter((x) => S(x) >= 0 && x !== 2)]", + "new Uint8Array([1, 2]).some((x) => S(x) < 0)", + "new Uint8Array([1, 2]).every((x) => S(x) >= 0)", + "new Uint8Array([1, 2]).find((x) => S(x) >= 0 && x === 2)", + "new Uint8Array([1, 2]).findIndex((x) => S(x) >= 0 && x === 2)", + "new Uint8Array([1, 2]).findLast((x) => S(x) >= 0 && x === 1)", + "new Uint8Array([1, 2]).findLastIndex((x) => S(x) >= 0 && x === 1)", + "new Uint8Array([1, 2]).reduce((a, x) => a + S(x) + x, 0)", + "new Uint8Array([1, 2, 3]).reduceRight((a, x, i) => a + S(x) + i)", + "[...Uint8Array.from([1, 2], (x, i) => S(x) + x + i)]", + "[...Uint8Array.from(new Uint8Array([1, 2]), function (x) { return S(x) + x + this.k }, { k: 10 })]", + `[...Uint8Array.from(${holdingIterable})]`, + `[...Uint8Array.from(${holdingIterable}, (x) => S(x) + x)]`, + `[...new Uint8Array(${holdingIterable})]`, + `(() => { const u = new Uint8Array(4); u.set(${holdingIterable}, 1); return [...u] })()`, + ] as Array, + programs: [ + "const u = new Uint8Array([1, 2]); return [...u.map((x) => (x === 1 ? 300 : '7'))]", + "try { new Uint8Array([]).reduce((a, x) => a + x) } catch (e) { return [e.name, e.message] }", + "try { Uint8Array.from([1, 2], (x) => { if (x === 2) throw new Error('m' + x); return x }) } catch (e) { return [e.name, e.message] }", + "try { new Uint8Array(1).set({ [Symbol.iterator]: function* () { yield 1; yield 2 } }) } catch (e) { return [e.name, e.message] }", + "const it = { [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 2, value: ++n }) } } }; const u = new Uint8Array(5); u.set(it, 2); return [[...u], [...new Uint8Array(it)], [...Uint8Array.from(it, (x) => x * 3)]]", + "return [[...new Uint8Array(new Set([1, 2]))], [...Uint8Array.from('12')], [...Uint8Array.from(new Map([[3, 4]]).keys())], [...new Uint8Array([1, 2].values())], [...new Uint8Array((function* () { yield 5; yield 6 })())]]", + "const u = new Uint8Array([5, 6, 7]); const seen = []; u.forEach((x, i, a) => { seen.push([x, i, a === u]); if (i === 0) u[2] = 9 }); return seen", + "const u = new Uint8Array([1, 2, 3, 4]); return [u.some((x) => x > 3), u.every((x) => x > 0), u.findLast((x) => x < 3), u.findIndex((x) => x > 9), u.reduceRight((a, x) => a + x, '')]", + ] as Array, + suspensions: [ + "return [...new Uint8Array([1, 2]).map((x) => hold({ query: wait({}).then(() => 'echo') }).items.length + x)]", + "return [...Uint8Array.from([1, 2], (x) => hold({ query: wait({}).then(() => 'echo') }).items.length + x)]", + "return new Uint8Array([1, 2]).reduce((a, x) => a + hold({ query: wait({}).then(() => 'echo') }).items.length + x, 0)", + ] as Array, +}) diff --git a/packages/codemode-rust/conformance/frames/callbacks.ts b/packages/codemode-rust/conformance/frames/callbacks.ts new file mode 100644 index 0000000000000..64250a12f63e5 --- /dev/null +++ b/packages/codemode-rust/conformance/frames/callbacks.ts @@ -0,0 +1,134 @@ +// JSON, crossings to the host, strings and the web globals: cases for conformance/streaming.ts (see its `holding`, `after` and `during`). +type Helpers = { + after: (setup: string, work: string) => string + during: (setup: string, loop: string) => string + text: unknown +} + +// An iterable whose `next` returns `value` while `n`, which `value` increments, is below 2. +const iterable = (value: string) => + `{ [Symbol.iterator]() { let n = 0; return { next: () => (n > 1 ? { done: true } : { done: false, value: ${value} }), return: () => ({}) } } }` +// Spins for 250 ms of wall-clock time: see the busy loops in streaming.ts. +const busy = "for (let end = Date.now() + 250; Date.now() < end; ) {}" + +export default ({ after, during, text }: Helpers) => ({ + holds: [ + // A `hold` call inside a toJSON while values cross (a function in an argument is left out, so no toJSON runs there). + "await send({ query: { toJSON: () => 'echo' + S(1) } }).then((r) => r.query)", + "hold({ query: { toJSON: () => 'echo' + S(1) } }).items.length", + "await send({ a: { toJSON: () => S(1) }, p: Promise.resolve(2) })", + `Object.fromEntries(${iterable("['k' + n, S(++n)]")})`, + `new AggregateError(${iterable("S(++n)")}, 'm').errors`, + `AggregateError(${iterable("S(++n)")}).errors`, + `Math.sumPrecise(${iterable("S(++n) + 0.5")})`, + `[...new URLSearchParams(${iterable("['k' + n, S(++n)]")})]`, + `[...new Headers([${iterable("'v' + S(++n)")}])]`, + `[...new Headers(${iterable("['x' + n, String(S(++n))]")})]`, + "({ toString: () => 'x' + S(1) }).toLocaleString()", + // A `hold` call whose arguments hold a toJSON and a promise: its frame parks while the promise settles. + "hold({ query: { toJSON: () => 'echo' }, p: Promise.resolve(1) }).items.length", + "hold({ p: Promise.resolve(1), query: { toJSON: () => 'echo' } }).items.length", + "[1, 2].map((x) => hold({ query: { toJSON() { log.push('tj ' + x); return 'echo' } }, p: Promise.resolve(x) }).items.length + x)", + "(() => { try { hold({ query: { toJSON: () => 'echo' }, p: Promise.reject(new Error('no')) }) } catch (e) { return [e.name, e.message] } })()", + "(() => { try { hold({ p: Promise.resolve(1), query: { toJSON() { throw new Error('tj') } } }) } catch (e) { return [e.name, e.message] } })()", + "await Promise.resolve(1).then((x) => hold({ query: { toJSON: () => 'echo' }, p: Promise.resolve(x) }).items.length + x)", + // A key or part converted by the program's toString or valueOf inside the loop over the entries or pairs. + // An entry holding a function is rejected, so a key's methods are inherited. + "Object.fromEntries([[Object.create({ toString: () => 'k' + S(1) }), 1], ['b', 2]])", + "Object.fromEntries([[Object.create({ toString: () => ({}), valueOf: () => S(3) }), 'v']])", + `Object.fromEntries(${iterable("[Object.create({ toString: () => 'k' + S(++n) }), n]")})`, + "[...new URLSearchParams([[{ toString: () => 'a' + S(1) }, 'b'], ['c', { toString: () => 'd' + S(2) }]])]", + "[...new Headers([[{ toString: () => 'x-' + S(1) }, { toString: () => 'v' + S(2) }]])]", + `[...new URLSearchParams(${iterable("[{ toString: () => 'k' + S(++n) }, n]")})]`, + ] as Array, + programs: [ + // A `hold` call inside a toJSON of the program's result. + `const log = []; return { t: { toJSON: () => (log.push('call'), hold({ query: Promise.resolve('echo') }).items.length) }, log }`, + // The internal walk: order of toJSON and replacer calls, keys and holders, what is left out, and errors. + `const log = []; const r = (k, v) => { log.push([k, typeof v]); return k === 'skip' ? undefined : v } + const v = { a: 1, skip: 2, b: [1, , { toJSON(k) { log.push('toJSON ' + k); return { c: undefined, d: () => 1, e: 'x' } } }], f: undefined } + return [JSON.stringify(v, r), JSON.stringify(v, r, 2), JSON.stringify(v, r, '--'), log]`, + `const r = (k, v) => (k === '' ? v : undefined); return [JSON.stringify({ a: 1, b: 2 }, r, 2), JSON.stringify([1, 2], r, 2), JSON.stringify({}, r, 2), JSON.stringify([], r, 2)]`, + `return [JSON.stringify(5, (k, v) => undefined), JSON.stringify({ a: 1 }, (k, v) => (k ? v + 1 : v)), JSON.stringify('s', (k, v) => [k, v])]`, + `const a = [1, 2, 3]; return JSON.stringify(a, (k, v) => { if (k === '0') a.length = 1; return v })`, + `const o = { a: 1, b: 2 }; return JSON.stringify(o, (k, v) => { if (k === 'a') { delete o.b; o.c = 3 } return v })`, + `const o = { x: 1 }; return [JSON.stringify(o, ['x', 'y'], 1), JSON.stringify({ toJSON: () => ({ y: 2, x: 1 }) }, ['y', 'x']), JSON.stringify([{ x: 1, y: 2 }], ['y'])]`, + `try { JSON.stringify({ a: { toJSON() { throw new RangeError('tj') } } }) } catch (e) { return [e.name, e.message] }`, + `try { JSON.stringify([1, [2]], (k, v) => { if (v === 2) throw new TypeError('r'); return v }) } catch (e) { return [e.name, e.message] }`, + `const o = { a: 1 }; try { JSON.stringify(o, (k, v) => (k === 'a' ? o : v)) } catch (e) { return [e.name, e.message] }`, + `return JSON.stringify({ p: 1, q: [2] }, (k, v) => (k === 'p' || k === '0' ? Promise.resolve(1) : v))`, + `const log = []; try { JSON.stringify({ a: 1, p: Promise.resolve(1) }, (k, v) => { log.push(k); return v }) } catch (e) { return [e.name, e.message, log] }`, + `try { return JSON.stringify([Promise.resolve(1)]) } catch (e) { return [e.name, e.message] }`, + `const e = new Error('m'); e.name = undefined; const f = new TypeError('n'); f.name = 5; f.x = 1; return JSON.stringify({ e, f }, (k, v) => v, 1)`, + `return [JSON.stringify({ a: Symbol.iterator, b: [Symbol.iterator] }, (k, v) => v), JSON.stringify({ s: Symbol.iterator }, ['s'], 1)]`, + `const p = Object.create({ inh: 1 }); p.own = 2; p.gone = 3; return JSON.stringify({ p }, (k, v) => { if (k === 'own') delete p.gone; return v })`, + `const a = [1, 2, 3]; return JSON.stringify(a, (k, v) => { if (k === '0') a[2] = 'changed'; return v })`, + `let d = 1; for (let i = 0; i < 99; i++) d = [d]; return [JSON.stringify(d, (k, v) => v).length, JSON.stringify({ d }, (k, v) => v).length]`, + `const big = 'x'.repeat(1 << 20); const parts = Array(600).fill(big); try { JSON.stringify(parts, (k, v) => v) } catch (e) { return [e.name, e.message] }`, + `const log = []; const s = JSON.stringify({ e: new TypeError('m'), d: new Date(0), m: new Map([[1, 2]]), s: new Set([1]), u: new URL('https://a.b/c') }, (k, v) => { log.push(k); return v }, '\\t'); return [s, log]`, + `const seen = []; JSON.stringify({ a: [1, { b: 2 }] }, function (k, v) { seen.push([k, Array.isArray(this) ? 'array' : typeof this]); return v }); return seen`, + // A replacer or toJSON that calls back into JSON.stringify. + `return JSON.stringify({ a: { b: 1 }, c: [2] }, (k, v) => (k === 'a' ? JSON.stringify(v, (k2, v2) => v2) : v))`, + `return JSON.stringify({ a: { toJSON: () => JSON.stringify({ x: { toJSON: () => 1 } }) } }, null, 1)`, + // The other built-ins of this family, over custom iterables. + `const log = []; const it = { [Symbol.iterator]() { let n = 0; return { next() { log.push('next'); return n < 2 ? { done: false, value: n++ === 0 ? ['a', 1] : 5 } : { done: true } }, return() { log.push('return'); return {} } } } } + try { Object.fromEntries(it) } catch (e) { log.push(e.message) } return log`, + `const log = []; const it = { [Symbol.iterator]() { let n = 0; return { next() { log.push('next'); return n < 2 ? { done: false, value: n++ ? 'x' : 1 } : { done: true } }, return() { log.push('return'); return {} } } } } + try { Math.sumPrecise(it) } catch (e) { log.push(e.message) } return [log, Math.sumPrecise([0.1, 0.2, -0.3]), Math.sumPrecise([])]`, + `const log = []; const pair = { [Symbol.iterator]() { let n = 0; return { next() { log.push('part'); return n < 2 ? { done: false, value: n++ ? { toString() { throw new Error('part') } } : 'k' } : { done: true } }, return() { log.push('close pair'); return {} } } } } + const outer = { [Symbol.iterator]() { let n = 0; return { next() { log.push('pair'); return n++ < 2 ? { done: false, value: pair } : { done: true } }, return() { log.push('close'); return {} } } } } + try { new URLSearchParams(outer) } catch (e) { log.push(e.message) } return log`, + `const g = function* () { yield ['a', '1']; yield new Set(['b', 2]) }; return [String(new URLSearchParams(g())), [...new Headers(g())], [...new Headers(new Map([['x', 'y']]))]]`, + `try { new Headers([['a', 'b', 'c']]) } catch (e) { return [e.name, e.message] }`, + `try { new URLSearchParams([1]) } catch (e) { return [e.name, e.message] }`, + `const e = new AggregateError(new Set([1, new Error('x')]), 'all', { cause: 2 }); return [e.errors.length, e.message, e.cause, AggregateError([]).errors]`, + `try { new AggregateError(5) } catch (e) { return [e.name, e.message] }`, + `try { Object.fromEntries(5) } catch (e) { return [e.name, e.message] }`, + `try { Math.sumPrecise(5) } catch (e) { return [e.name, e.message] }`, + `try { AggregateError({}) } catch (e) { return [e.name, e.message] }`, + `return [({}).toLocaleString(), Object.prototype.toLocaleString.call(5), Object.prototype.toLocaleString.call([1, [2]])]`, + `try { return Object.prototype.toLocaleString.call({ toString: 7 }) } catch (e) { return [e.name, e.message] }`, + `const t = Promise.prototype.then; const log = []; Promise.prototype.then = function (f, r) { log.push('then'); return t.call(this, f, r) } + const n = await hold({ query: 'echo' }).then((r) => r.items.length); Promise.prototype.then = t; return [n > 0, log]`, + `const r = hold({ query: 'echo' }); return [await r.catch(() => 0) === r, await r.finally(5) !== r, (await r.finally(() => 1)).items.length > 0]`, + // A toJSON in a host call's arguments, which the crossing leaves out with the other functions. + `const log = []; const p = send({ p: Promise.resolve(1), t: { toJSON() { log.push('tj'); Promise.resolve().then(() => log.push('then')); return 1 } } }) + Promise.resolve().then(() => log.push('job')); log.push('after'); const r = await p; return [r, log]`, + `const log = []; Promise.resolve().then(() => log.push('job')); return { t: { toJSON() { log.push('tj'); Promise.resolve().then(() => log.push('then')); return 1 } }, p: Promise.resolve(1), log }`, + `Date.prototype.toJSON = () => 'mine'; return [await send({ d: new Date(0) }), await send({ d: new Date(0), p: Promise.resolve(1) })]`, + `URL.prototype.toJSON = () => 'mine'; return [await send({ u: new URL('https://a.b/c') }), await send({ u: new URL('https://a.b/c'), p: Promise.resolve(1) })]`, + `return hold({ query: { toJSON: () => 'echo' }, p: Promise.reject(new Error('no')) }).items.length`, + `return hold({ query: { toJSON: () => 'echo' }, p: Promise.resolve(1), q: { toJSON() { null.x } } }).items.length`, + `return [{ toJSON: () => 'echo' }].map((q) => hold.call(null, { query: q }).items.length)`, + `return await send({ a: { toJSON: Object.prototype.toString }, p: Promise.resolve(1) })`, + `return await send({ a: { toJSON: () => send(1) } })`, + `const t = { toJSON(k) { return { k, n: { toJSON: (k2) => k2 + '!' } } } }; return [await send({ t, u: [t] }), await send({ t, p: Promise.resolve(1) }), hold({ query: 'echo', t }).items.length]`, + `return [{ t: { toJSON() { return Promise.resolve(5) } } }, await send({ t: { toJSON() { return Promise.resolve(5) } } })]`, + `try { return [{ toJSON: () => 'echo' }].map((q) => hold.call(null, { query: q, p: Promise.resolve(1) }).items.length) } catch (e) { return [e.name, e.message] }`, + // A key or part whose conversion throws closes the iterator; the order of the conversions against the reads. + `const log = []; const it = { [Symbol.iterator]() { return { next: () => ({ done: false, value: [Object.create({ toString() { throw new Error('ts') } }), 1] }), return: () => (log.push('closed'), {}) } } } + try { Object.fromEntries(it) } catch (e) { log.push(e.message) } return log`, + `const log = []; const it = { [Symbol.iterator]() { return { next: () => ({ done: false, value: [{ toString() { throw new Error('ts') } }, 'v'] }), return: () => (log.push('closed'), {}) } } } + try { new URLSearchParams(it) } catch (e) { log.push(e.message) } try { new Headers(it) } catch (e) { log.push(e.message) } return log`, + `const log = []; const key = (k) => Object.create({ toString() { log.push('ts ' + k); return k } }); const it = { [Symbol.iterator]() { let n = 0; return { next() { log.push('next ' + n); return n < 2 ? { done: false, value: [key('k' + n), n++] } : { done: true } } } } } + return [Object.fromEntries(it), String(new URLSearchParams(it)), log]`, + ] as Array, + suspensions: [ + `const p = fetch(${JSON.stringify(text)}); const s = JSON.stringify({ a: [1, { toJSON() { ${busy} return 2 } }], b: 'x' }, null, 1); const r = await p; return [r.status, s]`, + `const p = fetch(${JSON.stringify(text)}); const s = JSON.stringify({ a: [1, 2], b: { c: 3 } }, (k, v) => { if (k === 'c') { ${busy} } return v }); const r = await p; return [r.status, s]`, + `const p = fetch(${JSON.stringify(text)}); const o = Object.fromEntries(${iterable(`(n++ ? (() => { ${busy} return ['b', n] })() : ['a', n])`)}); const r = await p; return [r.status, o]`, + `const p = fetch(${JSON.stringify(text)}); const h = new Headers([${iterable(`(n++ ? (() => { ${busy} return 'v' })() : 'k')`)}]); const r = await p; return [r.status, [...h]]`, + `const p = fetch(${JSON.stringify(text)}); const s = ({ toString() { ${busy} return 's' } }).toLocaleString(); const r = await p; return [r.status, s]`, + // Suspended inside a toJSON while values cross, and while a `hold` call's frame is parked. + `const w = wait({}); return await send({ a: { toJSON() { ${busy} return 2 } }, w })`, + `const w = wait({}); return { a: { toJSON() { ${busy} return 2 } }, w }`, + `const w = wait({}); const n = hold({ query: { toJSON() { ${busy} return 'echo' } } }).items.length; return [n, await w]`, + `return await send({ w: wait({}), a: { toJSON() { for (let i = 0; i < 2000000; i++) {} return 2 } } })`, + `function f() { return hold({ query: { toJSON: () => 'echo' }, w: wait({}) }).items.length } return [f(), 1]`, + `function f() { return hold({ w: wait({}), query: { toJSON: () => 'echo' } }).items.length } return [f(), 1]`, + // Suspended inside the toString of an entry's key or a pair's part. + `return Object.fromEntries([[Object.create({ toString: () => 'k' + hold({ query: wait({}).then(() => 'echo') }).items.length }), 1]])`, + `return String(new URLSearchParams([['a', { toString: () => 'b' + hold({ query: wait({}).then(() => 'echo') }).items.length }]]))`, + `return [...new Headers([[Object.create({ toString: () => 'x-' + hold({ query: wait({}).then(() => 'echo') }).items.length }), 'v']])]`, + ] as Array, +}) diff --git a/packages/codemode-rust/conformance/frames/collections.ts b/packages/codemode-rust/conformance/frames/collections.ts new file mode 100644 index 0000000000000..43bb86d394da6 --- /dev/null +++ b/packages/codemode-rust/conformance/frames/collections.ts @@ -0,0 +1,77 @@ +// Map, Set, WeakMap, groupBy and the Promise combinators: cases for conformance/streaming.ts (see its `holding`, `after` and `during`). +type Helpers = { + after: (setup: string, work: string) => string + during: (setup: string, loop: string) => string + text: unknown +} + +// A Set-like object whose `keys()` steps through `values` with `next`, and may close. +const keysOf = (values: string, extra = "") => + `keys() { const v = ${values}; let i = 0; return { next: () => (i < v.length ? { done: false, value: v[i++] } : { done: true }) ${extra} } }` + +export default (_: Helpers) => ({ + holds: [ + // The Set methods given a Set-like object: its `has`, its `keys()`, the iterator's `next` and `return`. + "[...new Set([1, 2, 3]).intersection({ size: 5, has: (x) => S(x) > 0 && x !== 2, keys: () => [].values() })]", + "[...new Set([1, 2, 3]).difference({ size: 3, has: (x) => S(x) > 0 && x === 2, keys: () => [].values() })]", + "new Set([1, 2]).isSubsetOf({ size: 2, has: (x) => S(x) > 0, keys: () => [].values() })", + "new Set([1, 2]).isDisjointFrom({ size: 9, has: (x) => S(x) > 0 && x === 2, keys: () => [].values() })", + `[...new Set([1]).union({ size: 1, has: () => false, keys: () => { S(0); return [2, 3] } })]`, + `[...new Set([1, 2]).symmetricDifference({ size: 1, has: () => false, keys() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) + n }) } } })]`, + `[...new Set([1, 2]).union({ size: 1, has: () => false, ${keysOf("[S(5), 6]")} })]`, + `new Set([1]).isDisjointFrom({ size: 0, has: () => true, ${keysOf("[1, 2]", ", return: () => ({ r: S(9) })")} })`, + `new Set([1, 2]).isSupersetOf({ size: 2, has: () => true, ${keysOf("[1, 7]", ", return() { S(8); return {} }")} })`, + // getOrInsertComputed, of a Map and of a WeakMap. + "(() => { const m = new Map([[1, 'a']]); return [m.getOrInsertComputed('k', (k) => S(k) + k), m.getOrInsertComputed(1, () => S(2)), [...m]] })()", + "(() => { const w = new WeakMap(); const o = {}; return [w.getOrInsertComputed(o, () => S(1) + 1), w.get(o)] })()", + // WeakMap and WeakSet over an iterable whose `next` calls the program. + "(() => { const o = {}; const w = new WeakSet({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n++ > 0, value: (S(1), o) }) } } }); return w.has(o) })()", + "(() => { const o = {}; const w = new WeakMap({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n++ > 0, value: [o, S(n)] }) } } }); return w.get(o) })()", + // The combinators over an iterable whose `next` calls the program, and one whose iteration fails. + "await Promise.all({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) + n }) } } })", + "await Promise.allSettled({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 0, value: Promise.reject(S(++n)) }) } } })", + "await Promise.race({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 0, value: S(++n) }) } } })", + "await Promise.any({ [Symbol.iterator]() { S(1); return [Promise.reject(1), 2].values() } })", + "await Promise.all({ [Symbol.iterator]() { return { next() { S(1); throw new Error('nx') } } } }).catch((e) => e.message)", + "await Promise.all({ [Symbol.iterator]() { return { next: () => S(1) } } }).catch((e) => e.message)", + // A generator's `return` and `throw` called from a callback, and its `next` from native code. + "(() => { function* g() { try { yield 1 } finally { log.push('finally') } } const it = g(); it.next(); return [1].map((x) => [it.return(S(x)), it.next()]) })()", + "(() => { function* g() { try { yield 1 } catch (e) { yield e + 1 } } const it = g(); it.next(); return [1].map((x) => [it.throw(S(x)), it.next()]) })()", + "(() => { function* g() { try { yield 1 } catch (e) { return e } } const it = g(); it.next(); return [1].map((x) => it.throw.call(it, S(x) + x)) })()", + "Array.from({ [Symbol.iterator]() { const it = (function* () { yield 1; yield 2 })(); return { next: it.next.bind(it), [Symbol.iterator]() { return this } } } }, (x) => S(x) + x)", + // Object.groupBy's keys converted by the program's toString or valueOf, each right after its callback. + "Object.groupBy([1, 2], (x) => ({ toString: () => 'g' + S(x) }))", + "Object.groupBy([1, 2, 3], (x) => ({ toString: () => ({}), valueOf: () => S(x % 2) }))", + "Object.groupBy({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) }) } } }, (x) => ({ toString: () => 'k' + S(x) }))", + ] as Array, + programs: [ + // Iteration failures and early closes. + "return [new Set([1]).isDisjointFrom({ size: 0, has: () => true, keys: () => ({ next: () => ({ done: false, value: 1 }), return: () => 1 }) })]", + "try { new Set([1]).union({ size: 1, has: () => true, keys: () => ({ next: 5 }) }) } catch (e) { return [e.name, e.message] }", + "try { new Set([1]).union({ size: 1, has: () => true, keys: () => ({ next: () => 5 }) }) } catch (e) { return [e.name, e.message] }", + "const log = []; function* k() { try { yield 1; yield 2 } finally { log.push('closed') } } return [new Set([1]).isSupersetOf({ size: 1, has: () => true, keys: k }), new Set([1, 5]).isSupersetOf({ size: 2, has: () => true, keys: k }), log]", + "const log = []; const w = new WeakSet({ [Symbol.iterator]() { return { next: () => ({ done: false, value: 1 }), return() { log.push('closed'); return {} } } } }); return log", + "try { new WeakSet({ [Symbol.iterator]() { return { next: () => ({ done: false, value: 1 }), return() { return {} } } } }) } catch (e) { return [e.name, e.message] }", + "try { new WeakMap([[1, 2]]) } catch (e) { return [e.name, e.message] }", + "return await Promise.race({ [Symbol.iterator]: 5 }).catch((e) => [e.name, e.message])", + "return await Promise.all({ [Symbol.iterator]() { throw new RangeError('open') } }).catch((e) => [e.name, e.message])", + "return await Promise.all((function* () { yield 1; yield Promise.resolve(2) })())", + "function* g() { const x = yield 1; return x * 2 } const it = g(); it.next(); const r = it.next.call(it, 4); let t; try { it.throw.call(it, 1) } catch (e) { t = e } return [r, it.return(7), t]", + // A generator that throws past a `return` or `throw` request, from a callback and from `yield*` in an async generator. + "function* g() { try { yield 1 } finally { throw new Error('f') } } const it = g(); it.next(); const r = []; try { [1].map(() => it.return(2)) } catch (e) { r.push(e.message) } function* h() { yield 1 } const j = h(); j.next(); try { [1].forEach(() => j.throw(new Error('t'))) } catch (e) { r.push(e.message) } return [r, j.next()]", + "function* g() { yield 42; throw new Error('x') } async function* a() { yield* g() } const it = a(); await it.next(); try { await it.throw(new Error('c')) } catch (e) { return [e.message, await it.next()] }", + "function* k() { try { yield 1 } finally { throw new Error('fin') } } try { new Set([5]).isSupersetOf({ size: 1, has: () => true, keys: k }) } catch (e) { return e.message }", + // Object.groupBy converts each key right after its callback, and a throwing conversion closes the iterator. + `const log = []; const r = Object.groupBy(['a', 'b'], (x) => { log.push('cb ' + x); return { toString() { log.push('ts ' + x); return x } } }); return [r, log]`, + `const log = []; const it = { [Symbol.iterator]() { return { next: () => ({ done: false, value: 1 }), return: () => (log.push('closed'), {}) } } } + try { Object.groupBy(it, () => ({ toString() { throw new Error('ts') } })) } catch (e) { log.push(e.message) } return log`, + `return [Object.groupBy([1, 2], (x) => ({ x })), Map.groupBy([1, 2], (x) => ({ toString: () => 'never' })).size]`, + ] as Array, + suspensions: [ + // Suspended while a `hold` call parks in a callback these built-ins call. + `const m = new Map(); const v = m.getOrInsertComputed('k', () => hold({ query: wait({}).then(() => 'echo') }).items.length + 1); return [v, m.get('k')]`, + `return [...new Set([1, 2]).intersection({ size: 3, has: (x) => hold({ query: wait({}).then(() => 'echo') }).items.length + x > 2, keys: () => [].values() })]`, + `return await Promise.all({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: hold({ query: wait({}).then(() => 'echo') }).items.length + n++ }) } } })`, + `return Object.groupBy([1, 2], (x) => ({ toString: () => 'g' + (hold({ query: wait({}).then(() => 'echo') }).items.length + x) }))`, + ] as Array, +}) diff --git a/packages/codemode-rust/conformance/frames/core.ts b/packages/codemode-rust/conformance/frames/core.ts new file mode 100644 index 0000000000000..786a98bd7147f --- /dev/null +++ b/packages/codemode-rust/conformance/frames/core.ts @@ -0,0 +1,341 @@ +// The VM itself: conversions, iteration in bytecode, generators. Cases for conformance/streaming.ts (see its +// `holding`, `after` and `during`). +type Helpers = { + after: (setup: string, work: string) => string + during: (setup: string, loop: string) => string + text: unknown +} + +// An iterable whose `[Symbol.iterator]`, `next` and `return` are the program's, each calling `S` (see `holding`). +const counting = + "({ [Symbol.iterator]() { S(0); let n = 0; return { next: () => ({ done: n >= 2, value: S(++n) + n }), return: () => (S(9), {}) } } })" + +export default ({ after, text }: Helpers) => ({ + holds: [ + `(() => { const r = []; for (const x of ${counting}) r.push(x); return r })()`, + `(() => { const r = []; for (const x of ${counting}) { r.push(x); break } return r })()`, + `(() => { const [a] = ${counting}; return a })()`, + `(() => { const [a, ...rest] = ${counting}; return [a, rest] })()`, + `[...${counting}, 7]`, + `Math.max(...${counting})`, + `(() => { const it = { i: 0, next() { return { done: this.i > 1, value: S(++this.i) } }, [Symbol.iterator]() { return this } }; const r = []; for (const x of it) r.push(x); return r })()`, + // A program's valueOf and toString, called by an operator or a built-in. + `(() => { const o = { valueOf: () => S(1) + 3, toString: () => 'x' + S(2) }; return ['a' + o, o * 2, o < 5, o == 4, \`\${o}\`, -o, ~o] })()`, + `(() => { const o = { toString: () => 'k' + S(1) }; const m = {}; m[o] = 1; return [m, 'k1' in m, delete m[o], { [o]: 2 }] })()`, + `(() => { const o = { valueOf: () => S(1) + 2 }; let x = o; x++; let s = 0; for (let i = 0; i < o; i++) s += i; return [x, s] })()`, + `(() => { const o = { valueOf: () => S(1) + 3, toString: () => 'x' + S(2) }; return ['a'.padStart(o), String(o), Number(o), Math.max(o, 1), [1, 2, 3, 4].slice(o), [o, o].join('-')] })()`, + `(() => { const d = new Date(0); const r = d.setSeconds({ valueOf: () => (S(1), d.setTime(5000), 7) }); return [r, d.getTime()] })()`, + `[3, 1, 2].sort((a, b) => ({ valueOf: () => S(a) * 0 + a - b }))`, + `'abc'.replace('b', () => ({ toString: () => 'X' + S(1) }))`, + `[{ toLocaleString: () => ({ toString: () => 'T' + S(2) }) }].toLocaleString()`, + // Inside generators: yield* over the program's iterator, a delegated generator's return() and throw(), for await + // over a generator, and async generators. + "(() => { function* g() { yield* { [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) }) } } } } return [...g()] })()", + "(() => { function* inner() { try { yield 1 } finally { S(2) } } function* g() { yield* inner() } const a = g(); a.next(); return a.return(5) })()", + "(() => { function* inner() { try { yield 1 } catch (e) { yield S(3) } } function* g() { yield* inner() } const a = g(); a.next(); return a.throw(1) })()", + "await (async () => { const r = []; function* g() { yield S(1); yield 2 } for await (const x of g()) r.push(x); return r })()", + "await (async () => { async function* ag() { yield* { [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) }) } } } } const r = []; for await (const x of ag()) r.push(x); return r })()", + "await (async () => { async function* ag() { yield S(1); const x = S(2); yield x } const r = []; for await (const x of ag()) r.push(x); return r })()", + "await (async () => { async function* ag() { yield S(1) } const it = ag(); return [await it.next(), await it.next()] })()", + // A sync generator's finally, catch and body run under for await and an async generator's yield*. + "await (async () => { function* g() { try { yield 1; yield 2 } finally { S(9) } } const r = []; for await (const x of g()) { r.push(x); break } return r })()", + "await (async () => { function* g() { try { yield 1 } catch (e) { yield S(e) } } async function* ag() { yield* g() } const it = ag(); await it.next(); return it.throw(3) })()", + "await (async () => { function* g() { try { yield 1 } finally { S(4) } } async function* ag() { yield* g() } const it = ag(); await it.next(); return it.return(7) })()", + "await (async () => { async function* ag() { function* g() { yield S(1); yield S(2) } yield* g() } const r = []; for await (const x of ag()) r.push(x); return r })()", + // `for await` and an async generator's `yield*` over iterators whose methods are the program's. + "await (async () => { const r = []; for await (const x of { [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) + n }) } } }) r.push(x); return r })()", + "await (async () => { const r = []; const it = { n: 0, [Symbol.asyncIterator]() { S(0); return this }, next() { return Promise.resolve({ done: this.n > 1, value: S(++this.n) }) } }; for await (const x of it) r.push(x); return r })()", + "await (async () => { const r = []; const it = { [Symbol.asyncIterator]() { return this }, next: async () => ({ done: false, value: S(1) }), return() { r.push('return ' + S(9)); return { done: true } } }; for await (const x of it) { r.push(x); break } return r })()", + "await (async () => { const r = []; const src = { [Symbol.iterator]() { let n = 0; return { next: () => ({ done: false, value: S(++n) }), return: () => (r.push('ret ' + S(8)), {}) } } }; for await (const x of src) { r.push(x); break } return r })()", + "await (async () => { try { for await (const x of { [Symbol.iterator]: () => ({ next: () => { S(1); throw new Error('next threw') } }) }) {} } catch (e) { return e.message } })()", + "await (async () => { const it = { [Symbol.asyncIterator]() { return this }, next: async () => ({ done: false, value: S(1) }), return: async (v) => ({ done: true, value: S(2) + v }), throw: async (e) => ({ done: false, value: S(3) + e }) }; async function* g() { yield* it } const gen = g(); return [await gen.next(), await gen.throw(10), await gen.return(5), await gen.next()] })()", + ], + programs: [ + // Destructuring reads a promise's missing key as undefined, unlike a member read, in every pattern form; a rest + // and array destructuring still refuse it. + `const p = Promise.resolve(1); const { a, b = 5, [Symbol.iterator]: it, then } = p; let c; ({ c } = p); const f = ({ d }) => d; const r = []; for (const { e } of [p]) r.push(e); const [{ g }] = [p]; const o = {}; ({ h: o.h } = p); return [a, b, typeof it, typeof then, c, f(p), r, g, o]`, + `const { a: { b } } = Promise.resolve(1)`, + `const { a, ...r } = Promise.resolve(1)`, + `const [x] = Promise.resolve(1)`, + `for (const [a] of [Promise.resolve(1)]) {}`, + // Where an uncaught error points: a pattern's property, element, rest and target, ... + `const { b: { c } } = { b: null }`, + `const [[a]] = [Promise.resolve(1)]`, + `let o = null; ({ a: o.x } = { a: 1 })`, + `const c = 1; [...c] = []`, + `const c = 1; ({ a: c } = { a: 1 })`, + `const { [{ toString() { return {} } }]: v } = {}`, + // ... the for-in right side, a labeled loop, an object spread, ... + `for (const k in Promise.resolve(1)) {}`, + `x: y: for (const a of 5) {}`, + `const o = { a: 1, ...tools.git }`, + // ... a member's object without parentheses, a namespace path's key and a key that doesn't convert, ... + `const o = null; return (((o))).a`, + `const o = Promise.resolve(1); (o).a = 1`, + `const o = null; delete (o)[0]`, + `return (tools.git)[(0)]`, + `tools.git[Symbol.iterator] = 1`, + `const o = {}; o[{ toString() { return {} } }] += 1`, + // ... a callee without parentheses, a comparison with a constant, a template's substitution, ... + `const o = {}; (o.f)()`, + `return Promise.resolve(1) > 1`, + `let x = Promise.resolve(1); x += 1`, + "return `a${(({ toString() { return {} } }))}`", + // ... and a host call's or import()'s arguments that can't cross. + `const x = 1; await send({ s: Symbol.iterator })`, + `let d = []; for (let i = 0; i < 300; i++) d = [d]; const p = send(1, d); await p`, + `await import("z")`, + // An update or compound assignment checks the member it writes first, and a computed one before its right side + // runs or its key converts. + `tools.a += 1`, + `tools.a ??= 1`, + `tools.git[0]++`, + `const s = "abc"; s.length += 1`, + `const s = "abc"; s[0] = "x"`, + `const o = null; o[(() => { console.log("key"); return 1 })()] = console.log("value")`, + `const o = null; o[{ toString() { console.log("converted"); return "a" } }] += 1`, + `const p = Promise.resolve(1); p[(() => "k")()] = console.log("value")`, + `y; let y = 1`, + // An uncaught value that holds what is not data fails without showing it. + `throw [tools]`, + `throw { a: Promise.resolve(1) }`, + `throw new Map([[1, 2]])`, + `throw () => 1`, + `throw new Date(0)`, + `throw { a: [1, { b: "x" }] }`, + // The call depth limit's RangeError uncaught, with its location: plain recursion, through a callback, and one + // level over the exact limit. + `const f = (n) => f(n + 1); f(1)`, + `const f = () => [0].map(f); f()`, + `const r = (n) => (n > 1 ? r(n - 1) : n); r(10000); return r(10001)`, + `const log = []; function* g() { try { yield 1; yield 2 } finally { log.push('finally'); throw new Error('close') } } + const r = []; try { for (const x of g()) { r.push(x); break } } catch (e) { r.push(e.message) } + try { const [a] = g(); r.push(a) } catch (e) { r.push(e.message) } + try { new Map([[1, 2]].values().map((x) => x)) } catch (e) { r.push(e.message) } + try { Array.from(g(), (x) => { if (x === 1) throw new Error('mapper') }) } catch (e) { r.push(e.message) } + return [r, log]`, + `const it = { [Symbol.iterator]() { return { next: () => ({ done: false, value: 1 }), return: () => 5 } } } + const r = []; try { for (const x of it) break } catch (e) { r.push(e.message) } + try { const [a] = it } catch (e) { r.push(e.message) } + try { for (const x of it) throw new Error('body') } catch (e) { r.push(e.message) } + try { for (const x of { [Symbol.iterator]: () => ({ next: () => 5 }) }) {} } catch (e) { r.push(e.message) } + try { [...{ [Symbol.iterator]: () => 5 }] } catch (e) { r.push(e.message) } + try { for (const x of { [Symbol.iterator]: () => ({}) }) {} } catch (e) { r.push(e.message) } + return r`, + // A conversion with no primitive to give, inline, restarted, in an operator and in a step. + `const o = { valueOf: () => ({}), toString: () => ({}) }; const r = []; for (const f of [() => o + 1, () => 'a'.padStart(o), () => String(o), () => [o].join(), () => Object.groupBy([1], () => o), () => [2, 1].sort(() => o)]) { try { f() } catch (e) { r.push(e.message) } } return r`, + // Their fuel: the conversions run as calls, a built-in after them again. + after( + "const o = { valueOf() { return 1 }, toString() { return 'a' } }", + "for (let j = 0; j < 300; j++) { o + 1; o < 2; o == 1; `${o}`; [o].join(); 'a'.padStart(o); String(o); Math.max(o, 0); const m = {}; m[o] = 1 }", + ), + // `yield*` over a custom iterator and over a generator that gets `return()` and `throw()`, and `for await`: results, + // errors and closing. + `const log = []; const it = { i: 0, [Symbol.iterator]() { return this }, next(v) { log.push('next ' + v); return { done: this.i > 1, value: ++this.i } }, return(v) { log.push('return ' + v); return { done: true, value: v * 2 } }, throw(e) { log.push('throw ' + e); return { done: false, value: e + 100 } } }; function* g() { const r = yield* it; log.push('r ' + r); return r } const out = []; for (const x of g()) out.push(x); it.i = 0; const gen = g(); out.push(gen.next(1), gen.next(2), gen.throw(3), gen.return(4), gen.next(5)); return [out, log]`, + `const log = []; function* inner() { try { yield 1; yield 2 } catch (e) { log.push('caught ' + e); yield 'c' } finally { log.push('inner finally') } return 'done' } function* g() { try { const r = yield* inner(); log.push('r ' + r); yield r } finally { log.push('outer finally') } } const a = g(); const b = g(); const c = g(); return [a.next(), a.return(7), a.next(), b.next(), b.throw(3), b.next(), b.next(), c.return(1), log]`, + `const log = []; function* inner() { try { yield 1 } finally { log.push('f'); yield 'in finally' } } function* g() { const r = yield* inner(); return r } const a = g(); return [a.next(), a.return(9), a.next(), log]`, + `function* inner() { try { yield 1 } finally { throw new Error('from finally') } } function* g() { try { yield* inner() } catch (e) { yield 'caught ' + e.message } } const a = g(); a.next(); const b = g(); b.next(); return [a.return(1), a.next(), b.throw(new Error('x'))]`, + `function* inner() { yield 1 } function* g() { yield* inner() } const a = g(); a.next(); try { a.throw(new Error('uncaught')) } catch (e) { return [e.message, a.next()] }`, + `const r = []; const bad = (o) => ({ [Symbol.iterator]() { return o } }); function* g(o) { yield* bad(o) } for (const o of [{ next: 5 }, { next: () => 5 }, { next: () => ({ value: 1, done: false }), throw: 5 }, { next: () => ({ value: 1, done: false }), return: () => 5 }, { next: () => ({ value: 1, done: false }) }]) { const it = g(o); try { r.push(it.next()); r.push(it.throw(1)) } catch (e) { r.push(e.message) } try { r.push(it.return(2)) } catch (e) { r.push(e.message) } } return r`, + `const log = []; const src = { [Symbol.iterator]() { return { next: () => ({ done: false, value: 1 }), return: () => { log.push('closed'); return {} } } } }; async function* g() { return yield* src } const gen = g(); await gen.next(); try { await gen.throw(4) } catch (e) { log.push(e.message) } return log`, + `const log = []; const src = { [Symbol.iterator]() { return { next: () => ({ done: false, value: 1 }), return: () => 5 } } }; async function* g() { return yield* src } const gen = g(); await gen.next(); try { await gen.throw(4) } catch (e) { log.push(e.message) } return log`, + `const log = []; const src = { [Symbol.iterator]() { return { next: (v) => ({ done: false, value: 'n' + v }), return: (v) => ({ done: true, value: 'r' + v }), throw: (e) => { throw new Error('t' + e) } } } }; async function* g() { return yield* src } const a = g(); const b = g(); return [await a.next(), await a.next(1), await a.return(2), await b.next(), await b.throw(3).catch((e) => e.message), log]`, + `const r = []; async function f(src) { try { for await (const x of src) r.push(x) } catch (e) { r.push(e.message) } } await f({ [Symbol.asyncIterator]: () => 5 }); await f({ [Symbol.asyncIterator]: () => ({ next: 5 }) }); await f({ [Symbol.asyncIterator]: 5 }); await f({ [Symbol.iterator]: () => 5 }); await f({ [Symbol.iterator]: () => ({}) }); await f({ [Symbol.iterator]: () => ({ next: () => { throw new Error('next threw') } }) }); await f({ [Symbol.iterator]: () => ({ next: () => 5 }) }); await f({ [Symbol.asyncIterator]: () => ({ next: () => 5 }) }); return r`, + `const r = []; const it = { [Symbol.asyncIterator]() { return this }, next: () => Promise.resolve({ done: false, value: 1 }), return: () => 5 }; try { for await (const x of it) break } catch (e) { r.push(e.message) } try { for await (const x of it) throw new Error('body') } catch (e) { r.push(e.message) } const sync = { [Symbol.iterator]: () => ({ next: () => ({ done: false, value: Promise.reject(new Error('rejected value')) }), return: () => { r.push('sync closed'); return {} } }) }; try { for await (const x of sync) r.push(x) } catch (e) { r.push(e.message) } return r`, + `async function* agen() { yield 1; yield 2 } const r = []; const it = { [Symbol.asyncIterator]: agen }; for await (const x of it) r.push(x); for await (const x of { [Symbol.iterator]: function* () { yield 3; yield Promise.resolve(4) } }) r.push(x); return r`, + // Their fuel. + after( + "const mk = () => ({ i: 0, [Symbol.iterator]() { return this }, next() { return { done: this.i++ > 1, value: 1 } }, return: (v) => ({ done: true, value: v }), throw: (e) => ({ done: false, value: e }) }); function* g() { yield* mk() } let closed = 0; function* inner() { try { yield 1 } finally { closed++ } } function* h() { yield* inner() }", + "for (let j = 0; j < 100; j++) { for (const x of g()) {} const b = h(); b.next(); b.return(3) }", + ), + // An abrupt request forwarded by `yield*`. + after( + "function* inner() { yield 1 } function* g() { yield* inner() }", + "for (let j = 0; j < 100; j++) { const a = g(); a.next(); try { a.throw(2) } catch {} }", + ), + // A generator method's fifty before the body runs, a delegated method that is missing, bound or caught, and + // closing what `for await` iterates. + after( + "function* g() { yield 1 } function* h() { try { yield 1 } catch { yield 2 } }", + "for (let j = 0; j < 100; j++) { const a = g(); a.next(); try { a.throw(1) } catch {} const b = h(); b.next(); b.throw(1) }", + ), + after( + "function* g() { yield* [1, 2] } function* inner() { try { yield 1 } catch { yield 2 } } function* h() { yield* inner() }", + "for (let j = 0; j < 100; j++) { const a = g(); a.next(); a.return(1); const b = g(); b.next(); try { b.throw(1) } catch {} const c = h(); c.next(); c.throw(1); c.next() }", + ), + after( + "const it = { [Symbol.iterator]() { return this } }; it.next = function () { return { done: false, value: 1 } }.bind(it); it.throw = function (e) { return { done: false, value: e } }.bind(it); function* g() { yield* it }", + "for (let j = 0; j < 100; j++) { const a = g(); a.next(); a.next(); a.throw(1) }", + ), + after( + "async function* ag() { yield 1; yield 2 } function* gen() { yield 1; yield 2 }", + "for (let j = 0; j < 100; j++) { for await (const x of ag()) break; for await (const x of gen()) break; try { for await (const x of gen()) throw 1 } catch {} }", + ), + after( + "function* inner() { try { yield 1; yield 2 } catch { yield 9 } } async function* g() { yield* inner() }", + "for (let j = 0; j < 50; j++) { const a = g(); await a.next(); await a.return(3); const b = g(); await b.next(); await b.throw(3); await b.next() }", + ), + // Unsupported syntax throws where it runs: code that never reaches it runs, code before it runs, the SyntaxError + // is catchable, and nested functions holding it are made. A class's name and a var only a `with` body declares + // are not bindings. + `if (false) { class A {} } return 1`, + `console.log(1); class A {}; return 2`, + `try { class A {} } catch (e) { return [e.name, e.message, e instanceof SyntaxError, Object.keys(e)] }`, + `return typeof A; class A {}`, + `return A; class A {}`, + `class Map {} return typeof Map`, + `const C = class {}; return 1`, + `function f() { class A {} } return typeof f`, + `function f() { return () => { with (x) {} } } return typeof f()`, + `function f() { return () => { with (x) {} } } f()()`, + `console.log("a"); with (o) {}`, + `if (false) with (x) {}; return 1`, + `return x; with (o) { var x = 1 }`, + `var y = 2; with (o) { var y = 1 } return y`, + `L: { class A {} } return 1`, + `switch (1) { case 2: class A {} } return 1`, + `switch (1) { case 1: class A {} } return 1`, + `debugger; return 1`, + `function f() { return new.target } return 1`, + `function f() { return new.target } return f()`, + `return import.meta`, + `const o = { m() { return super.x } }; return [typeof o.m, (() => { try { o.m() } catch (e) { return e.name } })()]`, + `const o = { m() { super.x = f() } }; function f() { console.log("f") } return o.m()`, + `const o = { m() { return super.m(console.log("arg")) } }; return o.m()`, + `const o = { m() { return delete super.x } }; return o.m()`, + `const o = { m() { [super.x] = [1] } }; return o.m()`, + `const { x = class {} } = { x: 1 }; return x`, + `function f(a = class {}) { return a } return [f(1), (() => { try { f() } catch (e) { return e.name } })()]`, + `async function f() { await 1; class A {} } return await f().catch((e) => e.name)`, + `const r = await Promise.allSettled([Promise.resolve().then(() => { class A {} })]); return r[0].reason.name`, + `const e = (() => { try { class A {} } catch (e) { return e } })(); throw e`, + `{ export const x = 1 } return 1`, + `if (true) { export default 1 }`, + `if (false) { export const y = 1 } return 1`, + // A using declaration is a const nothing disposes; an import below the top level does nothing in the program and + // throws where it runs in a function. + `{ using x = { a: 1 }; await using y = 2; return [x.a, y] }`, + `{ using x = 1; x = 2 }`, + `{ import x from "nope" } return typeof x`, + `function f() { import x from "fs"; return 1 } return typeof f`, + `function f() { console.log(1); import x from "fs"; return 1 } return f()`, + `import("fs", { with: { type: "json" } }).then((m) => typeof m)`, + // A name fails at the name itself, parenthesized or as an assignment target. + `(x) = 1`, + `(x) += 1`, + `const a = 1; (a) = 2`, + `++(x)`, + `(y) = 1; let y`, + // Parse errors in acorn's words and at its positions. + `return 1 +`, + `let a; let a;`, + `function f(a, a) { "use strict" }`, + `x = { __proto__: 1, "__proto__": 2 }`, + `const x`, + `let [a]`, + `let let = 1`, + `"use strict"; var yield = 1`, + `"use strict"; delete x`, + `"use strict"; 010`, + `"use strict"; "\\01"`, + `"use strict"; var eval = 1`, + `"use strict"; arguments = 1`, + `var enum = 1`, + `function f(this) {}`, + `async function f() { var await }`, + `function* g() { var yield }`, + `return /(/`, + `return /a/gg`, + `return /a/x`, + `return /(?.)(?.)/`, + `return /\\p{Foo}/u`, + `return /[b-a]/`, + `return /+/`, + `return "abc`, + "return `abc", + `/* unclosed`, + `return 1__0`, + `return 1_`, + `return 0x_1`, + `return 0x`, + `return 1e`, + `return 3in []`, + `return 0b2`, + `return "\\u{110000}"`, + `return "\\x4"`, + `({ a = 1 })`, + `({ get a(x) {} })`, + `({ set a() {} })`, + `({ set a(...x) {} })`, + `x = 1 + (a || b ?? c)`, + `try {}`, + `switch (1) { default: default: }`, + `break`, + `continue`, + `L: L: ;`, + `L: { break M }`, + `while (1) { continue L }`, + `L: { continue L }`, + `function f() { yield 1 }`, + `() => { await 1 }`, + `new a?.b()`, + "a?.b`x`", + `import.metax`, + `new.foo`, + `new.target`, + `const f = () => new.target`, + `super.x`, + `super()`, + `const o = { m() { super() } }`, + `var a = 1; let a = 2`, + `try {} catch ([e, e]) {}`, + `for (let a of [], b) {}`, + `for (let x = 1 of []) {}`, + `for (let x = 1, y of []) {}`, + `for (async of x) {}`, + `for (let.x of y) {}`, + `"use strict"; if (1) function f() {}`, + `L: function* g() {}`, + `L: class A {}`, + `if (1) const x = 1`, + `if (1) using x = null`, + `(a, ...b,) => 1`, + `function f(...a = 1) {}`, + `let {...{a}} = b`, + `function f(a = 1) { "use strict" }`, + `[a] => 1`, + `({a}) = 1`, + `a?.b = 1`, + `"use strict"; with (x) {}`, + `using x = null`, + `switch (1) { case 1: using x = 1 }`, + `{ using x = 1, y }`, + `let x; [x.#y] = []`, + `class A { constructor() {} constructor() {} }`, + `class A { m() { delete this.#a } }`, + `import()`, + `import(...a)`, + `let x: number = 1`, + `type T = number`, + `enum E { A }`, + `const x = 1`, + `const x = y as number`, + `export const x = 1`, + ` `, + ], + suspensions: [ + // A resumed run reaches unsupported syntax at the same instruction. + `const n = await wait({}); try { class A {} } catch (e) { return [n, e.name] }`, + `const o = { valueOf: () => hold({ query: wait({}).then(() => 'echo') }).items.length + 1 }; return [o + 1, 'a'.padStart(o)]`, + `const r = []; for (const x of { [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: hold({ query: wait({}).then(() => 'echo') }).items.length + ++n }) } } }) r.push(x); return r`, + // Suspended inside the program's iterator methods called by `for await` and `yield*`. + `const r = []; for await (const x of { [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: hold({ query: wait({}).then(() => 'echo') }).items.length + ++n }) } } }) r.push(x); return r`, + `const r = []; for await (const x of { [Symbol.asyncIterator]() { const k = hold({ query: wait({}).then(() => 'echo') }).items.length; let n = 0; return { next: async () => ({ done: n > 1, value: k + ++n }) } } }) r.push(x); return r`, + `const r = []; for await (const x of { [Symbol.asyncIterator]() { return { next: async () => ({ done: false, value: 1 }), return() { r.push('closed ' + hold({ query: wait({}).then(() => 'echo') }).items.length); return { done: true } } } } }) { r.push(x); break } return r`, + `const r = []; for await (const x of { [Symbol.iterator]() { return { next: () => ({ done: false, value: 1 }), return() { r.push('closed ' + hold({ query: wait({}).then(() => 'echo') }).items.length); return {} } } } }) { r.push(x); break } return r`, + ...[ + "const it = { n: 0, [Symbol.iterator]() { return this }, next() { if (this.n === 0) for (let end = Date.now() + 250; Date.now() < end; ) {} return { done: this.n > 1, value: ++this.n } } }; function* g() { yield* it } const r = []; for (const x of g()) r.push(x)", + "const r = []; function* inner() { try { yield 1 } finally { for (let end = Date.now() + 250; Date.now() < end; ) {} r.push('finally') } } function* g() { return yield* inner() } const a = g(); a.next(); r.push(a.return(5))", + ].map((work) => `const p = fetch(${JSON.stringify(text)}); ${work}; const res = await p; return [res.status, r]`), + ], +}) diff --git a/packages/codemode-rust/conformance/frames/hostargs.ts b/packages/codemode-rust/conformance/frames/hostargs.ts new file mode 100644 index 0000000000000..dac4c9c3cfebd --- /dev/null +++ b/packages/codemode-rust/conformance/frames/hostargs.ts @@ -0,0 +1,101 @@ +// Host-call arguments: what host functions receive. Every host call converts its arguments with the reference's +// `toHost` under the runtime's translation (`functions: "drop"`, `promises: "await"`): a function is left out (an +// object's key is skipped, an array's item is null, an argument is undefined, a Map's or Set's entry is undefined), a +// fulfilled promise is its value, and a call whose arguments hold a promise that hasn't fulfilled waits for each, then +// calls again (`$vmHostWait`). No `toJSON` of the program's runs. A function from a host result crosses back as itself +// to a host function that takes functions (`echo`, `fetch`); `send` leaves it out. A call to a namespace path with no +// function rejects its promise. Cases for conformance/streaming.ts: `send` logs what it got and hands back its first +// argument, `refuse` logs and fails, `hold` (sync-thenable) hands back `{ items: args }`, `echo` (sync) hands back what +// it got, `fetch` is async. +type Helpers = { + after: (setup: string, work: string) => string + during: (setup: string, loop: string) => string + text: unknown +} + +// A promise that fulfills with `v` after `n` jobs. +const slow = "const slow = (v, n = 2) => (async () => { for (let i = 0; i < n; i++) await null; return v })()" +const late = (v: string) => `(async () => { await null; return ${v} })()` + +export default ({ text }: Helpers) => ({ + holds: [], + programs: [ + // Functions are left out at every position. + `return await send({ f() {}, a: [1, () => 2, { g: () => 3 }], m: new Map([['k', () => 1]]), s: new Set([() => 1, 2]), n: { h: Math.max, t: tools.echo, b: (() => 1).bind(null) } })`, + `return [await send(() => 1), await send(1, () => 2).catch((e) => [e.name, e.message])]`, + // Promises: fulfilled at once, pending, at every position, at the top. + `${slow}; return await send({ a: Promise.resolve(1), b: [slow(2), Promise.resolve(3)], c: new Set([slow(4)]), d: new Map([[slow('k'), slow('v')]]), e: { f: { g: slow(5, 3) } } })`, + `return await send(${late("{ x: 1, f: () => 1 }")})`, + `return await send([1, [Promise.reject(new RangeError('deep'))]]).catch((e) => [e.name, e.message])`, + `const late = (async () => { await null; throw new TypeError('late') })(); return await send({ late, ok: Promise.resolve(1) }).catch((e) => [e.name, e.message])`, + `${slow}; const no = (async () => { await null; throw new Error('first') })(); return await send([no, slow(1, 4)]).catch((e) => e.message)`, + // A promise that fulfills with more promises, or with a function. + `const inner = ${late("'in'")}; const outer = (async () => { await null; return { inner, deeper: (async () => { await null; await null; return [inner] })() } })(); return await send({ outer })`, + `return await send({ p: Promise.resolve(() => 1), q: ${late("() => 2")}, r: [Promise.resolve(() => 3)], s: new Set([Promise.resolve(() => 4)]) })`, + // Cycles through promises, and a promise shared without one. + `const o = { n: 1 }; o.p = Promise.resolve(o); return await send(o).catch((e) => [e.name, e.message])`, + `const o = { n: 1 }; o.p = (async () => { await null; return o })(); return await send(o).catch((e) => [e.name, e.message])`, + `const p = Promise.resolve({ v: 1 }); return await send({ a: p, b: [p, p] })`, + `let o = 1; for (let i = 0; i < 31; i++) o = { o }; const a = await send(Promise.resolve(o)).then(() => 'ok', (e) => e.message); const b = await send({ p: Promise.resolve(o) }).then(() => 'ok', (e) => e.message); return [a, b]`, + // Built-in objects as they cross; toJSON is never called. + `return await send({ d: new Date(0), bad: new Date(NaN), u: new URL('https://a.test/p?q=1#h'), q: new URLSearchParams('a=1&b=2'), h: new Headers({ B: '2', a: '1' }), m: new Map([[1, 2]]), s: new Set([1, 'x', { y: 1 }]), r: /x/g, w: new WeakMap(), n: [NaN, Infinity, -0], args: (function () { return arguments })(1, 2) })`, + `Date.prototype.toJSON = () => 'nope'; URL.prototype.toJSON = () => 'no'; const d = new Date(0); d.toJSON = () => 'own'; return await send({ d, u: new URL('https://a.test/'), o: { toJSON: () => 'x', v: 1 } })`, + `const e = new TypeError('bad', { cause: new Error('root') }); e.code = 7; e.fn = () => 1; e.later = ${late("8")}; return await send({ e, c: Object.assign(new Error('m'), { name: 'Custom', extra: 1 }), a: new AggregateError([1], 'agg'), u: new URIError('u') })`, + `const e = new Error('m'); e.bad = Symbol.iterator; e.deep = [Symbol.asyncIterator]; e.ok = 1; return await send({ e })`, + // What toHost refuses fails the call at once; a namespace path with no function. + `return await send({ b: Buffer.from('hi') }).catch((e) => [e.name, e.message])`, + `return await tools.nope({ b: new Uint8Array(1) }).catch((e) => e.message)`, + `return await send({ b: new Uint8Array(1), p: ${late("1")} }).catch((e) => [e.name, e.message])`, + `return await send({ s: Symbol.iterator, b: new Uint8Array(1) }).catch((e) => [e.name, e.message])`, + `return await Promise.all([send({ s: Symbol.iterator }), send({ t: tools }), send({ g: (function* () {})() }), send({ i: [1].values() })].map((p) => p.catch((e) => e.message)))`, + `let o = 1; for (let i = 0; i < 32; i++) o = { o }; const a = await send(o).then(() => 'ok', (e) => e.message); const b = await send({ o }).then(() => 'ok', (e) => e.message); return [a, b]`, + // When a waiting call starts, and the jobs its waits take. + `const log = []; Promise.resolve().then(() => log.push('job1')); const a = send({ n: 'waits', p: (async () => { log.push('in'); await null; log.push('resolved'); return 1 })() }); const b = send({ n: 'now' }); Promise.resolve().then(() => log.push('job2')); await Promise.all([a, b]); return log`, + `const log = []; const mk = (v, n) => (async () => { for (let i = 0; i < n; i++) await null; log.push(v); return v })() + Promise.resolve().then(() => log.push('j1')).then(() => log.push('j2')).then(() => log.push('j3')).then(() => log.push('j4')).then(() => log.push('j5')).then(() => log.push('j6')).then(() => log.push('j7')) + const r = send([mk('a', 3), mk('b', 1), mk('c', 2)]); r.then(() => log.push('settled')); await r; log.push('done'); return log`, + `const log = []; const mk = (v, n) => (async () => { for (let i = 0; i < n; i++) await null; log.push(v); return v })() + Promise.resolve().then(() => log.push('j1')).then(() => log.push('j2')).then(() => log.push('j3')).then(() => log.push('j4')).then(() => log.push('j5')) + const v = echo([mk('a', 2), mk('b', 1)]); log.push('echoed'); return [v, log]`, + // A sync-thenable function. + `return hold({ query: 'echo', fn: () => 1 }).items.length`, + `return hold(${late("'echo'")}).items.length`, + `async function f() { return hold({ query: ${late("'echo'")} }).items.length } const p = f(); return [typeof p.then, await p]`, + `try { hold({ query: (async () => { await null; throw new Error('late') })() }) } catch (e) { return [e.name, e.message] }`, + `try { hold({ query: new Uint8Array(1) }) } catch (e) { return [e.name, e.message] }`, + `return [hold({ query: new Date(0) }).items.length, hold({ query: { toJSON: () => 'echo' } }).items.length]`, + `return await send({ query: ${late("'echo'")} }).then((r) => r.query)`, + // A sync function that takes functions. + `const r = echo({ f() {}, a: [() => 1, 2], m: new Map([['k', () => 1]]), s: new Set([() => 1]) }); return [Object.keys(r), r.a, [...r.m], [...r.s]]`, + `${slow}; const s = slow('slow'); return echo({ p: Promise.resolve(1), q: s, l: [s] })`, + `return [echo(Promise.resolve(5)), echo(${late("6")}), echo(() => 1) === undefined]`, + `try { echo({ p: Promise.reject(new Error('x')) }) } catch (e) { return [e.name, e.message] }`, + `return [1, 2].map((x) => echo({ v: ${late("x")} }))`, + `function* g() { yield echo(${late("1")}); yield 2 } return [...g()]`, + `const log = []; async function f() { log.push('f'); const v = echo(${late("1")}); log.push('echoed'); return v } const p = f(); log.push('after'); return [await p, log]`, + `const r = await fetch(${late(JSON.stringify({ chunks: ["a", "b"] }))}); return await r.text()`, + `return await fetch(Promise.reject(new Error('no'))).catch((e) => e.message)`, + `let threw = false; let p; try { p = fetch({ s: Symbol.iterator }) } catch { threw = true } return [threw, await p.then(() => 'ok', (e) => [e.name, e.message])]`, + // A function from a host result crosses back as itself to a function that takes functions; `send`'s arguments leave it out. + `const r = await fetch(${JSON.stringify(text)}); const f = echo(r.text); return [typeof f, f === r.text, f.name, await f()]`, + `const r = await fetch(${JSON.stringify(text)}); const o = echo({ t: r.text, list: [r.json], m: new Map([['k', r.bytes]]) }); return [typeof o.t, typeof o.list[0], typeof o.m.get('k'), await o.t()]`, + `const r = await fetch(${JSON.stringify(text)}); return await send({ t: r.text, s: r.status, b: r.body })`, + `return [echo(echo), echo({ e: echo, f: fetch })]`, + // A call to a namespace path with no function rejects its promise. + `try { await tools.nope({}) } catch (e) { return e.message }`, + `return await tools.nope({}).catch((e) => e.message)`, + `const settled = await Promise.allSettled([send({}), tools.nope({})]); return settled.map((r) => r.status)`, + `return await tools.git({}).catch((e) => e.message)`, + `return await tools.ech({})`, + `return [typeof tools.nope, Object.keys(tools.git)]`, + `const p = tools.nope({}); return typeof p.then`, + `return await tools.nope({ p: ${late("1")} }).catch((e) => e.message)`, + `return await tools.nope({ s: Symbol.iterator }).catch((e) => [e.name, e.message])`, + ], + suspensions: [ + // Suspended while a call waits for a promise in its arguments. + `const r = send({ w: wait({}).then(() => ({ f: () => 1, v: 2 })) }); return await r`, + `function f() { return echo({ w: wait({}) }) } return [f(), 1]`, + `return [1, 2].map((x) => echo({ w: wait({}).then(() => x) }))`, + ], +}) diff --git a/packages/codemode-rust/conformance/frames/iterators.ts b/packages/codemode-rust/conformance/frames/iterators.ts new file mode 100644 index 0000000000000..9d904d253a662 --- /dev/null +++ b/packages/codemode-rust/conformance/frames/iterators.ts @@ -0,0 +1,97 @@ +// Iterators, iterator helpers and the built-ins that drive generators: cases for conformance/streaming.ts (see its `holding`, `after` and `during`). +type Helpers = { + after: (setup: string, work: string) => string + during: (setup: string, loop: string) => string + text: unknown +} + +const gen = "function* g(n) { for (let i = 0; i < n; i++) yield i }" +// A source that logs each call of its `next` and `return`, failing where asked. +const logged = `const log = [] + const src = (n, fail = {}) => ({ i: 0, next() { log.push('next ' + this.i); if (fail.next === this.i) throw new Error('next ' + this.i); return this.i < n ? { done: false, value: this.i++ } : { done: true } }, return() { log.push('return'); if (fail.ret) throw new Error('return'); return fail.bad ? 5 : {} } }) + const H = Iterator.prototype + const attempt = (f) => { try { return f() } catch (e) { return e.name + ': ' + e.message } }` +// Spins for 250 ms of wall-clock time: see the busy loops in streaming.ts. +const busy = "for (let end = Date.now() + 250; Date.now() < end; ) {}" + +export default ({ after, during, text }: Helpers) => ({ + // A `hold` call parked inside a helper's callback or the source's `next` it calls fails in the reference ("Iterator + // helper is already running."), so only `Iterator.from` calling an iterable's own method calls `hold` here. + holds: [ + "Iterator.from({ [Symbol.iterator]() { const n = S(1); return [n, 2].values() } }).toArray()", + ] as Array, + programs: [ + // Closing the source when a callback, `flatMap`'s inner record or its opening fails, and not when the source fails. + `${logged} + return [ + attempt(() => H.map.call(src(3), (x) => { if (x === 1) throw new Error('map'); return x }).toArray()), + attempt(() => H.filter.call(src(3), (x) => { throw new TypeError('filter') }).next()), + attempt(() => H.map.call(src(3, { next: 1 }), (x) => x).toArray()), + attempt(() => H.map.call(src(3, { ret: true }), () => { throw new Error('kept') }).next()), + attempt(() => H.flatMap.call(src(3), (x) => x).next()), + attempt(() => H.flatMap.call(src(3), () => ({ [Symbol.iterator]: 5 })).next()), + attempt(() => H.flatMap.call(src(3), () => ({ [Symbol.iterator]() { throw new Error('open') } })).next()), + attempt(() => H.flatMap.call(src(3), () => ({ next: () => 5 })).next()), + attempt(() => H.flatMap.call(src(3), () => ({ next() { throw new Error('inner') } })).next()), + log, + ]`, + // return() before the first value, at a yield, with flatMap's inner record open, failing, and twice. + `${logged} + const inner = () => ({ next: () => ({ done: false, value: 'i' }), return() { log.push('inner return'); throw new Error('inner') } }) + const a = H.map.call(src(3), (x) => x); log.push(JSON.stringify(a.return()), JSON.stringify(a.next())) + const b = H.map.call(src(3), (x) => x); b.next(); log.push(JSON.stringify(b.return()), JSON.stringify(b.return())) + const c = H.flatMap.call(src(3), inner); c.next(); log.push(attempt(() => c.return()), JSON.stringify(c.next())) + const d = H.flatMap.call(src(3, { ret: true }), inner); d.next(); log.push(attempt(() => d.return())) + const e = H.drop.call(src(3, { bad: true }), 1); e.next(); log.push(attempt(() => e.return())) + const f = H.take.call(src(3, { bad: true }), 1); log.push(attempt(() => f.return())) + const t = H.take.call(src(3, { bad: true }), 1); t.next(); log.push(attempt(() => t.next()), attempt(() => t.next())) + const z = H.take.call(src(3), 0); log.push(JSON.stringify(z.next())) + const odd = { next: () => ({ done: false, value: 1 }), return: 5 } + const q = H.map.call(odd, (x) => x); q.next(); log.push(attempt(() => q.return()), attempt(() => H.map.call(odd, (x) => x).return())) + log.push(attempt(() => H.map.call(odd, () => { throw new Error('cb') }).next())) + return log`, + // A helper stepped again while its step runs, from its callback and from its source. + `${logged} + let h; h = [1, 2].values().map((x) => attempt(() => h.next())); const r1 = h.next() + let k; k = Iterator.from({ next: () => ({ done: false, value: attempt(() => k.next()) }) }).map((x) => x); const r2 = k.next() + let m; m = [1, 2].values().map((x) => JSON.stringify(m.return())); const r3 = attempt(() => m.next()) + const r4 = [r1, r2, r3, h.next(), k.next().value, attempt(() => h.return())] + return r4`, + // Generators as sources and inner records: their completion, their `finally`, and a generator's own `next`. + `${gen} + const log = [] + function* f() { try { yield 1; yield 2 } finally { log.push('finally') } } + const a = f().map((x) => x * 2); log.push(a.next().value); a.return() + const b = f().take(1); log.push(b.next().value, b.next().done) + const c = [1, 2].values().flatMap(f); log.push(c.next().value); c.return() + const d = f(); d.next = () => ({ done: false, value: 'own' }); log.push(d.map((x) => x).next().value) + function* thrower() { yield 1; throw new Error('gen') } + try { thrower().map((x) => x).toArray() } catch (e) { log.push(e.message) } + function* bad() { try { yield 1 } finally { throw new Error('finally') } } + try { bad().map((x) => { throw new Error('cb') }).next() } catch (e) { log.push(e.message) } + const e = bad().drop(0); e.next(); try { e.return() } catch (err) { log.push(err.message) } + log.push(g(6).drop(1).filter((x) => x % 2).flatMap((x) => g(x)).take(5).toArray().join()) + return log`, + // Iterator.from over a program's iterable, a string, an iterator and a value that is neither. + `const log = [] + const it = { [Symbol.iterator]() { log.push('open'); return { next: () => ({ done: true }) } } } + const a = Iterator.from(it); log.push(typeof a.next, JSON.stringify(a.next())) + log.push(Iterator.from('ab').toArray().join(), Iterator.from({ next: () => ({ done: true }) }).toArray().length) + for (const v of [5, { [Symbol.iterator]: 5 }, { [Symbol.iterator]: () => 5 }, { [Symbol.iterator]() { throw new RangeError('open') } }]) + try { Iterator.from(v) } catch (e) { log.push(e.name + ': ' + e.message) } + return log`, + ] as Array, + // Suspended while a busy loop runs inside a helper's callback, its source's `next`, an inner record or a close. + suspensions: [ + `const p = fetch(${JSON.stringify(text)}); const n = [1, 2].values().map((x) => { ${busy} return x }).toArray(); const r = await p; return [r.status, n]`, + `const p = fetch(${JSON.stringify(text)}); const n = [1, 2, 3].values().filter((x) => { if (x === 2) { ${busy} } return x !== 2 }).toArray(); const r = await p; return [r.status, n]`, + `const p = fetch(${JSON.stringify(text)}); let k = 0; const src = { next() { if (k === 1) { ${busy} } return { done: k > 2, value: k++ } } } + const n = Iterator.prototype.map.call(src, (x) => x * 2).toArray(); const r = await p; return [r.status, n]`, + `const p = fetch(${JSON.stringify(text)}); const inner = () => { let d = false; return { next() { if (!d) { ${busy} } const r = { done: d, value: 7 }; d = true; return r } } } + const n = [1, 2].values().flatMap(inner).toArray(); const r = await p; return [r.status, n]`, + `const p = fetch(${JSON.stringify(text)}); const log = []; const src = { next: () => ({ done: false, value: 1 }), return() { ${busy} log.push('closed'); return {} } } + const h = Iterator.prototype.map.call(src, (x) => x); h.next(); const done = h.return(); const r = await p; return [r.status, done, log]`, + `const p = fetch(${JSON.stringify(text)}); const it = { [Symbol.iterator]() { ${busy} return [1, 2].values() } } + const n = Iterator.from(it).toArray(); const r = await p; return [r.status, n]`, + ] as Array, +}) diff --git a/packages/codemode-rust/conformance/generate.ts b/packages/codemode-rust/conformance/generate.ts new file mode 100644 index 0000000000000..7adfaa0b965ef --- /dev/null +++ b/packages/codemode-rust/conformance/generate.ts @@ -0,0 +1,122 @@ +#!/usr/bin/env bun + +// Regenerates conformance/cases/.json by running every .js through the reference's language layer +// (`Language.Runtime.make`). +// Usage: bun conformance/generate.ts [reference] — the reference CodeMode package directory, from the argument, +// CODEMODE_REF, or by default ../codemode relative to this workspace. +// +// Host globals: only `tools`, the namespace of conformance/reference.ts (`tools.echo`, `tools.fail`, `tools.git.status`, +// all async; any other path an async function that rejects with NotFound). No `modules`. +// +// A case may start with header comments that set its inputs: +// // @bindings {"event": {"type": "init"}} the program's bindings (default `{}`) +// // @limits {"timeout_ms": 50, "max_output_bytes": 9} the runtime's `limits` (default none) +// // @translate {"functions": "drop", "promises": "await"} the runtime's `translate` (default the reference's: +// both "error") +// // @platform "linux" +// A case with @platform depends on the system libm or compiler, so it is recorded and checked only on that platform +// (`process.platform`). Elsewhere this keeps its recorded outcome but rewrites it in the current format, and fails +// when the case needs a run on its platform (its inputs changed): see `refreshSkipped`. +// +// Each .json: `{ bindings, limits?, translate?, ok: true, value } | { bindings, limits?, translate?, ok: false, +// kind }`, then `logs` (the result's logs, `[]` when none) and `metadata` (the result's `run.metadata`: always `null` +// here, as `tools` keeps no run state). + +import { readdirSync, readFileSync, writeFileSync } from "node:fs" +import { join } from "node:path" +import { reference, toolsGlobal } from "./reference.ts" + +const ref = await reference(process.argv[2] ?? process.env.CODEMODE_REF) +const Effect = ref.Effect +const tools = toolsGlobal(ref) + +const header = (code: string, tag: string) => { + const line = code.split("\n").find((l) => l.startsWith(`// @${tag} `)) + return line === undefined ? undefined : JSON.parse(line.slice(`// @${tag} `.length)) +} + +const dir = join(import.meta.dir, "cases") + +// A case recorded only on another platform keeps its recorded outcome here, but follows the format the cases are +// written in: its fields are rewritten in the order below, and a field this generator can fill without running the +// case is filled (`metadata` is always null, as `tools` keeps no run state). When its inputs changed, or its outcome +// is missing, it needs a run on its platform: it is listed in `stale`, and the generator fails. +const stale: Array = [] +const refreshSkipped = (name: string, inputs: { bindings: unknown; limits: unknown; translate: unknown }): boolean => { + const path = join(dir, `${name}.json`) + const before = readFileSync(path, "utf8") + const recorded = JSON.parse(before) + const same = (a: unknown, b: unknown) => JSON.stringify(a) === JSON.stringify(b) + const outcome = + recorded.ok === true && "value" in recorded + ? { ok: true, value: recorded.value } + : recorded.ok === false && typeof recorded.kind === "string" + ? { ok: false, kind: recorded.kind } + : undefined + if ( + outcome === undefined || + !Array.isArray(recorded.logs) || + ("metadata" in recorded && recorded.metadata !== null) || + !same(recorded.bindings, inputs.bindings) || + !same(recorded.limits, inputs.limits) || + !same(recorded.translate, inputs.translate) + ) { + stale.push(` ${name}`) + return false + } + const expected = { + bindings: inputs.bindings, + ...(inputs.limits === undefined ? {} : { limits: inputs.limits }), + ...(inputs.translate === undefined ? {} : { translate: inputs.translate }), + ...outcome, + logs: recorded.logs, + metadata: null, + } + const after = JSON.stringify(expected, null, 2) + "\n" + if (after === before) return false + writeFileSync(path, after) + return true +} +const names = readdirSync(dir) + .filter((f) => f.endsWith(".js")) + .map((f) => f.slice(0, -3)) + .sort() + +for (const name of names) { + const code = readFileSync(join(dir, `${name}.js`), "utf8") + const platform = header(code, "platform") + const bindings = header(code, "bindings") ?? {} + const limits = header(code, "limits") + const translate = header(code, "translate") + if (platform !== undefined && platform !== process.platform) { + console.log( + `${name.padEnd(36)} ${refreshSkipped(name, { bindings, limits, translate }) ? "reformatted" : "skipped"} (${platform} only)`, + ) + continue + } + const runtime = ref.Language.Runtime.make({ + globals: () => ({ tools }), + ...(limits === undefined + ? {} + : { limits: { timeoutMs: limits.timeout_ms, maxOutputBytes: limits.max_output_bytes } }), + ...(translate === undefined ? {} : { translate }), + }) + const result = await Effect.runPromise(runtime.execute(code, { bindings })) + const expected = { + bindings, + ...(limits === undefined ? {} : { limits }), + ...(translate === undefined ? {} : { translate }), + ...(result.ok ? { ok: true, value: result.value } : { ok: false, kind: result.error.kind }), + logs: result.logs ?? [], + metadata: result.metadata, + } + writeFileSync(join(dir, `${name}.json`), JSON.stringify(expected, null, 2) + "\n") + console.log(`${name.padEnd(36)} ${result.ok ? "ok" : result.error.kind}`) +} + +if (stale.length > 0) { + console.error( + `These cases are recorded only on another platform, and their expectations need a run there (regenerate on it):\n${stale.join("\n")}`, + ) + process.exit(1) +} diff --git a/packages/codemode-rust/conformance/host.json b/packages/codemode-rust/conformance/host.json new file mode 100644 index 0000000000000..dadb7196d2fc6 --- /dev/null +++ b/packages/codemode-rust/conformance/host.json @@ -0,0 +1,108 @@ +{ + "executes": [ + {"code":"const a = double(2); const b = inc(a); return [a, b, typeof double, double.name, double.length]","runId":"run","outcome":{"ok":true,"value":[4,5,"function","double",1],"metadata":null},"log":[]}, + {"code":"const p = load(1); return [p instanceof Promise, await p]","runId":"run","outcome":{"ok":true,"value":[true,1],"metadata":null},"log":[]}, + {"code":"const p = promised(3); return [p instanceof Promise, await p]","runId":"run","outcome":{"ok":true,"value":[true,3],"metadata":null},"log":[]}, + {"code":"return [find().items.length, (await find()).items.length, await find().then((r) => r.items[1]), Object.keys(find())]","runId":"run","outcome":{"ok":true,"value":[2,2,2,["items"]],"metadata":null},"log":[]}, + {"code":"const log = []; load(1).then(() => log.push(\"load\")); promised(2).then(() => log.push(\"promised\")); Promise.resolve().then(() => log.push(\"job\")); log.push(inc(1)); await null; await null; await null; return log","runId":"run","outcome":{"ok":true,"value":[2,"job"],"metadata":null},"log":[]}, + {"code":"note(); note(1); await load(1); note(\"a\", [2]); await post(3); return 1","runId":"r","outcome":{"ok":true,"value":1,"metadata":null},"log":[["note","r:0",[]],["note","r:1",[1]],["note","r:3",["a",{"array":[2]}]],["post","r:4",[3]]]}, + {"code":"const p = post(1); note(2); const q = Promise.all([post(3), load(4)]); note(5); await p; await q; return 1","runId":"k","outcome":{"ok":true,"value":1,"metadata":null},"log":[["note","k:1",[2]],["note","k:4",[5]],["post","k:0",[1]],["post","k:2",[3]]]}, + {"code":"note({ at: new Date(5), m: new Map([[\"k\", 1]]), s: new Set([\"a\"]), u: new URL(\"https://a.test/\"), e: new RangeError(\"r\") }); const r = open(); return [typeof r.read, r.read(), r.read.name]","runId":"run","outcome":{"ok":true,"value":["function","called","read"],"metadata":null},"log":[["note","run:0",[{"object":[["at",{"date":5}],["m",{"map":[["k",1]]}],["s",{"set":["a"]}],["u",{"url":"https://a.test/"}],["e",{"error":{"name":"RangeError","message":"r","fields":[]}}]]}]]]}, + {"code":"return takes({ read: open().read })","runId":"run","outcome":{"ok":true,"value":true,"metadata":null},"log":[]}, + {"code":"return takes(open())","runId":"run","outcome":{"ok":true,"value":true,"metadata":null},"log":[]}, + {"code":"refuses(open().read)","runId":"run","outcome":{"ok":false,"error":{"kind":"ExecutionFailure","message":"TypeError: Argument 1 to refuses contains a function, which cannot be passed to the host. (line 1, col 1)","location":{"line":1,"column":1}},"metadata":null},"log":[]}, + {"code":"takes(takes)","runId":"run","outcome":{"ok":false,"error":{"kind":"ExecutionFailure","message":"TypeError: Argument 1 to takes contains a function, which cannot be passed to the host. (line 1, col 1)","location":{"line":1,"column":1}},"metadata":null},"log":[]}, + {"code":"takes(() => 1)","runId":"run","outcome":{"ok":false,"error":{"kind":"ExecutionFailure","message":"TypeError: Argument 1 to takes contains a function, which cannot be passed to the host. (line 1, col 1)","location":{"line":1,"column":1}},"metadata":null},"log":[]}, + {"code":"return [new Box(1).item, new Later(2).item, new Later(...[3]).item, Box(4).item, typeof Box]","runId":"run","outcome":{"ok":true,"value":[1,2,3,4,"function"],"metadata":null},"log":[]}, + {"code":"new double(1)","runId":"run","outcome":{"ok":false,"error":{"kind":"ExecutionFailure","message":"TypeError: new double(...) is not supported; call double(...) without new instead. (line 1, col 1)","location":{"line":1,"column":1}},"metadata":null},"log":[]}, + {"code":"try { new load(1) } catch (e) { return [e.name, e.message] }","runId":"run","outcome":{"ok":true,"value":["TypeError","new load(...) is not supported; call load(...) without new instead."],"metadata":null},"log":[]}, + {"code":"return [await api.issues.list(), Object.keys(api), Object.keys(api.issues), typeof api.x, typeof api.issues.list]","runId":"run","outcome":{"ok":true,"value":[["#1"],["issues"],["list"],"function","function"],"metadata":null},"log":[]}, + {"code":"return api.issues.nope()","runId":"run","outcome":{"ok":false,"error":{"kind":"NotFound","message":"No api.issues.nope","suggestions":["Try api.issues.list."]},"metadata":null},"log":[]}, + {"code":"try { api.nope() } catch (e) { return [e.name, e.message, e instanceof Error] }","runId":"run","outcome":{"ok":true,"value":["Error","No api.nope",true],"metadata":null},"log":[]}, + {"code":"refuse()","runId":"run","outcome":{"ok":false,"error":{"kind":"Refused","message":"Not today","suggestions":["Ask again."]},"metadata":null},"log":[]}, + {"code":"try { refuse() } catch (e) { return [e.name, e.message] }","runId":"run","outcome":{"ok":true,"value":["Error","Not today"],"metadata":null},"log":[]}, + {"code":"const out = []; for (const k in api) out.push(k); const x = api.issues; return [out, api.issues === api.issues, x === x, String(api.issues)]","runId":"run","outcome":{"ok":true,"value":[["issues"],false,true,"[object Object]"],"metadata":null},"log":[]}, + {"code":"count(); count(); return count()","runId":"run","outcome":{"ok":true,"value":3,"metadata":{"count":3}},"log":[]}, + {"code":"return 1","runId":"run","outcome":{"ok":true,"value":1,"metadata":null},"log":[]}, + {"code":"count(); throw new Error(\"after\")","runId":"run","outcome":{"ok":false,"error":{"kind":"ExecutionFailure","message":"Error: after"},"metadata":{"count":1}},"log":[]}, + {"code":"note({ f() {} })","runId":"run","outcome":{"ok":false,"error":{"kind":"ExecutionFailure","message":"TypeError: Argument 1 to note contains a function, which cannot be passed to the host. (line 1, col 1)","location":{"line":1,"column":1}},"metadata":null},"log":[]}, + {"code":"note([Promise.resolve(1)])","runId":"run","outcome":{"ok":false,"error":{"kind":"ExecutionFailure","message":"TypeError: Argument 1 to note contains an un-awaited Promise, which cannot be passed to the host. (line 1, col 1)","location":{"line":1,"column":1}},"metadata":null},"log":[]}, + {"code":"await post(() => 1)","runId":"run","outcome":{"ok":false,"error":{"kind":"ExecutionFailure","message":"TypeError: Argument 1 to post contains a function, which cannot be passed to the host. (line 1, col 7)","location":{"line":1,"column":7}},"metadata":null},"log":[]}, + {"code":"return await post({ p: Promise.resolve(1) }).catch((e) => [e.name, e.message])","runId":"run","outcome":{"ok":true,"value":["TypeError","Argument 1 to post contains an un-awaited Promise, which cannot be passed to the host."],"metadata":null},"log":[]}, + {"code":"note({ q: \"x\", format(v) { return v }, nested: { f: Math.max } }, [1, () => 2, note], () => 3, new Map([[\"k\", () => 1]]))","translate":{"functions":"drop"},"runId":"run","outcome":{"ok":true,"value":null,"metadata":null},"log":[["note","run:0",[{"object":[["q","x"],["nested",{"object":[]}]]},{"array":[1,null,null]},{"undefined":true},{"map":[["k",{"undefined":true}]]}]]]}, + {"code":"note({ p: Promise.resolve(1) })","translate":{"functions":"drop"},"runId":"run","outcome":{"ok":false,"error":{"kind":"ExecutionFailure","message":"TypeError: Argument 1 to note contains an un-awaited Promise, which cannot be passed to the host. (line 1, col 1)","location":{"line":1,"column":1}},"metadata":null},"log":[]}, + {"code":"const slow = (async () => { await null; await null; return \"slow\" })()\nconst a = note({ n: Promise.resolve(5), list: [load(1), slow] }, load({ deep: load(2) }))\nconst b = await post(slow, new Promise((resolve) => resolve(load(3))))\nreturn [a, b]","translate":{"promises":"await"},"runId":"run","outcome":{"ok":true,"value":[null,null],"metadata":null},"log":[["note","run:3",[{"object":[["n",5],["list",{"array":[1,"slow"]}]]},{"object":[["deep",2]]}]],["post","run:5",["slow",3]]]}, + {"code":"note({ f() {} })","translate":{"promises":"await"},"runId":"run","outcome":{"ok":false,"error":{"kind":"ExecutionFailure","message":"TypeError: Argument 1 to note contains a function, which cannot be passed to the host. (line 1, col 1)","location":{"line":1,"column":1}},"metadata":null},"log":[]}, + {"code":"const failing = () => Promise.reject(new RangeError(\"nope\"))\nlet thrown\ntry { note({ n: failing() }) } catch (error) { thrown = error }\nconst sent = post([load(1), failing()])\nreturn [thrown instanceof RangeError, thrown.message, sent instanceof Promise, await sent.catch((e) => e.message)]","translate":{"promises":"await"},"runId":"run","outcome":{"ok":true,"value":[true,"nope",true,"nope"],"metadata":null},"log":[]}, + {"code":"note({ n: never() })","translate":{"promises":"await"},"limits":{"timeoutMs":50},"runId":"run","outcome":{"ok":false,"error":{"kind":"TimeoutExceeded","message":"Execution timed out after 50ms."},"metadata":null},"log":[["never","run:0"]]}, + {"code":"note({ f() {}, p: load(1) }, () => 2)","translate":{"functions":"drop","promises":"await"},"runId":"run","outcome":{"ok":true,"value":null,"metadata":null},"log":[["note","run:1",[{"object":[["p",1]]},{"undefined":true}]]]}, + {"code":"while (true) {}","limits":{"timeoutMs":50},"runId":"run","outcome":{"ok":false,"error":{"kind":"TimeoutExceeded","message":"Execution timed out after 50ms."},"metadata":null},"log":[]}, + {"code":"await never()","limits":{"timeoutMs":50},"runId":"run","outcome":{"ok":false,"error":{"kind":"TimeoutExceeded","message":"Execution timed out after 50ms."},"metadata":null},"log":[["never","run:0"]]}, + {"code":"never(); return 1","limits":{"timeoutMs":50},"runId":"run","outcome":{"ok":true,"value":1,"metadata":null},"log":[["never","run:0"]]}, + {"code":"console.log(\"a\".repeat(10)); console.log(\"b\"); return \"c\".repeat(20)","limits":{"maxOutputBytes":16},"runId":"run","outcome":{"ok":true,"value":"\"ccccccccccccccc [result truncated: 22 bytes exceeds the 16-byte output limit; return a smaller value]","logs":["[logs truncated: showing 0 of 2 lines]"],"truncated":true,"metadata":null},"log":[]}, + {"code":"console.log(\"1\"); console.log(\"2\"); console.log(\"3\"); return 1","limits":{"maxOutputBytes":4},"runId":"run","outcome":{"ok":true,"value":1,"logs":["1","[logs truncated: showing 1 of 3 lines]"],"truncated":true,"metadata":null},"log":[]}, + {"code":"count(); console.log(\"x\".repeat(30)); throw new Error(\"y\".repeat(30))","limits":{"maxOutputBytes":8},"runId":"run","outcome":{"ok":false,"error":{"kind":"ExecutionFailure","message":"Error: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"},"logs":["[logs truncated: showing 0 of 1 lines]"],"truncated":true,"metadata":{"count":1}},"log":[]}, + {"code":"for (let i = 0; i < 5; i++) Promise.reject(new Error(\"e\" + i)); return 1","limits":{"maxOutputBytes":100},"runId":"run","outcome":{"ok":true,"value":1,"warnings":[{"kind":"ExecutionFailure","message":"Unhandled rejection from an un-awaited promise: Error: e0"},{"kind":"Truncated","message":"4 additional warnings omitted by the output limit."}],"truncated":true,"metadata":null},"log":[]}, + {"code":"Promise.reject(new Error(\"x\")); return 1","runId":"run","outcome":{"ok":true,"value":1,"warnings":[{"kind":"ExecutionFailure","message":"Unhandled rejection from an un-awaited promise: Error: x"}],"metadata":null},"log":[]}, + {"code":"const p = Promise.reject(1); await null; p.catch(() => 0); return 2","runId":"run","outcome":{"ok":true,"value":2,"metadata":null},"log":[]}, + {"code":"async function f() { throw new TypeError(\"bad\") }\nf(); f(); return 4","runId":"run","outcome":{"ok":true,"value":4,"warnings":[{"kind":"ExecutionFailure","message":"Unhandled rejection from an un-awaited promise: TypeError: bad"},{"kind":"ExecutionFailure","message":"Unhandled rejection from an un-awaited promise: TypeError: bad"}],"metadata":null},"log":[]}, + {"code":"Promise.reject(\"plain\"); Promise.reject({ a: [1] }); return 6","runId":"run","outcome":{"ok":true,"value":6,"warnings":[{"kind":"ExecutionFailure","message":"Unhandled rejection from an un-awaited promise: Uncaught: plain"},{"kind":"ExecutionFailure","message":"Unhandled rejection from an un-awaited promise: Uncaught: {\"a\":[1]}"}],"metadata":null},"log":[]}, + {"code":"Promise.reject(new Error(\"unseen\")); throw new Error(\"seen\")","runId":"run","outcome":{"ok":false,"error":{"kind":"ExecutionFailure","message":"Error: seen"},"metadata":null},"log":[]}, + {"code":"async function g() { null.x }\ng(); return 7","runId":"run","outcome":{"ok":true,"value":7,"warnings":[{"kind":"ExecutionFailure","message":"Unhandled rejection from an un-awaited promise: TypeError: Cannot read properties of null (reading 'x'). (line 1, col 22)","location":{"line":1,"column":22}}],"metadata":null},"log":[]}, + {"code":"refuse.call(null); return 8","runId":"run","outcome":{"ok":false,"error":{"kind":"Refused","message":"Not today","suggestions":["Ask again."]},"metadata":null},"log":[]}, + {"code":"api.issues.nope(); return 9","runId":"run","outcome":{"ok":false,"error":{"kind":"NotFound","message":"No api.issues.nope","suggestions":["Try api.issues.list."]},"metadata":null},"log":[]}, + {"code":"job(1); return 1","runId":"c","outcome":{"ok":true,"value":1,"metadata":null},"log":[["job.start","c:0",[1]],["job.wait","c:0","c:0",[1]],["job.cancel","c:0","c:0"]]}, + {"code":"const p = job({ a: 1 }); await null; throw new Error(\"ended\")","runId":"c","outcome":{"ok":false,"error":{"kind":"ExecutionFailure","message":"Error: ended"},"metadata":null},"log":[["job.start","c:0",[{"object":[["a",1]]}]],["job.wait","c:0","c:0",[{"object":[["a",1]]}]],["job.cancel","c:0","c:0"]]}, + {"code":"note(count()); return double(await load(2)) + count()","compiled":true,"runId":"run","compile":{"ok":true},"outcome":{"ok":true,"value":6,"metadata":{"count":2}},"again":{"ok":true,"value":6,"metadata":{"count":2}},"log":[["note","run:1",[1]],["note","run:1",[1]]]}, + {"code":"job(1); return 1","runId":"c","compiled":true,"compile":{"ok":true},"outcome":{"ok":true,"value":1,"metadata":null},"again":{"ok":true,"value":1,"metadata":null},"log":[["job.start","c:0",[1]],["job.wait","c:0","c:0",[1]],["job.cancel","c:0","c:0"],["job.start","c:0",[1]],["job.wait","c:0","c:0",[1]],["job.cancel","c:0","c:0"]]}, + {"code":"note(1); class A {}","compiled":true,"runId":"run","compile":{"ok":true},"outcome":{"ok":true,"value":null,"metadata":null},"again":{"ok":true,"value":null,"metadata":null},"log":[["note","run:0",[1]],["note","run:0",[1]]]}, + {"code":"let n = 0; note({ a: 1, get b() { n++; return [double(2)] }, set c(v) {} }); return n","runId":"run","outcome":{"ok":true,"value":1,"metadata":null},"log":[["note","run:1",[{"object":[["a",1],["b",{"array":[4]}]]}]]]}, + {"code":"const o = { get v() { return inc(1) } }; const x = o.v; o.v; return [x, { get w() { return x + 1 } }]","runId":"run","outcome":{"ok":true,"value":[2,{"w":3}],"metadata":null},"log":[]}, + {"code":"const o = { set v(x) { note(inc(x)) } }; o.v = 4; return Object.keys(o)","runId":"run","outcome":{"ok":true,"value":["v"],"metadata":null},"log":[["note","run:1",[5]]]}, + {"code":"const e = await load({ get a() { throw new Error(\"g\") } }).catch((e) => e.message); return [e, await load({ get a() { return 2 }, set b(v) {} })]","runId":"run","outcome":{"ok":true,"value":["g",{"a":2}],"metadata":null},"log":[]}, + {"code":"let n = 0; const r = await api.issues.list({ get q() { n++; return 1 } }); try { double({ get x() { throw new Error(\"s\") } }) } catch (e) { return [r, n, e.message] }","runId":"run","outcome":{"ok":true,"value":[["#1"],1,"s"],"metadata":null},"log":[]}, + {"code":"return [{ get a() { return 2 } }].map(note)","runId":"run","outcome":{"ok":true,"value":[null],"metadata":null},"log":[["note","run:0",[{"object":[["a",2]]},0,{"array":[{"object":[["a",2]]}]}]]]}, + {"code":"return [{ get a() { return 2 } }].map(double)","runId":"run","outcome":{"ok":true,"value":[null],"metadata":null},"log":[]}, + {"code":"return [1].map((x) => note({ get a() { return x } }))","runId":"run","outcome":{"ok":true,"value":[null],"metadata":null},"log":[["note","run:0",[{"object":[["a",1]]}]]]}, + {"code":"return note.call(null, { get a() { return 1 } })","runId":"run","outcome":{"ok":true,"value":null,"metadata":null},"log":[["note","run:0",[{"object":[["a",1]]}]]]}, + {"code":"return note.apply(null, [{ get a() { return 1 } }])","runId":"run","outcome":{"ok":true,"value":null,"metadata":null},"log":[["note","run:0",[{"object":[["a",1]]}]]]}, + {"code":"return note.bind(null, { get a() { return 1 } })()","runId":"run","outcome":{"ok":true,"value":null,"metadata":null},"log":[["note","run:0",[{"object":[["a",1]]}]]]}, + {"code":"return Array.from([{ get a() { return 1 } }], note)","runId":"run","outcome":{"ok":true,"value":[null],"metadata":null},"log":[["note","run:0",[{"object":[["a",1]]},0]]]}, + {"code":"const r = []; new Map([[1, { get a() { return 1 } }]]).forEach((v) => r.push(note(v))); return r","runId":"run","outcome":{"ok":true,"value":[null],"metadata":null},"log":[["note","run:0",[{"object":[["a",1]]}]]]}, + {"code":"return await Promise.resolve({ get a() { return 3 } }).then(note)","runId":"run","outcome":{"ok":true,"value":null,"metadata":null},"log":[["note","run:0",[{"object":[["a",3]]}]]]}, + {"code":"return [{ get a() { return 1 } }].forEach(note)","runId":"run","outcome":{"ok":true,"value":null,"metadata":null},"log":[["note","run:0",[{"object":[["a",1]]},0,{"array":[{"object":[["a",1]]}]}]]]}, + {"code":"return [{ get a() { return 1 } }].filter(note)","runId":"run","outcome":{"ok":true,"value":[],"metadata":null},"log":[["note","run:0",[{"object":[["a",1]]},0,{"array":[{"object":[["a",1]]}]}]]]}, + {"code":"return [[{ get a() { return 1 } }]].map(([x]) => note.call(null, x))","runId":"run","outcome":{"ok":true,"value":[null],"metadata":null},"log":[["note","run:0",[{"object":[["a",1]]}]]]}, + {"code":"return post.call(null, { get a() { throw new Error('g') } }).catch((e) => e.message)","runId":"run","outcome":{"ok":true,"value":"g","metadata":null},"log":[]}, + {"code":"return [{ get a() { throw new Error('g') } }].map(post)","runId":"run","outcome":{"ok":false,"error":{"kind":"ExecutionFailure","message":"Error: g"},"metadata":null},"log":[]}, + {"code":"return note.call(null, { get a() { return inc(1) } })","runId":"run","outcome":{"ok":true,"value":null,"metadata":null},"log":[["note","run:1",[{"object":[["a",2]]}]]]}, + {"code":"return [{ get a() { return inc(1) } }].map(note)","runId":"run","outcome":{"ok":true,"value":[null],"metadata":null},"log":[["note","run:1",[{"object":[["a",2]]},0,{"array":[{"object":[["a",2]]}]}]]]}, + {"code":" ","compiled":true,"runId":"run","compile":{"ok":false,"error":{"kind":"ParseError","message":"Code cannot be empty."}},"outcome":{"ok":false,"error":{"kind":"ParseError","message":"Code cannot be empty."},"metadata":null},"log":[]}, + {"code":"return (","compiled":true,"runId":"run","compile":{"ok":false,"error":{"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 9)","location":{"line":1,"column":9}}},"outcome":{"ok":false,"error":{"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 9)","location":{"line":1,"column":9}},"metadata":null},"log":[]}, + {"code":"export const x = 1","compiled":true,"runId":"run","compile":{"ok":false,"error":{"kind":"ParseError","message":"SyntaxError: Exports aren't available. Return the result instead. (line 1, col 1)","location":{"line":1,"column":1}}},"outcome":{"ok":false,"error":{"kind":"ParseError","message":"SyntaxError: Exports aren't available. Return the result instead. (line 1, col 1)","location":{"line":1,"column":1}},"metadata":null},"log":[]} + ], + "suspensions": [ + {"code":"count(); count(); await wait(); return count()","runId":"m","suspend":{"ok":true,"metadata":{"count":2},"same":true},"resume":{"ok":true,"value":3,"metadata":{"count":3}},"made":2,"log":[["wait","m:2"],["wait","m:2"]]}, + {"code":"count(); count(); await wait(); return count()","runId":"m","compiled":true,"suspend":{"ok":true,"metadata":{"count":2},"same":true},"resume":{"ok":true,"value":3,"metadata":{"count":3}},"made":2,"log":[["wait","m:2"],["wait","m:2"]]}, + {"code":"note(1); const a = await wait(); note(2); return [a, await wait()]","runId":"i","suspend":{"ok":true,"metadata":null,"same":true},"resume":{"ok":true,"value":[7,7],"metadata":null},"made":2,"log":[["note","i:0",[1]],["wait","i:1"],["wait","i:1"],["note","i:2",[2]],["wait","i:3"]]}, + {"code":"const ps = [wait(), load(1), wait()]; return await Promise.all(ps)","runId":"i","suspend":{"ok":true,"metadata":null,"same":true},"resume":{"ok":true,"value":[7,1,7],"metadata":null},"made":2,"log":[["wait","i:0"],["wait","i:2"],["wait","i:0"],["wait","i:2"]]}, + {"code":"await never()","runId":"s","suspend":{"ok":false,"message":"The run can't be suspended while never is running.","running":[{"key":"s:0","path":"never"}]},"made":1,"log":[["never","s:0"]]}, + {"code":"const p = never(); await wait(); return 1","runId":"s","suspend":{"ok":false,"message":"The run can't be suspended while never is running.","running":[{"key":"s:0","path":"never"}]},"made":1,"log":[["never","s:0"],["wait","s:1"]]}, + {"code":"await grab(open().read)","runId":"s","suspend":{"ok":false,"message":"The run can't be suspended while grab is running.","running":[{"key":"s:1","path":"grab"}]},"made":1,"log":[["grab","s:1"]]}, + {"code":"await grab({ n: 1 })","runId":"s","suspend":{"ok":true,"metadata":null,"same":true},"resume":{"ok":true,"value":3,"metadata":null},"made":2,"log":[["grab","s:0"],["grab","s:0"]]}, + {"code":"return (await job()) + 1","runId":"d","suspend":{"ok":true,"metadata":null,"same":true},"resume":{"ok":true,"value":42,"metadata":null},"made":2,"log":[["job.start","d:0",[]],["job.wait","d:0","d:0",[]],["job.wait","d:0","d:0",[]]]}, + {"code":"return (await job()) + 1","runId":"d","compiled":true,"suspend":{"ok":true,"metadata":null,"same":true},"resume":{"ok":true,"value":42,"metadata":null},"made":2,"log":[["job.start","d:0",[]],["job.wait","d:0","d:0",[]],["job.wait","d:0","d:0",[]]]}, + {"code":"const a = job(1, { b: [2] }); const b = job(); return [await a, await b, count()]","runId":"d","suspend":{"ok":true,"metadata":null,"same":true},"resume":{"ok":true,"value":[41,41,1],"metadata":{"count":1}},"made":2,"log":[["job.start","d:0",[1,{"object":[["b",{"array":[2]}]]}]],["job.wait","d:0","d:0",[1,{"object":[["b",{"array":[2]}]]}]],["job.start","d:1",[]],["job.wait","d:1","d:1",[]],["job.wait","d:0","d:0",[1,{"object":[["b",{"array":[2]}]]}]],["job.wait","d:1","d:1",[]]]}, + {"code":"return [note({ n: wait() }), await wait()]","runId":"t","translate":{"promises":"await"},"suspend":{"ok":true,"metadata":null,"same":true},"resume":{"ok":true,"value":[null,7],"metadata":null},"made":2,"log":[["wait","t:0"],["wait","t:0"],["note","t:1",[{"object":[["n",7]]}]],["wait","t:2"]]}, + {"code":"let n = 0; const o = { get x() { return ++n }, set x(v) { n = v } }; o.x; await wait(); o.x = 10; return [o.x, Object.getOwnPropertyDescriptor(o, \"x\").get.name, Object.keys(o)]","runId":"g","suspend":{"ok":true,"metadata":null,"same":true},"resume":{"ok":true,"value":[11,"get x",["x"]],"metadata":null},"made":2,"log":[["wait","g:0"],["wait","g:0"]]}, + {"code":"class A { constructor(n) { this.v = double(wait()) + n } m() { return this.v + 1 } } const a = new A(1); return [a.v, a.m(), a instanceof A, Object.keys(a)]","runId":"k","translate":{"promises":"await"},"suspend":{"ok":true,"metadata":null,"same":true},"resume":{"ok":true,"value":[15,16,true,["v"]],"metadata":null},"made":2,"log":[["wait","k:0"],["wait","k:0"]]}, + {"code":"class A { static scale = 2; a = 1; v = double(wait()) + this.a; w = this.v * A.scale; constructor() { this.after = this.w } } const a = new A(); return [a.v, a.w, a.after, Object.keys(a)]","runId":"k","translate":{"promises":"await"},"suspend":{"ok":true,"metadata":null,"same":true},"resume":{"ok":true,"value":[15,30,30,["a","v","w","after"]],"metadata":null},"made":2,"log":[["wait","k:0"],["wait","k:0"]]}, + {"code":"class A { static v = double(wait()); static w = A.v + 1 } return [A.v, A.w]","runId":"k","translate":{"promises":"await"},"suspend":{"ok":true,"metadata":null,"same":true},"resume":{"ok":true,"value":[14,15],"metadata":null},"made":2,"log":[["wait","k:0"],["wait","k:0"]]}, + {"code":"class A { constructor() { this.base = 1 } m() { return this.base + double(wait()) } } return [new A().m()]","runId":"k","translate":{"promises":"await"},"suspend":{"ok":true,"metadata":null,"same":true},"resume":{"ok":true,"value":[15],"metadata":null},"made":2,"log":[["wait","k:0"],["wait","k:0"]]}, + {"code":"class A { constructor() { this.n = 20 } get v() { return double(wait()) + this.n } set w(x) { this.got = double(wait()) + x } } const a = new A(); a.w = 1; return [a.v, a.got]","runId":"k","translate":{"promises":"await"},"suspend":{"ok":true,"metadata":null,"same":true},"resume":{"ok":true,"value":[34,15],"metadata":null},"made":2,"log":[["wait","k:0"],["wait","k:0"],["wait","k:2"]]}, + {"code":"class A { async load() { const v = await wait(); return v + 1 } *items() { yield 1; yield double(wait()); yield 3 } } const a = new A(); return [await a.load(), [...a.items()]]","runId":"k","translate":{"promises":"await"},"suspend":{"ok":true,"metadata":null,"same":true},"resume":{"ok":true,"value":[8,[1,14,3]],"metadata":null},"made":2,"log":[["wait","k:0"],["wait","k:0"],["wait","k:1"]]}, + {"code":"class A { constructor(n) { this.v = double(wait()) + n } } class B extends A { constructor() { super(1); this.w = this.v + 1 } m() { return super.constructor.name + this.w } } const b = new B(); return [b.v, b.w, b.m(), b instanceof A]","runId":"k","translate":{"promises":"await"},"suspend":{"ok":true,"metadata":null,"same":true},"resume":{"ok":true,"value":[15,16,"A16",true],"metadata":null},"made":2,"log":[["wait","k:0"],["wait","k:0"]]}, + {"code":"class Base extends Error { name = \"Base\" } class NotFound extends Base { constructor(n) { super(\"missing\", { cause: n }); this.code = double(wait()) } } try { throw new NotFound(3) } catch (e) { return [e instanceof NotFound, e.name, e.message, e.cause, e.code, String(e)] }","runId":"k","translate":{"promises":"await"},"suspend":{"ok":true,"metadata":null,"same":true},"resume":{"ok":true,"value":[true,"Base","missing",3,14,"Base: missing"],"metadata":null},"made":2,"log":[["wait","k:0"],["wait","k:0"]]}, + {"code":"await wait(); console.log(\"x\".repeat(20)); return \"y\".repeat(20)","runId":"l","limits":{"maxOutputBytes":10},"suspend":{"ok":true,"metadata":null,"same":true},"resume":{"ok":true,"value":"\"yyyyyyyyy [result truncated: 22 bytes exceeds the 10-byte output limit; return a smaller value]","logs":["[logs truncated: showing 0 of 1 lines]"],"truncated":true,"metadata":null},"made":2,"log":[["wait","l:0"],["wait","l:0"]]} + ] +} diff --git a/packages/codemode-rust/conformance/host.ts b/packages/codemode-rust/conformance/host.ts new file mode 100644 index 0000000000000..9d222303cf9f8 --- /dev/null +++ b/packages/codemode-rust/conformance/host.ts @@ -0,0 +1,402 @@ +#!/usr/bin/env bun + +// Regenerates conformance/host.json: what the reference's language layer does with host functions, the behaviours +// packages/codemode/test/language.test.ts covers that the other recordings don't: call keys and run ids, sync, async +// and sync-thenable functions, constructible ones, functions that take functions, idempotent calls across a suspend, +// durable functions across a suspend (start, wait, cancel), `Host.fail` and `Host.missing` kinds and suggestions, +// namespaces (keys, resolve), `run.metadata` across a suspend and in the result, globals made again on resume, +// `translate` (default "error" and its modes) and `limits`. The Rust tests replay this recording. +// Usage: bun conformance/host.ts [reference] — the reference CodeMode package directory, from the argument, +// CODEMODE_REF, or by default ../codemode relative to this workspace. +// +// Every entry runs in its own runtime: `Runtime.make({ globals, translate?, limits? })` with the entry's `translate` +// and `limits` (absent: the reference's defaults, both translations "error" and no limits), no `modules`, and the +// program made with `{ runId }` (the entry's, "run" by default). `globals(run)` is called when a run starts and again +// when it resumes; each call counts toward the entry's `made`. It gives (every `run` takes one parameter, `length` 1, +// except `note`, `post` and the durable function's hooks, which also take the call; each is named by its global): +// - `double(n)`: sync; gives `n * 2`. +// - `inc(n)`: sync; gives `Effect.succeed(n + 1)`, which the program waits for. +// - `promised(n)`: sync; gives `Promise.resolve(n)`, which reaches the program as a promise. +// - `load(n)`: async; gives `Effect.succeed(n)`. +// - `find()`: sync-thenable; gives `{ items: [1, 2] }`. +// - `note(...args)`: sync; logs `["note", call.key, args.map(describe)]` (see `describe` in conformance/reference.ts) +// and gives `undefined`. +// - `post(...args)`: async; logs `["post", call.key, args.map(describe)]` as it runs and gives `undefined`. +// - `never()`: async, not idempotent; logs `["never", call.key]` and never settles. +// - `open()`: sync; gives `{ read }`, where `read` is a host function (a plain JavaScript function inside a result) +// that gives `"called"`. +// - `takes(input)`: sync, `takesFunctions: true`; gives whether `input.read` is that same `read` function. +// - `refuses(input)`: sync; gives `true`. +// - `grab(input)`: async, `idempotent: true`, `takesFunctions: true`; logs `["grab", call.key]`; never settles until the entry +// resumed, then gives 3. +// - `Box(item)`: sync, `constructible: true`; gives `{ item }`. +// - `Later(item)`: sync, `constructible: true`; gives `Effect.succeed({ item })`. +// - `refuse()`: sync; fails with `Host.fail("Refused", "Not today", ["Ask again."])`. +// - `api`: `Host.namespace`; `keys([])` is `["issues"]`, `keys` of any other path `["list"]`; `resolve(["issues", +// "list"])` is an async function giving `["#1"]`, any other path `Host.missing("No api.", ["Try +// api.issues.list."], "NotFound")`. +// - `count()`: sync; sets `run.metadata` to `{ count: 0 }` when it is null, then increments and gives `count`. +// - `wait()`: async, `idempotent: true`; logs `["wait", call.key]`; never settles until the entry resumed, then gives 7. +// - `job()`: `Host.durableFn`. `start(args, call)` logs `["job.start", call.key, args.map(describe)]` and gives +// `call.key` as its data; `wait(data, call)` logs `["job.wait", data, call.key, call.args.map(describe)]`, never +// settles until the entry resumed, then gives 41; `cancel(data, call)` logs `["job.cancel", data, call.key]`. +// +// host.json: `{ executes: [{ code, runId, translate?, limits?, compiled?, compile?, outcome, again?, log }], +// suspensions: [{ code, runId, translate?, limits?, compiled?, suspend, resume?, made, log }] }`. +// - An entry with `compiled: true` runs from `runtime.compile(code)` instead of its source. An execute records +// `compile` (`{ ok: true }`, or `{ ok: false, error }` with the diagnostic, when `outcome` is its source's run), and +// runs the compiled program twice in the same runtime: `outcome`, then `again`. +// - `outcome` and `resume`: the run's `Result` as the reference gives it (`ok`, `value` or `error` with `kind`, +// `message` and `suggestions?`, `warnings?`, `logs?`, `truncated?`, `metadata`). +// - A suspension runs the program until `never`, `grab`, `wait` or the durable `job`'s `wait` is first called, +// suspends it (`program.suspend()`), then: on a `SuspendError`, records `suspend: { ok: false, message, running }` +// and interrupts the run; on success, records `suspend: { ok: true, metadata, same }` (the saved header's +// `metadata`; `same`: whether `run()` returned that same `Suspended`), marks the entry resumed, and resumes the +// state from bytes (`Language.toBytes`) in the same runtime. `made` counts `globals` calls (the reference's normal +// mode; its round-trip test mode makes them more often). +// - `log`: what the host functions logged, in order. +// Everything is recorded twice, and a difference between the two fails the generator. + +import { join } from "node:path" +import { writeRecording } from "./recording.ts" +import { describe, reference } from "./reference.ts" + +const ref = await reference(process.argv[2] ?? process.env.CODEMODE_REF) +const Effect = ref.Effect +const Fiber = ref.Fiber +const Host = ref.Language.Host +const Runtime = ref.Language.Runtime + +type Entry = { code: string; runId?: string; translate?: unknown; limits?: unknown; compiled?: boolean } + +const read = () => "called" + +const make = (entry: Entry) => { + const log: Array = [] + const state = { resumed: false, made: 0, started: () => {} } + const waiting = new Promise((done) => (state.started = done)) + const pending = () => Effect.callback(() => state.started()) + const runtime = Runtime.make({ + ...(entry.translate === undefined ? {} : { translate: entry.translate }), + ...(entry.limits === undefined ? {} : { limits: entry.limits }), + globals: (run: { id: string; metadata: unknown }) => { + state.made++ + return { + double: Host.fn(([n]: ReadonlyArray) => n * 2), + inc: Host.fn(([n]: ReadonlyArray) => Effect.succeed(n + 1)), + promised: Host.fn(([n]: ReadonlyArray) => Promise.resolve(n)), + load: Host.fn(([n]: ReadonlyArray) => Effect.succeed(n), { type: "async" }), + find: Host.fn((_: ReadonlyArray) => ({ items: [1, 2] }), { type: "sync-thenable" }), + note: Host.fn((args: ReadonlyArray, call: { key: string }) => { + log.push(["note", call.key, args.map(describe)]) + }), + post: Host.fn( + (args: ReadonlyArray, call: { key: string }) => + Effect.sync(() => void log.push(["post", call.key, args.map(describe)])), + { type: "async" }, + ), + never: Host.fn( + (_: ReadonlyArray, call: { key: string }) => + Effect.suspend(() => (log.push(["never", call.key]), pending())), + { type: "async" }, + ), + open: Host.fn((_: ReadonlyArray) => ({ read })), + takes: Host.fn(([input]: ReadonlyArray<{ read?: unknown }>) => input?.read === read, { takesFunctions: true }), + refuses: Host.fn((_: ReadonlyArray) => true), + grab: Host.fn( + (_: ReadonlyArray, call: { key: string }) => + Effect.suspend(() => (log.push(["grab", call.key]), state.resumed ? Effect.succeed(3) : pending())), + { type: "async", idempotent: true, takesFunctions: true }, + ), + Box: Host.fn(([item]: ReadonlyArray) => ({ item }), { constructible: true }), + Later: Host.fn(([item]: ReadonlyArray) => Effect.succeed({ item }), { constructible: true }), + refuse: Host.fn((_: ReadonlyArray) => Effect.fail(Host.fail("Refused", "Not today", ["Ask again."]))), + api: Host.namespace({ + keys: (path: ReadonlyArray) => (path.length === 0 ? ["issues"] : ["list"]), + resolve: (path: ReadonlyArray) => + path.join(".") === "issues.list" + ? Host.fn((_: ReadonlyArray) => Effect.succeed(["#1"]), { type: "async" }) + : Host.missing(`No api.${path.join(".")}`, ["Try api.issues.list."], "NotFound"), + }), + count: Host.fn((_: ReadonlyArray) => { + const counted = (run.metadata ??= { count: 0 }) as { count: number } + return ++counted.count + }), + wait: Host.fn( + (_: ReadonlyArray, call: { key: string }) => + Effect.suspend(() => { + log.push(["wait", call.key]) + return state.resumed ? Effect.succeed(7) : pending() + }), + { type: "async", idempotent: true }, + ), + job: Host.durableFn({ + start: (args: ReadonlyArray, call: { key: string }) => + Effect.sync(() => { + log.push(["job.start", call.key, args.map(describe)]) + return call.key + }), + wait: (data: unknown, call: { key: string; args: ReadonlyArray }) => + Effect.suspend(() => { + log.push(["job.wait", data, call.key, call.args.map(describe)]) + return state.resumed ? Effect.succeed(41) : pending() + }), + cancel: (data: unknown, call: { key: string }) => + Effect.sync(() => void log.push(["job.cancel", data, call.key])), + }), + } + }, + }) + return { runtime, log, state, waiting } +} + +const named = (entry: Entry) => ({ ...entry, runId: entry.runId ?? "run" }) + +const execute = async (entry: Entry) => { + const made = make(entry) + const options = { runId: named(entry).runId } + if (entry.compiled !== true) { + const result = await Effect.runPromise(made.runtime.execute(entry.code, options)) + return { ...named(entry), outcome: result, log: made.log } + } + const compiled = made.runtime.compile(entry.code) + if (!compiled.ok) { + const result = await Effect.runPromise(made.runtime.execute(entry.code, options)) + return { ...named(entry), compile: compiled, outcome: result, log: made.log } + } + const outcome = await Effect.runPromise(made.runtime.execute(compiled.compiled, options)) + const again = await Effect.runPromise(made.runtime.execute(compiled.compiled, options)) + return { ...named(entry), compile: { ok: true }, outcome, again, log: made.log } +} + +// The program an entry runs: its source, or with `compiled`, what `runtime.compile` made of it. +const code = (runtime: { compile: (code: string) => { ok: boolean; compiled?: unknown } }, entry: Entry) => { + if (entry.compiled !== true) return entry.code + const compiled = runtime.compile(entry.code) + if (!compiled.ok) throw new Error(`${entry.code} doesn't compile`) + return compiled.compiled +} + +const suspend = async (entry: Entry) => { + const made = make(entry) + const program = made.runtime.program(code(made.runtime, entry), { runId: named(entry).runId }) + const fiber = Effect.runFork(program.run()) + await made.waiting + const suspended = await Effect.runPromise(Effect.result(program.suspend())) + if (suspended._tag === "Failure") { + await Effect.runPromise(Fiber.interrupt(fiber)) + return { + ...named(entry), + suspend: { ok: false, message: suspended.failure.message, running: suspended.failure.running }, + made: made.state.made, + log: made.log, + } + } + const outcome = suspended.success + const ran = await Effect.runPromise(Fiber.join(fiber)) + if (outcome.ok !== "suspended") + return { ...named(entry), suspend: { ok: false, outcome }, made: made.state.made, log: made.log } + made.state.resumed = true + const resumed = await Effect.runPromise(made.runtime.resume(ref.Language.toBytes(outcome.state)).run()) + return { + ...named(entry), + suspend: { ok: true, metadata: outcome.state.header.metadata, same: ran === outcome }, + resume: resumed, + made: made.state.made, + log: made.log, + } +} + +const drop = { functions: "drop" } +const wait = { promises: "await" } +const executes: Array = [ + // Sync, async and sync-thenable functions. + { code: `const a = double(2); const b = inc(a); return [a, b, typeof double, double.name, double.length]` }, + { code: `const p = load(1); return [p instanceof Promise, await p]` }, + { code: `const p = promised(3); return [p instanceof Promise, await p]` }, + { + code: `return [find().items.length, (await find()).items.length, await find().then((r) => r.items[1]), Object.keys(find())]`, + }, + { + code: `const log = []; load(1).then(() => log.push("load")); promised(2).then(() => log.push("promised")); Promise.resolve().then(() => log.push("job")); log.push(inc(1)); await null; await null; await null; return log`, + }, + // Call keys: every call of a host function takes the next id, in program order. + { code: `note(); note(1); await load(1); note("a", [2]); await post(3); return 1`, runId: "r" }, + { + code: `const p = post(1); note(2); const q = Promise.all([post(3), load(4)]); note(5); await p; await q; return 1`, + runId: "k", + }, + // Arguments and results cross as structured copies. + { + code: `note({ at: new Date(5), m: new Map([["k", 1]]), s: new Set(["a"]), u: new URL("https://a.test/"), e: new RangeError("r") }); const r = open(); return [typeof r.read, r.read(), r.read.name]`, + }, + // A function inside a result crosses back as itself only to a function that takes functions. + { code: `return takes({ read: open().read })` }, + { code: `return takes(open())` }, + { code: `refuses(open().read)` }, + { code: `takes(takes)` }, + { code: `takes(() => 1)` }, + // Constructible functions. + { code: `return [new Box(1).item, new Later(2).item, new Later(...[3]).item, Box(4).item, typeof Box]` }, + { code: `new double(1)` }, + { code: `try { new load(1) } catch (e) { return [e.name, e.message] }` }, + // Namespaces, Host.missing and Host.fail. + { + code: `return [await api.issues.list(), Object.keys(api), Object.keys(api.issues), typeof api.x, typeof api.issues.list]`, + }, + { code: `return api.issues.nope()` }, + { code: `try { api.nope() } catch (e) { return [e.name, e.message, e instanceof Error] }` }, + { code: `refuse()` }, + { code: `try { refuse() } catch (e) { return [e.name, e.message] }` }, + { + code: `const out = []; for (const k in api) out.push(k); const x = api.issues; return [out, api.issues === api.issues, x === x, String(api.issues)]`, + }, + // run.metadata is the result's. + { code: `count(); count(); return count()` }, + { code: `return 1` }, + { code: `count(); throw new Error("after")` }, + // Translate: the default refuses functions and promises in arguments. + { code: `note({ f() {} })` }, + { code: `note([Promise.resolve(1)])` }, + { code: `await post(() => 1)` }, + { code: `return await post({ p: Promise.resolve(1) }).catch((e) => [e.name, e.message])` }, + // functions: "drop". + { + code: `note({ q: "x", format(v) { return v }, nested: { f: Math.max } }, [1, () => 2, note], () => 3, new Map([["k", () => 1]]))`, + translate: drop, + }, + { code: `note({ p: Promise.resolve(1) })`, translate: drop }, + // promises: "await". + { + code: `const slow = (async () => { await null; await null; return "slow" })() +const a = note({ n: Promise.resolve(5), list: [load(1), slow] }, load({ deep: load(2) })) +const b = await post(slow, new Promise((resolve) => resolve(load(3)))) +return [a, b]`, + translate: wait, + }, + { code: `note({ f() {} })`, translate: wait }, + { + code: `const failing = () => Promise.reject(new RangeError("nope")) +let thrown +try { note({ n: failing() }) } catch (error) { thrown = error } +const sent = post([load(1), failing()]) +return [thrown instanceof RangeError, thrown.message, sent instanceof Promise, await sent.catch((e) => e.message)]`, + translate: wait, + }, + { code: `note({ n: never() })`, translate: wait, limits: { timeoutMs: 50 } }, + { code: `note({ f() {}, p: load(1) }, () => 2)`, translate: { functions: "drop", promises: "await" } }, + // Limits. + { code: `while (true) {}`, limits: { timeoutMs: 50 } }, + { code: `await never()`, limits: { timeoutMs: 50 } }, + { code: `never(); return 1`, limits: { timeoutMs: 50 } }, + { code: `console.log("a".repeat(10)); console.log("b"); return "c".repeat(20)`, limits: { maxOutputBytes: 16 } }, + { code: `console.log("1"); console.log("2"); console.log("3"); return 1`, limits: { maxOutputBytes: 4 } }, + { code: `count(); console.log("x".repeat(30)); throw new Error("y".repeat(30))`, limits: { maxOutputBytes: 8 } }, + { code: `for (let i = 0; i < 5; i++) Promise.reject(new Error("e" + i)); return 1`, limits: { maxOutputBytes: 100 } }, + // Warnings: rejections nothing handled. + { code: `Promise.reject(new Error("x")); return 1` }, + { code: `const p = Promise.reject(1); await null; p.catch(() => 0); return 2` }, + { code: `async function f() { throw new TypeError("bad") }\nf(); f(); return 4` }, + { code: `Promise.reject("plain"); Promise.reject({ a: [1] }); return 6` }, + { code: `Promise.reject(new Error("unseen")); throw new Error("seen")` }, + { code: `async function g() { null.x }\ng(); return 7` }, + { code: `refuse.call(null); return 8` }, + { code: `api.issues.nope(); return 9` }, + // Durable functions: cancelled when the run ends with their work still running. + { code: `job(1); return 1`, runId: "c" }, + { code: `const p = job({ a: 1 }); await null; throw new Error("ended")`, runId: "c" }, + // Compiled once, run many times: the same as from source, each run with its own state. + { code: `note(count()); return double(await load(2)) + count()`, compiled: true }, + { code: `job(1); return 1`, runId: "c", compiled: true }, + { code: `note(1); class A {}`, compiled: true }, + // Getters and setters: an argument's getters run once before the host function, a setter-only property is left + // out; a getter that waits on a host call parks the read; the result's getters run as it crosses. + { code: `let n = 0; note({ a: 1, get b() { n++; return [double(2)] }, set c(v) {} }); return n` }, + { code: `const o = { get v() { return inc(1) } }; const x = o.v; o.v; return [x, { get w() { return x + 1 } }]` }, + { code: `const o = { set v(x) { note(inc(x)) } }; o.v = 4; return Object.keys(o)` }, + { code: `const e = await load({ get a() { throw new Error("g") } }).catch((e) => e.message); return [e, await load({ get a() { return 2 }, set b(v) {} })]` }, + { code: `let n = 0; const r = await api.issues.list({ get q() { n++; return 1 } }); try { double({ get x() { throw new Error("s") } }) } catch (e) { return [r, n, e.message] }` }, + // A host function called by a built-in reads its arguments' getters first, as one called from program code. + { code: `return [{ get a() { return 2 } }].map(note)` }, + { code: `return [{ get a() { return 2 } }].map(double)` }, + { code: `return [1].map((x) => note({ get a() { return x } }))` }, + { code: `return note.call(null, { get a() { return 1 } })` }, + { code: `return note.apply(null, [{ get a() { return 1 } }])` }, + { code: `return note.bind(null, { get a() { return 1 } })()` }, + { code: `return Array.from([{ get a() { return 1 } }], note)` }, + { code: `const r = []; new Map([[1, { get a() { return 1 } }]]).forEach((v) => r.push(note(v))); return r` }, + { code: `return await Promise.resolve({ get a() { return 3 } }).then(note)` }, + { code: `return [{ get a() { return 1 } }].forEach(note)` }, + { code: `return [{ get a() { return 1 } }].filter(note)` }, + { code: `return [[{ get a() { return 1 } }]].map(([x]) => note.call(null, x))` }, + { code: `return post.call(null, { get a() { throw new Error('g') } }).catch((e) => e.message)` }, + { code: `return [{ get a() { throw new Error('g') } }].map(post)` }, + { code: `return note.call(null, { get a() { return inc(1) } })` }, + { code: `return [{ get a() { return inc(1) } }].map(note)` }, + // Compiling gives the diagnostic a run of the source fails with first. + { code: ` `, compiled: true }, + { code: `return (`, compiled: true }, + { code: `export const x = 1`, compiled: true }, +] +const suspensions: Array = [ + // run.metadata across a suspend; the globals are made again on resume. + { code: `count(); count(); await wait(); return count()`, runId: "m" }, + { code: `count(); count(); await wait(); return count()`, runId: "m", compiled: true }, + // An idempotent call in progress runs again on resume, under the same key. + { code: `note(1); const a = await wait(); note(2); return [a, await wait()]`, runId: "i" }, + { code: `const ps = [wait(), load(1), wait()]; return await Promise.all(ps)`, runId: "i" }, + // A suspend fails while a call that isn't idempotent, or one that holds a host function, runs. + { code: `await never()`, runId: "s" }, + { code: `const p = never(); await wait(); return 1`, runId: "s" }, + { code: `await grab(open().read)`, runId: "s" }, + { code: `await grab({ n: 1 })`, runId: "s" }, + // A durable function keeps running across a suspend and is waited on again. + { code: `return (await job()) + 1`, runId: "d" }, + { code: `return (await job()) + 1`, runId: "d", compiled: true }, + { code: `const a = job(1, { b: [2] }); const b = job(); return [await a, await b, count()]`, runId: "d" }, + // promises: "await" keeps waiting across a suspend. + { code: `return [note({ n: wait() }), await wait()]`, runId: "t", translate: wait }, + // Accessors and their halves are saved with the run. + { + code: `let n = 0; const o = { get x() { return ++n }, set x(v) { n = v } }; o.x; await wait(); o.x = 10; return [o.x, Object.getOwnPropertyDescriptor(o, "x").get.name, Object.keys(o)]`, + runId: "g", + }, + // Classes: a host call waited on in a constructor, field, static field, method, accessor, async or generator method, + // derived constructor or Error subclass, suspended and resumed. + { code: `class A { constructor(n) { this.v = double(wait()) + n } m() { return this.v + 1 } } const a = new A(1); return [a.v, a.m(), a instanceof A, Object.keys(a)]`, runId: "k", translate: wait }, + { code: `class A { static scale = 2; a = 1; v = double(wait()) + this.a; w = this.v * A.scale; constructor() { this.after = this.w } } const a = new A(); return [a.v, a.w, a.after, Object.keys(a)]`, runId: "k", translate: wait }, + { code: `class A { static v = double(wait()); static w = A.v + 1 } return [A.v, A.w]`, runId: "k", translate: wait }, + { code: `class A { constructor() { this.base = 1 } m() { return this.base + double(wait()) } } return [new A().m()]`, runId: "k", translate: wait }, + { code: `class A { constructor() { this.n = 20 } get v() { return double(wait()) + this.n } set w(x) { this.got = double(wait()) + x } } const a = new A(); a.w = 1; return [a.v, a.got]`, runId: "k", translate: wait }, + { code: `class A { async load() { const v = await wait(); return v + 1 } *items() { yield 1; yield double(wait()); yield 3 } } const a = new A(); return [await a.load(), [...a.items()]]`, runId: "k", translate: wait }, + { code: `class A { constructor(n) { this.v = double(wait()) + n } } class B extends A { constructor() { super(1); this.w = this.v + 1 } m() { return super.constructor.name + this.w } } const b = new B(); return [b.v, b.w, b.m(), b instanceof A]`, runId: "k", translate: wait }, + { code: `class Base extends Error { name = "Base" } class NotFound extends Base { constructor(n) { super("missing", { cause: n }); this.code = double(wait()) } } try { throw new NotFound(3) } catch (e) { return [e instanceof NotFound, e.name, e.message, e.cause, e.code, String(e)] }`, runId: "k", translate: wait }, + // Limits are saved with the run. + { + code: `await wait(); console.log("x".repeat(20)); return "y".repeat(20)`, + runId: "l", + limits: { maxOutputBytes: 10 }, + }, +] + +const recordAll = async () => { + const recorded = { executes: [] as Array, suspensions: [] as Array } + for (const entry of executes) recorded.executes.push(await execute(entry)) + for (const entry of suspensions) recorded.suspensions.push(await suspend(entry)) + return recorded +} +// Everything is recorded twice: a recording that differs between the two depends on timing, which CI's freshness +// check and the Rust replay can't follow, so it fails here instead of being written. +const expected = await recordAll() +const again = await recordAll() +const unstable = (["executes", "suspensions"] as const).flatMap((kind) => + expected[kind].flatMap((entry, i) => + JSON.stringify(entry) === JSON.stringify(again[kind][i]) ? [] : [`${kind}[${i}]: ${(entry as Entry).code}`], + ), +) +if (unstable.length > 0) { + console.error(`recordings that differ between two runs (timing-dependent):\n${unstable.join("\n\n")}`) + process.exit(1) +} +writeRecording(join(import.meta.dir, "host.json"), expected) +console.log(`${expected.executes.length} executes, ${expected.suspensions.length} suspensions`) diff --git a/packages/codemode-rust/conformance/recording.ts b/packages/codemode-rust/conformance/recording.ts new file mode 100644 index 0000000000000..e67cd4b59fb94 --- /dev/null +++ b/packages/codemode-rust/conformance/recording.ts @@ -0,0 +1,19 @@ +// Writes a generated recording compactly but still as JSON: the top level's keys on lines of their own (and those of +// an object directly under it), and each entry of an array under them as one minified line, so a change to one +// recorded program is a one-line diff. + +import { writeFileSync } from "node:fs" + +export const writeRecording = (path: string, value: unknown) => writeFileSync(path, format(value, 0, "") + "\n") + +const format = (value: unknown, depth: number, indent: string): string => { + const inner = indent + " " + if (Array.isArray(value) && depth > 0 && value.length > 0) + return `[\n${value.map((entry) => inner + (JSON.stringify(entry) ?? "null")).join(",\n")}\n${indent}]` + if (depth < 2 && value !== null && typeof value === "object" && !Array.isArray(value)) { + const entries = Object.entries(value).filter((entry) => entry[1] !== undefined) + if (entries.length > 0) + return `{\n${entries.map(([key, v]) => `${inner}${JSON.stringify(key)}: ${format(v, depth + 1, inner)}`).join(",\n")}\n${indent}}` + } + return JSON.stringify(value) +} diff --git a/packages/codemode-rust/conformance/reference.rs b/packages/codemode-rust/conformance/reference.rs new file mode 100644 index 0000000000000..b5b6d98508546 --- /dev/null +++ b/packages/codemode-rust/conformance/reference.rs @@ -0,0 +1,187 @@ +//! The Rust side of `conformance/reference.ts`: the `tools` host global the generators define, and `describe`, which +//! writes a host value as data the way the recordings do. Each replay includes this file with `#[path]`. + +#![allow(dead_code)] + +use psychoscript::{Failure, HostFunction, HostString, HostValue, Json, Namespace, Resolved}; +use serde_json::json; + +/// The `tools` namespace of `conformance/reference.ts`: `tools.echo`, `tools.fail` and `tools.git.status`, all async; +/// any other path is an async function that rejects with `NotFound`, and listing the names under a path that is +/// neither a namespace nor a function throws `NotFound`. +pub fn tools() -> Namespace { + let echo = HostFunction::new_async(|args, _| async move { + Ok(match args.first() { + Some(HostValue::Object(fields)) => fields + .iter() + .find(|(k, _)| k == "id") + .map_or(HostValue::Null, |(_, v)| v.clone()), + _ => HostValue::Null, + }) + }) + .length(1); + let fail = + HostFunction::new_async(|_, _| async { Err(Failure::new("HostFailure", "boom").into()) }) + .length(1); + let status = HostFunction::new_async(|_, _| async { + Ok(HostValue::object([ + ("branch", HostValue::from("main")), + ("dirty", HostValue::Bool(true)), + ])) + }) + .length(1); + Namespace::new( + |path| match path { + [] => Ok(vec!["echo".into(), "fail".into(), "git".into()]), + [git] if git == "git" => Ok(vec!["status".into()]), + [f] if f == "echo" || f == "fail" => Ok(Vec::new()), + [git, status] if git == "git" && status == "status" => Ok(Vec::new()), + _ => Err(Failure::new( + "NotFound", + exact("No namespace at tools.", &joined_exact(path), "."), + ) + .into()), + }, + move |path| -> Resolved { + match path { + [f] if f == "echo" => echo.clone().into(), + [f] if f == "fail" => fail.clone().into(), + [git, s] if git == "git" && s == "status" => status.clone().into(), + _ => { + let message = exact("No function at tools.", &joined_exact(path), "."); + HostFunction::new_async(move |_, _| { + let message = message.clone(); + async move { Err(Failure::new("NotFound", message).into()) } + }) + .length(1) + .into() + } + } + }, + ) +} + +/// A host value as data, as `describe` in `conformance/reference.ts` writes it. +pub fn describe(v: &HostValue) -> Json { + match v { + HostValue::Undefined | HostValue::Interrupt => json!({ "undefined": true }), + HostValue::Null => Json::Null, + HostValue::Bool(b) => json!(b), + HostValue::Number(n) if n.is_nan() => json!({ "number": "NaN" }), + HostValue::Number(n) if n.is_infinite() => { + json!({ "number": if *n > 0.0 { "Infinity" } else { "-Infinity" } }) + } + HostValue::Number(n) => number(*n), + HostValue::String(s) => text(s), + HostValue::Function(f) => json!({ "function": f.name() }), + HostValue::Durable(_) | HostValue::Namespace(_) => json!({ "function": "" }), + HostValue::Date(t) if t.is_nan() => json!({ "date": "NaN" }), + HostValue::Date(t) => json!({ "date": number(*t) }), + HostValue::RegExp { source, flags } => json!({ "regexp": [text(source), flags] }), + HostValue::Url(href) => json!({ "url": href }), + HostValue::SearchParams(pairs) => json!({ "params": pairs }), + HostValue::Headers(entries) => json!({ "headers": entries }), + HostValue::Buffer(b) => json!({ "buffer": b }), + HostValue::Bytes(b) => json!({ "bytes": b }), + HostValue::Map(entries) => json!({ + "map": entries.iter().map(|(k, x)| json!([describe(k), describe(x)])).collect::>() + }), + HostValue::Set(items) => json!({ "set": items.iter().map(describe).collect::>() }), + HostValue::Array(items) => json!({ + "array": items + .iter() + .map(|i| i.as_ref().map_or(json!({ "hole": true }), describe)) + .collect::>() + }), + HostValue::Error(e) => { + let mut error = serde_json::Map::new(); + error.insert("name".into(), text(&e.name)); + error.insert("message".into(), text(&e.message)); + if let Some(cause) = &e.cause { + error.insert("cause".into(), describe(cause)); + } + error.insert( + "fields".into(), + Json::Array( + e.fields + .iter() + .map(|(k, x)| json!([text(k), describe(x)])) + .collect(), + ), + ); + json!({ "error": error }) + } + HostValue::Failure(f) => json!({ + "error": { "name": "Error", "message": text(&f.message), "fields": [] } + }), + HostValue::Response(_) => json!({ "object": [] }), + HostValue::Object(fields) => json!({ + "object": fields.iter().map(|(k, x)| json!([text(k), describe(x)])).collect::>() + }), + } +} + +/// A namespace path's names joined with `.`, unpaired surrogates kept, as the reference's `path.join(".")`. +pub fn joined_exact(path: &[HostString]) -> HostString { + let mut units = Vec::new(); + for (i, k) in path.iter().enumerate() { + if i > 0 { + units.push(u16::from(b'.')); + } + units.extend_from_slice(&k.to_utf16()); + } + HostString::from_utf16(&units) +} + +/// `before + text + after`, unpaired surrogates in `text` kept. +pub fn exact(before: &str, text: &HostString, after: &str) -> HostString { + let units: Vec = before + .encode_utf16() + .chain(text.to_utf16().iter().copied()) + .chain(after.encode_utf16()) + .collect(); + HostString::from_utf16(&units) +} + +/// A namespace path as text, its names joined with `.` (U+FFFD for an unpaired surrogate), for messages. +pub fn joined(path: &[HostString]) -> String { + path.iter() + .map(|k| k.to_string()) + .collect::>() + .join(".") +} + +/// A string as `describe` writes it: the string itself, or `{ string: [code units] }` when it has an unpaired +/// surrogate, which JSON can't hold. +pub fn text(s: &HostString) -> Json { + match s.as_str() { + Some(s) => json!(s), + None => json!({ "string": s.to_utf16() }), + } +} + +/// A number as JSON writes it: an integer when it is one. +fn number(n: f64) -> Json { + if n.fract() == 0.0 && n.abs() < 9.0e15 && !(n == 0.0 && n.is_sign_negative()) { + json!(n as i64) + } else { + json!(n) + } +} + +/// JSON equality where numbers compare by value, so `3` equals `3.0`. +pub fn same(a: &Json, b: &Json) -> bool { + match (a, b) { + (Json::Number(x), Json::Number(y)) => x.as_f64() == y.as_f64(), + (Json::Array(x), Json::Array(y)) => { + x.len() == y.len() && x.iter().zip(y).all(|(x, y)| same(x, y)) + } + (Json::Object(x), Json::Object(y)) => { + x.len() == y.len() + && x.iter() + .zip(y) + .all(|((kx, vx), (ky, vy))| kx == ky && same(vx, vy)) + } + _ => a == b, + } +} diff --git a/packages/codemode-rust/conformance/reference.ts b/packages/codemode-rust/conformance/reference.ts new file mode 100644 index 0000000000000..8cd1273a08b39 --- /dev/null +++ b/packages/codemode-rust/conformance/reference.ts @@ -0,0 +1,118 @@ +// Loads the reference's language layer (`packages/codemode/src/language`, the `Language` namespace) and `effect` as +// the reference resolves it, and defines the `tools` host global the generators and the reference bench drivers share. +// +// The reference package directory: `override` (a generator's first argument or CODEMODE_REF), or by default +// ../codemode relative to this workspace. +// +// The `tools` global (`Host.namespace`), the same wherever it is used: +// - `keys([])` is `["echo", "fail", "git"]`, `keys(["git"])` is `["status"]`, `keys` of a function's path (`["echo"]`, +// `["fail"]`, `["git", "status"]`) is `[]`; any other path throws `Host.fail("NotFound", "No namespace at tools..")`. +// - `resolve(path)` (path joined with "."): +// - `echo`: `Host.fn`, `type: "async"`, not idempotent; gives its first argument's own `id` property when that +// argument is a non-null object, otherwise `null`. +// - `fail`: `Host.fn`, `type: "async"`; fails with `Host.fail("HostFailure", "boom")`. +// - `git.status`: `Host.fn`, `type: "async"`; gives `{ branch: "main", dirty: true }`. +// - any other path: `Host.fn`, `type: "async"`, that fails with `Host.fail("NotFound", "No function at tools..")`, +// so calling it rejects its promise. +// Each function's `run` takes one parameter (`length` 1); its name is the last segment of its path. + +import { join, resolve } from "node:path" + +export const reference = async (override?: string) => { + const pkg = override === undefined ? resolve(import.meta.dir, "../../codemode") : resolve(override) + const effect = await import(Bun.resolveSync("effect", join(pkg, "src"))) + const language = await import(join(pkg, "src/language/index.ts")) + return { pkg, Effect: effect.Effect, Fiber: effect.Fiber, Language: language } +} + +type Reference = Awaited> + +export const toolsGlobal = (ref: Reference) => { + const Effect = ref.Effect + const Host = ref.Language.Host + const echo = Host.fn( + ([input]: ReadonlyArray) => + Effect.succeed( + typeof input === "object" && input !== null && Object.hasOwn(input, "id") + ? (input as { id: unknown }).id + : null, + ), + { type: "async" }, + ) + const fail = Host.fn((_: ReadonlyArray) => Effect.fail(Host.fail("HostFailure", "boom")), { type: "async" }) + const status = Host.fn((_: ReadonlyArray) => Effect.succeed({ branch: "main", dirty: true }), { + type: "async", + }) + const functions = new Map([ + ["echo", echo], + ["fail", fail], + ["git.status", status], + ]) + const namespaces = new Map([ + ["", ["echo", "fail", "git"]], + ["git", ["status"]], + ]) + return Host.namespace({ + keys: (path: ReadonlyArray) => { + const name = path.join(".") + const names = namespaces.get(name) + if (names !== undefined) return names + if (functions.has(name)) return [] + throw Host.fail("NotFound", `No namespace at tools.${name}.`) + }, + resolve: (path: ReadonlyArray) => { + const name = path.join(".") + return ( + functions.get(name) ?? + Host.fn((_: ReadonlyArray) => Effect.fail(Host.fail("NotFound", `No function at tools.${name}.`)), { + type: "async", + }) + ) + }, + }) +} + +/** + * A host value as data, for recordings: what a host function received, in a form JSON keeps. `{ undefined: true }`, + * `{ number: "NaN" | "Infinity" | "-Infinity" }`, JSON primitives as they are, `{ function: name }`, + * `{ date: ms | "NaN" }`, `{ regexp: [source, flags] }`, `{ url: href }`, `{ params: [[k, v], ...] }`, + * `{ headers: [[k, v], ...] }`, `{ buffer: [bytes] }`, `{ bytes: [bytes] }`, `{ arrayBuffer: [bytes] }`, + * `{ map: [[k, v], ...] }`, `{ set: [v, ...] }`, `{ array: [v | { hole: true }, ...] }`, and a string, an object key + * or an error message with an unpaired surrogate as `{ string: [code units] }`, + * `{ error: { name, message, cause?, fields: [[k, v], ...] } }`, `{ object: [[k, v], ...] }`. + */ +export const describe = (v: unknown): unknown => { + if (v === undefined) return { undefined: true } + if (typeof v === "number" && !Number.isFinite(v)) return { number: String(v) } + if (typeof v === "string") return text(v) + if (v === null || typeof v === "string" || typeof v === "number" || typeof v === "boolean") return v + if (typeof v === "function") return { function: v.name } + if (v instanceof Date) return { date: Number.isNaN(v.getTime()) ? "NaN" : v.getTime() } + if (v instanceof RegExp) return { regexp: [text(v.source), v.flags] } + if (v instanceof URL) return { url: v.href } + if (v instanceof URLSearchParams) return { params: [...v] } + if (v instanceof Headers) return { headers: [...v] } + if (Buffer.isBuffer(v)) return { buffer: [...v] } + if (v instanceof Uint8Array) return { bytes: [...v] } + if (v instanceof ArrayBuffer) return { arrayBuffer: [...new Uint8Array(v)] } + if (v instanceof Map) return { map: [...v].map(([k, x]) => [describe(k), describe(x)]) } + if (v instanceof Set) return { set: [...v].map(describe) } + if (Array.isArray(v)) + return { array: Array.from({ length: v.length }, (_, i) => (i in v ? describe(v[i]) : { hole: true })) } + if (v instanceof Error) { + const fields = v as unknown as Record + return { + error: { + name: text(v.name), + message: text(v.message), + ...("cause" in v ? { cause: describe(v.cause) } : {}), + fields: Object.keys(v).map((k) => [text(k), describe(fields[k])]), + }, + } + } + return { object: Object.entries(v as Record).map(([k, x]) => [text(k), describe(x)]) } +} + +/** A string as `describe` writes it: itself, or `{ string: [code units] }` when it has an unpaired surrogate. */ +const text = (s: string): unknown => + s.isWellFormed() ? s : { string: Array.from({ length: s.length }, (_, i) => s.charCodeAt(i)) } diff --git a/packages/codemode-rust/conformance/streaming.json b/packages/codemode-rust/conformance/streaming.json new file mode 100644 index 0000000000000..47c8cee028b2d --- /dev/null +++ b/packages/codemode-rust/conformance/streaming.json @@ -0,0 +1,762 @@ +{ + "programs": [ + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}})\n return [r.url, r.status, r.statusText, r.ok, r.redirected, r.headers.get(\"content-type\"), [...r.headers], r.bodyUsed,\n r.body === null, r.body.locked, typeof r.text, typeof r.body.getReader, Object.keys(r), Object.keys(r.body),\n r.text.name, r.body.getReader.name, r.headers instanceof Headers]","outcome":{"ok":true,"value":["",201,"Created",true,false,"text/plain",[["content-type","text/plain"],["x-a","1"]],false,false,false,"function","function",["url","status","statusText","ok","headers","redirected","body","text","json","bytes","arrayBuffer"],["cancel","getReader"],"","",true]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const t = await r.text(); return [t, r.bodyUsed, r.body.locked]","outcome":{"ok":true,"value":["hello",true,true]},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"{\\\"a\\\":\",\"[1,2]}\"],\"headers\":{\"content-type\":\"application/json\"}}); return [await r.json(), r.bodyUsed]","outcome":{"ok":true,"value":[{"a":[1,2]},true]},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const b = await r.bytes(); return [b instanceof Uint8Array, [...b]]","outcome":{"ok":true,"value":[true,[104,101,108,108,111]]},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const b = await r.arrayBuffer(); return [b instanceof Uint8Array, [...b]]","outcome":{"ok":true,"value":[true,[104,101,108,108,111]]},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({ chunks: [\"{\"], headers: { \"content-type\": \"application/json\" } })\n try { await r.json() } catch (e) { return [e.name, e.message, r.bodyUsed] }","outcome":{"ok":true,"value":["SyntaxError","JSON Parse error: Expected '}'",true]},"log":[["pull",0],["pull",1]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); await r.text()\n try { await r.text() } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","Body already used"]},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); await r.text()\n try { r.body.getReader() } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","Invalid state: ReadableStream is locked"]},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const reader = r.body.getReader()\n const reads = []\n for (let i = 0; i < 4; i++) { const { done, value } = await reader.read(); reads.push([done, value === undefined ? null : [...value]]) }\n return [r.body.locked, r.bodyUsed, reads]","outcome":{"ok":true,"value":[true,true,[[false,[104,101,108]],[false,[108,111]],[true,null],[true,null]]]},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); r.body.getReader()\n try { r.body.getReader() } catch (e) { return [e.name, e.message, r.body.locked] }","outcome":{"ok":true,"value":["TypeError","Invalid state: ReadableStream is locked",true]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); r.body.getReader()\n try { await r.text() } catch (e) { return [e.name, e.message, r.bodyUsed] }","outcome":{"ok":true,"value":["TypeError","Invalid state: ReadableStream is locked",false]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const reader = r.body.getReader(); reader.releaseLock()\n const after = r.body.locked\n try { await reader.read() } catch (e) { return [after, e.name, e.message] }","outcome":{"ok":true,"value":[false,"TypeError","Invalid state: The reader is not attached to a stream"]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const reader = r.body.getReader(); await reader.read(); reader.releaseLock()\n return [r.body.locked, r.bodyUsed, await r.body.getReader().read().then((x) => [x.done, [...x.value]])]","outcome":{"ok":true,"value":[false,true,[false,[108,111]]]},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}})\n try { r.body.getReader({ mode: \"byob\" }) } catch (e) { return [e.name, e.message, r.body.locked] }","outcome":{"ok":true,"value":["TypeError","Only the default stream reader is supported.",false]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const out = await r.body.cancel(\"enough\")\n return [out === undefined, r.bodyUsed, r.body.locked, await r.text()]","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Body already used"},"log":[["cancel","enough"]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const reader = r.body.getReader(); await reader.read()\n const out = await reader.cancel(\"stop\")\n return [out === undefined, r.body.locked, await reader.read()]","outcome":{"ok":true,"value":[true,true,{"done":true}]},"log":[["pull",0],["pull",1],["cancel","stop"]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); r.body.getReader()\n try { await r.body.cancel() } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","Invalid state: ReadableStream is locked"]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const parts = []\n for await (const chunk of r.body) parts.push([...chunk])\n return [parts, r.bodyUsed, r.body.locked]","outcome":{"ok":true,"value":[[[104,101,108],[108,111]],true,false]},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const parts = []\n for await (const chunk of r.body) { parts.push([...chunk]); break }\n return [parts, r.body.locked, await r.text().catch((e) => e.message)]","outcome":{"ok":true,"value":[[[104,101,108]],false,"Body already used"]},"log":[["pull",0],["pull",1],["cancel",null]]}, + {"code":"const r = await fetch({ chunks: [\"a\", \"b\"], fail: 1 }); const reader = r.body.getReader()\n const first = await reader.read()\n try { await reader.read() } catch (e) { return [[...first.value], e.name, e.message, r.body.locked] }","outcome":{"ok":true,"value":[[97],"Error","boom",true]},"log":[["pull",0],["pull",1]]}, + {"code":"const r = await fetch({ chunks: [\"a\"], fail: 0 })\n try { await r.text() } catch (e) { return [e.name, e.message, r.bodyUsed] }","outcome":{"ok":true,"value":["Error","boom",true]},"log":[["pull",0]]}, + {"code":"const r = await fetch({ chunks: [\"a\"], fail: 0 }); const parts = []\n try { for await (const c of r.body) parts.push([...c]) } catch (e) { return [parts, e.name, e.message] }","outcome":{"ok":true,"value":[[],"Error","boom"]},"log":[["pull",0]]}, + {"code":"const r = await fetch({ status: 204 })\n return [r.body, r.bodyUsed, r.ok, await r.text(), r.bodyUsed, await r.text()]","outcome":{"ok":true,"value":[null,false,true,"",false,""]},"log":[]}, + {"code":"const r = await fetch({ status: 404, statusText: \"Not Found\", chunks: [\"missing\"], redirected: true })\n return [r.ok, r.status, r.statusText, r.redirected, await r.text()]","outcome":{"ok":true,"value":[false,404,"Not Found",true,"missing"]},"log":[["pull",0],["pull",1]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); return r","outcome":{"ok":true,"value":{"url":"","status":201,"statusText":"Created","ok":true,"headers":{"content-type":"text/plain","x-a":"1"},"redirected":false,"body":{}}},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); return JSON.stringify(r)","outcome":{"ok":true,"value":"{\"url\":\"\",\"status\":201,\"statusText\":\"Created\",\"ok\":true,\"headers\":{\"content-type\":\"text/plain\",\"x-a\":\"1\"},\"redirected\":false,\"body\":{}}"},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const reader = r.body.getReader(); return [Object.keys(reader), typeof reader.read]","outcome":{"ok":true,"value":[["read","cancel","releaseLock"],"function"]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); try { r.bodyUsed = true } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","Cannot set property 'bodyUsed' of a data object which has only a getter."]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); try { r.body.locked = true } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","Cannot set property 'locked' of a data object which has only a getter."]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}})\n const before = [\"bodyUsed\" in r, r.hasOwnProperty(\"bodyUsed\"), Object.keys(r).includes(\"bodyUsed\"), \"locked\" in r.body]\n const deleted = [delete r.bodyUsed, \"bodyUsed\" in r, r.bodyUsed, delete r.body.locked, \"locked\" in r.body, r.body.locked]\n r.bodyUsed = 5; r.body.locked = 6\n return [before, deleted, r.bodyUsed, r.body.locked, Object.keys(r).includes(\"bodyUsed\"), Object.keys(r.body)]","outcome":{"ok":true,"value":[[true,true,false,true],[true,false,null,true,false,null],5,6,true,["cancel","getReader","locked"]]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); r.status = 5; delete r.text; return [r.status, typeof r.text, Object.keys(r).length]","outcome":{"ok":true,"value":[5,"undefined",10]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const reader = r.body.getReader()\n return [r.text.length, r.json.length, r.body.cancel.length, r.body.getReader.length, r.body[Symbol.asyncIterator].length,\n r.body[Symbol.asyncIterator].name, reader.read.length, reader.cancel.length, reader.releaseLock.length, reader.read.name]","outcome":{"ok":true,"value":[0,0,1,1,0,"",0,1,0,"read"]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); console.log(r); console.log(r.body); console.log(r.body.getReader()); return [String(r), String(r.body), Object.entries(r.body)]","outcome":{"ok":true,"value":["[object Object]","[object Object]",[["cancel",null],["getReader",null]]],"logs":["{\"url\":\"\",\"status\":201,\"statusText\":\"Created\",\"ok\":true,\"headers\":Headers {\"content-type\":\"text/plain\",\"x-a\":\"1\"},\"redirected\":false,\"body\":{\"cancel\":[opaque reference],\"getReader\":[opaque reference]},\"text\":[opaque reference],\"json\":[opaque reference],\"bytes\":[opaque reference],\"arrayBuffer\":[opaque reference]}","{\"cancel\":[opaque reference],\"getReader\":[opaque reference]}","{\"read\":[opaque reference],\"cancel\":[opaque reference],\"releaseLock\":[opaque reference]}"]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); return [JSON.stringify(r.body), JSON.stringify({ ...r.body }), Object.keys(r.body)]","outcome":{"ok":true,"value":["{}","{}",["cancel","getReader"]]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const reader = r.body.getReader(); await reader.read()\n try { await r.text() } catch (e) { return [e.name, e.message, r.bodyUsed, r.body.locked] }","outcome":{"ok":true,"value":["TypeError","Body already used",true,true]},"log":[["pull",0],["pull",1]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const reader = r.body.getReader(); await reader.read(); reader.releaseLock()\n try { await r.text() } catch (e) { return [e.name, e.message, r.bodyUsed, r.body.locked] }","outcome":{"ok":true,"value":["TypeError","Body already used",true,false]},"log":[["pull",0],["pull",1]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); await r.body.cancel(); const after = [r.bodyUsed, r.body.locked]\n try { await r.bytes() } catch (e) { return [after, e.name, e.message] }","outcome":{"ok":true,"value":[[true,false],"TypeError","Body already used"]},"log":[["cancel",null]]}, + {"code":"const r = await fetch({ status: 204 })\n const out = [[...(await r.bytes())], [...(await r.arrayBuffer())]]\n try { await r.json() } catch (e) { out.push([e.name, e.message]) }\n return out","outcome":{"ok":true,"value":[[],[],["SyntaxError","Unexpected end of JSON input"]]},"log":[]}, + {"code":"const out = []\n for (const body of [\"\",\" \",\"{\",\"[1,\",\"abc\",\"nul\",\"tru\",\"1 2\",\"{\\\"a\\\":1}x\",\"{\\\"a\\\" 1}\",\"{a:1}\",\"[1,]\",\"{\\\"a\\\":1,}\",\"\\\"x\",\"\\\"\\\\q\\\"\",\"\\\"\\\\u12\\\"\",\"01\",\"-\",\"1.\",\"1e\",\".5\",\"+1\",\"[1 2]\",\"{\\\"a\\\":1 \\\"b\\\":2}\",\"'x'\",\"  1\",\"\\\"\\t\\\"\",\"{\\\"__proto__\\\":1,\\\"a\\\":2,\\\"a\\\":3}\",\"1e400\",\"-0\",\"[[[[]]]]\",\"{\\\"\\\":\\\"\\\"}\",\"NaN\",\"Infinity\",\"undefined\",\"true false\",\":\",\",\",\"}\",\"]\",\"[\",\"\\\"a\\\\\\\"\",\"{\\\"a\\\":}\",\"{\\\"a\\\":1,\\\"b\\\"}\",\"{,}\",\"[,1]\",\"1e+\",\"0x10\",\"1_0\",\"\\\"\\\\x41\\\"\",\"\\\"\\\\u00e9\\\"\",\"
 1\",\"[1]]\",\"{}}\",\"nulll\",\"truex\",\" \\n\\t\\r 7 \",\"\\f1\",\"\\\"\\u0000\\\"\",\"{\\\"a\\\":[}\",\"123abc\",\"[-]\",\"[1,,2]\",\"\\\"\\\\\\\"\",\"1.5e3\",\"-1.5E-3\",\"1e-400\",\"9007199254740993\",\"{\\\"a\\\":{\\\"b\\\":[1,{\\\"c\\\":null}]}}\"]) {\n const r = await fetch({ chunks: [body] })\n try { const v = await r.json(); out.push([\"ok\", v, Object.is(v, -0)]) } catch (e) { out.push([e.name, e.message]) }\n }\n return out","outcome":{"ok":true,"value":[["SyntaxError","JSON Parse error: Unexpected EOF"],["SyntaxError","JSON Parse error: Unexpected EOF"],["SyntaxError","JSON Parse error: Expected '}'"],["SyntaxError","JSON Parse error: Unexpected EOF"],["SyntaxError","JSON Parse error: Unexpected identifier \"abc\""],["SyntaxError","JSON Parse error: Unexpected identifier \"nul\""],["SyntaxError","JSON Parse error: Unexpected identifier \"tru\""],["SyntaxError","JSON Parse error: Unable to parse JSON string"],["SyntaxError","JSON Parse error: Unable to parse JSON string"],["SyntaxError","JSON Parse error: Expected ':' before value in object property definition"],["SyntaxError","JSON Parse error: Expected '}'"],["SyntaxError","JSON Parse error: Unexpected comma at the end of array expression"],["SyntaxError","JSON Parse error: Property name must be a string literal"],["SyntaxError","JSON Parse error: Unterminated string"],["SyntaxError","JSON Parse error: Invalid escape character q"],["SyntaxError","JSON Parse error: \\u must be followed by 4 hex digits"],["SyntaxError","JSON Parse error: Unable to parse JSON string"],["SyntaxError","JSON Parse error: Invalid number"],["SyntaxError","JSON Parse error: Invalid digits after decimal point"],["SyntaxError","JSON Parse error: Unable to parse JSON string"],["SyntaxError","JSON Parse error: Unexpected token '.'"],["SyntaxError","JSON Parse error: Unrecognized token '+'"],["SyntaxError","JSON Parse error: Expected ']'"],["SyntaxError","JSON Parse error: Expected '}'"],["SyntaxError","JSON Parse error: Single quotes (') are not allowed in JSON"],["SyntaxError","JSON Parse error: Unrecognized token ' '"],["SyntaxError","JSON Parse error: Unterminated string"],["ok",{"a":3},false],["ok",null,false],["ok",0,true],["ok",[[[[]]]],false],["ok",{"":""},false],["SyntaxError","JSON Parse error: Unexpected identifier \"NaN\""],["SyntaxError","JSON Parse error: Unexpected identifier \"Infinity\""],["SyntaxError","JSON Parse error: Unexpected identifier \"undefined\""],["SyntaxError","JSON Parse error: Unable to parse JSON string"],["SyntaxError","JSON Parse error: Unexpected token ':'"],["SyntaxError","JSON Parse error: Unexpected token ','"],["SyntaxError","JSON Parse error: Unexpected token '}'"],["SyntaxError","JSON Parse error: Unexpected token ']'"],["SyntaxError","JSON Parse error: Unexpected EOF"],["SyntaxError","JSON Parse error: Unterminated string"],["SyntaxError","JSON Parse error: Unexpected token '}'"],["SyntaxError","JSON Parse error: Expected ':' before value in object property definition"],["SyntaxError","JSON Parse error: Expected '}'"],["SyntaxError","JSON Parse error: Unexpected token ','"],["SyntaxError","JSON Parse error: Unable to parse JSON string"],["SyntaxError","JSON Parse error: Unable to parse JSON string"],["SyntaxError","JSON Parse error: Unable to parse JSON string"],["SyntaxError","JSON Parse error: Invalid escape character x"],["ok","é",false],["SyntaxError","JSON Parse error: Unrecognized token '
'"],["SyntaxError","JSON Parse error: Unable to parse JSON string"],["SyntaxError","JSON Parse error: Unable to parse JSON string"],["SyntaxError","JSON Parse error: Unable to parse JSON string"],["SyntaxError","JSON Parse error: Unable to parse JSON string"],["ok",7,false],["SyntaxError","JSON Parse error: Unrecognized token '\f'"],["SyntaxError","JSON Parse error: Unterminated string"],["SyntaxError","JSON Parse error: Unexpected token '}'"],["SyntaxError","JSON Parse error: Unable to parse JSON string"],["SyntaxError","JSON Parse error: Invalid number"],["SyntaxError","JSON Parse error: Unexpected token ','"],["SyntaxError","JSON Parse error: Unterminated string"],["ok",1500,false],["ok",-0.0015,false],["ok",0,false],["ok",9007199254740992,false],["ok",{"a":{"b":[1,{"c":null}]}},false]]},"log":[["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1]]}, + {"code":"const r = await fetch({ chunks: [[0xef, 0xbb, 0xbf, 0x7b, 0x7d]] }); return await r.json().catch((e) => e.message)","outcome":{"ok":true,"value":{}},"log":[["pull",0],["pull",1]]}, + {"code":"const out = []\n for (const chunks of [[\"\\\"\\\\ud800\\\"\"],[\"\\\"\\\\udc00x\\\"\"],[\"\\\"a\\\\ud800\\\\ud800b\\\"\"],[\"\\\"\\\\ud83d\\\\ude00\\\"\"],[\"\\\"\\\\udbff\\\\udfff\\\"\"],[\"\\\"\\\\ud800\\\\udc00\\\\udc00\\\"\"],[\"{\\\"\\\\ud800\\\":\\\"\\\\udc00\\\"}\"],[\"{\\\"k\\\\udfff\\\":\\\"\\\\udbff\\\\udfffz\\\"}\"],[[34,244,143,191,191,34]],[[34,244,143,191,191,244,143,191,191,92,117,100,56,48,48,34]],[[34,237,160,128,34]]]) {\n const v = await (await fetch({ chunks })).json()\n const s = typeof v === \"string\" ? v : Object.keys(v)[0] + \"|\" + Object.values(v)[0]\n const t = await (await fetch({ chunks })).text()\n out.push([s.length, [...s].map((c) => c.codePointAt(0)), JSON.stringify(v), s.isWellFormed(), t.length, [...t].map((c) => c.codePointAt(0))])\n }\n return out","outcome":{"ok":true,"value":[[1,[55296],"\"\\ud800\"",false,8,[34,92,117,100,56,48,48,34]],[2,[56320,120],"\"\\udc00x\"",false,9,[34,92,117,100,99,48,48,120,34]],[4,[97,55296,55296,98],"\"a\\ud800\\ud800b\"",false,16,[34,97,92,117,100,56,48,48,92,117,100,56,48,48,98,34]],[2,[128512],"\"😀\"",true,14,[34,92,117,100,56,51,100,92,117,100,101,48,48,34]],[2,[1114111],"\"􏿿\"",true,14,[34,92,117,100,98,102,102,92,117,100,102,102,102,34]],[3,[65536,56320],"\"𐀀\\udc00\"",false,20,[34,92,117,100,56,48,48,92,117,100,99,48,48,92,117,100,99,48,48,34]],[3,[55296,124,56320],"{\"\\ud800\":\"\\udc00\"}",false,19,[123,34,92,117,100,56,48,48,34,58,34,92,117,100,99,48,48,34,125]],[6,[107,57343,124,1114111,122],"{\"k\\udfff\":\"􏿿z\"}",false,27,[123,34,107,92,117,100,102,102,102,34,58,34,92,117,100,98,102,102,92,117,100,102,102,102,122,34,125]],[2,[1114111],"\"􏿿\"",true,4,[34,1114111,34]],[5,[1114111,1114111,55296],"\"􏿿􏿿\\ud800\"",false,12,[34,1114111,1114111,92,117,100,56,48,48,34]],[3,[65533,65533,65533],"\"���\"",true,5,[34,65533,65533,65533,34]]]},"log":[["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1],["pull",0],["pull",1]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const p = r.text(); await null; await null; const now = [r.body.locked, r.bodyUsed]; await p; return now","outcome":{"ok":true,"value":[true,true]},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const out = []\n for (const chunks of [[[0xef, 0xbb, 0xbf, 0x68, 0x69]], [[0xff, 0x61]], [[0xe2, 0x82], [0xac]], [[0xe2, 0x82]], [[0xef, 0xbb], [0xbf, 0x7b, 0x7d]],\n [[0xed, 0xa0, 0x80]], [[0xf0, 0x9f, 0x98, 0x80]], [[0xc0, 0x80]]]) {\n const t = await (await fetch({ chunks })).text()\n const j = await (await fetch({ chunks: [...chunks, [0x22]].map((c, i) => i === 0 ? [0x22, ...c] : c) })).json().catch((e) => e.message)\n out.push([[...t].map((c) => c.codePointAt(0)), typeof j === \"string\" ? [...j].map((c) => c.codePointAt(0)) : j])\n }\n return out","outcome":{"ok":true,"value":[[[104,105],[65279,104,105]],[[65533,97],[65533,97]],[[8364],[8364]],[[65533],[65533]],[[123,125],[65279,123,125]],[[65533,65533,65533],[65533,65533,65533]],[[128512],[128512]],[[65533,65533],[65533,65533]]]},"log":[["pull",0],["pull",1],["pull",0],["pull",1],["pull",2],["pull",0],["pull",1],["pull",0],["pull",1],["pull",2],["pull",0],["pull",1],["pull",2],["pull",0],["pull",1],["pull",2],["pull",3],["pull",0],["pull",1],["pull",0],["pull",1],["pull",2],["pull",0],["pull",1],["pull",2],["pull",0],["pull",1],["pull",2],["pull",3],["pull",0],["pull",1],["pull",0],["pull",1],["pull",2],["pull",0],["pull",1],["pull",0],["pull",1],["pull",2],["pull",0],["pull",1],["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const p = r.text(); const now = [r.body.locked, r.bodyUsed]; await p; return now","outcome":{"ok":true,"value":[true,true]},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const reader = r.body.getReader(); const p = reader.read(); const now = r.bodyUsed; await p; return now","outcome":{"ok":true,"value":true},"log":[["pull",0],["pull",1]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}})\n const all = await Promise.allSettled([r.text(), r.text(), r.json()])\n return all.map((x) => x.status === \"fulfilled\" ? x.value : [x.reason.name, x.reason.message])","outcome":{"ok":true,"value":["hello",["TypeError","Body already used"],["TypeError","Body already used"]]},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const reader = r.body.getReader()\n const all = await Promise.all([reader.read(), reader.read(), reader.read(), reader.read()])\n return all.map((x) => [Object.keys(x), x.done, x.value === undefined ? null : [...x.value]])","outcome":{"ok":true,"value":[[["value","done"],false,[104,101,108]],[["value","done"],false,[108,111]],[["value","done"],true,null],[["value","done"],true,null]]},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); r.body.getReader()\n try { r.body[Symbol.asyncIterator]() } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","Invalid state: ReadableStream is locked"]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const it = r.body[Symbol.asyncIterator]()\n const locked = r.body.locked\n try { r.body[Symbol.asyncIterator]() } catch (e) { return [locked, e.name, e.message] }","outcome":{"ok":true,"value":[true,"TypeError","Invalid state: ReadableStream is locked"]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const it = r.body[Symbol.asyncIterator]()\n const steps = []\n for (let i = 0; i < 4; i++) { const x = await it.next(); steps.push([Object.keys(x), x.done, x.value === undefined ? null : [...x.value], r.body.locked]) }\n const ret = await it.return()\n return [steps, Object.keys(ret), ret, r.bodyUsed]","outcome":{"ok":true,"value":[[[["value","done"],false,[104,101,108],true],[["value","done"],false,[108,111],true],[["value","done"],true,null,false],[["value","done"],true,null,false]],["value","done"],{"done":true},true]},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const it = r.body[Symbol.asyncIterator]()\n const ret = await it.return(); const again = await it.next()\n return [Object.keys(ret), ret.done, again.done, r.body.locked, r.bodyUsed, await r.text().catch((e) => e.message)]","outcome":{"ok":true,"value":[["value","done"],true,true,false,true,"Body already used"]},"log":[["cancel",null]]}, + {"code":"const r = await fetch({ chunks: [\"a\"], fail: 0 }); const it = r.body[Symbol.asyncIterator]()\n const first = await it.next().catch((e) => [e.name, e.message])\n return [first, r.body.locked, await it.next().then((x) => x.done, (e) => e.message)]","outcome":{"ok":true,"value":[["Error","boom"],false,true]},"log":[["pull",0]]}, + {"code":"const r = await fetch({ chunks: [\"a\", \"b\"], fail: 1 }); const reader = r.body.getReader(); await reader.read()\n const failed = await reader.read().catch((e) => e.message)\n const again = await reader.read().catch((e) => e.message)\n const cancelled = await reader.cancel(\"x\").catch((e) => e.message)\n reader.releaseLock()\n return [failed, again, cancelled, r.body.locked, await r.body.cancel().catch((e) => e.message), await r.text().catch((e) => e.message)]","outcome":{"ok":true,"value":["boom","boom","boom",false,"boom","Body already used"]},"log":[["pull",0],["pull",1]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const reader = r.body.getReader(); await reader.cancel()\n const cancelled = await reader.cancel(\"again\"); reader.releaseLock()\n return [cancelled === undefined, await r.body.cancel(\"third\"), await r.body.getReader().read()]","outcome":{"ok":true,"value":[true,null,{"done":true}]},"log":[["cancel",null]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); try { await r.body.cancel(() => 1) } catch (e) { return [e.name, e.message, r.bodyUsed] }","outcome":{"ok":true,"value":null},"log":[["cancel",null]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const reader = r.body.getReader()\n try { await reader.cancel(Symbol.iterator) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","Argument 1 to fetch.body.getReader.cancel contains a symbol, which cannot be passed to the host."]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}})\n const out = []\n for (const o of [undefined, null, {}, { mode: undefined }, 5, \"byob\", { mode: \"default\" }]) {\n try { const reader = r.body.getReader(o); reader.releaseLock(); out.push(\"ok\") } catch (e) { out.push(e.message) }\n }\n return out","outcome":{"ok":true,"value":["ok","ok","ok","ok","ok","ok","Only the default stream reader is supported."]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const reader = r.body.getReader(); reader.releaseLock(); return [await reader.read().catch((e) => e.name), reader.closed]","outcome":{"ok":true,"value":["TypeError",null]},"log":[["pull",0]]}, + {"code":"const r = await fetch({ chunks: [\"a\"], delay: 5 }); const reader = r.body.getReader(); const p = reader.read()\n await null; await null; reader.releaseLock()\n return [await p.then((x) => x.done, (e) => [e.name, e.message]), r.body.locked, r.bodyUsed]","outcome":{"ok":true,"value":[["TypeError","Invalid state: Releasing reader"],false,true]},"log":[["pull",0]]}, + {"code":"const r = await fetch({ chunks: [\"a\"], delay: 5 }); const reader = r.body.getReader(); const p = reader.read()\n await null; await null; const c = await reader.cancel(\"c\")\n return [c === undefined, await p.then((x) => [Object.keys(x), x.done, x.value === undefined], (e) => [e.name, e.message])]","outcome":{"ok":true,"value":[true,[["value","done"],true,true]]},"log":[["cancel","c"]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const out = []\n for (const v of [r, r.body, r.headers, { ...r, text: 1, json: 1, bytes: 1, arrayBuffer: 1, body: 1 }]) {\n try { out.push(echo(v)) } catch (e) { out.push([e.name, e.message]) }\n }\n return out","outcome":{"ok":true,"value":[{"url":"","status":201,"statusText":"Created","ok":true,"headers":{"content-type":"text/plain","x-a":"1"},"redirected":false,"body":{}},{},{"content-type":"text/plain","x-a":"1"},{"url":"","status":201,"statusText":"Created","ok":true,"headers":{"content-type":"text/plain","x-a":"1"},"redirected":false,"body":1,"text":1,"json":1,"bytes":1,"arrayBuffer":1}]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); return [typeof r.clone, typeof r.formData, typeof r.blob, r.type, typeof r.body.tee, typeof r.body.pipeTo, r.body.values]","outcome":{"ok":true,"value":["undefined","undefined","undefined",null,"undefined","undefined",null]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const copy = { ...r }; return [Object.keys(copy), copy.bodyUsed]","outcome":{"ok":true,"value":[["url","status","statusText","ok","headers","redirected","body","text","json","bytes","arrayBuffer"],null]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const reader = r.body.getReader(); reader.releaseLock(); reader.releaseLock(); return [await reader.cancel().catch((e) => e.message), r.body.locked]","outcome":{"ok":true,"value":["Invalid state: The reader is not attached to a stream",false]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const it = r.body[Symbol.asyncIterator](); const a = await it.next(); const b = await it.return(); return [[...a.value], a.done, b, r.body.locked]","outcome":{"ok":true,"value":[[104,101,108],false,{"done":true},false]},"log":[["pull",0],["pull",1],["cancel",null]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); ; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (let i = 0; i < 30000; i++) { if (seen()) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); ; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (let i = 0; i < 30000; i++) if (flip < 0 && r.body.locked) flip = i\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let i = 0; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n while (i < 30000) { if (flip < 0 && r.body.locked) flip = i; i++ }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let i = 0; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n do { if (flip < 0 && r.body.locked) flip = i; i++; if (i % 2) continue } while (i < 30000)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); ; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (let i = 0; ; i++) { if (i % 3 === 0) continue; if (flip < 0 && r.body.locked) { flip = i; break } }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); ; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n outer: for (let i = 0; i < 300; i++) for (let j = 0; j < 100; j++) { if (j === 50) continue outer; if (flip < 0 && r.body.locked) flip = i * 1000 + j }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const f = (x) => x; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (let i = 0; i < 30000; i++) { f(i); if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); function f(x) { return x }; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (let i = 0; i < 30000; i++) { f?.(f(i)); if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const o = { m(x) { return x } }; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (let i = 0; i < 30000; i++) { o.m(i); if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const f = (...x) => x; const g = f.bind(null, 1); const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (let i = 0; i < 30000; i++) { f(...[i]); g(i); if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); ; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (let i = 0; i < 30000; i++) { Math.abs(i); if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const a = []; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (let i = 0; i < 30000; i++) { a.push(String(i)); JSON.stringify(i); if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); ; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (let i = 0; i < 30000; i++) { new Map(); [i].length; if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); ; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (let i = 0; i < 30000; i++) { echo(i); if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); ; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (let i = 0; i < 30000; i++) { try { if (i % 7 === 0) throw new Error('x') } catch {} finally { if (flip < 0 && r.body.locked) flip = i } }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const tag = (s, v) => v; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (let i = 0; i < 30000; i++) { tag`a${i}b`; if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const a = []; for (let i = 0; i < 30000; i++) a[i] = i; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (const i of a) { if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const o = {}; for (let i = 0; i < 20000; i++) o['k' + i] = i; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (const k in o) { if (flip < 0 && r.body.locked) flip = o[k] }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); function* gen() { for (let i = 0; i < 30000; i++) yield i }; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (const i of gen()) { if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); function* gen() { for (let i = 0; i < 30000; i++) yield i }; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n const it = gen(); for (let x = it.next(); !x.done; x = it.next()) { if (flip < 0 && r.body.locked) flip = x.value }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); function* gen() { for (let i = 0; i < 30000; i++) yield i }; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n const all = [...gen()]; for (const i of all) { if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); function* gen() { for (let i = 0; i < 3; i++) yield i }; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (let i = 0; i < 30000; i++) { const [a, b] = gen(); if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const a = []; for (let i = 0; i < 30000; i++) a[i] = i; function* gen() { yield* a }; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (const i of gen()) { if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); function* inner() { for (let i = 0; i < 30000; i++) yield i } function* gen() { yield* inner() }; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (const i of gen()) { if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const it = { [Symbol.iterator]() { let i = 0; return { next: () => ({ done: i >= 30000, value: i++ }) } } }; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (const i of it) { if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const m = new Map(); for (let i = 0; i < 30000; i++) m.set(i, i); const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (const [k] of m) { if (flip < 0 && r.body.locked) flip = k }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const a = []; for (let i = 0; i < 30000; i++) a[i] = i; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (const i of a.values()) { if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); ; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (const c of 'x'.repeat(30000)) { if (flip < 0 && r.body.locked) flip = 1 }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const a = []; for (let i = 0; i < 30000; i++) a[i] = i; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for await (const i of a) { if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); async function* gen() { for (let i = 0; i < 30000; i++) yield i }; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for await (const i of gen()) { if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const it = { [Symbol.iterator]() { let i = 0; return { next: () => ({ done: i >= 30000, value: i++ }) } } }; function* gen() { yield* it }; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (const i of gen()) { if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); function* gen() { yield 1; yield 2 }; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (let i = 0; i < 30000; i++) { for (const x of gen()) break; if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const h = async (x) => x; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (let i = 0; i < 30000; i++) { await h(i); if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); for (let i = 0; i < 25000; i++) {}; const p = r.text(); let flip = -1; const seen = () => flip < 0 && r.body.locked\n for (let i = 0; i < 30000; i++) { if (flip < 0 && r.body.locked) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); ; const p = r.body.cancel(); let flip = -1; const seen = () => flip < 0 && r.bodyUsed\n for (let i = 0; i < 30000; i++) { if (flip < 0 && r.bodyUsed) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["cancel",null]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const reader = r.body.getReader(); const p = reader.read(); let flip = -1; const seen = () => flip < 0 && r.bodyUsed\n for (let i = 0; i < 30000; i++) { if (flip < 0 && r.bodyUsed) flip = i }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["pull",0],["pull",1]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); ; const p = Promise.resolve(); let flip = -1; const seen = () => flip < 0 && r.bodyUsed\n for (let j = 0; j < 3; j++) { const q = r.body.cancel(); for (let i = 0; i < 9000; i++) { if (flip < 0 && r.bodyUsed) flip = j * 100000 + i } await q.catch(() => 0) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":0},"log":[["cancel",null]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); \n const p = r.text(); a.forEach(see)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); \n const p = r.text(); a.flatMap((x) => x % 2 ? [see(x), , x] : see(x))\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const b = [1, , 3]\n const p = r.text(); for (let j = 0; j < 3000; j++) { b.map(see); b.some(see); b.reduce(see) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); \n const p = r.text(); Array.prototype.forEach.call(a, see)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const b = a.slice(0, 2000)\n b.toLocaleString(); [[], [1]].forEach((c) => c.reduce(see)); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Array.reduce of an empty array with no initial value. (line 4, col 49)"},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const pairs = d.slice(0, 1000).map((x) => [x, x])\n new Map(pairs); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const m = new Map(d.slice(0, 9000).map((x) => [x, x]))\n const p = r.text(); m.forEach(see)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); \n const p = r.text(); Object.groupBy(a, (x) => see(x) % 3)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const m = new Map()\n const p = r.text(); for (let i = 0; i < 30000; i++) { m.getOrInsertComputed(i % 100, see); m.getOrInsert(i, 1) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const s1 = new Set(Array.from({ length: 1000 }, (_, i) => i + 0)); const s2 = new Set(Array.from({ length: 1000 }, (_, i) => i + 500)); const s3 = new Set(Array.from({ length: 300 }, (_, i) => i + 0))\n s1.union(s2); s3.union(s1); s1.union(s3); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const like = { size: 3, has: (x) => see(x) % 7 === 0, keys: () => [1, 2, 3].values() }; const s1 = new Set(Array.from({ length: 2 }, (_, i) => i + 0))\n const p = r.text(); for (let j = 0; j < 3000; j++) { s1.union(like); see(j) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const u = new Uint8Array(d.slice(0, 20000))\n const p = r.text(); u.forEach(see); u.map(see); u.filter(see)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const b = d.slice(0, 3000); const u = new Uint8Array(3000)\n new Uint8Array(b); Uint8Array.from(b); u.set(b); u.set(new Uint8Array(b)); new Uint8Array(u); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const b = d.slice(0, 3000).reverse()\n const p = r.text(); b.slice().sort((x, y) => see(x) - y); b.toSorted((x, y) => see(y) - x)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const b = d.slice(0, 20000).reverse(); const c = d.slice(0, 4096)\n b.slice().sort(); c.slice().sort(); b.toSorted(); [3, 1, 2].sort((x, y) => x - y); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const s = 'ab'.repeat(5000)\n const p = r.text(); s.replace(/b/g, see); s.replaceAll('a', see); s.replace('b', see); 'é'.repeat(2000).replaceAll('é', see); s.replace(/z/g, see)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const j = JSON.stringify({ x: d.slice(0, 3000), y: { z: d.slice(0, 2000) } })\n const p = r.text(); JSON.parse(j, (key, v) => see(v))\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const pairs = d.slice(0, 2000).map((x) => [x, x])\n Object.fromEntries(pairs); Object.fromEntries(new Map(pairs)); Math.sumPrecise(d); AggregateError(d.slice(0, 1000)); new AggregateError(d); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const pairs = d.slice(0, 1000).map((x) => ['k' + x, String(x)])\n new Headers(pairs); new URLSearchParams(pairs); new Headers({ a: 'b' }); new URLSearchParams(new URLSearchParams('a=b')); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const h = new Headers(d.slice(0, 2000).map((x) => ['k' + x, String(x)])); const q = new URLSearchParams(d.slice(0, 2000).map((x) => ['k', String(x)]))\n const p = r.text(); h.forEach(see); q.forEach(see)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const s = []; s[10000005] = 7; s[3] = 1; s[20] = 2\n const p = r.text(); s.forEach(see); s.reduceRight((t, x) => see(t), 0); [s].flatMap((x) => see(x))\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const s = []; s[10000005] = 7; s[3] = 1; s[20] = 2\n s.forEach((x) => x); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); \n const p = r.text(); d.values().map(see).toArray()\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); \n const p = r.text(); d.values().flatMap((x) => [see(x), x]).toArray()\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); \n const p = r.text(); d.values().reduce((s, x) => see(s)); d.values().some((x) => see(x) > 15000); d.values().every((x) => see(x) < 15000); d.values().find((x) => see(x) > 20000)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); function* g(n) { for (let i = 0; i < n; i++) yield i }\n const p = r.text(); for (let j = 0; j < 3000; j++) { const h = g(5).map(see); h.next(); h.return(); see(j) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); function* g(n) { for (let i = 0; i < n; i++) yield i }\n const p = r.text(); for (let j = 0; j < 3000; j++) { Iterator.from(g(2)).toArray(); Iterator.from([1, 2]).toArray(); Iterator.from('ab').toArray(); see(j) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); let n = 0; const custom = { next: () => ({ done: n++ % 4 === 3, value: n }) }\n const p = r.text(); for (let j = 0; j < 3000; j++) { Iterator.from(custom).toArray(); Iterator.prototype.toArray.call(custom); see(j) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const w = (x) => ({ [Symbol.iterator]: () => x[Symbol.iterator]() }); const A = w([1, 2, 3]), M = w(new Map([[1, 2]])), S = w('ab'), T = w(new Set([3, 4]))\n const H = w(new Headers([['a', 'b']])); const L = (function () { return w(arguments) })(5, 6)\n const p = r.text(); for (let j = 0; j < 1000; j++) { for (const x of A) {} const [y, z] = M; [...S]; for (const x of T) break; const [h] = H; [...L]; see(j) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const w = (x) => ({ [Symbol.iterator]: () => x[Symbol.iterator]() }); const A = w([1, 2, 3]), M = w(new Map([[1, 2]])), S = w('ab'), T = w(new Set([3, 4]))\n const H = w(new Headers([['a', 'b']])); const L = (function () { return w(arguments) })(5, 6)\n const p = r.text(); for (let j = 0; j < 1000; j++) { Array.from(A); new Map(M); Object.fromEntries(M); new Set(S); Promise.all(T); new Headers(H); see(j) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); function* g(n) { for (let i = 0; i < n; i++) yield i }\n const p = r.text(); const b = d.slice(0, 7); for (let j = 0; j < 3000; j++) { Promise.all(b); Promise.race([1]); Promise.any(g(3)); Promise.allSettled([]); see(j) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); function* g(n) { for (let i = 0; i < n; i++) yield i }; const it = { [Symbol.iterator]() { return this }, n: 0, next() { return { done: this.n++ % 3 === 2, value: 1 } } }\n const bound = { [Symbol.iterator]() { return this }, next: Object.fromEntries.bind(null, [['done', true]]) }\n const wrapped = { [Symbol.iterator]: () => [1, 2][Symbol.iterator]() }; const h = new Headers([['a', 'b']])\n async function* ag() { yield 1; yield* g(2) }\n for (let j = 0; j < 37; j++) { for await (const x of [1, 2]) {} for await (const x of 'ab') {} for await (const x of new Map([[1, 2]])) {} }; const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); function* g(n) { for (let i = 0; i < n; i++) yield i }; const it = { [Symbol.iterator]() { return this }, n: 0, next() { return { done: this.n++ % 3 === 2, value: 1 } } }\n const bound = { [Symbol.iterator]() { return this }, next: Object.fromEntries.bind(null, [['done', true]]) }\n const wrapped = { [Symbol.iterator]: () => [1, 2][Symbol.iterator]() }; const h = new Headers([['a', 'b']])\n async function* ag() { yield 1; yield* g(2) }\n for (let j = 0; j < 37; j++) { for await (const x of ag()) {} }; const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); function* g(n) { for (let i = 0; i < n; i++) yield i }; const it = { [Symbol.iterator]() { return this }, n: 0, next() { return { done: this.n++ % 3 === 2, value: 1 } } }\n const bound = { [Symbol.iterator]() { return this }, next: Object.fromEntries.bind(null, [['done', true]]) }\n const wrapped = { [Symbol.iterator]: () => [1, 2][Symbol.iterator]() }; const h = new Headers([['a', 'b']])\n async function* ag() { yield 1; yield* g(2) }; async function* a2() { yield* g(2) }\n for (let j = 0; j < 37; j++) { for await (const x of a2()) {} }; const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); function* g(n) { for (let i = 0; i < n; i++) yield i }; const it = { [Symbol.iterator]() { return this }, n: 0, next() { return { done: this.n++ % 3 === 2, value: 1 } } }\n const bound = { [Symbol.iterator]() { return this }, next: Object.fromEntries.bind(null, [['done', true]]) }\n const wrapped = { [Symbol.iterator]: () => [1, 2][Symbol.iterator]() }; const h = new Headers([['a', 'b']])\n async function* ag() { yield 1; yield* g(2) }; const ai = { [Symbol.asyncIterator]() { let c = 0; return { next: async () => ({ done: c++ >= 2, value: 1 }) } } }; async function* a7() { yield* ai }\n for (let j = 0; j < 37; j++) { for await (const x of a7()) {} }; const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const o = { valueOf: () => 1 }, s = { toString: () => 'b' }, n = {}, t = { toString: () => '[1]' }, dt = new Date(0)\n const v = { valueOf: () => see(1) }\n const p = r.text(); for (let j = 0; j < 1000; j++) { 'abc'.slice(o, 2); 'abc'.padStart(o, s); see(j) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const o = { valueOf: () => 1 }, s = { toString: () => 'b' }, n = {}, t = { toString: () => '[1]' }, dt = new Date(0)\n const v = { valueOf: () => see(1) }\n const p = r.text(); for (let j = 0; j < 1000; j++) { 'abc'.slice(v); Math.min(v, v); new Error(v); [1, 2].at(v); see(j) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const o = { valueOf: () => 1 }, s = { toString: () => 'b' }, n = {}, t = { toString: () => '[1]' }, dt = new Date(0)\n const v = { valueOf: () => see(1) }\n const p = r.text(); for (let j = 0; j < 1000; j++) { [s, 'a', o].sort(); [n, 2, 1].toSorted(); [3, 1].sort(); see(j) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const o = { valueOf: () => 1 }, s = { toString: () => 'b' }, n = {}, t = { toString: () => '[1]' }, dt = new Date(0)\n const v = { valueOf: () => see(1) }\n const big = Array.from({ length: 5000 }, (_, i) => i % 2 ? { toString: () => 'x' + i } : 'y' + i); big.sort(); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const o = { valueOf: () => 1 }, s = { toString: () => 'b' }, n = {}, t = { toString: () => '[1]' }, dt = new Date(0)\n const v = { valueOf: () => see(1) }; const pr = Promise.resolve(1)\n for (let j = 0; j < 300; j++) { String(tools); [1, 2].join(tools.git); Math.max(o, tools); [1, 2].slice(o, tools.echo); String(pr); Math.max(pr, v); [pr].join(); `${pr}`; ({ [pr]: 1 }) }; const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":301},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const o = { valueOf: () => 1 }, s = { toString: () => 'b' }, n = {}, t = { toString: () => '[1]' }, dt = new Date(0)\n const v = { valueOf: () => see(1) }; const pr = Promise.resolve(1)\n for (let j = 0; j < 300; j++) { try { 'abc'.at(v, pr) } catch {} try { 'abc'.indexOf(pr) } catch {} try { 'abc'.padStart(v, tools) } catch {} try { Object.keys(pr) } catch {} try { ({ ...tools }) } catch {} }; const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":601},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const doc = { a: d.slice(0, 50), b: { c: 1, d: [1, { e: 2 }], f: undefined, g: () => 1 }, h: 'x', i: null, j: new Date(0), k: new Map() }\n const p = r.text(); for (let j = 0; j < 300; j++) { JSON.stringify(doc, (key, v) => see(v)); see(j) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const doc = { a: d.slice(0, 50), b: { c: 1, d: [1, { e: 2 }], f: undefined, g: () => 1 }, h: 'x', i: null, j: new Date(0), k: new Map() }\n const p = r.text(); for (let j = 0; j < 3000; j++) { JSON.stringify(doc, ['a', 'b', 'c']); JSON.stringify(doc); see(j) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const doc = { a: d.slice(0, 50), b: { c: 1, d: [1, { e: 2 }], f: undefined, g: () => 1 }, h: 'x', i: null, j: new Date(0), k: new Map() }; const t = { x: [1, 2, { toJSON: () => 7 }], y: doc }\n JSON.stringify(t); JSON.stringify([doc, { toJSON() { return 1 } }]); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); let deep = 1; for (let i = 0; i < 101; i++) deep = { deep }\n for (let j = 0; j < 37; j++) try { JSON.stringify(deep, (k, v) => v) } catch {}; const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const x = { a: 1 }; const many = Array(2049).fill(x); const fewer = Array(2048).fill(x)\n JSON.stringify(many); JSON.stringify(fewer); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const x = [1, { b: 2 }]; const nest = Array(1100).fill({ p: x, q: x })\n JSON.stringify(nest); JSON.stringify(nest.slice(0, 600)); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const o = { valueOf: () => see(1), toString: () => 'k' }; const x = {}; let m = { valueOf() { return 2 } }\n const p = r.text(); for (let i = 0; i < 3000; i++) { o * 2; 2 < o; o >= 1; -o; o + 1; 'x' + o; o == 1; 1 != o; o | 0; `${o}`; x[o] = 1; m++; see(i) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const ks = []; const s = JSON.stringify({ h: new Headers({ a: 'b' }), e: new TypeError('x'), u: new Uint8Array([1]) }, (k, v) => { ks.push(k); return v }, 1)\n return [s, ks, JSON.stringify({ h: new Headers({ a: 'b' }) }, ['h', 'z'])]","outcome":{"ok":true,"value":["{\n \"h\": {\n \"a\": \"b\"\n },\n \"e\": {\n \"name\": \"TypeError\",\n \"message\": \"x\"\n },\n \"u\": {\n \"0\": 1\n }\n}",["","h","e","name","message","u","0"],"{\"h\":{}}"]},"log":[]}, + {"code":"return await send({ a: Promise.resolve(5), b: { toJSON: () => 7 }, c: [Promise.resolve(1), { d: Promise.resolve('x') }] })","outcome":{"ok":true,"value":{"a":5,"b":{},"c":[1,{"d":"x"}]}},"log":[["send",[{"object":[["a",5],["b",{"object":[]}],["c",{"array":[1,{"object":[["d","x"]]}]}]]}]]]}, + {"code":"return [await send(Promise.resolve({ x: 1 })), await send(), await send(undefined), await send(null)]","outcome":{"ok":true,"value":[{"x":1},null,null,null]},"log":[["send",[{"object":[["x",1]]}]],["send",[]],["send",[{"undefined":true}]],["send",[null]]]}, + {"code":"return await send({ s: new Set([Promise.resolve(2), 3]), q: new URLSearchParams('a=1'), h: new Headers({ k: 'v' }), d: new Date(0), m: new Map([[1, 2]]), e: new TypeError('x'), p: Promise.resolve(0), f: () => 1, u: undefined, n: NaN })","outcome":{"ok":true,"value":{"s":[2,3],"q":"a=1","h":{"k":"v"},"d":"1970-01-01T00:00:00.000Z","m":{},"e":{"name":"TypeError","message":"x"},"p":0,"n":null}},"log":[["send",[{"object":[["s",{"set":[2,3]}],["q",{"params":[["a","1"]]}],["h",{"headers":[["k","v"]]}],["d",{"date":0}],["m",{"map":[[1,2]]}],["e",{"error":{"name":"TypeError","message":"x","fields":[]}}],["p",0],["u",{"undefined":true}],["n",{"number":"NaN"}]]}]]]}, + {"code":"const o = { p: Promise.resolve(1) }; const shared = { v: 1 }; return await send({ o, x: [shared, shared, o] })","outcome":{"ok":true,"value":{"o":{"p":1},"x":[{"v":1},{"v":1},{"p":1}]}},"log":[["send",[{"object":[["o",{"object":[["p",1]]}],["x",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["p",1]]}]}]]}]]]}, + {"code":"const big = Array(3000).fill({ k: 1 }); return (await send({ big })).big.length","outcome":{"ok":true,"value":3000},"log":[["send",[{"object":[["big",{"array":[{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]},{"object":[["k",1]]}]}]]}]]]}, + {"code":"const e = new Error('m'); e.extra = Promise.resolve(2); e.name = 'Custom'; return await send({ e })","outcome":{"ok":true,"value":{"e":{"name":"Custom","message":"m","extra":2}}},"log":[["send",[{"object":[["e",{"error":{"name":"Custom","message":"m","fields":[["extra",2],["name","Custom"]]}}]]}]]]}, + {"code":"return await send({ ['__proto__']: Promise.resolve(1), a: Promise.resolve(3) })","outcome":{"ok":true,"value":{"a":3}},"log":[["send",[{"object":[["a",3]]}]]]}, + {"code":"const p = send({ a: Promise.reject(new Error('no')) }); return await p.catch((e) => [e.name, e.message])","outcome":{"ok":true,"value":["Error","no"]},"log":[]}, + {"code":"return await send({ p: Promise.resolve(1), t: { toJSON() { throw new TypeError('tj') } } }).catch((e) => [e.name, e.message])","outcome":{"ok":true,"value":{"p":1,"t":{}}},"log":[["send",[{"object":[["p",1],["t",{"object":[]}]]}]]]}, + {"code":"return await send({ p: Promise.resolve(1), b: new Uint8Array(1) }).catch((e) => [e.name, e.message])","outcome":{"ok":false,"kind":"InvalidDataValue","message":"TypeError: A Uint8Array cannot cross to the host; pass text instead, e.g. `new TextDecoder().decode(bytes)` or `bytes.toBase64()`."},"log":[["send",[{"object":[["p",1],["b",{"bytes":[0]}]]}]]]}, + {"code":"const a = { p: Promise.resolve(1) }; const b = { a }; return await send({ x: [b, b] })","outcome":{"ok":true,"value":{"x":[{"a":{"p":1}},{"a":{"p":1}}]}},"log":[["send",[{"object":[["x",{"array":[{"object":[["a",{"object":[["p",1]]}]]},{"object":[["a",{"object":[["p",1]]}]]}]}]]}]]]}, + {"code":"let o = 1; for (let i = 0; i < 40; i++) o = { o }; return await send({ p: Promise.resolve(1), o }).then((r) => { let n = 0; while (r.o) { r = r.o; n++ } return n }, (e) => [e.name, e.message])","outcome":{"ok":true,"value":["TypeError","Argument 1 to send exceeds the maximum value depth of 32."]},"log":[]}, + {"code":"let o = 1; for (let i = 0; i < 120; i++) o = { o }; return await send({ p: Promise.resolve(1), o }).catch((e) => [e.name, e.message])","outcome":{"ok":true,"value":["TypeError","Argument 1 to send exceeds the maximum value depth of 32."]},"log":[]}, + {"code":"let o = Promise.resolve(1); for (let i = 0; i < 40; i++) o = { o }; return await send(o).catch((e) => [e.name, e.message])","outcome":{"ok":true,"value":["TypeError","Argument 1 to send exceeds the maximum value depth of 32."]},"log":[]}, + {"code":"return await send(1, Promise.resolve(2)).catch((e) => [e.name, e.message])","outcome":{"ok":true,"value":1},"log":[["send",[1,2]]]}, + {"code":"const log = []; const p = send({ a: { toJSON(k) { log.push('toJSON ' + k); return 1 } }, p: Promise.resolve(2) }); log.push('after'); return [log, await p]","outcome":{"ok":true,"value":[["after"],{"a":{},"p":2}]},"log":[["send",[{"object":[["a",{"object":[]}],["p",2]]}]]]}, + {"code":"const log = []; const p = send({ p: Promise.resolve(1), t: { toJSON() { log.push('late'); return 2 } } }); log.push('after'); await p; return log","outcome":{"ok":true,"value":["after"]},"log":[["send",[{"object":[["p",1],["t",{"object":[]}]]}]]]}, + {"code":"const log = []; const a = send({ n: 'walked', p: Promise.resolve(1) }); const b = send({ n: 'plain' }); Promise.resolve().then(() => send({ n: 'job' })); log.push(typeof a.then)\n await Promise.all([a, b]); return log","outcome":{"ok":true,"value":["function"]},"log":[["send",[{"object":[["n","walked"],["p",1]]}]],["send",[{"object":[["n","plain"]]}]],["send",[{"object":[["n","job"]]}]]]}, + {"code":"const a = send({ n: 'later', p: new Promise((done) => setTimeout(() => done(1), 0)) }); const b = send({ n: 'then' }); return [await a, await b]","outcome":{"ok":false,"kind":"ExecutionFailure","message":"ReferenceError: Unknown identifier 'setTimeout'. (line 1, col 55)"},"log":[["send",[{"object":[["n","then"]]}]]]}, + {"code":"const p = Promise.resolve(1); const calls = [1, 2, 3].map((n) => send({ n, p })); return await Promise.all(calls)","outcome":{"ok":true,"value":[{"n":1,"p":1},{"n":2,"p":1},{"n":3,"p":1}]},"log":[["send",[{"object":[["n",1],["p",1]]}]],["send",[{"object":[["n",2],["p",1]]}]],["send",[{"object":[["n",3],["p",1]]}]]]}, + {"code":"return await send({ query: Promise.resolve('echo') }).then((r) => r.query)","outcome":{"ok":true,"value":"echo"},"log":[["send",[{"object":[["query","echo"]]}]]]}, + {"code":"return { a: Promise.resolve(5), b: [Promise.resolve(2), { c: Promise.resolve(3) }], d: { toJSON: () => 'D' } }","outcome":{"ok":true,"value":{"a":5,"b":[2,{"c":3}],"d":"D"}},"log":[]}, + {"code":"return Promise.resolve({ x: Promise.resolve(1) })","outcome":{"ok":true,"value":{"x":1}},"log":[]}, + {"code":"return { then(done) { done({ y: Promise.resolve(2) }) } }","outcome":{"ok":true,"value":{"y":2}},"log":[]}, + {"code":"return { a: Promise.reject(new TypeError('rejected')) }","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: rejected"},"log":[]}, + {"code":"return { a: Promise.resolve(1), t: { toJSON() { throw new RangeError('tj') } } }","outcome":{"ok":false,"kind":"ExecutionFailure","message":"RangeError: tj"},"log":[]}, + {"code":"let o = Promise.resolve(1); for (let i = 0; i < 40; i++) o = { o }; return o","outcome":{"ok":false,"kind":"ExecutionFailure","message":"RangeError: Value exceeds the maximum depth of 32."},"log":[]}, + {"code":"let o = 1; for (let i = 0; i < 120; i++) o = { o }; return { p: Promise.resolve(1), o }","outcome":{"ok":false,"kind":"ExecutionFailure","message":"RangeError: Value exceeds the maximum depth of 100."},"log":[]}, + {"code":"const log = []; Promise.resolve().then(() => log.push('job')); return { log, p: Promise.resolve(1).then(() => log.push('then')) }","outcome":{"ok":true,"value":{"log":[],"p":2}},"log":[]}, + {"code":"return hold({ query: Promise.resolve('echo') }).items.length","outcome":{"ok":true,"value":1},"log":[]}, + {"code":"function f() { return hold({ query: Promise.resolve('echo') }).items.length } return f()","outcome":{"ok":true,"value":1},"log":[]}, + {"code":"const log = []; Promise.resolve().then(() => log.push('job')); const r = hold({ query: Promise.resolve('echo') }); log.push('after'); return [log, r.items.length]","outcome":{"ok":true,"value":[["after"],1]},"log":[]}, + {"code":"try { hold({ query: Promise.reject(new Error('no')) }) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["Error","no"]},"log":[]}, + {"code":"try { hold({ query: { toJSON() { throw new Error('tj') } } }) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":null},"log":[]}, + {"code":"async function f() { return hold({ query: Promise.resolve('echo') }).items.length } const p = f(); const t = typeof p.then; return [t, await p]","outcome":{"ok":true,"value":["function",1]},"log":[]}, + {"code":"const g = (q) => hold(q).items.length; return [g({ query: { toJSON: () => 'echo' } }), g({ query: Promise.resolve('echo') })]","outcome":{"ok":true,"value":[1,1]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [1, 2].map((x) => S(x)); return [r, log]","outcome":{"ok":true,"value":[[1,1],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const r = []; [1, 2].forEach((x) => r.push(S(x))); return r })(); return [r, log]","outcome":{"ok":true,"value":[[1,1],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [1, 2].filter((x) => S(x) >= 0); return [r, log]","outcome":{"ok":true,"value":[[1,2],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [1, 2].some((x) => S(x) < 0); return [r, log]","outcome":{"ok":true,"value":[false,["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [1, 2].every((x) => S(x) >= 0); return [r, log]","outcome":{"ok":true,"value":[true,["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [1, 2].find((x) => S(x) >= 0 && x === 2); return [r, log]","outcome":{"ok":true,"value":[2,["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [1, 2].findLastIndex((x) => S(x) >= 0 && x === 1); return [r, log]","outcome":{"ok":true,"value":[0,["call 2","answer 2","call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [1, 2].reduce((a, x) => a + S(x) + x, 0); return [r, log]","outcome":{"ok":true,"value":[5,["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [1, , 3].reduceRight((a, x) => a + S(x) + x); return [r, log]","outcome":{"ok":true,"value":[5,["call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [1, 2].map((x) => [3].map((y) => S(y) + x)); return [r, log]","outcome":{"ok":true,"value":[[[2],[3]],["call 3","answer 3","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [2, 1].sort((a, b) => S(a) + a - b); return [r, log]","outcome":{"ok":true,"value":[[1,2],["call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = Array.from([1, 2], (x) => S(x) + x); return [r, log]","outcome":{"ok":true,"value":[[2,3],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = Array.from({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) }), return: () => ({}) } } }); return [r, log]","outcome":{"ok":true,"value":[[1,1],["call 1","answer 1","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...new Map({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 0, value: [++n, S(n)] }) } } })]; return [r, log]","outcome":{"ok":true,"value":[[[1,1]],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await Promise.resolve(1).then((x) => S(x) + x); return [r, log]","outcome":{"ok":true,"value":[2,["job","call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await Promise.reject(1).catch((x) => S(x) + x); return [r, log]","outcome":{"ok":true,"value":[2,["job","call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await Promise.resolve(1).finally(() => S(1)); return [r, log]","outcome":{"ok":true,"value":[1,["job","call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await new Promise((done) => done(S(1))); return [r, log]","outcome":{"ok":true,"value":[1,["call 1","answer 1","job"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await Promise.try((x) => S(x) + x, 1); return [r, log]","outcome":{"ok":true,"value":[2,["call 1","answer 1","job"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await Promise.resolve({ then(done) { done(S(1)) } }); return [r, log]","outcome":{"ok":true,"value":[1,["job","call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const r = []; new Map([[1, 'a'], [2, 'b']]).forEach((v, k) => r.push(S(k) + v)); return r })(); return [r, log]","outcome":{"ok":true,"value":[["1a","1b"],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const r = []; new Set([1, 2]).forEach((v) => r.push(S(v) + v)); return r })(); return [r, log]","outcome":{"ok":true,"value":[[2,3],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const r = []; new URLSearchParams('a=1&b=2').forEach((v) => r.push(S(v) + v)); return r })(); return [r, log]","outcome":{"ok":true,"value":[["11","12"],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [1, , 2].flatMap((x) => [S(x), x]); return [r, log]","outcome":{"ok":true,"value":[[1,1,1,2],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = Array.from({ length: 2 }, (_, i) => S(i) + i); return [r, log]","outcome":{"ok":true,"value":[[1,2],["call 0","answer 0","call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [1, { toLocaleString: () => String(S(2)) }].toLocaleString(); return [r, log]","outcome":{"ok":true,"value":["1,1",["call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = Object.groupBy([1, 2, 3], (x) => S(x) + (x % 2)); return [r, log]","outcome":{"ok":true,"value":[{"1":[2],"2":[1,3]},["call 1","answer 1","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...Map.groupBy([1, 2], (x) => S(x) + x)]; return [r, log]","outcome":{"ok":true,"value":[[[2,[1]],[3,[2]]],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = 'abcab'.replace('b', (m) => S(1) + m); return [r, log]","outcome":{"ok":true,"value":["a1bcab",["call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = 'abcab'.replaceAll('b', (m, i) => S(i) + i); return [r, log]","outcome":{"ok":true,"value":["a2ca5",["call 1","answer 1","call 4","answer 4"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = 'a1b2'.replace(/(\\d)/g, (m, d) => S(d) + d); return [r, log]","outcome":{"ok":true,"value":["a11b12",["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const r = []; [1, 2].values().forEach((x) => r.push(S(x) + x)); return r })(); return [r, log]","outcome":{"ok":true,"value":[[2,3],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [1, 2].values().some((x) => S(x) + x > 2); return [r, log]","outcome":{"ok":true,"value":[true,["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = Iterator.from({ next() { return { done: false, value: 3 } } }).find((x) => S(x) > 0); return [r, log]","outcome":{"ok":true,"value":[3,["call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [1, 2, 3].values().reduce((a, x) => a + S(x) + x); return [r, log]","outcome":{"ok":true,"value":[8,["call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = JSON.parse('[1,[2,{}],3]', (k, v) => (typeof v === 'number' ? S(v) + v : v)); return [r, log]","outcome":{"ok":true,"value":[[2,[3,{}],4],["call 1","answer 1","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (function (x) { return S(x) + x + this.y }).call({ y: 10 }, 1); return [r, log]","outcome":{"ok":true,"value":[12,["call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = ((x, y) => S(x) + x + y).apply(null, [1, 2]); return [r, log]","outcome":{"ok":true,"value":[4,["call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { function* g() { const a = S(1); yield a; yield a + 1 } const it = g(); return [it.next(), it.next(), it.next()] })(); return [r, log]","outcome":{"ok":true,"value":[[{"value":1,"done":false},{"value":2,"done":false},{"done":true}],["call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { function* g() { yield S(1); yield S(2) + 1; return 9 } const out = []; for (const x of g()) out.push(x); return out })(); return [r, log]","outcome":{"ok":true,"value":[[1,2],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { function* g() { yield S(1); yield 5; yield S(2) } return [...g()] })(); return [r, log]","outcome":{"ok":true,"value":[[1,5,1],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { function* inner() { yield S(1); yield S(2) * 10 } const first = () => inner().next().value; function* outer() { yield* inner(); yield first() + 100; for (const x of inner()) yield x + 1000 } return [...outer()] })(); return [r, log]","outcome":{"ok":true,"value":[[1,10,101,1001,1010],["call 1","answer 1","call 2","answer 2","call 1","answer 1","call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await (async () => { function* g() { yield S(1); yield S(2) + 1 } const it = g(); const a = it.next().value; await null; return [a, it.next().value, [...g()]] })(); return [r, log]","outcome":{"ok":true,"value":[[1,2,[1,2]],["call 1","answer 1","job","call 2","answer 2","call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { function* g() { try { yield S(1) } finally { yield 'cleanup' } } const it = g(); return [it.next(), it.return(4), it.next(), it.next()] })(); return [r, log]","outcome":{"ok":true,"value":[[{"value":1,"done":false},{"value":"cleanup","done":false},{"value":4,"done":true},{"done":true}],["call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = Array.from((function* () { yield S(1); yield S(2) })(), (x) => x + 1); return [r, log]","outcome":{"ok":true,"value":[[2,2],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); \n for (let j = 0; j < 37; j++) await send({ p: Promise.resolve(j), a: [1, { b: 2 }, [3]], s: 'x' }); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["send",[{"object":[["p",0],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",1],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",2],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",3],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",4],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",5],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",6],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",7],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",8],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",9],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",10],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",11],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",12],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",13],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",14],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",15],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",16],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",17],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",18],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",19],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",20],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",21],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",22],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",23],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",24],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",25],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",26],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",27],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",28],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",29],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",30],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",31],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",32],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",33],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",34],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",35],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["send",[{"object":[["p",36],["a",{"array":[1,{"object":[["b",2]]},{"array":[3]}]}],["s","x"]]}]],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); function* g() { yield 1 }\n for (let j = 0; j < 37; j++) [...g()]; const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); \n for (let j = 0; j < 37; j++) await send([Promise.resolve(1), [Promise.resolve(2), [Promise.resolve(3)]]]); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["send",[{"array":[1,{"array":[2,{"array":[3]}]}]}]],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const t = { toJSON: () => [1, 2] }\n for (let j = 0; j < 37; j++) await send({ t, p: Promise.resolve(1), e: new Error('x'), u: undefined }); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1],["e",{"error":{"name":"Error","message":"x","fields":[]}}],["u",{"undefined":true}]]}]],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); \n for (let j = 0; j < 37; j++) hold({ query: Promise.resolve('echo'), limit: 1 }); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); \n for (let j = 0; j < 37; j++) await refuse({}).catch(() => 0); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["refuse",[{"object":[]}]],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); \n for (let j = 0; j < 37; j++) await Promise.resolve(j).then((x) => x); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); \n for (let j = 0; j < 37; j++) await tools.nope({}).catch(() => 0); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); \n for (let j = 0; j < 37; j++) await Promise.resolve({ then(done) { done(j) } }); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); \n for (let j = 0; j < 37; j++) await Promise.resolve(j).finally(() => 0); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); \n for (let j = 0; j < 37; j++) await Promise.try(() => j); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); let o = 1; for (let i = 0; i < 101; i++) o = { o }\n for (let j = 0; j < 37; j++) await send({ p: Promise.resolve(1), o }).catch(() => 0); const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const t = { toJSON: () => see(1) }\n const p = r.text(); for (let j = 0; j < 300; j++) { send({ t, a: [1, 2, { c: 3 }] }); see(j) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["pull",2],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["a",{"array":[1,2,{"object":[["c",3]]}]}]]}]]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const t = { toJSON: () => see(1) }\n const p = r.text(); for (let j = 0; j < 300; j++) { hold({ query: t }); see(j) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const x = { v: 1 }; const many = Array(2049).fill(x)\n const p = r.text(); for (let j = 0; j < 30; j++) { send({ many }); see(j) }\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["send",[{"object":[["many",{"array":[{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]],["pull",2]]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...new Uint8Array([1, 2]).map((x) => S(x) + x)]; return [r, log]","outcome":{"ok":true,"value":[[2,3],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const r = []; new Uint8Array([1, 2]).forEach((x, i) => r.push(S(x) + i)); return r })(); return [r, log]","outcome":{"ok":true,"value":[[1,2],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...new Uint8Array([1, 2, 3]).filter((x) => S(x) >= 0 && x !== 2)]; return [r, log]","outcome":{"ok":true,"value":[[1,3],["call 1","answer 1","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = new Uint8Array([1, 2]).some((x) => S(x) < 0); return [r, log]","outcome":{"ok":true,"value":[false,["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = new Uint8Array([1, 2]).every((x) => S(x) >= 0); return [r, log]","outcome":{"ok":true,"value":[true,["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = new Uint8Array([1, 2]).find((x) => S(x) >= 0 && x === 2); return [r, log]","outcome":{"ok":true,"value":[2,["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = new Uint8Array([1, 2]).findIndex((x) => S(x) >= 0 && x === 2); return [r, log]","outcome":{"ok":true,"value":[1,["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = new Uint8Array([1, 2]).findLast((x) => S(x) >= 0 && x === 1); return [r, log]","outcome":{"ok":true,"value":[1,["call 2","answer 2","call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = new Uint8Array([1, 2]).findLastIndex((x) => S(x) >= 0 && x === 1); return [r, log]","outcome":{"ok":true,"value":[0,["call 2","answer 2","call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = new Uint8Array([1, 2]).reduce((a, x) => a + S(x) + x, 0); return [r, log]","outcome":{"ok":true,"value":[5,["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = new Uint8Array([1, 2, 3]).reduceRight((a, x, i) => a + S(x) + i); return [r, log]","outcome":{"ok":true,"value":[6,["call 2","answer 2","call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...Uint8Array.from([1, 2], (x, i) => S(x) + x + i)]; return [r, log]","outcome":{"ok":true,"value":[[2,4],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...Uint8Array.from(new Uint8Array([1, 2]), function (x) { return S(x) + x + this.k }, { k: 10 })]; return [r, log]","outcome":{"ok":true,"value":[[12,13],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...Uint8Array.from({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) }), return: () => ({}) } } })]; return [r, log]","outcome":{"ok":true,"value":[[1,1],["call 1","answer 1","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...Uint8Array.from({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) }), return: () => ({}) } } }, (x) => S(x) + x)]; return [r, log]","outcome":{"ok":true,"value":[[2,2],["call 1","answer 1","call 2","answer 2","call 3","answer 3","call 1","answer 1","call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...new Uint8Array({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) }), return: () => ({}) } } })]; return [r, log]","outcome":{"ok":true,"value":[[1,1],["call 1","answer 1","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const u = new Uint8Array(4); u.set({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) }), return: () => ({}) } } }, 1); return [...u] })(); return [r, log]","outcome":{"ok":true,"value":[[0,1,1,0],["call 1","answer 1","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const u = new Uint8Array([1, 2]); return [...u.map((x) => (x === 1 ? 300 : '7'))]","outcome":{"ok":true,"value":[44,7]},"log":[]}, + {"code":"try { new Uint8Array([]).reduce((a, x) => a + x) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","Uint8Array.reduce of an empty array with no initial value."]},"log":[]}, + {"code":"try { Uint8Array.from([1, 2], (x) => { if (x === 2) throw new Error('m' + x); return x }) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["Error","m2"]},"log":[]}, + {"code":"try { new Uint8Array(1).set({ [Symbol.iterator]: function* () { yield 1; yield 2 } }) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["RangeError","Uint8Array.set: the source does not fit at that offset."]},"log":[]}, + {"code":"const it = { [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 2, value: ++n }) } } }; const u = new Uint8Array(5); u.set(it, 2); return [[...u], [...new Uint8Array(it)], [...Uint8Array.from(it, (x) => x * 3)]]","outcome":{"ok":true,"value":[[0,0,1,2,3],[1,2,3],[3,6,9]]},"log":[]}, + {"code":"return [[...new Uint8Array(new Set([1, 2]))], [...Uint8Array.from('12')], [...Uint8Array.from(new Map([[3, 4]]).keys())], [...new Uint8Array([1, 2].values())], [...new Uint8Array((function* () { yield 5; yield 6 })())]]","outcome":{"ok":true,"value":[[1,2],[1,2],[3],[1,2],[5,6]]},"log":[]}, + {"code":"const u = new Uint8Array([5, 6, 7]); const seen = []; u.forEach((x, i, a) => { seen.push([x, i, a === u]); if (i === 0) u[2] = 9 }); return seen","outcome":{"ok":true,"value":[[5,0,true],[6,1,true],[9,2,true]]},"log":[]}, + {"code":"const u = new Uint8Array([1, 2, 3, 4]); return [u.some((x) => x > 3), u.every((x) => x > 0), u.findLast((x) => x < 3), u.findIndex((x) => x > 9), u.reduceRight((a, x) => a + x, '')]","outcome":{"ok":true,"value":[true,true,2,-1,"4321"]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = Iterator.from({ [Symbol.iterator]() { const n = S(1); return [n, 2].values() } }).toArray(); return [r, log]","outcome":{"ok":true,"value":[[1,2],["call 1","answer 1"]]},"log":[]}, + {"code":"const log = []\n const src = (n, fail = {}) => ({ i: 0, next() { log.push('next ' + this.i); if (fail.next === this.i) throw new Error('next ' + this.i); return this.i < n ? { done: false, value: this.i++ } : { done: true } }, return() { log.push('return'); if (fail.ret) throw new Error('return'); return fail.bad ? 5 : {} } })\n const H = Iterator.prototype\n const attempt = (f) => { try { return f() } catch (e) { return e.name + ': ' + e.message } }\n return [\n attempt(() => H.map.call(src(3), (x) => { if (x === 1) throw new Error('map'); return x }).toArray()),\n attempt(() => H.filter.call(src(3), (x) => { throw new TypeError('filter') }).next()),\n attempt(() => H.map.call(src(3, { next: 1 }), (x) => x).toArray()),\n attempt(() => H.map.call(src(3, { ret: true }), () => { throw new Error('kept') }).next()),\n attempt(() => H.flatMap.call(src(3), (x) => x).next()),\n attempt(() => H.flatMap.call(src(3), () => ({ [Symbol.iterator]: 5 })).next()),\n attempt(() => H.flatMap.call(src(3), () => ({ [Symbol.iterator]() { throw new Error('open') } })).next()),\n attempt(() => H.flatMap.call(src(3), () => ({ next: () => 5 })).next()),\n attempt(() => H.flatMap.call(src(3), () => ({ next() { throw new Error('inner') } })).next()),\n log,\n ]","outcome":{"ok":true,"value":["Error: map","TypeError: filter","Error: next 1","Error: kept","TypeError: Iterator.prototype.flatMap expects an iterable or iterator, received a number.","TypeError: H.flatMap.call is not a function.","Error: open","TypeError: Iterator next() result must be an object.","Error: inner",["next 0","next 1","return","next 0","return","next 0","next 1","next 0","return","next 0","return","next 0","return","next 0","return","next 0","return","next 0","return"]]},"log":[]}, + {"code":"const log = []\n const src = (n, fail = {}) => ({ i: 0, next() { log.push('next ' + this.i); if (fail.next === this.i) throw new Error('next ' + this.i); return this.i < n ? { done: false, value: this.i++ } : { done: true } }, return() { log.push('return'); if (fail.ret) throw new Error('return'); return fail.bad ? 5 : {} } })\n const H = Iterator.prototype\n const attempt = (f) => { try { return f() } catch (e) { return e.name + ': ' + e.message } }\n const inner = () => ({ next: () => ({ done: false, value: 'i' }), return() { log.push('inner return'); throw new Error('inner') } })\n const a = H.map.call(src(3), (x) => x); log.push(JSON.stringify(a.return()), JSON.stringify(a.next()))\n const b = H.map.call(src(3), (x) => x); b.next(); log.push(JSON.stringify(b.return()), JSON.stringify(b.return()))\n const c = H.flatMap.call(src(3), inner); c.next(); log.push(attempt(() => c.return()), JSON.stringify(c.next()))\n const d = H.flatMap.call(src(3, { ret: true }), inner); d.next(); log.push(attempt(() => d.return()))\n const e = H.drop.call(src(3, { bad: true }), 1); e.next(); log.push(attempt(() => e.return()))\n const f = H.take.call(src(3, { bad: true }), 1); log.push(attempt(() => f.return()))\n const t = H.take.call(src(3, { bad: true }), 1); t.next(); log.push(attempt(() => t.next()), attempt(() => t.next()))\n const z = H.take.call(src(3), 0); log.push(JSON.stringify(z.next()))\n const odd = { next: () => ({ done: false, value: 1 }), return: 5 }\n const q = H.map.call(odd, (x) => x); q.next(); log.push(attempt(() => q.return()), attempt(() => H.map.call(odd, (x) => x).return()))\n log.push(attempt(() => H.map.call(odd, () => { throw new Error('cb') }).next()))\n return log","outcome":{"ok":true,"value":["return","{\"done\":true}","{\"done\":true}","next 0","return","{\"done\":true}","{\"done\":true}","next 0","inner return","return","Error: inner","{\"done\":true}","next 0","inner return","return","Error: inner","next 0","next 1","return","TypeError: Iterator return() result must be an object.","return","TypeError: Iterator return() must return an object.","next 0","return","TypeError: Iterator return() result must be an object.",{"done":true},"return","{\"done\":true}","TypeError: Iterator return must be a function.","TypeError: H.map.call is not a function.","Error: cb"]},"log":[]}, + {"code":"const log = []\n const src = (n, fail = {}) => ({ i: 0, next() { log.push('next ' + this.i); if (fail.next === this.i) throw new Error('next ' + this.i); return this.i < n ? { done: false, value: this.i++ } : { done: true } }, return() { log.push('return'); if (fail.ret) throw new Error('return'); return fail.bad ? 5 : {} } })\n const H = Iterator.prototype\n const attempt = (f) => { try { return f() } catch (e) { return e.name + ': ' + e.message } }\n let h; h = [1, 2].values().map((x) => attempt(() => h.next())); const r1 = h.next()\n let k; k = Iterator.from({ next: () => ({ done: false, value: attempt(() => k.next()) }) }).map((x) => x); const r2 = k.next()\n let m; m = [1, 2].values().map((x) => JSON.stringify(m.return())); const r3 = attempt(() => m.next())\n const r4 = [r1, r2, r3, h.next(), k.next().value, attempt(() => h.return())]\n return r4","outcome":{"ok":true,"value":[{"value":"TypeError: Iterator helper is already running.","done":false},{"value":"TypeError: Iterator helper is already running.","done":false},"TypeError: Iterator helper is already running.",{"value":"TypeError: Iterator helper is already running.","done":false},"TypeError: Iterator helper is already running.",{"done":true}]},"log":[]}, + {"code":"function* g(n) { for (let i = 0; i < n; i++) yield i }\n const log = []\n function* f() { try { yield 1; yield 2 } finally { log.push('finally') } }\n const a = f().map((x) => x * 2); log.push(a.next().value); a.return()\n const b = f().take(1); log.push(b.next().value, b.next().done)\n const c = [1, 2].values().flatMap(f); log.push(c.next().value); c.return()\n const d = f(); d.next = () => ({ done: false, value: 'own' }); log.push(d.map((x) => x).next().value)\n function* thrower() { yield 1; throw new Error('gen') }\n try { thrower().map((x) => x).toArray() } catch (e) { log.push(e.message) }\n function* bad() { try { yield 1 } finally { throw new Error('finally') } }\n try { bad().map((x) => { throw new Error('cb') }).next() } catch (e) { log.push(e.message) }\n const e = bad().drop(0); e.next(); try { e.return() } catch (err) { log.push(err.message) }\n log.push(g(6).drop(1).filter((x) => x % 2).flatMap((x) => g(x)).take(5).toArray().join())\n return log","outcome":{"ok":true,"value":[2,"finally","finally",1,true,1,"finally","own","gen","cb","finally","0,0,1,2,0"]},"log":[]}, + {"code":"const log = []\n const it = { [Symbol.iterator]() { log.push('open'); return { next: () => ({ done: true }) } } }\n const a = Iterator.from(it); log.push(typeof a.next, JSON.stringify(a.next()))\n log.push(Iterator.from('ab').toArray().join(), Iterator.from({ next: () => ({ done: true }) }).toArray().length)\n for (const v of [5, { [Symbol.iterator]: 5 }, { [Symbol.iterator]: () => 5 }, { [Symbol.iterator]() { throw new RangeError('open') } }])\n try { Iterator.from(v) } catch (e) { log.push(e.name + ': ' + e.message) }\n return log","outcome":{"ok":true,"value":["open","function","{\"done\":true}","a,b",0,"TypeError: Iterator.from expects an iterable or iterator, received a number.","TypeError: Iterator.from is not a function.","TypeError: An iterator must be an object.","RangeError: open"]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...new Set([1, 2, 3]).intersection({ size: 5, has: (x) => S(x) > 0 && x !== 2, keys: () => [].values() })]; return [r, log]","outcome":{"ok":true,"value":[[1,3],["call 1","answer 1","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...new Set([1, 2, 3]).difference({ size: 3, has: (x) => S(x) > 0 && x === 2, keys: () => [].values() })]; return [r, log]","outcome":{"ok":true,"value":[[1,3],["call 1","answer 1","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = new Set([1, 2]).isSubsetOf({ size: 2, has: (x) => S(x) > 0, keys: () => [].values() }); return [r, log]","outcome":{"ok":true,"value":[true,["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = new Set([1, 2]).isDisjointFrom({ size: 9, has: (x) => S(x) > 0 && x === 2, keys: () => [].values() }); return [r, log]","outcome":{"ok":true,"value":[false,["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...new Set([1]).union({ size: 1, has: () => false, keys: () => { S(0); return [2, 3] } })]; return [r, log]","outcome":{"ok":true,"value":[[1,2,3],["call 0","answer 0"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...new Set([1, 2]).symmetricDifference({ size: 1, has: () => false, keys() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) + n }) } } })]; return [r, log]","outcome":{"ok":true,"value":[[1,3],["call 1","answer 1","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...new Set([1, 2]).union({ size: 1, has: () => false, keys() { const v = [S(5), 6]; let i = 0; return { next: () => (i < v.length ? { done: false, value: v[i++] } : { done: true }) } } })]; return [r, log]","outcome":{"ok":true,"value":[[1,2,6],["call 5","answer 5"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = new Set([1]).isDisjointFrom({ size: 0, has: () => true, keys() { const v = [1, 2]; let i = 0; return { next: () => (i < v.length ? { done: false, value: v[i++] } : { done: true }) , return: () => ({ r: S(9) }) } } }); return [r, log]","outcome":{"ok":true,"value":[false,["call 9","answer 9"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = new Set([1, 2]).isSupersetOf({ size: 2, has: () => true, keys() { const v = [1, 7]; let i = 0; return { next: () => (i < v.length ? { done: false, value: v[i++] } : { done: true }) , return() { S(8); return {} } } } }); return [r, log]","outcome":{"ok":true,"value":[false,["call 8","answer 8"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const m = new Map([[1, 'a']]); return [m.getOrInsertComputed('k', (k) => S(k) + k), m.getOrInsertComputed(1, () => S(2)), [...m]] })(); return [r, log]","outcome":{"ok":true,"value":[["1k","a",[[1,"a"],["k","1k"]]],["call k","answer k"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const w = new WeakMap(); const o = {}; return [w.getOrInsertComputed(o, () => S(1) + 1), w.get(o)] })(); return [r, log]","outcome":{"ok":true,"value":[[2,2],["call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const o = {}; const w = new WeakSet({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n++ > 0, value: (S(1), o) }) } } }); return w.has(o) })(); return [r, log]","outcome":{"ok":true,"value":[true,["call 1","answer 1","call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const o = {}; const w = new WeakMap({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n++ > 0, value: [o, S(n)] }) } } }); return w.get(o) })(); return [r, log]","outcome":{"ok":true,"value":[1,["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await Promise.all({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) + n }) } } }); return [r, log]","outcome":{"ok":true,"value":[[2,3],["call 1","answer 1","call 2","answer 2","call 3","answer 3","job"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await Promise.allSettled({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 0, value: Promise.reject(S(++n)) }) } } }); return [r, log]","outcome":{"ok":true,"value":[[{"status":"rejected","reason":1}],["call 1","answer 1","call 2","answer 2","job"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await Promise.race({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 0, value: S(++n) }) } } }); return [r, log]","outcome":{"ok":true,"value":[1,["call 1","answer 1","call 2","answer 2","job"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await Promise.any({ [Symbol.iterator]() { S(1); return [Promise.reject(1), 2].values() } }); return [r, log]","outcome":{"ok":true,"value":[2,["call 1","answer 1","job"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await Promise.all({ [Symbol.iterator]() { return { next() { S(1); throw new Error('nx') } } } }).catch((e) => e.message); return [r, log]","outcome":{"ok":true,"value":["nx",["call 1","answer 1","job"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await Promise.all({ [Symbol.iterator]() { return { next: () => S(1) } } }).catch((e) => e.message); return [r, log]","outcome":{"ok":true,"value":["Iterator next() result must be an object.",["call 1","answer 1","job"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { function* g() { try { yield 1 } finally { log.push('finally') } } const it = g(); it.next(); return [1].map((x) => [it.return(S(x)), it.next()]) })(); return [r, log]","outcome":{"ok":true,"value":[[[{"value":1,"done":true},{"done":true}]],["call 1","answer 1","finally"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { function* g() { try { yield 1 } catch (e) { yield e + 1 } } const it = g(); it.next(); return [1].map((x) => [it.throw(S(x)), it.next()]) })(); return [r, log]","outcome":{"ok":true,"value":[[[{"value":2,"done":false},{"done":true}]],["call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { function* g() { try { yield 1 } catch (e) { return e } } const it = g(); it.next(); return [1].map((x) => it.throw.call(it, S(x) + x)) })(); return [r, log]","outcome":{"ok":true,"value":[[{"value":2,"done":true}],["call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = Array.from({ [Symbol.iterator]() { const it = (function* () { yield 1; yield 2 })(); return { next: it.next.bind(it), [Symbol.iterator]() { return this } } } }, (x) => S(x) + x); return [r, log]","outcome":{"ok":true,"value":[[2,3],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = Object.groupBy([1, 2], (x) => ({ toString: () => 'g' + S(x) })); return [r, log]","outcome":{"ok":true,"value":[{"g1":[1,2]},["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = Object.groupBy([1, 2, 3], (x) => ({ toString: () => ({}), valueOf: () => S(x % 2) })); return [r, log]","outcome":{"ok":true,"value":[{"1":[1,2,3]},["call 1","answer 1","call 0","answer 0","call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = Object.groupBy({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) }) } } }, (x) => ({ toString: () => 'k' + S(x) })); return [r, log]","outcome":{"ok":true,"value":[{"k1":[1,1]},["call 1","answer 1","call 1","answer 1","call 2","answer 2","call 1","answer 1","call 3","answer 3"]]},"log":[]}, + {"code":"return [new Set([1]).isDisjointFrom({ size: 0, has: () => true, keys: () => ({ next: () => ({ done: false, value: 1 }), return: () => 1 }) })]","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Iterator return() result must be an object. (line 1, col 9)"},"log":[]}, + {"code":"try { new Set([1]).union({ size: 1, has: () => true, keys: () => ({ next: 5 }) }) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","The called value is not a function."]},"log":[]}, + {"code":"try { new Set([1]).union({ size: 1, has: () => true, keys: () => ({ next: () => 5 }) }) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","Iterator next() result must be an object."]},"log":[]}, + {"code":"const log = []; function* k() { try { yield 1; yield 2 } finally { log.push('closed') } } return [new Set([1]).isSupersetOf({ size: 1, has: () => true, keys: k }), new Set([1, 5]).isSupersetOf({ size: 2, has: () => true, keys: k }), log]","outcome":{"ok":true,"value":[false,false,["closed","closed"]]},"log":[]}, + {"code":"const log = []; const w = new WeakSet({ [Symbol.iterator]() { return { next: () => ({ done: false, value: 1 }), return() { log.push('closed'); return {} } } } }); return log","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Invalid value used in weak set: a number cannot be held weakly. (line 1, col 27)"},"log":[]}, + {"code":"try { new WeakSet({ [Symbol.iterator]() { return { next: () => ({ done: false, value: 1 }), return() { return {} } } } }) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","Invalid value used in weak set: a number cannot be held weakly."]},"log":[]}, + {"code":"try { new WeakMap([[1, 2]]) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","Invalid value used as weak map key: a number cannot be held weakly."]},"log":[]}, + {"code":"return await Promise.race({ [Symbol.iterator]: 5 }).catch((e) => [e.name, e.message])","outcome":{"ok":true,"value":["TypeError","Iterator method must be a function."]},"log":[]}, + {"code":"return await Promise.all({ [Symbol.iterator]() { throw new RangeError('open') } }).catch((e) => [e.name, e.message])","outcome":{"ok":true,"value":["RangeError","open"]},"log":[]}, + {"code":"return await Promise.all((function* () { yield 1; yield Promise.resolve(2) })())","outcome":{"ok":true,"value":[1,2]},"log":[]}, + {"code":"function* g() { const x = yield 1; return x * 2 } const it = g(); it.next(); const r = it.next.call(it, 4); let t; try { it.throw.call(it, 1) } catch (e) { t = e } return [r, it.return(7), t]","outcome":{"ok":true,"value":[{"value":8,"done":true},{"value":7,"done":true},1]},"log":[]}, + {"code":"function* g() { try { yield 1 } finally { throw new Error('f') } } const it = g(); it.next(); const r = []; try { [1].map(() => it.return(2)) } catch (e) { r.push(e.message) } function* h() { yield 1 } const j = h(); j.next(); try { [1].forEach(() => j.throw(new Error('t'))) } catch (e) { r.push(e.message) } return [r, j.next()]","outcome":{"ok":true,"value":[["f","t"],{"done":true}]},"log":[]}, + {"code":"function* g() { yield 42; throw new Error('x') } async function* a() { yield* g() } const it = a(); await it.next(); try { await it.throw(new Error('c')) } catch (e) { return [e.message, await it.next()] }","outcome":{"ok":true,"value":["c",{"done":true}]},"log":[]}, + {"code":"function* k() { try { yield 1 } finally { throw new Error('fin') } } try { new Set([5]).isSupersetOf({ size: 1, has: () => true, keys: k }) } catch (e) { return e.message }","outcome":{"ok":true,"value":"fin"},"log":[]}, + {"code":"const log = []; const r = Object.groupBy(['a', 'b'], (x) => { log.push('cb ' + x); return { toString() { log.push('ts ' + x); return x } } }); return [r, log]","outcome":{"ok":true,"value":[{"a":["a"],"b":["b"]},["cb a","ts a","cb b","ts b"]]},"log":[]}, + {"code":"const log = []; const it = { [Symbol.iterator]() { return { next: () => ({ done: false, value: 1 }), return: () => (log.push('closed'), {}) } } }\n try { Object.groupBy(it, () => ({ toString() { throw new Error('ts') } })) } catch (e) { log.push(e.message) } return log","outcome":{"ok":true,"value":["closed","ts"]},"log":[]}, + {"code":"return [Object.groupBy([1, 2], (x) => ({ x })), Map.groupBy([1, 2], (x) => ({ toString: () => 'never' })).size]","outcome":{"ok":true,"value":[{"[object Object]":[1,2]},2]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await send({ query: { toJSON: () => 'echo' + S(1) } }).then((r) => r.query); return [r, log]","outcome":{"ok":true,"value":[{},["job"]]},"log":[["send",[{"object":[["query",{"object":[]}]]}]]]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = hold({ query: { toJSON: () => 'echo' + S(1) } }).items.length; return [r, log]","outcome":{"ok":true,"value":[1,[]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await send({ a: { toJSON: () => S(1) }, p: Promise.resolve(2) }); return [r, log]","outcome":{"ok":true,"value":[{"a":{},"p":2},["job"]]},"log":[["send",[{"object":[["a",{"object":[]}],["p",2]]}]]]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = Object.fromEntries({ [Symbol.iterator]() { let n = 0; return { next: () => (n > 1 ? { done: true } : { done: false, value: ['k' + n, S(++n)] }), return: () => ({}) } } }); return [r, log]","outcome":{"ok":true,"value":[{"k0":1,"k1":1},["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = new AggregateError({ [Symbol.iterator]() { let n = 0; return { next: () => (n > 1 ? { done: true } : { done: false, value: S(++n) }), return: () => ({}) } } }, 'm').errors; return [r, log]","outcome":{"ok":true,"value":[[1,1],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = AggregateError({ [Symbol.iterator]() { let n = 0; return { next: () => (n > 1 ? { done: true } : { done: false, value: S(++n) }), return: () => ({}) } } }).errors; return [r, log]","outcome":{"ok":true,"value":[[1,1],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = Math.sumPrecise({ [Symbol.iterator]() { let n = 0; return { next: () => (n > 1 ? { done: true } : { done: false, value: S(++n) + 0.5 }), return: () => ({}) } } }); return [r, log]","outcome":{"ok":true,"value":[3,["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...new URLSearchParams({ [Symbol.iterator]() { let n = 0; return { next: () => (n > 1 ? { done: true } : { done: false, value: ['k' + n, S(++n)] }), return: () => ({}) } } })]; return [r, log]","outcome":{"ok":true,"value":[[["k0","1"],["k1","1"]],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...new Headers([{ [Symbol.iterator]() { let n = 0; return { next: () => (n > 1 ? { done: true } : { done: false, value: 'v' + S(++n) }), return: () => ({}) } } }])]; return [r, log]","outcome":{"ok":true,"value":[[["v1","v1"]],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...new Headers({ [Symbol.iterator]() { let n = 0; return { next: () => (n > 1 ? { done: true } : { done: false, value: ['x' + n, String(S(++n))] }), return: () => ({}) } } })]; return [r, log]","outcome":{"ok":true,"value":[[["x0","1"],["x1","1"]],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = ({ toString: () => 'x' + S(1) }).toLocaleString(); return [r, log]","outcome":{"ok":true,"value":["x1",["call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = hold({ query: { toJSON: () => 'echo' }, p: Promise.resolve(1) }).items.length; return [r, log]","outcome":{"ok":true,"value":[1,[]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = hold({ p: Promise.resolve(1), query: { toJSON: () => 'echo' } }).items.length; return [r, log]","outcome":{"ok":true,"value":[1,[]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [1, 2].map((x) => hold({ query: { toJSON() { log.push('tj ' + x); return 'echo' } }, p: Promise.resolve(x) }).items.length + x); return [r, log]","outcome":{"ok":true,"value":[[2,3],[]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { try { hold({ query: { toJSON: () => 'echo' }, p: Promise.reject(new Error('no')) }) } catch (e) { return [e.name, e.message] } })(); return [r, log]","outcome":{"ok":true,"value":[["Error","no"],["job"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { try { hold({ p: Promise.resolve(1), query: { toJSON() { throw new Error('tj') } } }) } catch (e) { return [e.name, e.message] } })(); return [r, log]","outcome":{"ok":true,"value":[null,[]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await Promise.resolve(1).then((x) => hold({ query: { toJSON: () => 'echo' }, p: Promise.resolve(x) }).items.length + x); return [r, log]","outcome":{"ok":true,"value":[2,["job"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = Object.fromEntries([[Object.create({ toString: () => 'k' + S(1) }), 1], ['b', 2]]); return [r, log]","outcome":{"ok":true,"value":[{"k1":1,"b":2},["call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = Object.fromEntries([[Object.create({ toString: () => ({}), valueOf: () => S(3) }), 'v']]); return [r, log]","outcome":{"ok":true,"value":[{"1":"v"},["call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = Object.fromEntries({ [Symbol.iterator]() { let n = 0; return { next: () => (n > 1 ? { done: true } : { done: false, value: [Object.create({ toString: () => 'k' + S(++n) }), n] }), return: () => ({}) } } }); return [r, log]","outcome":{"ok":true,"value":[{"k1":1},["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...new URLSearchParams([[{ toString: () => 'a' + S(1) }, 'b'], ['c', { toString: () => 'd' + S(2) }]])]; return [r, log]","outcome":{"ok":true,"value":[[["a1","b"],["c","d1"]],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...new Headers([[{ toString: () => 'x-' + S(1) }, { toString: () => 'v' + S(2) }]])]; return [r, log]","outcome":{"ok":true,"value":[[["x-1","v1"]],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...new URLSearchParams({ [Symbol.iterator]() { let n = 0; return { next: () => (n > 1 ? { done: true } : { done: false, value: [{ toString: () => 'k' + S(++n) }, n] }), return: () => ({}) } } })]; return [r, log]","outcome":{"ok":true,"value":[[["k1","0"],["k1","1"]],["call 1","answer 1","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; return { t: { toJSON: () => (log.push('call'), hold({ query: Promise.resolve('echo') }).items.length) }, log }","outcome":{"ok":true,"value":{"t":1,"log":["call"]}},"log":[]}, + {"code":"const log = []; const r = (k, v) => { log.push([k, typeof v]); return k === 'skip' ? undefined : v }\n const v = { a: 1, skip: 2, b: [1, , { toJSON(k) { log.push('toJSON ' + k); return { c: undefined, d: () => 1, e: 'x' } } }], f: undefined }\n return [JSON.stringify(v, r), JSON.stringify(v, r, 2), JSON.stringify(v, r, '--'), log]","outcome":{"ok":true,"value":["{\"a\":1,\"b\":[1,null,{\"e\":\"x\"}]}","{\n \"a\": 1,\n \"b\": [\n 1,\n null,\n {\n \"e\": \"x\"\n }\n ]\n}","{\n--\"a\": 1,\n--\"b\": [\n----1,\n----null,\n----{\n------\"e\": \"x\"\n----}\n--]\n}",[["","object"],["a","number"],["skip","number"],["b","object"],["0","number"],["1","undefined"],"toJSON 2",["2","object"],["c","undefined"],["d","function"],["e","string"],["f","undefined"],["","object"],["a","number"],["skip","number"],["b","object"],["0","number"],["1","undefined"],"toJSON 2",["2","object"],["c","undefined"],["d","function"],["e","string"],["f","undefined"],["","object"],["a","number"],["skip","number"],["b","object"],["0","number"],["1","undefined"],"toJSON 2",["2","object"],["c","undefined"],["d","function"],["e","string"],["f","undefined"]]]},"log":[]}, + {"code":"const r = (k, v) => (k === '' ? v : undefined); return [JSON.stringify({ a: 1, b: 2 }, r, 2), JSON.stringify([1, 2], r, 2), JSON.stringify({}, r, 2), JSON.stringify([], r, 2)]","outcome":{"ok":true,"value":["{}","[\n null,\n null\n]","{}","[]"]},"log":[]}, + {"code":"return [JSON.stringify(5, (k, v) => undefined), JSON.stringify({ a: 1 }, (k, v) => (k ? v + 1 : v)), JSON.stringify('s', (k, v) => [k, v])]","outcome":{"ok":false,"kind":"ExecutionFailure","message":"RangeError: Value exceeds the maximum depth of 100. (line 1, col 102)"},"log":[]}, + {"code":"const a = [1, 2, 3]; return JSON.stringify(a, (k, v) => { if (k === '0') a.length = 1; return v })","outcome":{"ok":true,"value":"[1,null,null]"},"log":[]}, + {"code":"const o = { a: 1, b: 2 }; return JSON.stringify(o, (k, v) => { if (k === 'a') { delete o.b; o.c = 3 } return v })","outcome":{"ok":true,"value":"{\"a\":1}"},"log":[]}, + {"code":"const o = { x: 1 }; return [JSON.stringify(o, ['x', 'y'], 1), JSON.stringify({ toJSON: () => ({ y: 2, x: 1 }) }, ['y', 'x']), JSON.stringify([{ x: 1, y: 2 }], ['y'])]","outcome":{"ok":true,"value":["{\n \"x\": 1\n}","{\"y\":2,\"x\":1}","[{\"y\":2}]"]},"log":[]}, + {"code":"try { JSON.stringify({ a: { toJSON() { throw new RangeError('tj') } } }) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["RangeError","tj"]},"log":[]}, + {"code":"try { JSON.stringify([1, [2]], (k, v) => { if (v === 2) throw new TypeError('r'); return v }) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","r"]},"log":[]}, + {"code":"const o = { a: 1 }; try { JSON.stringify(o, (k, v) => (k === 'a' ? o : v)) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","Converting circular structure to JSON."]},"log":[]}, + {"code":"return JSON.stringify({ p: 1, q: [2] }, (k, v) => (k === 'p' || k === '0' ? Promise.resolve(1) : v))","outcome":{"ok":true,"value":"{\"p\":{},\"q\":[{}]}"},"log":[]}, + {"code":"const log = []; try { JSON.stringify({ a: 1, p: Promise.resolve(1) }, (k, v) => { log.push(k); return v }) } catch (e) { return [e.name, e.message, log] }","outcome":{"ok":true,"value":["TypeError","JSON.stringify received an un-awaited Promise; await it first - e.g. `const result = await load(...)`.",["","a"]]},"log":[]}, + {"code":"try { return JSON.stringify([Promise.resolve(1)]) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","JSON.stringify received an un-awaited Promise; await it first - e.g. `const result = await load(...)`."]},"log":[]}, + {"code":"const e = new Error('m'); e.name = undefined; const f = new TypeError('n'); f.name = 5; f.x = 1; return JSON.stringify({ e, f }, (k, v) => v, 1)","outcome":{"ok":true,"value":"{\n \"e\": {\n \"message\": \"m\"\n },\n \"f\": {\n \"name\": 5,\n \"message\": \"n\",\n \"x\": 1\n }\n}"},"log":[]}, + {"code":"return [JSON.stringify({ a: Symbol.iterator, b: [Symbol.iterator] }, (k, v) => v), JSON.stringify({ s: Symbol.iterator }, ['s'], 1)]","outcome":{"ok":true,"value":["{\"a\":{},\"b\":[{}]}","{\n \"s\": {}\n}"]},"log":[]}, + {"code":"const p = Object.create({ inh: 1 }); p.own = 2; p.gone = 3; return JSON.stringify({ p }, (k, v) => { if (k === 'own') delete p.gone; return v })","outcome":{"ok":true,"value":"{\"p\":{\"own\":2}}"},"log":[]}, + {"code":"const a = [1, 2, 3]; return JSON.stringify(a, (k, v) => { if (k === '0') a[2] = 'changed'; return v })","outcome":{"ok":true,"value":"[1,2,\"changed\"]"},"log":[]}, + {"code":"let d = 1; for (let i = 0; i < 99; i++) d = [d]; return [JSON.stringify(d, (k, v) => v).length, JSON.stringify({ d }, (k, v) => v).length]","outcome":{"ok":true,"value":[199,205]},"log":[]}, + {"code":"const big = 'x'.repeat(1 << 20); const parts = Array(600).fill(big); try { JSON.stringify(parts, (k, v) => v) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["RangeError","Invalid string length"]},"log":[]}, + {"code":"const log = []; const s = JSON.stringify({ e: new TypeError('m'), d: new Date(0), m: new Map([[1, 2]]), s: new Set([1]), u: new URL('https://a.b/c') }, (k, v) => { log.push(k); return v }, '\\t'); return [s, log]","outcome":{"ok":true,"value":["{\n\t\"e\": {\n\t\t\"name\": \"TypeError\",\n\t\t\"message\": \"m\"\n\t},\n\t\"d\": \"1970-01-01T00:00:00.000Z\",\n\t\"m\": {},\n\t\"s\": {},\n\t\"u\": \"https://a.b/c\"\n}",["","e","name","message","d","m","s","u"]]},"log":[]}, + {"code":"const seen = []; JSON.stringify({ a: [1, { b: 2 }] }, function (k, v) { seen.push([k, Array.isArray(this) ? 'array' : typeof this]); return v }); return seen","outcome":{"ok":true,"value":[["","object"],["a","object"],["0","array"],["1","array"],["b","object"]]},"log":[]}, + {"code":"return JSON.stringify({ a: { b: 1 }, c: [2] }, (k, v) => (k === 'a' ? JSON.stringify(v, (k2, v2) => v2) : v))","outcome":{"ok":true,"value":"{\"a\":\"{\\\"b\\\":1}\",\"c\":[2]}"},"log":[]}, + {"code":"return JSON.stringify({ a: { toJSON: () => JSON.stringify({ x: { toJSON: () => 1 } }) } }, null, 1)","outcome":{"ok":true,"value":"{\n \"a\": \"{\\\"x\\\":1}\"\n}"},"log":[]}, + {"code":"const log = []; const it = { [Symbol.iterator]() { let n = 0; return { next() { log.push('next'); return n < 2 ? { done: false, value: n++ === 0 ? ['a', 1] : 5 } : { done: true } }, return() { log.push('return'); return {} } } } }\n try { Object.fromEntries(it) } catch (e) { log.push(e.message) } return log","outcome":{"ok":true,"value":["next","next","return","Object.fromEntries expects [key, value] entry objects."]},"log":[]}, + {"code":"const log = []; const it = { [Symbol.iterator]() { let n = 0; return { next() { log.push('next'); return n < 2 ? { done: false, value: n++ ? 'x' : 1 } : { done: true } }, return() { log.push('return'); return {} } } } }\n try { Math.sumPrecise(it) } catch (e) { log.push(e.message) } return [log, Math.sumPrecise([0.1, 0.2, -0.3]), Math.sumPrecise([])]","outcome":{"ok":true,"value":[["next","next","return","Math.sumPrecise expects an iterable of numbers."],2.7755575615628914e-17,0]},"log":[]}, + {"code":"const log = []; const pair = { [Symbol.iterator]() { let n = 0; return { next() { log.push('part'); return n < 2 ? { done: false, value: n++ ? { toString() { throw new Error('part') } } : 'k' } : { done: true } }, return() { log.push('close pair'); return {} } } } }\n const outer = { [Symbol.iterator]() { let n = 0; return { next() { log.push('pair'); return n++ < 2 ? { done: false, value: pair } : { done: true } }, return() { log.push('close'); return {} } } } }\n try { new URLSearchParams(outer) } catch (e) { log.push(e.message) } return log","outcome":{"ok":true,"value":["pair","part","part","close pair","close","part"]},"log":[]}, + {"code":"const g = function* () { yield ['a', '1']; yield new Set(['b', 2]) }; return [String(new URLSearchParams(g())), [...new Headers(g())], [...new Headers(new Map([['x', 'y']]))]]","outcome":{"ok":true,"value":["a=1&b=2",[["a","1"],["b","2"]],[["x","y"]]]},"log":[]}, + {"code":"try { new Headers([['a', 'b', 'c']]) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","new Headers(...) expects iterable [name, value] pairs."]},"log":[]}, + {"code":"try { new URLSearchParams([1]) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","new URLSearchParams(...) expects iterable [name, value] pairs."]},"log":[]}, + {"code":"const e = new AggregateError(new Set([1, new Error('x')]), 'all', { cause: 2 }); return [e.errors.length, e.message, e.cause, AggregateError([]).errors]","outcome":{"ok":true,"value":[2,"all",2,[]]},"log":[]}, + {"code":"try { new AggregateError(5) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","for...of requires an iterable value, received a number."]},"log":[]}, + {"code":"try { Object.fromEntries(5) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","for...of requires an iterable value, received a number."]},"log":[]}, + {"code":"try { Math.sumPrecise(5) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","for...of requires an iterable value, received a number."]},"log":[]}, + {"code":"try { AggregateError({}) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","for...of requires an iterable value, received a data object."]},"log":[]}, + {"code":"return [({}).toLocaleString(), Object.prototype.toLocaleString.call(5), Object.prototype.toLocaleString.call([1, [2]])]","outcome":{"ok":true,"value":["[object Object]","5","1,2"]},"log":[]}, + {"code":"try { return Object.prototype.toLocaleString.call({ toString: 7 }) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["TypeError","Object.prototype.toLocaleString.call is not a function."]},"log":[]}, + {"code":"const t = Promise.prototype.then; const log = []; Promise.prototype.then = function (f, r) { log.push('then'); return t.call(this, f, r) }\n const n = await hold({ query: 'echo' }).then((r) => r.items.length); Promise.prototype.then = t; return [n > 0, log]","outcome":{"ok":true,"value":[true,[]]},"log":[]}, + {"code":"const r = hold({ query: 'echo' }); return [await r.catch(() => 0) === r, await r.finally(5) !== r, (await r.finally(() => 1)).items.length > 0]","outcome":{"ok":true,"value":[false,true,true]},"log":[]}, + {"code":"const log = []; const p = send({ p: Promise.resolve(1), t: { toJSON() { log.push('tj'); Promise.resolve().then(() => log.push('then')); return 1 } } })\n Promise.resolve().then(() => log.push('job')); log.push('after'); const r = await p; return [r, log]","outcome":{"ok":true,"value":[{"p":1,"t":{}},["after","job"]]},"log":[["send",[{"object":[["p",1],["t",{"object":[]}]]}]]]}, + {"code":"const log = []; Promise.resolve().then(() => log.push('job')); return { t: { toJSON() { log.push('tj'); Promise.resolve().then(() => log.push('then')); return 1 } }, p: Promise.resolve(1), log }","outcome":{"ok":true,"value":{"t":1,"p":1,"log":["tj","job","then"]}},"log":[]}, + {"code":"Date.prototype.toJSON = () => 'mine'; return [await send({ d: new Date(0) }), await send({ d: new Date(0), p: Promise.resolve(1) })]","outcome":{"ok":true,"value":[{"d":"1970-01-01T00:00:00.000Z"},{"d":"1970-01-01T00:00:00.000Z","p":1}]},"log":[["send",[{"object":[["d",{"date":0}]]}]],["send",[{"object":[["d",{"date":0}],["p",1]]}]]]}, + {"code":"URL.prototype.toJSON = () => 'mine'; return [await send({ u: new URL('https://a.b/c') }), await send({ u: new URL('https://a.b/c'), p: Promise.resolve(1) })]","outcome":{"ok":true,"value":[{"u":"https://a.b/c"},{"u":"https://a.b/c","p":1}]},"log":[["send",[{"object":[["u",{"url":"https://a.b/c"}]]}]],["send",[{"object":[["u",{"url":"https://a.b/c"}],["p",1]]}]]]}, + {"code":"return hold({ query: { toJSON: () => 'echo' }, p: Promise.reject(new Error('no')) }).items.length","outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: no"},"log":[]}, + {"code":"return hold({ query: { toJSON: () => 'echo' }, p: Promise.resolve(1), q: { toJSON() { null.x } } }).items.length","outcome":{"ok":true,"value":1},"log":[]}, + {"code":"return [{ toJSON: () => 'echo' }].map((q) => hold.call(null, { query: q }).items.length)","outcome":{"ok":true,"value":[1]},"log":[]}, + {"code":"return await send({ a: { toJSON: Object.prototype.toString }, p: Promise.resolve(1) })","outcome":{"ok":true,"value":{"a":{},"p":1}},"log":[["send",[{"object":[["a",{"object":[]}],["p",1]]}]]]}, + {"code":"return await send({ a: { toJSON: () => send(1) } })","outcome":{"ok":true,"value":{"a":{}}},"log":[["send",[{"object":[["a",{"object":[]}]]}]]]}, + {"code":"const t = { toJSON(k) { return { k, n: { toJSON: (k2) => k2 + '!' } } } }; return [await send({ t, u: [t] }), await send({ t, p: Promise.resolve(1) }), hold({ query: 'echo', t }).items.length]","outcome":{"ok":true,"value":[{"t":{},"u":[{}]},{"t":{},"p":1},1]},"log":[["send",[{"object":[["t",{"object":[]}],["u",{"array":[{"object":[]}]}]]}]],["send",[{"object":[["t",{"object":[]}],["p",1]]}]]]}, + {"code":"return [{ t: { toJSON() { return Promise.resolve(5) } } }, await send({ t: { toJSON() { return Promise.resolve(5) } } })]","outcome":{"ok":true,"value":[{"t":{}},{"t":{}}]},"log":[["send",[{"object":[["t",{"object":[]}]]}]]]}, + {"code":"try { return [{ toJSON: () => 'echo' }].map((q) => hold.call(null, { query: q, p: Promise.resolve(1) }).items.length) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":[1]},"log":[]}, + {"code":"const log = []; const it = { [Symbol.iterator]() { return { next: () => ({ done: false, value: [Object.create({ toString() { throw new Error('ts') } }), 1] }), return: () => (log.push('closed'), {}) } } }\n try { Object.fromEntries(it) } catch (e) { log.push(e.message) } return log","outcome":{"ok":true,"value":["closed","ts"]},"log":[]}, + {"code":"const log = []; const it = { [Symbol.iterator]() { return { next: () => ({ done: false, value: [{ toString() { throw new Error('ts') } }, 'v'] }), return: () => (log.push('closed'), {}) } } }\n try { new URLSearchParams(it) } catch (e) { log.push(e.message) } try { new Headers(it) } catch (e) { log.push(e.message) } return log","outcome":{"ok":true,"value":["closed","ts","closed","ts"]},"log":[]}, + {"code":"const log = []; const key = (k) => Object.create({ toString() { log.push('ts ' + k); return k } }); const it = { [Symbol.iterator]() { let n = 0; return { next() { log.push('next ' + n); return n < 2 ? { done: false, value: [key('k' + n), n++] } : { done: true } } } } }\n return [Object.fromEntries(it), String(new URLSearchParams(it)), log]","outcome":{"ok":true,"value":[{"k0":0,"k1":1},"k0=0&k1=1",["next 0","ts k0","next 1","ts k1","next 2","next 0","ts k0","next 1","ts k1","next 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const r = []; for (const x of ({ [Symbol.iterator]() { S(0); let n = 0; return { next: () => ({ done: n >= 2, value: S(++n) + n }), return: () => (S(9), {}) } } })) r.push(x); return r })(); return [r, log]","outcome":{"ok":true,"value":[[2,3],["call 0","answer 0","call 1","answer 1","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const r = []; for (const x of ({ [Symbol.iterator]() { S(0); let n = 0; return { next: () => ({ done: n >= 2, value: S(++n) + n }), return: () => (S(9), {}) } } })) { r.push(x); break } return r })(); return [r, log]","outcome":{"ok":true,"value":[[2],["call 0","answer 0","call 1","answer 1","call 9","answer 9"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const [a] = ({ [Symbol.iterator]() { S(0); let n = 0; return { next: () => ({ done: n >= 2, value: S(++n) + n }), return: () => (S(9), {}) } } }); return a })(); return [r, log]","outcome":{"ok":true,"value":[2,["call 0","answer 0","call 1","answer 1","call 9","answer 9"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const [a, ...rest] = ({ [Symbol.iterator]() { S(0); let n = 0; return { next: () => ({ done: n >= 2, value: S(++n) + n }), return: () => (S(9), {}) } } }); return [a, rest] })(); return [r, log]","outcome":{"ok":true,"value":[[2,[3]],["call 0","answer 0","call 1","answer 1","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [...({ [Symbol.iterator]() { S(0); let n = 0; return { next: () => ({ done: n >= 2, value: S(++n) + n }), return: () => (S(9), {}) } } }), 7]; return [r, log]","outcome":{"ok":true,"value":[[2,3,7],["call 0","answer 0","call 1","answer 1","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = Math.max(...({ [Symbol.iterator]() { S(0); let n = 0; return { next: () => ({ done: n >= 2, value: S(++n) + n }), return: () => (S(9), {}) } } })); return [r, log]","outcome":{"ok":true,"value":[3,["call 0","answer 0","call 1","answer 1","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const it = { i: 0, next() { return { done: this.i > 1, value: S(++this.i) } }, [Symbol.iterator]() { return this } }; const r = []; for (const x of it) r.push(x); return r })(); return [r, log]","outcome":{"ok":true,"value":[[1,1],["call 1","answer 1","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const o = { valueOf: () => S(1) + 3, toString: () => 'x' + S(2) }; return ['a' + o, o * 2, o < 5, o == 4, `${o}`, -o, ~o] })(); return [r, log]","outcome":{"ok":true,"value":[["a4",8,true,true,"x1",-4,-5],["call 1","answer 1","call 1","answer 1","call 1","answer 1","call 1","answer 1","call 2","answer 2","call 1","answer 1","call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const o = { toString: () => 'k' + S(1) }; const m = {}; m[o] = 1; return [m, 'k1' in m, delete m[o], { [o]: 2 }] })(); return [r, log]","outcome":{"ok":true,"value":[[{},true,true,{"k1":2}],["call 1","answer 1","call 1","answer 1","call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const o = { valueOf: () => S(1) + 2 }; let x = o; x++; let s = 0; for (let i = 0; i < o; i++) s += i; return [x, s] })(); return [r, log]","outcome":{"ok":true,"value":[[4,3],["call 1","answer 1","call 1","answer 1","call 1","answer 1","call 1","answer 1","call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const o = { valueOf: () => S(1) + 3, toString: () => 'x' + S(2) }; return ['a'.padStart(o), String(o), Number(o), Math.max(o, 1), [1, 2, 3, 4].slice(o), [o, o].join('-')] })(); return [r, log]","outcome":{"ok":true,"value":[[" a","x1",4,4,[],"x1-x1"],["call 1","answer 1","call 2","answer 2","call 1","answer 1","call 1","answer 1","call 1","answer 1","call 2","answer 2","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { const d = new Date(0); const r = d.setSeconds({ valueOf: () => (S(1), d.setTime(5000), 7) }); return [r, d.getTime()] })(); return [r, log]","outcome":{"ok":true,"value":[[7000,7000],["call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [3, 1, 2].sort((a, b) => ({ valueOf: () => S(a) * 0 + a - b })); return [r, log]","outcome":{"ok":true,"value":[[1,2,3],["call 1","answer 1","call 3","answer 3","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = 'abc'.replace('b', () => ({ toString: () => 'X' + S(1) })); return [r, log]","outcome":{"ok":true,"value":["aX1c",["call 1","answer 1"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = [{ toLocaleString: () => ({ toString: () => 'T' + S(2) }) }].toLocaleString(); return [r, log]","outcome":{"ok":true,"value":["T1",["call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { function* g() { yield* { [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) }) } } } } return [...g()] })(); return [r, log]","outcome":{"ok":true,"value":[[1,1],["call 1","answer 1","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { function* inner() { try { yield 1 } finally { S(2) } } function* g() { yield* inner() } const a = g(); a.next(); return a.return(5) })(); return [r, log]","outcome":{"ok":true,"value":[{"value":5,"done":true},["call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = (() => { function* inner() { try { yield 1 } catch (e) { yield S(3) } } function* g() { yield* inner() } const a = g(); a.next(); return a.throw(1) })(); return [r, log]","outcome":{"ok":true,"value":[{"value":1,"done":false},["call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await (async () => { const r = []; function* g() { yield S(1); yield 2 } for await (const x of g()) r.push(x); return r })(); return [r, log]","outcome":{"ok":true,"value":[[1,2],["call 1","answer 1","job"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await (async () => { async function* ag() { yield* { [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) }) } } } } const r = []; for await (const x of ag()) r.push(x); return r })(); return [r, log]","outcome":{"ok":true,"value":[[1,1],["call 1","answer 1","job","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await (async () => { async function* ag() { yield S(1); const x = S(2); yield x } const r = []; for await (const x of ag()) r.push(x); return r })(); return [r, log]","outcome":{"ok":true,"value":[[1,1],["call 1","answer 1","job","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await (async () => { async function* ag() { yield S(1) } const it = ag(); return [await it.next(), await it.next()] })(); return [r, log]","outcome":{"ok":true,"value":[[{"value":1,"done":false},{"done":true}],["call 1","answer 1","job"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await (async () => { function* g() { try { yield 1; yield 2 } finally { S(9) } } const r = []; for await (const x of g()) { r.push(x); break } return r })(); return [r, log]","outcome":{"ok":true,"value":[[1],["job","call 9","answer 9"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await (async () => { function* g() { try { yield 1 } catch (e) { yield S(e) } } async function* ag() { yield* g() } const it = ag(); await it.next(); return it.throw(3) })(); return [r, log]","outcome":{"ok":true,"value":[{"value":1,"done":false},["job","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await (async () => { function* g() { try { yield 1 } finally { S(4) } } async function* ag() { yield* g() } const it = ag(); await it.next(); return it.return(7) })(); return [r, log]","outcome":{"ok":true,"value":[{"value":7,"done":true},["job","call 4","answer 4"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await (async () => { async function* ag() { function* g() { yield S(1); yield S(2) } yield* g() } const r = []; for await (const x of ag()) r.push(x); return r })(); return [r, log]","outcome":{"ok":true,"value":[[1,1],["call 1","answer 1","job","call 2","answer 2"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await (async () => { const r = []; for await (const x of { [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) + n }) } } }) r.push(x); return r })(); return [r, log]","outcome":{"ok":true,"value":[[2,3],["call 1","answer 1","job","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await (async () => { const r = []; const it = { n: 0, [Symbol.asyncIterator]() { S(0); return this }, next() { return Promise.resolve({ done: this.n > 1, value: S(++this.n) }) } }; for await (const x of it) r.push(x); return r })(); return [r, log]","outcome":{"ok":true,"value":[[1,1],["call 0","answer 0","call 1","answer 1","job","call 2","answer 2","call 3","answer 3"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await (async () => { const r = []; const it = { [Symbol.asyncIterator]() { return this }, next: async () => ({ done: false, value: S(1) }), return() { r.push('return ' + S(9)); return { done: true } } }; for await (const x of it) { r.push(x); break } return r })(); return [r, log]","outcome":{"ok":true,"value":[[1,"return 1"],["call 1","answer 1","job","call 9","answer 9"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await (async () => { const r = []; const src = { [Symbol.iterator]() { let n = 0; return { next: () => ({ done: false, value: S(++n) }), return: () => (r.push('ret ' + S(8)), {}) } } }; for await (const x of src) { r.push(x); break } return r })(); return [r, log]","outcome":{"ok":true,"value":[[1,"ret 1"],["call 1","answer 1","job","call 8","answer 8"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await (async () => { try { for await (const x of { [Symbol.iterator]: () => ({ next: () => { S(1); throw new Error('next threw') } }) }) {} } catch (e) { return e.message } })(); return [r, log]","outcome":{"ok":true,"value":["next threw",["call 1","answer 1","job"]]},"log":[]}, + {"code":"const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n }\n Promise.resolve().then(() => log.push('job')); const r = await (async () => { const it = { [Symbol.asyncIterator]() { return this }, next: async () => ({ done: false, value: S(1) }), return: async (v) => ({ done: true, value: S(2) + v }), throw: async (e) => ({ done: false, value: S(3) + e }) }; async function* g() { yield* it } const gen = g(); return [await gen.next(), await gen.throw(10), await gen.return(5), await gen.next()] })(); return [r, log]","outcome":{"ok":true,"value":[[{"value":1,"done":false},{"value":11,"done":false},{"value":6,"done":true},{"done":true}],["call 1","answer 1","job","call 3","answer 3","call 2","answer 2"]]},"log":[]}, + {"code":"const p = Promise.resolve(1); const { a, b = 5, [Symbol.iterator]: it, then } = p; let c; ({ c } = p); const f = ({ d }) => d; const r = []; for (const { e } of [p]) r.push(e); const [{ g }] = [p]; const o = {}; ({ h: o.h } = p); return [a, b, typeof it, typeof then, c, f(p), r, g, o]","outcome":{"ok":true,"value":[null,5,"undefined","function",null,null,[null],null,{}]},"log":[]}, + {"code":"const { a: { b } } = Promise.resolve(1)","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Cannot destructure undefined as it is undefined. (line 1, col 12)"},"log":[]}, + {"code":"const { a, ...r } = Promise.resolve(1)","outcome":{"ok":false,"kind":"InvalidDataValue","message":"TypeError: Object destructuring received an un-awaited Promise; await it before inspecting the result. (line 1, col 12)"},"log":[]}, + {"code":"const [x] = Promise.resolve(1)","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Array destructuring requires a supported iterable value. (line 1, col 7)"},"log":[]}, + {"code":"for (const [a] of [Promise.resolve(1)]) {}","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Array destructuring requires a supported iterable value. (line 1, col 12)"},"log":[]}, + {"code":"const { b: { c } } = { b: null }","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Cannot destructure null as it is null. (line 1, col 12)"},"log":[]}, + {"code":"const [[a]] = [Promise.resolve(1)]","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Array destructuring requires a supported iterable value. (line 1, col 8)"},"log":[]}, + {"code":"let o = null; ({ a: o.x } = { a: 1 })","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Cannot read properties of null (reading 'x'). (line 1, col 21)"},"log":[]}, + {"code":"const c = 1; [...c] = []","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Cannot assign to constant 'c'. (line 1, col 18)"},"log":[]}, + {"code":"const c = 1; ({ a: c } = { a: 1 })","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Cannot assign to constant 'c'. (line 1, col 20)"},"log":[]}, + {"code":"const { [{ toString() { return {} } }]: v } = {}","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Cannot convert object to primitive value. (line 1, col 10)"},"log":[]}, + {"code":"for (const k in Promise.resolve(1)) {}","outcome":{"ok":false,"kind":"InvalidDataValue","message":"TypeError: for...in received an un-awaited Promise; await it before inspecting the result. (line 1, col 17)"},"log":[]}, + {"code":"x: y: for (const a of 5) {}","outcome":{"ok":false,"kind":"InvalidDataValue","message":"TypeError: for...of requires an iterable value, received a number. (line 1, col 7)"},"log":[]}, + {"code":"const o = { a: 1, ...tools.git }","outcome":{"ok":false,"kind":"InvalidDataValue","message":"TypeError: Object spread cannot read tools: it is a namespace of host functions, not plain data. Use Object.keys(tools) for its names. (line 1, col 19)"},"log":[]}, + {"code":"const o = null; return (((o))).a","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Cannot read properties of null (reading 'a'). (line 1, col 27)"},"log":[]}, + {"code":"const o = Promise.resolve(1); (o).a = 1","outcome":{"ok":false,"kind":"InvalidDataValue","message":"TypeError: This value is an un-awaited Promise; await it first - e.g. `const result = await load(...)`. (line 1, col 32)"},"log":[]}, + {"code":"const o = null; delete (o)[0]","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Cannot read properties of null (reading '0'). (line 1, col 25)"},"log":[]}, + {"code":"return (tools.git)[(0)]","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: tools paths must use string property names. (line 1, col 21)"},"log":[]}, + {"code":"tools.git[Symbol.iterator] = 1","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: tools paths must use string property names. (line 1, col 11)"},"log":[]}, + {"code":"const o = {}; o[{ toString() { return {} } }] += 1","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Cannot convert object to primitive value. (line 1, col 17)"},"log":[]}, + {"code":"const o = {}; (o.f)()","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: o.f is not a function. (line 1, col 16)"},"log":[]}, + {"code":"return Promise.resolve(1) > 1","outcome":{"ok":false,"kind":"InvalidDataValue","message":"TypeError: Binary operators require data values. (line 1, col 8)"},"log":[]}, + {"code":"let x = Promise.resolve(1); x += 1","outcome":{"ok":false,"kind":"InvalidDataValue","message":"TypeError: Binary operators require data values. (line 1, col 29)"},"log":[]}, + {"code":"return `a${(({ toString() { return {} } }))}`","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Cannot convert object to primitive value. (line 1, col 14)"},"log":[]}, + {"code":"const x = 1; await send({ s: Symbol.iterator })","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Argument 1 to send contains a symbol, which cannot be passed to the host. (line 1, col 20)"},"log":[]}, + {"code":"let d = []; for (let i = 0; i < 300; i++) d = [d]; const p = send(1, d); await p","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Argument 2 to send exceeds the maximum value depth of 32. (line 1, col 62)"},"log":[]}, + {"code":"await import(\"z\")","outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: Cannot import \"z\": packages can't be installed here. (line 1, col 7)"},"log":[]}, + {"code":"tools.a += 1","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Only data fields may be assigned. (line 1, col 1)"},"log":[]}, + {"code":"tools.a ??= 1","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Only data fields may be assigned. (line 1, col 1)"},"log":[]}, + {"code":"tools.git[0]++","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: tools paths must use string property names. (line 1, col 11)"},"log":[]}, + {"code":"const s = \"abc\"; s.length += 1","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Only data fields may be assigned. (line 1, col 18)"},"log":[]}, + {"code":"const s = \"abc\"; s[0] = \"x\"","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Only data fields may be assigned. (line 1, col 18)"},"log":[]}, + {"code":"const o = null; o[(() => { console.log(\"key\"); return 1 })()] = console.log(\"value\")","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Cannot read properties of null (reading '1'). (line 1, col 17)"},"log":[]}, + {"code":"const o = null; o[{ toString() { console.log(\"converted\"); return \"a\" } }] += 1","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Cannot read properties of null (reading '[object Object]'). (line 1, col 17)"},"log":[]}, + {"code":"const p = Promise.resolve(1); p[(() => \"k\")()] = console.log(\"value\")","outcome":{"ok":false,"kind":"InvalidDataValue","message":"TypeError: This value is an un-awaited Promise; await it first - e.g. `const result = await load(...)`. (line 1, col 31)"},"log":[]}, + {"code":"y; let y = 1","outcome":{"ok":false,"kind":"ExecutionFailure","message":"ReferenceError: Cannot access 'y' before initialization. (line 1, col 1)"},"log":[]}, + {"code":"throw [tools]","outcome":{"ok":false,"kind":"ExecutionFailure","message":"Uncaught: a non-data value"},"log":[]}, + {"code":"throw { a: Promise.resolve(1) }","outcome":{"ok":false,"kind":"ExecutionFailure","message":"Uncaught: a non-data value"},"log":[]}, + {"code":"throw new Map([[1, 2]])","outcome":{"ok":false,"kind":"ExecutionFailure","message":"Uncaught: a non-data value"},"log":[]}, + {"code":"throw () => 1","outcome":{"ok":false,"kind":"ExecutionFailure","message":"Uncaught: a non-data value"},"log":[]}, + {"code":"throw new Date(0)","outcome":{"ok":false,"kind":"ExecutionFailure","message":"Uncaught: a non-data value"},"log":[]}, + {"code":"throw { a: [1, { b: \"x\" }] }","outcome":{"ok":false,"kind":"ExecutionFailure","message":"Uncaught: {\"a\":[1,{\"b\":\"x\"}]}"},"log":[]}, + {"code":"const f = (n) => f(n + 1); f(1)","outcome":{"ok":false,"kind":"ExecutionFailure","message":"RangeError: Maximum call stack size exceeded (line 1, col 18)"},"log":[]}, + {"code":"const f = () => [0].map(f); f()","outcome":{"ok":false,"kind":"ExecutionFailure","message":"RangeError: Maximum call stack size exceeded (line 1, col 17)"},"log":[]}, + {"code":"const r = (n) => (n > 1 ? r(n - 1) : n); r(10000); return r(10001)","outcome":{"ok":false,"kind":"ExecutionFailure","message":"RangeError: Maximum call stack size exceeded (line 1, col 27)"},"log":[]}, + {"code":"const log = []; function* g() { try { yield 1; yield 2 } finally { log.push('finally'); throw new Error('close') } }\n const r = []; try { for (const x of g()) { r.push(x); break } } catch (e) { r.push(e.message) }\n try { const [a] = g(); r.push(a) } catch (e) { r.push(e.message) }\n try { new Map([[1, 2]].values().map((x) => x)) } catch (e) { r.push(e.message) }\n try { Array.from(g(), (x) => { if (x === 1) throw new Error('mapper') }) } catch (e) { r.push(e.message) }\n return [r, log]","outcome":{"ok":true,"value":[[1,"close","close","mapper"],["finally","finally","finally"]]},"log":[]}, + {"code":"const it = { [Symbol.iterator]() { return { next: () => ({ done: false, value: 1 }), return: () => 5 } } }\n const r = []; try { for (const x of it) break } catch (e) { r.push(e.message) }\n try { const [a] = it } catch (e) { r.push(e.message) }\n try { for (const x of it) throw new Error('body') } catch (e) { r.push(e.message) }\n try { for (const x of { [Symbol.iterator]: () => ({ next: () => 5 }) }) {} } catch (e) { r.push(e.message) }\n try { [...{ [Symbol.iterator]: () => 5 }] } catch (e) { r.push(e.message) }\n try { for (const x of { [Symbol.iterator]: () => ({}) }) {} } catch (e) { r.push(e.message) }\n return r","outcome":{"ok":true,"value":["Iterator return() result must be an object.","Iterator return() result must be an object.","body","Iterator next() result must be an object.","Iterator method result must be an object.","Iterator next must be a function."]},"log":[]}, + {"code":"const o = { valueOf: () => ({}), toString: () => ({}) }; const r = []; for (const f of [() => o + 1, () => 'a'.padStart(o), () => String(o), () => [o].join(), () => Object.groupBy([1], () => o), () => [2, 1].sort(() => o)]) { try { f() } catch (e) { r.push(e.message) } } return r","outcome":{"ok":true,"value":["Cannot convert object to primitive value.","Cannot convert object to primitive value.","Cannot convert object to primitive value.","Cannot convert object to primitive value.","Cannot convert object to primitive value.","Cannot convert object to primitive value."]},"log":[]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const o = { valueOf() { return 1 }, toString() { return 'a' } }\n for (let j = 0; j < 300; j++) { o + 1; o < 2; o == 1; `${o}`; [o].join(); 'a'.padStart(o); String(o); Math.max(o, 0); const m = {}; m[o] = 1 }; const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const log = []; const it = { i: 0, [Symbol.iterator]() { return this }, next(v) { log.push('next ' + v); return { done: this.i > 1, value: ++this.i } }, return(v) { log.push('return ' + v); return { done: true, value: v * 2 } }, throw(e) { log.push('throw ' + e); return { done: false, value: e + 100 } } }; function* g() { const r = yield* it; log.push('r ' + r); return r } const out = []; for (const x of g()) out.push(x); it.i = 0; const gen = g(); out.push(gen.next(1), gen.next(2), gen.throw(3), gen.return(4), gen.next(5)); return [out, log]","outcome":{"ok":true,"value":[[1,2,{"value":1,"done":false},{"value":2,"done":false},{"value":103,"done":false},{"value":8,"done":true},{"done":true}],["next undefined","next undefined","next undefined","r 3","next undefined","next 2","throw 3","return 4"]]},"log":[]}, + {"code":"const log = []; function* inner() { try { yield 1; yield 2 } catch (e) { log.push('caught ' + e); yield 'c' } finally { log.push('inner finally') } return 'done' } function* g() { try { const r = yield* inner(); log.push('r ' + r); yield r } finally { log.push('outer finally') } } const a = g(); const b = g(); const c = g(); return [a.next(), a.return(7), a.next(), b.next(), b.throw(3), b.next(), b.next(), c.return(1), log]","outcome":{"ok":true,"value":[{"value":1,"done":false},{"value":7,"done":true},{"done":true},{"value":1,"done":false},{"value":"c","done":false},{"value":"done","done":false},{"done":true},{"value":1,"done":true},["inner finally","outer finally","caught 3","inner finally","r done","outer finally"]]},"log":[]}, + {"code":"const log = []; function* inner() { try { yield 1 } finally { log.push('f'); yield 'in finally' } } function* g() { const r = yield* inner(); return r } const a = g(); return [a.next(), a.return(9), a.next(), log]","outcome":{"ok":true,"value":[{"value":1,"done":false},{"value":"in finally","done":false},{"value":9,"done":true},["f"]]},"log":[]}, + {"code":"function* inner() { try { yield 1 } finally { throw new Error('from finally') } } function* g() { try { yield* inner() } catch (e) { yield 'caught ' + e.message } } const a = g(); a.next(); const b = g(); b.next(); return [a.return(1), a.next(), b.throw(new Error('x'))]","outcome":{"ok":true,"value":[{"value":"caught from finally","done":false},{"done":true},{"value":"caught from finally","done":false}]},"log":[]}, + {"code":"function* inner() { yield 1 } function* g() { yield* inner() } const a = g(); a.next(); try { a.throw(new Error('uncaught')) } catch (e) { return [e.message, a.next()] }","outcome":{"ok":true,"value":["uncaught",{"done":true}]},"log":[]}, + {"code":"const r = []; const bad = (o) => ({ [Symbol.iterator]() { return o } }); function* g(o) { yield* bad(o) } for (const o of [{ next: 5 }, { next: () => 5 }, { next: () => ({ value: 1, done: false }), throw: 5 }, { next: () => ({ value: 1, done: false }), return: () => 5 }, { next: () => ({ value: 1, done: false }) }]) { const it = g(o); try { r.push(it.next()); r.push(it.throw(1)) } catch (e) { r.push(e.message) } try { r.push(it.return(2)) } catch (e) { r.push(e.message) } } return r","outcome":{"ok":true,"value":["Iterator next must be a function.",{"value":2,"done":true},"Iterator next() result must be an object.",{"value":2,"done":true},{"value":1,"done":false},"Iterator throw must be a function.",{"value":2,"done":true},{"value":1,"done":false},"Iterator return() result must be an object.",{"value":2,"done":true},{"value":1,"done":false},"The delegated iterator does not provide a throw() method.",{"value":2,"done":true}]},"log":[]}, + {"code":"const log = []; const src = { [Symbol.iterator]() { return { next: () => ({ done: false, value: 1 }), return: () => { log.push('closed'); return {} } } } }; async function* g() { return yield* src } const gen = g(); await gen.next(); try { await gen.throw(4) } catch (e) { log.push(e.message) } return log","outcome":{"ok":true,"value":["closed","The delegated iterator does not provide a throw() method."]},"log":[]}, + {"code":"const log = []; const src = { [Symbol.iterator]() { return { next: () => ({ done: false, value: 1 }), return: () => 5 } } }; async function* g() { return yield* src } const gen = g(); await gen.next(); try { await gen.throw(4) } catch (e) { log.push(e.message) } return log","outcome":{"ok":true,"value":["Iterator return() result must be an object."]},"log":[]}, + {"code":"const log = []; const src = { [Symbol.iterator]() { return { next: (v) => ({ done: false, value: 'n' + v }), return: (v) => ({ done: true, value: 'r' + v }), throw: (e) => { throw new Error('t' + e) } } } }; async function* g() { return yield* src } const a = g(); const b = g(); return [await a.next(), await a.next(1), await a.return(2), await b.next(), await b.throw(3).catch((e) => e.message), log]","outcome":{"ok":true,"value":[{"value":"nundefined","done":false},{"value":"n1","done":false},{"value":"r2","done":true},{"value":"nundefined","done":false},"t3",[]]},"log":[]}, + {"code":"const r = []; async function f(src) { try { for await (const x of src) r.push(x) } catch (e) { r.push(e.message) } } await f({ [Symbol.asyncIterator]: () => 5 }); await f({ [Symbol.asyncIterator]: () => ({ next: 5 }) }); await f({ [Symbol.asyncIterator]: 5 }); await f({ [Symbol.iterator]: () => 5 }); await f({ [Symbol.iterator]: () => ({}) }); await f({ [Symbol.iterator]: () => ({ next: () => { throw new Error('next threw') } }) }); await f({ [Symbol.iterator]: () => ({ next: () => 5 }) }); await f({ [Symbol.asyncIterator]: () => ({ next: () => 5 }) }); return r","outcome":{"ok":true,"value":["Iterator method result must be an object.","Iterator next must be a function.","Iterator method must be a function.","Iterator method result must be an object.","Iterator next must be a function.","next threw","Iterator next() result must be an object.","Iterator next() result must be an object."]},"log":[]}, + {"code":"const r = []; const it = { [Symbol.asyncIterator]() { return this }, next: () => Promise.resolve({ done: false, value: 1 }), return: () => 5 }; try { for await (const x of it) break } catch (e) { r.push(e.message) } try { for await (const x of it) throw new Error('body') } catch (e) { r.push(e.message) } const sync = { [Symbol.iterator]: () => ({ next: () => ({ done: false, value: Promise.reject(new Error('rejected value')) }), return: () => { r.push('sync closed'); return {} } }) }; try { for await (const x of sync) r.push(x) } catch (e) { r.push(e.message) } return r","outcome":{"ok":true,"value":["Iterator return() result must be an object.","body","sync closed","rejected value"]},"log":[]}, + {"code":"async function* agen() { yield 1; yield 2 } const r = []; const it = { [Symbol.asyncIterator]: agen }; for await (const x of it) r.push(x); for await (const x of { [Symbol.iterator]: function* () { yield 3; yield Promise.resolve(4) } }) r.push(x); return r","outcome":{"ok":true,"value":[1,2,3,4]},"log":[]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const mk = () => ({ i: 0, [Symbol.iterator]() { return this }, next() { return { done: this.i++ > 1, value: 1 } }, return: (v) => ({ done: true, value: v }), throw: (e) => ({ done: false, value: e }) }); function* g() { yield* mk() } let closed = 0; function* inner() { try { yield 1 } finally { closed++ } } function* h() { yield* inner() }\n for (let j = 0; j < 100; j++) { for (const x of g()) {} const b = h(); b.next(); b.return(3) }; const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); function* inner() { yield 1 } function* g() { yield* inner() }\n for (let j = 0; j < 100; j++) { const a = g(); a.next(); try { a.throw(2) } catch {} }; const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); function* g() { yield 1 } function* h() { try { yield 1 } catch { yield 2 } }\n for (let j = 0; j < 100; j++) { const a = g(); a.next(); try { a.throw(1) } catch {} const b = h(); b.next(); b.throw(1) }; const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); function* g() { yield* [1, 2] } function* inner() { try { yield 1 } catch { yield 2 } } function* h() { yield* inner() }\n for (let j = 0; j < 100; j++) { const a = g(); a.next(); a.return(1); const b = g(); b.next(); try { b.throw(1) } catch {} const c = h(); c.next(); c.throw(1); c.next() }; const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); const it = { [Symbol.iterator]() { return this } }; it.next = function () { return { done: false, value: 1 } }.bind(it); it.throw = function (e) { return { done: false, value: e } }.bind(it); function* g() { yield* it }\n for (let j = 0; j < 100; j++) { const a = g(); a.next(); a.next(); a.throw(1) }; const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); async function* ag() { yield 1; yield 2 } function* gen() { yield 1; yield 2 }\n for (let j = 0; j < 100; j++) { for await (const x of ag()) break; for await (const x of gen()) break; try { for await (const x of gen()) throw 1 } catch {} }; const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let flip = -1; let k = 0\n const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x }\n const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true); function* inner() { try { yield 1; yield 2 } catch { yield 9 } } async function* g() { yield* inner() }\n for (let j = 0; j < 50; j++) { const a = g(); await a.next(); await a.return(3); const b = g(); await b.next(); await b.throw(3); await b.next() }; const p = r.text(); for (let i = 0; i < 30000; i++) see(i)\n await p.catch(() => 0); return flip","outcome":{"ok":true,"value":1},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"if (false) { class A {} } return 1","outcome":{"ok":true,"value":1},"log":[]}, + {"code":"console.log(1); class A {}; return 2","outcome":{"ok":true,"value":2,"logs":["1"]},"log":[]}, + {"code":"try { class A {} } catch (e) { return [e.name, e.message, e instanceof SyntaxError, Object.keys(e)] }","outcome":{"ok":true,"value":null},"log":[]}, + {"code":"return typeof A; class A {}","outcome":{"ok":false,"kind":"ExecutionFailure","message":"ReferenceError: Cannot access 'A' before initialization. (line 1, col 15)"},"log":[]}, + {"code":"return A; class A {}","outcome":{"ok":false,"kind":"ExecutionFailure","message":"ReferenceError: Cannot access 'A' before initialization. (line 1, col 8)"},"log":[]}, + {"code":"class Map {} return typeof Map","outcome":{"ok":true,"value":"function"},"log":[]}, + {"code":"const C = class {}; return 1","outcome":{"ok":true,"value":1},"log":[]}, + {"code":"function f() { class A {} } return typeof f","outcome":{"ok":true,"value":"function"},"log":[]}, + {"code":"function f() { return () => { with (x) {} } } return typeof f()","outcome":{"ok":true,"value":"function"},"log":[]}, + {"code":"function f() { return () => { with (x) {} } } f()()","outcome":{"ok":false,"kind":"UnsupportedSyntax","message":"SyntaxError: Syntax 'WithStatement' is not supported. This is a restricted JavaScript-like language. Supported: plain and async functions, data literals, destructuring, standard control flow, await and Promise, and built-ins such as Array, Object, Math, JSON, Date, RegExp, Map, Set, and URL. Unsupported: classes, BigInt, and custom Symbols. Use plain functions and data objects instead. (line 1, col 31)"},"log":[]}, + {"code":"console.log(\"a\"); with (o) {}","outcome":{"ok":false,"kind":"UnsupportedSyntax","message":"SyntaxError: Syntax 'WithStatement' is not supported. This is a restricted JavaScript-like language. Supported: plain and async functions, data literals, destructuring, standard control flow, await and Promise, and built-ins such as Array, Object, Math, JSON, Date, RegExp, Map, Set, and URL. Unsupported: classes, BigInt, and custom Symbols. Use plain functions and data objects instead. (line 1, col 19)"},"log":[]}, + {"code":"if (false) with (x) {}; return 1","outcome":{"ok":true,"value":1},"log":[]}, + {"code":"return x; with (o) { var x = 1 }","outcome":{"ok":false,"kind":"ExecutionFailure","message":"ReferenceError: Unknown identifier 'x'. (line 1, col 8)"},"log":[]}, + {"code":"var y = 2; with (o) { var y = 1 } return y","outcome":{"ok":false,"kind":"UnsupportedSyntax","message":"SyntaxError: Syntax 'WithStatement' is not supported. This is a restricted JavaScript-like language. Supported: plain and async functions, data literals, destructuring, standard control flow, await and Promise, and built-ins such as Array, Object, Math, JSON, Date, RegExp, Map, Set, and URL. Unsupported: classes, BigInt, and custom Symbols. Use plain functions and data objects instead. (line 1, col 12)"},"log":[]}, + {"code":"L: { class A {} } return 1","outcome":{"ok":true,"value":1},"log":[]}, + {"code":"switch (1) { case 2: class A {} } return 1","outcome":{"ok":true,"value":1},"log":[]}, + {"code":"switch (1) { case 1: class A {} } return 1","outcome":{"ok":true,"value":1},"log":[]}, + {"code":"debugger; return 1","outcome":{"ok":false,"kind":"UnsupportedSyntax","message":"SyntaxError: Syntax 'DebuggerStatement' is not supported. This is a restricted JavaScript-like language. Supported: plain and async functions, data literals, destructuring, standard control flow, await and Promise, and built-ins such as Array, Object, Math, JSON, Date, RegExp, Map, Set, and URL. Unsupported: classes, BigInt, and custom Symbols. Use plain functions and data objects instead. (line 1, col 1)"},"log":[]}, + {"code":"function f() { return new.target } return 1","outcome":{"ok":true,"value":1},"log":[]}, + {"code":"function f() { return new.target } return f()","outcome":{"ok":false,"kind":"UnsupportedSyntax","message":"SyntaxError: new.target is not supported. (line 1, col 23)"},"log":[]}, + {"code":"return import.meta","outcome":{"ok":false,"kind":"UnsupportedSyntax","message":"SyntaxError: new.target is not supported. (line 1, col 8)"},"log":[]}, + {"code":"const o = { m() { return super.x } }; return [typeof o.m, (() => { try { o.m() } catch (e) { return e.name } })()]","outcome":{"ok":true,"value":["function",null]},"log":[]}, + {"code":"const o = { m() { super.x = f() } }; function f() { console.log(\"f\") } return o.m()","outcome":{"ok":true,"value":null,"logs":["f"]},"log":[]}, + {"code":"const o = { m() { return super.m(console.log(\"arg\")) } }; return o.m()","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: The called value is not a function. (line 1, col 26)"},"log":[]}, + {"code":"const o = { m() { return delete super.x } }; return o.m()","outcome":{"ok":false,"kind":"ExecutionFailure","message":"ReferenceError: Unsupported reference to 'super'. (line 1, col 33)"},"log":[]}, + {"code":"const o = { m() { [super.x] = [1] } }; return o.m()","outcome":{"ok":false,"kind":"UnsupportedSyntax","message":"SyntaxError: Destructuring into super.x is not supported. (line 1, col 20)"},"log":[]}, + {"code":"const { x = class {} } = { x: 1 }; return x","outcome":{"ok":true,"value":1},"log":[]}, + {"code":"function f(a = class {}) { return a } return [f(1), (() => { try { f() } catch (e) { return e.name } })()]","outcome":{"ok":true,"value":[1,null]},"log":[]}, + {"code":"async function f() { await 1; class A {} } return await f().catch((e) => e.name)","outcome":{"ok":true,"value":null},"log":[]}, + {"code":"const r = await Promise.allSettled([Promise.resolve().then(() => { class A {} })]); return r[0].reason.name","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Cannot read properties of undefined (reading 'name'). (line 1, col 92)"},"log":[]}, + {"code":"const e = (() => { try { class A {} } catch (e) { return e } })(); throw e","outcome":{"ok":false,"kind":"ExecutionFailure","message":"Uncaught: undefined"},"log":[]}, + {"code":"{ export const x = 1 } return 1","outcome":{"ok":false,"kind":"UnsupportedSyntax","message":"SyntaxError: Syntax 'ExportNamedDeclaration' is not supported. This is a restricted JavaScript-like language. Supported: plain and async functions, data literals, destructuring, standard control flow, await and Promise, and built-ins such as Array, Object, Math, JSON, Date, RegExp, Map, Set, and URL. Unsupported: classes, BigInt, and custom Symbols. Use plain functions and data objects instead. (line 1, col 3)"},"log":[]}, + {"code":"if (true) { export default 1 }","outcome":{"ok":false,"kind":"UnsupportedSyntax","message":"SyntaxError: Syntax 'ExportDefaultDeclaration' is not supported. This is a restricted JavaScript-like language. Supported: plain and async functions, data literals, destructuring, standard control flow, await and Promise, and built-ins such as Array, Object, Math, JSON, Date, RegExp, Map, Set, and URL. Unsupported: classes, BigInt, and custom Symbols. Use plain functions and data objects instead. (line 1, col 13)"},"log":[]}, + {"code":"if (false) { export const y = 1 } return 1","outcome":{"ok":true,"value":1},"log":[]}, + {"code":"{ using x = { a: 1 }; await using y = 2; return [x.a, y] }","outcome":{"ok":true,"value":[1,2]},"log":[]}, + {"code":"{ using x = 1; x = 2 }","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Cannot assign to constant 'x'. (line 1, col 16)"},"log":[]}, + {"code":"{ import x from \"nope\" } return typeof x","outcome":{"ok":true,"value":"undefined"},"log":[]}, + {"code":"function f() { import x from \"fs\"; return 1 } return typeof f","outcome":{"ok":true,"value":"function"},"log":[]}, + {"code":"function f() { console.log(1); import x from \"fs\"; return 1 } return f()","outcome":{"ok":false,"kind":"ExecutionFailure","message":"SyntaxError: An import declaration may only appear at the top level of the program. (line 1, col 32)"},"log":[]}, + {"code":"import(\"fs\", { with: { type: \"json\" } }).then((m) => typeof m)","outcome":{"ok":false,"kind":"ExecutionFailure","message":"Error: Cannot import \"fs\": this runtime doesn't provide it. (line 1, col 1)"},"log":[]}, + {"code":"(x) = 1","outcome":{"ok":false,"kind":"ExecutionFailure","message":"ReferenceError: Unknown identifier 'x'. (line 1, col 2)"},"log":[]}, + {"code":"(x) += 1","outcome":{"ok":false,"kind":"ExecutionFailure","message":"ReferenceError: Unknown identifier 'x'. (line 1, col 2)"},"log":[]}, + {"code":"const a = 1; (a) = 2","outcome":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: Cannot assign to constant 'a'. (line 1, col 15)"},"log":[]}, + {"code":"++(x)","outcome":{"ok":false,"kind":"ExecutionFailure","message":"ReferenceError: Unknown identifier 'x'. (line 1, col 4)"},"log":[]}, + {"code":"(y) = 1; let y","outcome":{"ok":false,"kind":"ExecutionFailure","message":"ReferenceError: Cannot access 'y' before initialization. (line 1, col 2)"},"log":[]}, + {"code":"return 1 +","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 11)"},"log":[]}, + {"code":"let a; let a;","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Identifier 'a' has already been declared. Code must be plain JavaScript written as a program body. (line 1, col 12)"},"log":[]}, + {"code":"function f(a, a) { \"use strict\" }","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Argument name clash. Code must be plain JavaScript written as a program body. (line 1, col 15)"},"log":[]}, + {"code":"x = { __proto__: 1, \"__proto__\": 2 }","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Redefinition of __proto__ property. Code must be plain JavaScript written as a program body. (line 1, col 21)"},"log":[]}, + {"code":"const x","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 8)"},"log":[]}, + {"code":"let [a]","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Complex binding patterns require an initialization value. Code must be plain JavaScript written as a program body. (line 1, col 8)"},"log":[]}, + {"code":"let let = 1","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: let is disallowed as a lexically bound name. Code must be plain JavaScript written as a program body. (line 1, col 5)"},"log":[]}, + {"code":"\"use strict\"; var yield = 1","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: The keyword 'yield' is reserved. Code must be plain JavaScript written as a program body. (line 1, col 19)"},"log":[]}, + {"code":"\"use strict\"; delete x","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Deleting local variable in strict mode. Code must be plain JavaScript written as a program body. (line 1, col 15)"},"log":[]}, + {"code":"\"use strict\"; 010","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Invalid number. Code must be plain JavaScript written as a program body. (line 1, col 15)"},"log":[]}, + {"code":"\"use strict\"; \"\\01\"","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Octal literal in strict mode. Code must be plain JavaScript written as a program body. (line 1, col 16)"},"log":[]}, + {"code":"\"use strict\"; var eval = 1","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Binding eval in strict mode. Code must be plain JavaScript written as a program body. (line 1, col 19)"},"log":[]}, + {"code":"\"use strict\"; arguments = 1","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Assigning to arguments in strict mode. Code must be plain JavaScript written as a program body. (line 1, col 15)"},"log":[]}, + {"code":"var enum = 1","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: The keyword 'enum' is reserved. Code must be plain JavaScript written as a program body. (line 1, col 5)"},"log":[]}, + {"code":"function f(this) {}","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected keyword 'this'. Code must be plain JavaScript written as a program body. (line 1, col 12)"},"log":[]}, + {"code":"async function f() { var await }","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Cannot use 'await' as identifier inside an async function. Code must be plain JavaScript written as a program body. (line 1, col 26)"},"log":[]}, + {"code":"function* g() { var yield }","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Cannot use 'yield' as identifier inside a generator. Code must be plain JavaScript written as a program body. (line 1, col 21)"},"log":[]}, + {"code":"return /(/","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Invalid regular expression: /(/: Unterminated group. Code must be plain JavaScript written as a program body. (line 1, col 9)"},"log":[]}, + {"code":"return /a/gg","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Duplicate regular expression flag. Code must be plain JavaScript written as a program body. (line 1, col 9)"},"log":[]}, + {"code":"return /a/x","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Invalid regular expression flag. Code must be plain JavaScript written as a program body. (line 1, col 9)"},"log":[]}, + {"code":"return /(?.)(?.)/","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Invalid regular expression: /(?.)(?.)/: Duplicate capture group name. Code must be plain JavaScript written as a program body. (line 1, col 9)"},"log":[]}, + {"code":"return /\\p{Foo}/u","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Invalid regular expression: /\\p{Foo}/: Invalid property name. Code must be plain JavaScript written as a program body. (line 1, col 9)"},"log":[]}, + {"code":"return /[b-a]/","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Invalid regular expression: /[b-a]/: Range out of order in character class. Code must be plain JavaScript written as a program body. (line 1, col 9)"},"log":[]}, + {"code":"return /+/","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Invalid regular expression: /+/: Nothing to repeat. Code must be plain JavaScript written as a program body. (line 1, col 9)"},"log":[]}, + {"code":"return \"abc","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unterminated string constant. Code must be plain JavaScript written as a program body. (line 1, col 8)"},"log":[]}, + {"code":"return `abc","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unterminated template. Code must be plain JavaScript written as a program body. (line 1, col 9)"},"log":[]}, + {"code":"/* unclosed","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unterminated comment. Code must be plain JavaScript written as a program body. (line 1, col 1)"},"log":[]}, + {"code":"return 1__0","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Numeric separator must be exactly one underscore. Code must be plain JavaScript written as a program body. (line 1, col 10)"},"log":[]}, + {"code":"return 1_","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Numeric separator is not allowed at the last of digits. Code must be plain JavaScript written as a program body. (line 1, col 9)"},"log":[]}, + {"code":"return 0x_1","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Numeric separator is not allowed at the first of digits. Code must be plain JavaScript written as a program body. (line 1, col 10)"},"log":[]}, + {"code":"return 0x","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Expected number in radix 16. Code must be plain JavaScript written as a program body. (line 1, col 10)"},"log":[]}, + {"code":"return 1e","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Invalid number. Code must be plain JavaScript written as a program body. (line 1, col 8)"},"log":[]}, + {"code":"return 3in []","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Identifier directly after number. Code must be plain JavaScript written as a program body. (line 1, col 9)"},"log":[]}, + {"code":"return 0b2","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Expected number in radix 2. Code must be plain JavaScript written as a program body. (line 1, col 10)"},"log":[]}, + {"code":"return \"\\u{110000}\"","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Code point out of bounds. Code must be plain JavaScript written as a program body. (line 1, col 12)"},"log":[]}, + {"code":"return \"\\x4\"","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Bad character escape sequence. Code must be plain JavaScript written as a program body. (line 1, col 11)"},"log":[]}, + {"code":"({ a = 1 })","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Shorthand property assignments are valid only in destructuring patterns. Code must be plain JavaScript written as a program body. (line 1, col 6)"},"log":[]}, + {"code":"({ get a(x) {} })","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: getter should have no params. Code must be plain JavaScript written as a program body. (line 1, col 9)"},"log":[]}, + {"code":"({ set a() {} })","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: setter should have exactly one param. Code must be plain JavaScript written as a program body. (line 1, col 9)"},"log":[]}, + {"code":"({ set a(...x) {} })","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Setter cannot use rest params. Code must be plain JavaScript written as a program body. (line 1, col 10)"},"log":[]}, + {"code":"x = 1 + (a || b ?? c)","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses. Code must be plain JavaScript written as a program body. (line 1, col 17)"},"log":[]}, + {"code":"try {}","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Missing catch or finally clause. Code must be plain JavaScript written as a program body. (line 1, col 1)"},"log":[]}, + {"code":"switch (1) { default: default: }","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Multiple default clauses. Code must be plain JavaScript written as a program body. (line 1, col 23)"},"log":[]}, + {"code":"break","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unsyntactic break. Code must be plain JavaScript written as a program body. (line 1, col 1)"},"log":[]}, + {"code":"continue","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unsyntactic continue. Code must be plain JavaScript written as a program body. (line 1, col 1)"},"log":[]}, + {"code":"L: L: ;","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Label 'L' is already declared. Code must be plain JavaScript written as a program body. (line 1, col 4)"},"log":[]}, + {"code":"L: { break M }","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unsyntactic break. Code must be plain JavaScript written as a program body. (line 1, col 6)"},"log":[]}, + {"code":"while (1) { continue L }","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unsyntactic continue. Code must be plain JavaScript written as a program body. (line 1, col 13)"},"log":[]}, + {"code":"L: { continue L }","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unsyntactic continue. Code must be plain JavaScript written as a program body. (line 1, col 6)"},"log":[]}, + {"code":"function f() { yield 1 }","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 22)"},"log":[]}, + {"code":"() => { await 1 }","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 15)"},"log":[]}, + {"code":"new a?.b()","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Optional chaining cannot appear in the callee of new expressions. Code must be plain JavaScript written as a program body. (line 1, col 6)"},"log":[]}, + {"code":"a?.b`x`","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Optional chaining cannot appear in the tag of tagged template expressions. Code must be plain JavaScript written as a program body. (line 1, col 5)"},"log":[]}, + {"code":"import.metax","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: The only valid meta property for import is 'import.meta'. Code must be plain JavaScript written as a program body. (line 1, col 8)"},"log":[]}, + {"code":"new.foo","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: The only valid meta property for new is 'new.target'. Code must be plain JavaScript written as a program body. (line 1, col 5)"},"log":[]}, + {"code":"new.target","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: 'new.target' can only be used in functions and class static block. Code must be plain JavaScript written as a program body. (line 1, col 1)"},"log":[]}, + {"code":"const f = () => new.target","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: 'new.target' can only be used in functions and class static block. Code must be plain JavaScript written as a program body. (line 1, col 17)"},"log":[]}, + {"code":"super.x","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: 'super' keyword outside a method. Code must be plain JavaScript written as a program body. (line 1, col 1)"},"log":[]}, + {"code":"super()","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: 'super' keyword outside a method. Code must be plain JavaScript written as a program body. (line 1, col 1)"},"log":[]}, + {"code":"const o = { m() { super() } }","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: super() call outside constructor of a subclass. Code must be plain JavaScript written as a program body. (line 1, col 19)"},"log":[]}, + {"code":"var a = 1; let a = 2","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Identifier 'a' has already been declared. Code must be plain JavaScript written as a program body. (line 1, col 16)"},"log":[]}, + {"code":"try {} catch ([e, e]) {}","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Identifier 'e' has already been declared. Code must be plain JavaScript written as a program body. (line 1, col 19)"},"log":[]}, + {"code":"for (let a of [], b) {}","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 17)"},"log":[]}, + {"code":"for (let x = 1 of []) {}","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: for-of loop variable declaration may not have an initializer. Code must be plain JavaScript written as a program body. (line 1, col 6)"},"log":[]}, + {"code":"for (let x = 1, y of []) {}","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 19)"},"log":[]}, + {"code":"for (async of x) {}","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 15)"},"log":[]}, + {"code":"for (let.x of y) {}","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: The left-hand side of a for-of loop may not start with 'let'. Code must be plain JavaScript written as a program body. (line 1, col 6)"},"log":[]}, + {"code":"\"use strict\"; if (1) function f() {}","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 22)"},"log":[]}, + {"code":"L: function* g() {}","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 12)"},"log":[]}, + {"code":"L: class A {}","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 4)"},"log":[]}, + {"code":"if (1) const x = 1","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 8)"},"log":[]}, + {"code":"if (1) using x = null","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Using declaration cannot appear in the top level when source type is `script` or in the bare case statement. Code must be plain JavaScript written as a program body. (line 1, col 8)"},"log":[]}, + {"code":"(a, ...b,) => 1","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Comma is not permitted after the rest element. Code must be plain JavaScript written as a program body. (line 1, col 9)"},"log":[]}, + {"code":"function f(...a = 1) {}","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 17)"},"log":[]}, + {"code":"let {...{a}} = b","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 9)"},"log":[]}, + {"code":"function f(a = 1) { \"use strict\" }","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list. Code must be plain JavaScript written as a program body. (line 1, col 1)"},"log":[]}, + {"code":"[a] => 1","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 5)"},"log":[]}, + {"code":"({a}) = 1","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Assigning to rvalue. Code must be plain JavaScript written as a program body. (line 1, col 1)"},"log":[]}, + {"code":"a?.b = 1","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Optional chaining cannot appear in left-hand side. Code must be plain JavaScript written as a program body. (line 1, col 1)"},"log":[]}, + {"code":"\"use strict\"; with (x) {}","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: 'with' in strict mode. Code must be plain JavaScript written as a program body. (line 1, col 15)"},"log":[]}, + {"code":"using x = null","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Using declaration cannot appear in the top level when source type is `script` or in the bare case statement. Code must be plain JavaScript written as a program body. (line 1, col 1)"},"log":[]}, + {"code":"switch (1) { case 1: using x = 1 }","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Using declaration cannot appear in the top level when source type is `script` or in the bare case statement. Code must be plain JavaScript written as a program body. (line 1, col 22)"},"log":[]}, + {"code":"{ using x = 1, y }","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Missing initializer in using declaration. Code must be plain JavaScript written as a program body. (line 1, col 17)"},"log":[]}, + {"code":"let x; [x.#y] = []","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Private class members (#name) are not supported. Use a regular property instead. (line 1, col 11)"},"log":[]}, + {"code":"class A { constructor() {} constructor() {} }","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Duplicate constructor in the same class. Code must be plain JavaScript written as a program body. (line 1, col 28)"},"log":[]}, + {"code":"class A { m() { delete this.#a } }","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Private fields can not be deleted. Code must be plain JavaScript written as a program body. (line 1, col 17)"},"log":[]}, + {"code":"import()","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 8)"},"log":[]}, + {"code":"import(...a)","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 8)"},"log":[]}, + {"code":"let x: number = 1","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 6)"},"log":[]}, + {"code":"type T = number","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 6)"},"log":[]}, + {"code":"enum E { A }","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: The keyword 'enum' is reserved. Code must be plain JavaScript written as a program body. (line 1, col 1)"},"log":[]}, + {"code":"const x = 1","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 11)"},"log":[]}, + {"code":"const x = y as number","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. (line 1, col 13)"},"log":[]}, + {"code":"export const x = 1","outcome":{"ok":false,"kind":"ParseError","message":"SyntaxError: Exports aren't available. Return the result instead. (line 1, col 1)"},"log":[]}, + {"code":" ","outcome":{"ok":false,"kind":"ParseError","message":"Code cannot be empty."},"log":[]}, + {"code":"return await send({ f() {}, a: [1, () => 2, { g: () => 3 }], m: new Map([['k', () => 1]]), s: new Set([() => 1, 2]), n: { h: Math.max, t: tools.echo, b: (() => 1).bind(null) } })","outcome":{"ok":true,"value":{"a":[1,null,{}],"m":{},"s":[null,2],"n":{}}},"log":[["send",[{"object":[["a",{"array":[1,null,{"object":[]}]}],["m",{"map":[["k",{"undefined":true}]]}],["s",{"set":[{"undefined":true},2]}],["n",{"object":[]}]]}]]]}, + {"code":"return [await send(() => 1), await send(1, () => 2).catch((e) => [e.name, e.message])]","outcome":{"ok":true,"value":[null,1]},"log":[["send",[{"undefined":true}]],["send",[1,{"undefined":true}]]]}, + {"code":"const slow = (v, n = 2) => (async () => { for (let i = 0; i < n; i++) await null; return v })(); return await send({ a: Promise.resolve(1), b: [slow(2), Promise.resolve(3)], c: new Set([slow(4)]), d: new Map([[slow('k'), slow('v')]]), e: { f: { g: slow(5, 3) } } })","outcome":{"ok":true,"value":{"a":1,"b":[2,3],"c":[4],"d":{},"e":{"f":{"g":5}}}},"log":[["send",[{"object":[["a",1],["b",{"array":[2,3]}],["c",{"set":[4]}],["d",{"map":[["k","v"]]}],["e",{"object":[["f",{"object":[["g",5]]}]]}]]}]]]}, + {"code":"return await send((async () => { await null; return { x: 1, f: () => 1 } })())","outcome":{"ok":true,"value":{"x":1}},"log":[["send",[{"object":[["x",1]]}]]]}, + {"code":"return await send([1, [Promise.reject(new RangeError('deep'))]]).catch((e) => [e.name, e.message])","outcome":{"ok":true,"value":["RangeError","deep"]},"log":[]}, + {"code":"const late = (async () => { await null; throw new TypeError('late') })(); return await send({ late, ok: Promise.resolve(1) }).catch((e) => [e.name, e.message])","outcome":{"ok":true,"value":["TypeError","late"]},"log":[]}, + {"code":"const slow = (v, n = 2) => (async () => { for (let i = 0; i < n; i++) await null; return v })(); const no = (async () => { await null; throw new Error('first') })(); return await send([no, slow(1, 4)]).catch((e) => e.message)","outcome":{"ok":true,"value":"first"},"log":[]}, + {"code":"const inner = (async () => { await null; return 'in' })(); const outer = (async () => { await null; return { inner, deeper: (async () => { await null; await null; return [inner] })() } })(); return await send({ outer })","outcome":{"ok":true,"value":{"outer":{"inner":"in","deeper":["in"]}}},"log":[["send",[{"object":[["outer",{"object":[["inner","in"],["deeper",{"array":["in"]}]]}]]}]]]}, + {"code":"return await send({ p: Promise.resolve(() => 1), q: (async () => { await null; return () => 2 })(), r: [Promise.resolve(() => 3)], s: new Set([Promise.resolve(() => 4)]) })","outcome":{"ok":true,"value":{"r":[null],"s":[null]}},"log":[["send",[{"object":[["r",{"array":[null]}],["s",{"set":[{"undefined":true}]}]]}]]]}, + {"code":"const o = { n: 1 }; o.p = Promise.resolve(o); return await send(o).catch((e) => [e.name, e.message])","outcome":{"ok":true,"value":["TypeError","Argument 1 to send contains a circular value."]},"log":[]}, + {"code":"const o = { n: 1 }; o.p = (async () => { await null; return o })(); return await send(o).catch((e) => [e.name, e.message])","outcome":{"ok":true,"value":["TypeError","Argument 1 to send contains a circular value."]},"log":[]}, + {"code":"const p = Promise.resolve({ v: 1 }); return await send({ a: p, b: [p, p] })","outcome":{"ok":true,"value":{"a":{"v":1},"b":[{"v":1},{"v":1}]}},"log":[["send",[{"object":[["a",{"object":[["v",1]]}],["b",{"array":[{"object":[["v",1]]},{"object":[["v",1]]}]}]]}]]]}, + {"code":"let o = 1; for (let i = 0; i < 31; i++) o = { o }; const a = await send(Promise.resolve(o)).then(() => 'ok', (e) => e.message); const b = await send({ p: Promise.resolve(o) }).then(() => 'ok', (e) => e.message); return [a, b]","outcome":{"ok":true,"value":["ok","Argument 1 to send exceeds the maximum value depth of 32."]},"log":[["send",[{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",1]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]]}, + {"code":"return await send({ d: new Date(0), bad: new Date(NaN), u: new URL('https://a.test/p?q=1#h'), q: new URLSearchParams('a=1&b=2'), h: new Headers({ B: '2', a: '1' }), m: new Map([[1, 2]]), s: new Set([1, 'x', { y: 1 }]), r: /x/g, w: new WeakMap(), n: [NaN, Infinity, -0], args: (function () { return arguments })(1, 2) })","outcome":{"ok":true,"value":{"d":"1970-01-01T00:00:00.000Z","bad":null,"u":"https://a.test/p?q=1#h","q":"a=1&b=2","h":{"a":"1","b":"2"},"m":{},"s":[1,"x",{"y":1}],"r":{},"w":{},"n":[null,null,0],"args":{"0":1,"1":2}}},"log":[["send",[{"object":[["d",{"date":0}],["bad",{"date":"NaN"}],["u",{"url":"https://a.test/p?q=1#h"}],["q",{"params":[["a","1"],["b","2"]]}],["h",{"headers":[["a","1"],["b","2"]]}],["m",{"map":[[1,2]]}],["s",{"set":[1,"x",{"object":[["y",1]]}]}],["r",{"regexp":["x","g"]}],["w",{"object":[]}],["n",{"array":[{"number":"NaN"},{"number":"Infinity"},0]}],["args",{"object":[["0",1],["1",2]]}]]}]]]}, + {"code":"Date.prototype.toJSON = () => 'nope'; URL.prototype.toJSON = () => 'no'; const d = new Date(0); d.toJSON = () => 'own'; return await send({ d, u: new URL('https://a.test/'), o: { toJSON: () => 'x', v: 1 } })","outcome":{"ok":true,"value":{"d":"1970-01-01T00:00:00.000Z","u":"https://a.test/","o":{"v":1}}},"log":[["send",[{"object":[["d",{"date":0}],["u",{"url":"https://a.test/"}],["o",{"object":[["v",1]]}]]}]]]}, + {"code":"const e = new TypeError('bad', { cause: new Error('root') }); e.code = 7; e.fn = () => 1; e.later = (async () => { await null; return 8 })(); return await send({ e, c: Object.assign(new Error('m'), { name: 'Custom', extra: 1 }), a: new AggregateError([1], 'agg'), u: new URIError('u') })","outcome":{"ok":true,"value":{"e":{"name":"TypeError","message":"bad","code":7,"later":8},"c":{"name":"Custom","message":"m","extra":1},"a":{"name":"AggregateError","message":"agg"},"u":{"name":"URIError","message":"u"}}},"log":[["send",[{"object":[["e",{"error":{"name":"TypeError","message":"bad","cause":{"error":{"name":"Error","message":"root","fields":[]}},"fields":[["code",7],["later",8]]}}],["c",{"error":{"name":"Custom","message":"m","fields":[["name","Custom"],["extra",1]]}}],["a",{"error":{"name":"AggregateError","message":"agg","fields":[]}}],["u",{"error":{"name":"URIError","message":"u","fields":[]}}]]}]]]}, + {"code":"const e = new Error('m'); e.bad = Symbol.iterator; e.deep = [Symbol.asyncIterator]; e.ok = 1; return await send({ e })","outcome":{"ok":true,"value":{"e":{"name":"Error","message":"m","ok":1}}},"log":[["send",[{"object":[["e",{"error":{"name":"Error","message":"m","fields":[["ok",1]]}}]]}]]]}, + {"code":"return await send({ b: Buffer.from('hi') }).catch((e) => [e.name, e.message])","outcome":{"ok":true,"value":{"b":{"type":"Buffer","data":[104,105]}}},"log":[["send",[{"object":[["b",{"buffer":[104,105]}]]}]]]}, + {"code":"return await tools.nope({ b: new Uint8Array(1) }).catch((e) => e.message)","outcome":{"ok":true,"value":"No function at tools.nope."},"log":[]}, + {"code":"return await send({ b: new Uint8Array(1), p: (async () => { await null; return 1 })() }).catch((e) => [e.name, e.message])","outcome":{"ok":false,"kind":"InvalidDataValue","message":"TypeError: A Uint8Array cannot cross to the host; pass text instead, e.g. `new TextDecoder().decode(bytes)` or `bytes.toBase64()`."},"log":[["send",[{"object":[["b",{"bytes":[0]}],["p",1]]}]]]}, + {"code":"return await send({ s: Symbol.iterator, b: new Uint8Array(1) }).catch((e) => [e.name, e.message])","outcome":{"ok":true,"value":["TypeError","Argument 1 to send contains a symbol, which cannot be passed to the host."]},"log":[]}, + {"code":"return await Promise.all([send({ s: Symbol.iterator }), send({ t: tools }), send({ g: (function* () {})() }), send({ i: [1].values() })].map((p) => p.catch((e) => e.message)))","outcome":{"ok":true,"value":["Argument 1 to send contains a symbol, which cannot be passed to the host.","Argument 1 to send contains a namespace reference, which cannot be passed to the host.","Argument 1 to send contains a generator, which cannot be passed to the host.","Argument 1 to send contains an iterator, which cannot be passed to the host."]},"log":[]}, + {"code":"let o = 1; for (let i = 0; i < 32; i++) o = { o }; const a = await send(o).then(() => 'ok', (e) => e.message); const b = await send({ o }).then(() => 'ok', (e) => e.message); return [a, b]","outcome":{"ok":true,"value":["ok","Argument 1 to send exceeds the maximum value depth of 32."]},"log":[["send",[{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",{"object":[["o",1]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]}]]]}, + {"code":"const log = []; Promise.resolve().then(() => log.push('job1')); const a = send({ n: 'waits', p: (async () => { log.push('in'); await null; log.push('resolved'); return 1 })() }); const b = send({ n: 'now' }); Promise.resolve().then(() => log.push('job2')); await Promise.all([a, b]); return log","outcome":{"ok":true,"value":["in","job1","resolved","job2"]},"log":[["send",[{"object":[["n","now"]]}]],["send",[{"object":[["n","waits"],["p",1]]}]]]}, + {"code":"const log = []; const mk = (v, n) => (async () => { for (let i = 0; i < n; i++) await null; log.push(v); return v })()\n Promise.resolve().then(() => log.push('j1')).then(() => log.push('j2')).then(() => log.push('j3')).then(() => log.push('j4')).then(() => log.push('j5')).then(() => log.push('j6')).then(() => log.push('j7'))\n const r = send([mk('a', 3), mk('b', 1), mk('c', 2)]); r.then(() => log.push('settled')); await r; log.push('done'); return log","outcome":{"ok":true,"value":["j1","b","j2","c","j3","a","j4","j5","j6","j7","settled","done"]},"log":[["send",[{"array":["a","b","c"]}]]]}, + {"code":"const log = []; const mk = (v, n) => (async () => { for (let i = 0; i < n; i++) await null; log.push(v); return v })()\n Promise.resolve().then(() => log.push('j1')).then(() => log.push('j2')).then(() => log.push('j3')).then(() => log.push('j4')).then(() => log.push('j5'))\n const v = echo([mk('a', 2), mk('b', 1)]); log.push('echoed'); return [v, log]","outcome":{"ok":true,"value":[["a","b"],["j1","b","j2","a","j3","j4","echoed"]]},"log":[]}, + {"code":"return hold({ query: 'echo', fn: () => 1 }).items.length","outcome":{"ok":true,"value":1},"log":[]}, + {"code":"return hold((async () => { await null; return 'echo' })()).items.length","outcome":{"ok":true,"value":1},"log":[]}, + {"code":"async function f() { return hold({ query: (async () => { await null; return 'echo' })() }).items.length } const p = f(); return [typeof p.then, await p]","outcome":{"ok":true,"value":["function",1]},"log":[]}, + {"code":"try { hold({ query: (async () => { await null; throw new Error('late') })() }) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["Error","late"]},"log":[]}, + {"code":"try { hold({ query: new Uint8Array(1) }) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":null},"log":[]}, + {"code":"return [hold({ query: new Date(0) }).items.length, hold({ query: { toJSON: () => 'echo' } }).items.length]","outcome":{"ok":true,"value":[1,1]},"log":[]}, + {"code":"return await send({ query: (async () => { await null; return 'echo' })() }).then((r) => r.query)","outcome":{"ok":true,"value":"echo"},"log":[["send",[{"object":[["query","echo"]]}]]]}, + {"code":"const r = echo({ f() {}, a: [() => 1, 2], m: new Map([['k', () => 1]]), s: new Set([() => 1]) }); return [Object.keys(r), r.a, [...r.m], [...r.s]]","outcome":{"ok":true,"value":[["a","m","s"],[null,2],[["k",null]],[null]]},"log":[]}, + {"code":"const slow = (v, n = 2) => (async () => { for (let i = 0; i < n; i++) await null; return v })(); const s = slow('slow'); return echo({ p: Promise.resolve(1), q: s, l: [s] })","outcome":{"ok":true,"value":{"p":1,"q":"slow","l":["slow"]}},"log":[]}, + {"code":"return [echo(Promise.resolve(5)), echo((async () => { await null; return 6 })()), echo(() => 1) === undefined]","outcome":{"ok":true,"value":[5,6,true]},"log":[]}, + {"code":"try { echo({ p: Promise.reject(new Error('x')) }) } catch (e) { return [e.name, e.message] }","outcome":{"ok":true,"value":["Error","x"]},"log":[]}, + {"code":"return [1, 2].map((x) => echo({ v: (async () => { await null; return x })() }))","outcome":{"ok":true,"value":[{"v":1},{"v":2}]},"log":[]}, + {"code":"function* g() { yield echo((async () => { await null; return 1 })()); yield 2 } return [...g()]","outcome":{"ok":true,"value":[1,2]},"log":[]}, + {"code":"const log = []; async function f() { log.push('f'); const v = echo((async () => { await null; return 1 })()); log.push('echoed'); return v } const p = f(); log.push('after'); return [await p, log]","outcome":{"ok":true,"value":[1,["f","after","echoed"]]},"log":[]}, + {"code":"const r = await fetch((async () => { await null; return {\"chunks\":[\"a\",\"b\"]} })()); return await r.text()","outcome":{"ok":true,"value":"ab"},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"return await fetch(Promise.reject(new Error('no'))).catch((e) => e.message)","outcome":{"ok":true,"value":"no"},"log":[]}, + {"code":"let threw = false; let p; try { p = fetch({ s: Symbol.iterator }) } catch { threw = true } return [threw, await p.then(() => 'ok', (e) => [e.name, e.message])]","outcome":{"ok":true,"value":[false,["TypeError","Argument 1 to fetch contains a symbol, which cannot be passed to the host."]]},"log":[]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const f = echo(r.text); return [typeof f, f === r.text, f.name, await f()]","outcome":{"ok":true,"value":["function",false,"","hello"]},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const o = echo({ t: r.text, list: [r.json], m: new Map([['k', r.bytes]]) }); return [typeof o.t, typeof o.list[0], typeof o.m.get('k'), await o.t()]","outcome":{"ok":true,"value":["function","function","function","hello"]},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); return await send({ t: r.text, s: r.status, b: r.body })","outcome":{"ok":true,"value":{"s":201,"b":{}}},"log":[["send",[{"object":[["s",201],["b",{"object":[]}]]}]],["pull",0]]}, + {"code":"return [echo(echo), echo({ e: echo, f: fetch })]","outcome":{"ok":true,"value":[null,{}]},"log":[]}, + {"code":"try { await tools.nope({}) } catch (e) { return e.message }","outcome":{"ok":true,"value":"No function at tools.nope."},"log":[]}, + {"code":"return await tools.nope({}).catch((e) => e.message)","outcome":{"ok":true,"value":"No function at tools.nope."},"log":[]}, + {"code":"const settled = await Promise.allSettled([send({}), tools.nope({})]); return settled.map((r) => r.status)","outcome":{"ok":true,"value":["fulfilled","rejected"]},"log":[["send",[{"object":[]}]]]}, + {"code":"return await tools.git({}).catch((e) => e.message)","outcome":{"ok":true,"value":"No function at tools.git."},"log":[]}, + {"code":"return await tools.ech({})","outcome":{"ok":false,"kind":"NotFound","message":"No function at tools.ech."},"log":[]}, + {"code":"return [typeof tools.nope, Object.keys(tools.git)]","outcome":{"ok":true,"value":["function",["status"]]},"log":[]}, + {"code":"const p = tools.nope({}); return typeof p.then","outcome":{"ok":true,"value":"function"},"log":[]}, + {"code":"return await tools.nope({ p: (async () => { await null; return 1 })() }).catch((e) => e.message)","outcome":{"ok":true,"value":"No function at tools.nope."},"log":[]}, + {"code":"return await tools.nope({ s: Symbol.iterator }).catch((e) => [e.name, e.message])","outcome":{"ok":true,"value":["TypeError","Argument 1 to tools.nope contains a symbol, which cannot be passed to the host."]},"log":[]} + ], + "suspensions": [ + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); await wait({}); return [r.status, r.bodyUsed]","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: The function get bodyUsed came from the host and was lost when the run was suspended; get it again after resuming. (line 1, col 169)"},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const t = await r.text(); await wait({}); return t","suspend":{"ok":true},"resume":{"ok":true,"value":"hello"},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const s = r.status; const h = r.headers; await wait({}); return [s, h.get(\"x-a\")]","suspend":{"ok":true},"resume":{"ok":true,"value":[201,"1"]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const { status, statusText } = r; await wait({}); return [status, statusText]","suspend":{"ok":true},"resume":{"ok":true,"value":[201,"Created"]},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const text = r.text; await wait({}); return await text()","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: The function (anonymous) came from the host and was lost when the run was suspended; get it again after resuming. (line 1, col 185)"},"log":[["pull",0]]}, + {"code":"const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const body = r.body; await wait({}); return body.locked","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: The function get locked came from the host and was lost when the run was suspended; get it again after resuming. (line 1, col 179)"},"log":[["pull",0]]}, + {"code":"async function get() { const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); return await r.text() }\n const t = await get(); await wait({}); return t","suspend":{"ok":true},"resume":{"ok":true,"value":"hello"},"log":[["pull",0],["pull",1],["pull",2]]}, + {"code":"async function get() { const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); return r.body }\n const body = await get(); await wait({}); return body.locked","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: The function get locked came from the host and was lost when the run was suspended; get it again after resuming. (line 2, col 53)"},"log":[["pull",0]]}, + {"code":"async function get() { const r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); return r.text }\n const text = await get(); await wait({}); return await text()","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: The function (anonymous) came from the host and was lost when the run was suspended; get it again after resuming. (line 2, col 59)"},"log":[["pull",0]]}, + {"code":"const p = fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); for (let end = Date.now() + 250; Date.now() < end; ) {} const r = await p; return r.status","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: fetch produced a Lost, which the program cannot hold. (line 1, col 11)"},"log":[["pull",0]]}, + {"code":"const p = fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const n = [1, 2].map((x) => { for (let end = Date.now() + 250; Date.now() < end; ) {} return x }); const r = await p; return [r.status, n]","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: fetch produced a Lost, which the program cannot hold. (line 1, col 11)"},"log":[["pull",0]]}, + {"code":"const p = fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const n = await Promise.resolve(2).then((x) => { for (let end = Date.now() + 250; Date.now() < end; ) {} return x }); const r = await p; return [r.status, n]","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: fetch produced a Lost, which the program cannot hold. (line 1, col 11)"},"log":[["pull",0]]}, + {"code":"const r = send({ a: 1, w: wait({}) }); return await r","suspend":{"ok":true},"resume":{"ok":true,"value":{"a":1,"w":1}},"log":[["send",[{"object":[["a",1],["w",1]]}]]]}, + {"code":"return { a: 1, w: wait({}), b: [Promise.resolve(2)] }","suspend":{"ok":true},"resume":{"ok":true,"value":{"a":1,"w":1,"b":[2]}},"log":[]}, + {"code":"function f() { return hold({ query: wait({}).then(() => 'echo') }).items.length } return [f(), 1]","suspend":{"ok":true},"resume":{"ok":true,"value":[1,1]},"log":[]}, + {"code":"return [1, 2].map((x) => hold({ query: wait({}).then(() => 'echo') }).items.length + x)","suspend":{"ok":true},"resume":{"ok":true,"value":[2,3]},"log":[]}, + {"code":"return await Promise.resolve(1).then((x) => hold({ query: wait({}).then(() => 'echo') }).items.length + x)","suspend":{"ok":true},"resume":{"ok":true,"value":2},"log":[]}, + {"code":"function* g() { yield hold({ query: wait({}).then(() => 'echo') }).items.length; yield 7 }\n const caller = (it) => [it.next().value, it.next().value, it.next().done]; return [caller(g()), [...g()].length]","suspend":{"ok":true},"resume":{"ok":true,"value":[[1,7,true],2]},"log":[]}, + {"code":"async function f() { function* g() { yield hold({ query: wait({}).then(() => 'echo') }).items.length }\n return [...g()] } return await f()","suspend":{"ok":true},"resume":{"ok":true,"value":[1]},"log":[]}, + {"code":"const t = { toJSON: () => 9 }; const r = send({ t, n: [1, { w: wait({}) }], z: t }); return await r","suspend":{"ok":true},"resume":{"ok":true,"value":{"t":{},"n":[1,{"w":1}],"z":{}}},"log":[["send",[{"object":[["t",{"object":[]}],["n",{"array":[1,{"object":[["w",1]]}]}],["z",{"object":[]}]]}]]]}, + {"code":"let box = { r: await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}) }\n function* g() { let t = box.r; box = null; yield t; t = null; yield hold({ query: wait({}).then(() => 'echo') }).items.length }\n const a = [...g()]; return [a.length, a[1]]","suspend":{"ok":true},"resume":{"ok":true,"value":[2,1]},"log":[["pull",0]]}, + {"code":"let box = { r: await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}) }\n function* g() { let t = box.r; box = null; t = null; yield hold({ query: wait({}).then(() => 'echo') }).items.length }\n const a = [...g()]; return a","suspend":{"ok":true},"resume":{"ok":true,"value":[1]},"log":[["pull",0]]}, + {"code":"let r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const p = wait({}).then(echo.bind(null, r)); r = null; return typeof (await p)","suspend":{"ok":true},"resume":{"ok":true,"value":"object"},"log":[["pull",0]]}, + {"code":"let r = await fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const it = [1, 2].values().map(echo.bind(null, r)); r = null;\n const w = wait({}); await w; return typeof it.next().value","suspend":{"ok":true},"resume":{"ok":true,"value":"object"},"log":[["pull",0]]}, + {"code":"return [...new Uint8Array([1, 2]).map((x) => hold({ query: wait({}).then(() => 'echo') }).items.length + x)]","suspend":{"ok":true},"resume":{"ok":true,"value":[2,3]},"log":[]}, + {"code":"return [...Uint8Array.from([1, 2], (x) => hold({ query: wait({}).then(() => 'echo') }).items.length + x)]","suspend":{"ok":true},"resume":{"ok":true,"value":[2,3]},"log":[]}, + {"code":"return new Uint8Array([1, 2]).reduce((a, x) => a + hold({ query: wait({}).then(() => 'echo') }).items.length + x, 0)","suspend":{"ok":true},"resume":{"ok":true,"value":5},"log":[]}, + {"code":"const p = fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const n = [1, 2].values().map((x) => { for (let end = Date.now() + 250; Date.now() < end; ) {} return x }).toArray(); const r = await p; return [r.status, n]","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: fetch produced a Lost, which the program cannot hold. (line 1, col 11)"},"log":[["pull",0]]}, + {"code":"const p = fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const n = [1, 2, 3].values().filter((x) => { if (x === 2) { for (let end = Date.now() + 250; Date.now() < end; ) {} } return x !== 2 }).toArray(); const r = await p; return [r.status, n]","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: fetch produced a Lost, which the program cannot hold. (line 1, col 11)"},"log":[["pull",0]]}, + {"code":"const p = fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); let k = 0; const src = { next() { if (k === 1) { for (let end = Date.now() + 250; Date.now() < end; ) {} } return { done: k > 2, value: k++ } } }\n const n = Iterator.prototype.map.call(src, (x) => x * 2).toArray(); const r = await p; return [r.status, n]","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: fetch produced a Lost, which the program cannot hold. (line 1, col 11)"},"log":[["pull",0]]}, + {"code":"const p = fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const inner = () => { let d = false; return { next() { if (!d) { for (let end = Date.now() + 250; Date.now() < end; ) {} } const r = { done: d, value: 7 }; d = true; return r } } }\n const n = [1, 2].values().flatMap(inner).toArray(); const r = await p; return [r.status, n]","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: fetch produced a Lost, which the program cannot hold. (line 1, col 11)"},"log":[["pull",0]]}, + {"code":"const p = fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const log = []; const src = { next: () => ({ done: false, value: 1 }), return() { for (let end = Date.now() + 250; Date.now() < end; ) {} log.push('closed'); return {} } }\n const h = Iterator.prototype.map.call(src, (x) => x); h.next(); const done = h.return(); const r = await p; return [r.status, done, log]","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: fetch produced a Lost, which the program cannot hold. (line 1, col 11)"},"log":[["pull",0]]}, + {"code":"const p = fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const it = { [Symbol.iterator]() { for (let end = Date.now() + 250; Date.now() < end; ) {} return [1, 2].values() } }\n const n = Iterator.from(it).toArray(); const r = await p; return [r.status, n]","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: fetch produced a Lost, which the program cannot hold. (line 1, col 11)"},"log":[["pull",0]]}, + {"code":"const m = new Map(); const v = m.getOrInsertComputed('k', () => hold({ query: wait({}).then(() => 'echo') }).items.length + 1); return [v, m.get('k')]","suspend":{"ok":true},"resume":{"ok":true,"value":[2,2]},"log":[]}, + {"code":"return [...new Set([1, 2]).intersection({ size: 3, has: (x) => hold({ query: wait({}).then(() => 'echo') }).items.length + x > 2, keys: () => [].values() })]","suspend":{"ok":true},"resume":{"ok":true,"value":[2]},"log":[]}, + {"code":"return await Promise.all({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: hold({ query: wait({}).then(() => 'echo') }).items.length + n++ }) } } })","suspend":{"ok":true},"resume":{"ok":true,"value":[1,2]},"log":[]}, + {"code":"return Object.groupBy([1, 2], (x) => ({ toString: () => 'g' + (hold({ query: wait({}).then(() => 'echo') }).items.length + x) }))","suspend":{"ok":true},"resume":{"ok":true,"value":{"g2":[1],"g3":[2]}},"log":[]}, + {"code":"const p = fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const s = JSON.stringify({ a: [1, { toJSON() { for (let end = Date.now() + 250; Date.now() < end; ) {} return 2 } }], b: 'x' }, null, 1); const r = await p; return [r.status, s]","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: fetch produced a Lost, which the program cannot hold. (line 1, col 11)"},"log":[["pull",0]]}, + {"code":"const p = fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const s = JSON.stringify({ a: [1, 2], b: { c: 3 } }, (k, v) => { if (k === 'c') { for (let end = Date.now() + 250; Date.now() < end; ) {} } return v }); const r = await p; return [r.status, s]","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: fetch produced a Lost, which the program cannot hold. (line 1, col 11)"},"log":[["pull",0]]}, + {"code":"const p = fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const o = Object.fromEntries({ [Symbol.iterator]() { let n = 0; return { next: () => (n > 1 ? { done: true } : { done: false, value: (n++ ? (() => { for (let end = Date.now() + 250; Date.now() < end; ) {} return ['b', n] })() : ['a', n]) }), return: () => ({}) } } }); const r = await p; return [r.status, o]","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: fetch produced a Lost, which the program cannot hold. (line 1, col 11)"},"log":[["pull",0]]}, + {"code":"const p = fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const h = new Headers([{ [Symbol.iterator]() { let n = 0; return { next: () => (n > 1 ? { done: true } : { done: false, value: (n++ ? (() => { for (let end = Date.now() + 250; Date.now() < end; ) {} return 'v' })() : 'k') }), return: () => ({}) } } }]); const r = await p; return [r.status, [...h]]","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: fetch produced a Lost, which the program cannot hold. (line 1, col 11)"},"log":[["pull",0]]}, + {"code":"const p = fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const s = ({ toString() { for (let end = Date.now() + 250; Date.now() < end; ) {} return 's' } }).toLocaleString(); const r = await p; return [r.status, s]","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: fetch produced a Lost, which the program cannot hold. (line 1, col 11)"},"log":[["pull",0]]}, + {"code":"const w = wait({}); return await send({ a: { toJSON() { for (let end = Date.now() + 250; Date.now() < end; ) {} return 2 } }, w })","suspend":{"ok":true},"resume":{"ok":true,"value":{"a":{},"w":1}},"log":[["send",[{"object":[["a",{"object":[]}],["w",1]]}]]]}, + {"code":"const w = wait({}); return { a: { toJSON() { for (let end = Date.now() + 250; Date.now() < end; ) {} return 2 } }, w }","suspend":{"ok":true},"resume":{"ok":true,"value":{"a":2,"w":1}},"log":[]}, + {"code":"const w = wait({}); const n = hold({ query: { toJSON() { for (let end = Date.now() + 250; Date.now() < end; ) {} return 'echo' } } }).items.length; return [n, await w]","suspend":{"ok":true},"resume":{"ok":true,"value":[1,1]},"log":[]}, + {"code":"return await send({ w: wait({}), a: { toJSON() { for (let i = 0; i < 2000000; i++) {} return 2 } } })","suspend":{"ok":true},"resume":{"ok":true,"value":{"w":1,"a":{}}},"log":[["send",[{"object":[["w",1],["a",{"object":[]}]]}]]]}, + {"code":"function f() { return hold({ query: { toJSON: () => 'echo' }, w: wait({}) }).items.length } return [f(), 1]","suspend":{"ok":true},"resume":{"ok":true,"value":[1,1]},"log":[]}, + {"code":"function f() { return hold({ w: wait({}), query: { toJSON: () => 'echo' } }).items.length } return [f(), 1]","suspend":{"ok":true},"resume":{"ok":true,"value":[1,1]},"log":[]}, + {"code":"return Object.fromEntries([[Object.create({ toString: () => 'k' + hold({ query: wait({}).then(() => 'echo') }).items.length }), 1]])","suspend":{"ok":true},"resume":{"ok":true,"value":{"k1":1}},"log":[]}, + {"code":"return String(new URLSearchParams([['a', { toString: () => 'b' + hold({ query: wait({}).then(() => 'echo') }).items.length }]]))","suspend":{"ok":true},"resume":{"ok":true,"value":"a=b1"},"log":[]}, + {"code":"return [...new Headers([[Object.create({ toString: () => 'x-' + hold({ query: wait({}).then(() => 'echo') }).items.length }), 'v']])]","suspend":{"ok":true},"resume":{"ok":true,"value":[["x-1","v"]]},"log":[]}, + {"code":"const n = await wait({}); try { class A {} } catch (e) { return [n, e.name] }","suspend":{"ok":true},"resume":{"ok":true,"value":null},"log":[]}, + {"code":"const o = { valueOf: () => hold({ query: wait({}).then(() => 'echo') }).items.length + 1 }; return [o + 1, 'a'.padStart(o)]","suspend":{"ok":true},"resume":{"ok":true,"value":[3," a"]},"log":[]}, + {"code":"const r = []; for (const x of { [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: hold({ query: wait({}).then(() => 'echo') }).items.length + ++n }) } } }) r.push(x); return r","suspend":{"ok":true},"resume":{"ok":true,"value":[2,3]},"log":[]}, + {"code":"const r = []; for await (const x of { [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: hold({ query: wait({}).then(() => 'echo') }).items.length + ++n }) } } }) r.push(x); return r","suspend":{"ok":true},"resume":{"ok":true,"value":[2,3]},"log":[]}, + {"code":"const r = []; for await (const x of { [Symbol.asyncIterator]() { const k = hold({ query: wait({}).then(() => 'echo') }).items.length; let n = 0; return { next: async () => ({ done: n > 1, value: k + ++n }) } } }) r.push(x); return r","suspend":{"ok":true},"resume":{"ok":true,"value":[2,3]},"log":[]}, + {"code":"const r = []; for await (const x of { [Symbol.asyncIterator]() { return { next: async () => ({ done: false, value: 1 }), return() { r.push('closed ' + hold({ query: wait({}).then(() => 'echo') }).items.length); return { done: true } } } } }) { r.push(x); break } return r","suspend":{"ok":true},"resume":{"ok":true,"value":[1,"closed 1"]},"log":[]}, + {"code":"const r = []; for await (const x of { [Symbol.iterator]() { return { next: () => ({ done: false, value: 1 }), return() { r.push('closed ' + hold({ query: wait({}).then(() => 'echo') }).items.length); return {} } } } }) { r.push(x); break } return r","suspend":{"ok":true},"resume":{"ok":true,"value":[1,"closed 1"]},"log":[]}, + {"code":"const p = fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const it = { n: 0, [Symbol.iterator]() { return this }, next() { if (this.n === 0) for (let end = Date.now() + 250; Date.now() < end; ) {} return { done: this.n > 1, value: ++this.n } } }; function* g() { yield* it } const r = []; for (const x of g()) r.push(x); const res = await p; return [res.status, r]","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: fetch produced a Lost, which the program cannot hold. (line 1, col 11)"},"log":[["pull",0]]}, + {"code":"const p = fetch({\"chunks\":[\"hel\",\"lo\"],\"status\":201,\"statusText\":\"Created\",\"headers\":{\"Content-Type\":\"text/plain\",\"X-A\":\"1\"}}); const r = []; function* inner() { try { yield 1 } finally { for (let end = Date.now() + 250; Date.now() < end; ) {} r.push('finally') } } function* g() { return yield* inner() } const a = g(); a.next(); r.push(a.return(5)); const res = await p; return [res.status, r]","suspend":{"ok":true},"resume":{"ok":false,"kind":"ExecutionFailure","message":"TypeError: fetch produced a Lost, which the program cannot hold. (line 1, col 11)"},"log":[["pull",0]]}, + {"code":"const r = send({ w: wait({}).then(() => ({ f: () => 1, v: 2 })) }); return await r","suspend":{"ok":true},"resume":{"ok":true,"value":{"w":{"v":2}}},"log":[["send",[{"object":[["w",{"object":[["v",2]]}]]}]]]}, + {"code":"function f() { return echo({ w: wait({}) }) } return [f(), 1]","suspend":{"ok":true},"resume":{"ok":true,"value":[{"w":1},1]},"log":[]}, + {"code":"return [1, 2].map((x) => echo({ w: wait({}).then(() => x) }))","suspend":{"ok":true},"resume":{"ok":true,"value":[{"w":1},{"w":2}]},"log":[]} + ] +} diff --git a/packages/codemode-rust/conformance/streaming.ts b/packages/codemode-rust/conformance/streaming.ts new file mode 100644 index 0000000000000..fc7f7708c439f --- /dev/null +++ b/packages/codemode-rust/conformance/streaming.ts @@ -0,0 +1,991 @@ +#!/usr/bin/env bun + +// Regenerates conformance/streaming.json from the reference's language layer (`Language.Runtime.make`): how a host +// function hands programs a streaming HTTP response (`Language.StreamingResponse`), how host-call arguments cross +// (functions dropped, promises awaited), when queued host calls start against the fuel the VM spends, and what +// suspending a run that holds a response or waits in a crossing does. The reference has no tests of its own for this; +// the Rust tests replay this recording. +// Usage: bun conformance/streaming.ts [reference] — the reference CodeMode package directory, from the argument, +// CODEMODE_REF, or by default ../codemode relative to this workspace. +// +// Every run's runtime: `Runtime.make({ globals, translate: { functions: "drop", promises: "await" } })`, no `modules`, +// no `limits`. `globals()` (the same for every run and resume; none keeps state in `run.metadata`) gives: +// - `tools`: the namespace of conformance/reference.ts (`tools.echo`, `tools.fail`, `tools.git.status`; any other path +// an async function that rejects with NotFound). +// - `fetch(spec)`: `Host.fn`, `type: "async"`, `takesFunctions: true`; gives a `StreamingResponse` built from `spec` +// (see `respond`): `chunks` (text or bytes, one per read; omitted for no body), `fail` (the read at that index +// errors with `new Error("boom")`), `status` (200), `statusText`, `headers` ({}), `redirected` (false), `delay` (each +// read waits that many milliseconds first). Its body logs `["pull", index]` before each read and +// `["cancel", reason ?? null]` when cancelled. +// - `echo(value)`: `Host.fn`, `type: "sync"`, `takesFunctions: true`; gives back its first argument. +// - `send(...args)`: `Host.fn`, `type: "async"`; logs `["send", args.map(describe)]` (see `describe` in +// conformance/reference.ts) as it runs, so the log shows when its arguments had crossed, and gives back `args[0]`. +// - `refuse(...args)`: `Host.fn`, `type: "async"`; logs `["refuse", args.map(describe)]` as it runs and fails with +// `Host.fail("HostFailure", "boom")`. +// - `hold(...args)`: `Host.fn`, `type: "sync-thenable"`; gives `{ items: args }`. A call whose arguments hold a pending +// promise parks the frames it is called from until the promise settles. +// - `wait(...)`: `Host.fn`, `type: "async"`, `idempotent: true`; never settles before the run was suspended and resumed, +// and gives `1` once it is called again after the resume. Only the suspensions resume. +// Every `run` takes one parameter (`length` 1); each function is named by its global. +// +// streaming.json: `{ programs: [{ code, outcome, log }], suspensions: [{ code, suspend, resume?, log }] }`. +// - `outcome`: `{ ok: true, value, logs? }` or `{ ok: false, kind, message }`. +// - A suspension starts the program, suspends it once `wait` was called (or, when the program has no `wait(` call, +// 50 ms after `fetch` was called), resumes the suspended state from bytes (`Language.toBytes`) in the same runtime, +// and records `suspend: { ok: true }` and `resume: { ok: true, value } | { ok: false, kind, message }` (a +// `SnapshotError` failing the resume: `{ ok: false, message }`), or `suspend: { ok: false, message }` for a +// `SuspendError`, or `suspend: { ok: false, outcome }` when the run had already ended. +// - `log`: what `fetch`'s bodies, `send` and `refuse` logged, in order. + +import { join } from "node:path" +import { writeRecording } from "./recording.ts" +import { describe, reference, toolsGlobal } from "./reference.ts" + +const ref = await reference(process.argv[2] ?? process.env.CODEMODE_REF) +const Effect = ref.Effect +const Fiber = ref.Fiber +const Host = ref.Language.Host +const Runtime = ref.Language.Runtime +const tools = toolsGlobal(ref) + +// The reference yields to the host (which is when a stream pulls) once its fuel runs out and `SLICE_MS` (1 ms) of +// `performance.now()` passed since its last yield; the Rust replay yields at every exhaustion. On a fast machine 10,000 +// fuel can take less than a millisecond, so the busy loops below would record a later yield. A clock that moves a +// millisecond on every read makes every exhaustion a yield, so recordings don't depend on how fast this machine is. +let clock = performance.now() +performance.now = () => (clock += 1) + +type Spec = { + chunks?: Array> + fail?: number + status?: number + statusText?: string + headers?: Record + redirected?: boolean + delay?: number +} + +const respond = (spec: Spec, log: Array) => { + const encoder = { + encode: (chunk: string | Array) => + typeof chunk === "string" ? new TextEncoder().encode(chunk) : new Uint8Array(chunk), + } + let index = 0 + const body = + spec.chunks === undefined + ? null + : new ReadableStream({ + async pull(controller) { + log.push(["pull", index]) + if (spec.delay !== undefined) await Bun.sleep(spec.delay) + if (spec.fail === index) { + controller.error(new Error("boom")) + return + } + const chunk = spec.chunks![index++] + if (chunk === undefined) controller.close() + else controller.enqueue(encoder.encode(chunk)) + }, + cancel(reason) { + log.push(["cancel", reason === undefined ? null : reason]) + }, + }) + const response = new Response(body, { + status: spec.status ?? 200, + ...(spec.statusText === undefined ? {} : { statusText: spec.statusText }), + headers: spec.headers ?? {}, + }) + return new ref.Language.StreamingResponse(response, spec.redirected ?? false) +} + +// The run's globals; `fetched` is called 50 ms after `fetch` is, and `wait` answers once `resumed()` is true, calling +// `started` when it is called before. +const globals = (log: Array, wait: { resumed: () => boolean; started: () => void }, fetched?: () => void) => ({ + tools, + fetch: Host.fn( + ([spec]: ReadonlyArray) => + Effect.sync(() => { + const response = respond(spec as Spec, log) + if (fetched !== undefined) setTimeout(fetched, 50) + return response + }), + { type: "async", takesFunctions: true }, + ), + echo: Host.fn(([value]: ReadonlyArray) => value, { takesFunctions: true }), + send: Host.fn( + (args: ReadonlyArray) => + Effect.sync(() => { + log.push(["send", args.map(describe)]) + return args[0] + }), + { type: "async" }, + ), + refuse: Host.fn( + (args: ReadonlyArray) => + Effect.suspend(() => { + log.push(["refuse", args.map(describe)]) + return Effect.fail(Host.fail("HostFailure", "boom")) + }), + { type: "async" }, + ), + hold: Host.fn((args: ReadonlyArray) => ({ items: args }), { type: "sync-thenable" }), + wait: Host.fn( + (_: ReadonlyArray) => + wait.resumed() + ? Effect.succeed(1) + : Effect.callback(() => { + wait.started() + }), + { type: "async", idempotent: true }, + ), +}) +const runtime = (log: Array, wait: { resumed: () => boolean; started: () => void }, fetched?: () => void) => + Runtime.make({ globals: () => globals(log, wait, fetched), translate: { functions: "drop", promises: "await" } }) + +const text = { + chunks: ["hel", "lo"], + status: 201, + statusText: "Created", + headers: { "Content-Type": "text/plain", "X-A": "1" }, +} +const json = { chunks: ['{"a":', "[1,2]}"], headers: { "content-type": "application/json" } } + +// Bodies `json()` reads, valid and not: the reference's messages are its host runtime's. +const jsonBodies = [ + "", + " ", + "{", + "[1,", + "abc", + "nul", + "tru", + "1 2", + '{"a":1}x', + '{"a" 1}', + "{a:1}", + "[1,]", + '{"a":1,}', + '"x', + '"\\q"', + '"\\u12"', + "01", + "-", + "1.", + "1e", + ".5", + "+1", + "[1 2]", + '{"a":1 "b":2}', + "'x'", + "\u00a0 1", + '"\t"', + '{"__proto__":1,"a":2,"a":3}', + "1e400", + "-0", + "[[[[]]]]", + '{"":""}', + "NaN", + "Infinity", + "undefined", + "true false", + ":", + ",", + "}", + "]", + "[", + '"a\\"', + '{"a":}', + '{"a":1,"b"}', + "{,}", + "[,1]", + "1e+", + "0x10", + "1_0", + '"\\x41"', + '"\\u00e9"', + "\u2028 1", + "[1]]", + "{}}", + "nulll", + "truex", + " \n\t\r 7 ", + "\f1", + '"\u0000"', + '{"a":[}', + "123abc", + "[-]", + "[1,,2]", + '"\\"', + "1.5e3", + "-1.5E-3", + "1e-400", + "9007199254740993", + '{"a":{"b":[1,{"c":null}]}}', +] + +// Bodies whose JSON holds lone surrogates, escaped pairs and U+10FFFF, as escapes and as UTF-8. +const surrogateBodies = [ + ['"\\ud800"'], + ['"\\udc00x"'], + ['"a\\ud800\\ud800b"'], + ['"\\ud83d\\ude00"'], + ['"\\udbff\\udfff"'], + ['"\\ud800\\udc00\\udc00"'], + ['{"\\ud800":"\\udc00"}'], + ['{"k\\udfff":"\\udbff\\udfffz"}'], + [[0x22, 0xf4, 0x8f, 0xbf, 0xbf, 0x22]], + [[0x22, 0xf4, 0x8f, 0xbf, 0xbf, 0xf4, 0x8f, 0xbf, 0xbf, 0x5c, 0x75, 0x64, 0x38, 0x30, 0x30, 0x22]], + [[0x22, 0xed, 0xa0, 0x80, 0x22]], +] + +const programs: Array = [ + `const r = await fetch(${JSON.stringify(text)}) + return [r.url, r.status, r.statusText, r.ok, r.redirected, r.headers.get("content-type"), [...r.headers], r.bodyUsed, + r.body === null, r.body.locked, typeof r.text, typeof r.body.getReader, Object.keys(r), Object.keys(r.body), + r.text.name, r.body.getReader.name, r.headers instanceof Headers]`, + `const r = await fetch(${JSON.stringify(text)}); const t = await r.text(); return [t, r.bodyUsed, r.body.locked]`, + `const r = await fetch(${JSON.stringify(json)}); return [await r.json(), r.bodyUsed]`, + `const r = await fetch(${JSON.stringify(text)}); const b = await r.bytes(); return [b instanceof Uint8Array, [...b]]`, + `const r = await fetch(${JSON.stringify(text)}); const b = await r.arrayBuffer(); return [b instanceof Uint8Array, [...b]]`, + `const r = await fetch({ chunks: ["{"], headers: { "content-type": "application/json" } }) + try { await r.json() } catch (e) { return [e.name, e.message, r.bodyUsed] }`, + `const r = await fetch(${JSON.stringify(text)}); await r.text() + try { await r.text() } catch (e) { return [e.name, e.message] }`, + `const r = await fetch(${JSON.stringify(text)}); await r.text() + try { r.body.getReader() } catch (e) { return [e.name, e.message] }`, + `const r = await fetch(${JSON.stringify(text)}); const reader = r.body.getReader() + const reads = [] + for (let i = 0; i < 4; i++) { const { done, value } = await reader.read(); reads.push([done, value === undefined ? null : [...value]]) } + return [r.body.locked, r.bodyUsed, reads]`, + `const r = await fetch(${JSON.stringify(text)}); r.body.getReader() + try { r.body.getReader() } catch (e) { return [e.name, e.message, r.body.locked] }`, + `const r = await fetch(${JSON.stringify(text)}); r.body.getReader() + try { await r.text() } catch (e) { return [e.name, e.message, r.bodyUsed] }`, + `const r = await fetch(${JSON.stringify(text)}); const reader = r.body.getReader(); reader.releaseLock() + const after = r.body.locked + try { await reader.read() } catch (e) { return [after, e.name, e.message] }`, + `const r = await fetch(${JSON.stringify(text)}); const reader = r.body.getReader(); await reader.read(); reader.releaseLock() + return [r.body.locked, r.bodyUsed, await r.body.getReader().read().then((x) => [x.done, [...x.value]])]`, + `const r = await fetch(${JSON.stringify(text)}) + try { r.body.getReader({ mode: "byob" }) } catch (e) { return [e.name, e.message, r.body.locked] }`, + `const r = await fetch(${JSON.stringify(text)}); const out = await r.body.cancel("enough") + return [out === undefined, r.bodyUsed, r.body.locked, await r.text()]`, + `const r = await fetch(${JSON.stringify(text)}); const reader = r.body.getReader(); await reader.read() + const out = await reader.cancel("stop") + return [out === undefined, r.body.locked, await reader.read()]`, + `const r = await fetch(${JSON.stringify(text)}); r.body.getReader() + try { await r.body.cancel() } catch (e) { return [e.name, e.message] }`, + `const r = await fetch(${JSON.stringify(text)}); const parts = [] + for await (const chunk of r.body) parts.push([...chunk]) + return [parts, r.bodyUsed, r.body.locked]`, + `const r = await fetch(${JSON.stringify(text)}); const parts = [] + for await (const chunk of r.body) { parts.push([...chunk]); break } + return [parts, r.body.locked, await r.text().catch((e) => e.message)]`, + `const r = await fetch({ chunks: ["a", "b"], fail: 1 }); const reader = r.body.getReader() + const first = await reader.read() + try { await reader.read() } catch (e) { return [[...first.value], e.name, e.message, r.body.locked] }`, + `const r = await fetch({ chunks: ["a"], fail: 0 }) + try { await r.text() } catch (e) { return [e.name, e.message, r.bodyUsed] }`, + `const r = await fetch({ chunks: ["a"], fail: 0 }); const parts = [] + try { for await (const c of r.body) parts.push([...c]) } catch (e) { return [parts, e.name, e.message] }`, + `const r = await fetch({ status: 204 }) + return [r.body, r.bodyUsed, r.ok, await r.text(), r.bodyUsed, await r.text()]`, + `const r = await fetch({ status: 404, statusText: "Not Found", chunks: ["missing"], redirected: true }) + return [r.ok, r.status, r.statusText, r.redirected, await r.text()]`, + `const r = await fetch(${JSON.stringify(text)}); return r`, + `const r = await fetch(${JSON.stringify(text)}); return JSON.stringify(r)`, + `const r = await fetch(${JSON.stringify(text)}); const reader = r.body.getReader(); return [Object.keys(reader), typeof reader.read]`, + `const r = await fetch(${JSON.stringify(text)}); try { r.bodyUsed = true } catch (e) { return [e.name, e.message] }`, + `const r = await fetch(${JSON.stringify(text)}); try { r.body.locked = true } catch (e) { return [e.name, e.message] }`, + `const r = await fetch(${JSON.stringify(text)}) + const before = ["bodyUsed" in r, r.hasOwnProperty("bodyUsed"), Object.keys(r).includes("bodyUsed"), "locked" in r.body] + const deleted = [delete r.bodyUsed, "bodyUsed" in r, r.bodyUsed, delete r.body.locked, "locked" in r.body, r.body.locked] + r.bodyUsed = 5; r.body.locked = 6 + return [before, deleted, r.bodyUsed, r.body.locked, Object.keys(r).includes("bodyUsed"), Object.keys(r.body)]`, + `const r = await fetch(${JSON.stringify(text)}); r.status = 5; delete r.text; return [r.status, typeof r.text, Object.keys(r).length]`, + `const r = await fetch(${JSON.stringify(text)}); const reader = r.body.getReader() + return [r.text.length, r.json.length, r.body.cancel.length, r.body.getReader.length, r.body[Symbol.asyncIterator].length, + r.body[Symbol.asyncIterator].name, reader.read.length, reader.cancel.length, reader.releaseLock.length, reader.read.name]`, + `const r = await fetch(${JSON.stringify(text)}); console.log(r); console.log(r.body); console.log(r.body.getReader()); return [String(r), String(r.body), Object.entries(r.body)]`, + `const r = await fetch(${JSON.stringify(text)}); return [JSON.stringify(r.body), JSON.stringify({ ...r.body }), Object.keys(r.body)]`, + `const r = await fetch(${JSON.stringify(text)}); const reader = r.body.getReader(); await reader.read() + try { await r.text() } catch (e) { return [e.name, e.message, r.bodyUsed, r.body.locked] }`, + `const r = await fetch(${JSON.stringify(text)}); const reader = r.body.getReader(); await reader.read(); reader.releaseLock() + try { await r.text() } catch (e) { return [e.name, e.message, r.bodyUsed, r.body.locked] }`, + `const r = await fetch(${JSON.stringify(text)}); await r.body.cancel(); const after = [r.bodyUsed, r.body.locked] + try { await r.bytes() } catch (e) { return [after, e.name, e.message] }`, + `const r = await fetch({ status: 204 }) + const out = [[...(await r.bytes())], [...(await r.arrayBuffer())]] + try { await r.json() } catch (e) { out.push([e.name, e.message]) } + return out`, + `const out = [] + for (const body of ${JSON.stringify(jsonBodies)}) { + const r = await fetch({ chunks: [body] }) + try { const v = await r.json(); out.push(["ok", v, Object.is(v, -0)]) } catch (e) { out.push([e.name, e.message]) } + } + return out`, + `const r = await fetch({ chunks: [[0xef, 0xbb, 0xbf, 0x7b, 0x7d]] }); return await r.json().catch((e) => e.message)`, + `const out = [] + for (const chunks of ${JSON.stringify(surrogateBodies)}) { + const v = await (await fetch({ chunks })).json() + const s = typeof v === "string" ? v : Object.keys(v)[0] + "|" + Object.values(v)[0] + const t = await (await fetch({ chunks })).text() + out.push([s.length, [...s].map((c) => c.codePointAt(0)), JSON.stringify(v), s.isWellFormed(), t.length, [...t].map((c) => c.codePointAt(0))]) + } + return out`, + `const r = await fetch(${JSON.stringify(text)}); const p = r.text(); await null; await null; const now = [r.body.locked, r.bodyUsed]; await p; return now`, + `const out = [] + for (const chunks of [[[0xef, 0xbb, 0xbf, 0x68, 0x69]], [[0xff, 0x61]], [[0xe2, 0x82], [0xac]], [[0xe2, 0x82]], [[0xef, 0xbb], [0xbf, 0x7b, 0x7d]], + [[0xed, 0xa0, 0x80]], [[0xf0, 0x9f, 0x98, 0x80]], [[0xc0, 0x80]]]) { + const t = await (await fetch({ chunks })).text() + const j = await (await fetch({ chunks: [...chunks, [0x22]].map((c, i) => i === 0 ? [0x22, ...c] : c) })).json().catch((e) => e.message) + out.push([[...t].map((c) => c.codePointAt(0)), typeof j === "string" ? [...j].map((c) => c.codePointAt(0)) : j]) + } + return out`, + `const r = await fetch(${JSON.stringify(text)}); const p = r.text(); const now = [r.body.locked, r.bodyUsed]; await p; return now`, + `const r = await fetch(${JSON.stringify(text)}); const reader = r.body.getReader(); const p = reader.read(); const now = r.bodyUsed; await p; return now`, + `const r = await fetch(${JSON.stringify(text)}) + const all = await Promise.allSettled([r.text(), r.text(), r.json()]) + return all.map((x) => x.status === "fulfilled" ? x.value : [x.reason.name, x.reason.message])`, + `const r = await fetch(${JSON.stringify(text)}); const reader = r.body.getReader() + const all = await Promise.all([reader.read(), reader.read(), reader.read(), reader.read()]) + return all.map((x) => [Object.keys(x), x.done, x.value === undefined ? null : [...x.value]])`, + `const r = await fetch(${JSON.stringify(text)}); r.body.getReader() + try { r.body[Symbol.asyncIterator]() } catch (e) { return [e.name, e.message] }`, + `const r = await fetch(${JSON.stringify(text)}); const it = r.body[Symbol.asyncIterator]() + const locked = r.body.locked + try { r.body[Symbol.asyncIterator]() } catch (e) { return [locked, e.name, e.message] }`, + `const r = await fetch(${JSON.stringify(text)}); const it = r.body[Symbol.asyncIterator]() + const steps = [] + for (let i = 0; i < 4; i++) { const x = await it.next(); steps.push([Object.keys(x), x.done, x.value === undefined ? null : [...x.value], r.body.locked]) } + const ret = await it.return() + return [steps, Object.keys(ret), ret, r.bodyUsed]`, + `const r = await fetch(${JSON.stringify(text)}); const it = r.body[Symbol.asyncIterator]() + const ret = await it.return(); const again = await it.next() + return [Object.keys(ret), ret.done, again.done, r.body.locked, r.bodyUsed, await r.text().catch((e) => e.message)]`, + `const r = await fetch({ chunks: ["a"], fail: 0 }); const it = r.body[Symbol.asyncIterator]() + const first = await it.next().catch((e) => [e.name, e.message]) + return [first, r.body.locked, await it.next().then((x) => x.done, (e) => e.message)]`, + `const r = await fetch({ chunks: ["a", "b"], fail: 1 }); const reader = r.body.getReader(); await reader.read() + const failed = await reader.read().catch((e) => e.message) + const again = await reader.read().catch((e) => e.message) + const cancelled = await reader.cancel("x").catch((e) => e.message) + reader.releaseLock() + return [failed, again, cancelled, r.body.locked, await r.body.cancel().catch((e) => e.message), await r.text().catch((e) => e.message)]`, + `const r = await fetch(${JSON.stringify(text)}); const reader = r.body.getReader(); await reader.cancel() + const cancelled = await reader.cancel("again"); reader.releaseLock() + return [cancelled === undefined, await r.body.cancel("third"), await r.body.getReader().read()]`, + `const r = await fetch(${JSON.stringify(text)}); try { await r.body.cancel(() => 1) } catch (e) { return [e.name, e.message, r.bodyUsed] }`, + `const r = await fetch(${JSON.stringify(text)}); const reader = r.body.getReader() + try { await reader.cancel(Symbol.iterator) } catch (e) { return [e.name, e.message] }`, + `const r = await fetch(${JSON.stringify(text)}) + const out = [] + for (const o of [undefined, null, {}, { mode: undefined }, 5, "byob", { mode: "default" }]) { + try { const reader = r.body.getReader(o); reader.releaseLock(); out.push("ok") } catch (e) { out.push(e.message) } + } + return out`, + `const r = await fetch(${JSON.stringify(text)}); const reader = r.body.getReader(); reader.releaseLock(); return [await reader.read().catch((e) => e.name), reader.closed]`, + `const r = await fetch({ chunks: ["a"], delay: 5 }); const reader = r.body.getReader(); const p = reader.read() + await null; await null; reader.releaseLock() + return [await p.then((x) => x.done, (e) => [e.name, e.message]), r.body.locked, r.bodyUsed]`, + `const r = await fetch({ chunks: ["a"], delay: 5 }); const reader = r.body.getReader(); const p = reader.read() + await null; await null; const c = await reader.cancel("c") + return [c === undefined, await p.then((x) => [Object.keys(x), x.done, x.value === undefined], (e) => [e.name, e.message])]`, + `const r = await fetch(${JSON.stringify(text)}); const out = [] + for (const v of [r, r.body, r.headers, { ...r, text: 1, json: 1, bytes: 1, arrayBuffer: 1, body: 1 }]) { + try { out.push(echo(v)) } catch (e) { out.push([e.name, e.message]) } + } + return out`, + `const r = await fetch(${JSON.stringify(text)}); return [typeof r.clone, typeof r.formData, typeof r.blob, r.type, typeof r.body.tee, typeof r.body.pipeTo, r.body.values]`, + `const r = await fetch(${JSON.stringify(text)}); const copy = { ...r }; return [Object.keys(copy), copy.bodyUsed]`, + `const r = await fetch(${JSON.stringify(text)}); const reader = r.body.getReader(); reader.releaseLock(); reader.releaseLock(); return [await reader.cancel().catch((e) => e.message), r.body.locked]`, + `const r = await fetch(${JSON.stringify(text)}); const it = r.body[Symbol.asyncIterator](); const a = await it.next(); const b = await it.return(); return [[...a.value], a.done, b, r.body.locked]`, +] + +const record = async (code: string) => { + const log: Array = [] + const result = await Effect.runPromise(runtime(log, { resumed: () => false, started: () => {} }).execute(code)) + return { + code, + outcome: result.ok + ? { ok: true, value: result.value, ...(result.logs ? { logs: result.logs } : {}) } + : { ok: false, kind: result.error.kind, message: result.error.message }, + log, + } +} + +// Busy loops: the reference starts queued calls whenever its interpreter runs out of fuel (10,000 units: one per loop +// back-edge, function call and job, fifty per call of a built-in or host function), so a loop sees `locked` or +// `bodyUsed` change at a fixed iteration. The busy loops here and in conformance/frames/ keep one case per cost rule +// and code path (one built-in stands for its family): add a case for a new rule, not for another method of a family. +const busy = (setup: string, loop: string, op = "r.text()", flag = "r.body.locked") => + `const r = await fetch(${JSON.stringify(text)}); ${setup}; const p = ${op}; let flip = -1; const seen = () => flip < 0 && ${flag} + ${loop} + await p.catch(() => 0); return flip` +programs.push( + busy("", "for (let i = 0; i < 30000; i++) { if (seen()) flip = i }"), + busy("", "for (let i = 0; i < 30000; i++) if (flip < 0 && r.body.locked) flip = i"), + busy("let i = 0", "while (i < 30000) { if (flip < 0 && r.body.locked) flip = i; i++ }"), + busy("let i = 0", "do { if (flip < 0 && r.body.locked) flip = i; i++; if (i % 2) continue } while (i < 30000)"), + busy("", "for (let i = 0; ; i++) { if (i % 3 === 0) continue; if (flip < 0 && r.body.locked) { flip = i; break } }"), + busy( + "", + "outer: for (let i = 0; i < 300; i++) for (let j = 0; j < 100; j++) { if (j === 50) continue outer; if (flip < 0 && r.body.locked) flip = i * 1000 + j }", + ), + busy("const f = (x) => x", "for (let i = 0; i < 30000; i++) { f(i); if (flip < 0 && r.body.locked) flip = i }"), + busy( + "function f(x) { return x }", + "for (let i = 0; i < 30000; i++) { f?.(f(i)); if (flip < 0 && r.body.locked) flip = i }", + ), + busy( + "const o = { m(x) { return x } }", + "for (let i = 0; i < 30000; i++) { o.m(i); if (flip < 0 && r.body.locked) flip = i }", + ), + busy( + "const f = (...x) => x; const g = f.bind(null, 1)", + "for (let i = 0; i < 30000; i++) { f(...[i]); g(i); if (flip < 0 && r.body.locked) flip = i }", + ), + busy("", "for (let i = 0; i < 30000; i++) { Math.abs(i); if (flip < 0 && r.body.locked) flip = i }"), + busy( + "const a = []", + "for (let i = 0; i < 30000; i++) { a.push(String(i)); JSON.stringify(i); if (flip < 0 && r.body.locked) flip = i }", + ), + busy("", "for (let i = 0; i < 30000; i++) { new Map(); [i].length; if (flip < 0 && r.body.locked) flip = i }"), + busy("", "for (let i = 0; i < 30000; i++) { echo(i); if (flip < 0 && r.body.locked) flip = i }"), + busy( + "", + "for (let i = 0; i < 30000; i++) { try { if (i % 7 === 0) throw new Error('x') } catch {} finally { if (flip < 0 && r.body.locked) flip = i } }", + ), + busy( + "const tag = (s, v) => v", + "for (let i = 0; i < 30000; i++) { tag`a${i}b`; if (flip < 0 && r.body.locked) flip = i }", + ), + busy( + "const a = []; for (let i = 0; i < 30000; i++) a[i] = i", + "for (const i of a) { if (flip < 0 && r.body.locked) flip = i }", + ), + busy( + "const o = {}; for (let i = 0; i < 20000; i++) o['k' + i] = i", + "for (const k in o) { if (flip < 0 && r.body.locked) flip = o[k] }", + ), + busy( + "function* gen() { for (let i = 0; i < 30000; i++) yield i }", + "for (const i of gen()) { if (flip < 0 && r.body.locked) flip = i }", + ), + busy( + "function* gen() { for (let i = 0; i < 30000; i++) yield i }", + "const it = gen(); for (let x = it.next(); !x.done; x = it.next()) { if (flip < 0 && r.body.locked) flip = x.value }", + ), + busy( + "function* gen() { for (let i = 0; i < 30000; i++) yield i }", + "const all = [...gen()]; for (const i of all) { if (flip < 0 && r.body.locked) flip = i }", + ), + busy( + "function* gen() { for (let i = 0; i < 3; i++) yield i }", + "for (let i = 0; i < 30000; i++) { const [a, b] = gen(); if (flip < 0 && r.body.locked) flip = i }", + ), + busy( + "const a = []; for (let i = 0; i < 30000; i++) a[i] = i; function* gen() { yield* a }", + "for (const i of gen()) { if (flip < 0 && r.body.locked) flip = i }", + ), + busy( + "function* inner() { for (let i = 0; i < 30000; i++) yield i } function* gen() { yield* inner() }", + "for (const i of gen()) { if (flip < 0 && r.body.locked) flip = i }", + ), + busy( + "const it = { [Symbol.iterator]() { let i = 0; return { next: () => ({ done: i >= 30000, value: i++ }) } } }", + "for (const i of it) { if (flip < 0 && r.body.locked) flip = i }", + ), + busy( + "const m = new Map(); for (let i = 0; i < 30000; i++) m.set(i, i)", + "for (const [k] of m) { if (flip < 0 && r.body.locked) flip = k }", + ), + busy( + "const a = []; for (let i = 0; i < 30000; i++) a[i] = i", + "for (const i of a.values()) { if (flip < 0 && r.body.locked) flip = i }", + ), + busy("", "for (const c of 'x'.repeat(30000)) { if (flip < 0 && r.body.locked) flip = 1 }"), + busy( + "const a = []; for (let i = 0; i < 30000; i++) a[i] = i", + "for await (const i of a) { if (flip < 0 && r.body.locked) flip = i }", + ), + busy( + "async function* gen() { for (let i = 0; i < 30000; i++) yield i }", + "for await (const i of gen()) { if (flip < 0 && r.body.locked) flip = i }", + ), + busy( + "const it = { [Symbol.iterator]() { let i = 0; return { next: () => ({ done: i >= 30000, value: i++ }) } } }; function* gen() { yield* it }", + "for (const i of gen()) { if (flip < 0 && r.body.locked) flip = i }", + ), + busy( + "function* gen() { yield 1; yield 2 }", + "for (let i = 0; i < 30000; i++) { for (const x of gen()) break; if (flip < 0 && r.body.locked) flip = i }", + ), + busy( + "const h = async (x) => x", + "for (let i = 0; i < 30000; i++) { await h(i); if (flip < 0 && r.body.locked) flip = i }", + ), + busy( + "for (let i = 0; i < 25000; i++) {}", + "for (let i = 0; i < 30000; i++) { if (flip < 0 && r.body.locked) flip = i }", + ), + busy("", "for (let i = 0; i < 30000; i++) { if (flip < 0 && r.bodyUsed) flip = i }", "r.body.cancel()", "r.bodyUsed"), + busy( + "const reader = r.body.getReader()", + "for (let i = 0; i < 30000; i++) { if (flip < 0 && r.bodyUsed) flip = i }", + "reader.read()", + "r.bodyUsed", + ), + busy( + "", + "for (let j = 0; j < 3; j++) { const q = r.body.cancel(); for (let i = 0; i < 9000; i++) { if (flip < 0 && r.bodyUsed) flip = j * 100000 + i } await q.catch(() => 0) }", + "Promise.resolve()", + "r.bodyUsed", + ), +) + +// Busy loops over the built-ins the reference writes in its bytecode prelude, which spend that bytecode's fuel. +// `see(x)` counts its calls and records the count at the first that sees the body locked. `a` has 30,000 items with a +// hole at every third index, `d` its 20,000 items without holes. `during` reads the body while the built-in runs; +// `after` runs the built-in first, so the loop after it shows the fuel it left. +const base = `const r = await fetch(${JSON.stringify(text)}); let flip = -1; let k = 0 + const see = (x) => { k++; if (flip < 0 && r.body.locked) flip = k; return x } + const a = []; for (let i = 0; i < 30000; i++) if (i % 3) a[i] = i; a.length = 30000; const d = a.filter(() => true)` +const during = (setup: string, loop: string) => + `${base}; ${setup} + const p = r.text(); ${loop} + await p.catch(() => 0); return flip` +const after = (setup: string, work: string) => + `${base}; ${setup} + ${work}; const p = r.text(); for (let i = 0; i < 30000; i++) see(i) + await p.catch(() => 0); return flip` +const range = (from: number, to: number) => `Array.from({ length: ${to - from} }, (_, i) => i + ${from})` +programs.push( + during("", "a.forEach(see)"), + during("", "a.flatMap((x) => x % 2 ? [see(x), , x] : see(x))"), + during("const b = [1, , 3]", "for (let j = 0; j < 3000; j++) { b.map(see); b.some(see); b.reduce(see) }"), + during("", "Array.prototype.forEach.call(a, see)"), + after("const b = a.slice(0, 2000)", "b.toLocaleString(); [[], [1]].forEach((c) => c.reduce(see))"), + after("const pairs = d.slice(0, 1000).map((x) => [x, x])", "new Map(pairs)"), + during("const m = new Map(d.slice(0, 9000).map((x) => [x, x]))", "m.forEach(see)"), + during("", "Object.groupBy(a, (x) => see(x) % 3)"), + during( + "const m = new Map()", + "for (let i = 0; i < 30000; i++) { m.getOrInsertComputed(i % 100, see); m.getOrInsert(i, 1) }", + ), + // One method stands for the Set methods: they share the prelude loop and the set-like path. + ...["union"].flatMap((name) => [ + after( + `const s1 = new Set(${range(0, 1000)}); const s2 = new Set(${range(500, 1500)}); const s3 = new Set(${range(0, 300)})`, + `s1.${name}(s2); s3.${name}(s1); s1.${name}(s3)`, + ), + during( + `const like = { size: 3, has: (x) => see(x) % 7 === 0, keys: () => [1, 2, 3].values() }; const s1 = new Set(${range(0, 2)})`, + `for (let j = 0; j < 3000; j++) { s1.${name}(like); see(j) }`, + ), + ]), + during("const u = new Uint8Array(d.slice(0, 20000))", "u.forEach(see); u.map(see); u.filter(see)"), + after( + "const b = d.slice(0, 3000); const u = new Uint8Array(3000)", + "new Uint8Array(b); Uint8Array.from(b); u.set(b); u.set(new Uint8Array(b)); new Uint8Array(u)", + ), + during( + "const b = d.slice(0, 3000).reverse()", + "b.slice().sort((x, y) => see(x) - y); b.toSorted((x, y) => see(y) - x)", + ), + after( + "const b = d.slice(0, 20000).reverse(); const c = d.slice(0, 4096)", + "b.slice().sort(); c.slice().sort(); b.toSorted(); [3, 1, 2].sort((x, y) => x - y)", + ), + during( + "const s = 'ab'.repeat(5000)", + "s.replace(/b/g, see); s.replaceAll('a', see); s.replace('b', see); 'é'.repeat(2000).replaceAll('é', see); s.replace(/z/g, see)", + ), + during( + "const j = JSON.stringify({ x: d.slice(0, 3000), y: { z: d.slice(0, 2000) } })", + "JSON.parse(j, (key, v) => see(v))", + ), + after( + "const pairs = d.slice(0, 2000).map((x) => [x, x])", + "Object.fromEntries(pairs); Object.fromEntries(new Map(pairs)); Math.sumPrecise(d); AggregateError(d.slice(0, 1000)); new AggregateError(d)", + ), + after( + "const pairs = d.slice(0, 1000).map((x) => ['k' + x, String(x)])", + "new Headers(pairs); new URLSearchParams(pairs); new Headers({ a: 'b' }); new URLSearchParams(new URLSearchParams('a=b'))", + ), + during( + "const h = new Headers(d.slice(0, 2000).map((x) => ['k' + x, String(x)])); const q = new URLSearchParams(d.slice(0, 2000).map((x) => ['k', String(x)]))", + "h.forEach(see); q.forEach(see)", + ), + during( + "const s = []; s[10000005] = 7; s[3] = 1; s[20] = 2", + "s.forEach(see); s.reduceRight((t, x) => see(t), 0); [s].flatMap((x) => see(x))", + ), + after("const s = []; s[10000005] = 7; s[3] = 1; s[20] = 2", "s.forEach((x) => x)"), +) + +// Iterator helpers are prelude generators there, and the consumers prelude functions. +const gen = "function* g(n) { for (let i = 0; i < n; i++) yield i }" +// A built-in iterator a custom `Symbol.iterator` returns is stepped through its native `next`. +const wrapped = + "const w = (x) => ({ [Symbol.iterator]: () => x[Symbol.iterator]() }); const A = w([1, 2, 3]), M = w(new Map([[1, 2]])), S = w('ab'), T = w(new Set([3, 4]))\n" + + " const H = w(new Headers([['a', 'b']])); const L = (function () { return w(arguments) })(5, 6)" +programs.push( + during("", "d.values().map(see).toArray()"), + during("", "d.values().flatMap((x) => [see(x), x]).toArray()"), + during( + "", + "d.values().reduce((s, x) => see(s)); d.values().some((x) => see(x) > 15000); d.values().every((x) => see(x) < 15000); d.values().find((x) => see(x) > 20000)", + ), + during(gen, "for (let j = 0; j < 3000; j++) { const h = g(5).map(see); h.next(); h.return(); see(j) }"), + during( + gen, + "for (let j = 0; j < 3000; j++) { Iterator.from(g(2)).toArray(); Iterator.from([1, 2]).toArray(); Iterator.from('ab').toArray(); see(j) }", + ), + during( + "let n = 0; const custom = { next: () => ({ done: n++ % 4 === 3, value: n }) }", + "for (let j = 0; j < 3000; j++) { Iterator.from(custom).toArray(); Iterator.prototype.toArray.call(custom); see(j) }", + ), + during( + wrapped, + "for (let j = 0; j < 1000; j++) { for (const x of A) {} const [y, z] = M; [...S]; for (const x of T) break; const [h] = H; [...L]; see(j) }", + ), + during( + wrapped, + "for (let j = 0; j < 1000; j++) { Array.from(A); new Map(M); Object.fromEntries(M); new Set(S); Promise.all(T); new Headers(H); see(j) }", + ), + during( + gen, + "const b = d.slice(0, 7); for (let j = 0; j < 3000; j++) { Promise.all(b); Promise.race([1]); Promise.any(g(3)); Promise.allSettled([]); see(j) }", + ), +) + +// for await over a sync iterable steps it through an adapter whose native next the loop calls; one the reference does +// not walk itself it opens in its internal bytecode and steps there. An async generator's own requests and its +// yield* spend fuel too. `after` shows the fuel the loop left, since every step starts a new job. +const syncs = + gen + + "; const it = { [Symbol.iterator]() { return this }, n: 0, next() { return { done: this.n++ % 3 === 2, value: 1 } } }\n" + + " const bound = { [Symbol.iterator]() { return this }, next: Object.fromEntries.bind(null, [['done', true]]) }\n" + + " const wrapped = { [Symbol.iterator]: () => [1, 2][Symbol.iterator]() }; const h = new Headers([['a', 'b']])\n" + + " async function* ag() { yield 1; yield* g(2) }" +programs.push( + after( + syncs, + "for (let j = 0; j < 37; j++) { for await (const x of [1, 2]) {} for await (const x of 'ab') {} for await (const x of new Map([[1, 2]])) {} }", + ), + after(syncs, "for (let j = 0; j < 37; j++) { for await (const x of ag()) {} }"), + after( + syncs + "; async function* a2() { yield* g(2) }", + "for (let j = 0; j < 37; j++) { for await (const x of a2()) {} }", + ), + after( + syncs + + "; const ai = { [Symbol.asyncIterator]() { let c = 0; return { next: async () => ({ done: c++ >= 2, value: 1 }) } } }; async function* a7() { yield* ai }", + "for (let j = 0; j < 37; j++) { for await (const x of a7()) {} }", + ), +) + +// A built-in that needs primitives lists them; once one is an object, the reference converts the list in its internal +// bytecode before the built-in runs again. +const objects = + "const o = { valueOf: () => 1 }, s = { toString: () => 'b' }, n = {}, t = { toString: () => '[1]' }, dt = new Date(0)\n" + + " const v = { valueOf: () => see(1) }" +programs.push( + during(objects, "for (let j = 0; j < 1000; j++) { 'abc'.slice(o, 2); 'abc'.padStart(o, s); see(j) }"), + during( + objects, + "for (let j = 0; j < 1000; j++) { 'abc'.slice(v); Math.min(v, v); new Error(v); [1, 2].at(v); see(j) }", + ), + during(objects, "for (let j = 0; j < 1000; j++) { [s, 'a', o].sort(); [n, 2, 1].toSorted(); [3, 1].sort(); see(j) }"), + after( + objects, + "const big = Array.from({ length: 5000 }, (_, i) => i % 2 ? { toString: () => 'x' + i } : 'y' + i); big.sort()", + ), + // A namespace converts for nothing and starts no conversion; a promise costs its $vmToPrimitive call and stays. + after( + objects + "; const pr = Promise.resolve(1)", + "for (let j = 0; j < 300; j++) { String(tools); [1, 2].join(tools.git); Math.max(o, tools); [1, 2].slice(o, tools.echo); String(pr); Math.max(pr, v); [pr].join(); `${pr}`; ({ [pr]: 1 }) }", + ), + after( + objects + "; const pr = Promise.resolve(1)", + "for (let j = 0; j < 300; j++) { try { 'abc'.at(v, pr) } catch {} try { 'abc'.indexOf(pr) } catch {} try { 'abc'.padStart(v, tools) } catch {} try { Object.keys(pr) } catch {} try { ({ ...tools }) } catch {} }", + ), +) + +// JSON.stringify with a replacer, a property list or a toJSON of the program's runs the reference's internal walk. +const doc = + "const doc = { a: d.slice(0, 50), b: { c: 1, d: [1, { e: 2 }], f: undefined, g: () => 1 }, h: 'x', i: null, j: new Date(0), k: new Map() }" +programs.push( + during(doc, "for (let j = 0; j < 300; j++) { JSON.stringify(doc, (key, v) => see(v)); see(j) }"), + during(doc, "for (let j = 0; j < 3000; j++) { JSON.stringify(doc, ['a', 'b', 'c']); JSON.stringify(doc); see(j) }"), + after( + doc + "; const t = { x: [1, 2, { toJSON: () => 7 }], y: doc }", + "JSON.stringify(t); JSON.stringify([doc, { toJSON() { return 1 } }])", + ), + // Past depth 100 the internal walk throws through `$Throw`. + after( + "let deep = 1; for (let i = 0; i < 101; i++) deep = { deep }", + "for (let j = 0; j < 37; j++) try { JSON.stringify(deep, (k, v) => v) } catch {}", + ), + // The native walk gives up at its 2,048th visit of an object it has seen already. + after( + "const x = { a: 1 }; const many = Array(2049).fill(x); const fewer = Array(2048).fill(x)", + "JSON.stringify(many); JSON.stringify(fewer)", + ), + after( + "const x = [1, { b: 2 }]; const nest = Array(1100).fill({ p: x, q: x })", + "JSON.stringify(nest); JSON.stringify(nest.slice(0, 600))", + ), + during( + "const o = { valueOf: () => see(1), toString: () => 'k' }; const x = {}; let m = { valueOf() { return 2 } }", + "for (let i = 0; i < 3000; i++) { o * 2; 2 < o; o >= 1; -o; o + 1; 'x' + o; o == 1; 1 != o; o | 0; `${o}`; x[o] = 1; m++; see(i) }", + ), + `const ks = []; const s = JSON.stringify({ h: new Headers({ a: 'b' }), e: new TypeError('x'), u: new Uint8Array([1]) }, (k, v) => { ks.push(k); return v }, 1) + return [s, ks, JSON.stringify({ h: new Headers({ a: 'b' }) }, ['h', 'z'])]`, +) + +// Crossing to the host: a host function's arguments cross through toHost (a function left out, a promise awaited, no +// toJSON called; see conformance/frames/hostargs.ts), and the program's result as JSON through the reference's +// internal walk, which awaits a promise inside and calls a toJSON of the program's. +const later = (v: string) => `new Promise((done) => setTimeout(() => done(${v}), 0))` +// `S(x)` calls `hold` with an argument that holds a promise, which parks the frames it is called from, and logs around it. +const holding = (expr: string) => + `const log = []; const S = (x) => { log.push('call ' + x); const n = hold({ query: Promise.resolve('echo') }).items.length; log.push('answer ' + x); return n } + Promise.resolve().then(() => log.push('job')); const r = ${expr}; return [r, log]` + +programs.push( + `return await send({ a: Promise.resolve(5), b: { toJSON: () => 7 }, c: [Promise.resolve(1), { d: Promise.resolve('x') }] })`, + `return [await send(Promise.resolve({ x: 1 })), await send(), await send(undefined), await send(null)]`, + `return await send({ s: new Set([Promise.resolve(2), 3]), q: new URLSearchParams('a=1'), h: new Headers({ k: 'v' }), d: new Date(0), m: new Map([[1, 2]]), e: new TypeError('x'), p: Promise.resolve(0), f: () => 1, u: undefined, n: NaN })`, + `const o = { p: Promise.resolve(1) }; const shared = { v: 1 }; return await send({ o, x: [shared, shared, o] })`, + `const big = Array(3000).fill({ k: 1 }); return (await send({ big })).big.length`, + `const e = new Error('m'); e.extra = Promise.resolve(2); e.name = 'Custom'; return await send({ e })`, + `return await send({ ['__proto__']: Promise.resolve(1), a: Promise.resolve(3) })`, + `const p = send({ a: Promise.reject(new Error('no')) }); return await p.catch((e) => [e.name, e.message])`, + `return await send({ p: Promise.resolve(1), t: { toJSON() { throw new TypeError('tj') } } }).catch((e) => [e.name, e.message])`, + `return await send({ p: Promise.resolve(1), b: new Uint8Array(1) }).catch((e) => [e.name, e.message])`, + `const a = { p: Promise.resolve(1) }; const b = { a }; return await send({ x: [b, b] })`, + `let o = 1; for (let i = 0; i < 40; i++) o = { o }; return await send({ p: Promise.resolve(1), o }).then((r) => { let n = 0; while (r.o) { r = r.o; n++ } return n }, (e) => [e.name, e.message])`, + `let o = 1; for (let i = 0; i < 120; i++) o = { o }; return await send({ p: Promise.resolve(1), o }).catch((e) => [e.name, e.message])`, + `let o = Promise.resolve(1); for (let i = 0; i < 40; i++) o = { o }; return await send(o).catch((e) => [e.name, e.message])`, + `return await send(1, Promise.resolve(2)).catch((e) => [e.name, e.message])`, + `const log = []; const p = send({ a: { toJSON(k) { log.push('toJSON ' + k); return 1 } }, p: Promise.resolve(2) }); log.push('after'); return [log, await p]`, + `const log = []; const p = send({ p: Promise.resolve(1), t: { toJSON() { log.push('late'); return 2 } } }); log.push('after'); await p; return log`, + `const log = []; const a = send({ n: 'walked', p: Promise.resolve(1) }); const b = send({ n: 'plain' }); Promise.resolve().then(() => send({ n: 'job' })); log.push(typeof a.then) + await Promise.all([a, b]); return log`, + `const a = send({ n: 'later', p: ${later("1")} }); const b = send({ n: 'then' }); return [await a, await b]`, + `const p = Promise.resolve(1); const calls = [1, 2, 3].map((n) => send({ n, p })); return await Promise.all(calls)`, + `return await send({ query: Promise.resolve('echo') }).then((r) => r.query)`, + `return { a: Promise.resolve(5), b: [Promise.resolve(2), { c: Promise.resolve(3) }], d: { toJSON: () => 'D' } }`, + `return Promise.resolve({ x: Promise.resolve(1) })`, + `return { then(done) { done({ y: Promise.resolve(2) }) } }`, + `return { a: Promise.reject(new TypeError('rejected')) }`, + `return { a: Promise.resolve(1), t: { toJSON() { throw new RangeError('tj') } } }`, + `let o = Promise.resolve(1); for (let i = 0; i < 40; i++) o = { o }; return o`, + `let o = 1; for (let i = 0; i < 120; i++) o = { o }; return { p: Promise.resolve(1), o }`, + `const log = []; Promise.resolve().then(() => log.push('job')); return { log, p: Promise.resolve(1).then(() => log.push('then')) }`, + `return hold({ query: Promise.resolve('echo') }).items.length`, + `function f() { return hold({ query: Promise.resolve('echo') }).items.length } return f()`, + `const log = []; Promise.resolve().then(() => log.push('job')); const r = hold({ query: Promise.resolve('echo') }); log.push('after'); return [log, r.items.length]`, + `try { hold({ query: Promise.reject(new Error('no')) }) } catch (e) { return [e.name, e.message] }`, + `try { hold({ query: { toJSON() { throw new Error('tj') } } }) } catch (e) { return [e.name, e.message] }`, + `async function f() { return hold({ query: Promise.resolve('echo') }).items.length } const p = f(); const t = typeof p.then; return [t, await p]`, + `const g = (q) => hold(q).items.length; return [g({ query: { toJSON: () => 'echo' } }), g({ query: Promise.resolve('echo') })]`, + // A `hold` call that parks inside a built-in's callback parks the built-in's frame with it. + ...[ + "[1, 2].map((x) => S(x))", + "(() => { const r = []; [1, 2].forEach((x) => r.push(S(x))); return r })()", + "[1, 2].filter((x) => S(x) >= 0)", + "[1, 2].some((x) => S(x) < 0)", + "[1, 2].every((x) => S(x) >= 0)", + "[1, 2].find((x) => S(x) >= 0 && x === 2)", + "[1, 2].findLastIndex((x) => S(x) >= 0 && x === 1)", + "[1, 2].reduce((a, x) => a + S(x) + x, 0)", + "[1, , 3].reduceRight((a, x) => a + S(x) + x)", + "[1, 2].map((x) => [3].map((y) => S(y) + x))", + "[2, 1].sort((a, b) => S(a) + a - b)", + "Array.from([1, 2], (x) => S(x) + x)", + "Array.from({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 1, value: S(++n) }), return: () => ({}) } } })", + "[...new Map({ [Symbol.iterator]() { let n = 0; return { next: () => ({ done: n > 0, value: [++n, S(n)] }) } } })]", + "await Promise.resolve(1).then((x) => S(x) + x)", + "await Promise.reject(1).catch((x) => S(x) + x)", + "await Promise.resolve(1).finally(() => S(1))", + "await new Promise((done) => done(S(1)))", + "await Promise.try((x) => S(x) + x, 1)", + "await Promise.resolve({ then(done) { done(S(1)) } })", + "(() => { const r = []; new Map([[1, 'a'], [2, 'b']]).forEach((v, k) => r.push(S(k) + v)); return r })()", + "(() => { const r = []; new Set([1, 2]).forEach((v) => r.push(S(v) + v)); return r })()", + "(() => { const r = []; new URLSearchParams('a=1&b=2').forEach((v) => r.push(S(v) + v)); return r })()", + "[1, , 2].flatMap((x) => [S(x), x])", + "Array.from({ length: 2 }, (_, i) => S(i) + i)", + "[1, { toLocaleString: () => String(S(2)) }].toLocaleString()", + "Object.groupBy([1, 2, 3], (x) => S(x) + (x % 2))", + "[...Map.groupBy([1, 2], (x) => S(x) + x)]", + "'abcab'.replace('b', (m) => S(1) + m)", + "'abcab'.replaceAll('b', (m, i) => S(i) + i)", + "'a1b2'.replace(/(\\d)/g, (m, d) => S(d) + d)", + "(() => { const r = []; [1, 2].values().forEach((x) => r.push(S(x) + x)); return r })()", + "[1, 2].values().some((x) => S(x) + x > 2)", + "Iterator.from({ next() { return { done: false, value: 3 } } }).find((x) => S(x) > 0)", + "[1, 2, 3].values().reduce((a, x) => a + S(x) + x)", + "JSON.parse('[1,[2,{}],3]', (k, v) => (typeof v === 'number' ? S(v) + v : v))", + "(function (x) { return S(x) + x + this.y }).call({ y: 10 }, 1)", + "((x, y) => S(x) + x + y).apply(null, [1, 2])", + // Inside a running sync generator the park takes the generator and the frames driving it. + "(() => { function* g() { const a = S(1); yield a; yield a + 1 } const it = g(); return [it.next(), it.next(), it.next()] })()", + "(() => { function* g() { yield S(1); yield S(2) + 1; return 9 } const out = []; for (const x of g()) out.push(x); return out })()", + "(() => { function* g() { yield S(1); yield 5; yield S(2) } return [...g()] })()", + "(() => { function* inner() { yield S(1); yield S(2) * 10 } const first = () => inner().next().value; function* outer() { yield* inner(); yield first() + 100; for (const x of inner()) yield x + 1000 } return [...outer()] })()", + "await (async () => { function* g() { yield S(1); yield S(2) + 1 } const it = g(); const a = it.next().value; await null; return [a, it.next().value, [...g()]] })()", + "(() => { function* g() { try { yield S(1) } finally { yield 'cleanup' } } const it = g(); return [it.next(), it.return(4), it.next(), it.next()] })()", + "Array.from((function* () { yield S(1); yield S(2) })(), (x) => x + 1)", + ].map(holding), +) + +// Busy loops through crossings and the walk: its fuel decides when the reference starts the queued read. +programs.push( + after("", "for (let j = 0; j < 37; j++) await send({ p: Promise.resolve(j), a: [1, { b: 2 }, [3]], s: 'x' })"), + // Spreading a generator opens it with a call of its `Symbol.iterator`. + after("function* g() { yield 1 }", "for (let j = 0; j < 37; j++) [...g()]"), + after( + "", + "for (let j = 0; j < 37; j++) await send([Promise.resolve(1), [Promise.resolve(2), [Promise.resolve(3)]]])", + ), + after( + "const t = { toJSON: () => [1, 2] }", + "for (let j = 0; j < 37; j++) await send({ t, p: Promise.resolve(1), e: new Error('x'), u: undefined })", + ), + after("", "for (let j = 0; j < 37; j++) hold({ query: Promise.resolve('echo'), limit: 1 })"), + after("", "for (let j = 0; j < 37; j++) await refuse({}).catch(() => 0)"), + after("", "for (let j = 0; j < 37; j++) await Promise.resolve(j).then((x) => x)"), + after("", "for (let j = 0; j < 37; j++) await tools.nope({}).catch(() => 0)"), + after("", "for (let j = 0; j < 37; j++) await Promise.resolve({ then(done) { done(j) } })"), + after("", "for (let j = 0; j < 37; j++) await Promise.resolve(j).finally(() => 0)"), + after("", "for (let j = 0; j < 37; j++) await Promise.try(() => j)"), + after( + "let o = 1; for (let i = 0; i < 101; i++) o = { o }", + "for (let j = 0; j < 37; j++) await send({ p: Promise.resolve(1), o }).catch(() => 0)", + ), + during( + "const t = { toJSON: () => see(1) }", + "for (let j = 0; j < 300; j++) { send({ t, a: [1, 2, { c: 3 }] }); see(j) }", + ), + during("const t = { toJSON: () => see(1) }", "for (let j = 0; j < 300; j++) { hold({ query: t }); see(j) }"), + during( + "const x = { v: 1 }; const many = Array(2049).fill(x)", + "for (let j = 0; j < 30; j++) { send({ many }); see(j) }", + ), +) + +// Suspending while a run holds a response: `wait` is idempotent and answers only once the run resumed. +const suspensions: Array = [ + `const r = await fetch(${JSON.stringify(text)}); await wait({}); return [r.status, r.bodyUsed]`, + `const r = await fetch(${JSON.stringify(text)}); const t = await r.text(); await wait({}); return t`, + `const r = await fetch(${JSON.stringify(text)}); const s = r.status; const h = r.headers; await wait({}); return [s, h.get("x-a")]`, + `const r = await fetch(${JSON.stringify(text)}); const { status, statusText } = r; await wait({}); return [status, statusText]`, + `const r = await fetch(${JSON.stringify(text)}); const text = r.text; await wait({}); return await text()`, + `const r = await fetch(${JSON.stringify(text)}); const body = r.body; await wait({}); return body.locked`, + `async function get() { const r = await fetch(${JSON.stringify(text)}); return await r.text() } + const t = await get(); await wait({}); return t`, + `async function get() { const r = await fetch(${JSON.stringify(text)}); return r.body } + const body = await get(); await wait({}); return body.locked`, + `async function get() { const r = await fetch(${JSON.stringify(text)}); return r.text } + const text = await get(); await wait({}); return await text()`, + // Suspended while a response has arrived but the run has not taken it yet: a busy loop holds the run. Busy loops here + // and in frames/ spin for 250 ms of wall-clock time, so the suspend (50 ms after `fetch` here, 20 ms in the Rust + // replay) lands inside them on any machine, and the resumed run leaves them at once instead of spinning on. + `const p = fetch(${JSON.stringify(text)}); for (let end = Date.now() + 250; Date.now() < end; ) {} const r = await p; return r.status`, + // The same inside a built-in's callback, whose frame the snapshot saves. + `const p = fetch(${JSON.stringify(text)}); const n = [1, 2].map((x) => { for (let end = Date.now() + 250; Date.now() < end; ) {} return x }); const r = await p; return [r.status, n]`, + `const p = fetch(${JSON.stringify(text)}); const n = await Promise.resolve(2).then((x) => { for (let end = Date.now() + 250; Date.now() < end; ) {} return x }); const r = await p; return [r.status, n]`, + // Suspended while a crossing awaits: a host call's arguments, the result, and a `hold` call that parked its frames. + `const r = send({ a: 1, w: wait({}) }); return await r`, + `return { a: 1, w: wait({}), b: [Promise.resolve(2)] }`, + `function f() { return hold({ query: wait({}).then(() => 'echo') }).items.length } return [f(), 1]`, + `return [1, 2].map((x) => hold({ query: wait({}).then(() => 'echo') }).items.length + x)`, + `return await Promise.resolve(1).then((x) => hold({ query: wait({}).then(() => 'echo') }).items.length + x)`, + `function* g() { yield hold({ query: wait({}).then(() => 'echo') }).items.length; yield 7 } + const caller = (it) => [it.next().value, it.next().value, it.next().done]; return [caller(g()), [...g()].length]`, + `async function f() { function* g() { yield hold({ query: wait({}).then(() => 'echo') }).items.length } + return [...g()] } return await f()`, + `const t = { toJSON: () => 9 }; const r = send({ t, n: [1, { w: wait({}) }], z: t }); return await r`, + // A response the run reaches only one way when it is suspended: its resume fails as long as the run can reach it. + // Only through the array a spread of a generator collects into, while the generator's frame is parked by `hold`. + `let box = { r: await fetch(${JSON.stringify(text)}) } + function* g() { let t = box.r; box = null; yield t; t = null; yield hold({ query: wait({}).then(() => 'echo') }).items.length } + const a = [...g()]; return [a.length, a[1]]`, + // The same, with the array dropped before the generator parks: nothing reaches the response. + `let box = { r: await fetch(${JSON.stringify(text)}) } + function* g() { let t = box.r; box = null; t = null; yield hold({ query: wait({}).then(() => 'echo') }).items.length } + const a = [...g()]; return a`, + // Only through a reaction on the promise of a host call in flight. + `let r = await fetch(${JSON.stringify(text)}); const p = wait({}).then(echo.bind(null, r)); r = null; return typeof (await p)`, + // Only through an iterator helper's mapper, which a parked frame calls. + `let r = await fetch(${JSON.stringify(text)}); const it = [1, 2].values().map(echo.bind(null, r)); r = null; + const w = wait({}); await w; return typeof it.next().value`, +] + +// Each family of built-ins that run in native frames keeps its own cases in conformance/frames/: expressions to run with +// `S` (see `holding`), other programs, and suspensions. +for (const family of ["arrays", "iterators", "collections", "callbacks", "core", "hostargs"]) { + const { default: cases } = await import(join(import.meta.dir, "frames", `${family}.ts`)) + const own = cases({ after, during, text }) + programs.push(...own.holds.map(holding), ...own.programs) + suspensions.push(...own.suspensions) +} + +const suspend = async (code: string) => { + const log: Array = [] + let resumed = false + let started!: () => void + const waiting = new Promise((done) => (started = done)) + // Without `wait`, the suspend comes once the response has arrived. + const made = runtime(log, { resumed: () => resumed, started }, /\bwait\(/.test(code) ? undefined : started) + const program = made.program(code) + const fiber = Effect.runFork(program.run()) + await waiting + const suspended = await Effect.runPromise(Effect.result(program.suspend())) + await Effect.runPromise(Fiber.join(fiber)) + if (suspended._tag === "Failure") return { code, suspend: { ok: false, message: suspended.failure.message }, log } + const outcome = suspended.success + if (outcome.ok !== "suspended") return { code, suspend: { ok: false, outcome }, log } + resumed = true + const after = await Effect.runPromise(Effect.result(made.resume(ref.Language.toBytes(outcome.state)).run())) + return { + code, + suspend: { ok: true }, + resume: + after._tag === "Failure" + ? { ok: false, error: after.failure._tag, message: after.failure.message } + : after.success.ok === true + ? { ok: true, value: after.success.value } + : { ok: false, kind: after.success.error.kind, message: after.success.error.message }, + log, + } +} + +const recordAll = async () => ({ + programs: await Promise.all(programs.map(record)), + suspensions: await suspensions.reduce( + async (done, code) => [...(await done), await suspend(code)], + Promise.resolve([] as Array), + ), +}) +// Everything is recorded twice: a recording that differs between the two depends on timing, which CI's freshness +// check and the Rust replay can't follow, so it fails here instead of being written. +const expected = await recordAll() +const again = await recordAll() +const unstable = (["programs", "suspensions"] as const).flatMap((kind) => + expected[kind].flatMap((entry, i) => + JSON.stringify(entry) === JSON.stringify(again[kind][i]) + ? [] + : [`${kind}[${i}]: ${(entry as { code: string }).code}`], + ), +) +if (unstable.length > 0) { + console.error(`recordings that differ between two runs (timing-dependent):\n${unstable.join("\n\n")}`) + process.exit(1) +} +writeRecording(join(import.meta.dir, "streaming.json"), expected) +console.log(`${expected.programs.length} programs, ${expected.suspensions.length} suspensions`) diff --git a/packages/codemode-rust/crates/psychoscript/Cargo.toml b/packages/codemode-rust/crates/psychoscript/Cargo.toml new file mode 100644 index 0000000000000..6eb6b949b4efa --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "psychoscript" +version = "0.1.0" +edition.workspace = true +license.workspace = true +description = "Embeddable Rust implementation of the PsychoScript language layer" + +[features] +# The test262 harness globals, for the parity runner in test262/ only. +test262 = [] +# Per-run heap counts and collection pauses through `Run::heap_stats`, for the memory benchmarks in bench/ only. +gc-stats = [] + +[dependencies] +icu_collator = { version = "2.4", default-features = false, features = ["compiled_data"] } +idna_adapter = "~1.1" +oxc_allocator = "0.159" +oxc_ast = "0.159" +oxc_ast_visit = "0.159" +oxc_diagnostics = "0.159" +oxc_parser = { version = "0.159", default-features = false } +oxc_semantic = "0.159" +oxc_span = "0.159" +oxc_str = "0.159" +oxc_syntax = "0.159" +regress = { version = "0.12.0", default-features = false, features = ["std", "utf16"] } +rustc-hash = "2" +serde_json = { version = "1", features = ["preserve_order"] } +tz-rs = "0.7" +unicode-normalization = "0.1" +url = "2.5" + +# The crate's own tests read `Run::heap_stats` (tests/gc.rs), so they build it with `gc-stats`; normal builds don't. +[dev-dependencies] +psychoscript = { path = ".", features = ["gc-stats"] } diff --git a/packages/codemode-rust/crates/psychoscript/examples/run.rs b/packages/codemode-rust/crates/psychoscript/examples/run.rs new file mode 100644 index 0000000000000..ca006d95e33b2 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/examples/run.rs @@ -0,0 +1,49 @@ +//! Runs a program file and prints its outcome: `cargo run --example run -- program.js`. The program reaches one host +//! global, a `tools` namespace with an async `echo` that gives its input's `id`. + +use psychoscript::{Failure, HostFunction, HostValue, Limits, Namespace, Resolved, Runtime}; + +fn main() { + let path = std::env::args().nth(1).expect("usage: run "); + let code = std::fs::read_to_string(&path).expect("readable program"); + let tools = Namespace::new( + |path| match path { + [] => Ok(vec!["echo".into()]), + _ => Ok(Vec::new()), + }, + |path| -> Resolved { + match path { + [name] if name == "echo" => HostFunction::new_async(|args, _| async move { + Ok(args + .first() + .and_then(|a| a.get("id")) + .cloned() + .unwrap_or(HostValue::Null)) + }) + .into(), + _ => Failure::missing(format!( + "No function at tools.{}.", + path.iter() + .map(|k| k.to_string()) + .collect::>() + .join(".") + )) + .into(), + } + }, + ); + let runtime = Runtime::make() + .globals(move |_| [("tools", HostValue::from(tools.clone()))]) + .limits(Limits { + timeout_ms: Some(2000), + max_output_bytes: None, + }); + let outcome = runtime.execute(&code); + for line in &outcome.logs { + println!("log: {line}"); + } + match outcome.result { + Ok(v) => println!("ok: {v}"), + Err(d) => println!("error: {}: {} {:?}", d.kind, d.message, d.location), + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/accessors.rs b/packages/codemode-rust/crates/psychoscript/src/accessors.rs new file mode 100644 index 0000000000000..4e76492d28036 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/accessors.rs @@ -0,0 +1,1268 @@ +//! Accessor properties, as the reference's language layer has them: program getters and setters (`get x() {}`, +//! `Object.defineProperty`), and the companions that stand for a built-in's accessor halves. +//! +//! - An accessor property is a prop with the `ACCESSOR` flag whose value is a `Kind::Accessor` object with its two +//! halves. A half is a function or undefined. A native half is a companion (see `companion_get`), which reads stay +//! on the native path for; any other function is a program half, which only program code calls. +//! - The VM's property instructions call a program getter or setter as a call from the instruction (see `Vm::op_read`). +//! - A built-in reading a property (`Vm::get_obj`) cannot call the program. Inside [`Vm::with_reads`] a program +//! getter's value comes from the table of values read ahead, or reads as undefined and is recorded as missing; the +//! VM then runs the missing getters as program code and runs the built-in again from the start, as the reference's +//! `withReads` and `$vmReplay` do. Anywhere else reaching one fails the built-in's call (`Reads::fault`). + +use crate::native::{Frame, Input, Step}; +use crate::object::*; +use crate::value::{Id, Value}; +use crate::vm::{Res, Vm}; + +/// The program getters a built-in reads ahead (the reference's `reads`). +#[derive(Default)] +pub(crate) struct Reads { + /// Values read ahead by receiver and key, for the built-in running again. + pub table: Vec<(Value, Atom, Value)>, + /// Nesting of `with_reads`. + pub depth: u32, + /// The getters a `with_reads` round met that are not in the table yet, by receiver and key, each once. + pub missing: Vec<(Value, Atom)>, + /// A program accessor a built-in reached outside `with_reads`: its call fails once it returns. + pub fault: Option, +} + +/// One own property as the descriptor built-ins see it. +#[derive(Clone, Copy)] +pub(crate) struct OwnSlot { + /// The value, or for an accessor its halves. + pub value: SlotValue, + pub writable: bool, + pub enumerable: bool, + pub configurable: bool, +} + +#[derive(Clone, Copy)] +pub(crate) enum SlotValue { + Data(Value), + Accessor(Value, Value), +} + +/// A property descriptor a program gave (`ToPropertyDescriptor`): a field is `Some` when the descriptor has it. +#[derive(Clone, Copy, Default)] +pub(crate) struct Descriptor { + pub value: Option, + pub writable: Option, + pub get: Option, + pub set: Option, + pub enumerable: Option, + pub configurable: Option, +} + +impl Descriptor { + pub fn is_accessor(&self) -> bool { + self.get.is_some() || self.set.is_some() + } + + pub fn is_data(&self) -> bool { + self.value.is_some() || self.writable.is_some() + } +} + +impl Vm { + /// An accessor property's halves, from its value. + #[inline] + pub(crate) fn pair(&self, v: Value) -> Accessor { + match v { + Value::Obj(id) => match &self.heap[id as usize].kind { + Kind::Accessor(a) => **a, + _ => Accessor { + get: Value::Undef, + set: Value::Undef, + }, + }, + _ => Accessor { + get: Value::Undef, + set: Value::Undef, + }, + } + } + + pub(crate) fn new_pair(&mut self, get: Value, set: Value) -> Value { + Value::Obj(self.alloc(Obj::new( + None, + Kind::Accessor(Box::new(Accessor { get, set })), + ))) + } + + /// Whether `v` is the companion of a built-in's accessor half. + pub(crate) fn is_companion(&self, v: &Value) -> bool { + matches!(v, Value::Obj(id) if matches!(&self.heap[*id as usize].kind, + Kind::Native { f, .. } if std::ptr::fn_addr_eq(*f, companion_get as crate::vm::NativeFn) + || std::ptr::fn_addr_eq(*f, companion_set as crate::vm::NativeFn) + || std::ptr::fn_addr_eq(*f, crate::builtins::object::restricted as crate::vm::NativeFn))) + } + + /// Whether `v` is a half of `Function.prototype`'s `caller` or `arguments`, which always throws. + pub(crate) fn is_restricted(&self, v: &Value) -> bool { + matches!(v, Value::Obj(id) if matches!(&self.heap[*id as usize].kind, + Kind::Native { f, .. } if std::ptr::fn_addr_eq(*f, crate::builtins::object::restricted as crate::vm::NativeFn))) + } + + /// Whether an accessor half is a program function, which only program code may call. + #[inline] + pub(crate) fn is_program_half(&self, v: &Value) -> bool { + matches!(v, Value::Obj(_)) && !self.is_companion(v) + } + + /// Whether an accessor property's value has a program half. + pub(crate) fn is_program_accessor(&self, pair: Value) -> bool { + let a = self.pair(pair); + self.is_program_half(&a.get) || self.is_program_half(&a.set) + } + + /// An accessor property's value for a read that finds it on `receiver`'s chain: a companion's value, or for a + /// program getter what `Reads` gives (or, for an instruction, the getter to call; see `Vm::op_read`). + pub(crate) fn accessor_read(&mut self, pair: Value, receiver: Value, key: Atom) -> Value { + let a = self.pair(pair); + if let Value::Undef = a.get { + return Value::Undef; + } + if self.is_restricted(&a.get) { + self.restricted_hit = true; + return Value::Uninit; + } + if self.is_companion(&a.get) { + return self.companion_value(receiver, key); + } + if self.op_access { + self.getter_hit = Some(a.get); + return Value::Undef; + } + self.program_read(receiver, key) + } + + /// A program getter's value for a built-in: read ahead, or undefined and recorded as missing; outside + /// `with_reads`, a fault. + fn program_read(&mut self, receiver: Value, key: Atom) -> Value { + if let Some(v) = self + .reads + .table + .iter() + .find(|(r, k, _)| *k == key && self.same_value(r, &receiver)) + .map(|(_, _, v)| *v) + { + return v; + } + if self.reads.depth == 0 { + if self.reads.fault.is_none() { + self.reads.fault = Some(key); + } + return Value::Undef; + } + if !self + .reads + .missing + .iter() + .any(|(r, k)| *k == key && self.same_value(r, &receiver)) + { + self.reads.missing.push((receiver, key)); + } + Value::Undef + } + + /// The value a built-in accessor's getter gives `receiver`, or `Uninit` for a receiver of another kind (which a + /// read turns into `accessor_error`). + pub(crate) fn companion_value(&mut self, receiver: Value, key: Atom) -> Value { + let Value::Obj(id) = receiver else { + return Value::Uninit; + }; + let kind = &self.heap[id as usize].kind; + if let Kind::Map(m) | Kind::Set(m) = kind + && key == self.names.size + { + return Value::Num(m.live as f64); + } + if crate::builtins::exotic::is_exotic(kind) + && let Some(v) = crate::builtins::exotic::get(self, id, key) + { + return v; + } + Value::Uninit + } + + /// The error for a built-in that reached a program accessor it cannot call. + pub(crate) fn unreachable_accessor(&mut self, key: Atom) -> Value { + let k = self.key_text(key); + self.type_error(&format!( + "A built-in cannot call the getter or setter '{k}' here; read the property into a variable first." + )) + } + + /// A native's result, failed instead when it reached a program accessor it cannot call. + #[inline] + pub(crate) fn checked_native(&mut self, r: Res) -> Res { + match self.reads.fault.take() { + None => r, + Some(key) => Err(self.unreachable_accessor(key)), + } + } + + /// Runs a built-in body whose reads may meet program getters, as the reference's `withReads`: a getter not read + /// yet reads as undefined and is recorded; if any were, the body's result (or failure) is dropped and the missing + /// getters are left in `reads.missing` for the caller to run (`Vm::prefetch`), after which the body runs again + /// from the start. So the body must be repeatable until it returns. + pub(crate) fn with_reads( + &mut self, + body: impl FnOnce(&mut Vm) -> Result, + ) -> WithReads { + let outer = std::mem::take(&mut self.reads.missing); + self.reads.depth += 1; + let r = body(self); + self.reads.depth -= 1; + let missing = std::mem::replace(&mut self.reads.missing, outer); + if missing.is_empty() { + WithReads::Done(r) + } else { + WithReads::Prefetch(missing) + } + } + + /// Whether a read in this `with_reads` round met a getter not read yet, so what it gave is only a placeholder. + pub(crate) fn reads_pending(&self) -> bool { + !self.reads.missing.is_empty() + } + + /// An object literal's `get x() {}` or `set x(v) {}` (and a host's live accessor): an existing accessor keeps its + /// other half; a data property, or no property, becomes an accessor with only this half. + pub(crate) fn define_accessor_half( + &mut self, + id: Id, + key: Atom, + setter: bool, + f: Value, + enumerable: bool, + ) { + let current = self.heap[id as usize] + .props + .prop(key) + .filter(|p| p.flags & ACCESSOR != 0) + .map(|p| self.pair(p.value)); + let mut a = current.unwrap_or(Accessor { + get: Value::Undef, + set: Value::Undef, + }); + if setter { + a.set = f; + } else { + a.get = f; + } + let pair = self.new_pair(a.get, a.set); + let flags = ACCESSOR | if enumerable { ENUMERABLE } else { 0 }; + let o = &mut self.heap[id as usize]; + o.flags |= ACCESSORS; + match o.props.find(key) { + Some(i) => { + o.props.items[i].value = pair; + o.props.items[i].flags = flags; + } + None => o.props.push_new(key, pair, flags), + } + } + + /// Whether `id` or an object on its chain ever had a program accessor (the reference's `accessorsOnChain`). + pub(crate) fn accessors_on_chain(&self, id: Id) -> bool { + let mut cur = Some(id); + while let Some(c) = cur { + let o = &self.heap[c as usize]; + if o.flags & ACCESSORS != 0 { + return true; + } + cur = o.proto; + } + false + } + + /// The accessor property `key` on `id`'s chain, if the first property found there is one: its halves. + pub(crate) fn accessor_on_chain(&self, id: Id, key: Atom) -> Option { + let mut cur = Some(id); + while let Some(c) = cur { + let o = &self.heap[c as usize]; + if let Some(p) = o.props.prop(key) { + return (p.flags & ACCESSOR != 0).then(|| self.pair(p.value)); + } + if self.has_own(c, key) { + return None; + } + cur = o.proto; + } + None + } + + /// [[Get]] for display and diagnostics, which never run program code: a program getter reads as undefined (the + /// reference's `peek`). + pub(crate) fn peek(&mut self, id: Id, key: Atom) -> Value { + let outer = self.op_access; + self.op_access = true; + let v = self.get_obj(id, key); + self.op_access = outer; + self.restricted_hit = false; + match self.getter_hit.take() { + Some(_) => Value::Undef, + None => v, + } + } + + /// Own enumerable string entries for display, which runs no program code: a program accessor shows as its label + /// (the reference's `shownEntries`), `Err` here. + pub(crate) fn shown_entries(&mut self, id: Id) -> Vec<(Atom, Result)> { + let has_accessors = self.heap[id as usize].flags & ACCESSORS != 0; + if !has_accessors { + return self + .own_entries(id) + .into_iter() + .map(|(k, v)| (k, Ok(v))) + .collect(); + } + let keys = self.own_keys(id); + keys.into_iter() + .map(|k| { + let label = self.heap[id as usize] + .props + .prop(k) + .filter(|p| p.flags & ACCESSOR != 0) + .map(|p| p.value) + .filter(|pair| self.is_program_accessor(*pair)) + .map(|pair| self.accessor_label(pair)); + match label { + Some(l) => (k, Err(l)), + None => (k, Ok(self.peek(id, k))), + } + }) + .collect() + } + + /// A property as display shows it, own or inherited: a program accessor by its label (`shownProperty`). + pub(crate) fn shown_property(&mut self, id: Id, key: Atom) -> Result { + let mut cur = Some(id); + while let Some(c) = cur { + if let Some(p) = self.heap[c as usize].props.prop(key) { + if p.flags & ACCESSOR != 0 && self.is_program_accessor(p.value) { + return Err(self.accessor_label(p.value)); + } + break; + } + if self.has_own(c, key) { + break; + } + cur = self.heap[c as usize].proto; + } + Ok(self.peek(id, key)) + } + + /// Whether the property `key` found first on `id`'s chain is an accessor with no getter, which a copy for the host + /// leaves out (the reference's `setterOnly`). + pub(crate) fn setter_only(&self, id: Id, key: Atom) -> bool { + self.accessor_on_chain(id, key) + .is_some_and(|a| matches!(a.get, Value::Undef)) + } + + /// How display shows a program accessor in place of its value, in Node's words. + pub(crate) fn accessor_label(&self, pair: Value) -> &'static str { + let a = self.pair(pair); + match (a.get, a.set) { + (Value::Undef, _) => "[Setter]", + (_, Value::Undef) => "[Getter]", + _ => "[Getter/Setter]", + } + } +} + +/// A method read (`o.m`, keeping `o`) that met a program getter: its frame's slots are the getter and the receiver, +/// and the slot under its callee is where the method goes (see `Vm::enter_getter_method`). +pub(crate) const SUB_GETTER_METHOD: u16 = 8; +/// A write that met a program setter: its slots are the setter, the receiver and the value, which the write gives. +pub(crate) const SUB_SETTER: u16 = 9; + +pub(crate) fn getter_method_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + match input { + Input::Start => { + let (g, o) = (fr.slot(vm, 0), fr.slot(vm, 1)); + fr.call_slots(vm, g, o, []) + } + Input::Returned(f) => { + vm.stack[fr.base() - 3] = f; + Ok(Step::Done(fr.get(vm, 1))) + } + Input::Threw(e) => Err(e), + Input::Finished(_) => Ok(Step::Done(Value::Undef)), + } +} + +pub(crate) fn setter_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + match input { + Input::Start => { + let (s, o, v) = (fr.slot(vm, 0), fr.slot(vm, 1), fr.slot(vm, 2)); + fr.call_slots(vm, s, o, [v]) + } + Input::Returned(_) => Ok(Step::Done(fr.get(vm, 2))), + Input::Threw(e) => Err(e), + Input::Finished(_) => Ok(Step::Done(Value::Undef)), + } +} + +impl Vm { + /// Calls the program getter an instruction's read met, with the read's receiver, as a call from the instruction: + /// its result is the read's. Whether a frame was pushed. + pub(crate) fn enter_getter(&mut self, g: Value, receiver: Value) -> Result { + self.push(g); + self.push(receiver); + self.call_op(0) + } + + /// `enter_getter` for a method read, which leaves the method under its receiver. + pub(crate) fn enter_getter_method(&mut self, g: Value, receiver: Value) -> Result<(), Value> { + self.push(receiver); + let r = self.enter_native_with( + crate::native::NativeOp::Callbacks, + SUB_GETTER_METHOD, + Value::Undef, + Value::Undef, + &[g, receiver], + ); + self.entered = false; + r.map(|_| ()) + } + + /// Calls the program setter an instruction's write met, with the receiver and the value; the write gives the value. + pub(crate) fn enter_setter( + &mut self, + s: Value, + receiver: Value, + v: Value, + ) -> Result<(), Value> { + let r = self.enter_native_with( + crate::native::NativeOp::Callbacks, + SUB_SETTER, + Value::Undef, + Value::Undef, + &[s, receiver, v], + ); + self.entered = false; + r.map(|_| ()) + } + + /// An instruction's property read: the value, or `None` once it called a program getter (`pushed` says whether + /// that left a frame to run, else the getter's value is on the stack already). + #[inline] + pub(crate) fn op_read(&mut self, o: &Value, key: Atom) -> Result { + self.op_access = true; + let r = self.get(o, key); + self.op_access = false; + let v = r?; + match self.getter_hit.take() { + None => Ok(Read::Value(v)), + Some(g) => Ok(Read::Getter(g)), + } + } + + /// [[Get]] for native code stepping the iterator protocol (`next`, `done`, `value`, `return`, `[Symbol.iterator]`), + /// which the reference reads in program code: a program getter is called here, inline, to completion. A getter + /// read this way cannot park or suspend the run. + pub(crate) fn get_calling(&mut self, id: Id, key: Atom) -> Res { + // Restored after, for the instruction whose read this is part of (a key's conversion). + let outer = self.op_access; + self.op_access = true; + let v = self.get_obj(id, key); + self.op_access = false; + let r = match self.getter_hit.take() { + Some(g) => self.call(&g, Value::Obj(id), &[]), + None => Ok(v), + }; + self.op_access = outer; + r + } + + /// `get_calling` for any value: a primitive's read through its prototype, an object's own. + pub(crate) fn get_calling_value(&mut self, v: &Value, key: Atom) -> Res { + let outer = self.op_access; + self.op_access = true; + let r = self.get(v, key); + self.op_access = false; + let r = match r { + Err(e) => Err(e), + Ok(x) => match self.getter_hit.take() { + Some(g) => self.call(&g, *v, &[]), + None => Ok(x), + }, + }; + self.op_access = outer; + r + } + + /// Whether `id`'s chain has a program getter for `key` first, which `get_calling` would call. + pub(crate) fn has_program_getter(&self, id: Id, key: Atom) -> bool { + if !self.accessors_on_chain(id) { + return false; + } + let mut cur = Some(id); + while let Some(c) = cur { + let o = &self.heap[c as usize]; + if let Some(p) = o.props.prop(key) { + return p.flags & ACCESSOR != 0 && self.is_program_half(&self.pair(p.value).get); + } + if self.has_own(c, key) { + return false; + } + cur = o.proto; + } + false + } + + /// `op_read` for a computed key. + #[inline] + pub(crate) fn op_read_elem(&mut self, o: &Value, k: &Value) -> Result { + self.op_access = true; + let r = self.get_elem(o, k); + self.op_access = false; + let v = r?; + match self.getter_hit.take() { + None => Ok(Read::Value(v)), + Some(g) => Ok(Read::Getter(g)), + } + } + + /// An instruction's write: whether it met a program setter, which `setter_hit` holds. + #[inline] + pub(crate) fn op_write( + &mut self, + o: &Value, + key: Atom, + v: Value, + ) -> Result, Value> { + self.op_access = true; + let r = self.set(o, key, v); + self.op_access = false; + r?; + Ok(self.setter_hit.take()) + } + + /// `op_write` for a computed key. + #[inline] + pub(crate) fn op_write_elem( + &mut self, + o: &Value, + k: &Value, + v: Value, + ) -> Result, Value> { + self.op_access = true; + let r = self.set_elem(o, k, v); + self.op_access = false; + r?; + Ok(self.setter_hit.take()) + } +} + +/// What an instruction's read found. +pub(crate) enum Read { + Value(Value), + Getter(Value), +} + +/// What `Vm::with_reads` gives: the body's outcome, or the getters it still needs. +pub(crate) enum WithReads { + Done(Result), + Prefetch(Vec<(Value, Atom)>), +} + +/// The companion of a built-in accessor's getter, as a program sees it (`Object.getOwnPropertyDescriptor(Map.prototype, +/// "size").get`): its data is the prototype that has the accessor, and its name `get `. +pub(crate) fn companion_get(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + let (owner, key) = companion_of(vm, callee); + if !inherits(vm, &this, owner) { + return Err(companion_error(vm, owner, key, &this)); + } + let v = vm.companion_value(this, key); + if let Value::Uninit = v { + return Err(companion_error(vm, owner, key, &this)); + } + Ok(v) +} + +/// The companion of a built-in accessor's setter. +pub(crate) fn companion_set(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let (owner, key) = companion_of(vm, callee); + if !inherits(vm, &this, owner) || matches!(vm.companion_value(this, key), Value::Uninit) { + return Err(companion_error(vm, owner, key, &this)); + } + let Value::Obj(id) = this else { + return Err(companion_error(vm, owner, key, &this)); + }; + vm.set_obj(id, key, crate::builtins::arg(args, 0))?; + Ok(Value::Undef) +} + +/// Whether `owner` is on `v`'s prototype chain: the kind of receiver a built-in accessor of `owner` serves. +fn inherits(vm: &Vm, v: &Value, owner: Id) -> bool { + let Value::Obj(id) = v else { return false }; + let mut cur = vm.heap[*id as usize].proto; + while let Some(p) = cur { + if p == owner { + return true; + } + cur = vm.heap[p as usize].proto; + } + false +} + +/// A companion's prototype and key. +fn companion_of(vm: &Vm, callee: Id) -> (Id, Atom) { + match &vm.heap[callee as usize].kind { + Kind::Native { data, name, .. } => { + let owner = data.as_obj().unwrap_or(0); + let text = vm.atoms.text(*name); + let key = text.get(4..).and_then(|k| vm.atoms.lookup(k)).unwrap_or(0); + (owner, key) + } + _ => (0, 0), + } +} + +fn companion_error(vm: &mut Vm, owner: Id, key: Atom, this: &Value) -> Value { + let (pk, nk) = (vm.names.constructor, vm.names.name); + let ctor = match vm.get_obj(owner, pk) { + Value::Obj(c) => match vm.get_obj(c, nk) { + Value::Str(s) => vm.text(s).to_owned(), + _ => String::new(), + }, + _ => String::new(), + }; + let k = vm.atoms.text(key).to_owned(); + crate::builtins::incompatible(vm, &format!("{ctor}.prototype.{k}"), this) +} + +impl Vm { + /// The attributes an array's elements share (the reference's `Arr.elements`): `seal` and `freeze` narrow them. + fn element_attrs(&self, id: Id) -> (bool, bool, bool) { + let flags = self.heap[id as usize].flags; + (flags & FROZEN == 0, true, flags & (FROZEN | SEALED) == 0) + } + + /// The own property `key` of `id`, as `Object.getOwnPropertyDescriptor` and `defineProperty` see it (the + /// reference's `own`): an array's live elements and `length`, a function's `name` and `length`, a built-in + /// accessor (whose halves become its companions), or an ordinary property. + pub(crate) fn own_slot(&mut self, id: Id, key: Atom) -> Option { + let flags = self.heap[id as usize].flags; + let index = self.atoms.index(key); + let fixed_all = flags & (FROZEN | SEALED) != 0; + let frozen = flags & FROZEN != 0; + match &self.heap[id as usize].kind { + Kind::Array(items) => { + let (w, e, c) = self.element_attrs(id); + if let Some(i) = index { + if let Some(v) = items.get(i as usize) { + if matches!(v, Value::Uninit) { + return None; + } + return Some(OwnSlot { + value: SlotValue::Data(*v), + writable: w, + enumerable: e, + configurable: c, + }); + } + if flags & SPARSE == 0 { + return None; + } + } else if key == self.names.length { + return Some(OwnSlot { + value: SlotValue::Data(Value::Num(self.array_len(id) as f64)), + writable: w, + enumerable: false, + configurable: false, + }); + } + } + Kind::Arguments(items) => { + if let Some(i) = index + && let Some(v) = items.get(i as usize) + && !matches!(v, Value::Uninit) + { + return Some(OwnSlot { + value: SlotValue::Data(*v), + writable: !frozen, + enumerable: true, + configurable: !fixed_all, + }); + } + } + Kind::Closure(_) | Kind::Native { .. } + if self.heap[id as usize].props.find(key).is_none() + && ((key == self.names.name && flags & NAME_DELETED == 0) + || (key == self.names.length && flags & LENGTH_DELETED == 0)) => + { + let v = self.get_obj(id, key); + return Some(OwnSlot { + value: SlotValue::Data(v), + writable: false, + enumerable: false, + configurable: !fixed_all, + }); + } + Kind::Bytes(_) if crate::builtins::bytes::has_own(self, id, key) => { + let v = self.get_obj(id, key); + return Some(OwnSlot { + value: SlotValue::Data(v), + writable: true, + enumerable: true, + configurable: true, + }); + } + _ => {} + } + let i = self.heap[id as usize].props.find(key)?; + let p = self.heap[id as usize].props.items[i].clone(); + if let Value::Uninit = p.value { + // A built-in accessor: from now on its halves are its companions. + let (get, set) = self.companions(id, key); + let pair = self.new_pair(get, set); + let o = &mut self.heap[id as usize]; + o.props.items[i].value = pair; + o.props.items[i].flags = ACCESSOR; + return Some(OwnSlot { + value: SlotValue::Accessor(get, set), + writable: false, + enumerable: false, + configurable: !fixed_all, + }); + } + let configurable = p.flags & FIXED == 0 && !fixed_all; + let enumerable = p.flags & ENUMERABLE != 0; + if p.flags & ACCESSOR != 0 { + let a = self.pair(p.value); + return Some(OwnSlot { + value: SlotValue::Accessor(a.get, a.set), + writable: false, + enumerable, + configurable, + }); + } + // A sparse array's far element shares the array's attributes; its length is the array's. + let writable = p.flags & WRITABLE != 0 && !frozen; + Some(OwnSlot { + value: SlotValue::Data(p.value), + writable, + enumerable, + configurable, + }) + } + + /// The companions of the built-in accessor `key` of the prototype `owner`: its getter, and its setter when it has + /// one (a URL's fields but `origin`). + fn companions(&mut self, owner: Id, key: Atom) -> (Value, Value) { + let text = self.key_text(key); + let get_name = format!("get {text}"); + let fp = self.realm.function_proto; + let make = |vm: &mut Vm, name: String, length: u8, f: crate::vm::NativeFn| { + let n = vm.atoms.intern(&name); + Value::Obj(vm.alloc(Obj::new( + Some(fp), + Kind::Native { + f, + data: Value::Obj(owner), + name: n, + length, + ctor: false, + }, + ))) + }; + let get = make(self, get_name, 0, companion_get); + let has_setter = owner == self.realm.std.url && text != "origin" && text != "searchParams"; + let set = if has_setter { + make(self, format!("set {text}"), 1, companion_set) + } else { + Value::Undef + }; + self.heap[owner as usize].flags |= ACCESSORS; + (get, set) + } + + /// Every own key of `id`, in the reference's `ownKeys` order: elements, an array's `length`, a function's `length` + /// and `name`, then integer keys ascending, other strings in insertion order, and the iterator symbols. + pub(crate) fn own_property_keys(&mut self, id: Id) -> Vec { + if self.is_namespace(id) { + return self.namespace_names(id).unwrap_or_default(); + } + let flags = self.heap[id as usize].flags; + let (name, length) = (self.names.name, self.names.length); + let mut out = Vec::new(); + let mut leading = Vec::new(); + match &self.heap[id as usize].kind { + Kind::Array(items) | Kind::Arguments(items) => { + let n = items.len(); + let present: Vec = (0..n) + .filter(|i| !matches!(items[*i], Value::Uninit)) + .collect(); + for i in present { + out.push(self.atoms.intern(&i.to_string())); + } + if matches!(self.heap[id as usize].kind, Kind::Array(_)) { + if flags & SPARSE != 0 { + for (i, _) in self.sparse_tail(id) { + out.push(self.atoms.intern(&i.to_string())); + } + } + leading.push(length); + } + } + Kind::Closure(_) | Kind::Native { .. } => { + let props = &self.heap[id as usize].props; + if flags & LENGTH_DELETED == 0 || props.find(length).is_some() { + leading.push(length); + } + if flags & NAME_DELETED == 0 || props.find(name).is_some() { + leading.push(name); + } + } + k if crate::builtins::exotic::is_exotic(k) => { + for i in 0..crate::builtins::exotic::index_len(self, id) { + out.push(self.atoms.intern(&i.to_string())); + } + } + _ => {} + } + let is_array = matches!(self.heap[id as usize].kind, Kind::Array(_)); + let is_fn = matches!( + self.heap[id as usize].kind, + Kind::Closure(_) | Kind::Native { .. } + ); + out.extend(leading.iter().copied()); + let props = &self.heap[id as usize].props; + let mut ints = Vec::new(); + let mut strs = Vec::new(); + let mut syms = Vec::new(); + for p in &props.items { + if leading.contains(&p.key) { + continue; + } + if p.key <= SYM_ASYNC_ITERATOR { + syms.push(p.key); + continue; + } + match self.atoms.index(p.key) { + // A sparse array's far elements are listed with its elements. + Some(_) if is_array => {} + Some(i) => ints.push((i, p.key)), + None => strs.push(p.key), + } + } + ints.sort_unstable_by_key(|(i, _)| *i); + // A function's integer keys come before its `length` and `name`. + if is_fn { + out.truncate(out.len() - leading.len()); + } + out.extend(ints.into_iter().map(|(_, k)| k)); + if is_fn { + out.extend(leading.iter().copied()); + } + out.extend(strs); + out.extend(syms); + out + } +} + +impl Vm { + /// A built-in's getters to read ahead before it runs again (the reference's `Prefetch`), as the request of a + /// restartable call (see `conversion.rs`): the sentinel error its body returns. A built-in that cannot run again + /// fails as one that reached the getter. + pub(crate) fn prefetch(&mut self, missing: Vec<(Value, Atom)>) -> Value { + if self.convert_ok { + if self.convert_req.is_none() { + self.convert_req = Some(crate::conversion::Request::Read(missing)); + } + return Value::Undef; + } + let key = missing.first().map_or(0, |(_, k)| *k); + self.unreachable_accessor(key) + } + + /// `with_reads`, with a `Prefetch` made the call's request. + pub(crate) fn reading( + &mut self, + body: impl FnOnce(&mut Vm) -> Result, + ) -> Result { + match self.with_reads(body) { + WithReads::Done(r) => r, + WithReads::Prefetch(missing) => Err(self.prefetch(missing)), + } + } + + /// ToPropertyDescriptor, under `with_reads`: each field through the chain, in the spec's order. + pub(crate) fn property_descriptor(&mut self, v: &Value) -> Result { + let Value::Obj(id) = *v else { + let d = crate::builtins::describe_value(self, v); + return Err(self.type_error(&format!("Property description must be an object: {d}"))); + }; + if self.is_namespace(id) { + let d = crate::builtins::describe_value(self, v); + return Err(self.type_error(&format!("Property description must be an object: {d}"))); + } + let mut desc = Descriptor::default(); + let names = [ + "enumerable", + "configurable", + "value", + "writable", + "get", + "set", + ]; + for (i, name) in names.iter().enumerate() { + let key = self.atoms.intern_static(name); + if !self.has_key(id, key) { + continue; + } + let x = self.get_obj(id, key); + let x = if let Value::Uninit = x { + return Err(crate::builtins::accessor_error(self, id, key)); + } else { + x + }; + match i { + 0 => desc.enumerable = Some(self.truthy(&x)), + 1 => desc.configurable = Some(self.truthy(&x)), + 2 => desc.value = Some(x), + 3 => desc.writable = Some(self.truthy(&x)), + _ => { + let callable = matches!(x, Value::Obj(f) if self.heap[f as usize].is_callable() && !self.is_namespace(f)); + if !matches!(x, Value::Undef) && !callable { + let d = crate::builtins::describe_value(self, &x); + let what = if i == 4 { "Getter" } else { "Setter" }; + return Err(self.type_error(&format!("{what} must be a function: {d}"))); + } + if i == 4 { + desc.get = Some(x); + } else { + desc.set = Some(x); + } + } + } + } + if desc.is_accessor() && desc.is_data() { + return Err(self.type_error( + "Invalid property descriptor. Cannot both specify accessors and a value or writable attribute.", + )); + } + Ok(desc) + } + + /// DefinePropertyOrThrow. + pub(crate) fn define_or_throw( + &mut self, + id: Id, + key: Atom, + desc: &Descriptor, + ) -> Result<(), Value> { + if let Some(v @ Value::Obj(_)) = desc.value { + let label = if matches!(self.heap[id as usize].kind, Kind::Array(_)) { + "Array assignment result" + } else { + "Object assignment result" + }; + self.reject_circular(id, &v, label)?; + } + if self.define_own_property(id, key, desc)? { + return Ok(()); + } + let k = self.key_text(key); + if self.heap[id as usize].flags & NON_EXTENSIBLE != 0 && self.own_slot(id, key).is_none() { + return Err(self.type_error(&format!( + "Cannot define property {k}, object is not extensible" + ))); + } + Err(self.type_error(&format!("Cannot redefine property: {k}"))) + } + + /// ValidateAndApplyPropertyDescriptor for an own property, as the reference's `defineOwnProperty`: false where the + /// spec answers false, and a TypeError for what the object model cannot hold (an accessor on an array element, + /// elements whose attributes differ from their array's shared ones). Everything is checked before anything changes. + pub(crate) fn define_own_property( + &mut self, + id: Id, + key: Atom, + desc: &Descriptor, + ) -> Result { + let current = self.own_slot(id, key); + let extensible = self.heap[id as usize].flags & NON_EXTENSIBLE == 0; + if current.is_none() && !extensible { + return Ok(false); + } + if let Some(c) = ¤t + && !self.compatible(c, desc) + { + return Ok(false); + } + let index = self.atoms.index(key); + match &self.heap[id as usize].kind { + Kind::Array(_) if index.is_some() => { + return self.define_element(id, index.unwrap_or_default() as usize, current, desc); + } + Kind::Array(_) if key == self.names.length => return self.define_length(id, desc), + Kind::Bytes(_) if index.is_some() => { + return self.define_byte(id, index.unwrap_or_default() as usize, key, desc); + } + Kind::Arguments(items) + if index.is_some_and(|i| { + items + .get(i as usize) + .is_some_and(|v| !matches!(v, Value::Uninit)) + }) => + { + // An argument with other attributes, or made an accessor, becomes an ordinary property. + let i = index.unwrap_or_default() as usize; + let slot = self.applied(current.as_ref(), desc); + let plain = matches!(slot.value, SlotValue::Data(_)) + && slot.writable + && slot.enumerable + && slot.configurable; + if let (true, SlotValue::Data(v)) = (plain, slot.value) + && let Kind::Arguments(items) = &mut self.heap[id as usize].kind + { + items[i] = v; + return Ok(true); + } + if let Kind::Arguments(items) = &mut self.heap[id as usize].kind { + items[i] = Value::Uninit; + } + self.write_slot(id, key, slot); + return Ok(true); + } + _ => {} + } + let slot = self.applied(current.as_ref(), desc); + self.write_slot(id, key, slot); + Ok(true) + } + + /// Whether `desc` may change a non-configurable `current` (a configurable one may change in any way). + fn compatible(&self, current: &OwnSlot, desc: &Descriptor) -> bool { + if current.configurable { + return true; + } + if desc.configurable == Some(true) { + return false; + } + if desc.enumerable.is_some_and(|e| e != current.enumerable) { + return false; + } + match current.value { + SlotValue::Data(v) => { + if desc.is_accessor() { + return false; + } + if current.writable { + return true; + } + desc.writable != Some(true) && !desc.value.is_some_and(|x| !self.same_value(&x, &v)) + } + SlotValue::Accessor(g, s) => { + if desc.is_data() { + return false; + } + desc.get.is_none_or(|x| self.strict_eq(&x, &g)) + && desc.set.is_none_or(|x| self.strict_eq(&x, &s)) + } + } + } + + /// The property `desc` makes: a new one from what it gives (false or undefined for what it leaves out), or an + /// existing one with its fields applied, where a change of kind keeps only the attributes. + fn applied(&self, current: Option<&OwnSlot>, desc: &Descriptor) -> OwnSlot { + let created = |desc: &Descriptor, enumerable: bool, configurable: bool| { + if desc.is_accessor() { + OwnSlot { + value: SlotValue::Accessor( + desc.get.unwrap_or_default(), + desc.set.unwrap_or_default(), + ), + writable: false, + enumerable, + configurable, + } + } else { + OwnSlot { + value: SlotValue::Data(desc.value.unwrap_or_default()), + writable: desc.writable.unwrap_or(false), + enumerable, + configurable, + } + } + }; + let Some(c) = current else { + return created( + desc, + desc.enumerable.unwrap_or(false), + desc.configurable.unwrap_or(false), + ); + }; + let enumerable = desc.enumerable.unwrap_or(c.enumerable); + let configurable = desc.configurable.unwrap_or(c.configurable); + match c.value { + SlotValue::Data(_) if desc.is_accessor() => created(desc, enumerable, configurable), + SlotValue::Accessor(..) if desc.is_data() => created(desc, enumerable, configurable), + SlotValue::Data(v) => OwnSlot { + value: SlotValue::Data(desc.value.unwrap_or(v)), + writable: desc.writable.unwrap_or(c.writable), + enumerable, + configurable, + }, + SlotValue::Accessor(g, s) => OwnSlot { + value: SlotValue::Accessor(desc.get.unwrap_or(g), desc.set.unwrap_or(s)), + writable: false, + enumerable, + configurable, + }, + } + } + + /// Stores a property as an ordinary one. + fn write_slot(&mut self, id: Id, key: Atom, slot: OwnSlot) { + let mut flags = 0; + if slot.enumerable { + flags |= ENUMERABLE; + } + if !slot.configurable { + flags |= FIXED; + } + let value = match slot.value { + SlotValue::Data(v) => { + if slot.writable { + flags |= WRITABLE; + } + v + } + SlotValue::Accessor(g, s) => { + flags |= ACCESSOR; + if self.is_program_half(&g) || self.is_program_half(&s) { + self.heap[id as usize].flags |= ACCESSORS; + } + self.new_pair(g, s) + } + }; + let o = &mut self.heap[id as usize]; + match o.props.find(key) { + Some(i) => { + o.props.items[i].value = value; + o.props.items[i].flags = flags; + } + None => o.props.push_new(key, value, flags), + } + } + + /// An array element: elements have no slots, so only data with the array's own attributes fits. + fn define_element( + &mut self, + id: Id, + i: usize, + current: Option, + desc: &Descriptor, + ) -> Result { + if desc.is_accessor() { + return Err(self.type_error( + "Accessor properties are not supported on array elements; store the value or use a plain object.", + )); + } + let (bw, be, bc) = current.map_or((false, false, false), |c| { + (c.writable, c.enumerable, c.configurable) + }); + let writable = desc.writable.unwrap_or(bw); + let enumerable = desc.enumerable.unwrap_or(be); + let configurable = desc.configurable.unwrap_or(bc); + if (writable, enumerable, configurable) != self.element_attrs(id) { + return Err(self.type_error( + "Array elements share their attributes; only writable, enumerable and configurable equal to the array's are supported.", + )); + } + if current.is_none() || desc.value.is_some() { + let key = self.atoms.intern(&i.to_string()); + self.define(id, key, desc.value.unwrap_or_default()); + } + Ok(true) + } + + /// An array's `length`: its value, or making it read-only, which the shared element attributes can't separate. + fn define_length(&mut self, id: Id, desc: &Descriptor) -> Result { + if desc.is_accessor() || desc.configurable == Some(true) || desc.enumerable == Some(true) { + return Ok(false); + } + if desc.writable == Some(false) && self.element_attrs(id).0 { + return Err(self.type_error( + "Making an array's length read-only is not supported; use Object.freeze.", + )); + } + if let Some(v) = desc.value { + let n = crate::builtins::builtin_number(self, &v)?; + if n != self.array_len(id) as f64 { + if self.heap[id as usize].flags & FROZEN != 0 { + return Ok(false); + } + let lk = self.names.length; + self.set_obj(id, lk, Value::Num(n))?; + } + } + Ok(true) + } + + /// A Uint8Array's element: data with the shared attributes, within its length. + fn define_byte( + &mut self, + id: Id, + i: usize, + key: Atom, + desc: &Descriptor, + ) -> Result { + if desc.is_accessor() { + return Err(self.type_error( + "Accessor properties are not supported on array elements; store the value or use a plain object.", + )); + } + if i >= crate::builtins::bytes::index_len(self, id) { + return Ok(false); + } + let attrs = ( + desc.writable.unwrap_or(true), + desc.enumerable.unwrap_or(true), + desc.configurable.unwrap_or(true), + ); + if attrs != (true, true, true) { + return Err(self.type_error( + "Array elements share their attributes; only writable, enumerable and configurable equal to the array's are supported.", + )); + } + if let Some(v) = desc.value { + let n = crate::builtins::builtin_number(self, &v)?; + self.set_obj(id, key, Value::Num(n))?; + } + Ok(true) + } + + /// FromPropertyDescriptor. + pub(crate) fn descriptor_object(&mut self, slot: Option) -> Value { + let Some(s) = slot else { + return Value::Undef; + }; + let id = self.new_object(); + let put = |vm: &mut Vm, name: &'static str, v: Value| { + let k = vm.atoms.intern_static(name); + vm.define(id, k, v); + }; + match s.value { + SlotValue::Data(v) => { + put(self, "value", v); + put(self, "writable", Value::Bool(s.writable)); + } + SlotValue::Accessor(g, st) => { + put(self, "get", g); + put(self, "set", st); + } + } + put(self, "enumerable", Value::Bool(s.enumerable)); + put(self, "configurable", Value::Bool(s.configurable)); + Value::Obj(id) + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/builtins/array.rs b/packages/codemode-rust/crates/psychoscript/src/builtins/array.rs new file mode 100644 index 0000000000000..dd5b400d747b2 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/builtins/array.rs @@ -0,0 +1,1896 @@ +//! Array and Array.prototype. + +use super::{arg, fuel, to_index}; +use crate::native::{FOR_OF_SLOTS, Flow, ForOf, Frame, Input, Step, enter_for_of}; +use crate::object::*; +use crate::ops::{Hint, MAX_ARRAY_LEN, without_holes}; +use crate::strings::StrId; +use crate::value::{Id, Slot, Value, to_integer}; +use crate::vm::{Res, Vm}; + +pub fn setup(vm: &mut Vm) { + let ap = vm.realm.array_proto; + let array = vm.ctor("Array", 1, array_ctor, ap, Value::Undef); + vm.methods( + array, + &[ + ("isArray", 1, array_is_array), + ("of", 0, array_of), + ("from", 1, array_from), + ], + ); + vm.methods( + ap, + &[ + ("join", 1, a_join), + ("toString", 0, a_to_string), + ("includes", 1, a_includes), + ("indexOf", 1, a_index_of), + ("lastIndexOf", 1, a_last_index_of), + ("at", 1, a_at), + ("slice", 2, a_slice), + ("concat", 1, a_concat), + ("flat", 0, a_flat), + ("reverse", 0, a_reverse), + ("sort", 1, a_sort), + ("toSorted", 1, a_to_sorted), + ("toReversed", 0, a_to_reversed), + ("with", 2, a_with), + ("push", 1, a_push), + ("unshift", 1, a_unshift), + ("pop", 0, a_pop), + ("shift", 0, a_shift), + ("splice", 2, a_splice), + ("toSpliced", 2, a_to_spliced), + ("fill", 1, a_fill), + ("copyWithin", 2, a_copy_within), + ("keys", 0, a_keys), + ("values", 0, a_values), + ("entries", 0, a_entries), + ("map", 1, a_map), + ("filter", 1, a_filter), + ("forEach", 1, a_for_each), + ("some", 1, a_some), + ("every", 1, a_every), + ("find", 1, a_find), + ("findIndex", 1, a_find_index), + ("findLast", 1, a_find_last), + ("findLastIndex", 1, a_find_last_index), + ("reduce", 1, a_reduce), + ("reduceRight", 1, a_reduce_right), + ("flatMap", 1, a_flat_map), + ("toLocaleString", 0, a_to_locale_string), + ], + ); + let vk = vm.atoms.intern_static("values"); + let values = vm.get_obj(ap, vk); + vm.define_hidden(ap, SYM_ITERATOR, values); +} + +/// `this` as the array an `Array.prototype` method needs, or the reference's error naming `callee`, the method. +fn arr_id(vm: &mut Vm, this: &Value, callee: Id) -> Result { + if let Value::Obj(id) = this + && let Kind::Array(_) = vm.heap[*id as usize].kind + { + return Ok(*id); + } + Err(not_an_array(vm, this, callee)) +} + +#[cold] +#[inline(never)] +fn not_an_array(vm: &mut Vm, this: &Value, callee: Id) -> Value { + let name = match vm.heap[callee as usize].kind { + Kind::Native { name, .. } => vm.atoms.text(name).to_owned(), + _ => String::new(), + }; + super::incompatible(vm, &format!("Array.prototype.{name}"), this) +} + +fn items(vm: &Vm, id: Id) -> &[Value] { + match &vm.heap[id as usize].kind { + Kind::Array(items) => items, + _ => &[], + } +} + +#[inline] +fn len(vm: &Vm, id: Id) -> usize { + vm.array_len(id) +} + +#[inline] +fn is_sparse(vm: &Vm, id: Id) -> bool { + vm.heap[id as usize].flags & SPARSE != 0 +} + +/// A sparse array's own element `i` past its items. +fn tail_elem(vm: &Vm, id: Id, i: usize) -> Option { + if !is_sparse(vm, id) { + return None; + } + let key = vm.atoms.lookup(&i.to_string())?; + vm.heap[id as usize].props.get(key).copied() +} + +/// Element `i` as the array holds it, with a hole read as `undefined` and not looked up on the prototypes. +fn item(vm: &Vm, id: Id, i: usize) -> Value { + match items(vm, id).get(i) { + Some(v) => undef(*v), + None => tail_elem(vm, id, i).unwrap_or_default(), + } +} + +/// The indexes below `n` a method that skips holes visits: `None` for all of them, or for a sparse array only +/// those it holds, so a huge length is not walked index by index. +fn visit_order(vm: &Vm, id: Id, n: usize) -> Option> { + if !is_sparse(vm, id) { + return None; + } + let dense = items(vm, id).len().min(n); + let tail = vm + .sparse_tail(id) + .into_iter() + .map(|(i, _)| i) + .filter(|i| *i < n); + Some((0..dense).chain(tail).collect()) +} + +/// The `k`th index of a visit order over `n` indexes, or `None` past its end. +#[inline] +fn visit_at(order: &Option>, n: usize, k: usize) -> Option { + match order { + None => (k < n).then_some(k), + Some(o) => o.get(k).copied(), + } +} + +/// Makes `this` array dense for a method that walks its items. +fn dense_id(vm: &mut Vm, this: &Value, callee: Id) -> Result { + let id = arr_id(vm, this, callee)?; + vm.densify(id)?; + Ok(id) +} + +fn undef(v: Value) -> Value { + match v { + Value::Uninit => Value::Undef, + v => v, + } +} + +/// Element `i` as `array[i]` reads it: a hole or an index past the end may be inherited. +#[inline] +fn read(vm: &mut Vm, id: Id, i: usize) -> Value { + match items(vm, id).get(i) { + Some(v) if !matches!(v, Value::Uninit) => *v, + _ => vm.missing_elem(id, i), + } +} + +/// Element `i` when `i in array`, which a hole or an index past the end may still be through the prototypes. +#[inline] +fn present(vm: &mut Vm, id: Id, i: usize) -> Option { + match items(vm, id).get(i) { + Some(v) if !matches!(v, Value::Uninit) => Some(*v), + _ => inherited(vm, id, i), + } +} + +#[cold] +fn inherited(vm: &mut Vm, id: Id, i: usize) -> Option { + vm.inherited_elem(id, i) +} + +/// The array's items for a mutating method, after `check_mutable`. +fn items_mut(vm: &mut Vm, id: Id, growth: Option) -> Result<&mut Vec, Value> { + check_mutable(vm, id, growth)?; + array_items(vm, id) +} + +/// The reference's check of what a mutating method's first write would hit on a frozen, sealed or non-extensible +/// array. `growth` is given by the methods that always write `length`: how many items they add (or remove, when +/// negative). +fn check_mutable(vm: &mut Vm, id: Id, growth: Option) -> Result<(), Value> { + let flags = vm.heap[id as usize].flags; + if flags & (NON_EXTENSIBLE | SEALED | FROZEN) == 0 { + return Ok(()); + } + let n = len(vm, id); + let g = growth.unwrap_or(0); + if g > 0 && flags & NON_EXTENSIBLE != 0 { + return Err(vm.type_error(&format!( + "Cannot add property {n}, object is not extensible." + ))); + } + if g < 0 && n > 0 && flags & SEALED != 0 { + return Err(vm.type_error(&format!("Cannot delete property '{}'.", n - 1))); + } + if flags & FROZEN != 0 && (n > 0 || growth.is_some()) { + let k = if n > 0 { "0" } else { "length" }; + return Err(vm.type_error(&format!("Cannot assign to read only property '{k}'."))); + } + Ok(()) +} + +fn array_items(vm: &mut Vm, id: Id) -> Result<&mut Vec, Value> { + if !matches!(vm.heap[id as usize].kind, Kind::Array(_)) { + return Err(vm.type_error("not an array")); + } + match &mut vm.heap[id as usize].kind { + Kind::Array(items) => Ok(items), + _ => unreachable!("checked above"), + } +} + +fn callback(vm: &mut Vm, args: &[Value], name: &str) -> Result { + super::require_callback(vm, &arg(args, 0), name) +} + +fn array_ctor(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + if args.len() == 1 + && let Value::Num(n) = args[0] + { + if n < 0.0 || n.fract() != 0.0 || n > MAX_ARRAY_LEN as f64 { + return Err(vm.range_error("Invalid array length.")); + } + return Ok(vm.new_array(vec![Value::Uninit; n as usize])); + } + Ok(vm.new_array(args.to_vec())) +} + +fn array_is_array(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + Ok(Value::Bool( + matches!(arg(args, 0), Value::Obj(id) if matches!(vm.heap[id as usize].kind, Kind::Array(_))), + )) +} + +fn array_of(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + Ok(vm.new_array(args.to_vec())) +} + +// The slots of `Array.from` over an iterable, after the loop's (see `native::ForOf`). +const FROM_MAPPER: usize = FOR_OF_SLOTS; +const FROM_THIS: usize = FOR_OF_SLOTS + 1; +const FROM_OUT: usize = FOR_OF_SLOTS + 2; + +/// The reference's `arrayFromIterable`: each value is mapped as it is read, and a mapper that throws closes the +/// iterator. +pub(crate) struct ArrayFromIterable; + +impl ForOf for ArrayFromIterable { + fn item(vm: &mut Vm, fr: Frame, x: Value) -> Result { + let out = fr.slot(vm, FROM_OUT).obj().unwrap_or(0); + let n = len(vm, out); + if n >= MAX_ARRAY_LEN { + return Err(vm.range_error("Invalid array length.")); + } + let mapper = fr.slot(vm, FROM_MAPPER); + if mapper == Slot::UNDEF { + if let Kind::Array(items) = &mut vm.heap[out as usize].kind { + items.push(x); + } + return Ok(Flow::Next); + } + let this_arg = fr.slot(vm, FROM_THIS); + Ok(Flow::Call(fr.catching( + vm, + mapper, + this_arg, + [Slot::pack(x), Slot::index(n)], + )?)) + } + + fn returned(vm: &mut Vm, fr: Frame, r: Slot) -> Result { + let out = fr.slot(vm, FROM_OUT).obj().unwrap_or(0); + if let Kind::Array(items) = &mut vm.heap[out as usize].kind { + items.push(r.get()); + } + Ok(Flow::Next) + } + + fn finish(vm: &mut Vm, fr: Frame) -> Res { + vm.bytecode_builtin(); + Ok(fr.get(vm, FROM_OUT)) + } +} + +fn array_from(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let src = arg(args, 0); + let mapper = match arg(args, 1) { + Value::Undef => None, + f => Some(super::require_callback(vm, &f, "Array.from")?), + }; + let this_arg = arg(args, 2); + if vm.is_iterable(&src) { + fuel::handoff(vm); + let out = vm.new_array(Vec::new()); + return enter_for_of( + vm, + crate::native::NativeOp::ArrayFromIterable, + callee, + Value::Undef, + src, + &[mapper.unwrap_or_default(), this_arg, out], + ); + } + let id = match src { + Value::Obj(id) + if !matches!( + vm.heap[id as usize].kind, + Kind::Promise(_) | Kind::Namespace(_) + ) => + { + id + } + _ => { + let d = vm.describe_data(&src); + return Err(vm.invalid_data(&format!( + "Array.from expects an iterable or array-like value, received {d}." + ))); + } + }; + let lk = vm.names.length; + let lv = vm.get_obj(id, lk); + let n = to_integer(vm.number_of(&lv)?).max(0.0); + if n > MAX_ARRAY_LEN as f64 { + return Err(vm.range_error("Invalid array length.")); + } + let n = n as usize; + let has_indexes = vm.heap[id as usize] + .props + .items + .iter() + .any(|p| vm.atoms.index(p.key).is_some()); + // With a mapper, the reference's `arrayFromLike`. + if let Some(f) = mapper { + fuel::handoff(vm); + let out = vm.new_array(Vec::with_capacity(n)); + let op = crate::native::NativeOp::ArrayFromLike; + let slots = [ + f, + this_arg, + src, + Value::Num(n as f64), + Value::Num(0.0), + Value::Bool(has_indexes), + out, + ]; + return vm.enter_native(op, callee, Value::Undef, &slots); + } + let mut out = Vec::with_capacity(n); + for i in 0..n { + out.push(match has_indexes { + true => vm.get_elem(&src, &Value::Num(i as f64))?, + false => Value::Undef, + }); + } + Ok(vm.new_array(out)) +} + +/// The step of `Array.from` over an array-like value with a mapper: the slots are the mapper, its receiver, the +/// source, its length, the next index, whether the source has indexes to read, and the result. +pub(crate) fn from_like_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + let out = fr.slot(vm, 6).obj().unwrap_or(0); + let mut i = fr.index(vm, 4); + match input { + Input::Returned(r) => { + if let Kind::Array(items) = &mut vm.heap[out as usize].kind { + items.push(r.get()); + } + fuel::step(vm); + i += 1; + fr.set_index(vm, 4, i); + } + Input::Threw(e) => return Err(e), + Input::Start | Input::Finished(_) => {} + } + if i >= fr.index(vm, 3) { + vm.bytecode_builtin(); + return Ok(Step::Done(Value::Obj(out))); + } + let v = match fr.get(vm, 5) { + Value::Bool(true) => { + let src = fr.get(vm, 2); + vm.get_elem(&src, &Value::Num(i as f64))? + } + _ => Value::Undef, + }; + let (f, this_arg) = (fr.slot(vm, 0), fr.slot(vm, 1)); + fr.call_slots(vm, f, this_arg, [Slot::pack(v), Slot::index(i)]) +} + +fn a_push(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = arr_id(vm, &this, callee)?; + check_mutable(vm, id, Some(args.len() as i64))?; + for a in args { + vm.reject_circular(id, a, "Array.push result")?; + } + if is_sparse(vm, id) { + return push_sparse(vm, id, args); + } + let items = array_items(vm, id)?; + if items.len() + args.len() > MAX_ARRAY_LEN { + return Err(vm.range_error("Invalid array length.")); + } + items.extend_from_slice(args); + Ok(Value::Num(items.len() as f64)) +} + +/// `push` on a sparse array: each value is a far element, up to the largest length an array may have. +fn push_sparse(vm: &mut Vm, id: Id, args: &[Value]) -> Res { + let n = len(vm, id); + if n + args.len() > u32::MAX as usize { + // As the reference's host words it: one value and several take different paths there. + return Err(vm.range_error(if args.len() == 1 { + "Length exceeded the maximum array length" + } else { + "Invalid array length" + })); + } + for (k, v) in args.iter().enumerate() { + let key = vm.atoms.intern(&(n + k).to_string()); + vm.set_obj(id, key, *v)?; + } + Ok(Value::Num((n + args.len()) as f64)) +} + +fn a_pop(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + let id = arr_id(vm, &this, callee)?; + if is_sparse(vm, id) { + check_mutable(vm, id, Some(-1))?; + let n = len(vm, id); + let last = vm.atoms.intern(&(n - 1).to_string()); + let v = item(vm, id, n - 1); + let lk = vm.names.length; + let o = &mut vm.heap[id as usize]; + o.props.remove(last); + o.props.insert(lk, Value::Num((n - 1) as f64), 0); + return Ok(v); + } + Ok(undef( + items_mut(vm, id, Some(-1))?.pop().unwrap_or_default(), + )) +} + +fn a_shift(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + let id = dense_id(vm, &this, callee)?; + let items = items_mut(vm, id, Some(-1))?; + if items.is_empty() { + return Ok(Value::Undef); + } + Ok(undef(items.remove(0))) +} + +fn a_unshift(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = dense_id(vm, &this, callee)?; + check_mutable(vm, id, Some(args.len() as i64))?; + for a in args { + vm.reject_circular(id, a, "Array.unshift result")?; + } + let items = array_items(vm, id)?; + items.splice(0..0, args.iter().cloned()); + Ok(Value::Num(items.len() as f64)) +} + +fn a_slice(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = arr_id(vm, &this, callee)?; + integers(vm, args, &[0, 1], |vm, args| { + let n = len(vm, id); + let s = to_index(vm, &arg(args, 0), n, 0)?; + let e = to_index(vm, &arg(args, 1), n, n)?; + if s >= e { + return Ok(vm.new_array(Vec::new())); + } + if is_sparse(vm, id) { + return slice_sparse(vm, id, s, e); + } + let out = items(vm, id)[s..e].to_vec(); + Ok(vm.new_array(out)) + }) +} + +/// `slice` of a sparse array: the elements it holds in the range, with holes between them. +fn slice_sparse(vm: &mut Vm, id: Id, s: usize, e: usize) -> Res { + if e - s > MAX_ARRAY_LEN { + return Err(vm.range_error("Invalid array length.")); + } + let mut out = vec![Value::Uninit; e - s]; + let dense = items(vm, id); + for (i, v) in dense.iter().enumerate().take(e).skip(s) { + out[i - s] = *v; + } + for (i, v) in vm.sparse_tail(id) { + if (s..e).contains(&i) { + out[i - s] = v; + } + } + Ok(vm.new_array(out)) +} + +fn splice_args(vm: &mut Vm, args: &[Value], n: usize) -> Result<(usize, usize), Value> { + let start = to_index(vm, &arg(args, 0), n, 0)?; + let count = match args.len() { + 0 => 0, + 1 => n - start, + _ => (to_integer(vm.number_of(&args[1])?).max(0.0) as usize).min(n - start), + }; + Ok((start, count)) +} + +fn a_splice(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = dense_id(vm, &this, callee)?; + integers(vm, args, &[0, 1], |vm, args| { + let n = len(vm, id); + let (start, count) = splice_args(vm, args, n)?; + let insert: Vec = args.iter().skip(2).cloned().collect(); + for a in &insert { + vm.reject_circular(id, a, "Array.splice result")?; + } + let items = items_mut(vm, id, Some(insert.len() as i64 - count as i64))?; + let removed: Vec = items.splice(start..start + count, insert).collect(); + Ok(vm.new_array(removed)) + }) +} + +fn a_to_spliced(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = dense_id(vm, &this, callee)?; + integers(vm, args, &[0, 1], |vm, args| { + let n = len(vm, id); + let (start, count) = splice_args(vm, args, n)?; + let mut out = without_holes(items(vm, id)); + out.splice(start..start + count, args.iter().skip(2).cloned()); + Ok(vm.new_array(out)) + }) +} + +fn a_concat(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = dense_id(vm, &this, callee)?; + let mut out = items(vm, id).to_vec(); + for a in args { + match a { + Value::Obj(o) if matches!(vm.heap[*o as usize].kind, Kind::Array(_)) => { + vm.densify(*o)?; + out.extend_from_slice(items(vm, *o)); + } + v => out.push(*v), + } + if out.len() > MAX_ARRAY_LEN { + return Err(vm.range_error("Invalid array length.")); + } + } + Ok(vm.new_array(out)) +} + +pub fn join(vm: &mut Vm, id: Id, sep: &str, seen: &mut Vec) -> Result { + if seen.contains(&id) { + return Ok(String::new()); + } + seen.push(id); + vm.densify(id)?; + let mut out = String::new(); + let n = len(vm, id); + for i in 0..n { + if i > 0 { + out.push_str(sep); + } + match items(vm, id).get(i).cloned().unwrap_or_default() { + Value::Undef | Value::Null | Value::Uninit => {} + Value::Str(s) => out.push_str(vm.text(s)), + Value::Num(x) => crate::value::write_num(&mut out, x), + Value::Obj(o) if matches!(vm.heap[o as usize].kind, Kind::Array(_)) => { + let s = join(vm, o, ",", seen)?; + out.push_str(&s); + } + v => { + let t = vm.string_of(&v)?; + out.push_str(vm.text(t)); + } + } + if out.len() > crate::ops::MAX_STRING_LEN { + return Err(vm.range_error("Invalid string length")); + } + } + seen.pop(); + Ok(out) +} + +fn a_join(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = arr_id(vm, &this, callee)?; + let sep = match arg(args, 0) { + Value::Undef => vm.static_str(","), + v => v, + }; + joined(vm, id, Some(sep)) +} + +fn a_to_string(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + let id = arr_id(vm, &this, callee)?; + joined(vm, id, None) +} + +/// The reference's `join` and `toString`: the separator (`join`'s) and the elements, holes and nullish ones as "", +/// are one list of conversions with the string hint (see `fuel::Conversions`), then joined. An element that is an +/// array converts through its own `toString`, as any object does. +fn joined(vm: &mut Vm, id: Id, sep: Option) -> Res { + vm.densify(id)?; + let is_obj = |v: &Value| matches!(v, Value::Obj(_)); + if !sep.as_ref().is_some_and(is_obj) && !items(vm, id).iter().any(is_obj) { + let sep = match sep { + Some(v) => { + let t = vm.string_of(&v)?; + vm.text(t).to_owned() + } + None => ",".to_owned(), + }; + let s = join(vm, id, &sep, &mut Vec::new())?; + return Ok(vm.string_val(s)); + } + let empty = vm.static_str(""); + let mut list: Vec = sep.into_iter().collect(); + let parts = list.len(); + list.extend(items(vm, id).iter().map(|v| match v { + Value::Undef | Value::Null | Value::Uninit => empty, + v => *v, + })); + let mut c = fuel::Conversions::default(); + c.convert(vm, &[Hint::String], &mut list, false)?; + let sep = match parts { + 0 => ",".to_owned(), + _ => { + let t = vm.string_of(&list[0])?; + vm.text(t).to_owned() + } + }; + let mut out = String::new(); + for (i, v) in list[parts..].iter().enumerate() { + if i > 0 { + out.push_str(&sep); + } + let t = vm.string_of(v)?; + out.push_str(vm.text(t)); + if out.len() > crate::ops::MAX_STRING_LEN { + return Err(vm.range_error("Invalid string length")); + } + } + let r = Ok(vm.string_val(out)); + c.finish(vm, r) +} + +/// The reference's `integers`: the arguments at `positions`, `undefined` where missing, are one list of conversions +/// with the number hint (see `fuel::Conversions`) before `body` reads them. +fn integers( + vm: &mut Vm, + args: &[Value], + positions: &[usize], + body: impl FnOnce(&mut Vm, &[Value]) -> Res, +) -> Res { + if !positions + .iter() + .any(|&p| matches!(args.get(p), Some(Value::Obj(_)))) + { + return body(vm, args); + } + let mut listed: Vec = positions.iter().map(|&p| arg(args, p)).collect(); + let mut c = fuel::Conversions::default(); + c.convert(vm, &[Hint::Number], &mut listed, false)?; + let mut converted = args.to_vec(); + for (&p, v) in positions.iter().zip(listed) { + if p < args.len() { + converted[p] = v; + } + } + let r = body(vm, &converted); + c.finish(vm, r) +} + +fn a_to_locale_string(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + fuel::method(vm); + let id = dense_id(vm, &this, callee)?; + fuel::native(vm); + let empty = vm.static_str(""); + let op = crate::native::NativeOp::ToLocaleString; + vm.enter_native( + op, + callee, + Value::Obj(id), + &[empty, Value::Num(0.0), Value::Num(0.0)], + ) +} + +/// The step of `toLocaleString`: the slots are the text so far, the next index, and whether a result is being +/// converted by a call. +pub(crate) fn to_locale_string_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + let id = fr.this_slot(vm).obj().unwrap_or(0); + let mut i = fr.index(vm, 1); + match input { + Input::Returned(r) => { + let r = r.get(); + let converted = fr.index(vm, 2) == 1; + fr.set_index(vm, 2, 0); + if !converted && vm.converts_by_call(&r, Hint::String) { + fr.set_index(vm, 2, 1); + return fr.convert(vm, r, Hint::String); + } + let s = vm.string_of(&r)?; + fuel::native(vm); + let out = fr.get(vm, 0); + let Value::Str(o) = out else { + return Ok(Step::Done(out)); + }; + if vm.text(o).len() + vm.text(s).len() > crate::ops::MAX_STRING_LEN { + return Err(vm.range_error("Invalid string length")); + } + let joined = vm.concat_strs(&[o, s]); + fr.set(vm, 0, joined); + i += 1; + fuel::step(vm); + } + Input::Threw(e) => return Err(e), + Input::Start | Input::Finished(_) => {} + } + let key = vm.atoms.intern_static("toLocaleString"); + while i < len(vm, id) { + if i > 0 + && let Value::Str(o) = fr.get(vm, 0) + { + let comma = vm.static_id(","); + let joined = vm.concat_strs(&[o, comma]); + fr.set(vm, 0, joined); + } + let item = read(vm, id, i); + if !item.is_nullish() { + let f = vm.get(&item, key)?; + fr.set_index(vm, 1, i); + return fr.call_slots(vm, Slot::pack(f), Slot::pack(item), []); + } + i += 1; + fuel::step(vm); + } + vm.bytecode_builtin(); + Ok(Step::Done(fr.get(vm, 0))) +} + +fn a_reverse(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + let id = dense_id(vm, &this, callee)?; + // Fewer than two items means no writes at all, so a frozen one-item array reverses fine. + if len(vm, id) > 1 { + items_mut(vm, id, None)?.reverse(); + } + Ok(this) +} + +fn a_to_reversed(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + let id = dense_id(vm, &this, callee)?; + let mut out = without_holes(items(vm, id)); + out.reverse(); + Ok(vm.new_array(out)) +} + +fn a_index_of(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = arr_id(vm, &this, callee)?; + let x = arg(args, 0); + let n = len(vm, id); + // An empty array answers before fromIndex converts. + if n == 0 { + return Ok(Value::Num(-1.0)); + } + integers(vm, args, &[1], |vm, args| { + let n = len(vm, id); + let from = to_index(vm, &arg(args, 1), n, 0)?; + let r = items(vm, id) + .iter() + .enumerate() + .skip(from) + .find(|(_, v)| !matches!(v, Value::Uninit) && vm.strict_eq(v, &x)) + .map(|(i, _)| i); + // A sparse array's far elements come after its items. + let r = r.or_else(|| { + vm.sparse_tail(id) + .into_iter() + .find(|(i, v)| *i >= from && *i < n && vm.strict_eq(v, &x)) + .map(|(i, _)| i) + }); + Ok(Value::Num(r.map_or(-1.0, |i| i as f64))) + }) +} + +fn a_last_index_of(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = arr_id(vm, &this, callee)?; + let x = arg(args, 0); + let n = len(vm, id); + if n == 0 { + return Ok(Value::Num(-1.0)); + } + integers(vm, args, &[1], |vm, args| { + let n = len(vm, id); + let from = if args.len() > 1 { + let k = to_integer(vm.number_of(&args[1])?); + if k < 0.0 { + n as f64 + k + } else { + k.min(n as f64 - 1.0) + } + } else { + n as f64 - 1.0 + }; + if from < 0.0 { + return Ok(Value::Num(-1.0)); + } + let from = from as usize; + let tail = vm.sparse_tail(id); + let far = tail + .iter() + .rev() + .find(|(i, v)| *i <= from && vm.strict_eq(v, &x)) + .map(|(i, _)| *i); + let items = items(vm, id); + let r = far.or_else(|| { + (0..=from.min(items.len().saturating_sub(1))) + .rev() + .find(|i| { + items + .get(*i) + .is_some_and(|v| !matches!(v, Value::Uninit) && vm.strict_eq(v, &x)) + }) + }); + Ok(Value::Num(r.map(|i| i as f64).unwrap_or(-1.0))) + }) +} + +fn a_includes(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = arr_id(vm, &this, callee)?; + let x = arg(args, 0); + let n = len(vm, id); + if n == 0 { + return Ok(Value::Bool(false)); + } + integers(vm, args, &[1], |vm, args| { + let n = len(vm, id); + let from = to_index(vm, &arg(args, 1), n, 0)?; + if is_sparse(vm, id) { + return Ok(Value::Bool(includes_sparse(vm, id, &x, from, n))); + } + Ok(Value::Bool( + items(vm, id) + .iter() + .skip(from) + .any(|v| vm.same_value_zero(&undef(*v), &x)), + )) + }) +} + +/// `includes` on a sparse array: its elements from `from`, and its holes, which read as undefined. +fn includes_sparse(vm: &Vm, id: Id, x: &Value, from: usize, n: usize) -> bool { + let dense = items(vm, id); + let tail = vm.sparse_tail(id); + let mut held = 0; + for v in dense.iter().skip(from) { + if !matches!(v, Value::Uninit) { + held += 1; + } + if vm.same_value_zero(&undef(*v), x) { + return true; + } + } + for (i, v) in &tail { + if *i >= from && *i < n { + held += 1; + if vm.same_value_zero(v, x) { + return true; + } + } + } + matches!(x, Value::Undef) && held < n.saturating_sub(from) +} + +/// The back-edges the reference's loop spends on the holes from `walked` up to `to`, which a sparse array's visit +/// skips here. +fn holes(vm: &mut Vm, walked: &mut usize, to: usize) { + if to > *walked { + vm.fuel_steps(to - *walked); + *walked = to; + } +} + +// The callback methods run as native frames (see `native.rs`): each checks its receiver and callback as the reference's +// prelude function does, then its frame calls the callback once per index. The slots of an `each` frame: +const EACH_F: usize = 0; +const EACH_THIS: usize = 1; +const EACH_N: usize = 2; +/// The position in the walk: an index, or for a sparse array a position in `EACH_ORDER`. +const EACH_K: usize = 3; +/// A sparse array's visit order (see `visit_order`) as an array of indexes, or `undefined`. +const EACH_ORDER: usize = 4; +/// The positions the reference's loop has passed, holes included (see `holes`). +const EACH_WALKED: usize = 5; +/// `map`'s and `filter`'s result. +const EACH_OUT: usize = 6; +const EACH_MODE: usize = 7; +/// The element and index of the call that is running. +const EACH_V: usize = 8; +const EACH_I: usize = 9; + +const FOR_EACH: usize = 0; +const MAP: usize = 1; +const FILTER: usize = 2; +const SOME: usize = 3; +const EVERY: usize = 4; +/// The find methods visit every index below the starting length, holes included, reading each element live. +const FIND: usize = 5; +const FIND_INDEX: usize = 6; +const FIND_LAST: usize = 7; +const FIND_LAST_INDEX: usize = 8; + +/// Starts a callback method on the array `id`, once `fuel::method` and the receiver check are spent: the rest of the +/// prologue of the reference's `findItem`, `forEachItem`, `mapItems`, `filterItems` or `testItems` (see `fuel.rs`). +fn each_start( + vm: &mut Vm, + id: Id, + callee: Id, + args: &[Value], + mode: usize, + name: &str, + out: Value, +) -> Res { + fuel::receiver_then_loop(vm); + let f = callback(vm, args, name)?; + fuel::native(vm); + let n = len(vm, id); + let order = match mode >= FIND { + true => None, + false => visit_order(vm, id, n), + }; + let order = match order { + Some(o) => vm.new_array(o.into_iter().map(|i| Value::Num(i as f64)).collect()), + None => Value::Undef, + }; + let zero = Value::Num(0.0); + vm.enter_native( + crate::native::NativeOp::ArrayEach, + callee, + Value::Obj(id), + &[ + f, + arg(args, 1), + Value::Num(n as f64), + zero, + order, + zero, + out, + Value::Num(mode as f64), + Value::Undef, + zero, + ], + ) +} + +/// The step of an `each` frame. Its slots stay packed: a callback runs per step, so this is the callback methods' +/// loop. +pub(crate) fn each_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + let mode = fr.index(vm, EACH_MODE); + let order = fr.slot(vm, EACH_ORDER).obj(); + let mut k = fr.index(vm, EACH_K); + match input { + Input::Start => {} + Input::Returned(r) => { + let i = fr.index(vm, EACH_I); + if mode != FOR_EACH + && let Some(done) = each_visit(vm, fr, mode, i, r) + { + vm.bytecode_builtin(); + return Ok(Step::Done(done)); + } + fuel::step(vm); + if order.is_some() { + fr.set_index(vm, EACH_WALKED, i + 1); + } + k += 1; + } + Input::Threw(e) => return Err(e), + Input::Finished(_) => {} + } + let this = fr.this_slot(vm); + let Some(id) = this.obj() else { + return Ok(Step::Done(Value::Undef)); + }; + let n = fr.index(vm, EACH_N); + if mode >= FIND { + if k >= n { + vm.bytecode_builtin(); + return Ok(Step::Done(each_end(vm, fr, mode))); + } + let i = if mode >= FIND_LAST { n - 1 - k } else { k }; + let v = read(vm, id, i); + return each_call(vm, fr, this, k, i, v); + } + let Some(order) = order else { + while k < n { + if let Some(v) = present(vm, id, k) { + return each_call(vm, fr, this, k, k, v); + } + fuel::step(vm); + k += 1; + } + vm.bytecode_builtin(); + return Ok(Step::Done(each_end(vm, fr, mode))); + }; + let mut walked = fr.index(vm, EACH_WALKED); + while let Some(i) = items(vm, order).get(k).map(|v| v.as_num() as usize) { + holes(vm, &mut walked, i); + if let Some(v) = present(vm, id, i) { + fr.set_index(vm, EACH_WALKED, walked); + return each_call(vm, fr, this, k, i, v); + } + fuel::step(vm); + walked = i + 1; + k += 1; + } + holes(vm, &mut walked, n); + vm.bytecode_builtin(); + Ok(Step::Done(each_end(vm, fr, mode))) +} + +/// Calls the callback of an `each` frame at position `k` on element `i`. +#[inline(always)] +fn each_call( + vm: &mut Vm, + fr: Frame, + this: Slot, + k: usize, + i: usize, + v: Value, +) -> Result { + let v = Slot::pack(v); + fr.set_index(vm, EACH_K, k); + fr.set_slot(vm, EACH_V, v); + fr.set_index(vm, EACH_I, i); + let (f, this_arg) = (fr.slot(vm, EACH_F), fr.slot(vm, EACH_THIS)); + fr.call_slots(vm, f, this_arg, [v, Slot::index(i), this]) +} + +/// What the callback's result `r` on element `i` does: the method's result when it stops the walk. +#[inline] +fn each_visit(vm: &mut Vm, fr: Frame, mode: usize, i: usize, r: Slot) -> Option { + let r = r.get(); + match mode { + MAP => { + if let Some(Kind::Array(out)) = fr + .slot(vm, EACH_OUT) + .obj() + .map(|o| &mut vm.heap[o as usize].kind) + { + out[i] = r; + } + None + } + FILTER => { + let v = fr.get(vm, EACH_V); + if vm.truthy(&r) + && let Some(Kind::Array(out)) = fr + .slot(vm, EACH_OUT) + .obj() + .map(|o| &mut vm.heap[o as usize].kind) + { + out.push(v); + } + None + } + SOME => vm.truthy(&r).then_some(Value::Bool(true)), + EVERY => (!vm.truthy(&r)).then_some(Value::Bool(false)), + FIND | FIND_LAST => vm.truthy(&r).then(|| fr.get(vm, EACH_V)), + FIND_INDEX | FIND_LAST_INDEX => vm.truthy(&r).then_some(Value::Num(i as f64)), + _ => None, + } +} + +/// The result of an `each` frame that visited every index. +fn each_end(vm: &Vm, fr: Frame, mode: usize) -> Value { + match mode { + MAP | FILTER => fr.get(vm, EACH_OUT), + SOME => Value::Bool(false), + EVERY => Value::Bool(true), + FIND_INDEX | FIND_LAST_INDEX => Value::Num(-1.0), + _ => Value::Undef, + } +} + +fn each_method( + vm: &mut Vm, + this: Value, + args: &[Value], + callee: Id, + mode: usize, + name: &str, +) -> Res { + fuel::method(vm); + let id = arr_id(vm, &this, callee)?; + each_start(vm, id, callee, args, mode, name, Value::Undef) +} + +fn a_find(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + each_method(vm, this, args, callee, FIND, "Array.find") +} + +fn a_find_index(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + each_method(vm, this, args, callee, FIND_INDEX, "Array.findIndex") +} + +fn a_find_last(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + each_method(vm, this, args, callee, FIND_LAST, "Array.findLast") +} + +fn a_find_last_index(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + each_method( + vm, + this, + args, + callee, + FIND_LAST_INDEX, + "Array.findLastIndex", + ) +} + +fn a_some(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + each_method(vm, this, args, callee, SOME, "Array.some") +} + +fn a_every(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + each_method(vm, this, args, callee, EVERY, "Array.every") +} + +fn a_for_each(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + each_method(vm, this, args, callee, FOR_EACH, "Array.forEach") +} + +fn a_filter(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + fuel::method(vm); + let id = arr_id(vm, &this, callee)?; + let out = vm.new_array(Vec::new()); + each_start(vm, id, callee, args, FILTER, "Array.filter", out) +} + +fn a_map(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + fuel::method(vm); + let id = arr_id(vm, &this, callee)?; + if len(vm, id) > MAX_ARRAY_LEN { + return Err(vm.range_error("Invalid array length.")); + } + // Skipped indexes stay holes. + let out = vm.new_array(vec![Value::Uninit; len(vm, id)]); + each_start(vm, id, callee, args, MAP, "Array.map", out) +} + +// The slots of a `reduce` frame. +const RED_F: usize = 0; +/// How many positions the walk visits: every index, or a sparse array's visit order. +const RED_N: usize = 1; +const RED_K: usize = 2; +const RED_ORDER: usize = 3; +const RED_WALKED: usize = 4; +const RED_ACC: usize = 5; +const RED_REVERSE: usize = 6; +/// The array's length. +const RED_FULL: usize = 7; + +fn reduce(vm: &mut Vm, this: Value, args: &[Value], callee: Id, reverse: bool) -> Res { + fuel::method(vm); + let id = arr_id(vm, &this, callee)?; + fuel::receiver_then_loop(vm); + let f = callback( + vm, + args, + if reverse { + "Array.reduceRight" + } else { + "Array.reduce" + }, + )?; + fuel::native(vm); + let full = len(vm, id); + let order = visit_order(vm, id, full); + let n = order.as_ref().map_or(full, Vec::len); + // The reference's loops walk every index, holes a sparse array skips here included: `walked` counts the + // positions its loops have passed, from the end for `reduceRight`. + let sparse = order.is_some(); + let mut walked = 0; + let mut k = 0; + let acc = if args.len() >= 2 { + args[1] + } else { + loop { + if k >= n { + if sparse { + holes(vm, &mut walked, full); + } + let label = if reverse { "reduceRight" } else { "reduce" }; + return Err(vm.type_error(&format!( + "Array.{label} of an empty array with no initial value." + ))); + } + k += 1; + let i = reduce_index(&order, n, reverse, k - 1); + if sparse { + let at = if reverse { full - 1 - i } else { i }; + holes(vm, &mut walked, at); + walked = at + 1; + } + if let Some(v) = present(vm, id, i) { + break v; + } + fuel::step(vm); + } + }; + let order = match order { + Some(o) => vm.new_array(o.into_iter().map(|i| Value::Num(i as f64)).collect()), + None => Value::Undef, + }; + vm.enter_native( + crate::native::NativeOp::ArrayReduce, + callee, + this, + &[ + f, + Value::Num(n as f64), + Value::Num(k as f64), + order, + Value::Num(walked as f64), + acc, + Value::Num(reverse as u8 as f64), + Value::Num(full as f64), + ], + ) +} + +/// The index at position `k` of a reduce's walk. +fn reduce_index(order: &Option>, n: usize, reverse: bool, k: usize) -> usize { + let k = if reverse { n - 1 - k } else { k }; + match order { + None => k, + Some(o) => o[k], + } +} + +/// The step of a `reduce` frame, on packed slots as `each_step`. +pub(crate) fn reduce_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + match input { + Input::Start => {} + Input::Returned(r) => { + fr.set_slot(vm, RED_ACC, r); + fuel::step(vm); + } + Input::Threw(e) => return Err(e), + Input::Finished(_) => {} + } + let this = fr.this_slot(vm); + let Some(id) = this.obj() else { + return Ok(Step::Done(Value::Undef)); + }; + let n = fr.index(vm, RED_N); + let reverse = fr.index(vm, RED_REVERSE) != 0; + let order = fr.slot(vm, RED_ORDER).obj(); + let mut k = fr.index(vm, RED_K); + while k < n { + let p = if reverse { n - 1 - k } else { k }; + let i = match order { + None => p, + Some(o) => items(vm, o).get(p).map_or(0, |v| v.as_num() as usize), + }; + k += 1; + if order.is_some() { + let full = fr.index(vm, RED_FULL); + let mut walked = fr.index(vm, RED_WALKED); + let at = if reverse { full - 1 - i } else { i }; + holes(vm, &mut walked, at); + fr.set_index(vm, RED_WALKED, at + 1); + } + if let Some(v) = present(vm, id, i) { + fr.set_index(vm, RED_K, k); + let (f, acc) = (fr.slot(vm, RED_F), fr.slot(vm, RED_ACC)); + return fr.call_slots( + vm, + f, + Slot::UNDEF, + [acc, Slot::pack(v), Slot::index(i), this], + ); + } + fuel::step(vm); + } + if order.is_some() { + let (full, mut walked) = (fr.index(vm, RED_FULL), fr.index(vm, RED_WALKED)); + holes(vm, &mut walked, full); + } + vm.bytecode_builtin(); + Ok(Step::Done(fr.get(vm, RED_ACC))) +} + +fn a_reduce(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + reduce(vm, this, args, callee, false) +} + +fn a_reduce_right(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + reduce(vm, this, args, callee, true) +} + +/// Checks a sort's comparator as the reference does, naming the method (`Array.sort`) in the error. +pub(super) fn sort_comparator(vm: &mut Vm, cmp: &Value, name: &str) -> Result<(), Value> { + if !matches!(cmp, Value::Undef) { + super::require_callback(vm, cmp, name)?; + } + Ok(()) +} + +/// The default sort of `list`: `undefined` last, the rest by their strings. +fn sort_default(vm: &mut Vm, list: Vec) -> Result, Value> { + let (defined, undefs): (Vec, Vec) = + list.into_iter().partition(|v| !matches!(v, Value::Undef)); + // The values are one list of conversions with the string hint (see `fuel::Conversions`). Over `SORT_RUN` the + // reference sorts in bounded native steps in its prelude (`sortDefault`). + let stepped = defined.len() > SORT_RUN; + let mut c = fuel::Conversions::default(); + let primitives = c.converted(vm, &[Hint::String], &defined, false)?; + let mut keys = Vec::with_capacity(primitives.len()); + for p in primitives.iter() { + keys.push(vm.string_of(p)?); + } + drop(primitives); + let keyed: Vec<(StrId, Value)> = keys.into_iter().zip(defined).collect(); + if stepped { + sort_default_fuel(vm, &c, keyed.len()); + } + c.finish(vm, Ok(()))?; + let mut sorted = merge_sort( + vm, + keyed, + &mut |vm, a: &(StrId, Value), b: &(StrId, Value)| { + Ok(vm.atoms.sref(a.0).cmp16(vm.atoms.sref(b.0)).is_gt()) + }, + )?; + let mut out: Vec = sorted.drain(..).map(|(_, v)| v).collect(); + out.extend(undefs); + Ok(out) +} + +/// The most values the reference's default sort sorts in one native call, and how many a merge step of the +/// bounded sort past it merges. +const SORT_RUN: usize = 4096; +const MERGE_STEP: usize = 65_536; + +/// The fuel of the reference's `sortDefault` over `n` values: `$SortState`, a `$SortStep` per run of `SORT_RUN` and +/// per `MERGE_STEP` values of each merge pass, a back-edge after each step that leaves work, `$SortResult` and +/// `$Sorted`, after the native's own call. +fn sort_default_fuel(vm: &mut Vm, c: &fuel::Conversions, n: usize) { + c.handoff(vm); + fuel::native(vm); + let mut steps = n.div_ceil(SORT_RUN); + let mut width = SORT_RUN; + while width < n { + steps += n.div_ceil(MERGE_STEP); + width *= 2; + } + for i in 0..steps { + fuel::native(vm); + if i + 1 < steps { + fuel::step(vm); + } + } + fuel::native(vm); + fuel::native(vm); + vm.bytecode_builtin(); +} + +/// Where a sort with a comparator puts its result (see `sort_with`). +pub(super) const SORT_IN_PLACE: usize = 0; +pub(super) const SORT_COPY: usize = 1; +pub(super) const SORT_BYTES: usize = 2; + +// The slots of a sort frame. The values being sorted, the merge buffer and the plan follow them on the frame's stack, +// already packed: a comparison reads and writes only the frame's own slots. +const SORT_F: usize = 0; +/// How many values are sorted: `undefined` and holes are left out. +const SORT_N: usize = 1; +const SORT_M: usize = 2; +/// The merge being made: its bounds, and where it has got to in each half. +const SORT_LOW: usize = 3; +const SORT_MIDDLE: usize = 4; +const SORT_HIGH: usize = 5; +const SORT_LEFT: usize = 6; +const SORT_RIGHT: usize = 7; +const SORT_UNDEFS: usize = 8; +const SORT_HOLES: usize = 9; +const SORT_TARGET: usize = 10; +/// Set while the comparator's result is converted by a call (see `Frame::convert`). +const SORT_CONV: usize = 11; +/// The values, at `SORT_WORK + i`; the buffer a merge fills, at the same indexes past `SORT_WORK + n`; then the +/// merges to make, in order, as `low, middle, high` triples. +const SORT_WORK: usize = 12; + +/// Starts a sort with the comparator `f` as the reference's `sortWith` runs it: a stable top-down merge sort, its +/// merges planned in post-order so the comparator sees the pairs the recursive sort compares, in the same order. A +/// result that is not above zero, or NaN, keeps the left value first. `undefined` sorts after the rest, then +/// `holes` holes; `target` says where the result goes. +pub(super) fn sort_with( + vm: &mut Vm, + callee: Id, + this: Value, + list: Vec, + f: Value, + holes: usize, + target: usize, +) -> Res { + fn plan(low: usize, high: usize, out: &mut Vec) { + if high - low <= 1 { + return; + } + let middle = low + (high - low) / 2; + plan(low, middle, out); + plan(middle, high, out); + out.extend([low, middle, high].map(Slot::index)); + } + let (work, undefs): (Vec, Vec) = + list.into_iter().partition(|v| !matches!(v, Value::Undef)); + let n = work.len(); + let mut merges = Vec::with_capacity(3 * n); + plan(0, n, &mut merges); + fuel::handoff(vm); + let (low, middle, high) = match merges.get(0..3) { + Some(t) => (t[0].f(), t[1].f(), t[2].f()), + None => (0.0, 0.0, 0.0), + }; + vm.enter_native( + crate::native::NativeOp::SortWith, + callee, + this, + &[ + f, + Value::Num(n as f64), + Value::Num(0.0), + Value::Num(low), + Value::Num(middle), + Value::Num(high), + Value::Num(low), + Value::Num(middle), + Value::Num(undefs.len() as f64), + Value::Num(holes as f64), + Value::Num(target as f64), + Value::Num(0.0), + ], + )?; + vm.stack.extend(work.into_iter().map(Slot::pack)); + vm.stack.resize(vm.stack.len() + n, Slot::UNDEF); + vm.stack.extend(merges); + Ok(Value::Undef) +} + +/// The step of a sort frame: one comparison per call. +pub(crate) fn sort_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + let (mut left, mut right) = (fr.index(vm, SORT_LEFT), fr.index(vm, SORT_RIGHT)); + let (mut middle, mut high) = (fr.index(vm, SORT_MIDDLE), fr.index(vm, SORT_HIGH)); + let n = fr.index(vm, SORT_N); + match input { + Input::Start => {} + Input::Returned(r) => { + let converted = fr.index(vm, SORT_CONV) == 1; + fr.set_index(vm, SORT_CONV, 0); + let order = match r.is_num() { + true => r.f(), + false => { + let v = r.get(); + if !converted && vm.converts_by_call(&v, Hint::Number) { + fr.set_index(vm, SORT_CONV, 1); + return fr.convert(vm, v, Hint::Number); + } + vm.number_of(&v)? + } + }; + // Merged values fill the merge's range in order: as many as each half has given. + let at = left + right - middle; + let item = if order <= 0.0 || order.is_nan() { + left += 1; + fr.set_index(vm, SORT_LEFT, left); + fr.slot(vm, SORT_WORK + left - 1) + } else { + right += 1; + fr.set_index(vm, SORT_RIGHT, right); + fr.slot(vm, SORT_WORK + right - 1) + }; + fr.set_slot(vm, SORT_WORK + n + at, item); + fuel::step(vm); + } + Input::Threw(e) => return Err(e), + Input::Finished(_) => {} + } + // Fewer than two values make no merges. + if n >= 2 { + loop { + if left < middle && right < high { + let (a, b) = ( + fr.slot(vm, SORT_WORK + left), + fr.slot(vm, SORT_WORK + right), + ); + let f = fr.slot(vm, SORT_F); + return fr.call_slots(vm, f, Slot::UNDEF, [a, b]); + } + let low = fr.index(vm, SORT_LOW); + let at = left + right - middle; + let work = fr.base() + SORT_WORK; + let aux = work + n; + vm.stack.copy_within(work + left..work + middle, aux + at); + vm.stack + .copy_within(work + right..work + high, aux + at + middle - left); + vm.stack.copy_within(aux + low..aux + high, work + low); + // `$MergeRest`, and the back-edge to the next merge. + fuel::native(vm); + fuel::step(vm); + let m = fr.index(vm, SORT_M) + 1; + let plan = SORT_WORK + 2 * n + 3 * m; + if m + 1 >= n { + break; + } + fr.set_index(vm, SORT_M, m); + let (low, mid, hi) = ( + fr.index(vm, plan), + fr.index(vm, plan + 1), + fr.index(vm, plan + 2), + ); + (left, right, middle, high) = (low, mid, mid, hi); + for (k, i) in [ + (SORT_LOW, low), + (SORT_MIDDLE, mid), + (SORT_HIGH, hi), + (SORT_LEFT, low), + (SORT_RIGHT, mid), + ] { + fr.set_index(vm, k, i); + } + } + } + fuel::native(vm); + vm.bytecode_builtin(); + let work = fr.base() + SORT_WORK; + let mut sorted: Vec = vm.stack[work..work + n].iter().map(|s| s.get()).collect(); + sorted.resize(n + fr.index(vm, SORT_UNDEFS), Value::Undef); + let this = fr.this_slot(vm).get(); + match fr.index(vm, SORT_TARGET) { + SORT_COPY => Ok(Step::Done(vm.new_array(sorted))), + SORT_BYTES => { + if let Some(id) = this.as_obj() { + super::bytes::put_sorted(vm, id, &sorted); + } + Ok(Step::Done(this)) + } + _ => { + sorted.resize(sorted.len() + fr.index(vm, SORT_HOLES), Value::Uninit); + if let Some(id) = this.as_obj() + && let Kind::Array(items) = &mut vm.heap[id as usize].kind + { + *items = sorted; + } + Ok(Step::Done(this)) + } + } +} + +type Greater<'a, T> = dyn FnMut(&mut Vm, &T, &T) -> Result + 'a; + +/// Stable merge sort with a fallible comparator; `greater(a, b)` means `a` sorts after `b`. +fn merge_sort( + vm: &mut Vm, + mut v: Vec, + greater: &mut Greater, +) -> Result, Value> { + let n = v.len(); + if n < 2 { + return Ok(v); + } + let run = 8; + for start in (0..n).step_by(run) { + let end = (start + run).min(n); + for i in start + 1..end { + let mut j = i; + while j > start && greater(vm, &v[j - 1], &v[j])? { + v.swap(j - 1, j); + j -= 1; + } + } + } + let mut width = run; + let mut buf: Vec = Vec::with_capacity(n); + while width < n { + buf.clear(); + let mut start = 0; + while start < n { + let mid = (start + width).min(n); + let end = (start + 2 * width).min(n); + let (mut i, mut j) = (start, mid); + while i < mid && j < end { + if greater(vm, &v[i], &v[j])? { + buf.push(v[j].clone()); + j += 1; + } else { + buf.push(v[i].clone()); + i += 1; + } + } + buf.extend_from_slice(&v[i..mid]); + buf.extend_from_slice(&v[j..end]); + start = end; + } + std::mem::swap(&mut v, &mut buf); + width *= 2; + } + Ok(v) +} + +/// Makes `this` dense for a sort, which fails as the reference's host does when it cannot copy the elements. +fn sort_id(vm: &mut Vm, this: &Value, callee: Id) -> Result { + let id = arr_id(vm, this, callee)?; + if len(vm, id) > MAX_ARRAY_LEN { + return Err(vm.range_error("Out of memory")); + } + vm.densify(id)?; + Ok(id) +} + +fn a_sort(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = sort_id(vm, &this, callee)?; + // Holes sort last, after undefined, and stay holes; a comparator that throws leaves the array as it was. + let cmp = arg(args, 0); + let list = items_mut(vm, id, None)?.clone(); + sort_comparator(vm, &cmp, "Array.sort")?; + let holes = list.iter().filter(|v| matches!(v, Value::Uninit)).count(); + let list: Vec = list + .into_iter() + .filter(|v| !matches!(v, Value::Uninit)) + .collect(); + if !matches!(cmp, Value::Undef) { + return sort_with(vm, callee, this, list, cmp, holes, SORT_IN_PLACE); + } + let mut sorted = sort_default(vm, list)?; + sorted.resize(sorted.len() + holes, Value::Uninit); + if let Kind::Array(items) = &mut vm.heap[id as usize].kind { + *items = sorted; + } + Ok(this) +} + +fn a_to_sorted(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = sort_id(vm, &this, callee)?; + let cmp = arg(args, 0); + sort_comparator(vm, &cmp, "Array.toSorted")?; + let list = without_holes(items(vm, id)); + if !matches!(cmp, Value::Undef) { + return sort_with(vm, callee, this, list, cmp, 0, SORT_COPY); + } + let sorted = sort_default(vm, list)?; + Ok(vm.new_array(sorted)) +} + +/// Flattens `list` into `out`, dropping holes at every level. +fn flatten(vm: &Vm, out: &mut Vec, list: &[Value], depth: f64) { + for v in list { + if let Value::Uninit = v { + continue; + } + if depth >= 1.0 + && let Value::Obj(o) = v + && let Kind::Array(inner) = &vm.heap[*o as usize].kind + { + flatten(vm, out, inner, depth - 1.0); + // A sparse array's far elements follow its items; its holes are dropped anyway. + let tail: Vec = vm.sparse_tail(*o).into_iter().map(|(_, v)| v).collect(); + flatten(vm, out, &tail, depth - 1.0); + continue; + } + out.push(*v); + } +} + +fn a_flat(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = dense_id(vm, &this, callee)?; + integers(vm, args, &[0], |vm, args| { + let depth = match arg(args, 0) { + Value::Undef => 1.0, + v => to_integer(vm.number_of(&v)?), + }; + let list = items(vm, id).to_vec(); + let mut out = Vec::new(); + flatten(vm, &mut out, &list, depth.min(64.0)); + Ok(vm.new_array(out)) + }) +} + +fn a_flat_map(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + // A returned array is read like the callback methods read theirs: live, skipping indexes not in it. The fuel is + // the reference's `Array$prototype$flatMap`, which runs its loops itself. + fuel::method(vm); + let id = arr_id(vm, &this, callee)?; + fuel::native(vm); + let f = callback(vm, args, "Array.flatMap")?; + fuel::native(vm); + let n = len(vm, id); + let order = match visit_order(vm, id, n) { + Some(o) => vm.new_array(o.into_iter().map(|i| Value::Num(i as f64)).collect()), + None => Value::Undef, + }; + let out = vm.new_array(Vec::new()); + let zero = Value::Num(0.0); + let op = crate::native::NativeOp::FlatMap; + vm.enter_native( + op, + callee, + this, + &[ + f, + arg(args, 1), + Value::Num(n as f64), + zero, + order, + zero, + out, + zero, + ], + ) +} + +/// The step of `flatMap`: the slots are the callback, its receiver, the length, the position, the visit order of a +/// sparse array, the positions walked, the result, and the index of the running call. +pub(crate) fn flat_map_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + let this = fr.this_slot(vm); + let id = this.obj().unwrap_or(0); + let out = fr.slot(vm, 6).obj().unwrap_or(0); + let order = fr.slot(vm, 4).obj(); + let n = fr.index(vm, 2); + let (mut k, mut walked) = (fr.index(vm, 3), fr.index(vm, 5)); + match input { + Input::Returned(r) => { + let mut flat = Vec::new(); + match r.get() { + Value::Obj(inner) if matches!(vm.heap[inner as usize].kind, Kind::Array(_)) => { + let m = len(vm, inner); + let inner_order = visit_order(vm, inner, m); + let mut inner_walked = 0; + let mut j = 0; + while let Some(at) = visit_at(&inner_order, len(vm, inner).min(m), j) { + j += 1; + holes(vm, &mut inner_walked, at); + if let Some(v) = present(vm, inner, at) { + flat.push(v); + } + fuel::step(vm); + inner_walked = at + 1; + } + let end = len(vm, inner).min(m); + holes(vm, &mut inner_walked, end); + } + r => flat.push(r), + } + if let Kind::Array(items) = &mut vm.heap[out as usize].kind { + items.extend(flat); + } + fuel::step(vm); + walked = fr.index(vm, 7) + 1; + } + Input::Threw(e) => return Err(e), + Input::Start | Input::Finished(_) => {} + } + loop { + let i = match order { + None => (k < n).then_some(k), + Some(o) => items(vm, o).get(k).map(|v| v.as_num() as usize), + }; + let Some(i) = i else { break }; + k += 1; + holes(vm, &mut walked, i); + if let Some(v) = present(vm, id, i) { + fr.set_index(vm, 3, k); + fr.set_index(vm, 5, walked); + fr.set_index(vm, 7, i); + let (f, this_arg) = (fr.slot(vm, 0), fr.slot(vm, 1)); + return fr.call_slots(vm, f, this_arg, [Slot::pack(v), Slot::index(i), this]); + } + fuel::step(vm); + walked = i + 1; + } + holes(vm, &mut walked, n); + vm.bytecode_builtin(); + Ok(Step::Done(Value::Obj(out))) +} + +fn a_fill(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = arr_id(vm, &this, callee)?; + integers(vm, args, &[1, 2], |vm, args| { + let n = len(vm, id); + let s = to_index(vm, &arg(args, 1), n, 0)?; + let e = to_index(vm, &arg(args, 2), n, n)?; + let v = arg(args, 0); + check_mutable(vm, id, None)?; + vm.reject_circular(id, &v, "Array.fill result")?; + if e > items(vm, id).len() { + vm.densify(id)?; + } + let items = array_items(vm, id)?; + for slot in items.iter_mut().take(e).skip(s) { + *slot = v; + } + Ok(this) + }) +} + +fn a_copy_within(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = dense_id(vm, &this, callee)?; + integers(vm, args, &[0, 1, 2], |vm, args| { + let n = len(vm, id); + let target = to_index(vm, &arg(args, 0), n, 0)?; + let start = to_index(vm, &arg(args, 1), n, 0)?; + let end = to_index(vm, &arg(args, 2), n, n)?; + let items = items_mut(vm, id, None)?; + if start < end && target < n { + let count = (end - start).min(n - target); + let copy: Vec = items[start..start + count].to_vec(); + items[target..target + count].copy_from_slice(©); + } + Ok(this) + }) +} + +fn rel_index(vm: &mut Vm, v: &Value, n: usize) -> Result, Value> { + let mut i = to_integer(vm.number_of(v)?); + if i < 0.0 { + i += n as f64; + } + Ok(if i < 0.0 || i >= n as f64 { + None + } else { + Some(i as usize) + }) +} + +fn a_at(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = arr_id(vm, &this, callee)?; + integers(vm, args, &[0], |vm, args| { + let n = len(vm, id); + Ok(match rel_index(vm, &arg(args, 0), n)? { + Some(i) => item(vm, id, i), + None => Value::Undef, + }) + }) +} + +fn a_with(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = dense_id(vm, &this, callee)?; + integers(vm, args, &[0], |vm, args| { + let n = len(vm, id); + let Some(i) = rel_index(vm, &arg(args, 0), n)? else { + return Err(vm.range_error("Array.with index is out of range.")); + }; + let mut out = without_holes(items(vm, id)); + out[i] = arg(args, 1); + Ok(vm.new_array(out)) + }) +} + +fn array_iter(vm: &mut Vm, this: &Value, kind: IterKind, callee: Id) -> Res { + let id = arr_id(vm, this, callee)?; + let proto = vm.realm.iter_proto; + Ok(Value::Obj(vm.alloc(Obj::new( + Some(proto), + Kind::ArrayIter { + target: id, + pos: 0, + kind, + }, + )))) +} + +fn a_keys(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + array_iter(vm, &this, IterKind::Keys, callee) +} + +fn a_values(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + array_iter(vm, &this, IterKind::Values, callee) +} + +fn a_entries(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + array_iter(vm, &this, IterKind::Entries, callee) +} diff --git a/packages/codemode-rust/crates/psychoscript/src/builtins/buffer.rs b/packages/codemode-rust/crates/psychoscript/src/builtins/buffer.rs new file mode 100644 index 0000000000000..0d7689e394c10 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/builtins/buffer.rs @@ -0,0 +1,1058 @@ +//! Node's Buffer: a Uint8Array whose text conversions default to UTF-8, with Node's encodings, errors and codes. + +use super::bytes::{ + as_bytes, base64_decode_node, base64_encode, bytes_of, bytes_ref, hex_encode, new_bytes, to_u8, + view_value, +}; +use super::{arg, describe_value}; +use crate::object::*; +use crate::ops::MAX_ARRAY_LEN; +use crate::value::{Id, Value, num_to_string, to_integer}; +use crate::vm::{Res, Vm}; + +#[derive(Clone, Copy, PartialEq)] +enum Enc { + Utf8, + Hex, + Base64, + Base64Url, + Latin1, + Ascii, + Utf16le, +} + +fn encoding_of(name: &str) -> Option { + Some(match name.to_ascii_lowercase().as_str() { + "utf8" | "utf-8" => Enc::Utf8, + "hex" => Enc::Hex, + "base64" => Enc::Base64, + "base64url" => Enc::Base64Url, + "latin1" | "binary" => Enc::Latin1, + "ascii" => Enc::Ascii, + "ucs2" | "ucs-2" | "utf16le" | "utf-16le" => Enc::Utf16le, + _ => return None, + }) +} + +/// A Node-style error: the program error of `kind` with Node's `code`. +fn node_error(vm: &mut Vm, kind: &str, message: &str, code: &str) -> Value { + let proto = match kind { + "RangeError" => vm.realm.range_error_proto, + "TypeError" => vm.realm.type_error_proto, + _ => vm.realm.error_proto, + }; + let e = vm.make_error(proto, message); + if let Value::Obj(id) = e { + let k = vm.atoms.intern_static("code"); + let c = vm.str_val(code); + vm.define(id, k, c); + } + e +} + +/// How Node's argument errors show the value they received. +fn received(vm: &mut Vm, v: &Value) -> String { + match v { + Value::Undef | Value::Uninit => "undefined".into(), + Value::Null => "null".into(), + Value::Str(s) => { + // Node cuts the value at 25 code units. + let r = vm.atoms.sref(*s); + let short = r.slice16(0, 25); + let more = if r.len16() > 25 { "..." } else { "" }; + format!("type string ('{short}'{more})") + } + Value::Num(n) => format!("type number ({})", num_to_string(*n)), + Value::Bool(b) => format!("type boolean ({b})"), + Value::Obj(_) if vm.is_callable(v) => "function ".into(), + Value::Obj(id) => { + let ctor = vm.names.constructor; + let name = match vm.get_obj(*id, ctor) { + Value::Obj(c) => { + let nk = vm.names.name; + match vm.get_obj(c, nk) { + Value::Str(s) => vm.text(s).to_owned(), + _ => String::new(), + } + } + _ => String::new(), + }; + if name.is_empty() { + "[Object: null prototype]".into() + } else { + format!("an instance of {name}") + } + } + Value::Sym(_) => "type symbol (Symbol(Symbol.iterator))".into(), + } +} + +fn encoding(vm: &mut Vm, v: &Value) -> Result, Value> { + match v { + Value::Undef => Ok(None), + Value::Str(s) => match encoding_of(vm.text(*s)) { + Some(e) => Ok(Some(e)), + None => { + let t = vm.text(*s).to_owned(); + Err(node_error( + vm, + "TypeError", + &format!("Unknown encoding: {t}"), + "ERR_UNKNOWN_ENCODING", + )) + } + }, + v => { + let s = vm.string_of(v)?; + let t = vm.text(s).to_owned(); + Err(node_error( + vm, + "TypeError", + &format!("Unknown encoding: {t}"), + "ERR_UNKNOWN_ENCODING", + )) + } + } +} + +/// A string's bytes in `enc`: UTF-8 writes a lone surrogate as U+FFFD, the single-byte and UTF-16 encodings take +/// its code units. +fn encode(r: crate::strings::StrRef, enc: Enc) -> Vec { + let s = r.s; + match enc { + Enc::Utf8 => crate::strings::host_text(s).as_bytes().to_vec(), + Enc::Hex => { + let b = s.as_bytes(); + let mut out = Vec::new(); + for p in b.chunks(2) { + if p.len() < 2 { + break; + } + match ((p[0] as char).to_digit(16), (p[1] as char).to_digit(16)) { + (Some(h), Some(l)) => out.push((h * 16 + l) as u8), + _ => break, + } + } + out + } + Enc::Base64 | Enc::Base64Url => base64_decode_node(s), + Enc::Latin1 | Enc::Ascii => r.iter16().map(|u| u as u8).collect(), + Enc::Utf16le => r.iter16().flat_map(|u| u.to_le_bytes()).collect(), + } +} + +fn decode(data: &[u8], enc: Enc) -> String { + match enc { + Enc::Utf8 => crate::strings::external_text(String::from_utf8_lossy(data).into_owned()), + Enc::Hex => hex_encode(data), + Enc::Base64 => base64_encode(data, false, true), + Enc::Base64Url => base64_encode(data, true, false), + Enc::Latin1 => data.iter().map(|b| *b as char).collect(), + Enc::Ascii => data.iter().map(|b| (b & 0x7f) as char).collect(), + Enc::Utf16le => { + let units: Vec = data + .as_chunks::<2>() + .0 + .iter() + .map(|p| u16::from_le_bytes(*p)) + .collect(); + // Lone surrogates stay, as the reference decodes them. + crate::strings::from_units(&units) + } + } +} + +pub fn setup(vm: &mut Vm) { + let up = vm.realm.std.uint8; + let proto = vm.plain(up); + vm.realm.std.buffer = proto; + let ctor = vm.ctor("Buffer", 2, buffer_call, proto, Value::Undef); + // Bun inherits this from Uint8Array; Buffer's constructor here does not. + vm.constant(ctor, "BYTES_PER_ELEMENT", Value::Num(1.0)); + vm.methods( + ctor, + &[ + ("from", 3, buffer_from), + ("alloc", 3, buffer_alloc), + ("allocUnsafe", 1, buffer_alloc_unsafe), + ("allocUnsafeSlow", 1, buffer_alloc_unsafe), + ("byteLength", 2, buffer_byte_length), + ("concat", 2, buffer_concat), + ("isBuffer", 1, buffer_is_buffer), + ("isEncoding", 1, buffer_is_encoding), + ("compare", 2, buffer_compare), + ], + ); + let k = vm.atoms.intern_static("poolSize"); + vm.define_hidden(ctor, k, Value::Num(8192.0)); + vm.methods( + proto, + &[ + ("toString", 3, b_to_string), + ("toJSON", 0, b_to_json), + ("slice", 2, b_slice), + ("subarray", 2, b_slice), + ("equals", 1, b_equals), + ("compare", 5, b_compare), + ("indexOf", 3, b_index_of), + ("lastIndexOf", 3, b_last_index_of), + ("includes", 3, b_includes), + ("write", 4, b_write), + ("fill", 4, b_fill), + ("copy", 4, b_copy), + ], + ); + for (i, (name, ..)) in NUMERIC.iter().enumerate() { + let f = vm.native_fn(name, 2, b_numeric, Value::Num(i as f64)); + let k = vm.atoms.intern_static(name); + vm.define_hidden(proto, k, f); + } + vm.methods( + proto, + &[ + ("swap16", 0, b_swap16), + ("swap32", 0, b_swap32), + ("swap64", 0, b_swap64), + ], + ); +} + +fn wrap(vm: &mut Vm, data: Vec) -> Value { + new_bytes(vm, data, true) +} + +fn this_buf(vm: &mut Vm, this: &Value, name: &str) -> Result { + if let Value::Obj(id) = this + && let Kind::Bytes(_) = vm.heap[*id as usize].kind + { + return Ok(*id); + } + Err(super::incompatible( + vm, + &format!("Buffer.prototype.{name}"), + this, + )) +} + +fn bytes_from(vm: &mut Vm, value: &Value, second: &Value, third: &Value) -> Result, Value> { + if let Value::Str(s) = value { + let enc = encoding(vm, second)?.unwrap_or(Enc::Utf8); + return Ok(encode(vm.atoms.sref(*s), enc)); + } + if let Some(data) = bytes_of(vm, value) { + let offset = match second { + Value::Undef => 0.0, + v => vm.number_of(v)?, + }; + let start = to_integer(offset).clamp(0.0, data.len() as f64) as usize; + let end = match third { + Value::Undef => data.len(), + v => (start as f64 + to_integer(vm.number_of(v)?)) + .clamp(start as f64, data.len() as f64) as usize, + }; + return Ok(data[start..end].to_vec()); + } + if let Value::Obj(id) = value { + let id = *id; + if matches!(vm.heap[id as usize].kind, Kind::Array(_)) { + vm.densify(id)?; + } + if let Kind::Array(items) = &vm.heap[id as usize].kind { + let items = items.clone(); + let mut out = Vec::with_capacity(items.len()); + for v in items { + out.push(to_u8(vm.number_of(&v)?)); + } + return Ok(out); + } + let (tk, dk) = ( + vm.atoms.intern_static("type"), + vm.atoms.intern_static("data"), + ); + let t = vm.get_obj(id, tk); + let d = vm.get_obj(id, dk); + if let (Value::Str(t), Value::Obj(did)) = (t, d) + && vm.text(t) == "Buffer" + && matches!(vm.heap[did as usize].kind, Kind::Array(_)) + && vm.densify(did).is_ok() + && let Kind::Array(items) = &vm.heap[did as usize].kind + { + let items = items.clone(); + let mut out = Vec::with_capacity(items.len()); + for v in items { + out.push(to_u8(vm.number_of(&v)?)); + } + return Ok(out); + } + let lk = vm.names.length; + if let Value::Num(n) = vm.get_obj(id, lk) { + let n = to_integer(n).clamp(0.0, MAX_ARRAY_LEN as f64) as usize; + let mut out = Vec::with_capacity(n); + for i in 0..n { + let v = vm.get_elem(value, &Value::Num(i as f64))?; + out.push(to_u8(vm.number_of(&v)?)); + } + return Ok(out); + } + } + let d = describe_value(vm, value); + Err(node_error( + vm, + "TypeError", + &format!( + "The first argument must be of type string or an instance of Buffer, Uint8Array, or Array or an Array-like Object. Received {d}" + ), + "ERR_INVALID_ARG_TYPE", + )) +} + +fn buffer_call(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let data = bytes_from(vm, &arg(args, 0), &arg(args, 1), &arg(args, 2))?; + Ok(wrap(vm, data)) +} + +fn buffer_from(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + buffer_call(vm, Value::Undef, args, 0) +} + +fn size(vm: &mut Vm, v: &Value) -> Result { + let n = vm.number_of(v)?; + if n.fract() != 0.0 || !n.is_finite() || n < 0.0 || n > MAX_ARRAY_LEN as f64 { + let s = vm.string_of(v)?; + let s = vm.text(s).to_owned(); + return Err(node_error( + vm, + "RangeError", + &format!("The argument 'size' is invalid. Received {s}"), + "ERR_OUT_OF_RANGE", + )); + } + Ok(n as usize) +} + +/// Fills `data[start..end]` with a fill value as Node's `fill` reads it. +fn fill_with(vm: &mut Vm, data: &mut [u8], value: &Value, enc: Option) -> Result<(), Value> { + let pattern = match value { + Value::Str(s) => { + let p = encode(vm.atoms.sref(*s), enc.unwrap_or(Enc::Utf8)); + if p.is_empty() && !data.is_empty() { + vec![0] + } else { + p + } + } + Value::Num(n) => vec![to_u8(*n)], + Value::Bool(b) => vec![*b as u8], + v => match bytes_of(vm, v) { + Some(b) => b, + None => vec![to_u8(vm.number_of(v)?)], + }, + }; + if pattern.is_empty() { + return Ok(()); + } + for (i, slot) in data.iter_mut().enumerate() { + *slot = pattern[i % pattern.len()]; + } + Ok(()) +} + +fn buffer_alloc(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let n = size(vm, &arg(args, 0))?; + let mut data = vec![0; n]; + let fill = arg(args, 1); + if !matches!(fill, Value::Undef) { + let enc = if let Value::Str(_) = fill { + encoding(vm, &arg(args, 2))? + } else { + None + }; + fill_with(vm, &mut data, &fill, enc)?; + } + Ok(wrap(vm, data)) +} + +fn buffer_alloc_unsafe(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let n = size(vm, &arg(args, 0))?; + Ok(wrap(vm, vec![0; n])) +} + +fn buffer_byte_length(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let v = arg(args, 0); + if let Some(b) = as_bytes(vm, &v) { + return Ok(Value::Num(b.len as f64)); + } + let s = vm.string_of(&v)?; + let enc = encoding(vm, &arg(args, 1))?.unwrap_or(Enc::Utf8); + let text = vm.text(s); + let n = match enc { + Enc::Utf8 => crate::strings::host_text(text).len(), + Enc::Latin1 | Enc::Ascii => vm.atoms.sref(s).len16(), + Enc::Utf16le => vm.atoms.sref(s).len16() * 2, + Enc::Hex => text.len() / 2, + Enc::Base64 | Enc::Base64Url => { + let mut len = text.len(); + let b = text.as_bytes(); + if len > 0 && b[len - 1] == b'=' { + len -= 1; + } + if len > 0 && b[len - 1] == b'=' { + len -= 1; + } + len * 3 / 4 + } + }; + Ok(Value::Num(n as f64)) +} + +fn buffer_concat(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let list = arg(args, 0); + if let Value::Obj(id) = list + && matches!(vm.heap[id as usize].kind, Kind::Array(_)) + { + vm.densify(id)?; + } + let items = match list { + Value::Obj(id) => match &vm.heap[id as usize].kind { + Kind::Array(items) => items.clone(), + _ => Vec::new(), + }, + _ => Vec::new(), + }; + if !matches!(&list, Value::Obj(id) if matches!(vm.heap[*id as usize].kind, Kind::Array(_))) { + let d = describe_value(vm, &list); + return Err(vm.type_error(&format!( + "Buffer.concat expects an array of Buffers, received {d}." + ))); + } + let mut parts = Vec::with_capacity(items.len()); + for item in &items { + match bytes_of(vm, item) { + Some(b) => parts.push(b), + None => { + let d = describe_value(vm, item); + return Err(vm.type_error(&format!( + "Buffer.concat expects an array of Buffers, received {d} in it." + ))); + } + } + } + let total = match arg(args, 1) { + Value::Undef => parts.iter().map(Vec::len).sum(), + v => size(vm, &v)?, + }; + let mut out: Vec = parts.concat(); + out.resize(total, 0); + Ok(wrap(vm, out)) +} + +fn buffer_is_buffer(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + Ok(Value::Bool( + as_bytes(vm, &arg(args, 0)).is_some_and(|b| b.buffer), + )) +} + +fn buffer_is_encoding(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + Ok(Value::Bool(match arg(args, 0) { + Value::Str(s) => encoding_of(vm.text(s)).is_some(), + _ => false, + })) +} + +fn ordering(o: std::cmp::Ordering) -> Value { + Value::Num(match o { + std::cmp::Ordering::Less => -1.0, + std::cmp::Ordering::Equal => 0.0, + std::cmp::Ordering::Greater => 1.0, + }) +} + +fn buffer_compare(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + match (bytes_of(vm, &arg(args, 0)), bytes_of(vm, &arg(args, 1))) { + (Some(a), Some(b)) => Ok(ordering(a.cmp(&b))), + _ => Err(vm.type_error("Buffer.compare expects two Buffers or Uint8Arrays.")), + } +} + +// ---------- prototype ---------- + +fn b_to_string(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = this_buf(vm, &this, "toString")?; + let data = bytes_ref(vm, id).to_vec(); + let enc = encoding(vm, &arg(args, 0))?.unwrap_or(Enc::Utf8); + let start = match arg(args, 1) { + Value::Undef => 0.0, + v => vm.number_of(&v)?.max(0.0), + }; + let end = match arg(args, 2) { + Value::Undef => data.len() as f64, + v => vm.number_of(&v)?.min(data.len() as f64), + }; + let (s, e) = ( + to_integer(start) as usize, + to_integer(end).max(0.0) as usize, + ); + let part = if s < e && s < data.len() { + &data[s..e] + } else { + &[][..] + }; + let out = decode(part, enc); + Ok(vm.string_val(out)) +} + +fn b_to_json(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let id = this_buf(vm, &this, "toJSON")?; + let data: Vec = bytes_ref(vm, id) + .to_vec() + .into_iter() + .map(|b| Value::Num(b as f64)) + .collect(); + let arr = vm.new_array(data); + let o = vm.new_object(); + let (tk, dk) = ( + vm.atoms.intern_static("type"), + vm.atoms.intern_static("data"), + ); + let t = vm.static_str("Buffer"); + vm.define(o, tk, t); + vm.define(o, dk, arr); + Ok(Value::Obj(o)) +} + +fn b_slice(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = this_buf(vm, &this, "slice")?; + let len = bytes_ref(vm, id).len as f64; + let clamp = |vm: &mut Vm, v: &Value, fallback: f64| -> Result { + if let Value::Undef = v { + return Ok(fallback as usize); + } + let n = vm.number_of(v)?; + let i = if n.is_nan() { 0.0 } else { n.trunc() }; + Ok(if i < 0.0 { + (len + i).max(0.0) as usize + } else { + i.min(len) as usize + }) + }; + let s = clamp(vm, &arg(args, 0), 0.0)?; + let e = clamp(vm, &arg(args, 1), len)?; + let v = bytes_ref(vm, id).view(s, e, true); + Ok(view_value(vm, v)) +} + +fn b_equals(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = this_buf(vm, &this, "equals")?; + let other = arg(args, 0); + let Some(b) = bytes_of(vm, &other) else { + let d = describe_value(vm, &other); + return Err(vm.type_error(&format!( + "The \"otherBuffer\" argument must be an instance of Buffer or Uint8Array. Received {d}" + ))); + }; + Ok(Value::Bool(bytes_ref(vm, id).to_vec() == b)) +} + +fn range_arg( + vm: &mut Vm, + v: &Value, + name: &str, + default: usize, + max: usize, +) -> Result { + match v { + Value::Undef => Ok(default), + Value::Num(n) => { + if *n < 0.0 || *n > max as f64 || n.fract() != 0.0 { + return Err(node_error( + vm, + "RangeError", + &format!( + "The value of \"{name}\" is out of range. It must be >= 0 and <= {max}. Received {}", + num_to_string(*n) + ), + "ERR_OUT_OF_RANGE", + )); + } + Ok(*n as usize) + } + v => { + let d = received(vm, v); + Err(node_error( + vm, + "TypeError", + &format!("The \"{name}\" argument must be of type number. Received {d}"), + "ERR_INVALID_ARG_TYPE", + )) + } + } +} + +fn b_compare(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = this_buf(vm, &this, "compare")?; + let target = arg(args, 0); + let Some(t) = bytes_of(vm, &target) else { + let d = describe_value(vm, &target); + return Err(node_error( + vm, + "TypeError", + &format!( + "The \"target\" argument must be an instance of Buffer or Uint8Array. Received {d}" + ), + "ERR_INVALID_ARG_TYPE", + )); + }; + let s = bytes_ref(vm, id).to_vec(); + let ts = range_arg(vm, &arg(args, 1), "targetStart", 0, t.len())?; + let te = range_arg(vm, &arg(args, 2), "targetEnd", t.len(), t.len())?; + let ss = range_arg(vm, &arg(args, 3), "sourceStart", 0, s.len())?; + let se = range_arg(vm, &arg(args, 4), "sourceEnd", s.len(), s.len())?; + let a = &s[ss.min(se)..se]; + let b = &t[ts.min(te)..te]; + Ok(ordering(a.cmp(b))) +} + +/// The bytes a search value stands for, as Node's `indexOf` reads it. +fn needle(vm: &mut Vm, v: &Value, enc: &Value) -> Result, Value> { + match v { + Value::Str(s) => { + let enc = encoding(vm, enc)?.unwrap_or(Enc::Utf8); + Ok(encode(vm.atoms.sref(*s), enc)) + } + Value::Num(n) => Ok(vec![to_u8(*n)]), + v => match bytes_of(vm, v) { + Some(b) => Ok(b), + None => { + let d = describe_value(vm, v); + Err(node_error( + vm, + "TypeError", + &format!( + "The \"value\" argument must be one of type number or string or an instance of Buffer or Uint8Array. Received {d}" + ), + "ERR_INVALID_ARG_TYPE", + )) + } + }, + } +} + +fn search(vm: &mut Vm, this: &Value, args: &[Value], name: &str, last: bool) -> Result { + let id = this_buf(vm, this, name)?; + let hay = bytes_ref(vm, id).to_vec(); + let (offset, enc) = match arg(args, 1) { + Value::Str(_) => (Value::Undef, arg(args, 1)), + o => (o, arg(args, 2)), + }; + let n = needle(vm, &arg(args, 0), &enc)?; + let len = hay.len() as f64; + let from = match offset { + Value::Undef => { + if last { + len + } else { + 0.0 + } + } + v => { + let x = vm.number_of(&v)?; + if x.is_nan() { + if last { len } else { 0.0 } + } else { + let x = x.trunc(); + if x < 0.0 { + (len + x).max(if last { -1.0 } else { 0.0 }) + } else { + x + } + } + } + }; + if n.is_empty() { + return Ok(from.min(len)); + } + if n.len() > hay.len() { + return Ok(-1.0); + } + let max_start = hay.len() - n.len(); + if last { + if from < 0.0 { + return Ok(-1.0); + } + let start = (from as usize).min(max_start); + Ok((0..=start) + .rev() + .find(|&i| hay[i..i + n.len()] == n[..]) + .map(|i| i as f64) + .unwrap_or(-1.0)) + } else { + let start = from as usize; + if start > max_start { + return Ok(-1.0); + } + Ok((start..=max_start) + .find(|&i| hay[i..i + n.len()] == n[..]) + .map(|i| i as f64) + .unwrap_or(-1.0)) + } +} + +fn b_index_of(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + Ok(Value::Num(search(vm, &this, args, "indexOf", false)?)) +} + +fn b_last_index_of(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + Ok(Value::Num(search(vm, &this, args, "lastIndexOf", true)?)) +} + +fn b_includes(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + Ok(Value::Bool( + search(vm, &this, args, "includes", false)? >= 0.0, + )) +} + +fn b_write(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = this_buf(vm, &this, "write")?; + let Value::Str(s) = arg(args, 0) else { + let d = describe_value(vm, &arg(args, 0)); + return Err(node_error( + vm, + "TypeError", + &format!("The \"string\" argument must be of type string. Received {d}"), + "ERR_INVALID_ARG_TYPE", + )); + }; + let len = bytes_ref(vm, id).len; + let (offset, length, enc) = match (arg(args, 1), arg(args, 2)) { + (e @ Value::Str(_), _) => (Value::Undef, Value::Undef, e), + (o, e @ Value::Str(_)) => (o, Value::Undef, e), + (o, l) => (o, l, arg(args, 3)), + }; + let offset = range_arg(vm, &offset, "offset", 0, len)?; + let length = range_arg(vm, &length, "length", len - offset, len)?; + let enc = encoding(vm, &enc)?.unwrap_or(Enc::Utf8); + let mut data = encode(vm.atoms.sref(s), enc); + let room = length.min(len - offset); + if data.len() > room { + data.truncate(room); + if enc == Enc::Utf8 { + while !data.is_empty() && std::str::from_utf8(&data).is_err() { + data.pop(); + } + } + } + let b = bytes_ref(vm, id); + for (i, v) in data.iter().enumerate() { + b.put(offset + i, *v); + } + Ok(Value::Num(data.len() as f64)) +} + +fn b_fill(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = this_buf(vm, &this, "fill")?; + let len = bytes_ref(vm, id).len; + let value = arg(args, 0); + let (offset, end, enc) = match (arg(args, 1), arg(args, 2)) { + (e @ Value::Str(_), _) => (Value::Undef, Value::Undef, e), + (o, e @ Value::Str(_)) => (o, Value::Undef, e), + (o, l) => (o, l, arg(args, 3)), + }; + let offset = range_arg(vm, &offset, "offset", 0, len)?; + let end = range_arg(vm, &end, "end", len, len)?; + let enc = if let Value::Str(_) = value { + encoding(vm, &enc)? + } else { + None + }; + if offset >= end { + return Ok(this); + } + let mut data = vec![0; end - offset]; + fill_with(vm, &mut data, &value, enc)?; + let b = bytes_ref(vm, id); + for (i, v) in data.into_iter().enumerate() { + b.put(offset + i, v); + } + Ok(this) +} + +fn b_copy(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = this_buf(vm, &this, "copy")?; + let target = arg(args, 0); + let Value::Obj(tid) = target else { + return Err(node_error( + vm, + "TypeError", + "The \"target\" argument must be an instance of Buffer or Uint8Array.", + "ERR_INVALID_ARG_TYPE", + )); + }; + if !matches!(vm.heap[tid as usize].kind, Kind::Bytes(_)) { + let d = describe_value(vm, &target); + return Err(node_error( + vm, + "TypeError", + &format!( + "The \"target\" argument must be an instance of Buffer or Uint8Array. Received {d}" + ), + "ERR_INVALID_ARG_TYPE", + )); + } + let src = bytes_ref(vm, id).to_vec(); + let tlen = bytes_ref(vm, tid).len; + let ts = range_arg(vm, &arg(args, 1), "targetStart", 0, usize::MAX >> 12)?; + let ss = range_arg(vm, &arg(args, 2), "sourceStart", 0, src.len())?; + let se = match arg(args, 3) { + Value::Undef => src.len(), + v => range_arg(vm, &v, "sourceEnd", src.len(), usize::MAX >> 12)?.min(src.len()), + }; + if ts >= tlen || ss >= se { + return Ok(Value::Num(0.0)); + } + let n = (se - ss).min(tlen - ts); + let t = bytes_ref(vm, tid); + for i in 0..n { + t.put(ts + i, src[ss + i]); + } + Ok(Value::Num(n as f64)) +} + +fn swap(vm: &mut Vm, this: Value, size: usize) -> Res { + let id = this_buf(vm, &this, &format!("swap{}", size * 8))?; + let mut data = bytes_ref(vm, id).to_vec(); + if !data.len().is_multiple_of(size) { + return Err(node_error( + vm, + "RangeError", + &format!("Buffer size must be a multiple of {}-bits", size * 8), + "ERR_INVALID_BUFFER_SIZE", + )); + } + for chunk in data.chunks_mut(size) { + chunk.reverse(); + } + let b = bytes_ref(vm, id); + for (i, v) in data.into_iter().enumerate() { + b.put(i, v); + } + Ok(this) +} + +fn b_swap16(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + swap(vm, this, 2) +} +fn b_swap32(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + swap(vm, this, 4) +} +fn b_swap64(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + swap(vm, this, 8) +} + +#[derive(Clone, Copy)] +enum Num { + U, + I, + F, +} + +/// Name, write?, kind, byte width (0: from the byteLength argument), little-endian. +const NUMERIC: [(&str, bool, Num, usize, bool); 46] = [ + ("readUInt8", false, Num::U, 1, true), + ("readUint8", false, Num::U, 1, true), + ("readInt8", false, Num::I, 1, true), + ("readUInt16LE", false, Num::U, 2, true), + ("readUint16LE", false, Num::U, 2, true), + ("readUInt16BE", false, Num::U, 2, false), + ("readUint16BE", false, Num::U, 2, false), + ("readInt16LE", false, Num::I, 2, true), + ("readInt16BE", false, Num::I, 2, false), + ("readUInt32LE", false, Num::U, 4, true), + ("readUint32LE", false, Num::U, 4, true), + ("readUInt32BE", false, Num::U, 4, false), + ("readUint32BE", false, Num::U, 4, false), + ("readInt32LE", false, Num::I, 4, true), + ("readInt32BE", false, Num::I, 4, false), + ("readFloatLE", false, Num::F, 4, true), + ("readFloatBE", false, Num::F, 4, false), + ("readDoubleLE", false, Num::F, 8, true), + ("readDoubleBE", false, Num::F, 8, false), + ("readUIntLE", false, Num::U, 0, true), + ("readUIntBE", false, Num::U, 0, false), + ("readIntLE", false, Num::I, 0, true), + ("readIntBE", false, Num::I, 0, false), + ("writeUInt8", true, Num::U, 1, true), + ("writeUint8", true, Num::U, 1, true), + ("writeInt8", true, Num::I, 1, true), + ("writeUInt16LE", true, Num::U, 2, true), + ("writeUint16LE", true, Num::U, 2, true), + ("writeUInt16BE", true, Num::U, 2, false), + ("writeUint16BE", true, Num::U, 2, false), + ("writeInt16LE", true, Num::I, 2, true), + ("writeInt16BE", true, Num::I, 2, false), + ("writeUInt32LE", true, Num::U, 4, true), + ("writeUint32LE", true, Num::U, 4, true), + ("writeUInt32BE", true, Num::U, 4, false), + ("writeUint32BE", true, Num::U, 4, false), + ("writeInt32LE", true, Num::I, 4, true), + ("writeInt32BE", true, Num::I, 4, false), + ("writeFloatLE", true, Num::F, 4, true), + ("writeFloatBE", true, Num::F, 4, false), + ("writeDoubleLE", true, Num::F, 8, true), + ("writeDoubleBE", true, Num::F, 8, false), + ("writeUIntLE", true, Num::U, 0, true), + ("writeUIntBE", true, Num::U, 0, false), + ("writeIntLE", true, Num::I, 0, true), + ("writeIntBE", true, Num::I, 0, false), +]; + +fn offset_arg(vm: &mut Vm, v: &Value, len: usize, width: usize) -> Result { + let n = match v { + Value::Undef => 0.0, + Value::Num(n) => *n, + v => { + let d = received(vm, v); + return Err(node_error( + vm, + "TypeError", + &format!("The \"offset\" argument must be of type number. Received {d}"), + "ERR_INVALID_ARG_TYPE", + )); + } + }; + if n.fract() != 0.0 || !n.is_finite() { + return Err(node_error( + vm, + "RangeError", + &format!( + "The value of \"offset\" is out of range. It must be an integer. Received {}", + num_to_string(n) + ), + "ERR_OUT_OF_RANGE", + )); + } + if len < width { + return Err(node_error( + vm, + "RangeError", + "Attempt to access memory outside buffer bounds", + "ERR_BUFFER_OUT_OF_BOUNDS", + )); + } + if n < 0.0 || n > (len - width) as f64 { + return Err(node_error( + vm, + "RangeError", + &format!( + "The value of \"offset\" is out of range. It must be >= 0 and <= {}. Received {}", + len - width, + num_to_string(n) + ), + "ERR_OUT_OF_RANGE", + )); + } + Ok(n as usize) +} + +fn b_numeric(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let which = match vm.native_data(callee) { + Value::Num(n) => n as usize, + _ => 0, + }; + let (name, write, kind, fixed, le) = NUMERIC[which]; + let id = this_buf(vm, &this, name)?; + let len = bytes_ref(vm, id).len; + let (value, offset_v, width_v) = if write { + (arg(args, 0), arg(args, 1), arg(args, 2)) + } else { + (Value::Undef, arg(args, 0), arg(args, 1)) + }; + let width = if fixed > 0 { + fixed + } else { + match width_v { + Value::Num(n) if (1.0..=6.0).contains(&n) && n.fract() == 0.0 => n as usize, + v => { + let shown = match v { + Value::Num(n) => num_to_string(n), + _ => describe_value(vm, &v), + }; + return Err(node_error( + vm, + "RangeError", + &format!( + "The value of \"byteLength\" is out of range. It must be >= 1 and <= 6. Received {shown}" + ), + "ERR_OUT_OF_RANGE", + )); + } + } + }; + let offset = offset_arg(vm, &offset_v, len, width)?; + let b = bytes_ref(vm, id); + if !write { + let mut raw: Vec = (0..width).map(|i| b.get(offset + i).unwrap_or(0)).collect(); + if !le { + raw.reverse(); + } + let v = match kind { + Num::F if width == 4 => f32::from_le_bytes([raw[0], raw[1], raw[2], raw[3]]) as f64, + Num::F => { + let mut a = [0u8; 8]; + a.copy_from_slice(&raw); + f64::from_le_bytes(a) + } + Num::U => raw.iter().rev().fold(0u64, |acc, x| acc << 8 | *x as u64) as f64, + Num::I => { + let u = raw.iter().rev().fold(0u64, |acc, x| acc << 8 | *x as u64); + let bits = width * 8; + let sign = 1u64 << (bits - 1); + if u & sign != 0 { + u as f64 - (1u64 << bits) as f64 + } else { + u as f64 + } + } + }; + return Ok(Value::Num(v)); + } + let x = vm.number_of(&value)?; + let raw: Vec = match kind { + Num::F if width == 4 => (x as f32).to_le_bytes().to_vec(), + Num::F => x.to_le_bytes().to_vec(), + Num::U | Num::I => { + let bits = width as i32 * 8; + let (min, max) = match kind { + Num::U => (0.0, 2f64.powi(bits) - 1.0), + _ => (-(2f64.powi(bits - 1)), 2f64.powi(bits - 1) - 1.0), + }; + if !(x >= min && x <= max) { + let range = if width > 4 { + let p = bits; + match kind { + Num::U => format!(">= 0 and < 2 ** {p}"), + _ => format!(">= -(2 ** {}) and < 2 ** {}", p - 1, p - 1), + } + } else { + format!(">= {} and <= {}", num_to_string(min), num_to_string(max)) + }; + return Err(node_error( + vm, + "RangeError", + &format!( + "The value of \"value\" is out of range. It must be {range}. Received {}", + num_to_string(x) + ), + "ERR_OUT_OF_RANGE", + )); + } + let v = x.trunc() as i64 as u64; + (0..width).map(|i| (v >> (8 * i)) as u8).collect() + } + }; + let b = bytes_ref(vm, id); + for i in 0..width { + let byte = raw[if le { i } else { width - 1 - i }]; + b.put(offset + i, byte); + } + Ok(Value::Num((offset + width) as f64)) +} diff --git a/packages/codemode-rust/crates/psychoscript/src/builtins/bytes.rs b/packages/codemode-rust/crates/psychoscript/src/builtins/bytes.rs new file mode 100644 index 0000000000000..a99fca6deb449 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/builtins/bytes.rs @@ -0,0 +1,1466 @@ +//! Uint8Array, TextEncoder, TextDecoder, atob and btoa. + +use std::sync::{Arc, Mutex, MutexGuard, PoisonError}; + +use super::{arg, describe_value, fuel, incompatible}; +use crate::native::{FOR_OF_SLOTS, Flow, ForOf, Frame, Input, Step}; +use crate::object::*; +use crate::ops::{MAX_ARRAY_LEN, MAX_STRING_LEN}; +use crate::value::{Id, Slot, Value}; +use crate::vm::{Res, Vm}; + +/// A Uint8Array: a view of `len` bytes at `start` in a buffer that subarrays share. +pub struct Bytes { + pub buf: Arc>>, + pub start: usize, + pub len: usize, + /// A Node Buffer: text conversions default to UTF-8. + pub buffer: bool, +} + +impl Bytes { + pub fn new(data: Vec, buffer: bool) -> Bytes { + let len = data.len(); + Bytes { + buf: Arc::new(Mutex::new(data)), + start: 0, + len, + buffer, + } + } + + /// The shared buffer. Only the run that owns it touches it, so the lock is never contended. + pub fn bytes(&self) -> MutexGuard<'_, Vec> { + self.buf.lock().unwrap_or_else(PoisonError::into_inner) + } + + pub fn to_vec(&self) -> Vec { + let b = self.bytes(); + b[self.start..self.start + self.len].to_vec() + } + + pub fn get(&self, i: usize) -> Option { + if i < self.len { + self.bytes().get(self.start + i).copied() + } else { + None + } + } + + pub fn put(&self, i: usize, v: u8) { + if i < self.len + && let Some(slot) = self.bytes().get_mut(self.start + i) + { + *slot = v; + } + } + + pub fn view(&self, start: usize, end: usize, buffer: bool) -> Bytes { + let end = end.max(start).min(self.len); + let start = start.min(end); + Bytes { + buf: self.buf.clone(), + start: self.start + start, + len: end - start, + buffer, + } + } +} + +/// ToUint8: modulo 256, with NaN and infinities as 0. +pub fn to_u8(n: f64) -> u8 { + if !n.is_finite() { + return 0; + } + n.trunc().rem_euclid(256.0) as u8 +} + +pub fn new_bytes(vm: &mut Vm, data: Vec, buffer: bool) -> Value { + super::ensure(vm, super::LAZY_BYTES); + let proto = if buffer { + vm.realm.std.buffer + } else { + vm.realm.std.uint8 + }; + Value::Obj(vm.alloc(Obj::new( + Some(proto), + Kind::Bytes(Box::new(Bytes::new(data, buffer))), + ))) +} + +pub fn view_value(vm: &mut Vm, b: Bytes) -> Value { + let proto = if b.buffer { + vm.realm.std.buffer + } else { + vm.realm.std.uint8 + }; + Value::Obj(vm.alloc(Obj::new(Some(proto), Kind::Bytes(Box::new(b))))) +} + +pub fn as_bytes<'a>(vm: &'a Vm, v: &Value) -> Option<&'a Bytes> { + match v { + Value::Obj(id) => match &vm.heap[*id as usize].kind { + Kind::Bytes(b) => Some(b), + _ => None, + }, + _ => None, + } +} + +pub fn bytes_of(vm: &Vm, v: &Value) -> Option> { + as_bytes(vm, v).map(Bytes::to_vec) +} + +fn this_bytes(vm: &mut Vm, this: &Value, name: &str) -> Result { + if let Value::Obj(id) = this + && let Kind::Bytes(_) = vm.heap[*id as usize].kind + { + return Ok(*id); + } + Err(incompatible( + vm, + &format!("Uint8Array.prototype.{name}"), + this, + )) +} + +pub fn bytes_ref(vm: &Vm, id: Id) -> &Bytes { + match &vm.heap[id as usize].kind { + Kind::Bytes(b) => b, + _ => unreachable!("checked by this_bytes"), + } +} + +fn len_of(vm: &Vm, id: Id) -> usize { + bytes_ref(vm, id).len +} + +// ---------- accessors ---------- + +pub fn get_prop(vm: &mut Vm, id: Id, key: Atom) -> Option { + let b = bytes_ref(vm, id); + if let Some(i) = vm.atoms.index(key) { + return Some(match b.get(i as usize) { + Some(v) => Value::Num(v as f64), + None => Value::Undef, + }); + } + if key == vm.names.length { + return Some(Value::Num(b.len as f64)); + } + None +} + +pub fn set_prop(vm: &mut Vm, id: Id, key: Atom, val: Value) -> Option> { + if let Some(i) = vm.atoms.index(key) { + return Some( + super::builtin_number(vm, &val).map(|n| bytes_ref(vm, id).put(i as usize, to_u8(n))), + ); + } + if key == vm.names.length { + return Some(Err(vm.only_getter(&Value::Obj(id), key))); + } + None +} + +pub fn has_own(vm: &Vm, id: Id, key: Atom) -> bool { + vm.atoms + .index(key) + .is_some_and(|i| (i as usize) < len_of(vm, id)) +} + +pub fn index_len(vm: &Vm, id: Id) -> usize { + len_of(vm, id) +} + +pub fn inspect(vm: &Vm, id: Id) -> String { + let b = bytes_ref(vm, id); + let data = b.to_vec(); + if b.buffer { + let shown: Vec = data.iter().take(50).map(|x| format!("{x:02x}")).collect(); + let more = if data.len() > 50 { + format!(" ... {} more bytes", data.len() - 50) + } else { + String::new() + }; + let shown = shown.join(" "); + return format!( + "", + if shown.is_empty() { + String::new() + } else { + format!(" {shown}") + } + ); + } + let list: Vec = data.iter().map(u8::to_string).collect(); + format!("Uint8Array({}) [{}]", data.len(), list.join(",")) +} + +/// JSON form: index keys in `JSON.stringify`, and refused at the host boundary. +pub fn json_value(vm: &mut Vm, id: Id, boundary: bool) -> Res { + if boundary { + let p = vm.realm.type_error_proto; + return Err(vm.failure( + p, + "A Uint8Array cannot cross to the host; pass text instead, e.g. `new TextDecoder().decode(bytes)` or `bytes.toBase64()`.", + crate::DiagnosticKind::InvalidDataValue, + )); + } + let data = bytes_ref(vm, id).to_vec(); + let o = vm.new_object(); + for (i, b) in data.iter().enumerate() { + let k = vm.atoms.intern(&i.to_string()); + vm.define(o, k, Value::Num(*b as f64)); + } + Ok(Value::Obj(o)) +} + +// ---------- base64 and hex ---------- + +const B64: &[u8; 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +const B64URL: &[u8; 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; + +pub fn base64_encode(data: &[u8], url: bool, pad: bool) -> String { + let table = if url { B64URL } else { B64 }; + let mut out = String::with_capacity(data.len().div_ceil(3) * 4); + for chunk in data.chunks(3) { + let n = (chunk[0] as u32) << 16 + | (chunk.get(1).copied().unwrap_or(0) as u32) << 8 + | chunk.get(2).copied().unwrap_or(0) as u32; + out.push(table[(n >> 18) as usize & 63] as char); + out.push(table[(n >> 12) as usize & 63] as char); + if chunk.len() > 1 { + out.push(table[(n >> 6) as usize & 63] as char); + } else if pad { + out.push('='); + } + if chunk.len() > 2 { + out.push(table[n as usize & 63] as char); + } else if pad { + out.push('='); + } + } + out +} + +fn b64_value(c: char, url: Option) -> Option { + Some(match c { + 'A'..='Z' => c as u32 - 'A' as u32, + 'a'..='z' => c as u32 - 'a' as u32 + 26, + '0'..='9' => c as u32 - '0' as u32 + 52, + '+' if url != Some(true) => 62, + '/' if url != Some(true) => 63, + '-' if url != Some(false) => 62, + '_' if url != Some(false) => 63, + _ => return None, + }) +} + +/// Forgiving-base64 decode (WHATWG), as `atob` and `Uint8Array.fromBase64` read it. +pub fn base64_decode(text: &str) -> Option> { + let mut s: Vec = text + .chars() + .filter(|c| !matches!(c, ' ' | '\t' | '\n' | '\u{c}' | '\r')) + .collect(); + if s.len().is_multiple_of(4) && s.last() == Some(&'=') { + s.pop(); + if s.last() == Some(&'=') { + s.pop(); + } + } + if s.len() % 4 == 1 { + return None; + } + let mut out = Vec::with_capacity(s.len() * 3 / 4); + let mut acc = 0u32; + let mut bits = 0; + for c in s { + let v = b64_value(c, Some(false))?; + acc = acc << 6 | v; + bits += 6; + if bits >= 8 { + bits -= 8; + out.push((acc >> bits) as u8); + } + } + Some(out) +} + +/// Lenient decode for Node's base64 and base64url: either alphabet, stopping at the first invalid character. +pub fn base64_decode_node(text: &str) -> Vec { + let mut out = Vec::new(); + let mut acc = 0u32; + let mut bits = 0; + for c in text.chars() { + if c == '=' { + break; + } + let Some(v) = b64_value(c, None) else { + if c.is_whitespace() { + continue; + } + break; + }; + acc = acc << 6 | v; + bits += 6; + if bits >= 8 { + bits -= 8; + out.push((acc >> bits) as u8); + } + } + out +} + +pub fn hex_encode(data: &[u8]) -> String { + data.iter().map(|b| format!("{b:02x}")).collect() +} + +fn hex_decode(text: &str) -> Option> { + if !text.len().is_multiple_of(2) { + return None; + } + let b = text.as_bytes(); + b.chunks(2) + .map(|p| { + let hi = (p[0] as char).to_digit(16)?; + let lo = (p[1] as char).to_digit(16)?; + Some((hi * 16 + lo) as u8) + }) + .collect() +} + +// ---------- Uint8Array ---------- + +pub fn setup(vm: &mut Vm) { + let op = vm.realm.object_proto; + let proto = vm.plain(op); + vm.realm.std.uint8 = proto; + let ctor = vm.ctor("Uint8Array", 3, uint8_ctor, proto, Value::Undef); + vm.methods( + ctor, + &[ + ("from", 1, uint8_from), + ("of", 0, uint8_of), + ("fromBase64", 1, uint8_from_base64), + ("fromHex", 1, uint8_from_hex), + ], + ); + vm.constant(ctor, "BYTES_PER_ELEMENT", Value::Num(1.0)); + vm.constant(proto, "BYTES_PER_ELEMENT", Value::Num(1.0)); + super::accessors(vm, proto, &["length"]); + vm.methods( + proto, + &[ + ("at", 1, u_at), + ("slice", 2, u_slice), + ("subarray", 2, u_subarray), + ("set", 1, u_set), + ("fill", 1, u_fill), + ("reverse", 0, u_reverse), + ("sort", 1, u_sort), + ("indexOf", 1, u_index_of), + ("lastIndexOf", 1, u_last_index_of), + ("includes", 1, u_includes), + ("join", 1, u_join), + ("toString", 0, u_to_string), + ("toBase64", 0, u_to_base64), + ("toHex", 0, u_to_hex), + ("keys", 0, u_keys), + ("values", 0, u_values), + ("entries", 0, u_entries), + ("map", 1, u_map), + ("filter", 1, u_filter), + ("forEach", 1, u_for_each), + ("some", 1, u_some), + ("every", 1, u_every), + ("find", 1, u_find), + ("findIndex", 1, u_find_index), + ("findLast", 1, u_find_last), + ("findLastIndex", 1, u_find_last_index), + ("reduce", 1, u_reduce), + ("reduceRight", 1, u_reduce_right), + ], + ); + let vk = vm.atoms.intern_static("values"); + let values = vm.get_obj(proto, vk); + vm.define_hidden(proto, SYM_ITERATOR, values); + + let ep = vm.plain(op); + vm.realm.std.text_encoder = ep; + let utf8 = vm.static_str("utf-8"); + let ek = vm.atoms.intern_static("encoding"); + vm.define_hidden(ep, ek, utf8); + vm.method(ep, "encode", 0, encoder_encode); + vm.ctor("TextEncoder", 0, encoder_ctor, ep, Value::Undef); + + let dp = vm.plain(op); + vm.realm.std.text_decoder = dp; + super::accessors(vm, dp, &["encoding", "fatal", "ignoreBOM"]); + vm.method(dp, "decode", 0, decoder_decode); + vm.ctor("TextDecoder", 0, decoder_ctor, dp, Value::Undef); + + let atob = vm.native_fn("atob", 1, global_atob, Value::Undef); + vm.global("atob", atob); + let btoa = vm.native_fn("btoa", 1, global_btoa, Value::Undef); + vm.global("btoa", btoa); +} + +fn requires_new(vm: &mut Vm, this: &Value, name: &str) -> Result<(), Value> { + if matches!(this, Value::Uninit) { + Ok(()) + } else { + Err(vm.type_error(&format!("Constructor {name} requires 'new'."))) + } +} + +fn is_iterable(vm: &mut Vm, v: &Value) -> bool { + match v { + Value::Obj(id) => { + matches!( + vm.heap[*id as usize].kind, + Kind::Array(_) | Kind::Map(_) | Kind::Set(_) | Kind::Generator(_) + ) || vm.has_program_getter(*id, SYM_ITERATOR) + || !matches!(vm.get_obj(*id, SYM_ITERATOR), Value::Undef | Value::Null) + } + Value::Str(_) => true, + _ => false, + } +} + +/// What a built-in does with the bytes it collected: `new Uint8Array(...)` and `Uint8Array.from` make a Uint8Array of +/// them, `set` writes them into `target` at `offset`. +#[derive(Clone, Copy)] +enum Sink { + New, + Set { target: Id, offset: Value }, +} + +/// The values a Uint8Array, array or iterable describes, each mapped (with the original values) then converted, handed +/// to `into`. An iterable is read and mapped by a native frame (`Collect`). +fn collect( + vm: &mut Vm, + source: &Value, + name: &str, + mapper: Option<(Value, Value)>, + native: bool, + into: Sink, + callee: Id, +) -> Res { + if let (Some(b), None) = (bytes_of(vm, source), &mapper) { + return collected(vm, b, into); + } + // The reference's `collectBytes`, after the native's own call when a native hands on to it (see `fuel.rs`). + if native { + fuel::handoff(vm); + } else { + fuel::method(vm); + } + fuel::native(vm); + if !is_iterable(vm, source) { + let d = describe_value(vm, source); + fuel::native(vm); + return Err(vm.type_error(&format!( + "{name} expects a Uint8Array, an array, or an iterable of numbers, received {d}." + ))); + } + if mapper.is_none() && steps_natively(vm, source) { + let values = fuel::for_of(vm, source)?; + return convert(vm, &values, into); + } + let (f, this_arg) = mapper.unwrap_or_default(); + let (target, offset) = match into { + Sink::New => (Value::Undef, Value::Undef), + Sink::Set { target, offset } => (Value::Obj(target), offset), + }; + let values = vm.new_array(Vec::new()); + crate::native::enter_for_of_sub( + vm, + crate::native::NativeOp::Arrays, + COLLECT, + callee, + Value::Undef, + *source, + &[f, this_arg, values, target, offset, Value::Num(0.0)], + ) +} + +/// Whether iterating `v` runs no program code: its iterator is the VM's own over its items (see `Vm::walks`), which +/// reads them without calling anything. +fn steps_natively(vm: &Vm, v: &Value) -> bool { + match v { + Value::Str(_) => true, + Value::Obj(id) => matches!( + vm.heap[*id as usize].kind, + Kind::Array(_) | Kind::Map(_) | Kind::Set(_) + ), + _ => false, + } +} + +/// The end of the reference's `collectBytes`: each collected value converted to a byte. +fn convert(vm: &mut Vm, values: &[Value], into: Sink) -> Res { + fuel::native(vm); + vm.bytecode_builtin(); + let mut data = Vec::with_capacity(values.len()); + for v in values { + data.push(to_u8(super::builtin_number(vm, v)?)); + } + collected(vm, data, into) +} + +/// Hands collected bytes to what the built-in does with them. +fn collected(vm: &mut Vm, data: Vec, into: Sink) -> Res { + let Sink::Set { target, offset } = into else { + return Ok(new_bytes(vm, data, false)); + }; + let offset = match offset { + Value::Undef => 0.0, + v => super::builtin_integer(vm, &v)?, + }; + let len = len_of(vm, target); + if offset < 0.0 || data.len() as f64 + offset > len as f64 { + return Err(vm.range_error("Uint8Array.set: the source does not fit at that offset.")); + } + let b = bytes_ref(vm, target); + for (i, v) in data.iter().enumerate() { + b.put(offset as usize + i, *v); + } + Ok(Value::Undef) +} + +// The native frames of this family, by sub-op (see `family_step`). +const COLLECT: u16 = 0; +const WALK: u16 = 1; +const REDUCE: u16 = 2; + +// The slots of a `Collect` frame, after the loop's: the mapper and its receiver, the values read (an array), where +// they go (`set`'s target or undefined, and its offset), and the index the mapper is at. +const COL_MAPPER: usize = FOR_OF_SLOTS; +const COL_THIS: usize = FOR_OF_SLOTS + 1; +const COL_VALUES: usize = FOR_OF_SLOTS + 2; +const COL_TARGET: usize = FOR_OF_SLOTS + 3; +const COL_OFFSET: usize = FOR_OF_SLOTS + 4; +const COL_K: usize = FOR_OF_SLOTS + 5; + +/// The reference's `collectBytes` over an iterable: every value is read first, then each is mapped, with a back-edge +/// after each call. +struct Collect; + +impl ForOf for Collect { + fn item(vm: &mut Vm, fr: Frame, x: Value) -> Result { + if let Some(Kind::Array(values)) = fr + .slot(vm, COL_VALUES) + .obj() + .map(|o| &mut vm.heap[o as usize].kind) + { + values.push(x); + } + Ok(Flow::Next) + } + + fn finish(vm: &mut Vm, fr: Frame) -> Res { + let values = values_of(vm, fr.slot(vm, COL_VALUES)).to_vec(); + let into = match fr.get(vm, COL_TARGET) { + Value::Obj(target) => Sink::Set { + target, + offset: fr.get(vm, COL_OFFSET), + }, + _ => Sink::New, + }; + convert(vm, &values, into) + } + + fn done(vm: &mut Vm, fr: Frame) -> Result { + if fr.slot(vm, COL_MAPPER) == Slot::UNDEF { + return Ok(Step::Done(Self::finish(vm, fr)?)); + } + collect_map(vm, fr, 0) + } + + fn after(vm: &mut Vm, fr: Frame, input: Input) -> Result { + let k = fr.index(vm, COL_K); + match input { + Input::Returned(r) => { + if let Some(Kind::Array(values)) = fr + .slot(vm, COL_VALUES) + .obj() + .map(|o| &mut vm.heap[o as usize].kind) + && let Some(v) = values.get_mut(k) + { + *v = r.get(); + } + fuel::step(vm); + collect_map(vm, fr, k + 1) + } + Input::Threw(e) => Err(e), + Input::Start | Input::Finished(_) => collect_map(vm, fr, k), + } + } +} + +/// Calls the mapper on the value at `k`, or finishes once every value is mapped. +fn collect_map(vm: &mut Vm, fr: Frame, k: usize) -> Result { + let Some(v) = values_of(vm, fr.slot(vm, COL_VALUES)).get(k).copied() else { + return Ok(Step::Done(Collect::finish(vm, fr)?)); + }; + fr.set_index(vm, COL_K, k); + let (f, this_arg) = (fr.slot(vm, COL_MAPPER), fr.slot(vm, COL_THIS)); + fr.call_slots(vm, f, this_arg, [Slot::pack(v), Slot::index(k)]) +} + +fn values_of(vm: &Vm, s: Slot) -> &[Value] { + match s.obj().map(|o| &vm.heap[o as usize].kind) { + Some(Kind::Array(values)) => values, + _ => &[], + } +} + +fn uint8_ctor(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + requires_new(vm, &this, "Uint8Array")?; + let source = arg(args, 0); + if let Value::Obj(_) = source { + return collect( + vm, + &source, + "new Uint8Array(...)", + None, + false, + Sink::New, + callee, + ); + } + let n = match source { + Value::Undef => 0.0, + v => super::builtin_number(vm, &v)?, + }; + if n.fract() != 0.0 || !n.is_finite() || n < 0.0 { + let s = vm.string_of(&source)?; + let s = vm.text(s).to_owned(); + return Err(vm.range_error(&format!("Invalid typed array length: {s}"))); + } + if n > MAX_ARRAY_LEN as f64 { + return Err(vm.range_error("Invalid array length")); + } + Ok(new_bytes(vm, vec![0; n as usize], false)) +} + +fn optional_callback(vm: &mut Vm, f: &Value, name: &str) -> Result, Value> { + if let Value::Undef = f { + return Ok(None); + } + super::require_callback(vm, f, name).map(Some) +} + +fn uint8_from(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let mapper = optional_callback(vm, &arg(args, 1), "Uint8Array.from")?; + collect( + vm, + &arg(args, 0), + "Uint8Array.from", + mapper.map(|f| (f, arg(args, 2))), + true, + Sink::New, + callee, + ) +} + +fn uint8_of(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let mut data = Vec::with_capacity(args.len()); + for a in args { + data.push(to_u8(super::builtin_number(vm, a)?)); + } + Ok(new_bytes(vm, data, false)) +} + +fn uint8_from_base64(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let Value::Str(s) = arg(args, 0) else { + return Err(vm.type_error("Uint8Array.fromBase64 expects a string.")); + }; + match base64_decode(vm.text(s)) { + Some(d) => Ok(new_bytes(vm, d, false)), + None => Err(vm.syntax_error("Uint8Array.fromBase64: the string is not valid base64.")), + } +} + +fn uint8_from_hex(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let Value::Str(s) = arg(args, 0) else { + return Err(vm.type_error("Uint8Array.fromHex expects a string.")); + }; + match hex_decode(vm.text(s)) { + Some(d) => Ok(new_bytes(vm, d, false)), + None => Err(vm.syntax_error("Uint8Array.fromHex: the string is not valid hex.")), + } +} + +/// A relative index (negative counts from the end), clamped to `0..=len`; `undefined` is `default`. +pub fn rel_index(vm: &mut Vm, v: &Value, len: usize, default: usize) -> Result { + if let Value::Undef = v { + return Ok(default); + } + let n = super::builtin_integer(vm, v)?; + Ok(if n < 0.0 { + (len as f64 + n).max(0.0) as usize + } else { + n.min(len as f64) as usize + }) +} + +fn u_at(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = this_bytes(vm, &this, "at")?; + let len = len_of(vm, id) as f64; + let mut i = super::builtin_integer(vm, &arg(args, 0))?; + if i < 0.0 { + i += len; + } + if i < 0.0 || i >= len { + return Ok(Value::Undef); + } + Ok(match bytes_ref(vm, id).get(i as usize) { + Some(b) => Value::Num(b as f64), + None => Value::Undef, + }) +} + +fn range(vm: &mut Vm, id: Id, args: &[Value]) -> Result<(usize, usize), Value> { + let len = len_of(vm, id); + let start = rel_index(vm, &arg(args, 0), len, 0)?; + let end = rel_index(vm, &arg(args, 1), len, len)?; + Ok((start, end.max(start))) +} + +fn u_slice(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = this_bytes(vm, &this, "slice")?; + let (s, e) = range(vm, id, args)?; + let data = bytes_ref(vm, id).view(s, e, false).to_vec(); + Ok(new_bytes(vm, data, false)) +} + +fn u_subarray(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = this_bytes(vm, &this, "subarray")?; + let (s, e) = range(vm, id, args)?; + let v = bytes_ref(vm, id).view(s, e, false); + Ok(view_value(vm, v)) +} + +fn u_set(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = this_bytes(vm, &this, "set")?; + // The reference reads the offset as a number (which calls nothing) before the source, so its failure comes first. + if !matches!(arg(args, 1), Value::Undef) { + super::builtin_number(vm, &arg(args, 1))?; + } + let into = Sink::Set { + target: id, + offset: arg(args, 1), + }; + collect( + vm, + &arg(args, 0), + "Uint8Array.set", + None, + true, + into, + callee, + ) +} + +fn u_fill(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = this_bytes(vm, &this, "fill")?; + let v = to_u8(super::builtin_number(vm, &arg(args, 0))?); + let len = len_of(vm, id); + let s = rel_index(vm, &arg(args, 1), len, 0)?; + let e = rel_index(vm, &arg(args, 2), len, len)?; + let b = bytes_ref(vm, id); + for i in s..e { + b.put(i, v); + } + Ok(this) +} + +fn u_reverse(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let id = this_bytes(vm, &this, "reverse")?; + let b = bytes_ref(vm, id); + let mut data = b.to_vec(); + data.reverse(); + for (i, v) in data.into_iter().enumerate() { + b.put(i, v); + } + Ok(this) +} + +fn u_sort(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = this_bytes(vm, &this, "sort")?; + let cmp = arg(args, 0); + super::array::sort_comparator(vm, &cmp, "Uint8Array.sort")?; + let mut data = bytes_ref(vm, id).to_vec(); + if !matches!(cmp, Value::Undef) { + let list: Vec = data.iter().map(|b| Value::Num(*b as f64)).collect(); + return super::array::sort_with(vm, callee, this, list, cmp, 0, super::array::SORT_BYTES); + } + data.sort_unstable(); + let b = bytes_ref(vm, id); + for (i, v) in data.into_iter().enumerate() { + b.put(i, v); + } + Ok(this) +} + +/// Writes a sort's result into the bytes `id`. +pub(super) fn put_sorted(vm: &mut Vm, id: Id, sorted: &[Value]) { + let b = bytes_ref(vm, id); + for (i, v) in sorted.iter().enumerate() { + b.put(i, to_u8(v.as_num())); + } +} + +/// A search value: only numbers can equal a byte. +fn search_value(v: &Value) -> f64 { + match v { + Value::Num(n) => *n, + _ => f64::NAN, + } +} + +fn u_index_of(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = this_bytes(vm, &this, "indexOf")?; + let x = search_value(&arg(args, 0)); + let len = len_of(vm, id); + let from = rel_index(vm, &arg(args, 1), len, 0)?; + let data = bytes_ref(vm, id).to_vec(); + Ok(Value::Num( + (from..len) + .find(|i| data[*i] as f64 == x) + .map(|i| i as f64) + .unwrap_or(-1.0), + )) +} + +fn u_last_index_of(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = this_bytes(vm, &this, "lastIndexOf")?; + let x = search_value(&arg(args, 0)); + let len = len_of(vm, id) as f64; + let from = if args.len() < 2 { + len - 1.0 + } else { + let n = super::builtin_integer(vm, &args[1])?; + if n < 0.0 { len + n } else { n.min(len - 1.0) } + }; + let data = bytes_ref(vm, id).to_vec(); + if from < 0.0 { + return Ok(Value::Num(-1.0)); + } + Ok(Value::Num( + (0..=from as usize) + .rev() + .find(|i| data[*i] as f64 == x) + .map(|i| i as f64) + .unwrap_or(-1.0), + )) +} + +fn u_includes(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = this_bytes(vm, &this, "includes")?; + let x = search_value(&arg(args, 0)); + let len = len_of(vm, id); + let from = rel_index(vm, &arg(args, 1), len, 0)?; + let data = bytes_ref(vm, id).to_vec(); + Ok(Value::Bool((from..len).any(|i| data[i] as f64 == x))) +} + +fn join_bytes(data: &[u8], sep: &str) -> String { + let parts: Vec = data.iter().map(u8::to_string).collect(); + parts.join(sep) +} + +fn u_join(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = this_bytes(vm, &this, "join")?; + let sep = match arg(args, 0) { + Value::Undef => ",".to_owned(), + v => { + let s = vm.string_of(&v)?; + vm.text(s).to_owned() + } + }; + let out = join_bytes(&bytes_ref(vm, id).to_vec(), &sep); + if out.len() > MAX_STRING_LEN { + return Err(vm.range_error("Invalid string length")); + } + Ok(vm.string_val(out)) +} + +fn u_to_string(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let id = this_bytes(vm, &this, "toString")?; + let out = join_bytes(&bytes_ref(vm, id).to_vec(), ","); + Ok(vm.string_val(out)) +} + +fn u_to_base64(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let id = this_bytes(vm, &this, "toBase64")?; + let out = base64_encode(&bytes_ref(vm, id).to_vec(), false, true); + Ok(vm.string_val(out)) +} + +fn u_to_hex(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let id = this_bytes(vm, &this, "toHex")?; + let out = hex_encode(&bytes_ref(vm, id).to_vec()); + Ok(vm.string_val(out)) +} + +fn u_iter(vm: &mut Vm, this: &Value, name: &str, kind: IterKind) -> Res { + let id = this_bytes(vm, this, name)?; + Ok(super::iterator::exotic_iter(vm, id, kind)) +} + +fn u_keys(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + u_iter(vm, &this, "keys", IterKind::Keys) +} + +fn u_values(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + u_iter(vm, &this, "values", IterKind::Values) +} + +fn u_entries(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + u_iter(vm, &this, "entries", IterKind::Entries) +} + +/// One step of a live iterator over bytes. +pub fn iter_step(vm: &mut Vm, target: Id, pos: usize, kind: IterKind) -> Option { + let b = bytes_ref(vm, target).get(pos)?; + Some(match kind { + IterKind::Keys => Value::Num(pos as f64), + IterKind::Values => Value::Num(b as f64), + IterKind::Entries => vm.new_array(vec![Value::Num(pos as f64), Value::Num(b as f64)]), + }) +} + +fn byte_at(vm: &Vm, id: Id, i: usize) -> Value { + match bytes_ref(vm, id).get(i) { + Some(b) => Value::Num(b as f64), + None => Value::Undef, + } +} + +// The callback methods run as native frames (see `native.rs`): each checks its receiver and callback as the reference's +// `Uint8Array$prototype$...` and its shared item loop do (see `fuel.rs`), then its frame calls the callback once per +// index of the length fixed at the start, reading each byte live. The slots of a `walk` frame: +const WALK_F: usize = 0; +const WALK_THIS: usize = 1; +const WALK_N: usize = 2; +const WALK_K: usize = 3; +const WALK_MODE: usize = 4; +/// `map`'s and `filter`'s bytes, as an array of numbers. +const WALK_OUT: usize = 5; +/// The byte and index of the call that is running. +const WALK_V: usize = 6; +const WALK_I: usize = 7; +/// What converting one of `map`'s results last threw, thrown once the walk ends; uninitialized while none did. +const WALK_ERR: usize = 8; + +const FOR_EACH: usize = 0; +const MAP: usize = 1; +const FILTER: usize = 2; +const SOME: usize = 3; +const EVERY: usize = 4; +const FIND: usize = 5; +const FIND_INDEX: usize = 6; +/// The methods from here on walk from the end. +const FIND_LAST: usize = 7; +const FIND_LAST_INDEX: usize = 8; + +fn walk(vm: &mut Vm, this: Value, args: &[Value], callee: Id, mode: usize, name: &str) -> Res { + fuel::method(vm); + let id = this_bytes(vm, &this, name)?; + fuel::receiver_then_loop(vm); + let f = super::require_callback(vm, &arg(args, 0), &format!("Uint8Array.{name}"))?; + fuel::native(vm); + let out = match mode { + MAP | FILTER => vm.new_array(Vec::new()), + _ => Value::Undef, + }; + let len = len_of(vm, id); + vm.enter_native_sub( + crate::native::NativeOp::Arrays, + WALK, + callee, + this, + &[ + f, + arg(args, 1), + Value::Num(len as f64), + Value::Num(0.0), + Value::Num(mode as f64), + out, + Value::Undef, + Value::Num(0.0), + Value::Uninit, + ], + ) +} + +/// The step of a `walk` frame. +fn walk_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + let mode = fr.index(vm, WALK_MODE); + let mut k = fr.index(vm, WALK_K); + match input { + Input::Start | Input::Finished(_) => {} + Input::Returned(r) => { + if let Some(done) = walk_visit(vm, fr, mode, r.get()) { + vm.bytecode_builtin(); + return Ok(Step::Done(done)); + } + fuel::step(vm); + k += 1; + } + Input::Threw(e) => return Err(e), + } + let this = fr.this_slot(vm); + let (Some(id), n) = (this.obj(), fr.index(vm, WALK_N)) else { + return Ok(Step::Done(Value::Undef)); + }; + if k >= n { + return walk_end(vm, fr, mode); + } + let i = if mode >= FIND_LAST { n - 1 - k } else { k }; + let v = Slot::pack(byte_at(vm, id, i)); + fr.set_index(vm, WALK_K, k); + fr.set_slot(vm, WALK_V, v); + fr.set_index(vm, WALK_I, i); + let (f, this_arg) = (fr.slot(vm, WALK_F), fr.slot(vm, WALK_THIS)); + fr.call_slots(vm, f, this_arg, [v, Slot::index(i), this]) +} + +/// What the callback's result `r` does: the method's result when it stops the walk. +fn walk_visit(vm: &mut Vm, fr: Frame, mode: usize, r: Value) -> Option { + match mode { + MAP => { + match super::builtin_number(vm, &r) { + Ok(n) => push_out(vm, fr, Value::Num(to_u8(n) as f64)), + Err(e) => fr.set(vm, WALK_ERR, e), + } + None + } + FILTER => { + let item = fr.get(vm, WALK_V); + if vm.truthy(&r) + && let Value::Num(n) = item + { + push_out(vm, fr, Value::Num(n as u8 as f64)); + } + None + } + SOME => vm.truthy(&r).then_some(Value::Bool(true)), + EVERY => (!vm.truthy(&r)).then_some(Value::Bool(false)), + FIND | FIND_LAST => vm.truthy(&r).then(|| fr.get(vm, WALK_V)), + FIND_INDEX | FIND_LAST_INDEX => vm + .truthy(&r) + .then(|| Value::Num(fr.index(vm, WALK_I) as f64)), + _ => None, + } +} + +fn push_out(vm: &mut Vm, fr: Frame, v: Value) { + if let Some(Kind::Array(out)) = fr + .slot(vm, WALK_OUT) + .obj() + .map(|o| &mut vm.heap[o as usize].kind) + { + out.push(v); + } +} + +/// The result of a `walk` frame that visited every index. +fn walk_end(vm: &mut Vm, fr: Frame, mode: usize) -> Result { + let e = fr.get(vm, WALK_ERR); + if mode == MAP && !matches!(e, Value::Uninit) { + return Err(e); + } + if let MAP | FILTER = mode { + fuel::native(vm); + } + vm.bytecode_builtin(); + Ok(Step::Done(match mode { + MAP | FILTER => { + let data = values_of(vm, fr.slot(vm, WALK_OUT)) + .iter() + .map(|v| v.as_num() as u8) + .collect(); + new_bytes(vm, data, false) + } + SOME => Value::Bool(false), + EVERY => Value::Bool(true), + FIND_INDEX | FIND_LAST_INDEX => Value::Num(-1.0), + _ => Value::Undef, + })) +} + +fn u_for_each(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + walk(vm, this, args, callee, FOR_EACH, "forEach") +} + +fn u_map(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + walk(vm, this, args, callee, MAP, "map") +} + +fn u_filter(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + walk(vm, this, args, callee, FILTER, "filter") +} + +fn u_find(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + walk(vm, this, args, callee, FIND, "find") +} + +fn u_find_index(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + walk(vm, this, args, callee, FIND_INDEX, "findIndex") +} + +fn u_find_last(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + walk(vm, this, args, callee, FIND_LAST, "findLast") +} + +fn u_find_last_index(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + walk(vm, this, args, callee, FIND_LAST_INDEX, "findLastIndex") +} + +fn u_some(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + walk(vm, this, args, callee, SOME, "some") +} + +fn u_every(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + walk(vm, this, args, callee, EVERY, "every") +} + +// The slots of a `reduce` frame: the callback, the length fixed at the start, the next position, whether it walks +// from the end, and the accumulator. +const RED_F: usize = 0; +const RED_N: usize = 1; +const RED_K: usize = 2; +const RED_REVERSE: usize = 3; +const RED_ACC: usize = 4; + +fn reduce(vm: &mut Vm, this: Value, args: &[Value], callee: Id, right: bool) -> Res { + let name = if right { "reduceRight" } else { "reduce" }; + fuel::method(vm); + let id = this_bytes(vm, &this, name)?; + fuel::receiver_then_loop(vm); + let f = super::require_callback(vm, &arg(args, 0), &format!("Uint8Array.{name}"))?; + fuel::native(vm); + let len = len_of(vm, id); + let (acc, k) = match args.get(1) { + Some(acc) => (*acc, 0), + None if len == 0 => { + return Err(vm.type_error(&format!( + "Uint8Array.{name} of an empty array with no initial value." + ))); + } + None => (byte_at(vm, id, if right { len - 1 } else { 0 }), 1), + }; + vm.enter_native_sub( + crate::native::NativeOp::Arrays, + REDUCE, + callee, + this, + &[ + f, + Value::Num(len as f64), + Value::Num(k as f64), + Value::Bool(right), + acc, + ], + ) +} + +/// The step of a `reduce` frame. +fn reduce_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + match input { + Input::Start | Input::Finished(_) => {} + Input::Returned(r) => { + fr.set_slot(vm, RED_ACC, r); + fuel::step(vm); + } + Input::Threw(e) => return Err(e), + } + let this = fr.this_slot(vm); + let (Some(id), n, k) = (this.obj(), fr.index(vm, RED_N), fr.index(vm, RED_K)) else { + return Ok(Step::Done(Value::Undef)); + }; + if k >= n { + vm.bytecode_builtin(); + return Ok(Step::Done(fr.get(vm, RED_ACC))); + } + let i = if matches!(fr.get(vm, RED_REVERSE), Value::Bool(true)) { + n - 1 - k + } else { + k + }; + fr.set_index(vm, RED_K, k + 1); + let (f, acc) = (fr.slot(vm, RED_F), fr.slot(vm, RED_ACC)); + let v = Slot::pack(byte_at(vm, id, i)); + fr.call_slots(vm, f, Slot::UNDEF, [acc, v, Slot::index(i), this]) +} + +fn u_reduce(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + reduce(vm, this, args, callee, false) +} + +fn u_reduce_right(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + reduce(vm, this, args, callee, true) +} + +// ---------- TextEncoder and TextDecoder ---------- + +pub struct Decoder { + pub fatal: bool, + pub ignore_bom: bool, + pub(crate) queued: Vec, + pub(crate) seen: bool, +} + +fn encoder_ctor(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + requires_new(vm, &this, "TextEncoder")?; + let proto = vm.realm.std.text_encoder; + Ok(Value::Obj(vm.alloc(Obj::new(Some(proto), Kind::Ordinary)))) +} + +fn encoder_encode(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let s = match arg(args, 0) { + Value::Undef => String::new(), + v => { + let s = vm.string_of(&v)?; + crate::strings::host_text(vm.text(s)).into_owned() + } + }; + Ok(new_bytes(vm, s.into_bytes(), false)) +} + +const UTF8_LABELS: [&str; 6] = [ + "unicode-1-1-utf-8", + "unicode11utf8", + "unicode20utf8", + "utf-8", + "utf8", + "x-unicode20utf8", +]; + +fn decoder_ctor(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + requires_new(vm, &this, "TextDecoder")?; + let label = match arg(args, 0) { + Value::Undef => "utf-8".to_owned(), + v => { + let s = vm.string_of(&v)?; + vm.text(s) + .trim_matches(|c: char| c.is_ascii_whitespace()) + .to_lowercase() + } + }; + if !UTF8_LABELS.contains(&label.as_str()) { + return Err(vm.range_error(&format!( + "The \"{label}\" encoding is not supported; only UTF-8 is." + ))); + } + let mut flag = |name: &'static str| -> bool { + match arg(args, 1) { + Value::Obj(o) => { + let k = vm.atoms.intern_static(name); + let v = vm.get_obj(o, k); + vm.truthy(&v) + } + _ => false, + } + }; + let fatal = flag("fatal"); + let ignore_bom = flag("ignoreBOM"); + let proto = vm.realm.std.text_decoder; + let d = Decoder { + fatal, + ignore_bom, + queued: Vec::new(), + seen: false, + }; + Ok(Value::Obj(vm.alloc(Obj::new( + Some(proto), + Kind::TextDecoder(Box::new(d)), + )))) +} + +pub fn decoder_prop(vm: &mut Vm, id: Id, key: Atom) -> Option { + let Kind::TextDecoder(d) = &vm.heap[id as usize].kind else { + return None; + }; + let (fatal, ignore) = (d.fatal, d.ignore_bom); + match vm.atoms.text(key) { + "encoding" => Some(vm.static_str("utf-8")), + "fatal" => Some(Value::Bool(fatal)), + "ignoreBOM" => Some(Value::Bool(ignore)), + _ => None, + } +} + +/// Where a streamed chunk can be decoded up to: before an incomplete trailing sequence, or after the first error +/// in fatal mode. +fn stream_boundary(bytes: &[u8], fatal: bool) -> (usize, bool) { + let mut next = if fatal { + 0 + } else { + bytes.len().saturating_sub(3) + }; + while next < bytes.len() { + let start = next; + let lead = bytes[next]; + next += 1; + if lead < 0x80 { + continue; + } + if !(0xc2..=0xf4).contains(&lead) { + if fatal { + return (next, true); + } + continue; + } + let width = if lead < 0xe0 { + 2 + } else if lead < 0xf0 { + 3 + } else { + 4 + }; + let mut lower = match lead { + 0xe0 => 0xa0, + 0xf0 => 0x90, + _ => 0x80, + }; + let mut upper = match lead { + 0xed => 0x9f, + 0xf4 => 0x8f, + _ => 0xbf, + }; + while next < start + width { + if next == bytes.len() { + return (start, false); + } + let b = bytes[next]; + if b < lower || b > upper { + if fatal { + return (next, true); + } + break; + } + next += 1; + lower = 0x80; + upper = 0xbf; + } + } + (next, false) +} + +fn decoder_decode(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = match this { + Value::Obj(id) if matches!(vm.heap[id as usize].kind, Kind::TextDecoder(_)) => id, + _ => return Err(incompatible(vm, "TextDecoder.prototype.decode", &this)), + }; + let input = arg(args, 0); + let chunk = match input { + Value::Undef => Vec::new(), + v => match bytes_of(vm, &v) { + Some(b) => b, + None => { + let d = describe_value(vm, &v); + return Err(vm.type_error(&format!( + "TextDecoder.decode expects a Uint8Array, received {d}." + ))); + } + }, + }; + let stream = match arg(args, 1) { + Value::Undef => false, + Value::Obj(o) => { + let k = vm.atoms.intern_static("stream"); + let v = vm.get_obj(o, k); + vm.truthy(&v) + } + Value::Null => false, + _ => return Err(vm.type_error("TextDecoder.decode expects an options object.")), + }; + let Kind::TextDecoder(d) = &mut vm.heap[id as usize].kind else { + return Ok(Value::Undef); + }; + let mut bytes = std::mem::take(&mut d.queued); + bytes.extend_from_slice(&chunk); + let (end, error) = if stream { + stream_boundary(&bytes, d.fatal) + } else { + (bytes.len(), false) + }; + d.queued = bytes[end.min(bytes.len())..].to_vec(); + let strip = !d.ignore_bom && !d.seen; + if !stream { + d.seen = false; + } + let fatal = d.fatal; + if error { + return Err(vm.type_error("TextDecoder.decode: the input is not valid utf-8.")); + } + let part = &bytes[..end.min(bytes.len())]; + let text = if fatal { + match std::str::from_utf8(part) { + Ok(s) => s.to_owned(), + Err(_) => { + return Err(vm.type_error("TextDecoder.decode: the input is not valid utf-8.")); + } + } + } else { + String::from_utf8_lossy(part).into_owned() + }; + if stream + && !text.is_empty() + && let Kind::TextDecoder(d) = &mut vm.heap[id as usize].kind + { + d.seen = true; + } + let text = match text.strip_prefix('\u{feff}') { + Some(rest) if strip => rest.to_owned(), + _ => text, + }; + Ok(vm.string_val(crate::strings::external_text(text))) +} + +// ---------- atob and btoa ---------- + +fn global_atob(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + if args.is_empty() { + return Err(vm.type_error("atob requires 1 argument (a string)")); + } + let s = vm.string_of(&args[0])?; + match base64_decode(vm.text(s)) { + Some(d) => { + let out: String = d.into_iter().map(char::from).collect(); + Ok(vm.string_val(out)) + } + None => Err(vm.type_error("The string contains invalid characters.")), + } +} + +fn global_btoa(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + if args.is_empty() { + return Err(vm.type_error("btoa requires 1 argument (a string)")); + } + let s = vm.string_of(&args[0])?; + let mut data = Vec::new(); + for c in vm.text(s).chars() { + if c as u32 > 0xff { + return Err(vm.type_error("The string contains invalid characters.")); + } + data.push(c as u8); + } + let out = base64_encode(&data, false, true); + Ok(vm.string_val(out)) +} + +/// The steps of this family's native frames (`native::NativeOp::Arrays`), by sub-op; see `native.rs`. +pub(crate) fn family_step(vm: &mut Vm, sub: u16, fr: Frame, input: Input) -> Result { + match sub { + COLLECT => crate::native::for_of_step::(vm, fr, input), + WALK => walk_step(vm, fr, input), + REDUCE => reduce_step(vm, fr, input), + _ => Ok(Step::Done(Value::Undef)), + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/builtins/collections.rs b/packages/codemode-rust/crates/psychoscript/src/builtins/collections.rs new file mode 100644 index 0000000000000..1215599404ae5 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/builtins/collections.rs @@ -0,0 +1,722 @@ +//! Map, Set, Promise, generators and built-in iterators. + +use super::{arg, fuel}; +use crate::native::{ + FOR_OF_SLOTS, Flow, ForOf, Frame, Input, Step, enter_for_of, enter_for_of_sub, +}; +use crate::object::*; +use crate::value::{Id, Slot, Value}; +use crate::vm::{Reaction, Res, Vm}; + +pub fn setup(vm: &mut Vm) { + let mp = vm.realm.map_proto; + vm.ctor("Map", 0, map_ctor, mp, Value::Undef); + super::accessors(vm, mp, &["size"]); + vm.methods( + mp, + &[ + ("get", 1, map_get), + ("has", 1, map_has::), + ("set", 2, map_set), + ("getOrInsert", 2, super::sets::map_get_or_insert), + ( + "getOrInsertComputed", + 2, + super::sets::map_get_or_insert_computed, + ), + ("delete", 1, map_delete::), + ("clear", 0, map_clear::), + ("keys", 0, map_keys), + ("values", 0, map_values::), + ("entries", 0, map_entries::), + ("forEach", 1, map_for_each::), + ], + ); + let ek = vm.atoms.intern_static("entries"); + let entries = vm.get_obj(mp, ek); + vm.define_hidden(mp, SYM_ITERATOR, entries); + + let sp = vm.realm.set_proto; + vm.ctor("Set", 0, set_ctor, sp, Value::Undef); + super::accessors(vm, sp, &["size"]); + vm.methods( + sp, + &[ + ("has", 1, map_has::), + ("add", 1, set_add), + ("delete", 1, map_delete::), + ("clear", 0, map_clear::), + ], + ); + let values = vm.method(sp, "values", 0, map_values::); + vm.method(sp, "entries", 0, map_entries::); + let keys = vm.atoms.intern_static("keys"); + vm.define_hidden(sp, keys, values); + vm.define_hidden(sp, SYM_ITERATOR, values); + vm.method(sp, "forEach", 1, map_for_each::); + + let pp = vm.realm.promise_proto; + let promise = vm.ctor("Promise", 1, promise_ctor, pp, Value::Undef); + // Each combinator keeps, as its data, the internal function that collects an input it iterates in a frame. + let collect = vm.native_fn("", 1, collect_items, Value::Undef); + let combinators: [(&'static str, crate::vm::NativeFn); 4] = [ + ("all", promise_combinator::), + ("allSettled", promise_combinator::), + ("race", promise_combinator::), + ("any", promise_combinator::), + ]; + for (name, f) in combinators { + let v = vm.native_fn(name, 1, f, collect); + let key = vm.atoms.intern(name); + vm.define_hidden(promise, key, v); + } + vm.methods( + promise, + &[ + ("resolve", 1, promise_resolve), + ("reject", 1, promise_reject), + ("withResolvers", 0, promise_with_resolvers), + ("try", 1, promise_try), + ], + ); + // Combinators are not callbacks: `[p].map(Promise.resolve)` must ask for an arrow function. + for name in [ + "all", + "allSettled", + "race", + "any", + "resolve", + "reject", + "withResolvers", + "try", + ] { + let key = vm.atoms.intern(name); + if let Value::Obj(f) = vm.get_obj(promise, key) { + vm.heap[f as usize].flags |= NOT_CALLBACK; + } + } + let then = vm.method(pp, "then", 2, promise_then); + vm.realm.promise_then = then.as_obj().unwrap_or(0); + vm.methods( + pp, + &[("catch", 1, promise_catch), ("finally", 1, promise_finally)], + ); + + // `Iterator.prototype.next` is `builtins::iterator`'s. + let ip = vm.realm.iter_proto; + let self_iter = vm.native_fn("[Symbol.iterator]", 0, iter_self, Value::Undef); + vm.define_hidden(ip, SYM_ITERATOR, self_iter); + + let gp = vm.realm.generator_proto; + vm.methods( + gp, + &[ + ("next", 1, gen_next), + ("return", 1, gen_return), + ("throw", 1, gen_throw), + ], + ); +} + +// ---------- Map and Set ---------- + +/// The receiver of a Map method (`SET` false) or a Set method (`SET` true). +fn map_of(vm: &mut Vm, this: &Value, what: &str) -> Result { + if let Value::Obj(id) = this { + match vm.heap[*id as usize].kind { + Kind::Map(_) if !SET => return Ok(*id), + Kind::Set(_) if SET => return Ok(*id), + _ => {} + } + } + let ty = if SET { "Set" } else { "Map" }; + Err(super::incompatible( + vm, + &format!("{ty}.prototype.{what}"), + this, + )) +} + +fn table(vm: &mut Vm, id: Id) -> &mut OrderedMap { + match &mut vm.heap[id as usize].kind { + Kind::Map(m) | Kind::Set(m) => m, + _ => unreachable!("checked by map_of"), + } +} + +/// The reference's `fillCollection` into the Map or Set in the frame's first own slot: for a Map, `$IsObject`, then +/// `$Table("add")`, for each entry; for a Set, `$Table("add")` for each value. +pub(crate) struct FillCollection; + +impl ForOf for FillCollection { + fn item(vm: &mut Vm, fr: Frame, x: Value) -> Result { + let id = fr.slot(vm, FOR_OF_SLOTS).obj().unwrap_or(0); + if matches!(vm.heap[id as usize].kind, Kind::Set(_)) { + let key = vm.map_key(&x); + let entry_key = vm.map_entry_key(key, x); + table(vm, id).set(key, entry_key, Value::Undef); + fuel::native(vm); + return Ok(Flow::Next); + } + fuel::native(vm); + if !matches!(x, Value::Obj(_)) { + return Err(vm.type_error("new Map(...) expects [key, value] pairs as entry objects.")); + } + let k = vm.get_elem(&x, &Value::Num(0.0))?; + let v = vm.get_elem(&x, &Value::Num(1.0))?; + let key = vm.map_key(&k); + let entry_key = vm.map_entry_key(key, k); + table(vm, id).set(key, entry_key, v); + fuel::native(vm); + Ok(Flow::Next) + } + + fn finish(vm: &mut Vm, fr: Frame) -> Res { + Ok(fr.get(vm, FOR_OF_SLOTS)) + } +} + +fn map_ctor(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + if !matches!(this, Value::Uninit) { + return Err(vm.type_error("Constructor Map requires 'new'")); + } + let proto = vm.realm.map_proto; + let id = vm.alloc(Obj::new(Some(proto), Kind::Map(Box::default()))); + let src = arg(args, 0); + if !src.is_nullish() { + fuel::method(vm); + let op = crate::native::NativeOp::FillCollection; + return enter_for_of(vm, op, callee, Value::Undef, src, &[Value::Obj(id)]); + } + Ok(Value::Obj(id)) +} + +fn set_ctor(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + if !matches!(this, Value::Uninit) { + return Err(vm.type_error("Constructor Set requires 'new'")); + } + let proto = vm.realm.set_proto; + let id = vm.alloc(Obj::new(Some(proto), Kind::Set(Box::default()))); + let src = arg(args, 0); + if !src.is_nullish() { + fuel::method(vm); + let op = crate::native::NativeOp::FillCollection; + return enter_for_of(vm, op, callee, Value::Undef, src, &[Value::Obj(id)]); + } + Ok(Value::Obj(id)) +} + +fn map_get(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = map_of::(vm, &this, "get")?; + let key = vm.map_key(&arg(args, 0)); + Ok(table(vm, id).get(key).unwrap_or_default()) +} + +fn map_set(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = map_of::(vm, &this, "set")?; + let key = vm.map_key(&arg(args, 0)); + let entry_key = vm.map_entry_key(key, arg(args, 0)); + table(vm, id).set(key, entry_key, arg(args, 1)); + Ok(this) +} + +fn set_add(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = map_of::(vm, &this, "add")?; + let key = vm.map_key(&arg(args, 0)); + let entry_key = vm.map_entry_key(key, arg(args, 0)); + table(vm, id).set(key, entry_key, Value::Undef); + Ok(this) +} + +/// `Set.prototype.has` and `Map.prototype.has`, which the Set methods may call directly (see `sets::builtin_has`). +pub(crate) const SET_HAS: crate::vm::NativeFn = map_has::; +pub(crate) const MAP_HAS: crate::vm::NativeFn = map_has::; + +fn map_has(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = map_of::(vm, &this, "has")?; + let key = vm.map_key(&arg(args, 0)); + Ok(Value::Bool(table(vm, id).has(key))) +} + +fn map_delete(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = map_of::(vm, &this, "delete")?; + let key = vm.map_key(&arg(args, 0)); + Ok(Value::Bool(table(vm, id).delete(key))) +} + +fn map_clear(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let id = map_of::(vm, &this, "clear")?; + table(vm, id).clear(); + Ok(Value::Undef) +} + +fn map_for_each(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + // The reference's `collectionForEach`, over `$Table("entries")`. + fuel::method(vm); + let id = map_of::(vm, &this, "forEach")?; + fuel::receiver_then_loop(vm); + let label = if SET { "Set.forEach" } else { "Map.forEach" }; + let f = super::require_callback(vm, &arg(args, 0), label)?; + fuel::native(vm); + fuel::native(vm); + let op = crate::native::NativeOp::MapForEach; + vm.enter_native( + op, + callee, + Value::Obj(id), + &[f, arg(args, 1), Value::Num(0.0)], + ) +} + +/// The step of a Map's or Set's `forEach`: entries added while it runs are visited too. +pub(crate) fn map_for_each_step( + vm: &mut Vm, + fr: Frame, + input: crate::native::Input, +) -> Result { + use crate::native::{Input, Step}; + let this = fr.this_slot(vm); + let id = this.obj().unwrap_or(0); + // The logical position to continue from (see `OrderedMap`), exact in a slot up to 2^53. + let mut at = fr.index(vm, 2) as u64; + match input { + Input::Returned(_) => fuel::step(vm), + Input::Threw(e) => return Err(e), + Input::Start | Input::Finished(_) => {} + } + let is_set = matches!(vm.heap[id as usize].kind, Kind::Set(_)); + if let Some((k, v)) = table(vm, id).next_entry(&mut at) { + fr.set_index(vm, 2, at as usize); + let v = if is_set { k } else { v }; + let (f, this_arg) = (fr.slot(vm, 0), fr.slot(vm, 1)); + return fr.call_slots(vm, f, this_arg, [Slot::pack(v), Slot::pack(k), this]); + } + vm.bytecode_builtin(); + Ok(Step::Done(Value::Undef)) +} + +fn map_iter(vm: &mut Vm, this: &Value, name: &str, kind: IterKind) -> Res { + let id = map_of::(vm, this, name)?; + let proto = vm.realm.iter_proto; + Ok(Value::Obj(vm.alloc(Obj::new( + Some(proto), + Kind::MapIter { + target: id, + pos: 0, + kind, + }, + )))) +} + +fn map_keys(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + map_iter::(vm, &this, "keys", IterKind::Keys) +} + +fn map_values(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + map_iter::(vm, &this, "values", IterKind::Values) +} + +fn map_entries(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + map_iter::(vm, &this, "entries", IterKind::Entries) +} + +// ---------- iterators and generators ---------- + +fn iter_self(_vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + Ok(this) +} + +/// A generator method called as a native (`mode` 0 for `next`, 1 for `return`, 2 for `throw`): a generator that +/// runs does so in a frame, which answers with the iterator result. +fn gen_resume(vm: &mut Vm, this: &Value, mode: u8, v: Value, callee: Id) -> Res { + let Value::Obj(id) = *this else { + return Err(vm.type_error("Generator method called on incompatible receiver")); + }; + match vm.heap[id as usize].kind { + Kind::Generator(GenState::Suspended(_)) => {} + Kind::Generator(_) => { + // A generator that is done or running does not run: the answer is at hand. + if let Some((value, done)) = vm.native_resume(id, mode, v)? { + return Ok(vm.iter_result(value, done)); + } + } + _ => return Err(vm.type_error("Generator method called on incompatible receiver")), + } + let op = crate::native::NativeOp::Collections; + let slots = [Value::Obj(id), Value::Num(mode as f64), v]; + vm.enter_native_sub(op, super::sets::GEN_RESUME, callee, Value::Undef, &slots) +} + +/// `Vm::native_resume` for the frame `fr` on top, with what the generator throws and does not catch coming back to +/// the frame as `Input::Threw`. A `return` or `throw` request unwinds while the frame's step runs, which must not +/// carry the throw past the frame: when the frame is the base of a run, that would unwind the frames below it twice. +pub(crate) fn resume_catching( + vm: &mut Vm, + fr: Frame, + g: Id, + mode: u8, + v: Value, +) -> Result, Value> { + let sp = (vm.stack.len() - fr.base()) as u32; + vm.handlers_mut().push(crate::vm::Handler { + pc: crate::native::THREW as u32, + sp, + }); + let r = vm.native_resume(g, mode, v); + if !matches!(r, Ok(None)) { + vm.handlers_mut().pop(); + } + r +} + +/// The step of a generator method's frame: resumes the generator, then answers with what it yielded or returned. +pub(crate) fn gen_resume_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + match input { + Input::Start => { + let g = fr.slot(vm, 0).obj().unwrap_or(0); + let (mode, v) = (fr.index(vm, 1) as u8, fr.get(vm, 2)); + match resume_catching(vm, fr, g, mode, v)? { + None => Ok(Step::Pushed), + Some((value, done)) => Ok(Step::Done(vm.iter_result(value, done))), + } + } + Input::Returned(r) => Ok(Step::Done(vm.iter_result(r.get(), false))), + Input::Finished(r) => Ok(Step::Done(vm.iter_result(r.get(), true))), + Input::Threw(e) => Err(e), + } +} + +fn gen_next(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + gen_resume(vm, &this, 0, arg(args, 0), callee) +} + +fn gen_return(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + gen_resume(vm, &this, 1, arg(args, 0), callee) +} + +fn gen_throw(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + gen_resume(vm, &this, 2, arg(args, 0), callee) +} + +// ---------- Promise ---------- + +fn promise_ctor(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + if !matches!(this, Value::Uninit) { + return Err(vm.type_error("Promise constructor cannot be invoked without 'new'")); + } + let executor = arg(args, 0); + if !vm.is_callable(&executor) || matches!(executor, Value::Obj(id) if vm.is_namespace(id)) { + return Err(vm.type_error( + "new Promise(...) expects an executor function (e.g. new Promise((resolve, reject) => { ... })).", + )); + } + let p = vm.new_promise(); + let (res, rej) = vm.create_resolvers(p); + let kind = crate::promise::EXECUTOR; + crate::promise::enter_settle( + vm, + Value::Obj(callee), + kind, + Value::Obj(p), + rej, + Value::Undef, + executor, + Value::Undef, + &[res, rej], + ) +} + +fn promise_resolve(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + Ok(Value::Obj(vm.promise_resolve(arg(args, 0)))) +} + +fn promise_reject(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let p = vm.new_promise(); + vm.reject(p, arg(args, 0)); + Ok(Value::Obj(p)) +} + +// Which combinator a frame runs, as its slot holds it. +const ALL: u8 = 0; +const ALL_SETTLED: u8 = 1; +const ANY: u8 = 2; +const RACE: u8 = 3; +const COMBINATOR_NAMES: [&str; 4] = ["all", "allSettled", "any", "race"]; + +/// `Promise.all`, `allSettled`, `any` and `race`: an input that fails to iterate gives a rejected promise, not a +/// throw. An array is walked here; any other input is iterated in a frame (`combine_step`). +fn promise_combinator(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let items = arg(args, 0); + if !vm.is_iterable(&items) { + let d = vm.describe_data(&items); + let name = COMBINATOR_NAMES[K as usize]; + let e = vm.type_error(&format!( + "Promise.{name} expects a synchronous iterable, received {d}." + )); + return Ok(rejected(vm, e)); + } + // The reference adds the items in its internal `$vmCombine`, a back-edge each, after its own call. + fuel::native(vm); + if matches!(items, Value::Obj(id) if matches!(vm.heap[id as usize].kind, Kind::Array(_))) { + return match fuel::for_of(vm, &items) { + Ok(list) => { + vm.bytecode_builtin(); + Ok(combine(vm, K, list)) + } + Err(e) if vm.fatal.is_some() => Err(e), + Err(e) => Ok(rejected(vm, e)), + }; + } + let collect = vm.native_data(callee); + let op = crate::native::NativeOp::Collections; + let slots = [collect, items, Value::Num(K as f64)]; + vm.enter_native_sub(op, super::sets::COMBINE, callee, Value::Undef, &slots) +} + +/// The step of a combinator's frame: collects its input with the internal `collect_items`, catching what that throws, +/// then combines the items, or answers with a rejected promise. +pub(crate) fn combine_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + match input { + Input::Start => { + let (collect, items) = (fr.slot(vm, 0), fr.slot(vm, 1)); + Ok(fr.catching_list(vm, collect, Slot::UNDEF, &[items], Step::CallUncounted)) + } + Input::Returned(r) => { + let list = match r.obj().map(|id| &mut vm.heap[id as usize].kind) { + Some(Kind::Array(items)) => std::mem::take(items), + _ => Vec::new(), + }; + vm.bytecode_builtin(); + let kind = fr.index(vm, 2) as u8; + Ok(Step::Done(combine(vm, kind, list))) + } + Input::Threw(e) if vm.fatal.is_some() => Err(e), + Input::Threw(e) => Ok(Step::Done(rejected(vm, e))), + Input::Finished(_) => Ok(Step::Done(Value::Undef)), + } +} + +/// The internal function a combinator's frame calls to collect its input into an array, in a frame of its own. +fn collect_items(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let list = vm.new_array(Vec::new()); + let op = crate::native::NativeOp::Collections; + let sub = super::sets::COLLECT; + enter_for_of_sub(vm, op, sub, callee, Value::Undef, arg(args, 0), &[list]) +} + +/// Collects each value into the array in the frame's first own slot. +pub(crate) struct Collect; + +impl ForOf for Collect { + fn item(vm: &mut Vm, fr: Frame, x: Value) -> Result { + if let Some(list) = fr.slot(vm, FOR_OF_SLOTS).obj() + && let Kind::Array(items) = &mut vm.heap[list as usize].kind + { + items.push(x); + } + Ok(Flow::Next) + } + + fn finish(vm: &mut Vm, fr: Frame) -> Res { + Ok(fr.get(vm, FOR_OF_SLOTS)) + } +} + +fn rejected(vm: &mut Vm, e: Value) -> Value { + locate_call(vm, &e); + let p = vm.new_promise(); + vm.reject(p, e); + Value::Obj(p) +} + +/// Points a failure a combinator rejects with at the combinator's call, as the reference's would be when thrown. +fn locate_call(vm: &mut Vm, e: &Value) { + if let Value::Obj(id) = *e + && let Some(caller) = vm + .frames + .iter() + .rev() + .find(|f| !matches!(f.kind, crate::vm::FrameKind::Native(..))) + && let Kind::Error(Some(f)) = &mut vm.heap[id as usize].kind + && f.offset.is_none() + { + f.offset = caller.func.pos.get(caller.pc.saturating_sub(1)).copied(); + } +} + +/// The promise a combinator returns for its input's items. +fn combine(vm: &mut Vm, which: u8, items: Vec) -> Value { + let result = vm.new_promise(); + let kind = match which { + ALL => CombKind::All, + ALL_SETTLED => CombKind::AllSettled, + ANY => CombKind::Any, + _ => { + if items.is_empty() { + let e = vm.type_error( + "Promise.race([]) would never settle; provide at least one promise or value.", + ); + locate_call(vm, &e); + vm.reject(result, e); + } + for item in items { + let p = vm.promise_resolve(item); + vm.perform_then(p, Reaction::Resolve(result)); + } + return Value::Obj(result); + } + }; + let n = items.len(); + if n == 0 { + if kind == CombKind::Any { + let proto = vm.realm.aggregate_error_proto; + let e = vm.make_error(proto, "All promises were rejected"); + let empty = vm.new_array(Vec::new()); + if let Value::Obj(eid) = e { + let ek = vm.names.errors; + vm.define_hidden(eid, ek, empty); + } + vm.reject(result, e); + } else { + let empty = vm.new_array(Vec::new()); + vm.resolve_promise(result, empty); + } + return Value::Obj(result); + } + let proto = vm.realm.object_proto; + let comb = vm.alloc(Obj::new( + Some(proto), + Kind::Combinator(Box::new(Combinator { + kind, + promise: result, + values: vec![Value::Undef; n], + remaining: n, + })), + )); + for (i, item) in items.into_iter().enumerate() { + let p = vm.promise_resolve(item); + vm.perform_then( + p, + Reaction::Comb { + comb, + index: i as u32, + }, + ); + } + Value::Obj(result) +} + +fn promise_with_resolvers(vm: &mut Vm, _this: Value, _args: &[Value], _: Id) -> Res { + let p = vm.new_promise(); + let (res, rej) = vm.create_resolvers(p); + let o = vm.new_object(); + let (pk, rk, jk) = ( + vm.atoms.intern_static("promise"), + vm.atoms.intern_static("resolve"), + vm.atoms.intern_static("reject"), + ); + vm.define(o, pk, Value::Obj(p)); + vm.define(o, rk, res); + vm.define(o, jk, rej); + Ok(Value::Obj(o)) +} + +fn promise_try(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let f = arg(args, 0); + if !vm.is_callable(&f) { + let d = vm.describe_data(&f); + return Err(vm.type_error(&format!("Promise.try expects a function, received {d}."))); + } + let p = vm.new_promise(); + let rest = if args.is_empty() { &[][..] } else { &args[1..] }; + // The reference's native returns before the callback runs, which a call from bytecode spent its fifty on. + let counted = vm.host.meter.counted; + if counted { + fuel::native(vm); + } + // The frame ends the call as a bytecode built-in's when the call was counted. + let (u, c) = (Value::Undef, Value::Num(counted as u8 as f64)); + crate::promise::enter_settle( + vm, + Value::Obj(callee), + crate::promise::TRY, + Value::Obj(p), + u, + c, + f, + u, + rest, + ) +} + +fn this_promise(vm: &mut Vm, this: &Value, method: &str) -> Result { + match vm.as_promise(this) { + Some(p) => Ok(p), + None => Err(super::incompatible( + vm, + &format!("Promise.prototype.{method}"), + this, + )), + } +} + +fn promise_then(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let p = this_promise(vm, &this, "then")?; + let on_ful = reaction_handler(vm, arg(args, 0), "then")?; + let on_rej = reaction_handler(vm, arg(args, 1), "then")?; + let derived = vm.new_promise(); + vm.perform_then( + p, + Reaction::Then { + on_ful, + on_rej, + derived, + }, + ); + Ok(Value::Obj(derived)) +} + +fn promise_catch(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let p = this_promise(vm, &this, "catch")?; + let on_rej = reaction_handler(vm, arg(args, 0), "catch")?; + let derived = vm.new_promise(); + vm.perform_then( + p, + Reaction::Then { + on_ful: Value::Undef, + on_rej, + derived, + }, + ); + Ok(Value::Obj(derived)) +} + +/// A reaction's handler as the reference's `reactionHandler` takes it: a function a callback site admits, nothing +/// for anything that isn't a function, and a TypeError for a function it doesn't admit. +fn reaction_handler(vm: &mut Vm, f: Value, method: &str) -> Res { + if super::supported_callback(vm, &f) { + return Ok(f); + } + if vm.type_of(&f) == "function" { + let name = format!("Promise.prototype.{method}"); + return Err(super::unsupported_callable( + vm, + &name, + "handler", + "(value) => fn(value)", + )); + } + Ok(Value::Undef) +} + +fn promise_finally(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let p = this_promise(vm, &this, "finally")?; + let cleanup = reaction_handler(vm, arg(args, 0), "finally")?; + let derived = vm.new_promise(); + if vm.is_callable(&cleanup) { + vm.perform_then(p, Reaction::Finally { cleanup, derived }); + } else { + vm.perform_then(p, Reaction::Resolve(derived)); + } + Ok(Value::Obj(derived)) +} diff --git a/packages/codemode-rust/crates/psychoscript/src/builtins/date.rs b/packages/codemode-rust/crates/psychoscript/src/builtins/date.rs new file mode 100644 index 0000000000000..57057cf86354c --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/builtins/date.rs @@ -0,0 +1,1032 @@ +//! Date. Local time follows the host's time zone (`TZ`, else `/etc/localtime`), like the reference; the string forms +//! the reference makes deterministic (`toString`, `Date()`, `toLocale*String`) are ISO or `en-US` in UTC. + +use std::sync::OnceLock; + +use super::arg; +use super::fuel::Conversions; +use crate::object::*; +use crate::ops::Hint; +use crate::value::{Id, Value}; +use crate::vm::{Res, Vm}; + +const MS_PER_DAY: f64 = 86_400_000.0; +const DAYS: [&str; 7] = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; +const MONTHS: [&str; 12] = [ + "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", +]; + +// ---------- time model ---------- + +fn day(t: f64) -> f64 { + (t / MS_PER_DAY).floor() +} + +fn time_within_day(t: f64) -> f64 { + t.rem_euclid(MS_PER_DAY) +} + +/// Days since the epoch of a proleptic Gregorian date (month 1-12). +fn days_from_civil(y: i64, m: i64, d: i64) -> i64 { + let y = if m <= 2 { y - 1 } else { y }; + let era = y.div_euclid(400); + let yoe = y - era * 400; + let mp = (m + 9) % 12; + let doy = (153 * mp + 2) / 5 + d - 1; + let doe = yoe * 365 + yoe / 4 - yoe / 100 + doy; + era * 146_097 + doe - 719_468 +} + +/// (year, month 0-11, date 1-31) of a day number. +fn civil_from_days(z: i64) -> (i64, i64, i64) { + let z = z + 719_468; + let era = z.div_euclid(146_097); + let doe = z - era * 146_097; + let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365; + let y = yoe + era * 400; + let doy = doe - (365 * yoe + yoe / 4 - yoe / 100); + let mp = (5 * doy + 2) / 153; + let d = doy - (153 * mp + 2) / 5 + 1; + let m = if mp < 10 { mp + 3 } else { mp - 9 }; + (if m <= 2 { y + 1 } else { y }, m - 1, d) +} + +/// The calendar fields of a finite time value. +#[derive(Clone, Copy)] +struct Fields { + year: i64, + month: i64, + date: i64, + hours: i64, + minutes: i64, + seconds: i64, + ms: i64, + weekday: i64, +} + +fn fields(t: f64) -> Fields { + let d = day(t) as i64; + let (year, month, date) = civil_from_days(d); + let w = time_within_day(t) as i64; + Fields { + year, + month, + date, + hours: w / 3_600_000, + minutes: w / 60_000 % 60, + seconds: w / 1000 % 60, + ms: w % 1000, + weekday: (d + 4).rem_euclid(7), + } +} + +fn integer(x: f64) -> f64 { + x.trunc() + 0.0 +} + +fn make_time(h: f64, m: f64, s: f64, ms: f64) -> f64 { + if !(h.is_finite() && m.is_finite() && s.is_finite() && ms.is_finite()) { + return f64::NAN; + } + integer(h) * 3_600_000.0 + integer(m) * 60_000.0 + integer(s) * 1000.0 + integer(ms) +} + +fn make_day(year: f64, month: f64, date: f64) -> f64 { + if !(year.is_finite() && month.is_finite() && date.is_finite()) { + return f64::NAN; + } + let (y, m, dt) = (integer(year), integer(month), integer(date)); + let ym = y + (m / 12.0).floor(); + if ym.abs() > 400_000.0 { + return f64::NAN; + } + let mn = m.rem_euclid(12.0); + let days = days_from_civil(ym as i64, mn as i64 + 1, 1) as f64; + days + dt - 1.0 +} + +fn make_date(day: f64, time: f64) -> f64 { + if !(day.is_finite() && time.is_finite()) { + return f64::NAN; + } + let tv = day * MS_PER_DAY + time; + if !tv.is_finite() { f64::NAN } else { tv } +} + +pub fn time_clip(t: f64) -> f64 { + if !t.is_finite() || t.abs() > 8.64e15 { + return f64::NAN; + } + integer(t) +} + +// ---------- local time ---------- + +fn zone() -> Option<&'static tz::TimeZone> { + static ZONE: OnceLock> = OnceLock::new(); + ZONE.get_or_init(|| { + let from_env = std::env::var("TZ") + .ok() + .filter(|s| !s.is_empty()) + .and_then(|s| tz::TimeZone::from_posix_tz(&s).ok()); + from_env.or_else(|| tz::TimeZone::local().ok()) + }) + .as_ref() +} + +/// The zone's offset from UTC in milliseconds at UTC time `t`, with its designation. +fn offset_at(t: f64) -> (f64, String) { + let Some(z) = zone() else { + return (0.0, "UTC".into()); + }; + let secs = (t / 1000.0).floor().clamp(-8.64e12, 8.64e12) as i64; + match z.find_local_time_type(secs) { + Ok(lt) => ( + lt.ut_offset() as f64 * 1000.0, + lt.time_zone_designation().to_owned(), + ), + Err(_) => (0.0, "UTC".into()), + } +} + +fn local_time(t: f64) -> f64 { + t + offset_at(t).0 +} + +/// UTC(t): the UTC time of local time `t`. +fn utc(t: f64) -> f64 { + if !t.is_finite() { + return f64::NAN; + } + let guess = t - offset_at(t).0; + t - offset_at(guess).0 +} + +fn now() -> f64 { + std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .map(|d| d.as_millis() as f64) + .unwrap_or(0.0) +} + +// ---------- formatting ---------- + +fn year_text(y: i64) -> String { + if y < 0 { + format!("-{:04}", -y) + } else { + format!("{y:04}") + } +} + +pub fn iso_string(t: f64) -> String { + let f = fields(t); + let year = if (0..=9999).contains(&f.year) { + format!("{:04}", f.year) + } else if f.year < 0 { + format!("-{:06}", -f.year) + } else { + format!("+{:06}", f.year) + }; + format!( + "{year}-{:02}-{:02}T{:02}:{:02}:{:02}.{:03}Z", + f.month + 1, + f.date, + f.hours, + f.minutes, + f.seconds, + f.ms + ) +} + +/// The deterministic string form: ISO, or `Invalid Date`. +pub fn display(t: f64) -> String { + if t.is_finite() { + iso_string(t) + } else { + "Invalid Date".into() + } +} + +fn utc_string(t: f64) -> String { + let f = fields(t); + format!( + "{}, {:02} {} {} {:02}:{:02}:{:02} GMT", + DAYS[f.weekday as usize], + f.date, + MONTHS[f.month as usize], + year_text(f.year), + f.hours, + f.minutes, + f.seconds + ) +} + +fn date_string(t: f64) -> String { + let f = fields(local_time(t)); + format!( + "{} {} {:02} {}", + DAYS[f.weekday as usize], + MONTHS[f.month as usize], + f.date, + year_text(f.year) + ) +} + +fn zone_name(designation: &str, offset: f64) -> String { + match designation { + "UTC" | "UCT" | "Zulu" | "Z" => "Coordinated Universal Time".into(), + "GMT" if offset == 0.0 => "Greenwich Mean Time".into(), + d => d.to_owned(), + } +} + +fn time_string(t: f64) -> String { + let (offset, designation) = offset_at(t); + let f = fields(t + offset); + let mins = (offset / 60_000.0) as i64; + format!( + "{:02}:{:02}:{:02} GMT{}{:02}{:02} ({})", + f.hours, + f.minutes, + f.seconds, + if mins < 0 { '-' } else { '+' }, + mins.abs() / 60, + mins.abs() % 60, + zone_name(&designation, offset) + ) +} + +fn locale_date(f: &Fields) -> String { + let year = if f.year <= 0 { 1 - f.year } else { f.year }; + format!("{}/{}/{}", f.month + 1, f.date, year) +} + +fn locale_time(f: &Fields) -> String { + let h = f.hours % 12; + format!( + "{}:{:02}:{:02} {}", + if h == 0 { 12 } else { h }, + f.minutes, + f.seconds, + if f.hours < 12 { "AM" } else { "PM" } + ) +} + +// ---------- parsing ---------- + +fn digits(b: &[u8], i: &mut usize, n: usize) -> Option { + if *i + n > b.len() || !b[*i..*i + n].iter().all(u8::is_ascii_digit) { + return None; + } + let v = std::str::from_utf8(&b[*i..*i + n]).ok()?.parse().ok()?; + *i += n; + Some(v) +} + +/// The ECMAScript date-time string format, as JavaScriptCore accepts it. +fn parse_iso(s: &str) -> Option { + let b = s.as_bytes(); + let mut i = 0; + let year = match b.first()? { + b'+' | b'-' => { + let neg = b[0] == b'-'; + i = 1; + let y = digits(b, &mut i, 6)?; + if neg && y == 0 { + return None; + } + if neg { -y } else { y } + } + _ => digits(b, &mut i, 4)?, + }; + let (mut month, mut dt) = (1, 1); + if i < b.len() && b[i] == b'-' { + i += 1; + month = digits(b, &mut i, 2)?; + if i < b.len() && b[i] == b'-' { + i += 1; + dt = digits(b, &mut i, 2)?; + } + } + if !(1..=12).contains(&month) || !(1..=31).contains(&dt) { + return None; + } + let (mut h, mut m, mut sec, mut ms) = (0, 0, 0, 0.0); + let mut offset: Option = None; + let mut has_time = false; + if i < b.len() && (b[i] == b'T' || b[i] == b't') { + has_time = true; + i += 1; + h = digits(b, &mut i, 2)?; + if b.get(i) != Some(&b':') { + return None; + } + i += 1; + m = digits(b, &mut i, 2)?; + if b.get(i) == Some(&b':') { + i += 1; + sec = digits(b, &mut i, 2)?; + if b.get(i) == Some(&b'.') { + i += 1; + let start = i; + while i < b.len() && b[i].is_ascii_digit() { + i += 1; + } + if i == start { + return None; + } + let frac = &s[start..(start + 3).min(i)]; + ms = format!("{frac:0<3}").parse::().ok()?; + } + } + if h > 24 || m > 59 || sec > 59 || (h == 24 && (m > 0 || sec > 0 || ms > 0.0)) { + return None; + } + match b.get(i) { + Some(b'Z') | Some(b'z') => { + offset = Some(0.0); + i += 1; + } + Some(b'+') | Some(b'-') => { + let sign = if b[i] == b'-' { -1.0 } else { 1.0 }; + i += 1; + let oh = digits(b, &mut i, 2)?; + if b.get(i) == Some(&b':') { + i += 1; + } + let om = digits(b, &mut i, 2)?; + if oh > 23 || om > 59 { + return None; + } + offset = Some(sign * (oh * 60 + om) as f64 * 60_000.0); + } + _ => {} + } + } else if i < b.len() && (b[i] == b'Z' || b[i] == b'z') { + offset = Some(0.0); + i += 1; + } + if i != b.len() { + return None; + } + let dayn = make_day(year as f64, (month - 1) as f64, dt as f64); + let t = make_date(dayn, make_time(h as f64, m as f64, sec as f64, ms)); + Some(match offset { + Some(o) => t - o, + None if has_time => utc(t), + None => t, + }) +} + +#[derive(Debug)] +enum Tok { + Num(i64, usize), + Word(String), + Sign(char), + Punct(char), +} + +fn tokens(s: &str) -> Option> { + let mut out = Vec::new(); + let mut chars = s.chars().peekable(); + let mut depth = 0; + while let Some(&c) = chars.peek() { + if depth > 0 { + chars.next(); + match c { + '(' => depth += 1, + ')' => depth -= 1, + _ => {} + } + continue; + } + if c == '(' { + depth = 1; + chars.next(); + } else if c.is_ascii_digit() { + let mut n = String::new(); + while let Some(&d) = chars.peek() { + if !d.is_ascii_digit() { + break; + } + n.push(d); + chars.next(); + } + out.push(Tok::Num(n.parse().unwrap_or(i64::MAX), n.len())); + } else if c.is_alphabetic() { + let mut w = String::new(); + while let Some(&d) = chars.peek() { + if !d.is_alphabetic() && d != '.' { + break; + } + if d != '.' { + w.push(d.to_ascii_lowercase()); + } + chars.next(); + } + out.push(Tok::Word(w)); + } else if c == '+' || c == '-' { + out.push(Tok::Sign(c)); + chars.next(); + } else if c.is_whitespace() || c == ',' { + chars.next(); + if c == ',' { + out.push(Tok::Punct(',')); + } + } else if c == ':' || c == '/' || c == '.' { + out.push(Tok::Punct(c)); + chars.next(); + } else { + return None; + } + } + Some(out) +} + +fn month_of(w: &str) -> Option { + if w.len() < 3 { + return None; + } + const NAMES: [&str; 12] = [ + "january", + "february", + "march", + "april", + "may", + "june", + "july", + "august", + "september", + "october", + "november", + "december", + ]; + NAMES + .iter() + .position(|n| n.starts_with(w)) + .map(|i| i as i64) +} + +fn weekday_word(w: &str) -> bool { + const NAMES: [&str; 7] = [ + "sunday", + "monday", + "tuesday", + "wednesday", + "thursday", + "friday", + "saturday", + ]; + w.len() >= 3 && NAMES.iter().any(|n| n.starts_with(w)) +} + +fn zone_word(w: &str) -> Option { + Some(match w { + "gmt" | "utc" | "ut" | "z" => 0, + "est" => -300, + "edt" => -240, + "cst" => -360, + "cdt" => -300, + "mst" => -420, + "mdt" => -360, + "pst" => -480, + "pdt" => -420, + _ => return None, + }) +} + +/// The fallback formats JavaScriptCore accepts: RFC 2822, `toString` output, `Month D, YYYY`, `M/D/YYYY` and +/// the like, in local time unless a zone is given. +fn parse_legacy(s: &str) -> Option { + let toks = tokens(s)?; + let (mut year, mut month, mut dt): (Option, Option, Option) = (None, None, None); + let (mut h, mut mi, mut sec, mut ms) = (None::, 0i64, 0i64, 0i64); + let mut pm: Option = None; + let mut offset: Option = None; + let mut nums: Vec<(i64, usize)> = Vec::new(); + let mut i = 0; + let num_at = |i: usize| match toks.get(i) { + Some(Tok::Num(n, l)) => Some((*n, *l)), + _ => None, + }; + let punct_at = |i: usize, c: char| matches!(toks.get(i), Some(Tok::Punct(p)) if *p == c); + while i < toks.len() { + match &toks[i] { + Tok::Word(w) => { + if let Some(m) = month_of(w) { + if month.is_some() { + return None; + } + month = Some(m); + } else if w == "am" || w == "pm" { + pm = Some(w == "pm"); + } else if let Some(z) = zone_word(w) { + offset = Some(z); + if let Some(Tok::Sign(sg)) = toks.get(i + 1) + && let Some((n, l)) = num_at(i + 2) + { + let mins = if l <= 2 { + n * 60 + } else { + n / 100 * 60 + n % 100 + }; + offset = Some(if *sg == '-' { -mins } else { mins }); + i += 2; + } + } else if !weekday_word(w) { + return None; + } + i += 1; + } + Tok::Num(n, l) => { + let (n, l) = (*n, *l); + if punct_at(i + 1, ':') && h.is_none() { + h = Some(n); + mi = num_at(i + 2)?.0; + i += 3; + if punct_at(i, ':') { + sec = num_at(i + 1)?.0; + i += 2; + if punct_at(i, '.') + && let Some((f, fl)) = num_at(i + 1) + { + ms = (f as f64 / 10f64.powi(fl as i32 - 3)).floor() as i64; + i += 2; + } + } + continue; + } + if punct_at(i + 1, '/') { + let (b2, _) = num_at(i + 2)?; + let c = if punct_at(i + 3, '/') { + let c = num_at(i + 4)?; + i += 5; + Some(c) + } else { + i += 3; + None + }; + if l >= 3 { + year = Some(n); + month = Some(b2 - 1); + dt = Some(c?.0); + } else { + month = Some(n - 1); + dt = Some(b2); + if let Some((c, cl)) = c { + year = Some(if cl <= 2 { + c + if c < 50 { 2000 } else { 1900 } + } else { + c + }); + } + } + continue; + } + if matches!(toks.get(i + 1), Some(Tok::Sign('-'))) + && let Some((b2, _)) = num_at(i + 2) + { + if matches!(toks.get(i + 3), Some(Tok::Sign('-'))) + && let Some((c, _)) = num_at(i + 4) + { + year = Some(n); + month = Some(b2 - 1); + dt = Some(c); + i += 5; + continue; + } + return None; + } + nums.push((n, l)); + i += 1; + } + Tok::Sign(sg) => { + let (n, l) = num_at(i + 1)?; + if h.is_some() && offset.is_none() || offset == Some(0) && l == 4 { + let mins = if l <= 2 { + n * 60 + } else { + n / 100 * 60 + n % 100 + }; + offset = Some(if *sg == '-' { -mins } else { mins }); + i += 2; + } else { + return None; + } + } + Tok::Punct(_) => i += 1, + } + } + if month.is_none() + && let Some((n, _)) = nums.first() + && (1..=12).contains(n) + { + month = Some(n - 1); + nums.remove(0); + } + for (n, l) in nums { + if month.is_some() && dt.is_none() && l <= 2 && n <= 31 { + dt = Some(n); + } else if year.is_none() { + year = Some(if l <= 2 { + n + if n < 50 { 2000 } else { 1900 } + } else { + n + }); + } else if dt.is_none() && n <= 31 { + dt = Some(n); + } else { + return None; + } + } + let month = month?; + let year = year.unwrap_or(2001); + let dt = dt.unwrap_or(1); + let mut hour = h.unwrap_or(0); + if let Some(pm) = pm { + if hour > 12 { + return None; + } + if hour == 12 { + hour = 0; + } + if pm { + hour += 12; + } + } + if !(0..=11).contains(&month) || !(1..=31).contains(&dt) || hour > 24 || mi > 59 || sec > 59 { + return None; + } + let dayn = make_day(year as f64, month as f64, dt as f64); + let t = make_date( + dayn, + make_time(hour as f64, mi as f64, sec as f64, ms as f64), + ); + Some(match offset { + Some(o) => t - o as f64 * 60_000.0, + None => utc(t), + }) +} + +pub fn parse(s: &str) -> f64 { + let t = parse_iso(s).or_else(|| parse_legacy(s.trim())); + time_clip(t.unwrap_or(f64::NAN)) +} + +// ---------- built-ins ---------- + +pub fn setup(vm: &mut Vm) { + let op = vm.realm.object_proto; + let proto = vm.plain(op); + vm.realm.std.date = proto; + let ctor = vm.ctor("Date", 7, date_ctor, proto, Value::Undef); + vm.methods( + ctor, + &[ + ("now", 0, date_now), + ("parse", 1, date_parse), + ("UTC", 7, date_utc), + ], + ); + vm.methods( + proto, + &[ + ("getTime", 0, get_time), + ("valueOf", 0, get_time), + ("toISOString", 0, to_iso_string), + ("toJSON", 1, to_json), + ("toString", 0, to_string), + ("toDateString", 0, to_date_string), + ("toTimeString", 0, to_time_string), + ("toUTCString", 0, to_utc_string), + ("toGMTString", 0, to_utc_string), + ("toLocaleString", 0, to_locale_string), + ("toLocaleDateString", 0, to_locale_date_string), + ("toLocaleTimeString", 0, to_locale_time_string), + ], + ); + for (i, name) in GETTERS.iter().enumerate() { + let f = vm.native_fn(name, 0, getter, Value::Num(i as f64)); + let k = vm.atoms.intern_static(name); + vm.define_hidden(proto, k, f); + } + vm.method(proto, "getTimezoneOffset", 0, get_timezone_offset); + for (i, (name, len)) in SETTERS.iter().enumerate() { + let f = vm.native_fn(name, *len, setter, Value::Num(i as f64)); + let k = vm.atoms.intern_static(name); + vm.define_hidden(proto, k, f); + } +} + +pub fn new_date(vm: &mut Vm, t: f64) -> Value { + super::ensure(vm, super::LAZY_DATE); + let proto = vm.realm.std.date; + Value::Obj(vm.alloc(Obj::new(Some(proto), Kind::Date(t)))) +} + +pub fn time_of(vm: &Vm, v: &Value) -> Option { + match v { + Value::Obj(id) => match vm.heap[*id as usize].kind { + Kind::Date(t) => Some(t), + _ => None, + }, + _ => None, + } +} + +fn this_date(vm: &mut Vm, this: &Value, name: &str) -> Result<(Id, f64), Value> { + if let Value::Obj(id) = this + && let Kind::Date(t) = vm.heap[*id as usize].kind + { + return Ok((*id, t)); + } + Err(super::incompatible( + vm, + &format!("Date.prototype.{name}"), + this, + )) +} + +/// The reference's `toNumbers` over at most seven components: one list of conversions, each made a number in turn. +fn numbers(vm: &mut Vm, c: &mut Conversions, args: &[Value]) -> Result, Value> { + let args = c.converted(vm, &[Hint::Number], &args[..args.len().min(7)], true)?; + let mut out = Vec::with_capacity(args.len()); + for a in args.iter() { + out.push(vm.number_of(a)?); + } + Ok(out) +} + +/// Year, month and the rest as `new Date(...)` and `Date.UTC` read them; two-digit years are 19xx. +fn from_components(n: &[f64]) -> f64 { + let get = |i: usize, d: f64| n.get(i).copied().unwrap_or(d); + let mut y = get(0, f64::NAN); + if !y.is_nan() { + let yi = integer(y); + if (0.0..=99.0).contains(&yi) { + y = 1900.0 + yi; + } + } + let dayn = make_day(y, get(1, 0.0), get(2, 1.0)); + make_date( + dayn, + make_time(get(3, 0.0), get(4, 0.0), get(5, 0.0), get(6, 0.0)), + ) +} + +fn date_ctor(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + if !matches!(this, Value::Uninit) { + let s = iso_string(now()); + return Ok(vm.string_val(s)); + } + let mut c = Conversions::default(); + let t = match args.len() { + 0 => now(), + 1 => { + if let Some(t) = time_of(vm, &args[0]) { + t + } else { + let mut p = [args[0]]; + c.convert(vm, &[Hint::Default], &mut p, false)?; + match p[0] { + Value::Str(s) => parse(vm.text(s)), + v => time_clip(vm.number_of(&v)?), + } + } + } + _ => { + let n = numbers(vm, &mut c, args)?; + time_clip(utc(from_components(&n))) + } + }; + let r = Ok(new_date(vm, t)); + c.finish(vm, r) +} + +fn date_now(_vm: &mut Vm, _this: Value, _args: &[Value], _: Id) -> Res { + Ok(Value::Num(now())) +} + +fn date_parse(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let s = vm.string_of(&arg(args, 0))?; + Ok(Value::Num(parse(vm.text(s)))) +} + +fn date_utc(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let mut c = Conversions::default(); + let n = numbers(vm, &mut c, args)?; + c.finish(vm, Ok(Value::Num(time_clip(from_components(&n))))) +} + +fn get_time(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + Ok(Value::Num(this_date(vm, &this, "getTime")?.1)) +} + +fn to_iso_string(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let t = this_date(vm, &this, "toISOString")?.1; + if !t.is_finite() { + return Err(vm.range_error("Invalid time value.")); + } + let s = iso_string(t); + Ok(vm.string_val(s)) +} + +fn to_json(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let t = this_date(vm, &this, "toJSON")?.1; + if !t.is_finite() { + return Ok(Value::Null); + } + let s = iso_string(t); + Ok(vm.string_val(s)) +} + +fn format_with(vm: &mut Vm, this: &Value, name: &str, f: fn(f64) -> String) -> Res { + let t = this_date(vm, this, name)?.1; + let s = if t.is_finite() { + f(t) + } else { + "Invalid Date".into() + }; + Ok(vm.string_val(s)) +} + +fn to_string(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + format_with(vm, &this, "toString", iso_string) +} + +fn to_date_string(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + format_with(vm, &this, "toDateString", date_string) +} + +fn to_time_string(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + format_with(vm, &this, "toTimeString", time_string) +} + +fn to_utc_string(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + format_with(vm, &this, "toUTCString", utc_string) +} + +fn to_locale_string(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + format_with(vm, &this, "toLocaleString", |t| { + let f = fields(t); + format!("{}, {}", locale_date(&f), locale_time(&f)) + }) +} + +fn to_locale_date_string(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + format_with(vm, &this, "toLocaleDateString", |t| locale_date(&fields(t))) +} + +fn to_locale_time_string(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + format_with(vm, &this, "toLocaleTimeString", |t| locale_time(&fields(t))) +} + +fn get_timezone_offset(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let t = this_date(vm, &this, "getTimezoneOffset")?.1; + if !t.is_finite() { + return Ok(Value::Num(f64::NAN)); + } + Ok(Value::Num((t - local_time(t)) / 60_000.0 + 0.0)) +} + +const GETTERS: [&str; 16] = [ + "getFullYear", + "getMonth", + "getDate", + "getDay", + "getHours", + "getMinutes", + "getSeconds", + "getMilliseconds", + "getUTCFullYear", + "getUTCMonth", + "getUTCDate", + "getUTCDay", + "getUTCHours", + "getUTCMinutes", + "getUTCSeconds", + "getUTCMilliseconds", +]; + +fn getter(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + let which = match vm.native_data(callee) { + Value::Num(n) => n as usize, + _ => 0, + }; + let (_, t) = this_date(vm, &this, GETTERS[which])?; + if !t.is_finite() { + return Ok(Value::Num(f64::NAN)); + } + let local = which < 8; + let f = fields(if local { local_time(t) } else { t }); + Ok(Value::Num(match which % 8 { + 0 => f.year, + 1 => f.month, + 2 => f.date, + 3 => f.weekday, + 4 => f.hours, + 5 => f.minutes, + 6 => f.seconds, + _ => f.ms, + } as f64)) +} + +const SETTERS: [(&str, u8); 15] = [ + ("setTime", 1), + ("setMilliseconds", 1), + ("setUTCMilliseconds", 1), + ("setSeconds", 2), + ("setUTCSeconds", 2), + ("setMinutes", 3), + ("setUTCMinutes", 3), + ("setHours", 4), + ("setUTCHours", 4), + ("setDate", 1), + ("setUTCDate", 1), + ("setMonth", 2), + ("setUTCMonth", 2), + ("setFullYear", 3), + ("setUTCFullYear", 3), +]; + +fn setter(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let mut c = Conversions::default(); + let r = set(vm, &mut c, this, args, callee); + c.finish(vm, r) +} + +/// A setter after the receiver's check: its time, then the arguments it reads, are one list of conversions, each +/// made a number in turn. +fn set(vm: &mut Vm, c: &mut Conversions, this: Value, args: &[Value], callee: Id) -> Res { + let which = match vm.native_data(callee) { + Value::Num(n) => n as usize, + _ => 0, + }; + let (name, len) = SETTERS[which]; + let (id, time) = this_date(vm, &this, name)?; + let given = &args[..args.len().min(len as usize)]; + let mut listed = Vec::with_capacity(given.len() + 1); + listed.push(Value::Num(time)); + listed.extend_from_slice(given); + c.convert(vm, &[Hint::Number], &mut listed, true)?; + // The time as the list kept it: read before the conversions, which a rerun after them must not read again. + let time = listed[0].as_num(); + let mut v = Vec::with_capacity(given.len()); + for a in &listed[1..] { + v.push(vm.number_of(a)?); + } + let full_year = which >= 13; + if which != 0 && !full_year && time.is_nan() { + return Ok(Value::Num(f64::NAN)); + } + let local = which != 0 && (which % 2 == 1); + let arg = |i: usize| v.get(i).copied(); + let new = if which == 0 { + time_clip(arg(0).unwrap_or(f64::NAN)) + } else { + let t = if time.is_nan() { + 0.0 + } else if local { + local_time(time) + } else { + time + }; + let f = fields(t); + let (h, m, s, ms) = ( + f.hours as f64, + f.minutes as f64, + f.seconds as f64, + f.ms as f64, + ); + let d = day(t); + let (y, mo, dt) = (f.year as f64, f.month as f64, f.date as f64); + let first = arg(0).unwrap_or(f64::NAN); + let date = match which { + 1 | 2 => make_date(d, make_time(h, m, s, first)), + 3 | 4 => make_date(d, make_time(h, m, first, arg(1).unwrap_or(ms))), + 5 | 6 => make_date( + d, + make_time(h, first, arg(1).unwrap_or(s), arg(2).unwrap_or(ms)), + ), + 7 | 8 => make_date( + d, + make_time( + first, + arg(1).unwrap_or(m), + arg(2).unwrap_or(s), + arg(3).unwrap_or(ms), + ), + ), + 9 | 10 => make_date(make_day(y, mo, first), time_within_day(t)), + 11 | 12 => make_date(make_day(y, first, arg(1).unwrap_or(dt)), time_within_day(t)), + _ => make_date( + make_day(first, arg(1).unwrap_or(mo), arg(2).unwrap_or(dt)), + time_within_day(t), + ), + }; + time_clip(if local { utc(date) } else { date }) + }; + vm.heap[id as usize].kind = Kind::Date(new); + Ok(Value::Num(new)) +} diff --git a/packages/codemode-rust/crates/psychoscript/src/builtins/exotic.rs b/packages/codemode-rust/crates/psychoscript/src/builtins/exotic.rs new file mode 100644 index 0000000000000..533f2f32d02d1 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/builtins/exotic.rs @@ -0,0 +1,143 @@ +//! Behaviour of standard-library kinds that the generic object model reaches through small hooks: accessor +//! properties, indexed elements, console and JSON forms. + +use super::{bytes, regexp, web}; +use crate::object::*; +use crate::value::{Id, Value}; +use crate::vm::{Res, Vm}; + +/// Whether `kind` has properties the hooks below provide. +#[inline] +pub fn is_exotic(kind: &Kind) -> bool { + matches!( + kind, + Kind::RegExp(_) + | Kind::Bytes(_) + | Kind::TextDecoder(_) + | Kind::Url(_) + | Kind::SearchParams(_) + | Kind::Map(_) + | Kind::Set(_) + ) +} + +/// An own accessor or element of an exotic object, if `key` names one. Out of line, so every property read does +/// not set up what the RegExp accessors need. +#[inline(never)] +pub fn get(vm: &mut Vm, id: Id, key: Atom) -> Option { + match &vm.heap[id as usize].kind { + Kind::RegExp(_) => regexp::get_prop(vm, id, key), + Kind::Bytes(_) => bytes::get_prop(vm, id, key), + Kind::TextDecoder(_) => bytes::decoder_prop(vm, id, key), + Kind::Url(_) => web::url_get(vm, id, key), + Kind::SearchParams(_) if key == vm.names.size => { + Some(Value::Num(web::params_size(vm, id) as f64)) + } + _ => None, + } +} + +/// Writes an accessor or element; `None` when `key` is an ordinary property. +pub fn set(vm: &mut Vm, id: Id, key: Atom, val: Value) -> Option> { + match &vm.heap[id as usize].kind { + Kind::RegExp(_) => regexp::set_prop(vm, id, key, val), + Kind::Bytes(_) => bytes::set_prop(vm, id, key, val), + Kind::Url(_) => web::url_set(vm, id, key, val), + Kind::SearchParams(_) | Kind::Map(_) | Kind::Set(_) if key == vm.names.size => { + Some(Err(vm.only_getter(&Value::Obj(id), key))) + } + Kind::TextDecoder(_) + if matches!(vm.atoms.text(key), "encoding" | "fatal" | "ignoreBOM") => + { + Some(Err(vm.only_getter(&Value::Obj(id), key))) + } + _ => None, + } +} + +/// Whether `key` is an own element of an exotic object. +pub fn has_own(vm: &Vm, id: Id, key: Atom) -> bool { + match &vm.heap[id as usize].kind { + Kind::Bytes(_) => bytes::has_own(vm, id, key), + _ => false, + } +} + +/// Deletes an element; `None` when `key` is an ordinary property. +pub fn delete(vm: &mut Vm, id: Id, key: Atom) -> Option> { + match &vm.heap[id as usize].kind { + Kind::Bytes(_) if bytes::has_own(vm, id, key) => { + let k = vm.atoms.text(key).to_owned(); + Some(Err(vm.type_error(&format!("Cannot delete property '{k}'.")))) + } + _ => None, + } +} + +/// The number of indexed own elements, listed before ordinary keys. +pub fn index_len(vm: &Vm, id: Id) -> usize { + match &vm.heap[id as usize].kind { + Kind::Bytes(_) => bytes::index_len(vm, id), + _ => 0, + } +} + +/// Whether the default ToPrimitive hint reads as a string, as for Dates. +pub fn prefers_string(vm: &Vm, id: Id) -> bool { + matches!(vm.heap[id as usize].kind, Kind::Date(_)) +} + +/// The console form of an exotic object. +pub fn inspect(vm: &mut Vm, id: Id) -> Option { + match &vm.heap[id as usize].kind { + Kind::RegExp(_) => Some(regexp::inspect(vm, id)), + Kind::Date(t) => Some(super::date::display(*t)), + Kind::Bytes(_) => Some(bytes::inspect(vm, id)), + Kind::WeakMap(_) => Some("WeakMap { }".into()), + Kind::Url(_) => Some(web::url_href(vm, id)), + Kind::SearchParams(_) => Some(web::params_text(vm, id)), + Kind::Headers(_) => Some(web::headers_inspect(vm, id)), + Kind::WeakSet(_) => Some("WeakSet { }".into()), + _ => None, + } +} + +/// Whether this run may hold a value with its own JSON form: only once the byte or web groups are installed. +#[inline(always)] +pub fn may_have_json_forms(vm: &Vm) -> bool { + vm.realm.std.loaded & (super::LAZY_BYTES | super::LAZY_WEB) != 0 +} + +/// Whether a kind serializes through `json_value` rather than as its own keys. +#[inline] +pub fn has_json_form(kind: &Kind) -> bool { + matches!( + kind, + Kind::Bytes(_) | Kind::Headers(_) | Kind::SearchParams(_) + ) +} + +/// The value a JSON walk serializes in place of an exotic object, after `toJSON`. `boundary` is the host boundary. +/// Inlined so the walk pays only a kind test for the values that are not exotic. +#[inline(always)] +pub fn json_value(vm: &mut Vm, v: &Value, boundary: bool) -> Res { + if let Value::Obj(id) = v + && has_json_form(&vm.heap[*id as usize].kind) + { + return json_special(vm, *id, v, boundary); + } + Ok(*v) +} + +#[inline(never)] +fn json_special(vm: &mut Vm, id: Id, v: &Value, boundary: bool) -> Res { + match &vm.heap[id as usize].kind { + Kind::Bytes(_) => bytes::json_value(vm, id, boundary), + Kind::Headers(_) => Ok(web::headers_object(vm, id)), + Kind::SearchParams(_) if boundary => { + let s = web::params_text(vm, id); + Ok(vm.string_val(s)) + } + _ => Ok(*v), + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/builtins/fuel.rs b/packages/codemode-rust/crates/psychoscript/src/builtins/fuel.rs new file mode 100644 index 0000000000000..2a93a4ec76c6d --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/builtins/fuel.rs @@ -0,0 +1,197 @@ +//! The fuel the reference spends on the built-ins it writes in the language itself, its bytecode prelude +//! (`packages/codemode/src/prelude/source.ts`), so a busy loop built on them starts queued host calls at the same +//! step (see `HANDOVER_FUEL` in `vm.rs`). +//! +//! The reference's interpreter spends one unit on a call into a bytecode function and on a loop back-edge, and fifty on +//! a call of a native, the prelude's `$` helpers included; its `VmIntrinsic`s (`$IsArray`, `$Call`) are free, and +//! `$Call` is lowered to a plain call of the callback. Each built-in below spends what its prelude function's bytecode +//! does, in the same order, for every check point counts: the reference refills its fuel where it runs out, so the +//! order of the charges matters, not only their sum. Callbacks are called with `Vm::call_counted`, as bytecode calls +//! them; a closure's frame costs its one unit on entry. +//! +//! A prelude function installed as the method itself (`Array.prototype.forEach`) is entered with one unit instead of +//! a native call's fifty, so such a built-in ends with `Vm::bytecode_builtin`. A native that hands its work on to +//! the prelude (`Array.from`, `sort` with a comparator) spends its own fifty first, then the prelude function's unit. + +use std::borrow::Cow; + +use crate::bytecode::ITER_FOR_OF; +use crate::ops::Hint; +use crate::value::Value; +use crate::vm::{Res, Vm}; + +/// A call into a bytecode function. +pub const FN: i32 = 1; +/// A call of a native, a `$` helper included. +pub const NATIVE: i32 = 50; + +/// Entering `Array$prototype$forEach` (and `map`, `filter`, `some`, `every`, the find methods, `reduce` and +/// `reduceRight`), up to its `$Receiver` check. +pub fn method(vm: &mut Vm) { + vm.fuel(FN); +} + +/// The `$Receiver` check passed, and the shared item loop (`forEachItem`, `mapItems`, ...) entered, up to its +/// `$Callback` check. +pub fn receiver_then_loop(vm: &mut Vm) { + vm.fuel(NATIVE); + vm.fuel(FN); +} + +/// A `$` helper's call returned: `$Callback`, `$Receiver`, `$Table`, `String`. +pub fn native(vm: &mut Vm) { + vm.fuel(NATIVE); +} + +/// One loop iteration ended at its back-edge. +#[inline] +pub fn step(vm: &mut Vm) { + vm.fuel_step(); +} + +/// A native built-in (`Array.from`, `sort`) handing its work on to a prelude function: its own call, then the +/// prelude function's entry. +pub fn handoff(vm: &mut Vm) { + vm.fuel(NATIVE); + vm.fuel(FN); +} + +/// The reference's `withPrimitives`: a built-in lists the values it needs as primitives, and once a list holds an +/// object it returns, the reference converts the list in its internal bytecode (`$vmConvert`), then runs the +/// built-in again on the primitives. A call from bytecode has spent the built-in's fifty by then, so it is spent before +/// the first conversion and the call costs nothing more; a later list costs that loop's back-edge. Each listed value, +/// a primitive too, costs a back-edge after its ToPrimitive (`Vm::primitive_of`, which spends that call's fuel). A +/// list of primitives costs nothing. One per built-in call, ended with `finish`. +#[derive(Default)] +pub struct Conversions { + requested: bool, + paid: bool, +} + +impl Conversions { + /// Converts `values` in place, in order, the value at `i` with `hints[i]` (the last hint for those past the end; + /// every built-in names at least one). With `coerce`, each is also made a number or a string by its hint before + /// the next converts. + pub fn convert( + &mut self, + vm: &mut Vm, + hints: &[Hint], + values: &mut [Value], + coerce: bool, + ) -> Result<(), Value> { + if !values.iter().any(|v| vm.is_convertible_obj(v)) { + return Ok(()); + } + if self.requested { + step(vm); + } else { + self.requested = true; + if vm.host.meter.counted { + vm.fuel(NATIVE); + self.paid = true; + } + } + // A list holding an object whose conversion calls the program is converted in a convert frame, and the + // built-in run again with it (see `conversion.rs`). + if let Some(r) = vm.restartable_list(hints, values, coerce) { + let list = r?; + for (v, c) in values.iter_mut().zip(list) { + *v = c; + } + return Ok(()); + } + for (i, v) in values.iter_mut().enumerate() { + let hint = hints[i.min(hints.len() - 1)]; + *v = vm.primitive_of(v, hint)?; + if coerce { + *v = match hint { + Hint::String => Value::Str(vm.string_of(v)?), + _ => Value::Num(vm.number_of(v)?), + }; + } + step(vm); + } + Ok(()) + } + + /// `values` as `convert` leaves them, copied only when one is an object. + pub fn converted<'a>( + &mut self, + vm: &mut Vm, + hints: &[Hint], + values: &'a [Value], + coerce: bool, + ) -> Result, Value> { + if !values.iter().any(|v| vm.is_convertible_obj(v)) { + return Ok(Cow::Borrowed(values)); + } + let mut owned = values.to_vec(); + self.convert(vm, hints, &mut owned, coerce)?; + Ok(Cow::Owned(owned)) + } + + /// The built-in's own fifty where a built-in handing its work on spends it, unless its conversions spent it. + pub fn call(&self, vm: &mut Vm) { + if !self.paid { + vm.fuel(NATIVE); + } + } + + /// A native handing its work on to a prelude function after its conversions (see `handoff`). + pub fn handoff(&self, vm: &mut Vm) { + self.call(vm); + vm.fuel(FN); + } + + /// Ends the built-in with `r`: once it spent its call's fifty, the call costs nothing more. + pub fn finish(&self, vm: &mut Vm, r: Result) -> Result { + if self.paid && r.is_ok() { + vm.bytecode_builtin(); + } + r + } +} + +/// A built-in whose `values` are its one list of conversions (see `Conversions`): `body` runs on the primitives. +pub fn with_primitives( + vm: &mut Vm, + hints: &[Hint], + mut values: [Value; N], + coerce: bool, + body: impl FnOnce(&mut Vm, [Value; N]) -> Res, +) -> Res { + let mut c = Conversions::default(); + c.convert(vm, hints, &mut values, coerce)?; + let r = body(vm, values); + c.finish(vm, r) +} + +/// `with_primitives` over a list of any length. +pub fn with_primitive_list( + vm: &mut Vm, + hints: &[Hint], + values: &[Value], + coerce: bool, + body: impl FnOnce(&mut Vm, &[Value]) -> Res, +) -> Res { + let mut c = Conversions::default(); + let values = c.converted(vm, hints, values, coerce)?; + let r = body(vm, &values); + c.finish(vm, r) +} + +/// A prelude `for...of` over `source` that collects its values: opened as the reference opens it (free for a value it +/// walks itself, else a call of its `Symbol.iterator` method), and a back-edge spent after each value. Nothing runs +/// between the steps, so the loop never leaves early and closes nothing. +pub fn for_of(vm: &mut Vm, source: &Value) -> Result, Value> { + let open = vm.open_fuel(source, ITER_FOR_OF); + let it = vm.get_iterator(source)?; + vm.fuel(open); + let next = vm.record_next_of(source, &it)?; + let mut values = Vec::new(); + while let Some(x) = vm.iter_step_with(&it, next)? { + values.push(x); + step(vm); + } + Ok(values) +} diff --git a/packages/codemode-rust/crates/psychoscript/src/builtins/iterator.rs b/packages/codemode-rust/crates/psychoscript/src/builtins/iterator.rs new file mode 100644 index 0000000000000..4430645f6fa90 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/builtins/iterator.rs @@ -0,0 +1,1213 @@ +//! Live iterators over standard-library collections, and the shared iterator prototype's `next`. + +use super::{arg, fuel}; +use crate::native::{ + FOR_OF_SLOTS, Flow, ForOf, Frame, Input, NativeOp, Step, THREW, enter_for_of_record, +}; +use crate::object::*; +use crate::value::{Id, Slot, Value}; +use crate::vm::{Handler, Res, Vm}; + +pub fn setup(vm: &mut Vm) { + let ip = vm.realm.iter_proto; + vm.method(ip, "next", 0, iter_next); +} + +/// A live iterator over the elements of `target`. +pub fn exotic_iter(vm: &mut Vm, target: Id, kind: IterKind) -> Value { + let proto = vm.realm.iter_proto; + Value::Obj(vm.alloc(Obj::new( + Some(proto), + Kind::ExoticIter { + target, + pos: 0, + kind, + }, + ))) +} + +fn exotic_step(vm: &mut Vm, id: Id) -> Option { + let Kind::ExoticIter { target, pos, kind } = vm.heap[id as usize].kind else { + return None; + }; + let v = match &vm.heap[target as usize].kind { + Kind::Bytes(_) => super::bytes::iter_step(vm, target, pos as usize, kind), + Kind::SearchParams(_) | Kind::Headers(_) => { + super::web::iter_step(vm, target, pos as usize, kind) + } + _ => None, + }; + if let Kind::ExoticIter { pos, .. } = &mut vm.heap[id as usize].kind { + *pos = if v.is_some() { *pos + 1 } else { u32::MAX }; + } + v +} + +fn iter_next(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let r = match this { + Value::Obj(id) if matches!(vm.heap[id as usize].kind, Kind::ExoticIter { .. }) => { + exotic_step(vm, id) + } + Value::Obj(id) + if matches!( + vm.heap[id as usize].kind, + Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } + ) => + { + vm.iter_step(&this)? + } + _ => return Err(super::incompatible(vm, "Iterator.prototype.next", &this)), + }; + Ok(match r { + Some(v) => vm.iter_result(v, false), + None => vm.iter_result(Value::Undef, true), + }) +} + +// ---------- Iterator and its helpers ---------- + +pub enum HelperOp { + Wrap, + Map(Value), + Filter(Value), + Take(f64), + Drop(f64), + FlatMap(Value, Option<(Value, Value)>), +} + +#[derive(Clone, Copy, PartialEq)] +pub(crate) enum HelperState { + Start, + Suspended, + Running, + Done, +} + +/// An iterator helper: a lazy step over an iterator record, as the reference's prelude generators behave. +pub struct Helper { + pub(crate) iter: Value, + pub(crate) next: Value, + pub(crate) op: HelperOp, + pub(crate) counter: f64, + pub(crate) state: HelperState, + /// The name of the call that made the helper (`Iterator.from`), as a string, or undefined; the reference names it + /// when the iterator's `next` turns out not to be a function. + pub(crate) site: Value, +} + +pub fn setup_helpers(vm: &mut Vm) { + let ip = vm.realm.iter_proto; + vm.ctor("Iterator", 0, iterator_ctor, ip, Value::Undef); + let k = vm.names.constructor; + if let Value::Obj(c) = vm.get_obj(ip, k) { + vm.method(c, "from", 1, iterator_from); + } + vm.methods( + ip, + &[ + ("map", 1, it_map), + ("filter", 1, it_filter), + ("take", 1, it_take), + ("drop", 1, it_drop), + ("flatMap", 1, it_flat_map), + ("toArray", 0, it_to_array), + ("reduce", 1, it_reduce), + ("forEach", 1, it_for_each), + ("some", 1, it_some), + ("every", 1, it_every), + ("find", 1, it_find), + ], + ); + let hp = vm.plain(ip); + vm.realm.std.iterator_helper = hp; + vm.methods( + hp, + &[("next", 0, helper_next), ("return", 0, helper_return)], + ); +} + +fn iterator_ctor(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + if matches!(this, Value::Uninit) { + return Err( + vm.type_error("Iterator is abstract; use Iterator.from(...) or a built-in iterator.") + ); + } + Err(vm.type_error("Constructor Iterator requires 'new'.")) +} + +/// GetIteratorDirect: the iterator and its `next`, read once; the reference's `$Direct` helper. +fn direct(vm: &mut Vm, v: &Value) -> Result<(Value, Value), Value> { + let Value::Obj(id) = v else { + return Err(vm.type_error("An iterator must be an object.")); + }; + let nk = vm.names.next; + let next = vm.get_calling(*id, nk)?; + fuel::native(vm); + Ok((*v, next)) +} + +/// Whether the reference steps `iter` without calling its `next`: a built-in iterator, a generator or a helper. +fn stepped_directly(vm: &Vm, iter: &Value) -> bool { + matches!(iter, Value::Obj(id) if matches!( + vm.heap[*id as usize].kind, + Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } + | Kind::ExoticIter { .. } + | Kind::Generator(_) + | Kind::IterHelper(_) + )) +} + +/// The prelude's `flattenable` up to its call: `$IsObject` for a value that is not a string, `$Describe` when it +/// fails, then the value's `[Symbol.iterator]` method, which the caller calls (when it is not nullish) and opens with +/// `direct`. +fn flattenable(vm: &mut Vm, v: &Value, strings: bool, name: &str) -> Result { + fuel::method(vm); + let ok = match v { + Value::Str(_) => strings, + Value::Obj(id) if !vm.is_namespace(*id) => { + fuel::native(vm); + true + } + _ => { + fuel::native(vm); + false + } + }; + if !ok { + let d = super::describe_value(vm, v); + fuel::native(vm); + return Err(vm.type_error(&format!( + "{name} expects an iterable or iterator, received {d}." + ))); + } + vm.get_calling_value(v, SYM_ITERATOR) +} + +/// The error of a call of a value that is not callable, naming `site` (a helper's kept name or the running call's), as +/// the reference names the call its prelude makes. +fn not_callable(vm: &mut Vm, site: Value) -> Value { + let name = match site { + Value::Str(s) => vm.text(s).to_owned(), + _ => "The called value".to_owned(), + }; + vm.type_error(&format!("{name} is not a function.")) +} + +/// A helper made: its prelude generator called, `prime` entered, and its first `next` run to the first `yield`. +fn primed(vm: &mut Vm, iter: Value, next: Value, op: HelperOp) -> Value { + fuel::method(vm); + fuel::method(vm); + fuel::native(vm); + let h = new_helper(vm, iter, next, op); + vm.bytecode_builtin(); + h +} + +fn new_helper(vm: &mut Vm, iter: Value, next: Value, op: HelperOp) -> Value { + let proto = vm.realm.std.iterator_helper; + let site = match vm.call_site().map(str::to_owned) { + Some(name) => vm.string_val(name), + None => Value::Undef, + }; + let h = Helper { + iter, + next, + op, + counter: 0.0, + state: HelperState::Start, + site, + }; + Value::Obj(vm.alloc(Obj::new(Some(proto), Kind::IterHelper(Box::new(h))))) +} + +fn inherits_iterator(vm: &Vm, v: &Value) -> bool { + let &Value::Obj(mut cur) = v else { + return false; + }; + let ip = vm.realm.iter_proto; + while let Some(p) = vm.heap[cur as usize].proto { + if p == ip { + return true; + } + cur = p; + } + false +} + +fn iterator_from(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + // The prelude's `Iterator$from`: `$IsObject`, and for an object `$Inherits`. + fuel::method(vm); + let v = arg(args, 0); + fuel::native(vm); + if matches!(v, Value::Obj(_)) { + fuel::native(vm); + } + if inherits_iterator(vm, &v) { + vm.bytecode_builtin(); + return Ok(v); + } + let method = flattenable(vm, &v, true, "Iterator.from")?; + if method.is_nullish() { + let (iter, next) = direct(vm, &v)?; + return Ok(primed(vm, iter, next, HelperOp::Wrap)); + } + if !vm.is_callable(&method) { + let site = match vm.call_site().map(str::to_owned) { + Some(name) => vm.string_val(name), + None => Value::Undef, + }; + return Err(not_callable(vm, site)); + } + vm.enter_native_sub( + NativeOp::Iterators, + FROM, + callee, + Value::Undef, + &[v, method], + ) +} + +fn callback_helper( + vm: &mut Vm, + this: &Value, + args: &[Value], + name: &str, + make: fn(Value) -> HelperOp, +) -> Res { + fuel::method(vm); + let (iter, next) = direct(vm, this)?; + let f = super::require_callback(vm, &arg(args, 0), &format!("Iterator.prototype.{name}"))?; + fuel::native(vm); + Ok(primed(vm, iter, next, make(f))) +} + +fn it_map(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + callback_helper(vm, &this, args, "map", HelperOp::Map) +} + +fn it_filter(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + callback_helper(vm, &this, args, "filter", HelperOp::Filter) +} + +fn it_flat_map(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + callback_helper(vm, &this, args, "flatMap", |f| HelperOp::FlatMap(f, None)) +} + +fn count(vm: &mut Vm, v: &Value, name: &str) -> Result { + let n = vm.number_of(v)?; + let i = if n.is_infinite() { n } else { n.trunc() }; + if n.is_nan() || i < 0.0 { + return Err(vm.range_error(&format!( + "Iterator.prototype.{name} expects a non-negative count, received {}.", + crate::value::num_to_string(n) + ))); + } + Ok(i) +} + +fn it_take(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + fuel::method(vm); + let (iter, next) = direct(vm, &this)?; + fuel::method(vm); + let n = count(vm, &arg(args, 0), "take")?; + Ok(primed(vm, iter, next, HelperOp::Take(n))) +} + +fn it_drop(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + fuel::method(vm); + let (iter, next) = direct(vm, &this)?; + fuel::method(vm); + let n = count(vm, &arg(args, 0), "drop")?; + Ok(primed(vm, iter, next, HelperOp::Drop(n))) +} + +fn helper_mut(vm: &mut Vm, id: Id) -> &mut Helper { + match &mut vm.heap[id as usize].kind { + Kind::IterHelper(h) => h, + _ => unreachable!("checked by this_helper"), + } +} + +fn this_helper(vm: &mut Vm, this: &Value, name: &str) -> Result { + if let Value::Obj(id) = this + && matches!(vm.heap[*id as usize].kind, Kind::IterHelper(_)) + { + return Ok(*id); + } + Err(super::incompatible( + vm, + &format!("%IteratorHelper%.{name}"), + this, + )) +} + +fn helper_next(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + let id = this_helper(vm, &this, "next")?; + let state = helper_mut(vm, id).state; + match state { + HelperState::Done => return Ok(vm.iter_result(Value::Undef, true)), + HelperState::Running => return Err(vm.type_error("Iterator helper is already running.")), + _ => {} + } + let resumed = state == HelperState::Suspended; + if let Some(r) = next_direct(vm, id, resumed) { + return r; + } + helper_mut(vm, id).state = HelperState::Running; + enter_helper(vm, callee, id, START, resumed, Value::Undef) +} + +/// `next()` of a helper whose step calls nothing of the program's: `Iterator.from`, `take` with values left or `drop`, +/// over a built-in iterator stepped by its native `next`. It runs the frame's loop at once, without a frame; `None` +/// for any other helper. +fn next_direct(vm: &mut Vm, id: Id, resumed: bool) -> Option { + let h = helper_mut(vm, id); + let (iter, next) = (h.iter, h.next); + match h.op { + HelperOp::Wrap | HelperOp::Drop(_) => {} + HelperOp::Take(n) if n > 0.0 => {} + _ => return None, + } + if !native_step(vm, &iter, &next) { + return None; + } + let mut back = resumed; + loop { + if std::mem::take(&mut back) { + fuel::step(vm); + } + let r = vm.call(&next, iter, &[]).and_then(|r| result_of(vm, r)); + let item = match r { + Ok(Some(item)) => item, + Ok(None) => { + helper_mut(vm, id).state = HelperState::Done; + return Some(Ok(vm.iter_result(Value::Undef, true))); + } + Err(e) => { + helper_mut(vm, id).state = HelperState::Done; + return Some(Err(e)); + } + }; + let h = helper_mut(vm, id); + match &mut h.op { + HelperOp::Drop(n) if *n > 0.0 => { + *n -= 1.0; + back = true; + continue; + } + HelperOp::Take(n) => *n -= 1.0, + _ => {} + } + h.state = HelperState::Suspended; + return Some(Ok(vm.iter_result(item, false))); + } +} + +/// Whether `iter` is a built-in iterator whose record steps it by a native `next`, which calls nothing of the +/// program's. +fn native_step(vm: &Vm, iter: &Value, next: &Value) -> bool { + matches!(iter, Value::Obj(id) if matches!( + vm.heap[*id as usize].kind, + Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } + | Kind::ExoticIter { .. } + )) && matches!(next, Value::Obj(n) if matches!(vm.heap[*n as usize].kind, Kind::Native { .. })) +} + +fn helper_return(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + let id = this_helper(vm, &this, "return")?; + let h = helper_mut(vm, id); + match h.state { + HelperState::Done => return Ok(vm.iter_result(Value::Undef, true)), + HelperState::Running => return Err(vm.type_error("Iterator helper is already running.")), + _ => {} + } + // Before its first value the prelude generator's `finally` closes the source with `closeIterator`; at a `yield` + // its loops close their iterator records, the inner one of `flatMap` first. + let started = h.state == HelperState::Suspended; + h.state = HelperState::Done; + let inner = match &mut h.op { + HelperOp::FlatMap(_, slot) => slot.take(), + _ => None, + }; + let (phase, inner) = match inner { + _ if !started => (CLOSE_SOURCE, Value::Undef), + Some((inner, _)) => (CLOSE_INNER, inner), + None => (CLOSE_RECORD, Value::Undef), + }; + enter_helper(vm, callee, id, phase, false, inner) +} + +// A helper's `next()` and `return()` run in a native frame of the sub-op `HELPER` on the helper (its `this`), which +// holds what lasts between calls (the source record, the op, the counter, `flatMap`'s inner record, the state); the +// frame's slots hold one call's progress: where it is, the item a callback decides on (or the inner record `return()` +// closes), whether the prelude generator's loop owes a back-edge, and while closing, the error to throw, the close's +// fuel (or for `closeIterator` whether `return` is native) and whether a close failed. +const HELPER: u16 = 0; +/// `Iterator.from` calling an iterable's `[Symbol.iterator]`: slots the iterable and the method. +const FROM: u16 = 1; + +const PHASE: usize = 0; +const ITEM: usize = 1; +const BACK: usize = 2; +const STASH: usize = 3; +const CLOSE: usize = 4; +const FAILED: usize = 5; + +// Where a helper's frame is: what the call it waits on, if any, is for. A generator's phase follows its call's. +const START: usize = 0; +const OUTER_CALL: usize = 1; +const OUTER_GEN: usize = 2; +const INNER_CALL: usize = 3; +const INNER_GEN: usize = 4; +const CALLBACK: usize = 5; +const FLAT_OPEN: usize = 6; +/// Closing the source after a failure, which it throws once closed whatever the close does. +const CLOSE_THROW: usize = 7; +/// The prelude's `closeIterator(source)`, before the first value. +const CLOSE_SOURCE: usize = 8; +/// `return()` closing `flatMap`'s inner record, then the source. +const CLOSE_INNER: usize = 9; +/// Closing the source record, as a prelude `for...of` left early does. +const CLOSE_RECORD: usize = 10; + +fn enter_helper(vm: &mut Vm, callee: Id, id: Id, phase: usize, back: bool, item: Value) -> Res { + let slots = [ + Slot::index(phase), + Slot::pack(item), + Slot::index(back as usize), + Slot::UNDEF, + Slot::index(0), + Slot::index(0), + ]; + let r = vm.enter_native_slots( + NativeOp::Iterators, + HELPER, + Slot::pack(Value::Obj(callee)), + Slot::pack(Value::Obj(id)), + &slots, + ); + if r.is_err() { + helper_mut(vm, id).state = HelperState::Done; + } + r +} + +fn helper_of(vm: &Vm, fr: Frame) -> Id { + fr.this_slot(vm).obj().unwrap_or_default() +} + +/// A step of a helper's frame. Whatever fails leaves the helper done, as its prelude generator is once it threw. +fn helper_frame(vm: &mut Vm, fr: Frame, input: Input) -> Result { + let r = helper_input(vm, fr, input); + if r.is_err() { + let id = helper_of(vm, fr); + helper_mut(vm, id).state = HelperState::Done; + } + r +} + +fn helper_input(vm: &mut Vm, fr: Frame, input: Input) -> Result { + let phase = fr.index(vm, PHASE); + match input { + Input::Start => match phase { + START => next_start(vm, fr), + CLOSE_SOURCE => close_source(vm, fr), + CLOSE_INNER => { + let inner = fr.get(vm, ITEM); + close(vm, fr, inner) + } + _ => { + let iter = helper_mut(vm, helper_of(vm, fr)).iter; + close(vm, fr, iter) + } + }, + Input::Threw(e) => match phase { + OUTER_CALL | OUTER_GEN => Err(e), + INNER_CALL | INNER_GEN | CALLBACK | FLAT_OPEN => close_throw(vm, fr, e), + _ => closed(vm, fr, Err(e)), + }, + Input::Finished(_) => match phase { + OUTER_GEN => out(vm, fr, None), + INNER_GEN => { + inner_done(vm, fr); + next_loop(vm, fr) + } + _ => closed(vm, fr, Ok(())), + }, + Input::Returned(r) => match phase { + OUTER_CALL => match result_of(vm, r.get())? { + Some(item) => after_item(vm, fr, item), + None => out(vm, fr, None), + }, + OUTER_GEN => after_item(vm, fr, r.get()), + INNER_CALL => match result_of(vm, r.get()) { + Ok(Some(v)) => out(vm, fr, Some(v)), + Ok(None) => { + inner_done(vm, fr); + next_loop(vm, fr) + } + Err(e) => close_throw(vm, fr, e), + }, + INNER_GEN => out(vm, fr, Some(r.get())), + CALLBACK => callback_returned(vm, fr, r.get()), + FLAT_OPEN => match direct(vm, &r.get()) { + Ok(inner) => { + set_inner(vm, fr, Some(inner)); + next_loop(vm, fr) + } + Err(e) => close_throw(vm, fr, e), + }, + _ => { + // A close: a `return` method's result must be an object, as `closeIterator` checks it with its own + // message; a generator's close returns no result. + let it = if phase == CLOSE_INNER { + fr.get(vm, ITEM) + } else { + helper_mut(vm, helper_of(vm, fr)).iter + }; + let generator = matches!(it, Value::Obj(id) if matches!(vm.heap[id as usize].kind, Kind::Generator(_))); + let outcome = if generator || r.obj().is_some() { + Ok(()) + } else if phase == CLOSE_SOURCE { + Err(vm.type_error("Iterator return() must return an object.")) + } else { + Err(vm.type_error("Iterator return() result must be an object.")) + }; + closed(vm, fr, outcome) + } + }, + } +} + +/// A helper's `next()` starting: `take` with nothing left closes the source (its record once it yielded, as its +/// loop is left; before that with `closeIterator`); anything else runs the prelude generator's loop. +fn next_start(vm: &mut Vm, fr: Frame) -> Result { + let h = helper_mut(vm, helper_of(vm, fr)); + if let HelperOp::Take(n) = h.op + && n <= 0.0 + { + let iter = h.iter; + if fr.index(vm, BACK) != 0 { + fr.set_index(vm, PHASE, CLOSE_RECORD); + return close(vm, fr, iter); + } + fr.set_index(vm, PHASE, CLOSE_SOURCE); + return close_source(vm, fr); + } + next_loop(vm, fr) +} + +/// What stepping an iterator gave: its next value or `None` once done, or the call it waits on. +enum Stepped { + Value(Option), + Pending(Step), +} + +/// The prelude generator's loop, from its top: through the back-edge it owes, stepping `flatMap`'s inner record +/// while there is one, else the source, until a value is ready or a call is made. +fn next_loop(vm: &mut Vm, fr: Frame) -> Result { + let id = helper_of(vm, fr); + loop { + let h = helper_mut(vm, id); + let (iter, next, site) = (h.iter, h.next, h.site); + if let HelperOp::FlatMap(_, Some((inner, inext))) = h.op { + back_edge(vm, fr); + match step(vm, fr, inner, inext, Value::Undef, INNER_CALL) { + Ok(Stepped::Pending(s)) => return Ok(s), + Ok(Stepped::Value(Some(v))) => return out(vm, fr, Some(v)), + Ok(Stepped::Value(None)) => { + inner_done(vm, fr); + continue; + } + Err(e) => return close_throw(vm, fr, e), + } + } + back_edge(vm, fr); + let item = match step(vm, fr, iter, next, site, OUTER_CALL)? { + Stepped::Pending(s) => return Ok(s), + Stepped::Value(None) => return out(vm, fr, None), + Stepped::Value(Some(item)) => item, + }; + if let Some(s) = apply(vm, fr, id, item)? { + return Ok(s); + } + } +} + +/// The back-edge the loop owes, once. +fn back_edge(vm: &mut Vm, fr: Frame) { + if fr.index(vm, BACK) != 0 { + fr.set_index(vm, BACK, 0); + fuel::step(vm); + } +} + +/// `flatMap`'s inner record is done: its loop's back-edge, back to the source. +fn inner_done(vm: &mut Vm, fr: Frame) { + set_inner(vm, fr, None); + fuel::step(vm); +} + +fn set_inner(vm: &mut Vm, fr: Frame, inner: Option<(Value, Value)>) { + if let HelperOp::FlatMap(_, slot) = &mut helper_mut(vm, helper_of(vm, fr)).op { + *slot = inner; + } +} + +/// A value from the source, then the loop goes on. +fn after_item(vm: &mut Vm, fr: Frame, item: Value) -> Result { + let id = helper_of(vm, fr); + match apply(vm, fr, id, item)? { + Some(s) => Ok(s), + None => next_loop(vm, fr), + } +} + +/// What the helper's op does with a value from the source: the step to return, or `None` to go round the loop. +fn apply(vm: &mut Vm, fr: Frame, id: Id, item: Value) -> Result, Value> { + let h = helper_mut(vm, id); + let index = h.counter; + let f = match &mut h.op { + HelperOp::Wrap => return out(vm, fr, Some(item)).map(Some), + HelperOp::Take(n) => { + *n -= 1.0; + return out(vm, fr, Some(item)).map(Some); + } + HelperOp::Drop(n) => { + if *n > 0.0 { + *n -= 1.0; + fr.set_index(vm, BACK, 1); + return Ok(None); + } + return out(vm, fr, Some(item)).map(Some); + } + HelperOp::Map(f) | HelperOp::FlatMap(f, _) => *f, + HelperOp::Filter(f) => { + let f = *f; + fr.set_index(vm, BACK, 1); + f + } + }; + helper_mut(vm, id).counter += 1.0; + fr.set(vm, ITEM, item); + fr.set_index(vm, PHASE, CALLBACK); + let args = [Slot::pack(item), Slot::pack(Value::Num(index))]; + match call(vm, fr, Slot::pack(f), Slot::UNDEF, args, true) { + Ok(s) => Ok(Some(s)), + Err(e) => close_throw(vm, fr, e).map(Some), + } +} + +/// The callback of `map`, `filter` or `flatMap` returned. +fn callback_returned(vm: &mut Vm, fr: Frame, r: Value) -> Result { + let id = helper_of(vm, fr); + match helper_mut(vm, id).op { + HelperOp::Filter(_) => { + if vm.truthy(&r) { + let item = fr.get(vm, ITEM); + return out(vm, fr, Some(item)); + } + next_loop(vm, fr) + } + HelperOp::FlatMap(..) => { + let method = match flattenable(vm, &r, false, "Iterator.prototype.flatMap") { + Ok(m) => m, + Err(e) => return close_throw(vm, fr, e), + }; + if method.is_nullish() { + return match direct(vm, &r) { + Ok(inner) => { + set_inner(vm, fr, Some(inner)); + next_loop(vm, fr) + } + Err(e) => close_throw(vm, fr, e), + }; + } + if !vm.is_callable(&method) { + let site = helper_mut(vm, id).site; + let e = not_callable(vm, site); + return close_throw(vm, fr, e); + } + fr.set_index(vm, PHASE, FLAT_OPEN); + match call(vm, fr, Slot::pack(method), Slot::pack(r), [], true) { + Ok(s) => Ok(s), + Err(e) => close_throw(vm, fr, e), + } + } + _ => out(vm, fr, Some(r)), + } +} + +/// The helper's result for this call: a value, or done. +fn out(vm: &mut Vm, fr: Frame, v: Option) -> Result { + let id = helper_of(vm, fr); + helper_mut(vm, id).state = if v.is_some() { + HelperState::Suspended + } else { + HelperState::Done + }; + Ok(Step::Done( + vm.iter_result(v.unwrap_or(Value::Undef), v.is_none()), + )) +} + +/// Steps `iter` by its record's `next` as the prelude does: the reference steps its own iterators, generators and +/// helpers without counting a call. A call's result comes back in phase `phase`, a generator's in `phase + 1`. `site` +/// names the call that made the record, for a `next` that is not a function. +fn step( + vm: &mut Vm, + fr: Frame, + iter: Value, + next: Value, + site: Value, + phase: usize, +) -> Result { + if !vm.is_callable(&next) { + return Err(not_callable(vm, site)); + } + if native_step(vm, &iter, &next) { + if let Some(v) = step_builtin(vm, iter, next) { + return v.map(Stepped::Value); + } + let r = vm.call(&next, iter, &[])?; + return result_of(vm, r).map(Stepped::Value); + } + if let Value::Obj(id) = iter + && matches!(vm.heap[id as usize].kind, Kind::Generator(_)) + && next.as_obj() == Some(vm.realm.generator_next) + { + fr.set_index(vm, PHASE, phase + 1); + return Ok(match resume(vm, fr, id, 0)? { + None => Stepped::Pending(Step::Pushed), + Some((_, true)) => Stepped::Value(None), + Some((v, false)) => Stepped::Value(Some(v)), + }); + } + let direct = stepped_directly(vm, &iter); + fr.set_index(vm, PHASE, phase); + call(vm, fr, Slot::pack(next), Slot::pack(iter), [], !direct).map(Stepped::Pending) +} + +/// A built-in iterator stepped by the shared `next` (`iter_next`), as calling it from native code and reading its +/// result does, without making the result: `None` when `next` is another function. +#[inline(always)] +fn step_builtin(vm: &mut Vm, iter: Value, next: Value) -> Option, Value>> { + let (Value::Obj(id), Value::Obj(n)) = (iter, next) else { + return None; + }; + match vm.heap[n as usize].kind { + Kind::Native { f, .. } if std::ptr::fn_addr_eq(f, iter_next as crate::vm::NativeFn) => {} + _ => return None, + } + vm.host.meter.counted = false; + let r = if matches!(vm.heap[id as usize].kind, Kind::ExoticIter { .. }) { + Ok(exotic_step(vm, id)) + } else { + vm.iter_step(&iter) + }; + vm.host.meter.bytecode = false; + Some(r) +} + +/// An iterator result: its value, or `None` when it is done. +fn result_of(vm: &mut Vm, r: Value) -> Result, Value> { + let Value::Obj(rid) = r else { + return Err(vm.type_error("Iterator next() result must be an object.")); + }; + let (dk, vk) = (vm.names.done, vm.names.value); + let done = vm.get_calling(rid, dk)?; + if vm.truthy(&done) { + return Ok(None); + } + Ok(Some(vm.get_calling(rid, vk)?)) +} + +/// Calls `f` for the frame, counted as bytecode calls it or not as native code does, with what it throws coming back +/// as `Input::Threw`. A call that fails before it runs fails here, with no handler left behind. +fn call( + vm: &mut Vm, + fr: Frame, + f: Slot, + this: Slot, + args: [Slot; N], + counted: bool, +) -> Result { + if !counted { + return Ok(fr.catching_list(vm, f, this, &args, Step::CallUncounted)); + } + let n = vm.handlers_mut().len(); + let r = fr.catching(vm, f, this, args); + if r.is_err() { + vm.handlers_mut().truncate(n); + } + r +} + +/// Resumes the generator `g` for the frame (see `Vm::native_resume`), with what it throws coming back as +/// `Input::Threw`. +fn resume(vm: &mut Vm, fr: Frame, g: Id, mode: u8) -> Result, Value> { + let n = vm.handlers_mut().len(); + let sp = (vm.stack.len() - fr.base()) as u32; + vm.handlers_mut().push(Handler { + pc: THREW as u32, + sp, + }); + let r = vm.native_resume(g, mode, Value::Undef); + if !matches!(r, Ok(None)) { + vm.handlers_mut().truncate(n); + } + r +} + +/// A failure of the loop, after the source was taken: closes the source, ignoring how the close goes, then throws it. +fn close_throw(vm: &mut Vm, fr: Frame, e: Value) -> Result { + if vm.fatal.is_some() { + return Err(e); + } + let iter = helper_mut(vm, helper_of(vm, fr)).iter; + fr.set(vm, STASH, e); + fr.set_index(vm, PHASE, CLOSE_THROW); + close(vm, fr, iter) +} + +/// The prelude's `closeIterator(source)`: entered, then a `return` method called and its result checked with +/// `$IsObject`, which costs a native's call more when the method is native. +fn close_source(vm: &mut Vm, fr: Frame) -> Result { + fuel::method(vm); + let iter = helper_mut(vm, helper_of(vm, fr)).iter; + let Value::Obj(id) = iter else { + return out(vm, fr, None); + }; + let rk = vm.names.return_; + let method = vm.get_calling(id, rk)?; + if method.is_nullish() { + return out(vm, fr, None); + } + let native = !vm.is_closure(&method); + fr.set_index(vm, CLOSE, native as usize); + close(vm, fr, iter) +} + +/// Closes `it` as `Vm::iter_close` does; how it went comes to `closed`, now or once the call it makes returns. Except +/// for `closeIterator`, the close costs what calling its `return` does, read before it closes. +fn close(vm: &mut Vm, fr: Frame, it: Value) -> Result { + if fr.index(vm, PHASE) != CLOSE_SOURCE { + let cost = vm.close_fuel(&it); + fr.set_index(vm, CLOSE, cost as usize); + } + let Value::Obj(id) = it else { + return closed(vm, fr, Ok(())); + }; + match &vm.heap[id as usize].kind { + Kind::Generator(GenState::Suspended(_)) => match resume(vm, fr, id, 1) { + Ok(None) => Ok(Step::Pushed), + Ok(Some(_)) => closed(vm, fr, Ok(())), + Err(e) => closed(vm, fr, Err(e)), + }, + Kind::Generator(_) + | Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } => closed(vm, fr, Ok(())), + _ => { + let rk = vm.names.return_; + let f = vm.get_calling(id, rk)?; + if f.is_nullish() { + return closed(vm, fr, Ok(())); + } + if !vm.is_callable(&f) { + // `closeIterator` calls it, which fails as a call of the helper's prelude generator does. + let e = if fr.index(vm, PHASE) == CLOSE_SOURCE { + let site = helper_mut(vm, helper_of(vm, fr)).site; + not_callable(vm, site) + } else { + vm.type_error("Iterator return must be a function.") + }; + return closed(vm, fr, Err(e)); + } + call(vm, fr, Slot::pack(f), Slot::pack(it), [], false) + } + } +} + +/// A close the frame made ended: spends its fuel, then goes on by what the frame was closing for. +fn closed(vm: &mut Vm, fr: Frame, outcome: Result<(), Value>) -> Result { + match fr.index(vm, PHASE) { + CLOSE_THROW => { + let cost = fr.index(vm, CLOSE) as i32; + vm.fuel(cost); + Err(fr.get(vm, STASH)) + } + CLOSE_SOURCE => { + outcome?; + if fr.index(vm, CLOSE) != 0 { + fuel::native(vm); + } + fuel::native(vm); + out(vm, fr, None) + } + phase => { + match outcome { + Ok(()) => { + let cost = fr.index(vm, CLOSE) as i32; + vm.fuel(cost); + } + // `return()` closes the source after its inner record whatever that close did, and throws the + // first failure. + Err(e) if fr.index(vm, FAILED) == 0 => { + fr.set(vm, STASH, e); + fr.set_index(vm, FAILED, 1); + } + Err(_) => {} + } + if phase == CLOSE_INNER { + fr.set_index(vm, PHASE, CLOSE_RECORD); + let iter = helper_mut(vm, helper_of(vm, fr)).iter; + return close(vm, fr, iter); + } + if fr.index(vm, FAILED) != 0 { + return Err(fr.get(vm, STASH)); + } + out(vm, fr, None) + } + } +} + +// The consumers of an iterator run on the for-of driver (see `native::ForOf`), from its record: the slots after the +// loop's are what they do, the callback, the next index, the accumulator (or `toArray`'s result) and whether it is +// set, and the item being decided on. +const USE_MODE: usize = FOR_OF_SLOTS; +const USE_F: usize = FOR_OF_SLOTS + 1; +const USE_INDEX: usize = FOR_OF_SLOTS + 2; +const USE_ACC: usize = FOR_OF_SLOTS + 3; +const USE_HAS_ACC: usize = FOR_OF_SLOTS + 4; +const USE_ITEM: usize = FOR_OF_SLOTS + 5; + +const FOR_EACH: usize = 0; +const SOME: usize = 1; +const EVERY: usize = 2; +const FIND: usize = 3; +const TO_ARRAY: usize = 4; +const REDUCE: usize = 5; + +/// `forEach`, `some`, `every`, `find`, `toArray` and `reduce` of `Iterator.prototype`, as the prelude's +/// `Iterator$prototype$...` and its `iteratorTest` run them: a callback that throws closes the iterator, and one +/// that decides closes it too. +pub(crate) struct Consume; + +impl ForOf for Consume { + fn item(vm: &mut Vm, fr: Frame, x: Value) -> Result { + match fr.index(vm, USE_MODE) { + TO_ARRAY => { + let out = fr.slot(vm, USE_ACC).obj().unwrap_or(0); + if let Kind::Array(items) = &mut vm.heap[out as usize].kind { + if items.len() >= crate::ops::MAX_ARRAY_LEN { + return Err(vm.range_error("Invalid array length")); + } + items.push(x); + } + Ok(Flow::Next) + } + REDUCE if fr.index(vm, USE_HAS_ACC) == 0 => { + fr.set(vm, USE_ACC, x); + fr.set_index(vm, USE_HAS_ACC, 1); + let index = fr.index(vm, USE_INDEX); + fr.set_index(vm, USE_INDEX, index + 1); + Ok(Flow::Next) + } + REDUCE => { + let (f, acc, index) = ( + fr.slot(vm, USE_F), + fr.slot(vm, USE_ACC), + fr.slot(vm, USE_INDEX), + ); + Ok(Flow::Call(fr.catching( + vm, + f, + Slot::UNDEF, + [acc, Slot::pack(x), index], + )?)) + } + _ => { + fr.set(vm, USE_ITEM, x); + let (f, index) = (fr.slot(vm, USE_F), fr.slot(vm, USE_INDEX)); + Ok(Flow::Call(fr.catching( + vm, + f, + Slot::UNDEF, + [Slot::pack(x), index], + )?)) + } + } + } + + fn returned(vm: &mut Vm, fr: Frame, r: Slot) -> Result { + let index = fr.index(vm, USE_INDEX); + fr.set_index(vm, USE_INDEX, index + 1); + let r = r.get(); + Ok(match fr.index(vm, USE_MODE) { + REDUCE => { + fr.set(vm, USE_ACC, r); + Flow::Next + } + SOME if vm.truthy(&r) => Flow::Stop(Value::Bool(true)), + EVERY if !vm.truthy(&r) => Flow::Stop(Value::Bool(false)), + FIND if vm.truthy(&r) => Flow::Stop(fr.get(vm, USE_ITEM)), + _ => Flow::Next, + }) + } + + fn finish(vm: &mut Vm, fr: Frame) -> Res { + let r = match fr.index(vm, USE_MODE) { + SOME => Value::Bool(false), + EVERY => Value::Bool(true), + TO_ARRAY => fr.get(vm, USE_ACC), + REDUCE if fr.index(vm, USE_HAS_ACC) != 0 => fr.get(vm, USE_ACC), + REDUCE => { + return Err(vm.type_error( + "Iterator.prototype.reduce of an empty iterator with no initial value.", + )); + } + _ => Value::Undef, + }; + vm.bytecode_builtin(); + Ok(r) + } + + fn stopped(vm: &mut Vm) { + vm.bytecode_builtin(); + } +} + +/// Starts a consumer on the iterator `this` once its prologue's fuel is spent: a `next` that is not a function fails +/// as the first step would. +fn consume(vm: &mut Vm, this: Value, callee: Id, iter: Value, next: Value, own: [Value; 4]) -> Res { + let direct = stepped_directly(vm, &iter); + if !direct && !vm.is_callable(&next) { + let name = vm.call_site().unwrap_or("The called value").to_owned(); + return Err(vm.type_error(&format!("{name} is not a function."))); + } + let next = if direct { Value::Undef } else { next }; + let own = [ + own[0], + own[1], + Value::Num(0.0), + own[2], + own[3], + Value::Undef, + ]; + enter_for_of_record( + vm, + crate::native::NativeOp::IterConsume, + callee, + this, + iter, + next, + &own, + ) +} + +/// The prologue of `forEach`, `some`, `every` and `find`: the prelude's `Iterator$prototype$...` and its +/// `iteratorTest`. +fn test(vm: &mut Vm, this: Value, args: &[Value], callee: Id, mode: usize, name: &str) -> Res { + fuel::method(vm); + fuel::method(vm); + let (iter, next) = direct(vm, &this)?; + let f = super::require_callback(vm, &arg(args, 0), &format!("Iterator.prototype.{name}"))?; + fuel::native(vm); + consume( + vm, + this, + callee, + iter, + next, + [Value::Num(mode as f64), f, Value::Undef, Value::Num(0.0)], + ) +} + +fn it_for_each(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + test(vm, this, args, callee, FOR_EACH, "forEach") +} + +fn it_some(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + test(vm, this, args, callee, SOME, "some") +} + +fn it_every(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + test(vm, this, args, callee, EVERY, "every") +} + +fn it_find(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + test(vm, this, args, callee, FIND, "find") +} + +fn it_to_array(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + fuel::method(vm); + let (iter, next) = direct(vm, &this)?; + let out = vm.new_array(Vec::new()); + consume( + vm, + this, + callee, + iter, + next, + [ + Value::Num(TO_ARRAY as f64), + Value::Undef, + out, + Value::Num(0.0), + ], + ) +} + +fn it_reduce(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + fuel::method(vm); + let (iter, next) = direct(vm, &this)?; + let f = super::require_callback(vm, &arg(args, 0), "Iterator.prototype.reduce")?; + fuel::native(vm); + let (acc, has) = match args.get(1) { + Some(a) => (*a, 1.0), + None => (Value::Undef, 0.0), + }; + consume( + vm, + this, + callee, + iter, + next, + [Value::Num(REDUCE as f64), f, acc, Value::Num(has)], + ) +} + +/// `Iterator.from` over an iterable whose `[Symbol.iterator]` it calls, as the prelude's `flattenable` does. +fn from_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + match input { + Input::Start => { + let (method, v) = (fr.slot(vm, 1), fr.slot(vm, 0)); + fr.call_slots(vm, method, v, []) + } + Input::Returned(it) => { + let (iter, next) = direct(vm, &it.get())?; + Ok(Step::Done(primed(vm, iter, next, HelperOp::Wrap))) + } + Input::Threw(e) => Err(e), + Input::Finished(_) => Ok(Step::Done(Value::Undef)), + } +} + +/// The steps of this family's native frames (`native::NativeOp::Iterators`), by sub-op; see `native.rs`. +pub(crate) fn family_step(vm: &mut Vm, sub: u16, fr: Frame, input: Input) -> Result { + match sub { + HELPER => helper_frame(vm, fr, input), + _ => from_step(vm, fr, input), + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/builtins/mod.rs b/packages/codemode-rust/crates/psychoscript/src/builtins/mod.rs new file mode 100644 index 0000000000000..bf158fc49c526 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/builtins/mod.rs @@ -0,0 +1,581 @@ +//! Native built-ins: prototypes, constructors and global functions, created fresh for every run. + +pub(crate) mod array; +mod buffer; +pub mod bytes; +pub(crate) mod collections; +pub mod date; +pub mod exotic; +pub(crate) mod fuel; +pub mod iterator; +mod numfmt; +pub(crate) mod object; +pub mod regexp; +mod regexp_syntax; +pub(crate) mod sets; +pub(crate) mod string; +mod uri; +pub mod web; + +use crate::object::*; +use crate::value::{Id, Value}; +use crate::vm::{NativeFn, Res, Vm}; + +/// Prototypes of the standard-library kinds beyond the core ones in `Realm`. +#[derive(Default)] +pub struct StdProtos { + pub regexp: Id, + pub date: Id, + pub uint8: Id, + pub buffer: Id, + pub text_encoder: Id, + pub text_decoder: Id, + pub weak_map: Id, + pub weak_set: Id, + pub iterator_helper: Id, + pub uri_error: Id, + pub url: Id, + pub params: Id, + pub headers: Id, + /// The lazily installed groups already set up (see `LAZY`). + pub loaded: u8, +} + +/// Built-in groups installed only when a program names one of their globals (or makes one of their values), so a +/// run pays for what it uses: (bit, globals, setup). +/// A lazy group: its bit, the globals it defines, and its setup. +type LazyGroup = (u8, &'static [&'static str], fn(&mut Vm)); + +const LAZY: &[LazyGroup] = &[ + (1, &["RegExp"], regexp::setup), + (2, &["Date"], date::setup), + ( + 4, + &[ + "Uint8Array", + "Buffer", + "TextEncoder", + "TextDecoder", + "atob", + "btoa", + ], + setup_bytes, + ), + ( + 8, + &["Map", "Set", "Object", "WeakMap", "WeakSet"], + sets::setup, + ), + ( + 16, + &[ + "encodeURI", + "encodeURIComponent", + "decodeURI", + "decodeURIComponent", + ], + uri::setup, + ), + (32, &["URL", "URLSearchParams", "Headers"], web::setup), + (64, &["crypto", "structuredClone"], web::setup_globals), +]; + +pub const LAZY_REGEXP: u8 = 1; +pub const LAZY_DATE: u8 = 2; +pub const LAZY_BYTES: u8 = 4; +pub const LAZY_WEB: u8 = 32; + +fn setup_bytes(vm: &mut Vm) { + bytes::setup(vm); + buffer::setup(vm); +} + +/// Installs the lazy group with `bit`, once. +pub fn ensure(vm: &mut Vm, bit: u8) { + if vm.realm.std.loaded & bit != 0 { + return; + } + vm.realm.std.loaded |= bit; + if let Some((_, _, setup)) = LAZY.iter().find(|(b, _, _)| *b == bit) { + setup(vm); + } +} + +/// Installs the lazy group that defines the global `name`; false when no group does. +pub fn ensure_global(vm: &mut Vm, name: &str) -> bool { + match LAZY.iter().find(|(_, names, _)| names.contains(&name)) { + Some((bit, _, _)) => { + ensure(vm, *bit); + true + } + None => false, + } +} + +/// Installs the lazy groups a program's referenced globals need. +pub fn ensure_globals(vm: &mut Vm, globals: &[Atom]) { + for a in globals { + let name = vm.atoms.text(*a); + if let Some((bit, _, _)) = LAZY.iter().find(|(_, names, _)| names.contains(&name)) { + ensure(vm, *bit); + } + } +} + +/// Global names a program cannot assign to. +pub const GLOBAL_NAMES: &[&str] = &[ + "Object", + "Function", + "Array", + "String", + "Number", + "Boolean", + "Symbol", + "Math", + "JSON", + "Promise", + "Map", + "Set", + "Error", + "TypeError", + "RangeError", + "SyntaxError", + "ReferenceError", + "EvalError", + "URIError", + "AggregateError", + "RegExp", + "Date", + "Uint8Array", + "Buffer", + "WeakMap", + "WeakSet", + "Iterator", + "URL", + "URLSearchParams", + "Headers", + "crypto", + "structuredClone", + "encodeURI", + "encodeURIComponent", + "decodeURI", + "decodeURIComponent", + "TextEncoder", + "TextDecoder", + "atob", + "btoa", + "console", + "parseInt", + "parseFloat", + "isNaN", + "isFinite", + "NaN", + "Infinity", + "globalThis", +]; + +#[inline] +pub fn arg(args: &[Value], i: usize) -> Value { + args.get(i).cloned().unwrap_or_default() +} + +impl Vm { + // Inlined into `method`; see there. + #[inline(always)] + pub fn native_fn(&mut self, name: &'static str, length: u8, f: NativeFn, data: Value) -> Value { + let name = self.atoms.intern_static(name); + let proto = self.realm.function_proto; + Value::Obj(self.alloc(Obj::new( + Some(proto), + Kind::Native { + f, + data, + name, + length, + ctor: false, + }, + ))) + } + + // Inlined into the setup of built-ins, which runs for every run: with the collector's hooks in `alloc`, `heap[_]` + // and the interner, the compiler stops doing so itself, and setting up a run costs a few percent more. + #[inline(always)] + pub fn method(&mut self, target: Id, name: &'static str, length: u8, f: NativeFn) -> Value { + let v = self.native_fn(name, length, f, Value::Undef); + let key = self.atoms.intern(name); + self.define_hidden(target, key, v); + v + } + + fn methods(&mut self, target: Id, list: &[(&'static str, u8, NativeFn)]) { + for (name, len, f) in list { + self.method(target, name, *len, *f); + } + } + + // Inlined as `method` is. + #[inline(always)] + pub(crate) fn constant(&mut self, target: Id, name: &'static str, v: Value) { + let key = self.atoms.intern_static(name); + self.heap[target as usize].props.insert(key, v, FIXED); + } + + /// A constructor whose `prototype` is `proto`; `data` reaches the native as its callee data. + fn ctor(&mut self, name: &'static str, length: u8, f: NativeFn, proto: Id, data: Value) -> Id { + let name_atom = self.atoms.intern_static(name); + let fp = self.realm.function_proto; + let c = self.alloc(Obj::new( + Some(fp), + Kind::Native { + f, + data, + name: name_atom, + length, + ctor: true, + }, + )); + let (pk, ck) = (self.names.prototype, self.names.constructor); + self.heap[c as usize] + .props + .insert(pk, Value::Obj(proto), FIXED); + self.define_hidden(proto, ck, Value::Obj(c)); + self.global(name, Value::Obj(c)); + c + } + + fn global(&mut self, name: &'static str, v: Value) { + let a = self.atoms.intern_static(name); + self.global_map.insert(a, v); + } + + fn plain(&mut self, proto: Id) -> Id { + self.alloc(Obj::new(Some(proto), Kind::Ordinary)) + } + + pub fn native_data(&self, callee: Id) -> Value { + match &self.heap[callee as usize].kind { + Kind::Native { data, .. } => *data, + _ => Value::Undef, + } + } + + /// An iterator result `{ value, done }`. + pub fn iter_result(&mut self, value: Value, done: bool) -> Value { + let id = self.new_object(); + let (vk, dk) = (self.names.value, self.names.done); + let props = &mut self.heap[id as usize].props; + props.push_new(vk, value, DEFAULT_FLAGS); + props.push_new(dk, Value::Bool(done), DEFAULT_FLAGS); + Value::Obj(id) + } + + pub fn setup(&mut self) { + let object_proto = self.alloc(Obj::new(None, Kind::Ordinary)); + self.realm.object_proto = object_proto; + // Function.prototype is itself a function that accepts anything and returns undefined, as in JS. + let name = self.atoms.intern_static(""); + let function_proto = self.alloc(Obj::new( + Some(object_proto), + Kind::Native { + f: function_proto_call, + data: Value::Undef, + name, + length: 0, + ctor: false, + }, + )); + self.realm.function_proto = function_proto; + // Array.prototype is itself an array, as in the reference. + self.realm.array_proto = self.alloc(Obj::new(Some(object_proto), Kind::Array(Vec::new()))); + self.realm.string_proto = self.plain(object_proto); + self.realm.number_proto = self.plain(object_proto); + self.realm.boolean_proto = self.plain(object_proto); + self.realm.symbol_proto = self.plain(object_proto); + self.realm.error_proto = self.plain(object_proto); + let ep = self.realm.error_proto; + self.realm.type_error_proto = self.plain(ep); + self.realm.range_error_proto = self.plain(ep); + self.realm.syntax_error_proto = self.plain(ep); + self.realm.reference_error_proto = self.plain(ep); + self.realm.aggregate_error_proto = self.plain(ep); + self.realm.promise_proto = self.plain(object_proto); + self.realm.map_proto = self.plain(object_proto); + self.realm.set_proto = self.plain(object_proto); + self.realm.iter_proto = self.plain(object_proto); + let ip = self.realm.iter_proto; + self.realm.generator_proto = self.plain(ip); + // %GeneratorPrototype%'s `constructor` is %GeneratorFunction.prototype%, read-only, before its methods. + let fp = self.realm.function_proto; + let gfp = self.alloc(Obj::new(Some(fp), Kind::Ordinary)); + self.realm.generator_function_proto = gfp; + let (gp, ck) = (self.realm.generator_proto, self.names.constructor); + self.heap[gp as usize] + .props + .push_new(ck, Value::Obj(gfp), 0); + let values = self.native_fn("argumentsValues", 0, arguments_values, Value::Undef); + self.realm.arguments_values = values.as_obj().unwrap_or(0); + + object::setup(self); + array::setup(self); + string::setup(self); + collections::setup(self); + iterator::setup(self); + iterator::setup_helpers(self); + self.setup_async_iteration(); + + self.global("NaN", Value::Num(f64::NAN)); + self.global("Infinity", Value::Num(f64::INFINITY)); + self.global("undefined", Value::Undef); + } +} + +fn function_proto_call(_vm: &mut Vm, _this: Value, _args: &[Value], _: Id) -> crate::vm::Res { + Ok(Value::Undef) +} + +pub fn this_obj(vm: &mut Vm, this: &Value, what: &str) -> Result { + match this { + Value::Obj(id) => Ok(*id), + _ => Err(vm.type_error(&format!("{what} called on a non-object"))), + } +} + +/// `Frame::convert` with what the conversion throws coming back to the frame as `Input::Threw`, as `Frame::catching` +/// calls: a `ForOf` body that converts waits on it with `Flow::Call`, so a throw closes the iterator. +pub(crate) fn convert_catching( + vm: &mut Vm, + fr: crate::native::Frame, + v: Value, + hint: crate::ops::Hint, +) -> Result { + let sp = (vm.stack.len() - fr.base()) as u32; + vm.handlers_mut().push(crate::vm::Handler { + pc: crate::native::THREW as u32, + sp, + }); + fr.convert(vm, v, hint) +} + +pub fn to_index(vm: &mut Vm, v: &Value, len: usize, default: usize) -> Result { + if let Value::Undef = v { + return Ok(default); + } + let n = crate::value::to_integer(vm.number_of(v)?); + Ok(if n < 0.0 { + (len as f64 + n).max(0.0) as usize + } else { + n.min(len as f64) as usize + }) +} + +/// ToString without consulting program-defined methods, as the reference's `coerceToString`: an array joins its +/// elements, a Date, RegExp or Error uses its built-in form, any other object is `[object Tag]`. +pub fn builtin_string(vm: &mut Vm, v: &Value) -> Result { + let Value::Obj(id) = v else { + let s = vm.string_of(v)?; + return Ok(vm.text(s).to_owned()); + }; + let id = *id; + if matches!(vm.heap[id as usize].kind, Kind::Array(_)) { + vm.densify(id)?; + } + Ok(match &vm.heap[id as usize].kind { + Kind::Array(items) => { + let items = items.clone(); + let mut out = String::new(); + for (i, item) in items.iter().enumerate() { + if i > 0 { + out.push(','); + } + if !matches!(item, Value::Undef | Value::Null | Value::Uninit) { + out.push_str(&builtin_string(vm, item)?); + } + if out.len() > crate::ops::MAX_STRING_LEN { + return Err(vm.range_error("Invalid string length")); + } + } + out + } + Kind::Date(t) => date::display(*t), + Kind::RegExp(_) => regexp::inspect(vm, id), + Kind::Bytes(b) if b.buffer => { + crate::strings::external_text(String::from_utf8_lossy(&b.to_vec()).into_owned()) + } + Kind::Bytes(b) => { + let parts: Vec = b.to_vec().iter().map(u8::to_string).collect(); + parts.join(",") + } + Kind::Error(_) => { + let (nk, mk) = (vm.names.name, vm.names.message); + let name = match vm.get_obj(id, nk) { + Value::Str(s) => vm.text(s).to_owned(), + _ => "Error".to_owned(), + }; + let message = match vm.get_obj(id, mk) { + Value::Str(s) => vm.text(s).to_owned(), + _ => String::new(), + }; + if message.is_empty() { + name + } else if name.is_empty() { + message + } else { + format!("{name}: {message}") + } + } + Kind::Namespace(_) => "[object Object]".to_owned(), + Kind::Url(_) => web::url_href(vm, id), + Kind::SearchParams(_) => web::params_text(vm, id), + _ => format!("[object {}]", object::tag_of(vm, v)), + }) +} + +/// ToNumber without consulting program-defined methods, as the reference's `coerceToNumber`. +pub fn builtin_number(vm: &mut Vm, v: &Value) -> Result { + match v { + Value::Obj(id) => { + if let Kind::Date(t) = vm.heap[*id as usize].kind { + return Ok(t); + } + if let Kind::Namespace(_) = vm.heap[*id as usize].kind { + return Ok(f64::NAN); + } + let s = builtin_string(vm, v)?; + Ok(crate::value::str_to_num(&s)) + } + v => vm.number_of(v), + } +} + +/// ToIntegerOrInfinity over `builtin_number`. +pub fn builtin_integer(vm: &mut Vm, v: &Value) -> Result { + Ok(crate::value::to_integer(builtin_number(vm, v)?)) +} + +/// How diagnostics refer to a value, as the reference's `describeValue` does: `a number`, `an array`, `a Date`. +pub fn describe_value(vm: &Vm, v: &Value) -> String { + let tag = match v { + Value::Undef | Value::Uninit => return "undefined".into(), + Value::Null => return "null".into(), + Value::Obj(id) => match &vm.heap[*id as usize].kind { + Kind::Array(_) => return "an array".into(), + Kind::Namespace(_) => return "a namespace reference".into(), + Kind::Closure(_) | Kind::Native { .. } | Kind::Bound(_) => return "a function".into(), + Kind::Promise(_) => return "an un-awaited Promise".into(), + Kind::Generator(_) => return "a generator".into(), + Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } => return "an iterator".into(), + _ => object::tag_of(vm, v), + }, + _ => return format!("a {}", vm.type_of(v)), + }; + if tag == "Object" { + return "a data object".into(); + } + let article = if tag.starts_with(['A', 'E', 'I', 'O']) { + "an" + } else { + "a" + }; + format!("{article} {tag}") +} + +/// The reference's error for a method called on the wrong kind of receiver. +pub fn incompatible(vm: &mut Vm, method: &str, this: &Value) -> Value { + let d = describe_value(vm, this); + vm.type_error(&format!("{method} called on incompatible receiver {d}.")) +} + +/// Checks a callback argument, as the reference's `requireCallback` does. +pub fn require_callback(vm: &mut Vm, f: &Value, name: &str) -> Result { + if supported_callback(vm, f) { + return Ok(*f); + } + if vm.type_of(f) == "function" { + return Err(unsupported_callable( + vm, + name, + "callback", + "(value) => fn(value)", + )); + } + Err(vm.type_error(&format!("{name} expects a function callback."))) +} + +/// Whether callback sites (array methods, replacers, promise reactions) admit `f`, as the reference's +/// `isSupportedCallback`: any function but a namespace reference and the built-ins marked `NOT_CALLBACK`. +pub fn supported_callback(vm: &Vm, f: &Value) -> bool { + let Value::Obj(id) = f else { + return false; + }; + let o = &vm.heap[*id as usize]; + match o.kind { + Kind::Namespace(_) => false, + Kind::Native { .. } => o.flags & NOT_CALLBACK == 0, + _ => o.is_callable(), + } +} + +/// The error for a function a callback site doesn't admit, with the arrow function to wrap it in. +pub fn unsupported_callable(vm: &mut Vm, name: &str, role: &str, example: &str) -> Value { + vm.type_error(&format!( + "{name} cannot use this callable as a {role}; wrap it in an arrow function, e.g. {example}." + )) +} + +/// Declares getter-only accessor properties on a built-in prototype. Instances answer them through their exotic +/// hooks; the slot on the prototype holds `Uninit`, which a property read turns into `accessor_error`, so reading +/// one from the prototype itself (or an object that merely inherits it) throws as the reference's getters do. +fn accessors(vm: &mut Vm, proto: Id, names: &[&'static str]) { + for name in names { + let k = vm.atoms.intern_static(name); + vm.heap[proto as usize].props.insert(k, Value::Uninit, 0); + } +} + +/// The error for reading an accessor of `this`, which is not the kind the accessor belongs to. +pub fn accessor_error(vm: &mut Vm, this: Id, key: Atom) -> Value { + if std::mem::take(&mut vm.restricted_hit) { + return object::restricted(vm, Value::Undef, &[], 0).unwrap_err(); + } + let (pk, nk) = (vm.names.constructor, vm.names.name); + let mut owner = Some(this); + while let Some(o) = owner { + if matches!(vm.heap[o as usize].props.get(key), Some(Value::Uninit)) { + break; + } + owner = vm.heap[o as usize].proto; + } + let ctor = match owner.map(|o| vm.get_obj(o, pk)) { + Some(Value::Obj(c)) => match vm.get_obj(c, nk) { + Value::Str(s) => vm.text(s).to_owned(), + _ => String::new(), + }, + _ => String::new(), + }; + let k = vm.atoms.text(key).to_owned(); + incompatible(vm, &format!("{ctor}.prototype.{k}"), &Value::Obj(this)) +} + +/// An arguments object's `[Symbol.iterator]`: its values by `length` and index, read when it is called. +fn arguments_values(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let Value::Obj(id) = this else { + return Err(vm.type_error("argumentsValues called on a non-object.")); + }; + let lk = vm.names.length; + let len = vm.get_calling(id, lk)?; + let n = crate::value::to_integer(vm.number_of(&len)?).max(0.0) as usize; + let mut items = Vec::with_capacity(n.min(1 << 16)); + for i in 0..n { + let k = vm.atoms.intern(&i.to_string()); + items.push(vm.get_calling(id, k)?); + } + let proto = vm.realm.iter_proto; + let it = Kind::ListIter { + items: items.into(), + pos: 0, + }; + Ok(Value::Obj(vm.alloc(Obj::new(Some(proto), it)))) +} diff --git a/packages/codemode-rust/crates/psychoscript/src/builtins/numfmt.rs b/packages/codemode-rust/crates/psychoscript/src/builtins/numfmt.rs new file mode 100644 index 0000000000000..0126bcf25f25a --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/builtins/numfmt.rs @@ -0,0 +1,634 @@ +//! Number formatting with JavaScriptCore's results: radix strings, `toExponential` and `toPrecision`. + +/// The exact decimal digits of a finite positive `x` and the power of ten of the first one. +fn exact_digits(x: f64) -> (Vec, i32) { + let s = format!("{:.1100e}", x); + let (mantissa, exp) = s.split_once('e').unwrap_or((&s, "0")); + let digits: Vec = mantissa + .bytes() + .filter(u8::is_ascii_digit) + .map(|b| b - b'0') + .collect(); + let end = digits.iter().rposition(|d| *d != 0).map_or(1, |i| i + 1); + (digits[..end].to_vec(), exp.parse().unwrap_or(0)) +} + +/// `n` significant digits of a finite positive `x`, rounded half up on the exact value, and the exponent. +fn rounded(x: f64, n: usize) -> (Vec, i32) { + let (mut digits, mut e) = exact_digits(x); + let up = digits.get(n).is_some_and(|d| *d >= 5); + digits.resize(n, 0); + if up { + let mut i = n; + loop { + if i == 0 { + digits.insert(0, 1); + digits.truncate(n); + e += 1; + break; + } + i -= 1; + if digits[i] == 9 { + digits[i] = 0; + } else { + digits[i] += 1; + break; + } + } + } + (digits, e) +} + +/// The shortest round-trip digits of a finite positive `x`, and the exponent. +fn shortest(x: f64) -> (Vec, i32) { + let (digits, e) = crate::value::shortest_digits(x); + (digits.bytes().map(|b| b - b'0').collect(), e) +} + +fn text(d: &[u8]) -> String { + d.iter().map(|d| (b'0' + d) as char).collect() +} + +fn exponential(sign: &str, digits: &[u8], e: i32) -> String { + let mut out = String::from(sign); + out.push_str(&text(&digits[..1])); + if digits.len() > 1 { + out.push('.'); + out.push_str(&text(&digits[1..])); + } + out.push('e'); + out.push(if e < 0 { '-' } else { '+' }); + out.push_str(&e.abs().to_string()); + out +} + +/// `Number.prototype.toExponential` for a finite `x`; `None` digits means as many as needed. +pub fn to_exponential(x: f64, fraction: Option) -> String { + let sign = if x < 0.0 { "-" } else { "" }; + let x = x.abs(); + if x == 0.0 { + let n = fraction.unwrap_or(0); + return exponential("", &vec![0; n + 1], 0); + } + let (digits, e) = match fraction { + Some(f) => rounded(x, f + 1), + None => shortest(x), + }; + exponential(sign, &digits, e) +} + +/// `Number.prototype.toPrecision` for a finite `x` and a precision in 1..=100. +pub fn to_precision(x: f64, p: usize) -> String { + let sign = if x < 0.0 { "-" } else { "" }; + let x = x.abs(); + let (digits, e) = if x == 0.0 { + (vec![0; p], 0) + } else { + rounded(x, p) + }; + if e < -6 || e >= p as i32 { + return exponential(sign, &digits, e); + } + let mut out = String::from(sign); + if e >= 0 { + let int = e as usize + 1; + out.push_str(&text(&digits[..int])); + if p > int { + out.push('.'); + out.push_str(&text(&digits[int..])); + } + } else { + out.push_str("0."); + for _ in 0..(-e - 1) { + out.push('0'); + } + out.push_str(&text(&digits)); + } + out +} + +/// The exact digits of a non-negative integral `x` in `radix`. +fn integer_digits(x: f64, radix: u32) -> Vec { + if x < 9.007_199_254_740_992e15 { + let mut n = x as u64; + let mut out = Vec::new(); + loop { + out.push((n % radix as u64) as u32); + n /= radix as u64; + if n == 0 { + break; + } + } + out.reverse(); + return out; + } + let bits = x.to_bits(); + let exp = ((bits >> 52) & 0x7ff) as i64 - 1075; + let mantissa = (bits & ((1 << 52) - 1)) | (1 << 52); + // Little-endian 32-bit limbs of mantissa * 2^exp (exp > 0 here). + let mut limbs: Vec = vec![mantissa & 0xffff_ffff, mantissa >> 32]; + for _ in 0..exp { + let mut carry = 0; + for l in limbs.iter_mut() { + let v = (*l << 1) | carry; + *l = v & 0xffff_ffff; + carry = v >> 32; + } + if carry > 0 { + limbs.push(carry); + } + } + let mut out = Vec::new(); + while limbs.iter().any(|l| *l != 0) { + let mut rem = 0u64; + for l in limbs.iter_mut().rev() { + let cur = (rem << 32) | *l; + *l = cur / radix as u64; + rem = cur % radix as u64; + } + out.push(rem as u32); + while limbs.last() == Some(&0) { + limbs.pop(); + } + } + out.reverse(); + out +} + +/// A non-negative dyadic number with `FRAC` 32-bit limbs after the point: exact for the fraction and the +/// half-ulp of any double, as JavaScriptCore's `Uint16WithFraction` is. +struct Fixed(Vec); + +const FRAC: usize = 34; +const LIMBS: usize = FRAC + 2; + +impl Fixed { + /// `x / 2^shift`, for a finite non-negative double below 2^32. + fn new(x: f64, shift: u32) -> Fixed { + let bits = x.to_bits(); + let raw_exp = ((bits >> 52) & 0x7ff) as i64; + let (m, e) = if raw_exp == 0 { + (bits & ((1 << 52) - 1), -1074) + } else { + ((bits & ((1 << 52) - 1)) | (1 << 52), raw_exp - 1075) + }; + let shift_total = e + (FRAC as i64) * 32 - shift as i64; + let mut limbs = vec![0u32; LIMBS]; + if shift_total >= 0 { + let s = shift_total as usize; + let (word, bit) = (s / 32, s % 32); + let wide = (m as u128) << bit; + for k in 0..4 { + if word + k < LIMBS { + limbs[word + k] = (wide >> (32 * k)) as u32; + } + } + } + Fixed(limbs) + } + + fn mul_small(&mut self, r: u32) { + let mut carry = 0u64; + for l in self.0.iter_mut() { + let v = *l as u64 * r as u64 + carry; + *l = v as u32; + carry = v >> 32; + } + } + + /// Takes the integer part out, leaving the fraction. + fn floor_and_subtract(&mut self) -> u32 { + let d = self.0[FRAC]; + self.0[FRAC] = 0; + self.0[FRAC + 1] = 0; + d + } + + fn cmp_half(&self) -> std::cmp::Ordering { + let mut half = vec![0u32; LIMBS]; + half[FRAC - 1] = 1 << 31; + self.cmp_limbs(&half) + } + + fn cmp_limbs(&self, other: &[u32]) -> std::cmp::Ordering { + for i in (0..LIMBS).rev() { + match self.0[i].cmp(&other[i]) { + std::cmp::Ordering::Equal => {} + o => return o, + } + } + std::cmp::Ordering::Equal + } + + fn sum_greater_than_one(&self, other: &Fixed) -> bool { + let mut sum = vec![0u32; LIMBS]; + let mut carry = 0u64; + for (i, s) in sum.iter_mut().enumerate() { + let v = self.0[i] as u64 + other.0[i] as u64 + carry; + *s = v as u32; + carry = v >> 32; + } + let mut one = vec![0u32; LIMBS]; + one[FRAC] = 1; + Fixed(sum).cmp_limbs(&one) == std::cmp::Ordering::Greater + } +} + +fn next_after(x: f64, up: bool) -> f64 { + if up { + f64::from_bits(x.to_bits() + 1) + } else if x == 0.0 { + 0.0 + } else { + f64::from_bits(x.to_bits() - 1) + } +} + +/// `Number.prototype.toString(radix)` for radix other than 10, as JavaScriptCore writes it: exact integer digits, +/// then the fewest fraction digits that still identify the double. +pub fn to_radix(x: f64, radix: u32) -> String { + if x.is_nan() { + return "NaN".into(); + } + if x.is_infinite() { + return if x > 0.0 { "Infinity" } else { "-Infinity" }.into(); + } + let negative = x < 0.0; + let number = x.abs(); + let mut integer = number.floor(); + let fraction_part = number - integer; + let digit_char = |d: u32| std::char::from_digit(d, radix).unwrap_or('0'); + let mut frac = String::new(); + if fraction_part != 0.0 { + let integer_odd = integer <= 9_007_199_254_740_991.0 && (integer as i64) & 1 == 1; + let mut odd_in_odd_radix = integer_odd; + let mut digit = integer_odd as u32; + let mut fraction = Fixed::new(fraction_part, 0); + let mut rounding_up = false; + let delta_next = next_after(number, true) - number; + let delta_last = number - next_after(number, false); + let mut half_next = Fixed::new(delta_next, 1); + let mut half_last = Fixed::new(delta_last, 1); + loop { + let c = fraction.cmp_half(); + let odd = if radix & 1 == 1 { + odd_in_odd_radix + } else { + digit & 1 == 1 + }; + if c == std::cmp::Ordering::Greater || (c == std::cmp::Ordering::Equal && odd) { + if fraction.sum_greater_than_one(&half_next) { + rounding_up = true; + break; + } + } else if fraction.cmp_limbs(&half_last.0) == std::cmp::Ordering::Less { + break; + } + fraction.mul_small(radix); + digit = fraction.floor_and_subtract(); + frac.push(digit_char(digit)); + if digit & 1 == 1 { + odd_in_odd_radix = !odd_in_odd_radix; + } + half_next.mul_small(radix); + half_last.mul_small(radix); + } + let top = digit_char(radix - 1); + if rounding_up { + while frac.ends_with(top) { + frac.pop(); + } + match frac.pop() { + Some(c) => { + let d = c.to_digit(radix).unwrap_or(0); + frac.push(digit_char(d + 1)); + } + None => integer += 1.0, + } + } else { + while frac.ends_with('0') { + frac.pop(); + } + } + } + let mut out = String::new(); + if negative { + out.push('-'); + } + out.extend(integer_digits(integer, radix).into_iter().map(digit_char)); + if !frac.is_empty() { + out.push('.'); + out.push_str(&frac); + } + out +} + +/// `Math.f16round`: the nearest binary16 value, ties to even, rounded directly from the double. +pub fn f16_round(x: f64) -> f64 { + if !x.is_finite() || x == 0.0 { + return x; + } + let sign = if x < 0.0 { -1.0 } else { 1.0 }; + let a = x.abs(); + if a >= 65520.0 { + return sign * f64::INFINITY; + } + // Spacing of binary16 values around `a`: 2^(e - 10), with subnormals at 2^-24. + let e = a.log2().floor().max(-14.0); + let mut e = e as i32; + if 2f64.powi(e) > a { + e -= 1; + } + let e = e.max(-14); + let ulp = 2f64.powi(e - 10); + let q = a / ulp; + let r = q.round(); + let r = if (q - q.trunc()) == 0.5 && r % 2.0 != 0.0 { + r - 1.0 + } else { + r + }; + sign * r * ulp +} + +// Math.sumPrecise: a port of JavaScriptCore's small xsum accumulator (WTF PreciseSum, after Radford Neal's xsum), +// so results match the reference's host bit for bit, including its rounding of negative sums. +const XM_BITS: i64 = 52; +const XE_MASK: i64 = (1 << 11) - 1; +const XM_MASK: i64 = (1 << XM_BITS) - 1; +const XE_BIAS: i64 = (1 << 10) - 1; +const XSIGN: i64 = i64::MIN; +const XLOW_EXP_BITS: i64 = 5; +const XLOW_EXP_MASK: i64 = (1 << XLOW_EXP_BITS) - 1; +const XSCHUNKS: usize = (1 << (11 - XLOW_EXP_BITS)) + 3; +const XLOW_M_BITS: i64 = 1 << XLOW_EXP_BITS; +const XLOW_M_MASK: i64 = (1i64 << XLOW_M_BITS) - 1; +const XCARRY_TERMS: i64 = (1 << (63 - XM_BITS)) - 1; + +struct Xsum { + chunk: [i64; XSCHUNKS], + adds_until_propagate: i64, + inf: i64, + nan: i64, + count: usize, + has_pos: bool, +} + +impl Xsum { + fn new() -> Xsum { + Xsum { + chunk: [0; XSCHUNKS], + adds_until_propagate: XCARRY_TERMS, + inf: 0, + nan: 0, + count: 0, + has_pos: false, + } + } + + fn add_inf_nan(&mut self, ivalue: i64) { + let mantissa = ivalue & XM_MASK; + if mantissa == 0 { + if self.inf == 0 { + self.inf = ivalue; + } else if self.inf != ivalue { + self.inf = f64::NAN.to_bits() as i64; + } + } else if (self.nan & XM_MASK) <= mantissa { + self.nan = ivalue & !XSIGN; + } + } + + fn carry_propagate(&mut self) -> usize { + let mut u = XSCHUNKS as i64 - 1; + while 0 <= u && self.chunk[u as usize] == 0 { + if u == 0 { + self.adds_until_propagate = XCARRY_TERMS - 1; + return 0; + } + u -= 1; + } + let mut i: i64 = 0; + let mut uix: i64 = -1; + loop { + let mut cv; + loop { + cv = self.chunk[i as usize]; + if cv != 0 { + break; + } + i += 1; + if i > u { + break; + } + } + if i > u { + break; + } + let chigh = cv >> XLOW_M_BITS; + if chigh == 0 { + uix = i; + i += 1; + if i > u { + break; + } + continue; + } + if u == i { + if chigh == -1 { + uix = i; + break; + } + u = i + 1; + } + let clow = cv & XLOW_M_MASK; + if clow != 0 { + uix = i; + } + self.chunk[i as usize] = clow; + if i + 1 >= XSCHUNKS as i64 { + self.add_inf_nan((XE_MASK << XM_BITS) | XM_MASK); + u = i; + } else { + self.chunk[i as usize + 1] = self.chunk[i as usize + 1].wrapping_add(chigh); + } + i += 1; + if i > u { + break; + } + } + if uix < 0 { + self.adds_until_propagate = XCARRY_TERMS - 1; + return 0; + } + while self.chunk[uix as usize] == -1 && uix > 0 { + self.chunk[uix as usize - 1] = + self.chunk[uix as usize - 1].wrapping_add(-(1i64 << XLOW_M_BITS)); + self.chunk[uix as usize] = 0; + uix -= 1; + } + self.adds_until_propagate = XCARRY_TERMS - 1; + uix as usize + } + + fn add(&mut self, value: f64) { + self.count += 1; + self.has_pos = self.has_pos || !value.is_sign_negative(); + if self.adds_until_propagate == 0 { + self.carry_propagate(); + } + let ivalue = value.to_bits() as i64; + let exp = (ivalue >> XM_BITS) & XE_MASK; + let mut mantissa = ivalue & XM_MASK; + let high = (exp >> XLOW_EXP_BITS) as usize; + let mut low = exp & XLOW_EXP_MASK; + if exp == 0 { + if mantissa == 0 { + self.adds_until_propagate -= 1; + return; + } + low = 1; + } else if exp == XE_MASK { + self.add_inf_nan(ivalue); + self.adds_until_propagate -= 1; + return; + } else { + mantissa |= 1 << XM_BITS; + } + let lo = (((mantissa as u64) << low) as i64) & XLOW_M_MASK; + let hi = mantissa >> (XLOW_M_BITS - low); + if ivalue < 0 { + self.chunk[high] = self.chunk[high].wrapping_sub(lo); + self.chunk[high + 1] = self.chunk[high + 1].wrapping_sub(hi); + } else { + self.chunk[high] = self.chunk[high].wrapping_add(lo); + self.chunk[high + 1] = self.chunk[high + 1].wrapping_add(hi); + } + self.adds_until_propagate -= 1; + } + + fn compute(&mut self) -> f64 { + if self.nan != 0 { + return f64::from_bits(self.nan as u64); + } + if self.inf != 0 { + return f64::from_bits(self.inf as u64); + } + if self.count == 0 { + return -0.0; + } + let i = self.carry_propagate(); + let c = self.chunk; + let mut ivalue = c[i]; + if i <= 1 { + if ivalue == 0 { + return if self.has_pos { 0.0 } else { -0.0 }; + } + if i == 0 { + let mut intv = if 0 <= ivalue { ivalue } else { -ivalue }; + intv >>= 1; + if ivalue < 0 { + intv |= XSIGN; + } + return f64::from_bits(intv as u64); + } + let intv = ivalue + .wrapping_mul(1i64 << (XLOW_M_BITS - 1)) + .wrapping_add(c[0] >> 1); + if intv < 0 { + if intv > -(1i64 << XM_BITS) { + return f64::from_bits(((-intv) | XSIGN) as u64); + } + } else if (intv as u64) < 1u64 << XM_BITS { + return f64::from_bits(intv as u64); + } + } + let fltv = ivalue as f64; + let mut intv = fltv.to_bits() as i64; + let mut e = (intv >> XM_BITS) & XE_MASK; + let mut more = 2 + XM_BITS + XE_BIAS - e; + ivalue = ivalue.wrapping_mul(1i64.wrapping_shl(more as u32)); + let mut j = i as i64 - 1; + let mut lower = c[j as usize]; + if more >= XLOW_M_BITS { + more -= XLOW_M_BITS; + ivalue = ivalue.wrapping_add(lower.wrapping_shl(more as u32)); + j -= 1; + lower = if j < 0 { 0 } else { c[j as usize] }; + } + ivalue = ivalue.wrapping_add(lower >> (XLOW_M_BITS - more)); + lower &= (1i64 << (XLOW_M_BITS - more)) - 1; + let mut away = false; + let nonzero_below = |mut j: i64| { + while j > 0 { + j -= 1; + if c[j as usize] != 0 { + return true; + } + } + false + }; + if 0 <= ivalue { + intv = 0; + if ivalue & 2 == 0 { + away = false; + } else if ivalue & 1 != 0 || ivalue & 4 != 0 { + away = true; + } else { + if lower == 0 && nonzero_below(j) { + lower = 1; + } + if lower != 0 { + away = true; + } + } + } else { + if (-ivalue) & (1i64 << (XM_BITS + 2)) == 0 { + let pos = 1i64 << (XLOW_M_BITS - 1 - more); + ivalue = ivalue.wrapping_mul(2); + if lower & pos != 0 { + ivalue += 1; + lower &= !pos; + } + e -= 1; + } + intv = XSIGN; + ivalue = -ivalue; + if ivalue & 3 == 3 { + away = true; + } + // The reference's host predates WebKit's fix of this branch (8ee560d748ea): it also rounds a negative + // sum away from zero whenever nothing nonzero lies below the kept bits. Kept for identical results. + if lower == 0 && nonzero_below(j) { + lower = 1; + } + if lower == 0 { + away = true; + } + } + if away { + ivalue += 4; + if ivalue & (1i64 << (XM_BITS + 3)) != 0 { + ivalue >>= 1; + e += 1; + } + } + ivalue >>= 2; + e += ((i as i64) << XLOW_EXP_BITS) - XE_BIAS - XM_BITS; + if e >= XE_MASK { + intv |= XE_MASK << XM_BITS; + return f64::from_bits(intv as u64); + } + intv = intv.wrapping_add((e << XM_BITS).wrapping_add(ivalue & XM_MASK)); + f64::from_bits(intv as u64) + } +} + +/// `Math.sumPrecise` over numbers, as the reference's host computes it. +pub fn sum_precise(values: &[f64]) -> f64 { + let mut x = Xsum::new(); + for v in values { + x.add(*v); + } + x.compute() +} diff --git a/packages/codemode-rust/crates/psychoscript/src/builtins/object.rs b/packages/codemode-rust/crates/psychoscript/src/builtins/object.rs new file mode 100644 index 0000000000000..f4ded2798224b --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/builtins/object.rs @@ -0,0 +1,1705 @@ +//! Object, Function, Error, Boolean, Symbol, JSON, console and the global functions. + +use super::{arg, fuel, this_obj}; +use crate::convert; +use crate::object::*; +use crate::ops::Hint; +use crate::value::{Id, Value, parse_float_prefix, to_int32}; +use crate::vm::{Res, Vm}; + +pub fn setup(vm: &mut Vm) { + let op = vm.realm.object_proto; + let object = vm.ctor("Object", 1, object_ctor, op, Value::Undef); + vm.methods( + object, + &[ + ("keys", 1, object_keys), + ("values", 1, object_values), + ("entries", 1, object_entries), + ("hasOwn", 2, object_has_own), + ("is", 2, object_is), + ("assign", 2, object_assign), + ("freeze", 1, object_freeze), + ("seal", 1, object_seal), + ("preventExtensions", 1, object_prevent_extensions), + ("isFrozen", 1, object_is_frozen), + ("isSealed", 1, object_is_sealed), + ("isExtensible", 1, object_is_extensible), + ("getPrototypeOf", 1, object_get_prototype_of), + ("create", 2, object_create), + ("defineProperty", 3, object_define_property), + ("defineProperties", 2, object_define_properties), + ( + "getOwnPropertyDescriptor", + 2, + object_get_own_property_descriptor, + ), + ( + "getOwnPropertyDescriptors", + 1, + object_get_own_property_descriptors, + ), + ("getOwnPropertyNames", 1, object_get_own_property_names), + ], + ); + vm.methods( + op, + &[ + ("hasOwnProperty", 1, proto_has_own_property), + ("isPrototypeOf", 1, proto_is_prototype_of), + ("propertyIsEnumerable", 1, proto_property_is_enumerable), + ("toString", 0, proto_to_string), + ("toLocaleString", 0, proto_to_locale_string), + ("valueOf", 0, proto_value_of), + ], + ); + + let fp = vm.realm.function_proto; + vm.methods( + fp, + &[ + ("call", 1, function_call), + ("apply", 2, function_apply), + ("bind", 1, function_bind), + ], + ); + // AddRestrictedFunctionProperties: functions have no `caller` or `arguments` of their own. Each half is a native + // of its own, which built-ins read without running program code. + for (key, get, set) in [ + ("caller", "get caller", "set caller"), + ("arguments", "get arguments", "set arguments"), + ] { + let g = vm.native_fn(get, 0, restricted, Value::Undef); + let s = vm.native_fn(set, 1, restricted, Value::Undef); + let pair = vm.new_pair(g, s); + let k = vm.atoms.intern_static(key); + vm.heap[fp as usize].props.push_new(k, pair, ACCESSOR); + } + // So a write to a function's `caller` or `arguments` finds the accessor (see `Vm::inherited_accessor`). + vm.heap[fp as usize].flags |= ACCESSORS; + vm.ctor("Function", 1, function_ctor, fp, Value::Undef); + + let errors = [ + ("Error", vm.realm.error_proto), + ("TypeError", vm.realm.type_error_proto), + ("RangeError", vm.realm.range_error_proto), + ("SyntaxError", vm.realm.syntax_error_proto), + ("ReferenceError", vm.realm.reference_error_proto), + ("AggregateError", vm.realm.aggregate_error_proto), + ]; + let (nk, mk) = (vm.names.name, vm.names.message); + let mut error_ctor_id = 0; + for (name, proto) in errors { + let f: crate::vm::NativeFn = if name == "AggregateError" { + aggregate_error_ctor + } else { + error_ctor + }; + // `name` and `message` come before `constructor`, as the reference defines them. + let (n, m) = (vm.static_str(name), vm.static_str("")); + vm.define_hidden(proto, nk, n); + vm.define_hidden(proto, mk, m); + let c = vm.ctor(name, 1, f, proto, Value::Obj(proto)); + if name == "Error" { + error_ctor_id = c; + vm.method(c, "isError", 1, error_is_error); + } else { + vm.heap[c as usize].proto = Some(error_ctor_id); + } + } + for name in ["EvalError", "URIError"] { + let ep = vm.realm.error_proto; + let proto = vm.plain(ep); + let (n, m) = (vm.static_str(name), vm.static_str("")); + vm.define_hidden(proto, nk, n); + vm.define_hidden(proto, mk, m); + let c = vm.ctor(name, 1, error_ctor, proto, Value::Obj(proto)); + vm.heap[c as usize].proto = Some(error_ctor_id); + if name == "URIError" { + vm.realm.std.uri_error = proto; + } + } + let ep = vm.realm.error_proto; + vm.method(ep, "toString", 0, error_to_string); + + let bp = vm.realm.boolean_proto; + vm.ctor("Boolean", 1, boolean_ctor, bp, Value::Undef); + vm.methods( + bp, + &[ + ("toString", 0, boolean_to_string), + ("valueOf", 0, boolean_value_of), + ], + ); + + let sp = vm.realm.symbol_proto; + // `Symbol` is neither a callback nor a constructor: `new Symbol()` asks for a call instead, as the reference does. + // It has no `prototype`: a symbol's members are not reachable. + let symbol = vm + .native_fn("Symbol", 0, symbol_ctor, Value::Undef) + .as_obj() + .unwrap_or(0); + vm.global("Symbol", Value::Obj(symbol)); + vm.heap[symbol as usize].flags |= NOT_CALLBACK; + vm.constant(symbol, "asyncIterator", Value::Sym(1)); + vm.constant(symbol, "iterator", Value::Sym(0)); + vm.methods(sp, &[("toString", 0, symbol_to_string)]); + + let json = vm.new_object(); + vm.methods( + json, + &[("parse", 2, json_parse), ("stringify", 3, json_stringify)], + ); + vm.global("JSON", Value::Obj(json)); + + let console = vm.new_object(); + vm.methods( + console, + &[ + ("log", 0, console_log), + ("info", 0, console_log), + ("debug", 0, console_debug), + ("warn", 0, console_warn), + ("error", 0, console_error), + ("dir", 0, console_dir), + ("table", 0, console_table), + ], + ); + vm.global("console", Value::Obj(console)); + + let parse_int = vm.native_fn("parseInt", 2, global_parse_int, Value::Undef); + let parse_float = vm.native_fn("parseFloat", 1, global_parse_float, Value::Undef); + vm.global("parseInt", parse_int); + vm.global("parseFloat", parse_float); + let is_nan = vm.native_fn("isNaN", 1, global_is_nan, Value::Undef); + let is_finite = vm.native_fn("isFinite", 1, global_is_finite, Value::Undef); + vm.global("isNaN", is_nan); + vm.global("isFinite", is_finite); +} + +// ---------- Object ---------- + +fn object_ctor(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + match arg(args, 0) { + Value::Undef | Value::Null => Ok(Value::Obj(vm.new_object())), + Value::Obj(id) if !vm.is_namespace(id) => Ok(Value::Obj(id)), + // The reference names the host's typeof, which is "object" for a namespace. + v => { + let t = match v { + Value::Obj(_) => "object", + v => vm.type_of(&v), + }; + Err(vm.type_error(&format!( + "Object({t}) wrapper objects are not supported; use the primitive value directly." + ))) + } + } +} + +fn entries_of(vm: &mut Vm, label: &str, v: &Value) -> Result, Value> { + vm.enumerable_source(label, v)?; + Ok(match v { + // Each getter runs in key order, and a key's enumerability is checked when it is reached (the reference's + // `objectEntries`). + Value::Obj(id) if vm.heap[*id as usize].flags & ACCESSORS != 0 => { + let id = *id; + vm.copy_data_calling(0, id, &[], true)? + .into_iter() + .map(|(k, v)| (Value::Str(vm.atoms.atom_str(k)), v)) + .collect() + } + Value::Obj(id) => { + let id = *id; + vm.own_entries(id) + .into_iter() + .map(|(k, v)| (Value::Str(vm.atoms.atom_str(k)), v)) + .collect() + } + Value::Str(s) => { + let units = vm.atoms.sref(*s).utf16(); + units + .iter() + .enumerate() + .map(|(i, c)| (vm.string_val(i.to_string()), vm.char_str(*c))) + .collect() + } + _ => Vec::new(), + }) +} + +fn object_keys(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let v = arg(args, 0); + // A namespace lists its names. + if let Value::Obj(id) = v + && (vm.is_namespace(id) || !vm.is_promise(id)) + { + let keys = match vm.is_namespace(id) { + true => vm.namespace_names(id)?, + false => vm.own_keys(id), + }; + let items = keys + .into_iter() + .map(|k| Value::Str(vm.atoms.atom_str(k))) + .collect(); + return Ok(vm.new_array(items)); + } + let items = entries_of(vm, "Object.keys(...)", &v)? + .into_iter() + .map(|(k, _)| k) + .collect(); + Ok(vm.new_array(items)) +} + +fn object_values(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let items = entries_of(vm, "Object.values(...)", &arg(args, 0))? + .into_iter() + .map(|(_, v)| v) + .collect(); + Ok(vm.new_array(items)) +} + +fn object_entries(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let pairs = entries_of(vm, "Object.entries(...)", &arg(args, 0))?; + let items = pairs + .into_iter() + .map(|(k, v)| vm.new_array(vec![k, v])) + .collect(); + Ok(vm.new_array(items)) +} + +fn object_assign(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let target = arg(args, 0); + let t = match target { + Value::Obj(t) if !vm.is_namespace(t) => t, + _ => { + let d = super::describe_value(vm, &target); + return Err(vm.type_error(&format!( + "Object.assign expects a data object or array target, received {d}." + ))); + } + }; + for src in args.iter().skip(1) { + if !src.is_nullish() { + vm.enumerable_source("Object.assign(...)", src)?; + } + } + // Program getters on a source or setters on the target's chain: Get then Set, key by key (the reference's + // `objectAssign`). + let calling = vm.accessors_on_chain(t) + || args + .iter() + .skip(1) + .any(|s| matches!(s, Value::Obj(id) if vm.heap[*id as usize].flags & ACCESSORS != 0)); + if calling { + for src in args.iter().skip(1) { + match src { + Value::Obj(s) => { + let s = *s; + for k in vm.own_property_keys(s) { + if !vm.own_slot(s, k).is_some_and(|x| x.enumerable) { + continue; + } + let v = vm.get_calling(s, k)?; + vm.check_assignment_at(&target, k, &v)?; + vm.op_access = true; + let r = vm.set_obj(t, k, v); + vm.op_access = false; + r?; + if let Some(setter) = vm.setter_hit.take() { + vm.call(&setter, target, &[v])?; + } + } + } + Value::Str(_) => vm.copy_props(t, src, &[])?, + _ => {} + } + } + return Ok(target); + } + for src in args.iter().skip(1) { + if src.is_nullish() { + continue; + } + if let Value::Obj(s) = src { + let mut entries = vm.own_entries(*s); + entries.extend(vm.own_symbol_entries(*s)); + // The reference sets the fields as they are, on a promise too. + let promise = vm.is_promise(t); + for (k, v) in entries { + vm.reject_circular(t, &v, "Object.assign result")?; + if promise { + vm.define(t, k, v); + } else { + vm.set_obj(t, k, v)?; + } + } + } else { + vm.copy_props(t, src, &[])?; + } + } + Ok(target) +} + +pub(crate) fn object_from_entries(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + // The reference's for...of over the entries: each entry is read as it comes, and a bad one closes the iterator. + // Its fuel is the prelude's `Object$fromEntries` (see `fuel.rs`). + fuel::method(vm); + let source = arg(args, 0); + if !vm.is_iterable(&source) { + return Err(vm.not_iterable(&source, crate::bytecode::ITER_FOR_OF)); + } + let id = vm.new_object(); + crate::native::enter_for_of_sub( + vm, + crate::native::NativeOp::Callbacks, + SUB_FROM_ENTRIES, + callee, + Value::Undef, + source, + &[Value::Obj(id), Value::Undef], + ) +} + +/// `Object.fromEntries` over its entries: its own slots are the object it fills and the value of an entry whose key +/// is converted by a call. +struct FromEntries; + +impl crate::native::ForOf for FromEntries { + fn item(vm: &mut Vm, fr: crate::native::Frame, x: Value) -> Result { + // One entry: `$IsObject`, `String` of its key, `$Define`. + fuel::native(vm); + if !matches!(x, Value::Obj(_)) || contains_opaque(vm, &x, &mut Vec::new()) { + return Err(vm.type_error("Object.fromEntries expects [key, value] entry objects.")); + } + let k = vm.get_elem(&x, &Value::Num(0.0))?; + let v = vm.get_elem(&x, &Value::Num(1.0))?; + if vm.converts_by_call(&k, Hint::String) { + fr.set(vm, crate::native::FOR_OF_SLOTS + 1, v); + let step = super::convert_catching(vm, fr, k, Hint::String)?; + return Ok(crate::native::Flow::Call(step)); + } + define_entry(vm, fr, &k, v)?; + Ok(crate::native::Flow::Next) + } + + fn returned( + vm: &mut Vm, + fr: crate::native::Frame, + r: crate::value::Slot, + ) -> Result { + let v = fr.get(vm, crate::native::FOR_OF_SLOTS + 1); + define_entry(vm, fr, &r.get(), v)?; + Ok(crate::native::Flow::Next) + } + + fn finish(vm: &mut Vm, fr: crate::native::Frame) -> Res { + vm.bytecode_builtin(); + Ok(fr.get(vm, crate::native::FOR_OF_SLOTS)) + } +} + +/// An entry's key made a property key, then its value defined. +fn define_entry(vm: &mut Vm, fr: crate::native::Frame, k: &Value, v: Value) -> Result<(), Value> { + let id = fr + .get(vm, crate::native::FOR_OF_SLOTS) + .as_obj() + .unwrap_or(0); + let a = vm.key_of(k)?; + fuel::native(vm); + vm.define(id, a, v); + fuel::native(vm); + Ok(()) +} + +fn object_has_own(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let o = arg(args, 0); + vm.enumerable_source("Object.hasOwn(...)", &o)?; + let k = vm.key_of(&arg(args, 1))?; + Ok(Value::Bool(match o { + Value::Obj(id) => vm.has_own(id, k), + // A string reads as the array of its characters. + Value::Str(s) => { + k == vm.names.length + || vm + .atoms + .index(k) + .is_some_and(|i| (i as usize) < vm.atoms.sref(s).len16()) + } + _ => false, + })) +} + +fn set_flags(vm: &mut Vm, args: &[Value], flags: u8) -> Res { + let v = arg(args, 0); + if let Value::Obj(id) = v { + vm.heap[id as usize].flags |= flags; + } + Ok(v) +} + +fn has_flags(vm: &mut Vm, args: &[Value], flags: u8, primitive: bool) -> Res { + Ok(Value::Bool(match arg(args, 0) { + // A namespace is no object: as a primitive, it is frozen and sealed. + Value::Obj(id) if !vm.is_namespace(id) => { + let o = &vm.heap[id as usize]; + if o.flags & flags == flags { + true + } else if flags == NON_EXTENSIBLE || o.flags & NON_EXTENSIBLE == 0 { + false + } else { + // Not extensible, and every own property as `freeze` or `seal` would leave it. + let frozen = flags == FROZEN; + let keys = vm.own_property_keys(id); + keys.into_iter().all(|k| { + vm.own_slot(id, k).is_some_and(|s| { + !s.configurable + && !(frozen + && s.writable + && matches!(s.value, crate::accessors::SlotValue::Data(_))) + }) + }) + } + } + _ => primitive, + })) +} + +fn object_freeze(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + set_flags(vm, args, FROZEN | SEALED | NON_EXTENSIBLE) +} +fn object_is_frozen(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + has_flags(vm, args, FROZEN, true) +} +fn object_seal(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + set_flags(vm, args, SEALED | NON_EXTENSIBLE) +} +fn object_is_sealed(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + has_flags(vm, args, SEALED, true) +} +fn object_prevent_extensions(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + set_flags(vm, args, NON_EXTENSIBLE) +} +fn object_is_extensible(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + Ok(Value::Bool(match arg(args, 0) { + Value::Obj(id) if !vm.is_namespace(id) => vm.heap[id as usize].flags & NON_EXTENSIBLE == 0, + _ => false, + })) +} + +fn object_create(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let proto = match arg(args, 0) { + Value::Obj(p) if !vm.is_namespace(p) => Some(p), + Value::Null => None, + _ => return Err(vm.type_error("Object prototype may only be an Object or null.")), + }; + if matches!(arg(args, 1), Value::Undef) { + return Ok(Value::Obj(vm.alloc(Obj::new(proto, Kind::Ordinary)))); + } + let props = arg(args, 1); + vm.reading(|vm| { + let id = vm.alloc(Obj::new(proto, Kind::Ordinary)); + define_properties(vm, id, &props) + }) +} + +/// The target `Object.defineProperty` and `defineProperties` define on. +fn require_target(vm: &mut Vm, v: &Value, name: &str) -> Result { + match v { + Value::Obj(id) if !vm.is_namespace(*id) => Ok(*id), + _ => Err(vm.type_error(&format!("Object.{name} called on non-object"))), + } +} + +/// ObjectDefineProperties, under `with_reads`: every descriptor is read (getters included) before the first one is +/// defined. +fn define_properties(vm: &mut Vm, id: Id, props: &Value) -> Res { + let descriptors = match props { + Value::Undef | Value::Null => { + let t = if let Value::Null = props { + "null" + } else { + "undefined" + }; + return Err(vm.type_error(&format!("Cannot convert {t} to object"))); + } + Value::Obj(p) if !vm.is_namespace(*p) => { + let p = *p; + let keys = vm.own_property_keys(p); + let mut out = Vec::new(); + for key in keys { + if !vm.own_slot(p, key).is_some_and(|s| s.enumerable) { + continue; + } + let d = vm.get_obj(p, key); + let d = if let Value::Uninit = d { + return Err(super::accessor_error(vm, p, key)); + } else { + d + }; + out.push((key, vm.property_descriptor(&d)?)); + } + out + } + Value::Str(s) => { + // ToObject: a string's indexes are its only own enumerable properties. + let s = *s; + let n = vm.atoms.sref(s).len16(); + let mut out = Vec::new(); + for i in 0..n { + let c = match vm.atoms.sref(s).code_unit(i) { + Some(c) => vm.char_str(c), + None => Value::Undef, + }; + let key = vm.atoms.intern(&i.to_string()); + out.push((key, vm.property_descriptor(&c)?)); + } + out + } + _ => Vec::new(), + }; + if vm.reads_pending() { + return Ok(Value::Obj(id)); + } + for (key, desc) in descriptors { + vm.define_or_throw(id, key, &desc)?; + } + Ok(Value::Obj(id)) +} + +fn object_define_property(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let id = require_target(vm, &arg(args, 0), "defineProperty")?; + let key = vm.key_of(&arg(args, 1))?; + let d = arg(args, 2); + vm.reading(|vm| { + let desc = vm.property_descriptor(&d)?; + if vm.reads_pending() { + return Ok(Value::Obj(id)); + } + vm.define_or_throw(id, key, &desc)?; + Ok(Value::Obj(id)) + }) +} + +fn object_define_properties(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let id = require_target(vm, &arg(args, 0), "defineProperties")?; + let props = arg(args, 1); + vm.reading(|vm| define_properties(vm, id, &props)) +} + +/// RequireObjectCoercible for the descriptor readers. +fn require_coercible(vm: &mut Vm, v: &Value, name: &str) -> Result<(), Value> { + match v { + Value::Undef | Value::Null | Value::Uninit => { + let t = if let Value::Null = v { + "null" + } else { + "undefined" + }; + Err(vm.type_error(&format!("Object.{name} cannot convert {t} to an object."))) + } + Value::Obj(id) if vm.is_namespace(*id) => { + let root = vm.namespace_root(*id); + Err(vm.type_error(&format!( + "Object.{name} cannot read {root}: it is a namespace of host functions, not an object." + ))) + } + _ => Ok(()), + } +} + +/// The own properties a primitive has after ToObject, which only a string's are: its indexes and `length`. +fn primitive_slot(vm: &mut Vm, v: &Value, key: Atom) -> Option { + use crate::accessors::{OwnSlot, SlotValue}; + let Value::Str(s) = v else { return None }; + let s = *s; + let n = vm.atoms.sref(s).len16(); + if key == vm.names.length { + return Some(OwnSlot { + value: SlotValue::Data(Value::Num(n as f64)), + writable: false, + enumerable: false, + configurable: false, + }); + } + let i = vm.atoms.index(key)? as usize; + if i >= n { + return None; + } + let c = match vm.atoms.sref(s).code_unit(i) { + Some(c) => vm.char_str(c), + None => Value::Undef, + }; + Some(OwnSlot { + value: SlotValue::Data(c), + writable: false, + enumerable: true, + configurable: false, + }) +} + +fn primitive_keys(vm: &mut Vm, v: &Value) -> Vec { + let Value::Str(s) = v else { return Vec::new() }; + let n = vm.atoms.sref(*s).len16(); + let mut out: Vec = (0..n).map(|i| vm.atoms.intern(&i.to_string())).collect(); + out.push(vm.names.length); + out +} + +fn object_get_own_property_descriptor(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let v = arg(args, 0); + require_coercible(vm, &v, "getOwnPropertyDescriptor")?; + let key = vm.key_of(&arg(args, 1))?; + let slot = match v { + Value::Obj(id) => vm.own_slot(id, key), + _ => primitive_slot(vm, &v, key), + }; + Ok(vm.descriptor_object(slot)) +} + +fn object_get_own_property_descriptors(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let v = arg(args, 0); + require_coercible(vm, &v, "getOwnPropertyDescriptors")?; + let result = vm.new_object(); + let keys = match v { + Value::Obj(id) => vm.own_property_keys(id), + _ => primitive_keys(vm, &v), + }; + for key in keys { + let slot = match v { + Value::Obj(id) => vm.own_slot(id, key), + _ => primitive_slot(vm, &v, key), + }; + let d = vm.descriptor_object(slot); + vm.define(result, key, d); + } + Ok(Value::Obj(result)) +} + +fn object_get_own_property_names(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let v = arg(args, 0); + if let Value::Obj(id) = v + && vm.is_namespace(id) + { + let names: Vec = vm + .namespace_names(id)? + .into_iter() + .map(|k| vm.atom_val(k)) + .collect(); + return Ok(vm.new_array(names)); + } + require_coercible(vm, &v, "getOwnPropertyNames")?; + let keys = match v { + Value::Obj(id) => vm.own_property_keys(id), + _ => primitive_keys(vm, &v), + }; + let names: Vec = keys + .into_iter() + .filter(|k| *k > SYM_ASYNC_ITERATOR) + .map(|k| vm.atom_val(k)) + .collect(); + Ok(vm.new_array(names)) +} + +fn object_get_prototype_of(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + Ok(match arg(args, 0) { + Value::Obj(id) if !vm.is_namespace(id) => vm.heap[id as usize] + .proto + .map(Value::Obj) + .unwrap_or(Value::Null), + Value::Str(_) => Value::Obj(vm.realm.string_proto), + Value::Num(_) => Value::Obj(vm.realm.number_proto), + Value::Bool(_) => Value::Obj(vm.realm.boolean_proto), + v => { + let d = super::describe_value(vm, &v); + return Err(vm.type_error(&format!( + "Object.getPrototypeOf cannot convert {d} to an object." + ))); + } + }) +} + +fn object_is(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let (a, b) = (arg(args, 0), arg(args, 1)); + Ok(Value::Bool(match (&a, &b) { + (Value::Num(x), Value::Num(y)) => { + (x.is_nan() && y.is_nan()) || (x == y && x.is_sign_negative() == y.is_sign_negative()) + } + _ => vm.strict_eq(&a, &b), + })) +} + +/// The receiver of the `Object.prototype` methods that need an object: like the reference, primitives (which JS +/// would box) and namespace references are rejected. +fn object_receiver(vm: &mut Vm, this: &Value, method: &str) -> Result { + if let Value::Obj(id) = this + && !matches!(vm.heap[*id as usize].kind, Kind::Namespace(_)) + { + return Ok(*id); + } + Err(super::incompatible( + vm, + &format!("Object.prototype.{method}"), + this, + )) +} + +fn is_namespace_ref(vm: &Vm, v: &Value) -> bool { + matches!(v, Value::Obj(id) if matches!(vm.heap[*id as usize].kind, Kind::Namespace(_))) +} + +fn proto_has_own_property(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = object_receiver(vm, &this, "hasOwnProperty")?; + let k = vm.key_of(&arg(args, 0))?; + Ok(Value::Bool(vm.has_own(id, k))) +} + +pub fn tag_of(vm: &Vm, v: &Value) -> &'static str { + match v { + Value::Undef | Value::Uninit => "Undefined", + Value::Null => "Null", + Value::Num(_) => "Number", + Value::Str(_) => "String", + Value::Bool(_) => "Boolean", + Value::Sym(_) => "Symbol", + Value::Obj(id) => match &vm.heap[*id as usize].kind { + Kind::Array(_) => "Array", + Kind::Arguments(_) => "Arguments", + Kind::Closure(_) | Kind::Native { .. } | Kind::Bound(_) => "Function", + Kind::Error(_) => "Error", + Kind::Promise(_) => "Promise", + Kind::Map(_) => "Map", + Kind::Set(_) => "Set", + Kind::Generator(_) | Kind::IterHelper(_) => "Generator", + Kind::ArrayIter { .. } => "Array Iterator", + Kind::MapIter { target, .. } => match vm.heap[*target as usize].kind { + Kind::Set(_) => "Set Iterator", + _ => "Map Iterator", + }, + Kind::StrIter { .. } => "String Iterator", + Kind::RegExp(_) => "RegExp", + Kind::Date(_) => "Date", + Kind::Bytes(_) => "Uint8Array", + Kind::WeakMap(_) => "WeakMap", + Kind::Url(_) => "URL", + Kind::SearchParams(_) => "URLSearchParams", + Kind::Headers(_) => "Headers", + Kind::WeakSet(_) => "WeakSet", + Kind::ExoticIter { target, .. } => match vm.heap[*target as usize].kind { + Kind::Bytes(_) => "Array Iterator", + Kind::SearchParams(_) => "URLSearchParams Iterator", + Kind::Headers(_) => "Headers Iterator", + _ => "Iterator", + }, + _ => "Object", + }, + } +} + +fn proto_to_string(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + if let Value::Obj(id) = this + && let Kind::Error(_) = vm.heap[id as usize].kind + { + return Ok(vm.static_str("[object Error]")); + } + // The reference has no tag of its own for a symbol. + if let Value::Sym(_) = this { + return Ok(vm.static_str("[object Object]")); + } + let t = format!("[object {}]", tag_of(vm, &this)); + Ok(vm.static_str(&t)) +} + +fn proto_to_locale_string(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + // A symbol has no prototype to find the method on, as null and undefined have none. + if this.is_nullish() || is_namespace_ref(vm, &this) || matches!(this, Value::Sym(_)) { + return Err(vm.type_error("Object.prototype.toLocaleString called on null or undefined.")); + } + let k = vm.names.to_string; + let f = vm.get(&this, k)?; + // The reference hands on to `toString` as `call` does (`invokeMethod`). + invoke(vm, callee, f, this, &[]) +} + +fn proto_value_of(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + if this.is_nullish() { + return Err(vm.type_error("Object.prototype.valueOf called on null or undefined.")); + } + Ok(this) +} + +fn proto_is_prototype_of(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let p = object_receiver(vm, &this, "isPrototypeOf")?; + let Value::Obj(mut cur) = arg(args, 0) else { + return Ok(Value::Bool(false)); + }; + while let Some(next) = vm.heap[cur as usize].proto { + if next == p { + return Ok(Value::Bool(true)); + } + cur = next; + } + Ok(Value::Bool(false)) +} + +fn proto_property_is_enumerable(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = object_receiver(vm, &this, "propertyIsEnumerable")?; + let k = vm.key_of(&arg(args, 0))?; + let o = &vm.heap[id as usize]; + // A sparse array's far elements are properties, read below. + if let Kind::Array(items) = &o.kind + && let Some(i) = vm.atoms.index(k) + && items + .get(i as usize) + .is_some_and(|v| !matches!(v, Value::Uninit)) + { + return Ok(Value::Bool(true)); + } + Ok(Value::Bool( + o.props + .find(k) + .is_some_and(|i| o.props.items[i].flags & ENUMERABLE != 0), + )) +} + +// ---------- Function ---------- + +fn function_ctor(vm: &mut Vm, _this: Value, _args: &[Value], _: Id) -> Res { + Err(vm.type_error("Function() is not supported; write a function expression instead")) +} + +/// The receiver of `Function.prototype.call`, `apply` or `bind`, which must be callable. +fn function_receiver(vm: &mut Vm, this: &Value, method: &str) -> Result<(), Value> { + if vm.is_callable(this) && !matches!(this, Value::Obj(id) if vm.is_namespace(*id)) { + return Ok(()); + } + let d = vm.describe_data(this); + Err(vm.type_error(&format!( + "Function.prototype.{method} called on incompatible receiver {d}." + ))) +} + +fn function_call(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + function_receiver(vm, &this, "call")?; + let rest = if args.is_empty() { &[][..] } else { &args[1..] }; + invoke(vm, callee, this, arg(args, 0), rest) +} + +/// Calls `f` as the reference's `call` and `apply` do: they cost a native call before they hand on to `f`, which +/// costs what a call of it from bytecode costs (see `fuel.rs`). The call is made from a native frame. +fn invoke(vm: &mut Vm, callee: Id, f: Value, this: Value, args: &[Value]) -> Res { + super::fuel::native(vm); + let mut slots = vec![f, this, Value::Num(args.len() as f64)]; + slots.extend_from_slice(args); + vm.enter_native( + crate::native::NativeOp::Invoke, + callee, + Value::Undef, + &slots, + ) +} + +/// The step of `call` and `apply`'s frame: its slots are the function, the receiver, the argument count and the +/// arguments. +pub(crate) fn invoke_step( + vm: &mut Vm, + fr: crate::native::Frame, + input: crate::native::Input, +) -> Result { + use crate::native::{Input, Step}; + match input { + Input::Start => { + let (f, this, argc) = (fr.slot(vm, 0), fr.slot(vm, 1), fr.index(vm, 2)); + let at = fr.base() + 3; + let args: Vec<_> = vm.stack[at..at + argc].to_vec(); + vm.stack.extend_from_slice(&[f, this]); + vm.stack.extend_from_slice(&args); + vm.native_call(argc) + } + Input::Returned(r) => { + vm.bytecode_builtin(); + Ok(Step::Done(r.get())) + } + Input::Threw(e) => Err(e), + Input::Finished(_) => Ok(Step::Done(Value::Undef)), + } +} + +fn function_apply(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + function_receiver(vm, &this, "apply")?; + let list = match arg(args, 1) { + Value::Undef | Value::Null => Vec::new(), + Value::Obj(id) if !vm.is_namespace(id) => { + vm.reading(|vm| array_like(vm, &Value::Obj(id)))? + } + _ => { + return Err( + vm.type_error("Function.prototype.apply expects an array-like argument list.") + ); + } + }; + invoke(vm, callee, this, arg(args, 0), &list) +} + +pub fn array_like(vm: &mut Vm, v: &Value) -> Result, Value> { + let Value::Obj(id) = v else { + return Ok(Vec::new()); + }; + if let Kind::Array(_) = &vm.heap[*id as usize].kind { + vm.densify(*id)?; + if let Kind::Array(items) = &vm.heap[*id as usize].kind { + return Ok(crate::ops::without_holes(items)); + } + } + let lk = vm.names.length; + let len = vm.get_obj(*id, lk); + let n = crate::value::to_integer(vm.number_of(&len)?) + .clamp(0.0, crate::ops::MAX_ARRAY_LEN as f64) as usize; + let mut out = Vec::with_capacity(n); + for i in 0..n { + out.push(vm.get_elem(v, &Value::Num(i as f64))?); + } + Ok(out) +} + +fn function_bind(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + function_receiver(vm, &this, "bind")?; + let rest: Vec = args.iter().skip(1).cloned().collect(); + // Like the reference: `bound `, and the target's length less the bound arguments, at least 0. + let (lk, nk) = (vm.names.length, vm.names.name); + // The target's `length` and `name` through their getters, read ahead (`Vm::with_reads`). + let (len, nm) = vm.reading(|vm| Ok((vm.get(&this, lk)?, vm.get(&this, nk)?)))?; + let length = match len { + Value::Num(n) if n == f64::INFINITY => n, + Value::Num(n) if n.is_finite() => (n.trunc() - rest.len() as f64).max(0.0), + _ => 0.0, + }; + let name = match nm { + Value::Str(s) => format!("bound {}", vm.text(s)), + _ => "bound ".to_owned(), + }; + let fp = vm.realm.function_proto; + let id = vm.alloc(Obj::new( + Some(fp), + Kind::Bound(Box::new((this, arg(args, 0), rest))), + )); + let name = vm.string_val(name); + vm.heap[id as usize].props.insert(lk, Value::Num(length), 0); + vm.heap[id as usize].props.insert(nk, name, 0); + Ok(Value::Obj(id)) +} + +// ---------- Error ---------- + +fn make_error_from(vm: &mut Vm, proto: Id, message: &Value, options: &Value) -> Res { + let id = vm.alloc(Obj::new(Some(proto), Kind::Error(None))); + if !matches!(message, Value::Undef) { + let m = vm.string_of(message)?; + let mk = vm.names.message; + vm.define_hidden(id, mk, Value::Str(m)); + } + if let Value::Obj(o) = *options { + let ck = vm.names.cause; + // A program getter for `cause` is read ahead (`Vm::with_reads`). + let cause = vm.reading(|vm| { + Ok(if vm.has_key(o, ck) { + Some(vm.get_obj(o, ck)) + } else { + None + }) + })?; + if let Some(c) = cause { + vm.define_hidden(id, ck, c); + } + } + Ok(Value::Obj(id)) +} + +/// The prototype a constructed error gets: its type's, or for `super(...)` in a class its new target's own +/// `prototype` (the reference's `prototypeFrom`). +fn error_proto(vm: &mut Vm, callee: Id, fallback: Id) -> Id { + let proto = vm.native_data(callee).as_obj().unwrap_or(fallback); + let Some(nt) = vm.new_target.take() else { + return proto; + }; + match vm.heap[nt as usize].props.prop(vm.names.prototype) { + Some(p) if p.flags & ACCESSOR == 0 => p.value.as_obj().unwrap_or(proto), + _ => proto, + } +} + +/// Whether `id` is an error type's constructor, which a class may extend. +pub(crate) fn is_error_ctor(vm: &Vm, id: Id) -> bool { + matches!(&vm.heap[id as usize].kind, Kind::Native { f, .. } + if std::ptr::fn_addr_eq(*f, error_ctor as crate::vm::NativeFn) + || std::ptr::fn_addr_eq(*f, aggregate_error_ctor as crate::vm::NativeFn)) +} + +fn error_ctor(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let proto = error_proto(vm, callee, vm.realm.error_proto); + let mut c = fuel::Conversions::default(); + let message = error_message(vm, &mut c, arg(args, 0))?; + let r = make_error_from(vm, proto, &message, &arg(args, 1)); + c.finish(vm, r) +} + +/// An error constructor's message, when there is one, is its list of conversions, made a string. +fn error_message(vm: &mut Vm, c: &mut fuel::Conversions, message: Value) -> Res { + let mut m = [message]; + if !matches!(message, Value::Undef) { + c.convert(vm, &[Hint::String], &mut m, true)?; + } + Ok(m[0]) +} + +fn aggregate_error_ctor(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let proto = error_proto(vm, callee, vm.realm.aggregate_error_proto); + let mut c = fuel::Conversions::default(); + let message = error_message(vm, &mut c, arg(args, 1))?; + let e = make_error_from(vm, proto, &message, &arg(args, 2))?; + // The errors are read in the reference's prelude (`aggregateError`), after the call itself when it is not `new`. + let called = !matches!(this, Value::Uninit); + if called { + c.handoff(vm); + } else { + fuel::method(vm); + } + let source = arg(args, 0); + if !vm.is_iterable(&source) { + return Err(vm.not_iterable(&source, crate::bytecode::ITER_FOR_OF)); + } + let errors = vm.new_array(Vec::new()); + let own = [e, errors, Value::Bool(called)]; + crate::native::enter_for_of_sub( + vm, + crate::native::NativeOp::Callbacks, + SUB_AGGREGATE, + callee, + Value::Undef, + source, + &own, + ) +} + +/// `AggregateError` reading its errors: its own slots are the error, the errors read so far (an internal array) and +/// whether it was called without `new`. +struct Aggregate; + +impl crate::native::ForOf for Aggregate { + fn item(vm: &mut Vm, fr: crate::native::Frame, x: Value) -> Result { + let errors = fr.get(vm, crate::native::FOR_OF_SLOTS + 1).as_obj(); + if let Some(errors) = errors + && let Kind::Array(items) = &mut vm.heap[errors as usize].kind + { + items.push(x); + } + Ok(crate::native::Flow::Next) + } + + fn finish(vm: &mut Vm, fr: crate::native::Frame) -> Res { + let base = crate::native::FOR_OF_SLOTS; + let (e, errors) = (fr.get(vm, base), fr.get(vm, base + 1)); + fuel::native(vm); + if let Value::Obj(id) = e { + let ek = vm.names.errors; + vm.define_hidden(id, ek, errors); + } + if vm.truthy(&fr.get(vm, base + 2)) { + vm.bytecode_builtin(); + } + Ok(e) + } +} + +fn error_is_error(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + Ok(Value::Bool( + matches!(arg(args, 0), Value::Obj(id) if matches!(vm.heap[id as usize].kind, Kind::Error(_))), + )) +} + +fn error_to_string(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let id = this_obj(vm, &this, "Error.prototype.toString")?; + // `name` and `message` through their getters, read ahead (`Vm::with_reads`). + let (nk, mk) = (vm.names.name, vm.names.message); + let (name, message) = vm.reading(|vm| Ok((vm.get_obj(id, nk), vm.get_obj(id, mk))))?; + let name = match name { + Value::Undef => "Error".to_owned(), + v => vm.quiet_string(&v), + }; + let message = match message { + Value::Undef => String::new(), + v => vm.quiet_string(&v), + }; + let s = if message.is_empty() { + name + } else if name.is_empty() { + message + } else { + format!("{name}: {message}") + }; + Ok(vm.string_val(s)) +} + +// ---------- Boolean and Symbol ---------- + +fn boolean_ctor(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + if let Value::Uninit = this { + return Err(vm.type_error( + "new Boolean(...) is not supported; call Boolean(...) without new instead.", + )); + } + Ok(Value::Bool(vm.truthy(&arg(args, 0)))) +} + +fn this_bool(vm: &mut Vm, this: &Value) -> Result { + match this { + Value::Bool(b) => Ok(*b), + _ => Err(vm.type_error("Boolean.prototype method called on an incompatible receiver")), + } +} + +fn boolean_to_string(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let b = this_bool(vm, &this)?; + Ok(vm.static_str(if b { "true" } else { "false" })) +} + +fn boolean_value_of(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + Ok(Value::Bool(this_bool(vm, &this)?)) +} + +fn symbol_ctor(vm: &mut Vm, _this: Value, _args: &[Value], _: Id) -> Res { + Err(vm.type_error( + "Symbol is not callable; only Symbol.asyncIterator and Symbol.iterator are available.", + )) +} + +fn symbol_to_string(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let s = if let Value::Sym(s) = this { s } else { 0 }; + Ok(vm.atom_val(s)) +} + +// ---------- JSON ---------- + +fn json_parse(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let mut c = fuel::Conversions::default(); + let r = parse(vm, &mut c, args, callee); + c.finish(vm, r) +} + +/// `JSON.parse` after its text, a list of conversions of its own. +fn parse(vm: &mut Vm, c: &mut fuel::Conversions, args: &[Value], callee: Id) -> Res { + let mut text = [arg(args, 0)]; + c.convert(vm, &[Hint::String], &mut text, false)?; + let text = vm.string_of(&text[0])?; + let text = vm.text(text).to_owned(); + let v = convert::parse(vm, &text)?; + let reviver = arg(args, 1); + if vm.type_of(&reviver) != "function" { + return Ok(v); + } + let reviver = super::require_callback(vm, &reviver, "JSON.parse")?; + let holder = vm.new_object(); + let empty = vm.atoms.intern_static(""); + vm.define(holder, empty, v); + // The reference revives in its prelude (`revive`), after `JSON.parse`'s own call. + c.call(vm); + let key = vm.static_str(""); + let op = crate::native::NativeOp::Revive; + vm.enter_native(op, callee, Value::Undef, &[reviver, Value::Num(0.0)])?; + push_level(vm, Value::Obj(holder), key); + Ok(Value::Undef) +} + +// The slots of a reviving frame: the reviver and how many levels deep it is; then, per level, the holder, the key, the +// value, the value's keys (an internal array, or undefined for a primitive) and the next of them to revive. +const REV_F: usize = 0; +const REV_DEPTH: usize = 1; +const REV_LEVELS: usize = 2; +const LEVEL: usize = 5; +const L_HOLDER: usize = 0; +const L_KEY: usize = 1; +const L_VAL: usize = 2; +const L_KEYS: usize = 3; +const L_I: usize = 4; + +/// Pushes a level to revive `key` of `holder`, on top of the frame's slots. +fn push_level(vm: &mut Vm, holder: Value, key: Value) { + vm.stack.extend( + [holder, key, Value::Undef, Value::Undef, Value::Num(0.0)].map(crate::value::Slot::pack), + ); +} + +/// The step of a reviving frame: the prelude's `revive`, entered once per value; an object's `$IsObject` and +/// `$Keys`, a back-edge per key, then the reviver, children first. +pub(crate) fn revive_step( + vm: &mut Vm, + fr: crate::native::Frame, + input: crate::native::Input, +) -> Result { + use crate::native::{Input, Step}; + let mut depth = fr.index(vm, REV_DEPTH); + let at = |depth: usize, k: usize| REV_LEVELS + depth * LEVEL + k; + // Whether the level on top is visited already, its keys walked from `L_I`. + let mut visited = false; + match input { + Input::Start => {} + Input::Returned(nv) => { + let nv = nv.get(); + if depth == 0 { + vm.bytecode_builtin(); + return Ok(Step::Done(nv)); + } + vm.stack.truncate(fr.base() + at(depth, 0)); + depth -= 1; + fr.set_index(vm, REV_DEPTH, depth); + let val = fr.get(vm, at(depth, L_VAL)); + let keys = fr.get(vm, at(depth, L_KEYS)).as_obj().unwrap_or(0); + let i = fr.index(vm, at(depth, L_I)); + let k = match &vm.heap[keys as usize].kind { + Kind::Array(items) => items.get(i).copied().unwrap_or_default(), + _ => Value::Undef, + }; + let k = vm.key_of(&k)?; + if let Value::Undef = nv { + vm.delete(&val, k)?; + } else if let Value::Obj(id) = val { + vm.set_obj(id, k, nv)?; + } + fuel::step(vm); + fr.set_index(vm, at(depth, L_I), i + 1); + visited = true; + } + Input::Threw(e) => return Err(e), + Input::Finished(_) => {} + } + loop { + let (holder, key) = ( + fr.get(vm, at(depth, L_HOLDER)), + fr.get(vm, at(depth, L_KEY)), + ); + if !visited { + fuel::method(vm); + let k = vm.key_of(&key)?; + let val = vm.get(&holder, k)?; + fuel::native(vm); + fr.set(vm, at(depth, L_VAL), val); + if let Value::Obj(id) = val { + let keys: Vec = vm + .own_keys(id) + .into_iter() + .map(|a| vm.atom_val(a)) + .collect(); + fuel::native(vm); + let keys = vm.new_array(keys); + fr.set(vm, at(depth, L_KEYS), keys); + } + } + let val = fr.get(vm, at(depth, L_VAL)); + let next_key = match fr + .get(vm, at(depth, L_KEYS)) + .as_obj() + .map(|k| &vm.heap[k as usize].kind) + { + Some(Kind::Array(items)) => items.get(fr.index(vm, at(depth, L_I))).copied(), + _ => None, + }; + if let Some(k) = next_key { + push_level(vm, val, k); + depth += 1; + fr.set_index(vm, REV_DEPTH, depth); + visited = false; + continue; + } + let f = fr.slot(vm, REV_F); + let (holder, key, val) = ( + crate::value::Slot::pack(holder), + crate::value::Slot::pack(key), + crate::value::Slot::pack(val), + ); + return fr.call_slots(vm, f, holder, [key, val]); + } +} + +fn json_stringify(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let replacer = arg(args, 1); + let mut opts = convert::Stringify { + indent: String::new(), + replacer_fn: None, + allow: None, + }; + if vm.type_of(&replacer) == "function" { + opts.replacer_fn = Some(super::require_callback(vm, &replacer, "JSON.stringify")?); + } else if let Value::Obj(id) = replacer + && matches!(vm.heap[id as usize].kind, Kind::Array(_)) + && vm.densify(id).is_ok() + && let Kind::Array(items) = &vm.heap[id as usize].kind + { + let items = items.clone(); + let mut allow = Vec::new(); + for i in items { + if matches!(i, Value::Str(_) | Value::Num(_)) { + let a = vm.key_of(&i)?; + if !allow.contains(&a) { + allow.push(a); + } + } + } + opts.allow = Some(allow); + } + match arg(args, 2) { + Value::Num(n) => opts.indent = " ".repeat(n.clamp(0.0, 10.0) as usize), + Value::Str(s) => opts.indent = vm.atoms.sref(s).slice16(0, 10), + _ => {} + } + let v = arg(args, 0); + match convert::stringify(vm, &v, &opts)? { + Some(Some(s)) => Ok(vm.string_val(s)), + Some(None) => Ok(Value::Undef), + None => convert::enter_stringify(vm, callee, v, opts), + } +} + +// ---------- console ---------- + +fn log_line(vm: &mut Vm, prefix: &str, args: &[Value]) -> Res { + let mut line = String::from(prefix); + for (i, a) in args.iter().enumerate() { + if i > 0 { + line.push(' '); + } + line.push_str(&convert::format_value(vm, a)); + } + vm.logs.push(line); + Ok(Value::Undef) +} + +fn console_log(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + log_line(vm, "", args) +} +fn console_debug(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + log_line(vm, "[debug] ", args) +} +fn console_warn(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + log_line(vm, "[warn] ", args) +} +fn console_error(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + log_line(vm, "[error] ", args) +} +fn console_dir(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + if args.is_empty() { + vm.logs.push("undefined".into()); + return Ok(Value::Undef); + } + log_line(vm, "", &args[..1]) +} + +/// Whether a value holds an opaque reference (a function, promise, iterator or namespace path) anywhere in the +/// data objects and arrays it contains, as the reference's `containsOpaqueReference` walks it. +fn contains_opaque(vm: &Vm, v: &Value, seen: &mut Vec) -> bool { + let Value::Obj(id) = v else { return false }; + let o = &vm.heap[*id as usize]; + match &o.kind { + Kind::Ordinary | Kind::Error(_) | Kind::Arguments(_) | Kind::Array(_) => {} + Kind::Map(_) + | Kind::Set(_) + | Kind::WeakMap(_) + | Kind::WeakSet(_) + | Kind::Date(_) + | Kind::RegExp(_) + | Kind::Bytes(_) + | Kind::Url(_) + | Kind::SearchParams(_) + | Kind::Headers(_) + | Kind::TextDecoder(_) => return false, + _ => return true, + } + if seen.contains(id) { + return false; + } + seen.push(*id); + // A structural check, so it never runs program code: accessors are left out. + let mut children: Vec = o + .props + .items + .iter() + .filter(|p| p.flags & ACCESSOR == 0) + .map(|p| p.value) + .collect(); + if let Kind::Array(items) | Kind::Arguments(items) = &o.kind { + children.extend(items.iter().copied()); + } + children.iter().any(|c| contains_opaque(vm, c, seen)) +} + +/// A row's cells: an object's own entries (or the chosen columns), or the value itself under `Value`. +fn table_values(vm: &mut Vm, v: &Value, columns: &Option>) -> Vec<(String, Value)> { + if let Value::Obj(id) = v + && !matches!(vm.heap[*id as usize].kind, Kind::Array(_)) + { + return match columns { + Some(cols) => cols + .iter() + .map(|c| { + let k = vm.atoms.intern(c); + let v = match vm.shown_property(*id, k) { + Ok(v) => v, + Err(label) => vm.str_val(label), + }; + (c.clone(), v) + }) + .collect(), + None => vm + .shown_entries(*id) + .into_iter() + .map(|(k, v)| { + let v = match v { + Ok(v) => v, + Err(label) => vm.str_val(label), + }; + (vm.atoms.text(k).to_owned(), v) + }) + .collect(), + }; + } + vec![("Value".to_owned(), *v)] +} + +/// Orders record keys as a JavaScript object would: array indexes ascending, then the rest as first seen. +fn record_keys(keys: Vec) -> Vec { + let mut ints: Vec<(u32, String)> = Vec::new(); + let mut rest: Vec = Vec::new(); + for k in keys { + if ints.iter().any(|(_, x)| x == &k) || rest.contains(&k) { + continue; + } + match crate::value::index_of_key(&k) { + Some(i) => ints.push((i, k)), + None => rest.push(k), + } + } + ints.sort_by_key(|(i, _)| *i); + ints.into_iter().map(|(_, k)| k).chain(rest).collect() +} + +fn console_table(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let data = arg(args, 0); + if let Value::Undef = data { + vm.logs.push("undefined".into()); + return Ok(Value::Undef); + } + if contains_opaque(vm, &data, &mut Vec::new()) { + vm.logs.push("[opaque reference]".into()); + return Ok(Value::Undef); + } + for v in [data, arg(args, 1)] { + if let Value::Obj(id) = v + && matches!(vm.heap[id as usize].kind, Kind::Array(_)) + { + vm.densify(id)?; + } + } + let columns = match arg(args, 1) { + Value::Obj(id) => match &vm.heap[id as usize].kind { + Kind::Array(items) => { + let items = items.clone(); + let mut cols = Vec::with_capacity(items.len()); + for i in items { + cols.push(super::builtin_string(vm, &i)?); + } + Some(cols) + } + _ => None, + }, + _ => None, + }; + let rows: Vec<(String, Vec<(String, Value)>)> = match data { + Value::Obj(id) => match &vm.heap[id as usize].kind { + Kind::Array(items) => { + let items = items.clone(); + items + .iter() + .enumerate() + .map(|(i, item)| (i.to_string(), table_values(vm, item, &columns))) + .collect() + } + _ => { + let entries: Vec<(Atom, Value)> = vm + .shown_entries(id) + .into_iter() + .map(|(k, v)| match v { + Ok(v) => (k, v), + Err(label) => (k, vm.str_val(label)), + }) + .collect(); + entries + .into_iter() + .map(|(k, item)| { + let k = vm.atoms.text(k).to_owned(); + (k, table_values(vm, &item, &columns)) + }) + .collect() + } + }, + v => vec![("0".to_owned(), vec![("Value".to_owned(), v)])], + }; + // Each row's cells read like an object record: later duplicates win, indexes sort first. + let rows: Vec<(String, Vec<(String, Value)>)> = rows + .into_iter() + .map(|(index, cells)| { + let keys = record_keys(cells.iter().map(|(k, _)| k.clone()).collect()); + let cells = keys + .into_iter() + .map(|k| { + let v = cells.iter().rev().find(|(c, _)| c == &k).map(|(_, v)| *v); + (k, v.unwrap_or_default()) + }) + .collect(); + (index, cells) + }) + .collect(); + let keys = match &columns { + Some(c) => c.clone(), + None => { + let mut keys: Vec = Vec::new(); + for (_, cells) in &rows { + for (k, _) in cells { + if !keys.contains(k) { + keys.push(k.clone()); + } + } + } + keys + } + }; + let mut lines = vec![ + std::iter::once("(index)".to_owned()) + .chain(keys.iter().cloned()) + .collect::>() + .join("\t"), + ]; + for (index, cells) in &rows { + let mut line = vec![index.clone()]; + for k in &keys { + let cell = match cells.iter().find(|(c, _)| c == k) { + None | Some((_, Value::Undef)) => String::new(), + Some((_, Value::Str(s))) => vm.text(*s).to_owned(), + Some((_, v)) => convert::format_value(vm, v), + }; + line.push(cell); + } + lines.push(line.join("\t")); + } + vm.logs.push(lines.join("\n")); + Ok(Value::Undef) +} + +// ---------- global functions ---------- + +pub fn global_parse_int(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let listed = [arg(args, 0), arg(args, 1)]; + fuel::with_primitives(vm, &[Hint::String, Hint::Number], listed, false, parse_int) +} + +fn parse_int(vm: &mut Vm, [text, radix]: [Value; 2]) -> Res { + let s = vm.string_of(&text)?; + let mut radix = to_int32(vm.number_of(&radix)?); + let owned = vm.text(s).to_owned(); + let t = owned.trim_start_matches(crate::value::is_js_whitespace); + let (neg, mut t) = match t.as_bytes().first() { + Some(b'-') => (true, &t[1..]), + Some(b'+') => (false, &t[1..]), + _ => (false, t), + }; + if radix == 0 { + radix = 10; + if t.starts_with("0x") || t.starts_with("0X") { + radix = 16; + t = &t[2..]; + } + } else if radix == 16 && (t.starts_with("0x") || t.starts_with("0X")) { + t = &t[2..]; + } + if !(2..=36).contains(&radix) { + return Ok(Value::Num(f64::NAN)); + } + let mut v = 0.0f64; + let mut any = false; + for c in t.chars() { + match c.to_digit(radix as u32) { + Some(d) => { + v = v * radix as f64 + d as f64; + any = true; + } + None => break, + } + } + if !any { + return Ok(Value::Num(f64::NAN)); + } + Ok(Value::Num(if neg { -v } else { v })) +} + +pub fn global_parse_float(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + fuel::with_primitives(vm, &[Hint::String], [arg(args, 0)], false, |vm, [v]| { + let s = vm.string_of(&v)?; + Ok(Value::Num(parse_float_prefix(vm.text(s)))) + }) +} + +fn global_is_nan(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + fuel::with_primitives(vm, &[Hint::Number], [arg(args, 0)], false, |vm, [v]| { + Ok(Value::Bool(vm.number_of(&v)?.is_nan())) + }) +} + +fn global_is_finite(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + fuel::with_primitives(vm, &[Hint::Number], [arg(args, 0)], false, |vm, [v]| { + Ok(Value::Bool(vm.number_of(&v)?.is_finite())) + }) +} + +// The sub-ops of `NativeOp::Callbacks`; a number keeps its meaning once a snapshot may hold it. +/// `Object.fromEntries`. +pub(crate) const SUB_FROM_ENTRIES: u16 = 0; +/// `AggregateError` reading its errors. +pub(crate) const SUB_AGGREGATE: u16 = 1; +/// `Math.sumPrecise` (`builtins::string::SumPrecise`). +pub(crate) const SUB_SUM_PRECISE: u16 = 2; +/// The pairs of `new URLSearchParams(...)` and `new Headers(...)`, and the parts of one pair (`builtins::web`). +pub(crate) const SUB_PAIRS: u16 = 3; +pub(crate) const SUB_PAIR: u16 = 4; +/// `JSON.stringify`'s internal walk (`convert::stringify_step`). +pub(crate) const SUB_STRINGIFY: u16 = 5; +/// The program result's crossing to the host, which calls a `toJSON` of the program's (`cross::frame_step`). +pub(crate) const SUB_CROSS: u16 = 6; +/// A synchronous host call waiting for promises in its arguments (`cross::wait_step`). +pub(crate) const SUB_HOST_WAIT: u16 = 7; + +/// The steps of this family's native frames (`native::NativeOp::Callbacks`), by sub-op; see `native.rs`. +pub(crate) fn family_step( + vm: &mut Vm, + sub: u16, + fr: crate::native::Frame, + input: crate::native::Input, +) -> Result { + use crate::native::for_of_step; + match sub { + SUB_FROM_ENTRIES => for_of_step::(vm, fr, input), + SUB_AGGREGATE => for_of_step::(vm, fr, input), + SUB_SUM_PRECISE => for_of_step::(vm, fr, input), + SUB_PAIRS => for_of_step::(vm, fr, input), + SUB_PAIR => for_of_step::(vm, fr, input), + SUB_STRINGIFY => convert::stringify_step(vm, fr, input), + SUB_CROSS => crate::cross::frame_step(vm, fr, input), + SUB_HOST_WAIT => crate::cross::wait_step(vm, fr, input), + crate::accessors::SUB_GETTER_METHOD => crate::accessors::getter_method_step(vm, fr, input), + crate::accessors::SUB_SETTER => crate::accessors::setter_step(vm, fr, input), + _ => Ok(crate::native::Step::Done(Value::Undef)), + } +} + +/// The halves of `Function.prototype`'s `caller` and `arguments`. +pub(crate) fn restricted(vm: &mut Vm, _this: Value, _args: &[Value], _: Id) -> Res { + Err(vm.type_error( + "'caller' and 'arguments' are restricted function properties and cannot be accessed in this context.", + )) +} diff --git a/packages/codemode-rust/crates/psychoscript/src/builtins/regexp.rs b/packages/codemode-rust/crates/psychoscript/src/builtins/regexp.rs new file mode 100644 index 0000000000000..f5d2614e7b842 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/builtins/regexp.rs @@ -0,0 +1,1148 @@ +//! RegExp, and the String methods that take a regular expression. +//! +//! Matching runs on `regress`, which implements ECMAScript regular expression semantics. ASCII text is matched as +//! UTF-8, where byte offsets are code-unit offsets; other text is matched as UTF-16, so offsets, `lastIndex` and +//! non-unicode patterns see code units exactly as JavaScript does. + +use super::arg; +use super::regexp_syntax::{self, Mode}; +use crate::object::*; +use crate::ops::{MAX_ARRAY_LEN, MAX_STRING_LEN}; +use crate::strings::StrId; +use crate::value::{Id, Value, to_integer}; +use crate::vm::{Res, Vm}; + +pub struct RegExpData { + pub source: String, + pub flags: String, + pub regex: regress::Regex, + pub last_index: f64, +} + +impl RegExpData { + fn has(&self, flag: char) -> bool { + self.flags.contains(flag) + } + fn global(&self) -> bool { + self.has('g') + } + fn sticky(&self) -> bool { + self.has('y') + } + fn full_unicode(&self) -> bool { + self.has('u') || self.has('v') + } +} + +const ESCAPE_HINT: &str = "To match special characters like ( ) [ ] { } + * ? . literally, escape them with a backslash (e.g. \"\\\\(\") or test for them with String.includes instead."; + +pub enum CompileError { + Flags, + Pattern(String), +} + +/// Validates and orders the flags, then compiles the pattern. +pub fn compile(pattern: &str, flags: &str) -> Result<(regress::Regex, String), CompileError> { + const ORDER: &str = "dgimsuvy"; + let mut seen = [false; 8]; + for c in flags.chars() { + let Some(i) = ORDER.find(c) else { + return Err(CompileError::Flags); + }; + if seen[i] { + return Err(CompileError::Flags); + } + seen[i] = true; + } + if seen[5] && seen[6] { + return Err(CompileError::Flags); + } + let ordered: String = ORDER + .chars() + .zip(seen) + .filter(|(_, s)| *s) + .map(|(c, _)| c) + .collect(); + let rflags = regress::Flags { + icase: seen[2], + multiline: seen[3], + dot_all: seen[4], + unicode: seen[5], + unicode_sets: seen[6], + ..Default::default() + }; + let mode = if rflags.unicode_sets { + Mode::UnicodeSets + } else if rflags.unicode { + Mode::Unicode + } else { + Mode::Legacy + }; + if let Some(code) = + regexp_syntax::check(&crate::strings::units_of(pattern), mode, &EngineUnicode) + { + return Err(CompileError::Pattern(code.message().into())); + } + let expanded = rewrite_named_refs(pattern, rflags.unicode_sets); + let pattern = expanded.as_deref().unwrap_or(pattern); + // Without the unicode flags a pattern is code units, like the text it matches. + // A carrier pattern holds lone surrogates, which only code points can pass on. + let compiled = if (rflags.unicode || rflags.unicode_sets) && crate::strings::has_mark(pattern) { + let points = char::decode_utf16(crate::strings::units_of(pattern)).map(|r| match r { + Ok(c) => c as u32, + Err(e) => e.unpaired_surrogate() as u32, + }); + regress::Regex::from_unicode(points, rflags) + } else if rflags.unicode || rflags.unicode_sets { + regress::Regex::with_flags(pattern, rflags) + } else { + regress::Regex::from_unicode( + crate::strings::units_of(pattern).into_iter().map(u32::from), + rflags, + ) + .or_else(|_| regress::Regex::with_flags(pattern, rflags)) + }; + match compiled { + Ok(r) => Ok((r, ordered)), + Err(e) => Err(CompileError::Pattern(e.to_string())), + } +} + +/// A pattern's named groups (name and capture index) and its `\\k` references outside classes (span and +/// name). +struct NamedRefs { + groups: Vec<(String, usize)>, + refs: Vec<(usize, usize, String)>, +} + +fn scan_named_refs(chars: &[char], nested_classes: bool) -> NamedRefs { + let mut found = NamedRefs { + groups: Vec::new(), + refs: Vec::new(), + }; + let (mut i, mut depth, mut count) = (0, 0usize, 0usize); + let name_at = |from: usize| { + let end = chars[from..] + .iter() + .position(|c| *c == '>') + .map(|n| from + n)?; + Some((end, chars[from..end].iter().collect::())) + }; + while i < chars.len() { + match chars[i] { + '\\' => { + if chars.get(i + 1) == Some(&'k') + && depth == 0 + && chars.get(i + 2) == Some(&'<') + && let Some((end, name)) = name_at(i + 3) + { + found.refs.push((i, end + 1, name)); + } + i += 2; + continue; + } + '[' if depth == 0 || nested_classes => depth += 1, + ']' if depth > 0 => depth -= 1, + '(' if depth == 0 => { + if chars.get(i + 1) != Some(&'?') { + count += 1; + } else if chars.get(i + 2) == Some(&'<') + && !matches!(chars.get(i + 3), Some('=') | Some('!')) + && let Some((_, name)) = name_at(i + 3) + { + count += 1; + found.groups.push((name, count)); + } + } + _ => {} + } + i += 1; + } + found +} + +/// `regress` binds `\\k` to the first group of that name only. When a name is duplicated at most one of its +/// groups participates, and a reference to a group that did not participate matches empty, so the reference +/// becomes the sequence of back-references to every group of that name, `(?:\\1\\2)`. +fn rewrite_named_refs(pattern: &str, nested_classes: bool) -> Option { + if !pattern.contains("\\k") { + return None; + } + let chars: Vec = pattern.chars().collect(); + let found = scan_named_refs(&chars, nested_classes); + if found.groups.is_empty() { + return None; + } + let indexes = |name: &str| -> Vec { + found + .groups + .iter() + .filter(|(n, _)| n == name) + .map(|(_, i)| *i) + .collect() + }; + let mut out = String::new(); + let mut last = 0; + for (start, end, name) in &found.refs { + let indexes = indexes(name); + if indexes.len() < 2 { + continue; + } + out.extend(&chars[last..*start]); + out.push_str("(?:"); + for i in indexes { + out.push_str(&format!("\\{i}")); + } + out.push(')'); + last = *end; + } + if last == 0 { + return None; + } + out.extend(&chars[last..]); + Some(out) +} + +/// The Unicode facts the syntax check needs, from `regress`, which runs the pattern. +struct EngineUnicode; + +impl regexp_syntax::Unicode for EngineUnicode { + fn property(&self, expression: &str, mode: Mode) -> Option { + const STRINGS: [&str; 7] = [ + "Basic_Emoji", + "Emoji_Keycap_Sequence", + "RGI_Emoji_Modifier_Sequence", + "RGI_Emoji_Flag_Sequence", + "RGI_Emoji_Tag_Sequence", + "RGI_Emoji_ZWJ_Sequence", + "RGI_Emoji", + ]; + let flags = regress::Flags { + unicode: mode == Mode::Unicode, + unicode_sets: mode == Mode::UnicodeSets, + ..Default::default() + }; + regress::Regex::with_flags(&format!("\\p{{{expression}}}"), flags).ok()?; + Some(mode == Mode::UnicodeSets && STRINGS.contains(&expression)) + } + + fn identifier(&self, ch: u32, start: bool) -> bool { + static START: std::sync::LazyLock> = + std::sync::LazyLock::new(|| regress::Regex::with_flags("^\\p{L}$", "u").ok()); + static PART: std::sync::LazyLock> = std::sync::LazyLock::new(|| { + regress::Regex::with_flags("^[\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}]$", "u").ok() + }); + let Some(c) = char::from_u32(ch) else { + return false; + }; + let re = if start { &*START } else { &*PART }; + re.as_ref() + .is_some_and(|r| r.find(c.encode_utf8(&mut [0; 4])).is_some()) + } +} + +/// The source as `RegExp.prototype.source` spells it: `/` and line terminators escaped outside classes. +fn escape_source(pattern: &str) -> String { + if pattern.is_empty() { + return "(?:)".into(); + } + let mut out = String::with_capacity(pattern.len()); + let mut in_class = false; + let mut chars = pattern.chars(); + while let Some(c) = chars.next() { + match c { + '\\' => { + out.push('\\'); + if let Some(n) = chars.next() { + match n { + '\n' => out.push('n'), + '\r' => out.push('r'), + '\u{2028}' => out.push_str("u2028"), + '\u{2029}' => out.push_str("u2029"), + _ => out.push(n), + } + } + } + '/' if !in_class => out.push_str("\\/"), + '\n' => out.push_str("\\n"), + '\r' => out.push_str("\\r"), + '\u{2028}' => out.push_str("\\u2028"), + '\u{2029}' => out.push_str("\\u2029"), + '[' => { + in_class = true; + out.push(c); + } + ']' => { + in_class = false; + out.push(c); + } + _ => out.push(c), + } + } + out +} + +fn quote_json(s: &str) -> String { + let mut out = String::new(); + crate::convert::quote(&mut out, s); + out +} + +pub fn setup(vm: &mut Vm) { + let op = vm.realm.object_proto; + let proto = vm.plain(op); + vm.realm.std.regexp = proto; + let ctor = vm.ctor("RegExp", 2, regexp_ctor, proto, Value::Undef); + vm.method(ctor, "escape", 1, regexp_escape); + // The accessors live on the prototype, as in JS; instances answer them through `get_prop`. + super::accessors( + vm, + proto, + &[ + "source", + "flags", + "lastIndex", + "hasIndices", + "global", + "ignoreCase", + "multiline", + "sticky", + "unicode", + "unicodeSets", + "dotAll", + ], + ); + vm.methods( + proto, + &[ + ("exec", 1, re_exec), + ("test", 1, re_test), + ("toString", 0, re_to_string), + ], + ); +} + +/// A new RegExp object, or the program's `SyntaxError` when the pattern or flags are invalid. +pub fn new_regexp(vm: &mut Vm, pattern: &str, flags: &str) -> Res { + super::ensure(vm, super::LAZY_REGEXP); + match compile(pattern, flags) { + Ok((regex, flags)) => { + let proto = vm.realm.std.regexp; + let data = RegExpData { + source: escape_source(pattern), + flags, + regex, + last_index: 0.0, + }; + Ok(Value::Obj( + vm.alloc(Obj::new(Some(proto), Kind::RegExp(Box::new(data)))), + )) + } + Err(CompileError::Flags) => Err(vm.syntax_error(&format!( + "new RegExp(...) received invalid flags {} (Invalid flags supplied to RegExp constructor.). Valid flags are d, g, i, m, s, u, v, and y.", + quote_json(flags) + ))), + Err(CompileError::Pattern(reason)) => Err(vm.syntax_error(&format!( + "new RegExp(...) received {}, which is not a valid regular expression pattern ({reason}). {ESCAPE_HINT}", + quote_json(pattern) + ))), + } +} + +/// Checks a regular expression literal at compile time. +pub fn validate_literal(pattern: &str, flags: &str) -> Result<(), String> { + match compile(pattern, flags) { + Ok(_) => Ok(()), + Err(CompileError::Flags) => Err(format!("Invalid regular expression flags '{flags}'")), + Err(CompileError::Pattern(reason)) => Err(format!( + "Invalid regular expression: /{pattern}/{flags}: {reason}" + )), + } +} + +pub fn as_regexp(vm: &Vm, v: &Value) -> Option { + match v { + Value::Obj(id) if matches!(vm.heap[*id as usize].kind, Kind::RegExp(_)) => Some(*id), + _ => None, + } +} + +fn data(vm: &Vm, id: Id) -> &RegExpData { + match &vm.heap[id as usize].kind { + Kind::RegExp(r) => r, + _ => unreachable!("checked by as_regexp"), + } +} + +fn data_mut(vm: &mut Vm, id: Id) -> &mut RegExpData { + match &mut vm.heap[id as usize].kind { + Kind::RegExp(r) => r, + _ => unreachable!("checked by as_regexp"), + } +} + +fn this_regexp(vm: &mut Vm, this: &Value, name: &str) -> Result { + match as_regexp(vm, this) { + Some(id) => Ok(id), + None => Err(super::incompatible( + vm, + &format!("RegExp.prototype.{name}"), + this, + )), + } +} + +/// The accessor properties of a RegExp: `lastIndex`, `source`, `flags` and the flag booleans. +pub fn get_prop(vm: &mut Vm, id: Id, key: Atom) -> Option { + let name = vm.atoms.text(key); + let r = data(vm, id); + let flag = match name { + "lastIndex" => return Some(Value::Num(r.last_index)), + "source" => { + let s = r.source.clone(); + return Some(vm.string_val(s)); + } + "flags" => { + let s = r.flags.clone(); + return Some(vm.string_val(s)); + } + "hasIndices" => 'd', + "global" => 'g', + "ignoreCase" => 'i', + "multiline" => 'm', + "dotAll" => 's', + "unicode" => 'u', + "unicodeSets" => 'v', + "sticky" => 'y', + _ => return None, + }; + Some(Value::Bool(r.has(flag))) +} + +pub fn set_prop(vm: &mut Vm, id: Id, key: Atom, val: Value) -> Option> { + match vm.atoms.text(key) { + "lastIndex" => { + Some(super::builtin_number(vm, &val).map(|n| data_mut(vm, id).last_index = n)) + } + "source" | "flags" | "hasIndices" | "global" | "ignoreCase" | "multiline" | "dotAll" + | "unicode" | "unicodeSets" | "sticky" => Some(Err(vm.only_getter(&Value::Obj(id), key))), + _ => None, + } +} + +pub fn inspect(vm: &Vm, id: Id) -> String { + let r = data(vm, id); + format!("/{}/{}", r.source, r.flags) +} + +pub fn clone_regexp(vm: &mut Vm, id: Id) -> Value { + let r = data(vm, id); + let copy = RegExpData { + source: r.source.clone(), + flags: r.flags.clone(), + regex: r.regex.clone(), + last_index: 0.0, + }; + let proto = vm.realm.std.regexp; + Value::Obj(vm.alloc(Obj::new(Some(proto), Kind::RegExp(Box::new(copy))))) +} + +// ---------- matching ---------- + +/// A string prepared for matching: ASCII text as is, anything else as UTF-16 code units. +pub struct Subject { + pub text: String, + pub units: Option>, +} + +impl Subject { + pub fn new(vm: &Vm, s: StrId) -> Subject { + let r = vm.atoms.sref(s); + Subject { + text: r.s.to_owned(), + units: if r.ascii { None } else { Some(r.utf16()) }, + } + } + + pub fn len(&self) -> usize { + match &self.units { + Some(u) => u.len(), + None => self.text.len(), + } + } + + pub fn slice(&self, a: usize, b: usize) -> String { + let (a, b) = (a.min(self.len()), b.min(self.len())); + if a >= b { + return String::new(); + } + match &self.units { + Some(u) => crate::strings::from_units(&u[a..b]), + None => self.text[a..b].to_owned(), + } + } + + /// AdvanceStringIndex: one code unit, or one code point under the unicode flags. + fn advance(&self, i: usize, unicode: bool) -> usize { + if unicode + && let Some(u) = &self.units + && (0xd800..0xdc00).contains(&u.get(i).copied().unwrap_or(0)) + && (0xdc00..0xe000).contains(&u.get(i + 1).copied().unwrap_or(0)) + { + return i + 2; + } + i + 1 + } +} + +/// The leftmost match starting at or after `start`. +pub fn find( + re: ®ress::Regex, + unicode: bool, + subject: &Subject, + start: usize, +) -> Option { + if start > subject.len() { + return None; + } + match &subject.units { + None => re.find_from(&subject.text, start).next(), + Some(units) if unicode => re.find_from_utf16(units, start).next(), + Some(units) => re.find_from_ucs2(units, start).next(), + } +} + +/// RegExpBuiltinExec: one match honoring and updating `lastIndex`. +fn exec_raw(vm: &mut Vm, id: Id, subject: &Subject) -> Result, Value> { + let li = data(vm, id).last_index; + let li = to_integer(li).max(0.0); + let r = data(vm, id); + let (global, sticky, unicode) = (r.global(), r.sticky(), r.full_unicode()); + let start = if global || sticky { li } else { 0.0 }; + if start > subject.len() as f64 { + if global || sticky { + data_mut(vm, id).last_index = 0.0; + } + return Ok(None); + } + let start = start as usize; + let m = find(&data(vm, id).regex, unicode, subject, start); + let m = match m { + Some(m) if !sticky || m.start() == start => m, + _ => { + if global || sticky { + data_mut(vm, id).last_index = 0.0; + } + return Ok(None); + } + }; + if global || sticky { + data_mut(vm, id).last_index = m.end() as f64; + } + Ok(Some(m)) +} + +fn opt_str(vm: &mut Vm, subject: &Subject, r: Option) -> Value { + match r { + Some(r) => { + let s = subject.slice(r.start, r.end); + vm.string_val(s) + } + None => Value::Undef, + } +} + +fn has_named_groups(m: ®ress::Match) -> bool { + m.named_groups().next().is_some() +} + +fn groups_object(vm: &mut Vm, subject: &Subject, m: ®ress::Match) -> Value { + let id = vm.new_object(); + let named: Vec<(String, Option)> = + m.named_groups().map(|(n, r)| (n.to_owned(), r)).collect(); + for (name, range) in named { + let k = vm.atoms.intern(&name); + let v = opt_str(vm, subject, range); + vm.define(id, k, v); + } + Value::Obj(id) +} + +/// The array `exec` returns: the match and captures, with `index`, `input`, `groups` and, under `d`, `indices`. +fn match_array( + vm: &mut Vm, + subject: &Subject, + input: StrId, + m: ®ress::Match, + indices: bool, +) -> Value { + let items: Vec = m + .groups() + .collect::>() + .into_iter() + .map(|g| opt_str(vm, subject, g)) + .collect(); + let arr = vm.new_array(items); + let Value::Obj(aid) = arr else { return arr }; + let ik = vm.atoms.intern_static("index"); + vm.define(aid, ik, Value::Num(m.start() as f64)); + let ink = vm.atoms.intern_static("input"); + vm.define(aid, ink, Value::Str(input)); + let named = has_named_groups(m); + if named { + let g = groups_object(vm, subject, m); + let gk = vm.atoms.intern_static("groups"); + vm.define(aid, gk, g); + } + if indices { + let pairs: Vec> = m.groups().collect(); + let items: Vec = pairs + .into_iter() + .map(|r| match r { + Some(r) => vm.new_array(vec![Value::Num(r.start as f64), Value::Num(r.end as f64)]), + None => Value::Undef, + }) + .collect(); + let ind = vm.new_array(items); + let groups = if named { + let gid = vm.new_object(); + let named: Vec<(String, Option)> = + m.named_groups().map(|(n, r)| (n.to_owned(), r)).collect(); + for (name, r) in named { + let k = vm.atoms.intern(&name); + let v = match r { + Some(r) => { + vm.new_array(vec![Value::Num(r.start as f64), Value::Num(r.end as f64)]) + } + None => Value::Undef, + }; + vm.define(gid, k, v); + } + Value::Obj(gid) + } else { + Value::Undef + }; + if let Value::Obj(iid) = ind { + let gk = vm.atoms.intern_static("groups"); + vm.define(iid, gk, groups); + } + let k = vm.atoms.intern_static("indices"); + vm.define(aid, k, ind); + } + arr +} + +fn exec_value(vm: &mut Vm, id: Id, s: StrId) -> Res { + let subject = Subject::new(vm, s); + let indices = data(vm, id).has('d'); + match exec_raw(vm, id, &subject)? { + Some(m) => Ok(match_array(vm, &subject, s, &m, indices)), + None => Ok(Value::Null), + } +} + +// ---------- RegExp ---------- + +fn regexp_ctor(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let first = arg(args, 0); + let pattern = match as_regexp(vm, &first) { + Some(id) => { + let src = data(vm, id).source.clone(); + if src == "(?:)" { String::new() } else { src } + } + None => match first { + Value::Undef => String::new(), + v => super::builtin_string(vm, &v)?, + }, + }; + let flags = match arg(args, 1) { + Value::Undef => match as_regexp(vm, &first) { + Some(id) => data(vm, id).flags.clone(), + None => String::new(), + }, + Value::Str(s) => vm.text(s).to_owned(), + other => { + let t = if let Value::Null = other { + "null" + } else { + vm.type_of(&other) + }; + return Err(vm.syntax_error(&format!( + "RegExp flags must be a string of flag characters (e.g. \"g\", \"gi\"), not {t}." + ))); + } + }; + new_regexp(vm, &pattern, &flags) +} + +fn regexp_escape(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let Value::Str(s) = arg(args, 0) else { + return Err(vm.type_error("RegExp.escape expects a string.")); + }; + let units = vm.atoms.sref(s).utf16(); + let mut out = String::new(); + for (i, c) in char::decode_utf16(units).enumerate() { + let c = match c { + Ok(c) => c, + Err(e) => { + out.push_str(&format!("\\u{:04x}", e.unpaired_surrogate())); + continue; + } + }; + if i == 0 && c.is_ascii_alphanumeric() { + out.push_str(&format!("\\x{:x}", c as u32)); + continue; + } + match c { + '^' | '$' | '\\' | '.' | '*' | '+' | '?' | '(' | ')' | '[' | ']' | '{' | '}' | '|' + | '/' => { + out.push('\\'); + out.push(c); + } + '\t' => out.push_str("\\t"), + '\n' => out.push_str("\\n"), + '\u{b}' => out.push_str("\\v"), + '\u{c}' => out.push_str("\\f"), + '\r' => out.push_str("\\r"), + ',' | '-' | '=' | '<' | '>' | '#' | '&' | '!' | '%' | ':' | ';' | '@' | '~' | '\'' + | '`' | '"' => out.push_str(&format!("\\x{:x}", c as u32)), + c if crate::value::is_js_whitespace(c) => { + if (c as u32) <= 0xff { + out.push_str(&format!("\\x{:x}", c as u32)); + } else { + let mut buf = [0u16; 2]; + for u in c.encode_utf16(&mut buf) { + out.push_str(&format!("\\u{:04x}", u)); + } + } + } + c => crate::strings::push_char(&mut out, c), + } + } + Ok(vm.string_val(out)) +} + +fn re_exec(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = this_regexp(vm, &this, "exec")?; + let s = super::builtin_string(vm, &arg(args, 0))?; + let s = vm.atoms.alloc(s); + exec_value(vm, id, s) +} + +fn re_test(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = this_regexp(vm, &this, "test")?; + let s = super::builtin_string(vm, &arg(args, 0))?; + let s = vm.atoms.alloc(s); + let subject = Subject::new(vm, s); + Ok(Value::Bool(exec_raw(vm, id, &subject)?.is_some())) +} + +fn re_to_string(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let id = this_regexp(vm, &this, "toString")?; + let s = inspect(vm, id); + Ok(vm.string_val(s)) +} + +// ---------- String methods ---------- + +/// A RegExp argument as is, or anything else compiled as a pattern string with `flags`. +fn pattern_arg(vm: &mut Vm, v: &Value, method: &str, flags: &str) -> Result { + super::ensure(vm, super::LAZY_REGEXP); + if let Some(id) = as_regexp(vm, v) { + return Ok(id); + } + let source = match v { + Value::Undef => String::new(), + v => { + let s = vm.string_of(v)?; + vm.text(s).to_owned() + } + }; + match compile(&source, flags) { + Ok((regex, flags)) => { + let proto = vm.realm.std.regexp; + let data = RegExpData { + source: escape_source(&source), + flags, + regex, + last_index: 0.0, + }; + Ok(vm.alloc(Obj::new(Some(proto), Kind::RegExp(Box::new(data))))) + } + Err(e) => { + let reason = match e { + CompileError::Flags => "Invalid flags".to_owned(), + CompileError::Pattern(r) => r, + }; + Err(vm.syntax_error(&format!( + "String.{method} received the string {}, which is not a valid regular expression pattern ({reason}). {ESCAPE_HINT}", + quote_json(&source) + ))) + } + } +} + +pub fn string_match(vm: &mut Vm, s: StrId, pat: &Value) -> Res { + let id = pattern_arg(vm, pat, "match", "")?; + if !data(vm, id).global() { + return exec_value(vm, id, s); + } + let subject = Subject::new(vm, s); + let unicode = data(vm, id).full_unicode(); + data_mut(vm, id).last_index = 0.0; + let mut out = Vec::new(); + while let Some(m) = exec_raw(vm, id, &subject)? { + if out.len() >= MAX_ARRAY_LEN { + return Err(vm.range_error("Invalid array length")); + } + let v = subject.slice(m.start(), m.end()); + out.push(vm.string_val(v)); + if m.start() == m.end() { + let next = subject.advance(m.end(), unicode); + data_mut(vm, id).last_index = next as f64; + } + } + if out.is_empty() { + return Ok(Value::Null); + } + Ok(vm.new_array(out)) +} + +pub fn string_match_all(vm: &mut Vm, s: StrId, pat: &Value) -> Res { + let id = pattern_arg(vm, pat, "matchAll", "g")?; + let r = data(vm, id); + if !r.global() { + let msg = format!( + "String.matchAll requires a regular expression with the global (g) flag: write /{}/{}g, or use String.match for a single match.", + r.source, r.flags + ); + return Err(vm.type_error(&msg)); + } + let last = r.last_index; + let copy = clone_regexp(vm, id); + let cid = copy.as_obj().unwrap_or(id); + data_mut(vm, cid).last_index = last; + let subject = Subject::new(vm, s); + let unicode = data(vm, cid).full_unicode(); + let indices = data(vm, cid).has('d'); + let mut out = Vec::new(); + while let Some(m) = exec_raw(vm, cid, &subject)? { + if out.len() >= MAX_ARRAY_LEN { + return Err(vm.range_error("Invalid array length")); + } + out.push(match_array(vm, &subject, s, &m, indices)); + if m.start() == m.end() { + let next = subject.advance(m.end(), unicode); + data_mut(vm, cid).last_index = next as f64; + } + } + Ok(vm.new_array(out)) +} + +pub fn string_search(vm: &mut Vm, s: StrId, pat: &Value) -> Res { + let id = pattern_arg(vm, pat, "search", "")?; + let subject = Subject::new(vm, s); + let r = data(vm, id); + let (sticky, unicode) = (r.sticky(), r.full_unicode()); + let m = find(&r.regex, unicode, &subject, 0); + Ok(Value::Num(match m { + Some(m) if !sticky || m.start() == 0 => m.start() as f64, + _ => -1.0, + })) +} + +/// GetSubstitution: expands `$$`, `$&`, `` $` ``, `$'`, `$n`, `$nn` and `$` in a replacement template. +pub fn substitute( + template: &str, + subject: &Subject, + start: usize, + end: usize, + captures: &[Option], + groups: Option<&[(String, Option)]>, +) -> String { + let mut out = String::new(); + let t: Vec = template.chars().collect(); + let m = captures.len(); + let mut i = 0; + while i < t.len() { + let c = t[i]; + if c != '$' || i + 1 >= t.len() { + out.push(c); + i += 1; + continue; + } + let n = t[i + 1]; + match n { + '$' => { + out.push('$'); + i += 2; + } + '&' => { + out.push_str(&subject.slice(start, end)); + i += 2; + } + '`' => { + out.push_str(&subject.slice(0, start)); + i += 2; + } + '\'' => { + out.push_str(&subject.slice(end, subject.len())); + i += 2; + } + '0'..='9' => { + let d1 = n as usize - '0' as usize; + let two = t + .get(i + 2) + .filter(|c| c.is_ascii_digit()) + .map(|c| d1 * 10 + (*c as usize - '0' as usize)); + if let Some(nn) = two + && nn >= 1 + && nn <= m + { + if let Some(s) = &captures[nn - 1] { + out.push_str(s); + } + i += 3; + } else if d1 >= 1 && d1 <= m { + if let Some(s) = &captures[d1 - 1] { + out.push_str(s); + } + i += 2; + } else { + out.push('$'); + i += 1; + } + } + '<' => match groups { + None => { + out.push('$'); + i += 1; + } + Some(groups) => { + let rest: String = t[i + 2..].iter().collect(); + match rest.find('>') { + None => { + out.push('$'); + i += 1; + } + Some(close) => { + let name = &rest[..close]; + if let Some((_, Some(v))) = groups.iter().find(|(n, _)| n == name) { + out.push_str(v); + } + i += 2 + name.chars().count() + 1; + } + } + } + }, + _ => { + out.push('$'); + i += 1; + } + } + } + out +} + +struct Found { + start: usize, + end: usize, + captures: Vec>, + groups: Option)>>, +} + +fn collect_matches(vm: &mut Vm, id: Id, subject: &Subject, all: bool) -> Result, Value> { + let unicode = data(vm, id).full_unicode(); + let global = data(vm, id).global(); + if global { + data_mut(vm, id).last_index = 0.0; + } + let mut found = Vec::new(); + while let Some(m) = exec_raw(vm, id, subject)? { + let captures = m + .captures + .iter() + .map(|r| r.clone().map(|r| subject.slice(r.start, r.end))) + .collect(); + let groups = if has_named_groups(&m) { + Some( + m.named_groups() + .map(|(n, r)| (n.to_owned(), r.map(|r| subject.slice(r.start, r.end)))) + .collect(), + ) + } else { + None + }; + found.push(Found { + start: m.start(), + end: m.end(), + captures, + groups, + }); + if !global || !all { + break; + } + if m.start() == m.end() { + let next = subject.advance(m.end(), unicode); + data_mut(vm, id).last_index = next as f64; + } + } + Ok(found) +} + +/// `replace`/`replaceAll` with a RegExp pattern, after the conversions `c` of the call. +pub fn string_replace( + vm: &mut Vm, + c: &super::fuel::Conversions, + s: StrId, + re: Id, + rep: &Value, + all: bool, +) -> Res { + let r = data(vm, re); + if all && !r.global() { + let msg = format!( + "String.replaceAll requires a regular expression with the global (g) flag: write /{}/{}g, or use String.replace to replace only the first match.", + r.source, r.flags + ); + return Err(vm.type_error(&msg)); + } + let callable = vm.is_callable(rep); + let template = if callable { + None + } else { + let t = vm.string_of(rep)?; + Some(vm.text(t).to_owned()) + }; + let subject = Subject::new(vm, s); + let found = collect_matches(vm, re, &subject, true)?; + // With a callback, the reference finds the matches, then hands them to its prelude's `replaceWith`. + if callable { + c.handoff(vm); + } + if found.is_empty() { + if callable { + vm.bytecode_builtin(); + } + return Ok(Value::Str(s)); + } + if template.is_none() { + let mut gaps = Vec::with_capacity(found.len()); + let mut calls = Vec::with_capacity(found.len()); + let mut last = 0; + for f in &found { + gaps.push(vm.str_val(&subject.slice(last, f.start))); + let mut cargs = Vec::with_capacity(f.captures.len() + 4); + let whole = subject.slice(f.start, f.end); + cargs.push(vm.string_val(whole)); + for c in &f.captures { + let v = match c { + Some(c) => vm.str_val(c), + None => Value::Undef, + }; + cargs.push(v); + } + cargs.push(Value::Num(f.start as f64)); + cargs.push(Value::Str(s)); + if let Some(groups) = &f.groups { + let gid = vm.new_object(); + for (name, v) in groups { + let k = vm.atoms.intern(name); + let v = match v { + Some(v) => vm.str_val(v), + None => Value::Undef, + }; + vm.define(gid, k, v); + } + cargs.push(Value::Obj(gid)); + } + calls.push(cargs); + last = f.end; + } + let tail = vm.str_val(&subject.slice(last, subject.len())); + return super::string::enter_replace_with(vm, *rep, gaps, calls, tail, true); + } + let mut out = String::new(); + let mut last = 0; + for f in &found { + out.push_str(&subject.slice(last, f.start)); + if let Some(t) = &template { + out.push_str(&substitute( + t, + &subject, + f.start, + f.end, + &f.captures, + f.groups.as_deref(), + )); + } + if out.len() > MAX_STRING_LEN { + return Err(vm.range_error("Invalid string length")); + } + last = f.end; + } + out.push_str(&subject.slice(last, subject.len())); + if callable { + vm.bytecode_builtin(); + } + Ok(vm.string_val(out)) +} + +/// `split` with a RegExp separator, following the spec's sticky matching at each position. +pub fn string_split(vm: &mut Vm, s: StrId, re: Id, limit: Value) -> Res { + let lim = match limit { + Value::Undef => u32::MAX, + v => crate::value::to_uint32(vm.number_of(&v)?), + } as usize; + let subject = Subject::new(vm, s); + let r = data(vm, re); + let unicode = r.full_unicode(); + let regex = r.regex.clone(); + let mut out: Vec = Vec::new(); + if lim == 0 { + return Ok(vm.new_array(out)); + } + let size = subject.len(); + if size == 0 { + if find(®ex, unicode, &subject, 0).is_some_and(|m| m.start() == 0) { + return Ok(vm.new_array(out)); + } + return Ok(vm.new_array(vec![Value::Str(s)])); + } + let mut p = 0; + let mut q = 0; + while q < size { + let Some(m) = find(®ex, unicode, &subject, q) else { + break; + }; + if m.start() >= size { + break; + } + q = m.start(); + let e = m.end().min(size); + if e == p { + q = subject.advance(q, unicode); + continue; + } + let piece = subject.slice(p, q); + out.push(vm.string_val(piece)); + if out.len() >= lim { + return Ok(vm.new_array(out)); + } + for c in &m.captures { + let v = opt_str(vm, &subject, c.clone()); + out.push(v); + if out.len() >= lim { + return Ok(vm.new_array(out)); + } + } + if out.len() >= MAX_ARRAY_LEN { + return Err(vm.range_error("Invalid array length")); + } + p = e; + q = p; + } + let tail = subject.slice(p, size); + out.push(vm.string_val(tail)); + Ok(vm.new_array(out)) +} diff --git a/packages/codemode-rust/crates/psychoscript/src/builtins/regexp_syntax.rs b/packages/codemode-rust/crates/psychoscript/src/builtins/regexp_syntax.rs new file mode 100644 index 0000000000000..51aa985f7d222 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/builtins/regexp_syntax.rs @@ -0,0 +1,1389 @@ +//! Syntax errors of regular expression patterns as the reference's host reports them: a port of the checks in +//! JavaScriptCore's `YarrParser` (the version Bun ships), which finds the first error in the order that parser meets +//! it. `regress` compiles the pattern afterwards; it accepts a few patterns JavaScriptCore rejects (such as `\b*`) +//! and words its errors differently, so the reference's error and wording come from here. + +use std::collections::HashSet; + +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub enum Mode { + Legacy, + Unicode, + UnicodeSets, +} + +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub enum Code { + PatternTooLarge, + QuantifierOutOfOrder, + QuantifierWithoutAtom, + QuantifierTooLarge, + QuantifierIncomplete, + CantQuantifyAtom, + MissingParentheses, + BracketUnmatched, + ParenthesesUnmatched, + ParenthesesTypeInvalid, + InvalidGroupName, + DuplicateGroupName, + CharacterClassUnmatched, + CharacterClassRangeOutOfOrder, + CharacterClassRangeInvalid, + ClassStringDisjunctionUnmatched, + EscapeUnterminated, + InvalidUnicodeEscape, + InvalidUnicodeCodePointEscape, + InvalidBackreference, + InvalidNamedBackReference, + InvalidIdentityEscape, + InvalidOctalEscape, + InvalidControlLetterEscape, + InvalidUnicodePropertyExpression, + InvalidClassSetOperation, + NegatedClassSetMayContainStrings, + InvalidClassSetCharacter, + InvalidRegularExpressionModifier, + TooManyCaptures, +} + +impl Code { + /// The message JavaScriptCore gives, without its "Invalid regular expression: " prefix. + pub fn message(self) -> &'static str { + match self { + Code::PatternTooLarge => "regular expression too large", + Code::QuantifierOutOfOrder => "numbers out of order in {} quantifier", + Code::QuantifierWithoutAtom => "nothing to repeat", + Code::QuantifierTooLarge => "number too large in {} quantifier", + Code::QuantifierIncomplete => "incomplete {} quantifier for Unicode pattern", + Code::CantQuantifyAtom => "invalid quantifier", + Code::MissingParentheses => "missing )", + Code::BracketUnmatched => "unmatched ] or } bracket for Unicode pattern", + Code::ParenthesesUnmatched => "unmatched parentheses", + Code::ParenthesesTypeInvalid => "unrecognized character after (?", + Code::InvalidGroupName => "invalid group specifier name", + Code::DuplicateGroupName => "duplicate group specifier name", + Code::CharacterClassUnmatched => "missing terminating ] for character class", + Code::CharacterClassRangeOutOfOrder => "range out of order in character class", + Code::CharacterClassRangeInvalid => { + "invalid range in character class for Unicode pattern" + } + Code::ClassStringDisjunctionUnmatched => { + "missing terminating } for class string disjunction" + } + Code::EscapeUnterminated => "\\ at end of pattern", + Code::InvalidUnicodeEscape => "invalid Unicode \\u escape", + Code::InvalidUnicodeCodePointEscape => "invalid Unicode code point \\u{} escape", + Code::InvalidBackreference => "invalid backreference for Unicode pattern", + Code::InvalidNamedBackReference => "invalid \\k<> named backreference", + Code::InvalidIdentityEscape => "invalid escaped character for Unicode pattern", + Code::InvalidOctalEscape => "invalid octal escape for Unicode pattern", + Code::InvalidControlLetterEscape => "invalid \\c escape for Unicode pattern", + Code::InvalidUnicodePropertyExpression => "invalid property expression", + Code::InvalidClassSetOperation => "invalid operation in class set", + Code::NegatedClassSetMayContainStrings => "negated class set may contain strings", + Code::InvalidClassSetCharacter => "invalid class set character", + Code::InvalidRegularExpressionModifier => "invalid regular expression modifier", + Code::TooManyCaptures => "too many captures", + } + } +} + +/// What the parser asks about Unicode, answered by the engine that runs the pattern. +pub trait Unicode { + /// Whether `\p{expression}` names a property in this mode, and if so whether it may match strings. + fn property(&self, expression: &str, mode: Mode) -> Option; + /// Whether a code point may start (`start`) or continue a group name, beyond ASCII. + fn identifier(&self, ch: u32, start: bool) -> bool; +} + +/// The first syntax error of `pattern` (UTF-16 code units) in `mode`, as JavaScriptCore finds it. +pub fn check(pattern: &[u16], mode: Mode, unicode: &dyn Unicode) -> Option { + if pattern.len() > MAX_PATTERN { + return Some(Code::PatternTooLarge); + } + let mut p = Parser { + data: pattern, + i: 0, + mode, + unicode, + error: None, + back_reference_limit: u32::MAX, + subpatterns: 0, + max_back_reference: 0, + captures: 0, + named_forward_allowed: true, + k_identity_seen: false, + parens: Vec::new(), + names: Names::new(), + forward_names: HashSet::new(), + }; + p.tokens(); + if p.error.is_none() { + p.illegal_references(); + } + p.error +} + +const MAX_PATTERN: usize = 1024 * 1024; +const MAX_CAPTURES: u32 = (1 << 16) / 2; +const INFINITE: u64 = u32::MAX as u64; +const NO_CHAR: u32 = u32::MAX; + +#[derive(Clone, Copy, PartialEq)] +enum Token { + NotAtom, + Atom, + Lookbehind, + SetDisjunction, + SetDisjunctionStrings, +} + +#[derive(Clone, Copy, PartialEq)] +enum Escape { + Normal, + Class, + ClassSet, + StringDisjunction, +} + +#[derive(Clone, Copy, PartialEq)] +enum Paren { + Subpattern, + Assertion, + Lookbehind, +} + +/// Named groups seen so far: a name may repeat only in another alternative. +struct Names { + all: HashSet>, + nested: Vec>>, + active: Vec>>, +} + +impl Names { + fn new() -> Names { + Names { + all: HashSet::new(), + nested: vec![HashSet::new()], + active: vec![HashSet::new()], + } + } + + fn next_alternative(&mut self) { + let done = std::mem::take(self.active.last_mut().expect("a scope")); + self.nested.last_mut().expect("a scope").extend(done); + let n = self.active.len(); + if n > 1 { + let outer = self.active[n - 2].clone(); + self.active[n - 1].extend(outer); + } + } + + fn push(&mut self) { + let top = self.active.last().cloned().unwrap_or_default(); + self.nested.push(HashSet::new()); + self.active.push(top); + } + + fn pop(&mut self) { + let (Some(mut nested), Some(active)) = (self.nested.pop(), self.active.pop()) else { + return; + }; + nested.extend(active); + if let Some(outer) = self.active.last_mut() { + outer.extend(nested); + } + } + + /// Adds a name; false when it is already active in this alternative. + fn add(&mut self, name: Vec) -> bool { + self.all.insert(name.clone()); + self.active.last_mut().is_some_and(|a| a.insert(name)) + } +} + +struct Parser<'a> { + data: &'a [u16], + i: usize, + mode: Mode, + unicode: &'a dyn Unicode, + error: Option, + back_reference_limit: u32, + subpatterns: u32, + max_back_reference: u32, + captures: u32, + named_forward_allowed: bool, + k_identity_seen: bool, + parens: Vec, + names: Names, + forward_names: HashSet>, +} + +/// What an escape adds to the construct it is in. +enum Item { + Char(u32), + Class { strings: bool }, + Other, +} + +impl Parser<'_> { + fn set(&mut self, code: Code) { + self.error = Some(code); + } + + fn failed(&self) -> bool { + self.error.is_some() + } + + fn unicode_mode(&self) -> bool { + self.mode != Mode::Legacy + } + + fn at_end(&self) -> bool { + self.i >= self.data.len() + } + + fn peek(&self) -> u32 { + self.data.get(self.i).map_or(0, |c| *c as u32) + } + + fn peek_is_digit(&self) -> bool { + !self.at_end() && (b'0' as u32..=b'9' as u32).contains(&self.peek()) + } + + fn consume(&mut self) -> u32 { + let c = self.peek(); + self.i += 1; + c + } + + fn try_consume(&mut self, c: u8) -> bool { + if !self.at_end() && self.peek() == c as u32 { + self.i += 1; + return true; + } + false + } + + fn consume_number(&mut self) -> u64 { + let mut n: u64 = 0; + let mut overflow = false; + while self.peek_is_digit() { + let d = (self.consume() - b'0' as u32) as u64; + match n.checked_mul(10).and_then(|n| n.checked_add(d)) { + Some(v) => n = v, + None => overflow = true, + } + } + if overflow { u64::MAX } else { n } + } + + fn try_consume_hex(&mut self, count: usize) -> u32 { + let start = self.i; + let mut n = 0u32; + for _ in 0..count { + match char::from_u32(self.peek()).and_then(|c| c.to_digit(16)) { + Some(d) if !self.at_end() => { + self.i += 1; + n = (n << 4) | d; + } + _ => { + self.i = start; + return NO_CHAR; + } + } + } + n + } + + fn consume_possible_pair(&mut self, group_name: bool) -> u32 { + let ch = self.consume(); + if (0xD800..0xDC00).contains(&ch) && (self.unicode_mode() || group_name) && !self.at_end() { + let low = self.peek(); + if (0xDC00..0xE000).contains(&low) { + self.i += 1; + return 0x10000 + ((ch - 0xD800) << 10) + (low - 0xDC00); + } + } + ch + } + + fn identity_escape_error(&mut self, ch: u32, mode: Escape) -> bool { + if !self.unicode_mode() { + return false; + } + let allowed: &[u8] = if matches!(mode, Escape::ClassSet | Escape::StringDisjunction) { + b"^$\\.*+?()[]{}|/&-!#%,:;<=>@`~" + } else { + b"^$\\.*+?()[]{}|/" + }; + if ch == 0 || (ch < 128 && !allowed.contains(&(ch as u8))) { + self.set(Code::InvalidIdentityEscape); + return true; + } + false + } + + // ---------- tokens ---------- + + fn tokens(&mut self) { + let mut last = Token::NotAtom; + while !self.at_end() { + match self.peek() { + 0x7C => { + self.consume(); + last = Token::NotAtom; + self.names.next_alternative(); + } + 0x28 => { + self.parentheses_begin(); + last = Token::NotAtom; + } + 0x29 => last = self.parentheses_end(), + 0x5E | 0x24 => { + self.consume(); + last = Token::NotAtom; + } + 0x2E => { + self.consume(); + last = Token::Atom; + } + 0x5B => { + if self.mode == Mode::UnicodeSets { + self.class_set(); + } else { + self.character_class(); + } + last = Token::Atom; + } + 0x5D | 0x7D => { + if self.unicode_mode() { + self.set(Code::BracketUnmatched); + } else { + self.consume(); + last = Token::Atom; + } + } + 0x5C => last = self.escape(Escape::Normal).0, + 0x2A | 0x2B | 0x3F => { + self.consume(); + self.quantifier(last); + last = Token::NotAtom; + } + 0x7B => { + let start = self.i; + self.consume(); + let mut done = false; + if self.peek_is_digit() { + let min = self.consume_number(); + let mut max = min; + if self.try_consume(b',') { + max = if self.peek_is_digit() { + self.consume_number() + } else { + u64::MAX + }; + } + if self.try_consume(b'}') { + if min == u64::MAX { + self.set(Code::QuantifierTooLarge); + } else if min <= max { + let _ = (min.min(INFINITE), max.min(INFINITE)); + self.quantifier(last); + } else { + self.set(Code::QuantifierOutOfOrder); + } + last = Token::NotAtom; + done = true; + } + } + if !done { + if self.unicode_mode() { + self.set(Code::QuantifierIncomplete); + } else { + self.i = start; + self.consume_possible_pair(false); + last = Token::Atom; + } + } + } + _ => { + self.consume_possible_pair(false); + last = Token::Atom; + } + } + if self.failed() { + return; + } + } + if !self.parens.is_empty() { + self.set(Code::MissingParentheses); + } + } + + fn quantifier(&mut self, last: Token) { + match last { + Token::Atom => { + self.try_consume(b'?'); + } + Token::Lookbehind => self.set(Code::CantQuantifyAtom), + _ => self.set(Code::QuantifierWithoutAtom), + } + } + + fn count_captures(&mut self) { + self.captures += 1; + if self.captures > MAX_CAPTURES { + self.set(Code::TooManyCaptures); + } + } + + fn parentheses_begin(&mut self) { + self.consume(); + let mut kind = Paren::Subpattern; + let mut non_capturing = false; + if self.try_consume(b'?') { + if self.at_end() { + self.set(Code::ParenthesesTypeInvalid); + return; + } + match self.peek() { + 0x3A => { + self.consume(); + non_capturing = true; + } + 0x3D | 0x21 => { + self.consume(); + kind = Paren::Assertion; + } + 0x3C => { + self.consume(); + let name = self.group_name(); + if self.failed() { + // An error while reading the name stops the parse. + } else if let Some(name) = name { + if self.k_identity_seen { + self.set(Code::InvalidNamedBackReference); + } else if self.names.add(name) { + self.count_captures(); + } else { + self.set(Code::DuplicateGroupName); + } + } else if self.try_consume(b'=') || self.try_consume(b'!') { + kind = Paren::Lookbehind; + } else { + self.set(Code::InvalidGroupName); + } + } + 0x69 | 0x6D | 0x73 | 0x2D => { + non_capturing = true; + self.modifiers(); + } + _ => self.set(Code::ParenthesesTypeInvalid), + } + } else { + self.count_captures(); + } + if kind == Paren::Subpattern && !non_capturing { + self.subpatterns += 1; + } + self.parens.push(kind); + self.names.push(); + } + + /// `(?ims-ims:`: each flag at most once on each side, never on both, and at least one. + fn modifiers(&mut self) { + let (mut set, mut unset) = (0u8, 0u8); + let mut negated = false; + while !self.at_end() { + let c = self.consume(); + if c == b':' as u32 { + break; + } + let bit = match c { + 0x69 => 1, + 0x6D => 2, + 0x73 => 4, + 0x2D => { + if negated { + self.set(Code::InvalidRegularExpressionModifier); + } + negated = true; + continue; + } + _ => { + self.set(Code::ParenthesesTypeInvalid); + continue; + } + }; + let side = if negated { &mut unset } else { &mut set }; + if *side & bit != 0 { + self.error = Some(Code::InvalidRegularExpressionModifier); + } + *side |= bit; + } + if self.failed() { + return; + } + if set & unset != 0 || (set == 0 && unset == 0) { + self.set(Code::InvalidRegularExpressionModifier); + } + } + + fn parentheses_end(&mut self) -> Token { + self.consume(); + let Some(kind) = self.parens.pop() else { + self.set(Code::ParenthesesUnmatched); + return Token::NotAtom; + }; + self.names.pop(); + match kind { + Paren::Lookbehind => Token::Lookbehind, + Paren::Subpattern => Token::Atom, + Paren::Assertion if self.mode == Mode::Legacy => Token::Atom, + Paren::Assertion => Token::NotAtom, + } + } + + fn illegal_references(&mut self) { + let mut reparse = false; + if self.max_back_reference > self.subpatterns { + if self.unicode_mode() { + self.set(Code::InvalidBackreference); + return; + } + self.back_reference_limit = self.subpatterns; + reparse = true; + } + if self.k_identity_seen && !self.names.all.is_empty() { + self.set(Code::InvalidNamedBackReference); + return; + } + let illegal_forward = !self.forward_names.is_empty() + && (self.names.all.is_empty() + || self + .forward_names + .iter() + .any(|n| !self.names.all.contains(n))); + if illegal_forward { + if self.unicode_mode() || !self.names.all.is_empty() { + self.set(Code::InvalidNamedBackReference); + return; + } + self.named_forward_allowed = false; + reparse = true; + } + if reparse { + self.i = 0; + self.subpatterns = 0; + self.max_back_reference = 0; + self.k_identity_seen = false; + self.parens.clear(); + self.names = Names::new(); + self.forward_names.clear(); + self.tokens(); + } + } + + // ---------- escapes ---------- + + /// An escape at `\`: the token it makes and what it adds to an enclosing class. + fn escape(&mut self, mode: Escape) -> (Token, Item) { + self.consume(); + if self.at_end() { + self.set(Code::EscapeUnterminated); + return (Token::NotAtom, Item::Other); + } + let c = self.peek(); + let ch = |c: u32| (Token::Atom, Item::Char(c)); + match c { + 0x62 => { + self.consume(); + if mode == Escape::Normal { + return (Token::NotAtom, Item::Other); + } + ch(8) + } + 0x42 => { + self.consume(); + if mode == Escape::Normal { + return (Token::NotAtom, Item::Other); + } + self.identity_escape_error(c, mode); + ch(c) + } + 0x64 | 0x73 | 0x77 | 0x44 | 0x53 | 0x57 => { + self.consume(); + if mode == Escape::StringDisjunction { + return ch(c); + } + (Token::Atom, Item::Class { strings: false }) + } + 0x30 => { + self.consume(); + if !self.peek_is_digit() { + return ch(0); + } + if self.unicode_mode() { + self.set(Code::InvalidOctalEscape); + return ch(0); + } + ch(self.consume_octal(2)) + } + 0x31..=0x39 => { + if mode == Escape::Normal { + let start = self.i; + let n = self.consume_number(); + let n = u32::try_from(n).unwrap_or(u32::MAX); + if n <= self.back_reference_limit { + self.max_back_reference = self.max_back_reference.max(n); + return (Token::Atom, Item::Other); + } + self.i = start; + if self.unicode_mode() { + self.set(Code::InvalidBackreference); + return (Token::Atom, Item::Other); + } + } + if self.unicode_mode() { + self.set(Code::InvalidOctalEscape); + return (Token::Atom, Item::Other); + } + let v = if self.peek() < b'8' as u32 { + self.consume_octal(3) + } else { + self.consume() + }; + ch(v) + } + 0x66 => { + self.consume(); + ch(0x0C) + } + 0x6E => { + self.consume(); + ch(0x0A) + } + 0x72 => { + self.consume(); + ch(0x0D) + } + 0x74 => { + self.consume(); + ch(0x09) + } + 0x76 => { + self.consume(); + ch(0x0B) + } + 0x63 => { + let start = self.i; + self.consume(); + if !self.at_end() { + let control = self.consume(); + if char::from_u32(control).is_some_and(|c| c.is_ascii_alphabetic()) { + return ch(control & 0x1F); + } + if self.unicode_mode() { + self.set(Code::InvalidControlLetterEscape); + return ch(0); + } + if mode != Escape::Normal + && (char::from_u32(control).is_some_and(|c| c.is_ascii_digit()) + || control == b'_' as u32) + { + return ch(control & 0x1F); + } + } + if self.unicode_mode() { + self.set(Code::InvalidIdentityEscape); + return ch(0); + } + self.i = start; + ch(b'\\' as u32) + } + 0x78 => { + self.consume(); + let x = self.try_consume_hex(2); + if x == NO_CHAR { + self.identity_escape_error(b'x' as u32, mode); + return ch(b'x' as u32); + } + ch(x) + } + 0x6B => { + self.consume(); + let start = self.i; + if mode == Escape::Normal && self.try_consume(b'<') { + let name = self.group_name(); + if self.failed() { + return (Token::Atom, Item::Other); + } + if let Some(name) = name { + if self.names.all.contains(&name) { + return (Token::Atom, Item::Other); + } + if self.named_forward_allowed { + self.forward_names.insert(name); + return (Token::Atom, Item::Other); + } + } + } + self.i = start; + if !self.identity_escape_error(b'k' as u32, mode) { + self.k_identity_seen = true; + } + ch(b'k' as u32) + } + 0x70 | 0x50 => { + let e = self.consume(); + if self.mode == Mode::Legacy || mode == Escape::StringDisjunction { + self.identity_escape_error(e, mode); + return ch(e); + } + if !self.at_end() && self.peek() == b'{' as u32 { + self.consume(); + let Some(strings) = self.property_expression() else { + return (Token::Atom, Item::Other); + }; + if e == b'P' as u32 && strings { + self.set(Code::NegatedClassSetMayContainStrings); + return (Token::Atom, Item::Other); + } + return (Token::Atom, Item::Class { strings }); + } + self.set(Code::InvalidUnicodePropertyExpression); + (Token::Atom, Item::Other) + } + 0x71 => { + let e = self.consume(); + if mode == Escape::ClassSet { + if !self.at_end() && self.peek() == b'{' as u32 { + let strings = self.string_disjunction(); + let token = if strings { + Token::SetDisjunctionStrings + } else { + Token::SetDisjunction + }; + return (token, Item::Other); + } + self.set(Code::InvalidUnicodePropertyExpression); + } + self.identity_escape_error(e, mode); + ch(e) + } + 0x75 => { + let cp = self.unicode_escape(false); + if self.failed() { + return (Token::Atom, Item::Other); + } + ch(if cp == NO_CHAR { b'u' as u32 } else { cp }) + } + _ => { + if c == b'-' as u32 && self.unicode_mode() && mode != Escape::Normal { + return ch(self.consume()); + } + if self.identity_escape_error(c, mode) { + return (Token::Atom, Item::Other); + } + ch(self.consume()) + } + } + } + + fn consume_octal(&mut self, count: usize) -> u32 { + let mut v = 0; + for _ in 0..count { + if v >= 32 || self.at_end() || !(b'0' as u32..=b'7' as u32).contains(&self.peek()) { + break; + } + v = v * 8 + (self.consume() - b'0' as u32); + } + v + } + + fn unicode_escape(&mut self, group_name: bool) -> u32 { + let unicode = self.unicode_mode() || group_name; + if !self.try_consume(b'u') || self.at_end() { + if unicode { + self.set(Code::InvalidUnicodeEscape); + } + return NO_CHAR; + } + if unicode && self.try_consume(b'{') { + let mut cp: u32 = 0; + loop { + let Some(d) = (!self.at_end()) + .then(|| char::from_u32(self.peek()).and_then(|c| c.to_digit(16))) + .flatten() + else { + self.set(Code::InvalidUnicodeCodePointEscape); + return NO_CHAR; + }; + self.consume(); + cp = (cp << 4) | d; + if cp > 0x10FFFF { + self.set(Code::InvalidUnicodeCodePointEscape); + return NO_CHAR; + } + if self.at_end() || self.peek() == b'}' as u32 { + break; + } + } + if !self.try_consume(b'}') { + self.set(Code::InvalidUnicodeCodePointEscape); + return NO_CHAR; + } + return cp; + } + let unit = self.try_consume_hex(4); + if unit == NO_CHAR { + if unicode { + self.set(Code::InvalidUnicodeEscape); + } + return NO_CHAR; + } + if (0xD800..0xDC00).contains(&unit) + && unicode + && self.data.len() - self.i >= 6 + && self.peek() == b'\\' as u32 + { + let start = self.i; + self.consume(); + if self.try_consume(b'u') { + let low = self.try_consume_hex(4); + if (0xDC00..0xE000).contains(&low) { + return 0x10000 + ((unit - 0xD800) << 10) + (low - 0xDC00); + } + } + self.i = start; + } + unit + } + + fn identifier_char(&mut self) -> u32 { + if self.try_consume(b'\\') { + return self.unicode_escape(true); + } + self.consume_possible_pair(true) + } + + fn is_identifier(&self, ch: u32, start: bool) -> bool { + if ch < 128 { + let c = ch as u8; + return c.is_ascii_alphabetic() + || c == b'_' + || c == b'$' + || (!start && c.is_ascii_digit()); + } + if ch == NO_CHAR { + return false; + } + if !start && (ch == 0x200C || ch == 0x200D) { + return true; + } + self.unicode.identifier(ch, start) + } + + /// A group name up to `>`, or `None` (with the position restored) when there is none. + fn group_name(&mut self) -> Option> { + if self.at_end() { + return None; + } + let start = self.i; + let ch = self.identifier_char(); + if self.is_identifier(ch, true) { + let mut name = vec![ch]; + while !self.at_end() { + let ch = self.identifier_char(); + if ch == b'>' as u32 { + return Some(name); + } + if !self.is_identifier(ch, false) { + break; + } + name.push(ch); + } + } + self.i = start; + None + } + + /// `\p{...}` after the brace: whether the property may match strings, or `None` after an error. + fn property_expression(&mut self) -> Option { + let ok = |c: u32| { + char::from_u32(c).is_some_and(|c| c.is_ascii_alphanumeric() || c == '_' || c == '=') + }; + if self.at_end() || !ok(self.peek()) { + self.set(Code::InvalidUnicodePropertyExpression); + return None; + } + let mut text = String::new(); + let mut equals = false; + let mut errors = false; + text.push(char::from_u32(self.consume()).unwrap_or('?')); + while !self.at_end() { + let c = self.consume(); + if c == b'}' as u32 { + if errors { + break; + } + let found = self.unicode.property(&text, self.mode); + if found.is_none() { + self.set(Code::InvalidUnicodePropertyExpression); + } + return found; + } + if c == b'=' as u32 { + if equals { + errors = true; + } + equals = true; + text.push('='); + } else if !ok(c) { + errors = true; + } else { + text.push(char::from_u32(c).unwrap_or('?')); + } + } + self.set(Code::InvalidUnicodePropertyExpression); + None + } + + // ---------- classes ---------- + + fn character_class(&mut self) { + self.consume(); + self.try_consume(b'^'); + let unicode = self.mode == Mode::Unicode; + let mut state = ClassState::Empty; + let mut cached = 0u32; + while !self.at_end() { + let item = match self.peek() { + 0x5D => { + self.consume(); + return; + } + 0x5C => self.escape(Escape::Class).1, + _ => { + let c = self.consume_possible_pair(false); + match state { + ClassState::AfterClass if c == b'-' as u32 => { + state = ClassState::AfterClassHyphen; + continue; + } + ClassState::Cached if c == b'-' as u32 => { + state = ClassState::CachedHyphen; + continue; + } + _ => Item::Char(c), + } + } + }; + if self.failed() { + return; + } + match item { + Item::Char(c) => match state { + ClassState::Empty | ClassState::AfterClass | ClassState::Cached => { + cached = c; + state = ClassState::Cached; + } + ClassState::CachedHyphen => { + if c < cached { + self.set(Code::CharacterClassRangeOutOfOrder); + return; + } + state = ClassState::Empty; + } + ClassState::AfterClassHyphen => { + if unicode { + self.set(Code::CharacterClassRangeInvalid); + return; + } + state = ClassState::Empty; + } + }, + Item::Class { .. } => match state { + ClassState::Empty | ClassState::AfterClass | ClassState::Cached => { + state = ClassState::AfterClass; + } + ClassState::CachedHyphen | ClassState::AfterClassHyphen => { + if unicode { + self.set(Code::CharacterClassRangeInvalid); + return; + } + state = ClassState::Empty; + } + }, + Item::Other => {} + } + } + self.set(Code::CharacterClassUnmatched); + } + + fn class_set(&mut self) { + self.consume(); + let inverted = self.try_consume(b'^'); + let mut set = ClassSet::new(inverted); + while !self.at_end() { + match self.peek() { + 0x5D => { + self.consume(); + if set.nested_end(&mut self.error) { + return; + } + } + 0x5B => { + self.consume(); + let invert = self.try_consume(b'^'); + set.nested_begin(invert, &mut self.error); + } + 0x5C => { + if !set.can_take_operand(&mut self.error) { + self.set(Code::InvalidClassSetOperation); + return; + } + let (token, item) = self.escape(Escape::ClassSet); + if self.failed() { + return; + } + match item { + Item::Char(c) => set.character(c, false, &mut self.error), + Item::Class { strings } => set.builtin(strings, &mut self.error), + Item::Other => {} + } + set.compute_strings(token == Token::SetDisjunctionStrings); + if matches!(token, Token::SetDisjunction | Token::SetDisjunctionStrings) { + set.after_operand(&mut self.error); + } + } + c @ (0x2D | 0x26) => { + let start = self.i; + self.consume(); + if self.at_end() { + self.set(Code::CharacterClassUnmatched); + return; + } + if self.peek() == c { + self.consume(); + if self.at_end() || self.peek() == c { + self.set(Code::InvalidClassSetCharacter); + return; + } + let op = if c == 0x2D { + SetOp::Subtraction + } else { + SetOp::Intersection + }; + set.operator(op, &mut self.error); + } else { + self.i = start; + self.class_set_char(&mut set); + } + } + _ => self.class_set_char(&mut set), + } + if self.failed() { + return; + } + } + self.set(Code::CharacterClassUnmatched); + } + + fn class_set_char(&mut self, set: &mut ClassSet) { + let c = self.class_set_character(); + if c == NO_CHAR { + return; + } + set.character(c, true, &mut self.error); + } + + fn class_set_character(&mut self) -> u32 { + let c = self.consume_possible_pair(false); + if c == 0 { + self.set(Code::InvalidClassSetCharacter); + return NO_CHAR; + } + if c < 128 { + if b"()[]{}/|".contains(&(c as u8)) { + self.set(Code::InvalidClassSetCharacter); + return NO_CHAR; + } + if !self.at_end() && self.peek() == c && b"&!#$%*+,.:;<=>?@^`~".contains(&(c as u8)) { + self.set(Code::InvalidClassSetOperation); + return NO_CHAR; + } + } + c + } + + /// `\q{...}` at the brace: whether it holds a string longer than one character. + fn string_disjunction(&mut self) -> bool { + self.consume(); + let mut strings = false; + let mut len = 0; + while !self.at_end() { + match self.peek() { + 0x7D => { + self.consume(); + return strings; + } + 0x5C => { + let (_, item) = self.escape(Escape::StringDisjunction); + if matches!(item, Item::Char(_)) { + len += 1; + } + } + 0x7C => { + self.consume(); + len = 0; + } + 0x2D => { + self.consume(); + self.set(Code::InvalidClassSetCharacter); + return strings; + } + _ => { + if self.class_set_character() == NO_CHAR { + return strings; + } + len += 1; + } + } + if len > 1 { + strings = true; + } + if self.failed() { + return strings; + } + } + self.set(Code::ClassStringDisjunctionUnmatched); + strings + } +} + +#[derive(Clone, Copy, PartialEq)] +enum ClassState { + Empty, + Cached, + CachedHyphen, + AfterClass, + AfterClassHyphen, +} + +#[derive(Clone, Copy, PartialEq)] +enum SetOp { + Default, + Union, + Subtraction, + Intersection, +} + +#[derive(Clone, Copy, PartialEq)] +enum SetState { + Empty, + Cached, + CachedHyphen, + AfterClass, + AfterClassHyphen, + AfterRange, + AfterOperand, + AfterOperator, +} + +/// The state `ClassSetParserDelegate` keeps for a `v`-mode class. +struct ClassSet { + state: SetState, + op: SetOp, + strings: bool, + inverted: bool, + cached: u32, + nesting: Vec<(SetOp, bool, bool)>, +} + +impl ClassSet { + fn new(inverted: bool) -> ClassSet { + ClassSet { + state: SetState::Empty, + op: SetOp::Default, + strings: false, + inverted, + cached: 0, + nesting: Vec::new(), + } + } + + fn union_active(&self) -> bool { + matches!(self.op, SetOp::Default | SetOp::Union) + } + + fn flush(&mut self, error: &mut Option) { + match self.state { + SetState::Cached => self.state = SetState::Empty, + SetState::CachedHyphen | SetState::AfterClassHyphen => { + *error = Some(Code::InvalidClassSetCharacter) + } + _ => {} + } + } + + fn union_if_default(&mut self) { + if self.op == SetOp::Default { + self.op = SetOp::Union; + } + } + + fn nested_begin(&mut self, invert: bool, error: &mut Option) { + self.flush(error); + self.nesting.push((self.op, self.strings, self.inverted)); + self.op = SetOp::Default; + self.strings = false; + self.inverted = invert; + } + + /// Ends a class; true when it was the outermost. + fn nested_end(&mut self, error: &mut Option) -> bool { + self.flush(error); + if self.inverted && self.strings { + *error = Some(Code::NegatedClassSetMayContainStrings); + } + let Some((op, strings, inverted)) = self.nesting.pop() else { + if matches!( + self.state, + SetState::CachedHyphen | SetState::AfterClassHyphen | SetState::AfterOperator + ) { + *error = Some(Code::InvalidClassSetCharacter); + } + if self.inverted && self.strings { + *error = Some(Code::NegatedClassSetMayContainStrings); + } + return true; + }; + let inner = self.strings; + self.op = op; + self.inverted = inverted; + self.strings = strings; + self.state = SetState::AfterOperand; + self.compute_strings(inner); + false + } + + fn operator(&mut self, op: SetOp, error: &mut Option) { + if self.state == SetState::Empty || (self.op != SetOp::Default && self.op != op) { + *error = Some(Code::InvalidClassSetOperation); + return; + } + self.flush(error); + self.op = op; + self.state = SetState::AfterOperator; + } + + fn compute_strings(&mut self, rhs: bool) { + match self.op { + SetOp::Default | SetOp::Union => self.strings |= rhs, + SetOp::Intersection => self.strings = self.strings && rhs, + SetOp::Subtraction => {} + } + } + + fn after_operand(&mut self, error: &mut Option) { + self.flush(error); + self.state = SetState::AfterOperand; + } + + fn can_take_operand(&mut self, error: &mut Option) -> bool { + let union = self.union_active(); + match self.state { + SetState::Empty | SetState::AfterOperator => true, + SetState::Cached => { + if !union { + return false; + } + self.flush(error); + true + } + _ => union, + } + } + + fn character(&mut self, ch: u32, hyphen_is_range: bool, error: &mut Option) { + let union = self.union_active(); + let hyphen = ch == b'-' as u32; + match self.state { + SetState::AfterClass + | SetState::AfterRange + | SetState::Empty + | SetState::AfterOperator => { + if self.state == SetState::AfterClass && hyphen_is_range && union && hyphen { + self.state = SetState::AfterClassHyphen; + return; + } + if matches!(self.state, SetState::AfterClass | SetState::AfterRange) { + self.union_if_default(); + } + if hyphen_is_range && hyphen { + *error = Some(Code::InvalidClassSetCharacter); + return; + } + self.cached = ch; + self.state = SetState::Cached; + } + SetState::Cached => { + if !union { + *error = Some(Code::InvalidClassSetOperation); + return; + } + if hyphen { + self.state = SetState::CachedHyphen; + } else { + self.union_if_default(); + self.cached = ch; + } + } + SetState::CachedHyphen => { + if ch < self.cached { + *error = Some(Code::CharacterClassRangeOutOfOrder); + return; + } + self.union_if_default(); + self.state = SetState::AfterRange; + } + SetState::AfterClassHyphen => *error = Some(Code::CharacterClassRangeInvalid), + SetState::AfterOperand => { + if !union || (hyphen_is_range && hyphen) { + *error = Some(Code::InvalidClassSetOperation); + return; + } + self.union_if_default(); + self.cached = ch; + self.state = SetState::Cached; + } + } + } + + fn builtin(&mut self, strings: bool, error: &mut Option) { + let union = self.union_active(); + match self.state { + SetState::Cached | SetState::AfterRange => { + if self.state == SetState::Cached && !union { + *error = Some(Code::InvalidClassSetOperation); + return; + } + self.union_if_default(); + } + SetState::Empty | SetState::AfterClass | SetState::AfterOperator => {} + SetState::CachedHyphen | SetState::AfterClassHyphen => { + *error = Some(Code::CharacterClassRangeInvalid); + return; + } + SetState::AfterOperand => { + if !union { + *error = Some(Code::InvalidClassSetOperation); + } + } + } + self.compute_strings(strings); + self.state = SetState::AfterClass; + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/builtins/sets.rs b/packages/codemode-rust/crates/psychoscript/src/builtins/sets.rs new file mode 100644 index 0000000000000..e46cd390999cf --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/builtins/sets.rs @@ -0,0 +1,935 @@ +//! Map and Set additions (`getOrInsert`, `groupBy`, the Set composition methods), `Object.groupBy`, WeakMap and +//! WeakSet. + +use super::{arg, describe_value, fuel, incompatible, require_callback}; +use crate::native::{ + FOR_OF_SLOTS, Flow, ForOf, Frame, Input, NativeOp, Step, enter_for_of, enter_for_of_sub, + for_of_step, +}; +use crate::object::*; +use crate::ops::Hint; +use crate::value::{Id, Slot, Value}; +use crate::vm::{Res, Vm}; + +pub fn setup(vm: &mut Vm) { + let mp = vm.realm.map_proto; + let k = vm.names.constructor; + if let Value::Obj(map) = vm.get_obj(mp, k) { + vm.method(map, "groupBy", 2, map_group_by); + } + let op = vm.realm.object_proto; + if let Value::Obj(object) = vm.get_obj(op, k) { + vm.method(object, "groupBy", 2, object_group_by); + vm.method(object, "fromEntries", 1, super::object::object_from_entries); + } + let sp = vm.realm.set_proto; + for (i, (name, _)) in SET_METHODS.iter().enumerate() { + let f = vm.native_fn(name, 1, set_method, Value::Num(i as f64)); + let key = vm.atoms.intern_static(name); + vm.define_hidden(sp, key, f); + } + + let wmp = vm.plain(op); + vm.realm.std.weak_map = wmp; + vm.ctor("WeakMap", 0, weak_map_ctor, wmp, Value::Undef); + vm.methods( + wmp, + &[ + ("get", 1, weak_get), + ("has", 1, weak_has), + ("delete", 1, weak_delete), + ("set", 2, weak_set), + ("getOrInsert", 2, weak_get_or_insert), + ("getOrInsertComputed", 2, weak_get_or_insert_computed), + ], + ); + let wsp = vm.plain(op); + vm.realm.std.weak_set = wsp; + vm.ctor("WeakSet", 0, weak_set_ctor, wsp, Value::Undef); + vm.methods( + wsp, + &[ + ("has", 1, weak_has), + ("delete", 1, weak_delete), + ("add", 1, weak_add), + ], + ); +} + +fn table(vm: &mut Vm, id: Id) -> &mut OrderedMap { + match &mut vm.heap[id as usize].kind { + Kind::Map(m) | Kind::Set(m) | Kind::WeakMap(m) | Kind::WeakSet(m) => m, + _ => unreachable!("checked by the receiver test"), + } +} + +fn receiver(vm: &mut Vm, this: &Value, method: &str, ok: fn(&Kind) -> bool) -> Result { + if let Value::Obj(id) = this + && ok(&vm.heap[*id as usize].kind) + { + return Ok(*id); + } + Err(incompatible(vm, method, this)) +} + +fn normalize(v: Value) -> Value { + match v { + Value::Num(n) => Value::Num(n + 0.0), + v => v, + } +} + +// ---------- Map ---------- + +pub(crate) fn map_get_or_insert(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = receiver(vm, &this, "Map.prototype.getOrInsert", |k| { + matches!(k, Kind::Map(_)) + })?; + let key = vm.map_key(&arg(args, 0)); + if let Some(v) = table(vm, id).get(key) { + return Ok(v); + } + let entry_key = vm.map_entry_key(key, arg(args, 0)); + table(vm, id).set(key, entry_key, arg(args, 1)); + Ok(arg(args, 1)) +} + +fn get_or_insert_computed(vm: &mut Vm, id: Id, args: &[Value], name: &str, callee: Id) -> Res { + let f = require_callback(vm, &arg(args, 1), name)?; + let k = normalize(arg(args, 0)); + let key = vm.map_key(&k); + if let Some(v) = table(vm, id).get(key) { + return Ok(v); + } + // A missing key is the reference's `insertComputed`: the callback, then `$Table("add")`. + fuel::handoff(vm); + vm.enter_native_sub( + NativeOp::Collections, + GET_OR_INSERT, + callee, + Value::Undef, + &[Value::Obj(id), k, f], + ) +} + +/// The step of `getOrInsertComputed` once the key was missing: calls the callback, then stores what it returned. +fn get_or_insert_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + match input { + Input::Start => { + let (f, k) = (fr.slot(vm, 2), fr.slot(vm, 1)); + fr.call_slots(vm, f, Slot::UNDEF, [k]) + } + Input::Returned(r) => { + let id = fr.slot(vm, 0).obj().unwrap_or(0); + let k = fr.get(vm, 1); + let key = vm.map_key(&k); + let v = r.get(); + let entry_key = vm.map_entry_key(key, k); + table(vm, id).set(key, entry_key, v); + fuel::native(vm); + vm.bytecode_builtin(); + Ok(Step::Done(v)) + } + Input::Threw(e) => Err(e), + Input::Finished(_) => Ok(Step::Done(Value::Undef)), + } +} + +pub(crate) fn map_get_or_insert_computed( + vm: &mut Vm, + this: Value, + args: &[Value], + callee: Id, +) -> Res { + let id = receiver(vm, &this, "Map.prototype.getOrInsertComputed", |k| { + matches!(k, Kind::Map(_)) + })?; + get_or_insert_computed(vm, id, args, "Map.getOrInsertComputed", callee) +} + +// The slots of a `groupBy` frame, after the loop's: the callback, the next index, the item being grouped, the +// `[key, item]` pairs so far (an internal array), whether it groups into an object, and whether a key is being +// converted by a call. +const GROUP_F: usize = FOR_OF_SLOTS; +const GROUP_INDEX: usize = FOR_OF_SLOTS + 1; +const GROUP_ITEM: usize = FOR_OF_SLOTS + 2; +const GROUP_PAIRS: usize = FOR_OF_SLOTS + 3; +const GROUP_OBJECT: usize = FOR_OF_SLOTS + 4; +const GROUP_CONV: usize = FOR_OF_SLOTS + 5; + +/// Walks an iterable one step at a time, calling the grouping callback between steps, with the fuel of the +/// reference's `groupBy`: its `$Callback` and `$Table("groups")`, then for each item the callback, an object key's +/// `$Table("groupKey")` and `String`, and `$Table("group")`. +pub(crate) struct GroupBy; + +impl ForOf for GroupBy { + fn item(vm: &mut Vm, fr: Frame, x: Value) -> Result { + fr.set(vm, GROUP_ITEM, x); + let (f, index) = (fr.slot(vm, GROUP_F), fr.slot(vm, GROUP_INDEX)); + Ok(Flow::Call(fr.catching( + vm, + f, + Slot::UNDEF, + [Slot::pack(x), index], + )?)) + } + + fn returned(vm: &mut Vm, fr: Frame, r: Slot) -> Result { + if fr.index(vm, GROUP_CONV) == 1 { + fr.set_index(vm, GROUP_CONV, 0); + return add_to_group(vm, fr, r.get()); + } + let index = fr.index(vm, GROUP_INDEX); + fr.set_index(vm, GROUP_INDEX, index + 1); + let mut key = r.get(); + if fr.index(vm, GROUP_OBJECT) != 0 { + fuel::native(vm); + fuel::native(vm); + // `String` of an object key: ToPrimitive now, as a call when it calls the program. + if matches!(key, Value::Obj(_)) { + if vm.converts_by_call(&key, Hint::String) { + fr.set_index(vm, GROUP_CONV, 1); + return Ok(Flow::Call(super::convert_catching( + vm, + fr, + key, + Hint::String, + )?)); + } + key = vm.primitive_of(&key, Hint::String)?; + } + } + add_to_group(vm, fr, key) + } + + fn finish(vm: &mut Vm, fr: Frame) -> Res { + vm.bytecode_builtin(); + let pairs = match fr + .slot(vm, GROUP_PAIRS) + .obj() + .map(|p| &vm.heap[p as usize].kind) + { + Some(Kind::Array(items)) => items.clone(), + _ => Vec::new(), + }; + let pairs = pairs.chunks(2).map(|p| (p[0], p[1])); + if fr.index(vm, GROUP_OBJECT) != 0 { + return object_groups(vm, pairs); + } + Ok(map_groups(vm, pairs)) + } +} + +/// `$Table("group")`: the item goes with its key. +fn add_to_group(vm: &mut Vm, fr: Frame, key: Value) -> Result { + fuel::native(vm); + let item = fr.get(vm, GROUP_ITEM); + if let Some(pairs) = fr.slot(vm, GROUP_PAIRS).obj() + && let Kind::Array(items) = &mut vm.heap[pairs as usize].kind + { + items.extend([key, item]); + } + Ok(Flow::Next) +} + +fn group_by(vm: &mut Vm, args: &[Value], kind: &str, callee: Id) -> Res { + fuel::method(vm); + fuel::method(vm); + let items = arg(args, 0); + if items.is_nullish() { + return Err(vm.type_error(&format!("{kind}.groupBy expects an iterable collection."))); + } + let f = require_callback(vm, &arg(args, 1), &format!("{kind}.groupBy"))?; + fuel::native(vm); + fuel::native(vm); + let object = Value::Num((kind == "Object") as u8 as f64); + let pairs = vm.new_array(Vec::new()); + let own = [ + f, + Value::Num(0.0), + Value::Undef, + pairs, + object, + Value::Num(0.0), + ]; + enter_for_of( + vm, + crate::native::NativeOp::GroupBy, + callee, + Value::Undef, + items, + &own, + ) +} + +fn map_groups(vm: &mut Vm, pairs: impl Iterator) -> Value { + let proto = vm.realm.map_proto; + let id = vm.alloc(Obj::new(Some(proto), Kind::Map(Box::default()))); + for (k, item) in pairs { + let k = normalize(k); + let key = vm.map_key(&k); + match table(vm, id).get(key) { + Some(Value::Obj(arr)) => { + if let Kind::Array(items) = &mut vm.heap[arr as usize].kind { + items.push(item); + } + } + _ => { + let arr = vm.new_array(vec![item]); + let entry_key = vm.map_entry_key(key, k); + table(vm, id).set(key, entry_key, arr); + } + } + } + Value::Obj(id) +} + +fn object_groups(vm: &mut Vm, pairs: impl Iterator) -> Res { + let id = vm.alloc(Obj::new(None, Kind::Ordinary)); + for (k, item) in pairs { + let atom = vm.key_of(&k)?; + match vm.heap[id as usize].props.get(atom).copied() { + Some(Value::Obj(arr)) => { + if let Kind::Array(items) = &mut vm.heap[arr as usize].kind { + items.push(item); + } + } + _ => { + let arr = vm.new_array(vec![item]); + vm.define(id, atom, arr); + } + } + } + Ok(Value::Obj(id)) +} + +fn map_group_by(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + group_by(vm, args, "Map", callee) +} + +fn object_group_by(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + group_by(vm, args, "Object", callee) +} + +// ---------- Set composition ---------- + +const SET_METHODS: [(&str, ()); 7] = [ + ("union", ()), + ("intersection", ()), + ("difference", ()), + ("symmetricDifference", ()), + ("isSubsetOf", ()), + ("isSupersetOf", ()), + ("isDisjointFrom", ()), +]; + +fn new_set(vm: &mut Vm, entries: Vec) -> Id { + let proto = vm.realm.set_proto; + let id = vm.alloc(Obj::new(Some(proto), Kind::Set(Box::default()))); + for v in entries { + let key = vm.map_key(&v); + let entry_key = vm.map_entry_key(key, v); + table(vm, id).set(key, entry_key, Value::Undef); + } + id +} + +fn live_values(vm: &mut Vm, id: Id) -> Vec { + table(vm, id).iter().map(|e| e.0).collect() +} + +fn set_method(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let which = match vm.native_data(callee) { + Value::Num(n) => n as usize, + _ => 0, + }; + let name = SET_METHODS[which].0; + // The fuel is the reference's `setMethod`: its checks, then `$Table` and callback calls per item (see `fuel.rs`). + fuel::method(vm); + let target = receiver(vm, &this, &format!("Set.prototype.{name}"), |k| { + matches!(k, Kind::Set(_)) + })?; + fuel::receiver_then_loop(vm); + let other = arg(args, 0); + fuel::native(vm); + if !matches!(other, Value::Obj(oid) if !vm.is_namespace(oid)) { + return Err(vm.type_error(&format!("Set.{name} expects a Set-like object."))); + } + let sk = vm.names.size; + // `other.size`, `other.has` and `other.keys` as the reference's prelude reads them, through any getters. + let raw = vm.get_calling_value(&other, sk)?; + let size = vm.number_of(&raw)?; + if size.is_nan() { + return Err(vm.type_error(&format!( + "Set.{name} received a Set-like object with an invalid size." + ))); + } + let size = crate::value::to_integer(size); + if size < 0.0 { + return Err(vm.range_error(&format!( + "Set.{name} received a Set-like object with a negative size." + ))); + } + let hk = vm.atoms.intern_static("has"); + let kk = vm.atoms.intern_static("keys"); + let has = vm.get_calling_value(&other, hk)?; + let keys = vm.get_calling_value(&other, kk)?; + fuel::native(vm); + let callable = vm.is_callable(&has); + if callable { + fuel::native(vm); + } + if !callable || !vm.is_callable(&keys) { + return Err(vm.type_error(&format!( + "Set.{name} expects callable 'has' and 'keys' methods." + ))); + } + let own = table(vm, target).live as f64; + fuel::native(vm); + if (name == "isSubsetOf" && own > size) || (name == "isSupersetOf" && own < size) { + vm.bytecode_builtin(); + return Ok(Value::Bool(false)); + } + let result = match name { + "intersection" => Value::Obj(new_set(vm, Vec::new())), + "union" | "difference" | "symmetricDifference" => { + fuel::native(vm); + let vals = live_values(vm, target); + Value::Obj(new_set(vm, vals)) + } + _ => Value::Undef, + }; + // With a Set-like object at least as large, the methods that may drop items ask its `has` for each own item; + // otherwise they walk its `keys()`. + let asks = name == "isSubsetOf" + || (matches!(name, "intersection" | "difference" | "isDisjointFrom") && own <= size); + if asks { + fuel::native(vm); + if builtin_has(vm, &has) { + return ask_builtin(vm, name, target, result.as_obj(), has, other); + } + } + let phase = if asks { ASKING } else { KEYS }; + let slots = [ + Value::Obj(target), + other, + has, + keys, + result, + Value::Num(which as f64), + Value::Num(phase as f64), + Value::Num(0.0), + Value::Undef, + Value::Undef, + Value::Undef, + Value::Bool(false), + ]; + vm.enter_native_sub( + NativeOp::Collections, + SET_METHOD, + callee, + Value::Undef, + &slots, + ) +} + +// The slots of a Set method's frame: the receiver, the Set-like object, its `has` and `keys`, the Set it builds (or +// undefined), which method, the phase, the next entry of the walk, the item asked about, the iterator `keys()` +// returned and its `next`, and whether that iterator is an array's. +const SM_TARGET: usize = 0; +const SM_OTHER: usize = 1; +const SM_HAS: usize = 2; +const SM_KEYS: usize = 3; +const SM_RESULT: usize = 4; +const SM_WHICH: usize = 5; +const SM_PHASE: usize = 6; +const SM_AT: usize = 7; +const SM_ITEM: usize = 8; +const SM_ITER: usize = 9; +const SM_NEXT: usize = 10; +const SM_ARRAY: usize = 11; + +/// What a Set method's frame waits on: `has(item)`, `keys()`, the iterator's `next()`, its `return()`, or a +/// generator closing. +const ASKING: usize = 0; +const KEYS: usize = 1; +const STEPPING: usize = 2; +const CLOSING: usize = 3; +const CLOSING_GEN: usize = 4; + +fn set_method_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + let name = SET_METHODS[fr.index(vm, SM_WHICH)].0; + let target = fr.slot(vm, SM_TARGET).obj().unwrap_or(0); + let result = fr.slot(vm, SM_RESULT).obj(); + let phase = fr.index(vm, SM_PHASE); + match input { + Input::Start if phase == KEYS => { + let (keys, other) = (fr.slot(vm, SM_KEYS), fr.slot(vm, SM_OTHER)); + return fr.call_slots(vm, keys, other, []); + } + Input::Start => {} + Input::Returned(r) => match phase { + ASKING => { + let found = vm.truthy(&r.get()); + let item = fr.get(vm, SM_ITEM); + if answer(vm, name, result, item, found) { + return set_done(vm, Value::Bool(false)); + } + fuel::step(vm); + } + KEYS => opened(vm, fr, r.get(), name)?, + STEPPING => { + let Some(rid) = r.obj() else { + return Err(vm.type_error("Iterator next() result must be an object.")); + }; + let (dk, vk) = (vm.names.done, vm.names.value); + let done = vm.get_calling(rid, dk)?; + if vm.truthy(&done) { + return set_done(vm, set_result(result)); + } + let item = vm.get_calling(rid, vk)?; + if let Some(step) = take_key(vm, fr, item, name, target, result)? { + return Ok(step); + } + } + CLOSING => { + if r.obj().is_none() { + return Err(vm.type_error("Iterator return() result must be an object.")); + } + return set_done(vm, Value::Bool(false)); + } + // A generator closing yielded from a `finally`. + _ => return set_done(vm, Value::Bool(false)), + }, + Input::Finished(_) => return set_done(vm, Value::Bool(false)), + Input::Threw(e) => return Err(e), + } + if phase == ASKING { + let walk = if name == "difference" { + result.unwrap_or(target) + } else { + target + }; + let mut at = fr.index(vm, SM_AT) as u64; + if let Some((item, _)) = table(vm, walk).next_entry(&mut at) { + fr.set_index(vm, SM_AT, at as usize); + fr.set(vm, SM_ITEM, item); + let (has, other) = (fr.slot(vm, SM_HAS), fr.slot(vm, SM_OTHER)); + return fr.call_slots(vm, has, other, [Slot::pack(item)]); + } + return set_done(vm, set_result(result)); + } + // The keys of the Set-like object, one at a time. + let iterator = fr.get(vm, SM_ITER); + loop { + if !vm.truthy(&fr.get(vm, SM_ARRAY)) { + fr.set_index(vm, SM_PHASE, STEPPING); + let next = fr.slot(vm, SM_NEXT); + return fr.call_slots_as(vm, next, Slot::pack(iterator), [], Step::CallUncounted); + } + // An array's iterator, which the reference steps itself. + let Some(item) = vm.iter_step(&iterator)? else { + return set_done(vm, set_result(result)); + }; + if let Some(step) = take_key(vm, fr, item, name, target, result)? { + return Ok(step); + } + } +} + +/// Whether `f` is a Map's, Set's or WeakMap's own `has`, which runs no program code: asking it needs no frame. +fn builtin_has(vm: &Vm, f: &Value) -> bool { + let Value::Obj(id) = f else { return false }; + let Kind::Native { f, .. } = vm.heap[*id as usize].kind else { + return false; + }; + let plain: [crate::vm::NativeFn; 3] = [ + super::collections::SET_HAS, + super::collections::MAP_HAS, + weak_has, + ]; + plain.into_iter().any(|g| std::ptr::fn_addr_eq(f, g)) +} + +/// The walk that asks a built-in `has` about each own item, run here as the reference runs it. +fn ask_builtin( + vm: &mut Vm, + name: &str, + target: Id, + result: Option, + has: Value, + other: Value, +) -> Res { + let walk = if name == "difference" { + result.unwrap_or(target) + } else { + target + }; + // A logical position (see `OrderedMap`): `difference` deletes from the Set it walks, which may compact it. + let mut at = 0; + while let Some((item, _)) = table(vm, walk).next_entry(&mut at) { + let r = vm.call_counted(&has, other, &[item])?; + let found = vm.truthy(&r); + if answer(vm, name, result, item, found) { + vm.bytecode_builtin(); + return Ok(Value::Bool(false)); + } + fuel::step(vm); + } + vm.bytecode_builtin(); + Ok(set_result(result)) +} + +/// What `has(item)` answered, for the methods that ask: whether that decides the result as `false`. +fn answer(vm: &mut Vm, name: &str, result: Option, item: Value, found: bool) -> bool { + match (name, result) { + ("intersection", Some(res)) => { + if found { + let key = vm.map_key(&item); + let entry_key = vm.map_entry_key(key, item); + table(vm, res).set(key, entry_key, Value::Undef); + fuel::native(vm); + } + false + } + ("difference", Some(res)) => { + if found { + let key = vm.map_key(&item); + table(vm, res).delete(key); + fuel::native(vm); + } + false + } + _ => found == (name == "isDisjointFrom"), + } +} + +/// What `keys()` returned: keeps the iterator to step. +fn opened(vm: &mut Vm, fr: Frame, iterator: Value, name: &str) -> Result<(), Value> { + fuel::native(vm); + let Value::Obj(iid) = iterator else { + return Err(vm.type_error(&format!( + "Set.{name} expects 'keys' to return an iterator object." + ))); + }; + fuel::native(vm); + // An array from `keys()` is read like its values iterator. + let array = matches!(vm.heap[iid as usize].kind, Kind::Array(_)); + let it = if array { + vm.get_iterator(&iterator)? + } else { + iterator + }; + let nk = vm.names.next; + let next = vm.get_calling(iid, nk)?; + if !array && !vm.is_callable(&next) { + return Err(vm.type_error("The called value is not a function.")); + } + fr.set(vm, SM_ITER, it); + fr.set(vm, SM_NEXT, next); + fr.set(vm, SM_ARRAY, Value::Bool(array)); + Ok(()) +} + +/// One key of the Set-like object: `Some` with the frame's next step when it decides the result early. +fn take_key( + vm: &mut Vm, + fr: Frame, + item: Value, + name: &str, + target: Id, + result: Option, +) -> Result, Value> { + let item = normalize(item); + let key = vm.map_key(&item); + let found = table(vm, target).has(key); + fuel::native(vm); + match (name, result) { + ("union", Some(res)) => { + let entry_key = vm.map_entry_key(key, item); + table(vm, res).set(key, entry_key, Value::Undef); + fuel::native(vm); + } + ("intersection", Some(res)) => { + if found { + let entry_key = vm.map_entry_key(key, item); + table(vm, res).set(key, entry_key, Value::Undef); + fuel::native(vm); + } + } + ("difference", Some(res)) => { + table(vm, res).delete(key); + fuel::native(vm); + } + ("symmetricDifference", Some(res)) => { + if found { + table(vm, res).delete(key); + } else { + let entry_key = vm.map_entry_key(key, item); + table(vm, res).set(key, entry_key, Value::Undef); + } + fuel::native(vm); + } + _ => { + if found == (name == "isDisjointFrom") { + return close_keys(vm, fr).map(Some); + } + } + } + fuel::step(vm); + Ok(None) +} + +/// Closes the keys iterator after the result was decided early, then finishes with `false`. +fn close_keys(vm: &mut Vm, fr: Frame) -> Result { + let Value::Obj(id) = fr.get(vm, SM_ITER) else { + return set_done(vm, Value::Bool(false)); + }; + match &vm.heap[id as usize].kind { + Kind::Generator(GenState::Suspended(_)) => { + fr.set_index(vm, SM_PHASE, CLOSING_GEN); + match super::collections::resume_catching(vm, fr, id, 1, Value::Undef)? { + None => Ok(Step::Pushed), + Some(_) => set_done(vm, Value::Bool(false)), + } + } + Kind::Generator(_) + | Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } => set_done(vm, Value::Bool(false)), + _ => { + let rk = vm.names.return_; + let f = vm.get_calling(id, rk)?; + if f.is_nullish() { + return set_done(vm, Value::Bool(false)); + } + if !vm.is_callable(&f) { + return Err(vm.type_error("Iterator return must be a function.")); + } + fr.set_index(vm, SM_PHASE, CLOSING); + let it = Slot::pack(Value::Obj(id)); + fr.call_slots_as(vm, Slot::pack(f), it, [], Step::CallUncounted) + } + } +} + +fn set_result(result: Option) -> Value { + match result { + Some(r) => Value::Obj(r), + None => Value::Bool(true), + } +} + +fn set_done(vm: &mut Vm, v: Value) -> Result { + vm.bytecode_builtin(); + Ok(Step::Done(v)) +} + +// ---------- WeakMap and WeakSet ---------- + +fn weak_key(vm: &mut Vm, v: &Value, label: &str) -> Result<(), Value> { + if let Value::Obj(id) = v + && !matches!(vm.heap[*id as usize].kind, Kind::Namespace(_)) + { + return Ok(()); + } + let d = describe_value(vm, v); + Err(vm.type_error(&format!( + "Invalid value used {label}: {d} cannot be held weakly." + ))) +} + +fn holdable(vm: &Vm, v: &Value) -> bool { + matches!(v, Value::Obj(id) if !matches!(vm.heap[*id as usize].kind, Kind::Namespace(_))) +} + +/// The reference's `fillCollection` into the WeakMap or WeakSet in the frame's first own slot: for a WeakMap, +/// `$IsObject`, then `$Table("add")`, for each entry; for a WeakSet, `$Table("add")` for each value. +struct WeakFill; + +impl ForOf for WeakFill { + fn item(vm: &mut Vm, fr: Frame, item: Value) -> Result { + let id = fr.slot(vm, FOR_OF_SLOTS).obj().unwrap_or(0); + if matches!(vm.heap[id as usize].kind, Kind::WeakMap(_)) { + fuel::native(vm); + if !matches!(item, Value::Obj(_)) { + return Err( + vm.type_error("new WeakMap(...) expects [key, value] pairs as entry objects.") + ); + } + let k = vm.get_elem(&item, &Value::Num(0.0))?; + let v = vm.get_elem(&item, &Value::Num(1.0))?; + weak_key(vm, &k, "as weak map key")?; + let key = vm.map_key(&k); + let entry_key = vm.map_entry_key(key, k); + table(vm, id).set(key, entry_key, v); + } else { + weak_key(vm, &item, "in weak set")?; + let key = vm.map_key(&item); + let entry_key = vm.map_entry_key(key, item); + table(vm, id).set(key, entry_key, Value::Undef); + } + fuel::native(vm); + Ok(Flow::Next) + } + + fn finish(vm: &mut Vm, fr: Frame) -> Res { + Ok(fr.get(vm, FOR_OF_SLOTS)) + } +} + +fn weak_ctor(vm: &mut Vm, this: Value, args: &[Value], pairs: bool, callee: Id) -> Res { + let name = if pairs { "WeakMap" } else { "WeakSet" }; + if !matches!(this, Value::Uninit) { + return Err(vm.type_error(&format!("Constructor {name} requires 'new'."))); + } + let proto = if pairs { + vm.realm.std.weak_map + } else { + vm.realm.std.weak_set + }; + let kind = if pairs { + Kind::WeakMap(Box::default()) + } else { + Kind::WeakSet(Box::default()) + }; + let id = vm.alloc(Obj::new(Some(proto), kind)); + let src = arg(args, 0); + if src.is_nullish() { + return Ok(Value::Obj(id)); + } + fuel::method(vm); + let own = [Value::Obj(id)]; + enter_for_of_sub( + vm, + NativeOp::Collections, + WEAK_FILL, + callee, + Value::Undef, + src, + &own, + ) +} + +fn weak_map_ctor(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + weak_ctor(vm, this, args, true, callee) +} + +fn weak_set_ctor(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + weak_ctor(vm, this, args, false, callee) +} + +fn weak_map_of(vm: &mut Vm, this: &Value, name: &str) -> Result { + receiver(vm, this, &format!("WeakMap.prototype.{name}"), |k| { + matches!(k, Kind::WeakMap(_)) + }) +} + +fn weak_get(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = weak_map_of(vm, &this, "get")?; + let k = arg(args, 0); + if !holdable(vm, &k) { + return Ok(Value::Undef); + } + let key = vm.map_key(&k); + Ok(table(vm, id).get(key).unwrap_or_default()) +} + +fn weak_set(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = weak_map_of(vm, &this, "set")?; + let k = arg(args, 0); + weak_key(vm, &k, "as weak map key")?; + let key = vm.map_key(&k); + let entry_key = vm.map_entry_key(key, k); + table(vm, id).set(key, entry_key, arg(args, 1)); + Ok(this) +} + +fn weak_either(vm: &mut Vm, this: &Value, name: &str) -> Result { + let is_map = + matches!(this, Value::Obj(id) if matches!(vm.heap[*id as usize].kind, Kind::WeakMap(_))); + let what = if is_map { "WeakMap" } else { "WeakSet" }; + receiver(vm, this, &format!("{what}.prototype.{name}"), |k| { + matches!(k, Kind::WeakMap(_) | Kind::WeakSet(_)) + }) +} + +fn weak_has(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = weak_either(vm, &this, "has")?; + let k = arg(args, 0); + if !holdable(vm, &k) { + return Ok(Value::Bool(false)); + } + let key = vm.map_key(&k); + Ok(Value::Bool(table(vm, id).has(key))) +} + +fn weak_delete(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = weak_either(vm, &this, "delete")?; + let k = arg(args, 0); + if !holdable(vm, &k) { + return Ok(Value::Bool(false)); + } + let key = vm.map_key(&k); + Ok(Value::Bool(table(vm, id).delete(key))) +} + +fn weak_add(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = receiver(vm, &this, "WeakSet.prototype.add", |k| { + matches!(k, Kind::WeakSet(_)) + })?; + let k = arg(args, 0); + weak_key(vm, &k, "in weak set")?; + let key = vm.map_key(&k); + let entry_key = vm.map_entry_key(key, k); + table(vm, id).set(key, entry_key, Value::Undef); + Ok(this) +} + +fn weak_get_or_insert(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let id = weak_map_of(vm, &this, "getOrInsert")?; + let k = arg(args, 0); + weak_key(vm, &k, "as weak map key")?; + let key = vm.map_key(&k); + if let Some(v) = table(vm, id).get(key) { + return Ok(v); + } + let entry_key = vm.map_entry_key(key, k); + table(vm, id).set(key, entry_key, arg(args, 1)); + Ok(arg(args, 1)) +} + +fn weak_get_or_insert_computed(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let id = weak_map_of(vm, &this, "getOrInsertComputed")?; + weak_key(vm, &arg(args, 0), "as weak map key")?; + get_or_insert_computed(vm, id, args, "WeakMap.getOrInsertComputed", callee) +} + +// The sub-ops of this family's frames. A number keeps its meaning once a snapshot may hold it. +/// `getOrInsertComputed` of a Map or WeakMap. +const GET_OR_INSERT: u16 = 0; +/// A Set composition method given a Set-like object. +const SET_METHOD: u16 = 1; +/// `new WeakMap(iterable)` and `new WeakSet(iterable)`. +const WEAK_FILL: u16 = 2; +/// A generator's `next`, `return` or `throw` called as a native. +pub(crate) const GEN_RESUME: u16 = 3; +/// `Promise.all`, `allSettled`, `any` and `race` over an input they iterate in a frame. +pub(crate) const COMBINE: u16 = 4; +/// The loop that collects a combinator's input. +pub(crate) const COLLECT: u16 = 5; + +/// The steps of this family's native frames (`native::NativeOp::Collections`), by sub-op; see `native.rs`. +pub(crate) fn family_step(vm: &mut Vm, sub: u16, fr: Frame, input: Input) -> Result { + use super::collections; + match sub { + GET_OR_INSERT => get_or_insert_step(vm, fr, input), + SET_METHOD => set_method_step(vm, fr, input), + WEAK_FILL => for_of_step::(vm, fr, input), + GEN_RESUME => collections::gen_resume_step(vm, fr, input), + COMBINE => collections::combine_step(vm, fr, input), + COLLECT => for_of_step::(vm, fr, input), + _ => Ok(Step::Done(Value::Undef)), + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/builtins/string.rs b/packages/codemode-rust/crates/psychoscript/src/builtins/string.rs new file mode 100644 index 0000000000000..f5d43b1f15c35 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/builtins/string.rs @@ -0,0 +1,1713 @@ +//! String, Number and Math. + +use super::fuel::{self, Conversions}; +use super::{arg, regexp, to_index}; +use crate::object::*; +use crate::ops::{Hint, MAX_STRING_LEN}; +use crate::strings::{StrId, StrRef}; +use crate::value::{ + Id, Value, is_js_whitespace, num_to_fixed, num_to_string, to_integer, to_uint32, +}; +use crate::vm::{Res, Vm}; + +pub fn setup(vm: &mut Vm) { + let sp = vm.realm.string_proto; + let string = vm.ctor("String", 1, string_ctor, sp, Value::Undef); + vm.methods( + string, + &[ + ("fromCharCode", 1, string_from_char_code), + ("fromCodePoint", 1, string_from_code_point), + ("raw", 1, string_raw), + ], + ); + vm.methods( + sp, + &[ + ("toString", 0, s_to_string), + ("valueOf", 0, s_to_string), + ("toLowerCase", 0, s_to_lower), + ("toUpperCase", 0, s_to_upper), + ("toLocaleLowerCase", 0, s_to_lower), + ("toLocaleUpperCase", 0, s_to_upper), + ("trim", 0, s_trim), + ("trimStart", 0, s_trim_start), + ("trimLeft", 0, s_trim_start), + ("trimEnd", 0, s_trim_end), + ("trimRight", 0, s_trim_end), + ("localeCompare", 1, s_locale_compare), + ("normalize", 0, s_normalize), + ("split", 2, s_split), + ("slice", 2, s_slice), + ("includes", 1, s_includes), + ("startsWith", 1, s_starts_with), + ("endsWith", 1, s_ends_with), + ("indexOf", 1, s_index_of), + ("lastIndexOf", 1, s_last_index_of), + ("replace", 2, s_replace), + ("replaceAll", 2, s_replace_all), + ("match", 1, s_match), + ("matchAll", 1, s_match_all), + ("search", 1, s_search), + ("repeat", 1, s_repeat), + ("padStart", 2, s_pad_start), + ("padEnd", 2, s_pad_end), + ("charAt", 1, s_char_at), + ("at", 1, s_at), + ("substring", 2, s_substring), + ("substr", 2, s_substr), + ("isWellFormed", 0, s_is_well_formed), + ("toWellFormed", 0, s_to_well_formed), + ("charCodeAt", 1, s_char_code_at), + ("codePointAt", 1, s_code_point_at), + ("concat", 1, s_concat), + ], + ); + let iter = vm.native_fn("[Symbol.iterator]", 0, s_iterator, Value::Undef); + vm.define_hidden(sp, SYM_ITERATOR, iter); + + let np = vm.realm.number_proto; + let number = vm.ctor("Number", 1, number_ctor, np, Value::Undef); + for (name, v) in [ + ("MAX_SAFE_INTEGER", 9007199254740991.0), + ("MIN_SAFE_INTEGER", -9007199254740991.0), + ("MAX_VALUE", f64::MAX), + ("MIN_VALUE", 5e-324), + ("EPSILON", f64::EPSILON), + ("NaN", f64::NAN), + ("POSITIVE_INFINITY", f64::INFINITY), + ("NEGATIVE_INFINITY", f64::NEG_INFINITY), + ] { + vm.constant(number, name, Value::Num(v)); + } + vm.methods( + number, + &[ + ("isInteger", 1, n_is_integer), + ("isFinite", 1, n_is_finite), + ("isNaN", 1, n_is_nan), + ("isSafeInteger", 1, n_is_safe_integer), + ("parseInt", 2, super::object::global_parse_int), + ("parseFloat", 1, super::object::global_parse_float), + ], + ); + vm.methods( + np, + &[ + ("toFixed", 1, n_to_fixed), + ("toLocaleString", 0, n_to_locale_string), + ("toExponential", 1, n_to_exponential), + ("toPrecision", 1, n_to_precision), + ("toString", 1, n_to_string), + ("valueOf", 0, n_value_of), + ], + ); + + let math = vm.new_object(); + for (name, v) in [ + ("PI", std::f64::consts::PI), + ("E", std::f64::consts::E), + ("LN2", std::f64::consts::LN_2), + ("LN10", std::f64::consts::LN_10), + ("LOG2E", std::f64::consts::LOG2_E), + ("LOG10E", std::f64::consts::LOG10_E), + ("SQRT2", std::f64::consts::SQRT_2), + ("SQRT1_2", std::f64::consts::FRAC_1_SQRT_2), + ] { + vm.constant(math, name, Value::Num(v)); + } + vm.methods( + math, + &[ + ("random", 0, m_random), + ("max", 2, m_max), + ("min", 2, m_min), + ("hypot", 2, m_hypot), + ("abs", 1, m_abs), + ("acos", 1, m_acos), + ("acosh", 1, m_acosh), + ("asin", 1, m_asin), + ("asinh", 1, m_asinh), + ("atan", 1, m_atan), + ("atan2", 2, m_atan2), + ("atanh", 1, m_atanh), + ("floor", 1, m_floor), + ("ceil", 1, m_ceil), + ("round", 1, m_round), + ("trunc", 1, m_trunc), + ("sign", 1, m_sign), + ("sqrt", 1, m_sqrt), + ("cbrt", 1, m_cbrt), + ("pow", 2, m_pow), + ("cos", 1, m_cos), + ("cosh", 1, m_cosh), + ("sin", 1, m_sin), + ("sinh", 1, m_sinh), + ("tan", 1, m_tan), + ("tanh", 1, m_tanh), + ("log", 1, m_log), + ("log2", 1, m_log2), + ("log10", 1, m_log10), + ("log1p", 1, m_log1p), + ("exp", 1, m_exp), + ("expm1", 1, m_expm1), + ("f16round", 1, m_f16round), + ("fround", 1, m_fround), + ("clz32", 1, m_clz32), + ("imul", 2, m_imul), + ("sumPrecise", 1, m_sum_precise), + ], + ); + vm.global("Math", Value::Obj(math)); +} + +/// The receiver's text; null and undefined fail with the method's name, as the reference's `simple` does. +fn this_str(vm: &mut Vm, this: &Value, callee: Id) -> Result { + match this { + Value::Str(s) => Ok(*s), + Value::Undef | Value::Null => { + let name = match vm.heap[callee as usize].kind { + Kind::Native { name, .. } => vm.atoms.text(name).to_owned(), + _ => String::new(), + }; + Err(vm.type_error(&format!( + "String.prototype.{name} called on null or undefined." + ))) + } + v => vm.string_of(v), + } +} + +/// The reference's `simple` for a `String.prototype` method: the receiver (with the string hint) and the arguments +/// the method reads (`hints`, one each) are one list of conversions (see `fuel::Conversions`), after the receiver's +/// null check and before `body` runs on the receiver's text and the arguments. +fn simple( + vm: &mut Vm, + callee: Id, + this: Value, + args: &[Value], + hints: &[Hint], + body: impl FnOnce(&mut Vm, &mut Conversions, StrId, &[Value]) -> Res, +) -> Res { + let n = hints.len().min(args.len()); + let mut c = Conversions::default(); + if !matches!(this, Value::Obj(_)) && !args[..n].iter().any(|v| matches!(v, Value::Obj(_))) { + let s = this_str(vm, &this, callee)?; + let r = body(vm, &mut c, s, args); + return c.finish(vm, r); + } + if this.is_nullish() { + this_str(vm, &this, callee)?; + } + let mut list = Vec::with_capacity(args.len() + 1); + list.push(this); + list.extend_from_slice(&args[..n]); + let mut kinds = Vec::with_capacity(n + 1); + kinds.push(Hint::String); + kinds.extend_from_slice(&hints[..n]); + c.convert(vm, &kinds, &mut list, false)?; + let s = this_str(vm, &list[0], callee)?; + list.remove(0); + list.extend_from_slice(&args[n..]); + let r = body(vm, &mut c, s, &list); + c.finish(vm, r) +} + +/// The reference's `str`: argument `i` as text, once it is data (see `data_arg`). +fn arg_str(vm: &mut Vm, name: &str, args: &[Value], i: usize) -> Result { + let v = data_arg(vm, name, args, i)?; + vm.string_of(&v) +} + +/// The reference's `requireDataArgument`: an argument a `String` method reads that is still a promise or a namespace +/// once the receiver and the arguments converted (conversion keeps both) is not data. +fn data_arg(vm: &mut Vm, name: &str, args: &[Value], i: usize) -> Res { + let v = arg(args, i); + if vm.is_opaque_operand(&v) { + return Err(vm.invalid_data(&format!( + "String.{name} expects argument {} to be a data value.", + i + 1 + ))); + } + Ok(v) +} + +fn string_ctor(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + if let Value::Uninit = this { + return Err(vm.type_error( + "new String(...) is not supported; call String(...) without new instead.", + )); + } + if args.is_empty() { + return Ok(vm.static_str("")); + } + fuel::with_primitives(vm, &[Hint::String], [args[0]], false, |vm, [v]| { + Ok(Value::Str(vm.string_of(&v)?)) + }) +} + +fn string_from_char_code(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + if args.len() == 1 + && let Value::Num(n) = args[0] + { + let c = (to_uint32(n) & 0xffff) as u16; + return Ok(vm.char_str(c)); + } + fuel::with_primitive_list(vm, &[Hint::Number], args, true, |vm, args| { + let mut units = Vec::with_capacity(args.len()); + for a in args { + units.push((to_uint32(vm.number_of(a)?) & 0xffff) as u16); + } + Ok(Value::Str(vm.atoms.alloc_units(&units))) + }) +} + +fn string_raw(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + // Program getters on the template are read ahead (`Vm::with_reads`). + let parts = vm.reading(|vm| raw_parts(vm, args))?; + fuel::with_primitive_list(vm, &[Hint::String], &parts, true, |vm, parts| { + let mut out = String::new(); + for p in parts { + let t = vm.string_of(p)?; + out.push_str(vm.text(t)); + } + if out.encode_utf16().count() > MAX_STRING_LEN { + return Err(vm.range_error("Invalid string length")); + } + Ok(vm.string_val(out)) + }) +} + +/// `String.raw`'s literals, each followed by its substitution but the last. +fn raw_parts(vm: &mut Vm, args: &[Value]) -> Result, Value> { + let template = arg(args, 0); + let raw = match template { + Value::Obj(id) if !vm.is_namespace(id) => { + let k = vm.atoms.intern_static("raw"); + vm.get_obj(id, k) + } + _ => Value::Undef, + }; + if !matches!(raw, Value::Obj(_)) { + return Err(vm.type_error("String.raw expects a template object with a raw array.")); + } + let lk = vm.names.length; + let len = vm.get(&raw, lk)?; + let count = to_integer(vm.number_of(&len)?).max(0.0); + if count > crate::ops::MAX_ARRAY_LEN as f64 { + return Err(vm.range_error("Invalid array length")); + } + let count = count as usize; + let mut parts = Vec::with_capacity(count * 2); + for i in 0..count { + parts.push(vm.get_elem(&raw, &Value::Num(i as f64))?); + if i + 1 < count && i + 1 < args.len() { + parts.push(args[i + 1]); + } + } + Ok(parts) +} + +fn string_from_code_point(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + fuel::with_primitive_list(vm, &[Hint::Number], args, true, |vm, args| { + let mut out = String::new(); + for a in args { + let n = vm.number_of(a)?; + match char::from_u32(n as u32) { + Some(c) if n.fract() == 0.0 && n >= 0.0 => out.push(c), + // The reference's host words every invalid code point alike. + _ => { + return Err(vm.range_error( + "Arguments contain a value that is out of range of code points", + )); + } + } + } + Ok(vm.string_val(crate::strings::external_text(out))) + }) +} + +fn pos_arg(vm: &mut Vm, name: &str, args: &[Value], i: usize) -> Result { + let v = data_arg(vm, name, args, i)?; + Ok(to_integer(vm.number_of(&v)?)) +} + +fn s_char_at(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[Hint::Number], |vm, _, s, args| { + let i = pos_arg(vm, "charAt", args, 0)?; + let c = if i < 0.0 { + None + } else { + vm.atoms.sref(s).code_unit(i as usize) + }; + Ok(match c { + Some(c) => vm.char_str(c), + None => vm.static_str(""), + }) + }) +} + +fn s_char_code_at(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[Hint::Number], |vm, _, s, args| { + let i = pos_arg(vm, "charCodeAt", args, 0)?; + if i < 0.0 { + return Ok(Value::Num(f64::NAN)); + } + Ok(Value::Num( + vm.atoms + .sref(s) + .code_unit(i as usize) + .map(|c| c as f64) + .unwrap_or(f64::NAN), + )) + }) +} + +fn s_code_point_at(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[Hint::Number], |vm, _, s, args| { + let i = pos_arg(vm, "codePointAt", args, 0)?; + let units = vm.atoms.sref(s).utf16(); + if i < 0.0 || i as usize >= units.len() { + return Ok(Value::Undef); + } + let i = i as usize; + let a = units[i]; + if (0xd800..0xdc00).contains(&a) + && let Some(&b) = units.get(i + 1) + && (0xdc00..0xe000).contains(&b) + { + return Ok(Value::Num( + (((a as u32 - 0xd800) << 10) + (b as u32 - 0xdc00) + 0x10000) as f64, + )); + } + Ok(Value::Num(a as f64)) + }) +} + +fn s_at(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[Hint::Number], |vm, _, s, args| { + let len = vm.atoms.sref(s).len16() as f64; + let mut i = pos_arg(vm, "at", args, 0)?; + if i < 0.0 { + i += len; + } + if i < 0.0 || i >= len { + return Ok(Value::Undef); + } + Ok(match vm.atoms.sref(s).code_unit(i as usize) { + Some(c) => vm.char_str(c), + None => Value::Undef, + }) + }) +} + +/// Finds `needle` in `hay` at or after code unit `from`, in code units. +fn find16(hay: StrRef, needle: StrRef, from: usize) -> Option { + if hay.ascii && needle.ascii { + if from > hay.s.len() { + return None; + } + return hay.s[from..].find(needle.s).map(|i| i + from); + } + let h = hay.utf16(); + let n = needle.utf16(); + if n.is_empty() { + return if from <= h.len() { Some(from) } else { None }; + } + if n.len() > h.len() { + return None; + } + (from..=h.len() - n.len()).find(|&i| h[i..i + n.len()] == n[..]) +} + +fn rfind16(hay: StrRef, needle: StrRef, from: usize) -> Option { + let h = hay.utf16(); + let n = needle.utf16(); + if n.len() > h.len() { + return None; + } + let start = from.min(h.len() - n.len()); + (0..=start).rev().find(|&i| h[i..i + n.len()] == n[..]) +} + +fn s_index_of(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple( + vm, + callee, + this, + args, + &[Hint::String, Hint::Number], + |vm, _, s, args| { + let n = arg_str(vm, "indexOf", args, 0)?; + let len = vm.atoms.sref(s).len16() as f64; + let from = pos_arg(vm, "indexOf", args, 1)?.clamp(0.0, len) as usize; + let r = find16(vm.atoms.sref(s), vm.atoms.sref(n), from); + Ok(Value::Num(r.map(|i| i as f64).unwrap_or(-1.0))) + }, + ) +} + +fn s_last_index_of(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple( + vm, + callee, + this, + args, + &[Hint::String, Hint::Number], + |vm, _, s, args| { + let n = arg_str(vm, "lastIndexOf", args, 0)?; + let pos = { + let v = data_arg(vm, "lastIndexOf", args, 1)?; + vm.number_of(&v)? + }; + let from = if pos.is_nan() { + usize::MAX + } else { + to_integer(pos).max(0.0) as usize + }; + let r = rfind16(vm.atoms.sref(s), vm.atoms.sref(n), from); + Ok(Value::Num(r.map(|i| i as f64).unwrap_or(-1.0))) + }, + ) +} + +/// `includes`, `startsWith` and `endsWith` reject a RegExp before converting their arguments. +fn reject_regexp(vm: &mut Vm, args: &[Value], name: &str) -> Result<(), Value> { + if regexp::as_regexp(vm, &arg(args, 0)).is_some() { + return Err(vm.type_error(&format!( + "String.{name} cannot take a regular expression; use regex.test(string) or String.search instead." + ))); + } + Ok(()) +} + +fn s_includes(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[], |vm, c, s, args| { + reject_regexp(vm, args, "includes")?; + let listed = &args[..args.len().min(2)]; + let args = c.converted(vm, &[Hint::String, Hint::Number], listed, false)?; + let n = arg_str(vm, "includes", &args, 0)?; + let len = vm.atoms.sref(s).len16() as f64; + let from = pos_arg(vm, "includes", &args, 1)?.clamp(0.0, len) as usize; + Ok(Value::Bool( + find16(vm.atoms.sref(s), vm.atoms.sref(n), from).is_some(), + )) + }) +} + +fn s_starts_with(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[], |vm, c, s, args| { + reject_regexp(vm, args, "startsWith")?; + let listed = &args[..args.len().min(2)]; + let args = c.converted(vm, &[Hint::String, Hint::Number], listed, false)?; + let n = arg_str(vm, "startsWith", &args, 0)?; + let len = vm.atoms.sref(s).len16() as f64; + let from = pos_arg(vm, "startsWith", &args, 1)?.clamp(0.0, len) as usize; + let (h, n) = (vm.atoms.sref(s), vm.atoms.sref(n)); + if h.ascii && n.ascii { + return Ok(Value::Bool(h.s[from..].starts_with(n.s))); + } + let (h, n) = (h.utf16(), n.utf16()); + Ok(Value::Bool( + h.len() >= from + n.len() && h[from..from + n.len()] == n[..], + )) + }) +} + +fn s_ends_with(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[], |vm, c, s, args| { + reject_regexp(vm, args, "endsWith")?; + let listed = &args[..args.len().min(2)]; + let args = c.converted(vm, &[Hint::String, Hint::Number], listed, false)?; + let n = arg_str(vm, "endsWith", &args, 0)?; + let len = vm.atoms.sref(s).len16(); + let end = match data_arg(vm, "endsWith", &args, 1)? { + Value::Undef => len, + v => to_integer(vm.number_of(&v)?).clamp(0.0, len as f64) as usize, + }; + let h = vm.atoms.sref(s).utf16(); + let n = vm.atoms.sref(n).utf16(); + Ok(Value::Bool( + end >= n.len() && h[end - n.len()..end] == n[..], + )) + }) +} + +fn s_slice(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple( + vm, + callee, + this, + args, + &[Hint::Number, Hint::Number], + |vm, _, s, args| { + let len = vm.atoms.sref(s).len16(); + let start = data_arg(vm, "slice", args, 0)?; + let start = to_index(vm, &start, len, 0)?; + let end = data_arg(vm, "slice", args, 1)?; + let end = to_index(vm, &end, len, len)?; + if start == 0 && end >= len { + return Ok(Value::Str(s)); + } + let out = vm.atoms.sref(s).slice16(start, end); + Ok(vm.string_val(out)) + }, + ) +} + +fn s_substring(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple( + vm, + callee, + this, + args, + &[Hint::Number, Hint::Number], + |vm, _, s, args| { + let len = vm.atoms.sref(s).len16() as f64; + let a = pos_arg(vm, "substring", args, 0)?.clamp(0.0, len) as usize; + let b = match data_arg(vm, "substring", args, 1)? { + Value::Undef => len as usize, + v => to_integer(vm.number_of(&v)?).clamp(0.0, len) as usize, + }; + let out = vm.atoms.sref(s).slice16(a.min(b), a.max(b)); + Ok(vm.string_val(out)) + }, + ) +} + +fn s_substr(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple( + vm, + callee, + this, + args, + &[Hint::Number, Hint::Number], + |vm, _, s, args| { + let len = vm.atoms.sref(s).len16(); + let start = data_arg(vm, "substr", args, 0)?; + let start = to_index(vm, &start, len, 0)?; + let count = match data_arg(vm, "substr", args, 1)? { + Value::Undef => len, + v => to_integer(vm.number_of(&v)?).max(0.0) as usize, + }; + let out = vm.atoms.sref(s).slice16(start, start.saturating_add(count)); + Ok(vm.string_val(out)) + }, + ) +} + +fn map_text(vm: &mut Vm, callee: Id, this: &Value, f: fn(&str) -> String) -> Res { + simple(vm, callee, *this, &[], &[], |vm, _, s, _| { + let out = f(vm.text(s)); + Ok(vm.string_val(out)) + }) +} + +fn s_to_upper(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + map_text(vm, callee, &this, str::to_uppercase) +} + +fn s_to_lower(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + map_text(vm, callee, &this, str::to_lowercase) +} + +fn s_trim(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + map_text(vm, callee, &this, |s| { + s.trim_matches(is_js_whitespace).to_owned() + }) +} + +fn s_trim_start(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + map_text(vm, callee, &this, |s| { + s.trim_start_matches(is_js_whitespace).to_owned() + }) +} + +fn s_trim_end(vm: &mut Vm, this: Value, _args: &[Value], callee: Id) -> Res { + map_text(vm, callee, &this, |s| { + s.trim_end_matches(is_js_whitespace).to_owned() + }) +} + +fn pad(vm: &mut Vm, callee: Id, this: Value, args: &[Value], at_start: bool) -> Res { + let name = if at_start { "padStart" } else { "padEnd" }; + simple( + vm, + callee, + this, + args, + &[Hint::Number, Hint::String], + |vm, _, s, args| { + let target = pos_arg(vm, name, args, 0)?; + if target > MAX_STRING_LEN as f64 { + return Err(vm.range_error("Invalid string length")); + } + let fill = match arg(args, 1) { + Value::Undef => " ".to_owned(), + _ => { + let f = arg_str(vm, name, args, 1)?; + vm.text(f).to_owned() + } + }; + let len = vm.atoms.sref(s).len16(); + if target <= len as f64 || fill.is_empty() { + return Ok(Value::Str(s)); + } + let need = target as usize - len; + let padding: Vec = crate::strings::units_of(&fill) + .into_iter() + .cycle() + .take(need) + .collect(); + let padding = crate::strings::from_units(&padding); + let out = if at_start { + padding + vm.text(s) + } else { + vm.text(s).to_owned() + &padding + }; + Ok(vm.string_val(out)) + }, + ) +} + +fn s_pad_start(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + pad(vm, callee, this, args, true) +} + +fn s_pad_end(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + pad(vm, callee, this, args, false) +} + +fn s_repeat(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[Hint::Number], |vm, _, s, args| { + let n = pos_arg(vm, "repeat", args, 0)?; + if n < 0.0 || n.is_infinite() { + return Err(vm.range_error("String.repeat expects a finite non-negative count.")); + } + if vm.text(s).len() as f64 * n > MAX_STRING_LEN as f64 { + return Err(vm.range_error("Invalid string length")); + } + let out = vm.text(s).repeat(n as usize); + Ok(vm.string_val(out)) + }) +} + +fn s_split(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[], split) +} + +/// The reference's `split` body: the limit, then a separator that is not a RegExp, are one list of conversions. +fn split(vm: &mut Vm, c: &mut Conversions, s: StrId, args: &[Value]) -> Res { + let re = regexp::as_regexp(vm, &arg(args, 0)); + let mut listed = [ + arg(args, 1), + if re.is_some() { + Value::Undef + } else { + arg(args, 0) + }, + ]; + c.convert(vm, &[Hint::Number, Hint::String], &mut listed, false)?; + // Whether there is a limit is the argument's question; a limit that converts to undefined is NaN, so zero. + let limit = match (arg(args, 1), listed[0]) { + (Value::Undef, _) => Value::Undef, + (_, Value::Undef) => Value::Num(f64::NAN), + (_, v) => data_arg(vm, "split", &[Value::Undef, v], 1)?, + }; + if let Some(re) = re { + return regexp::string_split(vm, s, re, limit); + } + let limit = match limit { + Value::Undef => u32::MAX as usize, + v => to_uint32(vm.number_of(&v)?) as usize, + }; + let parts: Vec = match arg(args, 0) { + Value::Undef if limit == 0 => Vec::new(), + Value::Undef => vec![Value::Str(s)], + _ => { + let sep = arg_str(vm, "split", &listed[1..], 0)?; + if vm.text(sep).is_empty() { + let units = vm.atoms.sref(s).utf16(); + units.iter().take(limit).map(|c| vm.char_str(*c)).collect() + } else if vm.atoms.is_wtf(s) || vm.atoms.is_wtf(sep) { + // A separator can cut a pair, so carriers split by code units. + let (h, n) = (vm.atoms.sref(s).utf16(), vm.atoms.sref(sep).utf16()); + let mut pieces = Vec::new(); + let (mut start, mut i) = (0, 0); + while pieces.len() < limit && i + n.len() <= h.len() { + if h[i..i + n.len()] == n[..] { + pieces.push(h[start..i].to_vec()); + i += n.len(); + start = i; + } else { + i += 1; + } + } + if pieces.len() < limit { + pieces.push(h[start..].to_vec()); + } + pieces + .iter() + .map(|p| Value::Str(vm.atoms.alloc_units(p))) + .collect() + } else { + let pieces: Vec = vm + .text(s) + .split(vm.text(sep)) + .take(limit) + .map(str::to_owned) + .collect(); + pieces.into_iter().map(|p| vm.string_val(p)).collect() + } + } + }; + Ok(vm.new_array(parts)) +} + +fn expand_replacement(template: &str, matched: &str, pos: usize, subject: &str) -> String { + let mut out = String::new(); + let mut chars = template.chars().peekable(); + while let Some(c) = chars.next() { + if c != '$' { + out.push(c); + continue; + } + match chars.peek() { + Some('$') => { + chars.next(); + out.push('$'); + } + Some('&') => { + chars.next(); + out.push_str(matched); + } + Some('`') => { + chars.next(); + out.push_str(&subject[..pos]); + } + Some('\'') => { + chars.next(); + out.push_str(&subject[pos + matched.len()..]); + } + _ => out.push('$'), + } + } + out +} + +fn replace(vm: &mut Vm, callee: Id, this: Value, args: &[Value], all: bool) -> Res { + simple(vm, callee, this, args, &[], |vm, c, s, args| { + replace_in(vm, c, s, args, all) + }) +} + +/// The reference's `replace` body: a pattern that is not a RegExp, then a replacement that is not a callback, are +/// one list of conversions. +fn replace_in(vm: &mut Vm, c: &mut Conversions, s: StrId, args: &[Value], all: bool) -> Res { + let re = regexp::as_regexp(vm, &arg(args, 0)); + let rep = arg(args, 1); + let callable = super::supported_callback(vm, &rep); + // A function callback sites don't admit fails once the pattern converted. + let refused = !callable && vm.type_of(&rep) == "function"; + let mut listed = [ + if re.is_some() { + Value::Undef + } else { + arg(args, 0) + }, + if callable { Value::Undef } else { rep }, + ]; + c.convert(vm, &[Hint::String], &mut listed, false)?; + if refused { + let name = format!("String.{}", if all { "replaceAll" } else { "replace" }); + return Err(super::unsupported_callable( + vm, + &name, + "replacer", + "(match) => fn(match)", + )); + } + let name = if all { "replaceAll" } else { "replace" }; + if let Some(re) = re { + let rep = if callable { + rep + } else { + data_arg(vm, name, &listed, 1)? + }; + return regexp::string_replace(vm, c, s, re, &rep, all); + } + let pat = arg_str(vm, name, &listed, 0)?; + let rep = if callable { rep } else { listed[1] }; + let template = if callable { + None + } else { + let t = arg_str(vm, name, &listed, 1)?; + Some(vm.text(t).to_owned()) + }; + if !(vm.atoms.sref(s).ascii && vm.atoms.sref(pat).ascii) { + return replace16(vm, c, s, pat, &rep, template, all); + } + let subject = vm.text(s).to_owned(); + let needle = vm.text(pat).to_owned(); + let mut positions = Vec::new(); + if needle.is_empty() { + if all { + positions.extend(subject.char_indices().map(|(i, _)| i)); + positions.push(subject.len()); + } else { + positions.push(0); + } + } else { + let mut from = 0; + while let Some(i) = subject[from..].find(&needle) { + positions.push(from + i); + from += i + needle.len(); + if !all { + break; + } + } + } + // With a callback, the reference finds the matches, then hands them to its prelude's `replaceWith`. + if callable { + c.handoff(vm); + } + if positions.is_empty() { + if callable { + vm.bytecode_builtin(); + } + return Ok(Value::Str(s)); + } + if callable { + let mut gaps = Vec::with_capacity(positions.len()); + let mut calls = Vec::with_capacity(positions.len()); + let mut last = 0; + for pos in positions { + gaps.push(vm.str_val(&subject[last..pos])); + let offset = subject[..pos].encode_utf16().count() as f64; + calls.push(vec![Value::Str(pat), Value::Num(offset), Value::Str(s)]); + last = pos + needle.len(); + } + let tail = vm.str_val(&subject[last..]); + return enter_replace_with(vm, rep, gaps, calls, tail, false); + } + let mut out = String::new(); + let mut last = 0; + for pos in positions { + out.push_str(&subject[last..pos]); + if let Some(t) = &template { + out.push_str(&expand_replacement(t, &needle, pos, &subject)); + } + last = pos + needle.len(); + } + out.push_str(&subject[last..]); + Ok(vm.string_val(out)) +} + +// The slots of a `replace` frame with a callback: the callback, the text so far, the next match, how many there are, +// and whether the text is checked against the longest string after each; then, for each match, the text before it and +// its call's arguments (an internal array), then the text after the last. +const REP_F: usize = 0; +const REP_OUT: usize = 1; +const REP_K: usize = 2; +const REP_N: usize = 3; +const REP_CHECK: usize = 4; +/// Set while a callback's result is converted by a call (see `Frame::convert`). +const REP_CONV: usize = 5; +const REP_MATCHES: usize = 6; + +/// Pushes a frame that replaces each match with what the callback `f` returns for it, as the reference's prelude +/// `replaceWith` does once the matches are found: the result as a string, then `String`'s fifty and a back-edge. +pub(crate) fn enter_replace_with( + vm: &mut Vm, + f: Value, + gaps: Vec, + calls: Vec>, + tail: Value, + check: bool, +) -> Res { + let empty = vm.static_str(""); + let n = calls.len(); + let mut slots = vec![ + f, + empty, + Value::Num(0.0), + Value::Num(n as f64), + Value::Bool(check), + Value::Num(0.0), + ]; + for (gap, args) in gaps.into_iter().zip(calls) { + let args = vm.new_array(args); + slots.extend([gap, args]); + } + slots.push(tail); + let callee = match f { + Value::Obj(id) => id, + _ => 0, + }; + vm.enter_native( + crate::native::NativeOp::ReplaceWith, + callee, + Value::Undef, + &slots, + ) +} + +/// The step of a `replace` frame. +pub(crate) fn replace_with_step( + vm: &mut Vm, + fr: crate::native::Frame, + input: crate::native::Input, +) -> Result { + use crate::native::{Input, Step}; + let mut k = fr.index(vm, REP_K); + let append = |vm: &mut Vm, piece: Value| { + if let (Value::Str(o), Value::Str(p)) = (fr.get(vm, REP_OUT), piece) { + let joined = vm.concat_strs(&[o, p]); + fr.set(vm, REP_OUT, joined); + } + }; + match input { + Input::Returned(r) => { + let r = r.get(); + let converted = fr.index(vm, REP_CONV) == 1; + fr.set_index(vm, REP_CONV, 0); + if !converted && vm.converts_by_call(&r, crate::ops::Hint::String) { + fr.set_index(vm, REP_CONV, 1); + return fr.convert(vm, r, crate::ops::Hint::String); + } + let r = vm.string_of(&r)?; + super::fuel::native(vm); + super::fuel::step(vm); + append(vm, Value::Str(r)); + if matches!(fr.get(vm, REP_CHECK), Value::Bool(true)) + && let Value::Str(o) = fr.get(vm, REP_OUT) + && vm.text(o).len() > MAX_STRING_LEN + { + return Err(vm.range_error("Invalid string length")); + } + k += 1; + fr.set_index(vm, REP_K, k); + } + Input::Threw(e) => return Err(e), + Input::Start | Input::Finished(_) => {} + } + let n = fr.index(vm, REP_N); + if k >= n { + let tail = fr.get(vm, REP_MATCHES + 2 * n); + append(vm, tail); + vm.bytecode_builtin(); + return Ok(Step::Done(fr.get(vm, REP_OUT))); + } + let gap = fr.get(vm, REP_MATCHES + 2 * k); + append(vm, gap); + let args = match fr + .get(vm, REP_MATCHES + 2 * k + 1) + .as_obj() + .map(|a| &vm.heap[a as usize].kind) + { + Some(crate::object::Kind::Array(items)) => items.clone(), + _ => Vec::new(), + }; + let f = fr.slot(vm, REP_F); + vm.stack.extend_from_slice(&[f, crate::value::Slot::UNDEF]); + vm.stack + .extend(args.iter().map(|v| crate::value::Slot::pack(*v))); + vm.native_call(args.len()) +} + +/// `replace` by code units, for a subject or pattern beyond ASCII: matches and an empty pattern's positions fall +/// between code units, even inside a pair. +fn replace16( + vm: &mut Vm, + c: &Conversions, + s: StrId, + pat: StrId, + rep: &Value, + template: Option, + all: bool, +) -> Res { + let subject = vm.atoms.sref(s).utf16(); + let needle = vm.atoms.sref(pat).utf16(); + let template = template.map(|t| crate::strings::units_of(&t)); + let mut positions = Vec::new(); + if needle.is_empty() { + if all { + positions.extend(0..=subject.len()); + } else { + positions.push(0); + } + } else { + let mut i = 0; + while i + needle.len() <= subject.len() { + if subject[i..i + needle.len()] == needle[..] { + positions.push(i); + if !all { + break; + } + i += needle.len(); + } else { + i += 1; + } + } + } + let callable = template.is_none(); + if callable { + c.handoff(vm); + } + if positions.is_empty() { + if callable { + vm.bytecode_builtin(); + } + return Ok(Value::Str(s)); + } + if callable { + let mut gaps = Vec::with_capacity(positions.len()); + let mut calls = Vec::with_capacity(positions.len()); + let mut last = 0; + for pos in positions { + gaps.push(Value::Str(vm.atoms.alloc_units(&subject[last..pos]))); + calls.push(vec![Value::Str(pat), Value::Num(pos as f64), Value::Str(s)]); + last = pos + needle.len(); + } + let tail = Value::Str(vm.atoms.alloc_units(&subject[last..])); + return enter_replace_with(vm, *rep, gaps, calls, tail, false); + } + let mut out: Vec = Vec::with_capacity(subject.len()); + let mut last = 0; + for pos in positions { + out.extend_from_slice(&subject[last..pos]); + if let Some(t) = &template { + expand_replacement16(&mut out, t, &needle, pos, &subject); + } + last = pos + needle.len(); + } + out.extend_from_slice(&subject[last..]); + Ok(Value::Str(vm.atoms.alloc_units(&out))) +} + +/// `expand_replacement` in code units. +fn expand_replacement16( + out: &mut Vec, + template: &[u16], + matched: &[u16], + pos: usize, + subject: &[u16], +) { + let dollar = b'$' as u16; + let mut i = 0; + while i < template.len() { + let c = template[i]; + i += 1; + if c != dollar { + out.push(c); + continue; + } + match template + .get(i) + .map(|n| *n as u8 as char) + .filter(|_| template[i] < 128) + { + Some('$') => out.push(dollar), + Some('&') => out.extend_from_slice(matched), + Some('`') => out.extend_from_slice(&subject[..pos]), + Some('\'') => out.extend_from_slice(&subject[pos + matched.len()..]), + _ => { + out.push(dollar); + continue; + } + } + i += 1; + } +} + +fn s_replace(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + replace(vm, callee, this, args, false) +} + +fn s_replace_all(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + replace(vm, callee, this, args, true) +} + +fn s_concat(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[], |vm, c, s, args| { + let args = c.converted(vm, &[Hint::String], args, false)?; + let mut out = vm.text(s).to_owned(); + for i in 0..args.len() { + let t = arg_str(vm, "concat", &args, i)?; + out.push_str(vm.text(t)); + } + Ok(vm.string_val(out)) + }) +} + +fn s_to_string(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[], |_, _, s, _| Ok(Value::Str(s))) +} + +fn s_locale_compare(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + use icu_collator::options::{CollatorOptions, Strength}; + use icu_collator::{Collator, CollatorBorrowed}; + // The root collation the reference's host uses for its default locale (en-US), built once per process. + static COLLATOR: std::sync::LazyLock>> = + std::sync::LazyLock::new(|| { + Collator::try_new(Default::default(), CollatorOptions::default()).ok() + }); + static PRIMARY: std::sync::LazyLock>> = + std::sync::LazyLock::new(|| { + let mut options = CollatorOptions::default(); + options.strength = Some(Strength::Primary); + Collator::try_new(Default::default(), options).ok() + }); + simple(vm, callee, this, args, &[Hint::String], |vm, _, s, args| { + let o = arg_str(vm, "localeCompare", args, 0)?; + let (a, b) = (vm.atoms.sref(s), vm.atoms.sref(o)); + let order = match (COLLATOR.as_ref(), PRIMARY.as_ref()) { + (Some(c), Some(p)) if a.units.is_some() || b.units.is_some() => { + compare_lone(c, p, &a.utf16(), &b.utf16()) + } + (Some(c), _) => c.compare(a.s, b.s), + _ => a.cmp16(b), + }; + Ok(Value::Num(match order { + std::cmp::Ordering::Less => -1.0, + std::cmp::Ordering::Equal => 0.0, + std::cmp::Ordering::Greater => 1.0, + })) + }) +} + +/// Collates strings with lone surrogates as the reference's ICU does, where each weighs like an unassigned code +/// point of its own value: above every assigned character, below private use and U+FFFD. ICU4X weighs them as +/// U+FFFD, so they stand in as U+D7FF, the unassigned code point just below them, and strings equal at the primary +/// level then order by their lone surrogates, which ICU tells apart at that level. +fn compare_lone( + full: &icu_collator::CollatorBorrowed, + primary: &icu_collator::CollatorBorrowed, + a: &[u16], + b: &[u16], +) -> std::cmp::Ordering { + let lone = |u: &[u16]| -> (Vec, Vec) { + let mut text = Vec::with_capacity(u.len()); + let mut lone = Vec::new(); + for r in char::decode_utf16(u.iter().copied()) { + match r { + Ok(c) => { + let mut buf = [0u16; 2]; + text.extend_from_slice(c.encode_utf16(&mut buf)); + } + Err(e) => { + text.push(0xD7FF); + lone.push(e.unpaired_surrogate()); + } + } + } + (text, lone) + }; + let ((ta, la), (tb, lb)) = (lone(a), lone(b)); + if primary.compare_utf16(&ta, &tb).is_eq() && la != lb { + return la.cmp(&lb); + } + full.compare_utf16(&ta, &tb) +} + +/// The reference's `withPattern`: a RegExp as is, anything else a list of its own, converted with the string hint. +fn pattern_value(vm: &mut Vm, c: &mut Conversions, args: &[Value]) -> Res { + let mut p = [arg(args, 0)]; + if regexp::as_regexp(vm, &p[0]).is_some() { + return Ok(p[0]); + } + c.convert(vm, &[Hint::String], &mut p, false)?; + Ok(p[0]) +} + +fn s_match(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[], |vm, c, s, args| { + let p = pattern_value(vm, c, args)?; + regexp::string_match(vm, s, &p) + }) +} + +fn s_match_all(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[], |vm, c, s, args| { + let p = pattern_value(vm, c, args)?; + regexp::string_match_all(vm, s, &p) + }) +} + +fn s_search(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[], |vm, c, s, args| { + let p = pattern_value(vm, c, args)?; + regexp::string_search(vm, s, &p) + }) +} + +fn s_normalize(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[Hint::String], |vm, _, s, args| { + normalize(vm, s, args) + }) +} + +fn normalize(vm: &mut Vm, s: StrId, args: &[Value]) -> Res { + use unicode_normalization::UnicodeNormalization; + let form = match arg(args, 0) { + Value::Undef => "NFC".to_owned(), + _ => { + let f = arg_str(vm, "normalize", args, 0)?; + vm.text(f).to_owned() + } + }; + let text = vm.text(s); + let out: String = match form.as_str() { + "NFC" => text.nfc().collect(), + "NFD" => text.nfd().collect(), + "NFKC" => text.nfkc().collect(), + "NFKD" => text.nfkd().collect(), + _ => { + let mut q = String::new(); + crate::convert::quote(&mut q, &form); + return Err(vm.range_error(&format!( + "String.normalize expects the form \"NFC\", \"NFD\", \"NFKC\", or \"NFKD\" (got {q})." + ))); + } + }; + if out == text { + return Ok(Value::Str(s)); + } + Ok(vm.string_val(out)) +} + +fn s_is_well_formed(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[], |vm, _, s, _| { + Ok(Value::Bool(vm.atoms.sref(s).well_formed())) + }) +} + +fn s_to_well_formed(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[], |vm, _, s, _| { + if vm.atoms.sref(s).well_formed() { + return Ok(Value::Str(s)); + } + let fixed = String::from_utf16_lossy(&vm.atoms.sref(s).utf16()); + Ok(vm.string_val(crate::strings::external_text(fixed))) + }) +} + +fn s_iterator(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + simple(vm, callee, this, args, &[], |vm, _, s, _| { + vm.get_iterator(&Value::Str(s)) + }) +} + +// ---------- Number ---------- + +fn number_ctor(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + if let Value::Uninit = this { + return Err(vm.type_error( + "new Number(...) is not supported; call Number(...) without new instead.", + )); + } + if args.is_empty() { + return Ok(Value::Num(0.0)); + } + fuel::with_primitives(vm, &[Hint::Number], [args[0]], false, |vm, [v]| { + Ok(Value::Num(vm.number_of(&v)?)) + }) +} + +fn num_arg(args: &[Value]) -> Option { + match args.first() { + Some(Value::Num(n)) => Some(*n), + _ => None, + } +} + +fn n_is_integer(_vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + Ok(Value::Bool( + num_arg(args).is_some_and(|n| n.is_finite() && n.fract() == 0.0), + )) +} + +fn n_is_safe_integer(_vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + Ok(Value::Bool(num_arg(args).is_some_and(|n| { + n.fract() == 0.0 && n.abs() <= 9007199254740991.0 + }))) +} + +fn n_is_finite(_vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + Ok(Value::Bool(num_arg(args).is_some_and(f64::is_finite))) +} + +fn n_is_nan(_vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + Ok(Value::Bool(num_arg(args).is_some_and(f64::is_nan))) +} + +fn this_num(vm: &mut Vm, this: &Value, name: &str) -> Result { + match this { + Value::Num(n) => Ok(*n), + _ => Err(vm.type_error(&format!( + "Number.prototype.{name} requires that 'this' be a Number." + ))), + } +} + +/// The reference's `formatting`: after the receiver's check, the one argument is a list of conversions. +fn formatting(vm: &mut Vm, args: &[Value], body: impl FnOnce(&mut Vm, &[Value]) -> Res) -> Res { + fuel::with_primitives(vm, &[Hint::Number], [arg(args, 0)], false, |vm, digits| { + body(vm, &digits) + }) +} + +fn n_to_fixed(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let x = this_num(vm, &this, "toFixed")?; + formatting(vm, args, |vm, args| { + let d = to_integer(vm.number_of(&arg(args, 0))?); + if !(0.0..=100.0).contains(&d) { + return Err(vm.range_error("toFixed() argument must be between 0 and 100")); + } + if x.abs() >= 1e21 { + return Ok(vm.string_val(num_to_string(x))); + } + // The sign stays even when the digits round to zero: `(-0.0001).toFixed(2)` is "-0.00". + let sign = if x < 0.0 { "-" } else { "" }; + Ok(vm.string_val(format!("{sign}{}", num_to_fixed(x.abs(), d as usize)))) + }) +} + +fn n_to_string(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let x = this_num(vm, &this, "toString")?; + formatting(vm, args, |vm, args| { + let radix = match arg(args, 0) { + Value::Undef => 10.0, + v => to_integer(vm.number_of(&v)?), + }; + if !(2.0..=36.0).contains(&radix) { + return Err(vm.range_error("toString() radix argument must be between 2 and 36")); + } + Ok(vm.string_val(if radix == 10.0 { + num_to_string(x) + } else { + super::numfmt::to_radix(x, radix as u32) + })) + }) +} + +fn n_to_exponential(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let x = this_num(vm, &this, "toExponential")?; + formatting(vm, args, |vm, args| { + let digits = match arg(args, 0) { + Value::Undef => None, + v => Some(to_integer(vm.number_of(&v)?)), + }; + if !x.is_finite() { + return Ok(vm.string_val(num_to_string(x))); + } + if digits.is_some_and(|d| !(0.0..=100.0).contains(&d)) { + return Err(vm.range_error("toExponential() argument must be between 0 and 100")); + } + let out = super::numfmt::to_exponential(x, digits.map(|d| d as usize)); + Ok(vm.string_val(out)) + }) +} + +fn n_to_precision(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + let x = this_num(vm, &this, "toPrecision")?; + formatting(vm, args, |vm, args| { + if let Value::Undef = arg(args, 0) { + return Ok(vm.string_val(num_to_string(x))); + } + let p = to_integer(vm.number_of(&arg(args, 0))?); + if !x.is_finite() { + return Ok(vm.string_val(num_to_string(x))); + } + if !(1.0..=100.0).contains(&p) { + return Err(vm.range_error("toPrecision() argument must be between 1 and 100")); + } + let out = super::numfmt::to_precision(x, p as usize); + Ok(vm.string_val(out)) + }) +} + +fn n_value_of(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + Ok(Value::Num(this_num(vm, &this, "valueOf")?)) +} + +fn n_to_locale_string(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let x = this_num(vm, &this, "toLocaleString")?; + if !x.is_finite() { + return Ok(vm.string_val(num_to_string(x))); + } + let fixed = num_to_fixed(x, 3); + let fixed = fixed.trim_end_matches('0').trim_end_matches('.'); + let (int, frac) = fixed.split_once('.').unwrap_or((fixed, "")); + let (sign, digits) = int.strip_prefix('-').map(|d| ("-", d)).unwrap_or(("", int)); + let mut grouped = String::new(); + for (i, c) in digits.chars().enumerate() { + if i > 0 && (digits.len() - i) % 3 == 0 { + grouped.push(','); + } + grouped.push(c); + } + let out = if frac.is_empty() { + format!("{sign}{grouped}") + } else { + format!("{sign}{grouped}.{frac}") + }; + Ok(vm.string_val(out)) +} + +// ---------- Math ---------- + +fn n0(vm: &mut Vm, args: &[Value]) -> Result { + match args.first() { + Some(Value::Num(n)) => Ok(*n), + Some(v) => vm.number_of(v), + None => Ok(f64::NAN), + } +} + +fn n1(vm: &mut Vm, args: &[Value]) -> Result { + match args.get(1) { + Some(Value::Num(n)) => Ok(*n), + Some(v) => vm.number_of(v), + None => Ok(f64::NAN), + } +} + +macro_rules! math1 { + ($name:ident, $f:expr) => { + fn $name(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let f: fn(f64) -> f64 = $f; + if let Some(Value::Obj(_)) = args.first() { + return math(vm, &args[..1], |xs| f(xs[0])); + } + let x = n0(vm, args)?; + Ok(Value::Num(f(x))) + } + }; +} + +/// The reference's Math methods: the arguments a method reads (`args`) are one list of conversions with the number +/// hint, then `f` runs on their numbers. +fn math(vm: &mut Vm, args: &[Value], f: impl FnOnce(&[f64]) -> f64) -> Res { + fuel::with_primitive_list(vm, &[Hint::Number], args, false, |vm, args| { + let mut xs = Vec::with_capacity(args.len()); + for a in args { + xs.push(vm.number_of(a)?); + } + Ok(Value::Num(f(&xs))) + }) +} + +/// The first two arguments, which a two-argument Math method reads, padded with `undefined`. +fn two(args: &[Value]) -> [Value; 2] { + [arg(args, 0), arg(args, 1)] +} + +math1!(m_floor, f64::floor); +math1!(m_ceil, f64::ceil); +math1!(m_trunc, f64::trunc); +math1!(m_abs, f64::abs); +math1!(m_sqrt, f64::sqrt); +math1!(m_cbrt, f64::cbrt); +math1!(m_exp, f64::exp); +math1!(m_expm1, f64::exp_m1); +math1!(m_log, f64::ln); +math1!(m_log2, f64::log2); +math1!(m_log10, f64::log10); +math1!(m_log1p, f64::ln_1p); +math1!(m_sin, f64::sin); +math1!(m_cos, f64::cos); +math1!(m_tan, f64::tan); +math1!(m_asin, f64::asin); +math1!(m_acos, f64::acos); +math1!(m_atan, f64::atan); +math1!(m_sinh, f64::sinh); +math1!(m_cosh, f64::cosh); +math1!(m_tanh, f64::tanh); +math1!(m_asinh, f64::asinh); +math1!(m_acosh, f64::acosh); +math1!(m_atanh, f64::atanh); +math1!(m_fround, |x| x as f32 as f64); +math1!(m_f16round, super::numfmt::f16_round); +math1!(m_clz32, |x| to_uint32(x).leading_zeros() as f64); +math1!(m_sign, |x| if x.is_nan() || x == 0.0 { + x +} else { + x.signum() +}); +math1!(m_round, |x| { + if !x.is_finite() || x == 0.0 { + return x; + } + let r = x.floor(); + let v = if x - r >= 0.5 { r + 1.0 } else { r }; + if v == 0.0 && x < 0.0 { -0.0 } else { v } +}); + +fn m_sum_precise(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + // The reference's prelude `Math$sumPrecise`: a back-edge per value, then `$SumPrecise`. + super::fuel::method(vm); + let source = arg(args, 0); + if !vm.is_iterable(&source) { + return Err(vm.not_iterable(&source, crate::bytecode::ITER_FOR_OF)); + } + let values = vm.new_array(Vec::new()); + crate::native::enter_for_of_sub( + vm, + crate::native::NativeOp::Callbacks, + super::object::SUB_SUM_PRECISE, + callee, + Value::Undef, + source, + &[values], + ) +} + +/// `Math.sumPrecise` over its values: its own slot is the numbers read so far, an internal array. +pub(crate) struct SumPrecise; + +impl crate::native::ForOf for SumPrecise { + fn item(vm: &mut Vm, fr: crate::native::Frame, x: Value) -> Result { + let Value::Num(_) = x else { + return Err(vm.type_error("Math.sumPrecise expects an iterable of numbers.")); + }; + let values = fr + .get(vm, crate::native::FOR_OF_SLOTS) + .as_obj() + .unwrap_or(0); + let Kind::Array(items) = &mut vm.heap[values as usize].kind else { + return Ok(crate::native::Flow::Next); + }; + if items.len() >= crate::ops::MAX_ARRAY_LEN { + return Err(vm.range_error("Invalid array length")); + } + items.push(x); + Ok(crate::native::Flow::Next) + } + + fn finish(vm: &mut Vm, fr: crate::native::Frame) -> Res { + let values = fr + .get(vm, crate::native::FOR_OF_SLOTS) + .as_obj() + .unwrap_or(0); + let values: Vec = match &vm.heap[values as usize].kind { + Kind::Array(items) => items.iter().map(Value::as_num).collect(), + _ => Vec::new(), + }; + super::fuel::native(vm); + vm.bytecode_builtin(); + Ok(Value::Num(super::numfmt::sum_precise(&values))) + } +} + +fn m_atan2(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + if args.iter().take(2).any(|v| matches!(v, Value::Obj(_))) { + return math(vm, &two(args), |xs| xs[0].atan2(xs[1])); + } + let (y, x) = (n0(vm, args)?, n1(vm, args)?); + Ok(Value::Num(y.atan2(x))) +} + +fn m_pow(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + if args.iter().take(2).any(|v| matches!(v, Value::Obj(_))) { + return math(vm, &two(args), |xs| crate::vm::js_pow(xs[0], xs[1])); + } + let (x, y) = (n0(vm, args)?, n1(vm, args)?); + Ok(Value::Num(crate::vm::js_pow(x, y))) +} + +fn imul(x: f64, y: f64) -> f64 { + (to_uint32(x) as i32).wrapping_mul(to_uint32(y) as i32) as f64 +} + +fn m_imul(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + if args.iter().take(2).any(|v| matches!(v, Value::Obj(_))) { + return math(vm, &two(args), |xs| imul(xs[0], xs[1])); + } + let (x, y) = (n0(vm, args)?, n1(vm, args)?); + Ok(Value::Num(imul(x, y))) +} + +fn m_max(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + fuel::with_primitive_list(vm, &[Hint::Number], args, false, |vm, args| { + let mut r = f64::NEG_INFINITY; + for a in args { + let x = vm.number_of(a)?; + if x.is_nan() || r.is_nan() { + r = f64::NAN; + } else if x > r || (x == 0.0 && r == 0.0 && !x.is_sign_negative()) { + r = x; + } + } + Ok(Value::Num(r)) + }) +} + +fn m_min(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + fuel::with_primitive_list(vm, &[Hint::Number], args, false, |vm, args| { + let mut r = f64::INFINITY; + for a in args { + let x = vm.number_of(a)?; + if x.is_nan() || r.is_nan() { + r = f64::NAN; + } else if x < r || (x == 0.0 && r == 0.0 && x.is_sign_negative()) { + r = x; + } + } + Ok(Value::Num(r)) + }) +} + +fn m_hypot(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + // Every argument converts before any is examined, so a later conversion's throw is not skipped. + math(vm, args, hypot) +} + +/// `Math.hypot` as JavaScriptCore computes it: libm for two values, a scaled sum for three, and a running scaled +/// fused sum beyond. +fn hypot(xs: &[f64]) -> f64 { + if xs.iter().any(|x| x.is_infinite()) { + return f64::INFINITY; + } + if xs.iter().any(|x| x.is_nan()) { + return f64::NAN; + } + match xs { + [] => 0.0, + [x] => x.abs(), + [x, y] => x.hypot(*y), + [x, y, z] => { + let (x, y, z) = (x.abs(), y.abs(), z.abs()); + let a = x.max(y).max(z); + if a == 0.0 { + return 0.0; + } + let (x, y, z) = (x / a, y / a, z / a); + a * (x * x + y * y + z * z).sqrt() + } + _ => { + let (mut max, mut sum) = (0.0f64, 0.0f64); + for x in xs { + let a = x.abs(); + if max < a { + let s = max / a; + sum = sum.mul_add(s * s, 1.0); + max = a; + } else if max != 0.0 { + let s = a / max; + sum = s.mul_add(s, sum); + } + } + if max == 0.0 { 0.0 } else { sum.sqrt() * max } + } + } +} + +fn m_random(vm: &mut Vm, _this: Value, _args: &[Value], _: Id) -> Res { + let mut x = vm.rng; + x ^= x << 13; + x ^= x >> 7; + x ^= x << 17; + vm.rng = x; + Ok(Value::Num((x >> 11) as f64 / (1u64 << 53) as f64)) +} diff --git a/packages/codemode-rust/crates/psychoscript/src/builtins/uri.rs b/packages/codemode-rust/crates/psychoscript/src/builtins/uri.rs new file mode 100644 index 0000000000000..5c1f952c51090 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/builtins/uri.rs @@ -0,0 +1,143 @@ +//! encodeURI, encodeURIComponent, decodeURI and decodeURIComponent. + +use super::arg; +use crate::value::{Id, Value}; +use crate::vm::{Res, Vm}; + +const URI_MARKS: &str = "-_.!~*'()"; +const URI_RESERVED: &str = ";/?:@&=+$,"; + +pub fn setup(vm: &mut Vm) { + for (name, f) in [ + ("encodeURI", encode_uri as crate::vm::NativeFn), + ("encodeURIComponent", encode_uri_component), + ("decodeURI", decode_uri), + ("decodeURIComponent", decode_uri_component), + ] { + let v = vm.native_fn(name, 1, f, Value::Undef); + vm.global(name, v); + } +} + +/// Percent-encodes `s` as UTF-8, or fails on a lone surrogate, which has no UTF-8 form. +fn encode(s: &str, keep: &str) -> Option { + let decoded; + let s = if crate::strings::has_mark(s) { + decoded = String::from_utf16(&crate::strings::units_of(s)).ok()?; + &decoded + } else { + s + }; + let mut out = String::with_capacity(s.len()); + for c in s.chars() { + if c.is_ascii_alphanumeric() || keep.contains(c) { + out.push(c); + } else { + let mut buf = [0u8; 4]; + for b in c.encode_utf8(&mut buf).bytes() { + out.push_str(&format!("%{b:02X}")); + } + } + } + Some(out) +} + +fn hex(b: &[u8], i: usize) -> Option { + if b.get(i) != Some(&b'%') { + return None; + } + let h = (*b.get(i + 1)? as char).to_digit(16)?; + let l = (*b.get(i + 2)? as char).to_digit(16)?; + Some((h * 16 + l) as u8) +} + +/// Decodes `%XX` escapes as UTF-8, leaving escapes of the `reserved` characters as they are. +fn decode(s: &str, reserved: &str) -> Option { + let b = s.as_bytes(); + let mut out: Vec = Vec::with_capacity(b.len()); + let mut i = 0; + while i < b.len() { + if b[i] != b'%' { + out.push(b[i]); + i += 1; + continue; + } + let lead = hex(b, i)?; + if lead < 0x80 { + if reserved.contains(lead as char) { + out.extend_from_slice(&b[i..i + 3]); + } else { + out.push(lead); + } + i += 3; + continue; + } + let n = match lead { + 0xc0..=0xdf => 2, + 0xe0..=0xef => 3, + 0xf0..=0xf7 => 4, + _ => return None, + }; + let mut seq = vec![lead]; + let mut j = i + 3; + for _ in 1..n { + let c = hex(b, j)?; + if c & 0xc0 != 0x80 { + return None; + } + seq.push(c); + j += 3; + } + // from_utf8 rejects overlong forms, surrogates and code points above U+10FFFF, as the spec does. + let ch = std::str::from_utf8(&seq).ok()?; + out.extend_from_slice(ch.as_bytes()); + if ch == "\u{10FFFF}" { + // The rest of the output is the input's text, so a decoded MARK is doubled to stay one. + out.extend_from_slice(ch.as_bytes()); + } + i = j; + } + String::from_utf8(out).ok() +} + +fn input(vm: &mut Vm, args: &[Value]) -> Result { + super::builtin_string(vm, &arg(args, 0)) +} + +fn run(vm: &mut Vm, args: &[Value], name: &str, f: impl Fn(&str) -> Option) -> Res { + let s = input(vm, args)?; + match f(&s) { + Some(out) => Ok(vm.string_val(out)), + None => { + let p = vm.realm.std.uri_error; + let why = if name.starts_with("encode") { + "String contained an illegal UTF-16 sequence." + } else { + "URI error" + }; + Err(vm.failure( + p, + &format!("{name} received malformed URI data: {why}"), + crate::DiagnosticKind::ExecutionFailure, + )) + } + } +} + +fn encode_uri(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let keep = format!("{URI_RESERVED}{URI_MARKS}#"); + run(vm, args, "encodeURI", |s| encode(s, &keep)) +} + +fn encode_uri_component(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + run(vm, args, "encodeURIComponent", |s| encode(s, URI_MARKS)) +} + +fn decode_uri(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let reserved = format!("{URI_RESERVED}#"); + run(vm, args, "decodeURI", |s| decode(s, &reserved)) +} + +fn decode_uri_component(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + run(vm, args, "decodeURIComponent", |s| decode(s, "")) +} diff --git a/packages/codemode-rust/crates/psychoscript/src/builtins/web.rs b/packages/codemode-rust/crates/psychoscript/src/builtins/web.rs new file mode 100644 index 0000000000000..39828e22098f8 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/builtins/web.rs @@ -0,0 +1,1317 @@ +//! URL, URLSearchParams and Headers. + +use super::{arg, builtin_string, incompatible, require_callback}; +use crate::object::*; +use crate::value::{Id, Value}; +use crate::vm::{Res, Vm}; + +pub struct UrlData { + pub url: url::Url, + /// The linked `searchParams` object. + pub params: Id, +} + +pub struct Params { + pub list: Vec<(String, String)>, + /// The URL whose query this list mirrors, for `url.searchParams`. + pub url: Option, +} + +pub struct HeaderList { + /// Lowercased names and normalized values, in insertion order. + pub list: Vec<(String, String)>, +} + +pub fn setup(vm: &mut Vm) { + let op = vm.realm.object_proto; + let up = vm.plain(op); + vm.realm.std.url = up; + let url = vm.ctor("URL", 1, url_ctor, up, Value::Undef); + super::accessors(vm, up, &URL_FIELDS); + super::accessors(vm, up, &["searchParams"]); + vm.methods( + url, + &[("canParse", 1, url_can_parse), ("parse", 1, url_parse)], + ); + vm.methods( + up, + &[("toString", 0, url_to_string), ("toJSON", 0, url_to_string)], + ); + + let pp = vm.plain(op); + vm.realm.std.params = pp; + // Both constructors keep the native that reads one pair of an iterable (see `Pairs`) as their data. + let pair = vm.native_fn("", 1, read_pair, Value::Undef); + vm.ctor("URLSearchParams", 0, params_ctor, pp, pair); + super::accessors(vm, pp, &["size"]); + vm.methods( + pp, + &[ + ("append", 2, p_append), + ("delete", 1, p_delete), + ("get", 1, p_get), + ("getAll", 1, p_get_all), + ("has", 1, p_has), + ("set", 2, p_set), + ("sort", 0, p_sort), + ("keys", 0, p_keys), + ("values", 0, p_values), + ("entries", 0, p_entries), + ("toString", 0, p_to_string), + ("forEach", 1, p_for_each), + ], + ); + let ek = vm.atoms.intern_static("entries"); + let entries = vm.get_obj(pp, ek); + vm.define_hidden(pp, SYM_ITERATOR, entries); + + let hp = vm.plain(op); + vm.realm.std.headers = hp; + vm.ctor("Headers", 0, headers_ctor, hp, pair); + vm.methods( + hp, + &[ + ("append", 2, h_append), + ("delete", 1, h_delete), + ("get", 1, h_get), + ("getSetCookie", 0, h_get_set_cookie), + ("has", 1, h_has), + ("set", 2, h_set), + ("keys", 0, h_keys), + ("values", 0, h_values), + ("entries", 0, h_entries), + ("forEach", 1, h_for_each), + ], + ); + let ek = vm.atoms.intern_static("entries"); + let entries = vm.get_obj(hp, ek); + vm.define_hidden(hp, SYM_ITERATOR, entries); +} + +fn requires_new(vm: &mut Vm, this: &Value, name: &str) -> Result<(), Value> { + if matches!(this, Value::Uninit) { + Ok(()) + } else { + Err(vm.type_error(&format!("Constructor {name} requires 'new'."))) + } +} + +fn requires_args( + vm: &mut Vm, + args: &[Value], + what: &str, + name: &str, + n: usize, +) -> Result<(), Value> { + if args.len() < n { + let s = if n == 1 { "" } else { "s" }; + return Err(vm.type_error(&format!("{what}.{name} requires {n} argument{s}."))); + } + Ok(()) +} + +fn str_arg(vm: &mut Vm, args: &[Value], i: usize) -> Result { + builtin_string(vm, &arg(args, i)) +} + +/// A value as a USVString, as URL and URLSearchParams take it: a lone surrogate becomes U+FFFD. +fn usv_text(vm: &mut Vm, v: &Value) -> Result { + let s = builtin_string(vm, v)?; + Ok(match crate::strings::host_text(&s) { + std::borrow::Cow::Owned(t) => t, + std::borrow::Cow::Borrowed(_) => s, + }) +} + +fn usv_arg(vm: &mut Vm, args: &[Value], i: usize) -> Result { + usv_text(vm, &arg(args, i)) +} + +/// A name and value as URLSearchParams keeps them (USVStrings); Headers checks the text as given. +fn usv_pair(headers: bool, name: String, value: String) -> (String, String) { + if headers { + return (name, value); + } + let usv = |t: String| match crate::strings::host_text(&t) { + std::borrow::Cow::Owned(u) => u, + std::borrow::Cow::Borrowed(_) => t, + }; + (usv(name), usv(value)) +} + +/// Plain UTF-8 kept by URL, URLSearchParams and Headers, as a string again. +fn js_text(vm: &mut Vm, s: String) -> Value { + vm.string_val(crate::strings::external_text(s)) +} + +fn is_runtime_reference(vm: &Vm, v: &Value) -> bool { + match v { + Value::Obj(id) => !matches!( + vm.heap[*id as usize].kind, + Kind::Ordinary | Kind::Array(_) | Kind::Error(_) + ), + _ => false, + } +} + +// ---------- URL ---------- + +fn url_data(vm: &Vm, id: Id) -> &UrlData { + match &vm.heap[id as usize].kind { + Kind::Url(u) => u, + _ => unreachable!("checked by the receiver test"), + } +} + +fn url_text(vm: &mut Vm, v: &Value) -> Result { + if let Value::Obj(id) = v + && let Kind::Url(u) = &vm.heap[*id as usize].kind + { + return Ok(u.url.as_str().to_owned()); + } + usv_text(vm, v) +} + +fn parse_url(vm: &mut Vm, args: &[Value]) -> Result, Value> { + let input = url_text(vm, &arg(args, 0))?; + let base = match arg(args, 1) { + Value::Undef => None, + v => Some(url_text(vm, &v)?), + }; + Ok(match base { + None => url::Url::parse(&input).map_err(|_| ()), + Some(b) => url::Url::parse(&b) + .and_then(|b| b.join(&input)) + .map_err(|_| ()), + }) +} + +/// A URL value with its linked `searchParams`, for code that builds one from a parsed URL. +pub fn new_url(vm: &mut Vm, url: url::Url) -> Value { + super::ensure(vm, super::LAZY_WEB); + let pp = vm.realm.std.params; + let list = query_pairs(&url); + let params = vm.alloc(Obj::new( + Some(pp), + Kind::SearchParams(Box::new(Params { list, url: None })), + )); + let up = vm.realm.std.url; + let id = vm.alloc(Obj::new( + Some(up), + Kind::Url(Box::new(UrlData { url, params })), + )); + if let Kind::SearchParams(p) = &mut vm.heap[params as usize].kind { + p.url = Some(id); + } + Value::Obj(id) +} + +fn query_pairs(url: &url::Url) -> Vec<(String, String)> { + url.query() + .map(|q| { + url::form_urlencoded::parse(q.as_bytes()) + .into_owned() + .collect() + }) + .unwrap_or_default() +} + +fn url_ctor(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + requires_new(vm, &this, "URL")?; + if args.is_empty() { + return Err(vm.type_error("new URL(...) requires a URL string and an optional base URL.")); + } + match parse_url(vm, args)? { + Ok(u) => Ok(new_url(vm, u)), + Err(()) => { + let base = if matches!(arg(args, 1), Value::Undef) { + "" + } else { + " or base URL" + }; + Err(vm.type_error(&format!("new URL(...) received an invalid URL{base}."))) + } + } +} + +fn url_can_parse(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + if args.is_empty() { + return Err(vm.type_error("URL.canParse requires a URL argument.")); + } + Ok(Value::Bool(parse_url(vm, args)?.is_ok())) +} + +fn url_parse(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + if args.is_empty() { + return Err(vm.type_error("URL.parse requires a URL argument.")); + } + Ok(match parse_url(vm, args)? { + Ok(u) => new_url(vm, u), + Err(()) => Value::Null, + }) +} + +fn this_url(vm: &mut Vm, this: &Value, name: &str) -> Result { + if let Value::Obj(id) = this + && let Kind::Url(_) = vm.heap[*id as usize].kind + { + return Ok(*id); + } + Err(incompatible(vm, &format!("URL.prototype.{name}"), this)) +} + +fn url_to_string(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let id = this_url(vm, &this, "toString")?; + let s = url_data(vm, id).url.as_str().to_owned(); + Ok(js_text(vm, s)) +} + +const URL_FIELDS: [&str; 11] = [ + "href", "origin", "protocol", "username", "password", "host", "hostname", "port", "pathname", + "search", "hash", +]; + +pub fn url_get(vm: &mut Vm, id: Id, key: Atom) -> Option { + use url::quirks as q; + let name = vm.atoms.text(key); + if name == "searchParams" { + return Some(Value::Obj(url_data(vm, id).params)); + } + if !URL_FIELDS.contains(&name) { + return None; + } + let u = &url_data(vm, id).url; + let s = match name { + "href" => q::href(u).to_owned(), + "origin" => q::origin(u), + "protocol" => q::protocol(u).to_owned(), + "username" => q::username(u).to_owned(), + "password" => q::password(u).to_owned(), + "host" => q::host(u).to_owned(), + "hostname" => q::hostname(u).to_owned(), + "port" => q::port(u).to_owned(), + "pathname" => q::pathname(u).to_owned(), + "search" => q::search(u).to_owned(), + _ => q::hash(u).to_owned(), + }; + Some(js_text(vm, s)) +} + +pub fn url_set(vm: &mut Vm, id: Id, key: Atom, val: Value) -> Option> { + use url::quirks as q; + let name = vm.atoms.text(key).to_owned(); + if name == "searchParams" || name == "origin" { + return Some(Err(vm.only_getter(&Value::Obj(id), key))); + } + if !URL_FIELDS.contains(&name.as_str()) { + return None; + } + let text = match usv_text(vm, &val) { + Ok(t) => t, + Err(e) => return Some(Err(e)), + }; + let Kind::Url(data) = &mut vm.heap[id as usize].kind else { + return None; + }; + let u = &mut data.url; + let ok = match name.as_str() { + "href" => q::set_href(u, &text).is_ok(), + "protocol" => { + let _ = q::set_protocol(u, &text); + true + } + "username" => { + let _ = q::set_username(u, &text); + true + } + "password" => { + let _ = q::set_password(u, &text); + true + } + "host" => { + let _ = q::set_host(u, &text); + true + } + "hostname" => { + let _ = q::set_hostname(u, &text); + true + } + "port" => { + let _ = q::set_port(u, &text); + true + } + "pathname" => { + q::set_pathname(u, &text); + true + } + "search" => { + q::set_search(u, &text); + true + } + _ => { + q::set_hash(u, &text); + true + } + }; + if !ok { + return Some(Err( + vm.type_error(&format!("URL.{name} received an invalid value.")) + )); + } + let (list, params) = (query_pairs(&data.url), data.params); + if let Kind::SearchParams(p) = &mut vm.heap[params as usize].kind { + p.list = list; + } + Some(Ok(())) +} + +pub fn url_href(vm: &Vm, id: Id) -> String { + url_data(vm, id).url.as_str().to_owned() +} + +// ---------- URLSearchParams ---------- + +fn params_mut(vm: &mut Vm, id: Id) -> &mut Params { + match &mut vm.heap[id as usize].kind { + Kind::SearchParams(p) => p, + _ => unreachable!("checked by the receiver test"), + } +} + +pub fn serialize(list: &[(String, String)]) -> String { + url::form_urlencoded::Serializer::new(String::new()) + .extend_pairs(list.iter()) + .finish() +} + +pub fn params_text(vm: &Vm, id: Id) -> String { + match &vm.heap[id as usize].kind { + Kind::SearchParams(p) => serialize(&p.list), + _ => String::new(), + } +} + +/// Writes a changed list back into the URL it belongs to. +fn update(vm: &mut Vm, id: Id) { + let p = params_mut(vm, id); + let (text, owner) = (serialize(&p.list), p.url); + let empty = p.list.is_empty(); + if let Some(u) = owner + && let Kind::Url(data) = &mut vm.heap[u as usize].kind + { + data.url.set_query(if empty { None } else { Some(&text) }); + } +} + +pub fn new_params(vm: &mut Vm, list: Vec<(String, String)>) -> Value { + let pp = vm.realm.std.params; + Value::Obj(vm.alloc(Obj::new( + Some(pp), + Kind::SearchParams(Box::new(Params { list, url: None })), + ))) +} + +fn parse_query(s: &str) -> Vec<(String, String)> { + let s = s.strip_prefix('?').unwrap_or(s); + url::form_urlencoded::parse(s.as_bytes()) + .into_owned() + .collect() +} + +fn is_iterable(vm: &mut Vm, v: &Value) -> bool { + match v { + Value::Obj(id) => { + matches!( + vm.heap[*id as usize].kind, + Kind::Array(_) | Kind::Map(_) | Kind::Set(_) | Kind::Generator(_) + ) || vm.has_program_getter(*id, SYM_ITERATOR) + || !vm.get_obj(*id, SYM_ITERATOR).is_nullish() + } + Value::Str(_) => true, + _ => false, + } +} + +/// `[name, value]` pairs from an iterable (each read in full as strings, then checked), or a record of names to +/// values, as the reference's `readPairs` reads them: the record's pairs, or `None` once a native frame that reads +/// the iterable's pairs and finishes the constructor `callee` was pushed (see `Pairs`). +fn read_pairs( + vm: &mut Vm, + init: &Value, + headers: bool, + callee: Id, +) -> Result>, Value> { + // The fuel is the prelude's `readPairs`: `$IsIterable`, then per pair `$IsIterable` and a `String` per part, and + // `$Pairs` at the end (see `fuel.rs`). + super::fuel::method(vm); + super::fuel::native(vm); + if is_iterable(vm, init) { + let rows = vm.new_array(Vec::new()); + let helper = vm.native_data(callee); + crate::native::enter_for_of_sub( + vm, + crate::native::NativeOp::Callbacks, + super::object::SUB_PAIRS, + callee, + Value::Undef, + *init, + &[rows, Value::Bool(headers), helper], + )?; + return Ok(None); + } + if !matches!(init, Value::Obj(_)) || is_runtime_reference(vm, init) { + return Err(vm.type_error(if headers { + "new Headers(...) expects a record of names to values, iterable [name, value] pairs, or Headers." + } else if !is_runtime_reference(vm, init) { + // What is neither an object nor a runtime reference (a symbol) gets the reference's other wording. + "new URLSearchParams(...) expects a query string, data object, iterable pairs, or URLSearchParams." + } else { + "new URLSearchParams(...) expects a query string, data object, or synchronous iterable pairs." + })); + } + let Value::Obj(id) = init else { + return Ok(Some(Vec::new())); + }; + let mut out = Vec::new(); + for (k, v) in vm.own_entries(*id) { + let name = vm.atoms.text(k).to_owned(); + let value = builtin_string(vm, &v)?; + out.push(usv_pair(headers, name, value)); + } + super::fuel::native(vm); + Ok(Some(out)) +} + +fn pairs_label(headers: bool) -> &'static str { + if headers { + "new Headers(...)" + } else { + "new URLSearchParams(...)" + } +} + +// The own slots of a `Pairs` frame: the rows read so far (an internal array of `Pair` results), whether it builds +// Headers, and the native that pushes a `Pair` frame (the constructor's data). +const PAIRS_ROWS: usize = crate::native::FOR_OF_SLOTS; +const PAIRS_HEADERS: usize = PAIRS_ROWS + 1; +const PAIRS_HELPER: usize = PAIRS_ROWS + 2; + +/// The outer loop of `readPairs` over an iterable of pairs; each pair is read by a `Pair` frame, called through a +/// native so that a throw there closes this loop's iterator too. It ends as the constructor does. +pub(crate) struct Pairs; + +impl crate::native::ForOf for Pairs { + fn item( + vm: &mut Vm, + fr: crate::native::Frame, + pair: Value, + ) -> Result { + super::fuel::native(vm); + if !is_iterable(vm, &pair) || matches!(pair, Value::Str(_)) { + let label = pairs_label(vm.truthy(&fr.get(vm, PAIRS_HEADERS))); + return Err(vm.type_error(&format!("{label} expects iterable [name, value] pairs."))); + } + let helper = fr.slot(vm, PAIRS_HELPER); + let args = [crate::value::Slot::pack(pair)]; + Ok(crate::native::Flow::Call(fr.catching_list( + vm, + helper, + crate::value::Slot::UNDEF, + &args, + crate::native::Step::CallUncounted, + ))) + } + + fn returned( + vm: &mut Vm, + fr: crate::native::Frame, + r: crate::value::Slot, + ) -> Result { + let rows = fr.get(vm, PAIRS_ROWS).as_obj().unwrap_or(0); + if let Kind::Array(items) = &mut vm.heap[rows as usize].kind { + items.push(r.get()); + } + Ok(crate::native::Flow::Next) + } + + fn finish(vm: &mut Vm, fr: crate::native::Frame) -> Res { + let headers = vm.truthy(&fr.get(vm, PAIRS_HEADERS)); + let rows = fr.get(vm, PAIRS_ROWS).as_obj().unwrap_or(0); + let rows: Vec> = match &vm.heap[rows as usize].kind { + Kind::Array(rows) => rows + .iter() + .map(|r| match r.as_obj().map(|r| &vm.heap[r as usize].kind) { + Some(Kind::Array(parts)) => parts.clone(), + _ => Vec::new(), + }) + .collect(), + _ => Vec::new(), + }; + if rows.iter().any(|r| r.len() != 2) { + let label = pairs_label(headers); + return Err(vm.type_error(&format!("{label} expects iterable [name, value] pairs."))); + } + let pairs = rows + .into_iter() + .map(|r| { + let text = |v: &Value| match v { + Value::Str(s) => vm.text(*s).to_owned(), + _ => String::new(), + }; + usv_pair(headers, text(&r[0]), text(&r[1])) + }) + .collect(); + super::fuel::native(vm); + if headers { + return finish_headers(vm, pairs); + } + Ok(new_params(vm, pairs)) + } +} + +/// The native a `Pairs` frame calls on each pair: it pushes a `Pair` frame over it. +fn read_pair(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let parts = vm.new_array(Vec::new()); + crate::native::enter_for_of_sub( + vm, + crate::native::NativeOp::Callbacks, + super::object::SUB_PAIR, + callee, + Value::Undef, + arg(args, 0), + &[parts], + ) +} + +/// The inner loop of `readPairs` over one pair: each part made a string. Its own slot is the strings so far, an +/// internal array, which it returns. +pub(crate) struct Pair; + +impl crate::native::ForOf for Pair { + fn item( + vm: &mut Vm, + fr: crate::native::Frame, + part: Value, + ) -> Result { + if vm.converts_by_call(&part, crate::ops::Hint::String) { + let step = super::convert_catching(vm, fr, part, crate::ops::Hint::String)?; + return Ok(crate::native::Flow::Call(step)); + } + push_part(vm, fr, part) + } + + /// A part converted by a call. + fn returned( + vm: &mut Vm, + fr: crate::native::Frame, + r: crate::value::Slot, + ) -> Result { + push_part(vm, fr, r.get()) + } + + fn finish(vm: &mut Vm, fr: crate::native::Frame) -> Res { + Ok(fr.get(vm, crate::native::FOR_OF_SLOTS)) + } +} + +/// A part of a pair made a string and kept. +fn push_part( + vm: &mut Vm, + fr: crate::native::Frame, + part: Value, +) -> Result { + let s = vm.string_of(&part)?; + super::fuel::native(vm); + let parts = fr + .get(vm, crate::native::FOR_OF_SLOTS) + .as_obj() + .unwrap_or(0); + if let Kind::Array(items) = &mut vm.heap[parts as usize].kind { + items.push(Value::Str(s)); + } + Ok(crate::native::Flow::Next) +} + +fn params_ctor(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + requires_new(vm, &this, "URLSearchParams")?; + let init = arg(args, 0); + let list = match init { + Value::Undef => Vec::new(), + Value::Str(s) => parse_query(&crate::strings::host_text(vm.text(s))), + Value::Null | Value::Num(_) | Value::Bool(_) => { + let s = builtin_string(vm, &init)?; + parse_query(&s) + } + Value::Obj(id) if matches!(vm.heap[id as usize].kind, Kind::SearchParams(_)) => { + params_mut(vm, id).list.clone() + } + _ => match read_pairs(vm, &init, false, callee)? { + Some(list) => list, + None => return Ok(Value::Undef), + }, + }; + Ok(new_params(vm, list)) +} + +fn this_params(vm: &mut Vm, this: &Value, name: &str) -> Result { + if let Value::Obj(id) = this + && let Kind::SearchParams(_) = vm.heap[*id as usize].kind + { + return Ok(*id); + } + Err(incompatible( + vm, + &format!("URLSearchParams.prototype.{name}"), + this, + )) +} + +fn p_append(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + requires_args(vm, args, "URLSearchParams", "append", 2)?; + let id = this_params(vm, &this, "append")?; + let (k, v) = (usv_arg(vm, args, 0)?, usv_arg(vm, args, 1)?); + params_mut(vm, id).list.push((k, v)); + update(vm, id); + Ok(Value::Undef) +} + +fn p_delete(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + requires_args(vm, args, "URLSearchParams", "delete", 1)?; + let id = this_params(vm, &this, "delete")?; + let k = usv_arg(vm, args, 0)?; + let v = match arg(args, 1) { + Value::Undef => None, + v => Some(usv_text(vm, &v)?), + }; + params_mut(vm, id) + .list + .retain(|(n, x)| !(n == &k && v.as_ref().is_none_or(|v| v == x))); + update(vm, id); + Ok(Value::Undef) +} + +fn p_get(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + requires_args(vm, args, "URLSearchParams", "get", 1)?; + let id = this_params(vm, &this, "get")?; + let k = usv_arg(vm, args, 0)?; + let found = params_mut(vm, id) + .list + .iter() + .find(|(n, _)| n == &k) + .map(|(_, v)| v.clone()); + Ok(match found { + Some(v) => js_text(vm, v), + None => Value::Null, + }) +} + +fn p_get_all(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + requires_args(vm, args, "URLSearchParams", "getAll", 1)?; + let id = this_params(vm, &this, "getAll")?; + let k = usv_arg(vm, args, 0)?; + let found: Vec = params_mut(vm, id) + .list + .iter() + .filter(|(n, _)| n == &k) + .map(|(_, v)| v.clone()) + .collect(); + let items = found.into_iter().map(|v| js_text(vm, v)).collect(); + Ok(vm.new_array(items)) +} + +fn p_has(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + requires_args(vm, args, "URLSearchParams", "has", 1)?; + let id = this_params(vm, &this, "has")?; + let k = usv_arg(vm, args, 0)?; + let v = match arg(args, 1) { + Value::Undef => None, + v => Some(usv_text(vm, &v)?), + }; + Ok(Value::Bool(params_mut(vm, id).list.iter().any(|(n, x)| { + n == &k && v.as_ref().is_none_or(|v| v == x) + }))) +} + +fn p_set(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + requires_args(vm, args, "URLSearchParams", "set", 2)?; + let id = this_params(vm, &this, "set")?; + let (k, v) = (usv_arg(vm, args, 0)?, usv_arg(vm, args, 1)?); + let list = &mut params_mut(vm, id).list; + match list.iter().position(|(n, _)| n == &k) { + Some(i) => { + list[i].1 = v; + let mut j = i + 1; + while j < list.len() { + if list[j].0 == k { + list.remove(j); + } else { + j += 1; + } + } + } + None => list.push((k, v)), + } + update(vm, id); + Ok(Value::Undef) +} + +fn p_sort(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let id = this_params(vm, &this, "sort")?; + params_mut(vm, id) + .list + .sort_by(|a, b| a.0.encode_utf16().cmp(b.0.encode_utf16())); + update(vm, id); + Ok(Value::Undef) +} + +fn pairs_for_each( + vm: &mut Vm, + this: &Value, + args: &[Value], + pairs: Vec<(String, String)>, + label: &str, + callee: Id, +) -> Res { + let f = require_callback(vm, &arg(args, 0), label)?; + let this_arg = arg(args, 1); + // The reference hands the pairs to its prelude's `pairsForEach`. + super::fuel::handoff(vm); + let mut calls = Vec::with_capacity(3 * pairs.len()); + for (k, v) in pairs { + let (k, v) = (js_text(vm, k), js_text(vm, v)); + calls.extend([v, k, *this]); + } + crate::native::enter_call_list(vm, callee, f, this_arg, 3, calls, Value::Undef) +} + +fn p_for_each(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + requires_args(vm, args, "URLSearchParams", "forEach", 1)?; + let id = this_params(vm, &this, "forEach")?; + let pairs = params_mut(vm, id).list.clone(); + pairs_for_each(vm, &this, args, pairs, "URLSearchParams.forEach", callee) +} + +fn p_to_string(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let id = this_params(vm, &this, "toString")?; + let s = params_text(vm, id); + Ok(js_text(vm, s)) +} + +fn p_iter(vm: &mut Vm, this: &Value, name: &str, kind: IterKind) -> Res { + let id = this_params(vm, this, name)?; + Ok(super::iterator::exotic_iter(vm, id, kind)) +} + +fn p_keys(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + p_iter(vm, &this, "keys", IterKind::Keys) +} + +fn p_values(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + p_iter(vm, &this, "values", IterKind::Values) +} + +fn p_entries(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + p_iter(vm, &this, "entries", IterKind::Entries) +} + +pub fn params_size(vm: &Vm, id: Id) -> usize { + match &vm.heap[id as usize].kind { + Kind::SearchParams(p) => p.list.len(), + _ => 0, + } +} + +fn pair_step(vm: &mut Vm, pair: Option<(String, String)>, kind: IterKind) -> Option { + let (k, v) = pair?; + Some(match kind { + IterKind::Keys => js_text(vm, k), + IterKind::Values => js_text(vm, v), + IterKind::Entries => { + let (k, v) = (js_text(vm, k), js_text(vm, v)); + vm.new_array(vec![k, v]) + } + }) +} + +/// One step of a live iterator over URLSearchParams or Headers. +pub fn iter_step(vm: &mut Vm, target: Id, pos: usize, kind: IterKind) -> Option { + let pair = match &vm.heap[target as usize].kind { + Kind::SearchParams(p) => p.list.get(pos).cloned(), + Kind::Headers(h) => header_entries(&h.list).into_iter().nth(pos), + _ => None, + }; + pair_step(vm, pair, kind) +} + +// ---------- Headers ---------- + +fn is_token(name: &str) -> bool { + !name.is_empty() + && name + .bytes() + .all(|b| b.is_ascii_alphanumeric() || b"!#$%&'*+-.^_`|~".contains(&b)) +} + +fn header_name(vm: &mut Vm, name: &str) -> Result { + if !is_token(name) { + return Err(vm.type_error(&format!("Invalid header name: '{name}'"))); + } + Ok(name.to_ascii_lowercase()) +} + +fn header_value(vm: &mut Vm, name: &str, value: &str) -> Result { + let v = value.trim_matches(|c| matches!(c, '\t' | '\n' | '\r' | ' ')); + if v.chars() + .any(|c| matches!(c, '\0' | '\n' | '\r') || c as u32 > 0xff) + { + return Err(vm.type_error(&format!("Header '{name}' has invalid value"))); + } + Ok(v.to_owned()) +} + +/// The iteration view: other names sorted with their values combined, then each `set-cookie` value apart, as the +/// host's Headers list them. +pub fn header_entries(list: &[(String, String)]) -> Vec<(String, String)> { + let mut names: Vec<&String> = list + .iter() + .map(|(n, _)| n) + .filter(|n| *n != "set-cookie") + .collect(); + names.sort_by(|a, b| a.as_bytes().cmp(b.as_bytes())); + names.dedup(); + let mut out = Vec::new(); + for n in names { + let joined: Vec<&str> = list + .iter() + .filter(|(k, _)| k == n) + .map(|(_, v)| v.as_str()) + .collect(); + out.push((n.clone(), joined.join(", "))); + } + for (k, v) in list.iter().filter(|(k, _)| k == "set-cookie") { + out.push((k.clone(), v.clone())); + } + out +} + +fn headers_mut(vm: &mut Vm, id: Id) -> &mut HeaderList { + match &mut vm.heap[id as usize].kind { + Kind::Headers(h) => h, + _ => unreachable!("checked by the receiver test"), + } +} + +fn headers_ctor(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + requires_new(vm, &this, "Headers")?; + let init = arg(args, 0); + let pairs = match init { + Value::Undef => Vec::new(), + Value::Obj(_) => match read_pairs(vm, &init, true, callee)? { + Some(pairs) => pairs, + None => return Ok(Value::Undef), + }, + _ => { + return Err(vm.type_error( + "new Headers(...) expects a record of names to values, iterable [name, value] pairs, or Headers.", + )); + } + }; + finish_headers(vm, pairs) +} + +/// The rest of `new Headers(...)` once its pairs are read: each name and value checked and normalized. +fn finish_headers(vm: &mut Vm, pairs: Vec<(String, String)>) -> Res { + let mut list = Vec::with_capacity(pairs.len()); + for (k, v) in pairs { + let n = header_name(vm, &k)?; + let v = header_value(vm, &k, &v)?; + list.push((n, v)); + } + Ok(new_headers(vm, list)) +} + +/// A Headers value over lowercased names and normalized values, as `new Headers(...)` leaves them. +pub fn new_headers(vm: &mut Vm, list: Vec<(String, String)>) -> Value { + super::ensure(vm, super::LAZY_WEB); + let hp = vm.realm.std.headers; + Value::Obj(vm.alloc(Obj::new( + Some(hp), + Kind::Headers(Box::new(HeaderList { list })), + ))) +} + +fn this_headers(vm: &mut Vm, this: &Value, name: &str) -> Result { + if let Value::Obj(id) = this + && let Kind::Headers(_) = vm.heap[*id as usize].kind + { + return Ok(*id); + } + Err(incompatible(vm, &format!("Headers.prototype.{name}"), this)) +} + +fn h_append(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + requires_args(vm, args, "Headers", "append", 2)?; + let id = this_headers(vm, &this, "append")?; + let (k, v) = (str_arg(vm, args, 0)?, str_arg(vm, args, 1)?); + let n = header_name(vm, &k)?; + let v = header_value(vm, &k, &v)?; + headers_mut(vm, id).list.push((n, v)); + Ok(Value::Undef) +} + +fn h_delete(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + requires_args(vm, args, "Headers", "delete", 1)?; + let id = this_headers(vm, &this, "delete")?; + let k = str_arg(vm, args, 0)?; + let n = header_name(vm, &k)?; + headers_mut(vm, id).list.retain(|(x, _)| x != &n); + Ok(Value::Undef) +} + +fn h_get(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + requires_args(vm, args, "Headers", "get", 1)?; + let id = this_headers(vm, &this, "get")?; + let k = str_arg(vm, args, 0)?; + let n = header_name(vm, &k)?; + let values: Vec = headers_mut(vm, id) + .list + .iter() + .filter(|(x, _)| x == &n) + .map(|(_, v)| v.clone()) + .collect(); + if values.is_empty() { + return Ok(Value::Null); + } + Ok(js_text(vm, values.join(", "))) +} + +fn h_get_set_cookie(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + let id = this_headers(vm, &this, "getSetCookie")?; + let values: Vec = headers_mut(vm, id) + .list + .iter() + .filter(|(x, _)| x == "set-cookie") + .map(|(_, v)| v.clone()) + .collect(); + let items = values.into_iter().map(|v| js_text(vm, v)).collect(); + Ok(vm.new_array(items)) +} + +fn h_has(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + requires_args(vm, args, "Headers", "has", 1)?; + let id = this_headers(vm, &this, "has")?; + let k = str_arg(vm, args, 0)?; + let n = header_name(vm, &k)?; + Ok(Value::Bool( + headers_mut(vm, id).list.iter().any(|(x, _)| x == &n), + )) +} + +fn h_set(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + requires_args(vm, args, "Headers", "set", 2)?; + let id = this_headers(vm, &this, "set")?; + let (k, v) = (str_arg(vm, args, 0)?, str_arg(vm, args, 1)?); + let n = header_name(vm, &k)?; + let v = header_value(vm, &k, &v)?; + let list = &mut headers_mut(vm, id).list; + match list.iter().position(|(x, _)| x == &n) { + Some(i) => { + list[i].1 = v; + let mut j = i + 1; + while j < list.len() { + if list[j].0 == n { + list.remove(j); + } else { + j += 1; + } + } + } + None => list.push((n, v)), + } + Ok(Value::Undef) +} + +fn h_for_each(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + requires_args(vm, args, "Headers", "forEach", 1)?; + let id = this_headers(vm, &this, "forEach")?; + let pairs = header_entries(&headers_mut(vm, id).list); + pairs_for_each(vm, &this, args, pairs, "Headers.forEach", callee) +} + +fn h_iter(vm: &mut Vm, this: &Value, name: &str, kind: IterKind) -> Res { + let id = this_headers(vm, this, name)?; + Ok(super::iterator::exotic_iter(vm, id, kind)) +} + +fn h_keys(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + h_iter(vm, &this, "keys", IterKind::Keys) +} + +fn h_values(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + h_iter(vm, &this, "values", IterKind::Values) +} + +fn h_entries(vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + h_iter(vm, &this, "entries", IterKind::Entries) +} + +/// The `{ name: value }` object Headers serialize to. +pub fn headers_object(vm: &mut Vm, id: Id) -> Value { + let entries = header_entries(&headers_mut(vm, id).list); + let o = vm.new_object(); + for (k, v) in entries { + let k = vm.atoms.intern(&k); + let v = js_text(vm, v); + vm.define(o, k, v); + } + Value::Obj(o) +} + +pub fn headers_inspect(vm: &Vm, id: Id) -> String { + let Kind::Headers(h) = &vm.heap[id as usize].kind else { + return String::new(); + }; + let mut map: Vec<(String, String)> = Vec::new(); + for (k, v) in header_entries(&h.list) { + match map.iter_mut().find(|(n, _)| n == &k) { + Some(slot) => slot.1 = v, + None => map.push((k, v)), + } + } + let mut out = String::from("Headers {"); + for (i, (k, v)) in map.iter().enumerate() { + if i > 0 { + out.push(','); + } + crate::convert::quote(&mut out, k); + out.push(':'); + crate::convert::quote(&mut out, v); + } + out.push('}'); + out +} + +// ---------- crypto and structuredClone ---------- + +pub fn setup_globals(vm: &mut Vm) { + let crypto = vm.new_object(); + vm.methods( + crypto, + &[ + ("randomUUID", 0, crypto_random_uuid), + ("getRandomValues", 1, crypto_get_random_values), + ], + ); + vm.global("crypto", Value::Obj(crypto)); + let clone = vm.native_fn("structuredClone", 1, structured_clone, Value::Undef); + vm.global("structuredClone", clone); +} + +/// Random bytes from the operating system, falling back to the run's generator where there is none. +fn random_bytes(vm: &mut Vm, n: usize) -> Vec { + use std::io::Read; + let mut buf = vec![0u8; n]; + if let Ok(mut f) = std::fs::File::open("/dev/urandom") + && f.read_exact(&mut buf).is_ok() + { + return buf; + } + for b in buf.iter_mut() { + let mut x = vm.rng; + x ^= x << 13; + x ^= x >> 7; + x ^= x << 17; + vm.rng = x; + *b = (x >> 24) as u8; + } + buf +} + +fn crypto_random_uuid(vm: &mut Vm, _this: Value, _args: &[Value], _: Id) -> Res { + let mut b = random_bytes(vm, 16); + b[6] = (b[6] & 0x0f) | 0x40; + b[8] = (b[8] & 0x3f) | 0x80; + let h = super::bytes::hex_encode(&b); + let s = format!( + "{}-{}-{}-{}-{}", + &h[0..8], + &h[8..12], + &h[12..16], + &h[16..20], + &h[20..32] + ); + Ok(js_text(vm, s)) +} + +fn crypto_get_random_values(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let target = arg(args, 0); + let len = match super::bytes::as_bytes(vm, &target) { + Some(b) => b.len, + None => { + let d = super::describe_value(vm, &target); + return Err(vm.type_error(&format!( + "crypto.getRandomValues expects a Uint8Array, received {d}." + ))); + } + }; + let data = random_bytes(vm, len); + if let Some(b) = super::bytes::as_bytes(vm, &target) { + for (i, v) in data.into_iter().enumerate() { + b.put(i, v); + } + } + Ok(target) +} + +fn structured_clone(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + if args.is_empty() { + return Err(vm.type_error("structuredClone requires 1 argument")); + } + let mut memo: Vec<(Id, Id)> = Vec::new(); + clone_value(vm, &args[0], &mut memo) +} + +fn clone_error(vm: &mut Vm, v: &Value) -> Value { + let d = super::describe_value(vm, v); + vm.type_error(&format!("DataCloneError: {d} could not be cloned.")) +} + +fn clone_value(vm: &mut Vm, v: &Value, memo: &mut Vec<(Id, Id)>) -> Res { + let id = match v { + Value::Obj(id) => *id, + Value::Sym(_) => return Err(clone_error(vm, v)), + other => return Ok(*other), + }; + if let Some((_, copy)) = memo.iter().find(|(src, _)| *src == id) { + return Ok(Value::Obj(*copy)); + } + let remember = |_: &mut Vm, memo: &mut Vec<(Id, Id)>, copy: Id| memo.push((id, copy)); + enum Plan { + Map(bool), + Date(f64), + RegExp, + Bytes(Vec), + Error, + Array(usize), + Object, + Reject, + } + let plan = match &vm.heap[id as usize].kind { + Kind::Map(_) => Plan::Map(false), + Kind::Set(_) => Plan::Map(true), + Kind::Date(t) => Plan::Date(*t), + Kind::RegExp(_) => Plan::RegExp, + Kind::Bytes(b) => Plan::Bytes(b.to_vec()), + Kind::Error(_) => Plan::Error, + Kind::Array(items) => Plan::Array(items.len()), + Kind::Ordinary | Kind::Arguments(_) | Kind::TextDecoder(_) => Plan::Object, + _ => Plan::Reject, + }; + match plan { + Plan::Reject => Err(clone_error(vm, v)), + Plan::Date(t) => { + let d = super::date::new_date(vm, t); + remember(vm, memo, d.as_obj().unwrap_or(0)); + Ok(d) + } + Plan::RegExp => { + let r = super::regexp::clone_regexp(vm, id); + remember(vm, memo, r.as_obj().unwrap_or(0)); + Ok(r) + } + Plan::Bytes(data) => { + let b = super::bytes::new_bytes(vm, data, false); + remember(vm, memo, b.as_obj().unwrap_or(0)); + Ok(b) + } + Plan::Map(is_set) => { + let (proto, kind) = if is_set { + (vm.realm.set_proto, Kind::Set(Box::default())) + } else { + (vm.realm.map_proto, Kind::Map(Box::default())) + }; + let copy = vm.alloc(Obj::new(Some(proto), kind)); + remember(vm, memo, copy); + let entries: Vec<(Value, Value)> = match &vm.heap[id as usize].kind { + Kind::Map(m) | Kind::Set(m) => m.iter().copied().collect(), + _ => Vec::new(), + }; + for (k, val) in entries { + let k = clone_value(vm, &k, memo)?; + let val = clone_value(vm, &val, memo)?; + let key = vm.map_key(&k); + let entry_key = vm.map_entry_key(key, k); + if let Kind::Map(m) | Kind::Set(m) = &mut vm.heap[copy as usize].kind { + m.set(key, entry_key, val); + } + } + Ok(Value::Obj(copy)) + } + Plan::Error => { + let (nk, mk, ck) = (vm.names.name, vm.names.message, vm.names.cause); + let name = match vm.get_obj(id, nk) { + Value::Str(s) => vm.text(s).to_owned(), + _ => String::new(), + }; + let proto = match name.as_str() { + "TypeError" => vm.realm.type_error_proto, + "RangeError" => vm.realm.range_error_proto, + "SyntaxError" => vm.realm.syntax_error_proto, + "ReferenceError" => vm.realm.reference_error_proto, + "URIError" => vm.realm.std.uri_error, + "AggregateError" => vm.realm.aggregate_error_proto, + "EvalError" => { + let g = vm.atoms.intern_static("EvalError"); + match vm.global_map.get(&g).copied() { + Some(Value::Obj(c)) => { + let pk = vm.names.prototype; + vm.get_obj(c, pk).as_obj().unwrap_or(vm.realm.error_proto) + } + _ => vm.realm.error_proto, + } + } + _ => vm.realm.error_proto, + }; + let copy = vm.alloc(Obj::new(Some(proto), Kind::Error(None))); + remember(vm, memo, copy); + let message = vm.get_obj(id, mk); + if !matches!(message, Value::Undef) { + let m = builtin_string(vm, &message)?; + let m = vm.string_val(m); + vm.define_hidden(copy, mk, m); + } + if vm.heap[id as usize].props.find(ck).is_some() { + let c = vm.get_obj(id, ck); + let c = clone_value(vm, &c, memo)?; + vm.define_hidden(copy, ck, c); + } + Ok(Value::Obj(copy)) + } + Plan::Array(len) => { + let copy = vm.new_array(vec![Value::Uninit; len]); + let cid = copy.as_obj().unwrap_or(0); + remember(vm, memo, cid); + for (k, val) in vm.own_entries(id) { + let val = clone_value(vm, &val, memo)?; + vm.define(cid, k, val); + } + // A sparse array's copy keeps its length, which may run past its last element. + if vm.heap[id as usize].flags & SPARSE != 0 { + let (n, lk) = (vm.array_len(id), vm.names.length); + let o = &mut vm.heap[cid as usize]; + o.flags |= SPARSE; + o.props.insert(lk, Value::Num(n as f64), 0); + } + Ok(copy) + } + Plan::Object => { + let copy = vm.new_object(); + remember(vm, memo, copy); + for (k, val) in vm.own_entries(id) { + let val = clone_value(vm, &val, memo)?; + vm.define(copy, k, val); + } + Ok(Value::Obj(copy)) + } + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/bytecode.rs b/packages/codemode-rust/crates/psychoscript/src/bytecode.rs new file mode 100644 index 0000000000000..df049bf9910d1 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/bytecode.rs @@ -0,0 +1,369 @@ +//! Bytecode: a compact stack-machine instruction set and compiled function prototypes. + +use std::sync::Arc; + +use crate::object::Atom; + +/// One instruction. Operands are slot, constant, atom or jump-target indexes. +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum Op { + Nop, + Pop, + Dup, + /// `a b` -> `a b a b` + Dup2, + /// `a b` -> `b a` + Swap, + /// `a b c` -> `c a b` + Rot3, + /// `a b c` -> `b c a` + Rot3Back, + Undef, + Null, + True, + False, + Uninit, + Int(i32), + Const(u32), + + GetLocal(u32), + /// Two `GetLocal`s. + GetLocal2(u32, u32), + SetLocal(u32), + /// Reads a local that may be in its temporal dead zone; the second operand is the name's atom. + GetLocalChk(u32, Atom), + /// Allocates a fresh closure cell into a local slot; the cell instructions take that slot. + NewCell(u32), + GetCell(u32), + GetCellChk(u32, Atom), + SetCell(u32), + GetUpval(u32), + GetUpvalChk(u32, Atom), + SetUpval(u32), + GetGlobal(u32), + TypeofGlobal(u32), + ThrowConst(Atom), + ThrowRef(Atom), + /// Throws a `TypeError` with a constant message, for syntax that is only rejected when it runs. + ThrowType(u32), + /// Throws the `UnsupportedSyntax` `SyntaxError` for the syntax whose ESTree node type is the string constant: the + /// reference compiles unsupported syntax to a throw where it stands, so code that never reaches it still runs. + ThrowUnsupported(u32), + /// Throws a `SyntaxError` with a constant message, for syntax that is only rejected when it runs. + ThrowSyntax(u32), + This, + Callee, + Arguments, + Rest(u32), + + GetProp(Atom), + SetProp(Atom), + GetElem, + SetElem, + /// A destructuring pattern's read of `key`: a member read that lets a promise's missing key read as undefined. + DestructProp(Atom), + /// `obj key` -> `value`: [`Op::DestructProp`] with a key that `ToKey` made. + DestructElem, + /// `obj` -> `value`: the read of a member an assignment or update then writes, which fails first unless the member + /// can be written (`Vm::check_writable`). + GetPropW(Atom), + /// `obj key` -> `obj key`: a computed member's key as a write target (`Vm::write_key`). + WriteKey, + /// `obj` -> `f obj` + GetMethod(Atom), + DelProp(Atom), + DelElem, + In, + InstanceOf, + DefineField(Atom), + DefineElem, + /// An object literal's `get x() {}` (`false`) or `set x(v) {}` (`true`): the function on top, the object under it. + DefineAccessor(Atom, bool), + /// The same with a computed key, which is under the function. + DefineAccessorElem(bool), + /// Names the anonymous function on top by the key under it (the reference's `SET_NAME` 1, 2 and 3): `0` the key, + /// `1` `get `, `2` `set `. + NameByKey(u8), + /// Classes. `Class(derived)` makes the constructor on top a class: `[ctor] -> [ctor, proto]`, or with a parent + /// `[parent, ctor] -> [ctor, proto]`. + Class(bool), + /// `[ctor, proto, (key), fn] -> [ctor, proto]`: a hidden method of the prototype, or of the constructor when + /// static. The flags: 1 static, 2 computed key, 4 getter, 8 setter. + DefineMethod(Atom, u8), + /// `[ctor, proto, fn] -> [ctor, proto]`: `fn` defines the class's instance fields. + SetFields, + /// `[this] -> [result]`: runs the running constructor's instance field initializer on `this`, when it has one. + InitFields, + /// `[ctor, fn] -> [result]`: runs a static field initializer with the constructor as `this`. + InitStatic, + /// `super(...)` in a derived constructor: constructs its parent for the new target in local `.1`, `[...args] -> + /// [instance]` with `.0` arguments, or `[argsArr] -> [instance]` when `.0` is `u32::MAX`. + SuperCall(u32, u32), + /// `[instance, this] -> [instance]`: fails unless the `this` binding is still unbound. + SuperBind, + /// `super.x`: `[home, this, (key)] -> [value]`, or `[value, this]` to call it. The flags: 1 keep the receiver, + /// 2 computed key. + GetSuper(Atom, u8), + /// `super.x = v`: `[home, this, (key), v] -> [v]`. The flags: 2 computed key. + PutSuper(Atom, u8), + /// Throws a ReferenceError with this message. + ThrowReference(u32), + /// An object literal method that uses `super` gets the object `.0` below it as its home: `[o, .., fn]`. + SetHome(u32), + /// The running method's home object. + Home, + /// A class constructor's result, `[v, this] -> [result]`: `v` if it is an object, else `this`; a derived + /// constructor (`true`) refuses any other value and an unbound `this`. + CtorReturn(bool), + /// A class field, `[o, (key), v] -> [o]` (key on the stack when `.1`): defined as data, or a TypeError. + DefineClassField(Atom, bool), + NewObject, + NewArray(u32), + ArrayPush, + ArraySpread, + ObjectSpread, + /// `src k1..kn` -> `rest` + ObjRest(u32), + RequireCoercible, + /// ToPropertyKey on the top, so a key converts once when it is both read and written. + ToKey, + + Add, + Sub, + Mul, + Div, + Mod, + Pow, + BitAnd, + BitOr, + BitXor, + Shl, + Shr, + UShr, + Eq, + Ne, + StrictEq, + StrictNe, + Lt, + Le, + Gt, + Ge, + /// A binary operator whose right operand is an integer immediate. + ArithI(Arith, i32), + Neg, + ToNumber, + ToNumeric, + Not, + BitNot, + Typeof, + /// Pops the pattern and flags strings, pushes a new RegExp. + RegExp, + Inc, + Dec, + ToStr, + Concat(u32), + /// Pushes the strings array of a tagged template site, made once per run. + Template(u32), + /// `local += pop()` in statement position, appending in place to a string only this local holds. + AddLocal(u32), + /// `local++` on a plain local in statement position. + IncLocal(u32), + + Jump(u32), + JumpIfFalse(u32), + JumpIfTrue(u32), + /// A comparison fused with the `JumpIfFalse` after it: `a b` -> ``, jumping when `a op b` is false. + JumpUnless(Arith, u32), + /// `JumpUnless` with an integer immediate as the right operand: `a` -> ``. + JumpUnlessI(Arith, i32, u32), + JumpIfFalseKeep(u32), + JumpIfTrueKeep(u32), + JumpIfNotNullishKeep(u32), + JumpIfNotUndef(u32), + /// If the top is nullish, replace it with `undefined` and jump. + OptChain(u32), + /// If the callee under the receiver is nullish, replace both with `undefined` and jump. + OptCall(u32), + + Closure(u32), + Call(u32), + CallSpread, + New(u32), + NewSpread, + Return, + GeneratorStart, + Await, + /// Suspends a generator. `next(v)` resumes at the operand with `v` pushed; `return(v)` resumes just after the + /// `yield`, at its inline return path, with `v` pushed; `throw(e)` throws at the `yield`. + Yield(u32), + /// A `yield` whose result is unused: `next` resumes it without pushing. + YieldDrop(u32), + /// The `yield` of a `yield*`: like `Yield`, but `throw(e)` resumes two instructions after it with `e` pushed. + YieldStar(u32), + + Throw, + PushCatch(u32), + PushFinally(u32), + PopTry, + + /// Opens an iterator into a slot; the context (`ITER_*`) words the error for a value that is not iterable. + GetIter(u32, u8), + IterNext(u32, u32), + /// One `yield*` step: `received` -> `result`, calling the iterator's `next`, `throw` or `return` (the flag's low + /// bits 0, 1, 2) with it. Jumps with `received` when `throw` or `return` is missing. Without the async flag, an + /// iterator the VM runs itself skips the result: it pushes the value and continues after the `DelegateResult` + /// that follows, or at that instruction's target when done. + DelegateCall(u32, u8, u32), + /// `result` -> `value`, jumping when the iterator result is done. + DelegateResult(u32, u8), + /// Opens an async iterator into a slot: `Symbol.asyncIterator`, or a sync iterator adapted to async; the + /// context is `ITER_FOR_AWAIT` or `ITER_DELEGATE`. + GetAsyncIter(u32, u8), + /// Pushes the result of calling the iterator's `return()`, or jumps when it has none. + AsyncClose(u32, u32), + /// Throws a `TypeError` unless the top is an object. + CheckObject, + IterStep(u32), + IterRest(u32), + IterClose(u32), + IterCloseQuiet(u32), + ForIn(u32), +} + +pub const ITER_FOR_OF: u8 = 0; +pub const ITER_DESTRUCTURE: u8 = 1; +pub const ITER_DELEGATE: u8 = 2; +pub const ITER_SPREAD: u8 = 3; +pub const ITER_FOR_AWAIT: u8 = 4; + +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum Arith { + Add, + Sub, + Mul, + Div, + Mod, + Lt, + Le, + Gt, + Ge, + StrictEq, + StrictNe, +} + +impl Arith { + pub fn is_comparison(self) -> bool { + !matches!( + self, + Arith::Add | Arith::Sub | Arith::Mul | Arith::Div | Arith::Mod + ) + } + + pub fn of(op: Op) -> Option { + Some(match op { + Op::Add => Arith::Add, + Op::Sub => Arith::Sub, + Op::Mul => Arith::Mul, + Op::Div => Arith::Div, + Op::Mod => Arith::Mod, + Op::Lt => Arith::Lt, + Op::Le => Arith::Le, + Op::Gt => Arith::Gt, + Op::Ge => Arith::Ge, + Op::StrictEq => Arith::StrictEq, + Op::StrictNe => Arith::StrictNe, + _ => return None, + }) + } +} + +#[derive(Clone, Copy, Debug)] +pub enum Capture { + /// A cell of the enclosing frame. + Cell(u32), + /// An upvalue of the enclosing closure. + Upval(u32), +} + +pub const CLASS_BASE: u8 = 1; +pub const CLASS_DERIVED: u8 = 2; + +#[derive(Debug)] +pub struct FuncProto { + pub name: Atom, + pub code: Vec, + /// Source offset of each instruction, for diagnostics. + pub pos: Vec, + pub nparams: u32, + pub length: u32, + pub nlocals: u32, + pub captures: Vec, + pub is_async: bool, + pub is_generator: bool, + pub is_arrow: bool, + pub is_program: bool, + /// A class constructor: `CLASS_BASE` or `CLASS_DERIVED`, else 0. Only `new` may call it. + pub class: u8, + /// An arrow that reads its method's home object (`super`): it takes it when it is made. + pub home: bool, + /// Keeps arguments beyond `nparams` for rest parameters and `arguments`. + pub needs_extra: bool, + /// How each call or `new` names its callee in errors (`o.f`, `f(...)`), by the instruction's index, ascending. + /// A callee that cannot be named is not listed. + pub callees: Vec<(u32, Box)>, + /// The source offsets of the object and the key of each member instruction whose errors may point at them + /// instead of at the member, by the instruction's index, ascending. + pub sites: Vec<(u32, [u32; 2])>, +} + +impl FuncProto { + /// The name of the callee of the call or `new` instruction at `at`. + pub fn callee(&self, at: usize) -> Option<&str> { + let i = self + .callees + .binary_search_by_key(&(at as u32), |(pc, _)| *pc) + .ok()?; + Some(&self.callees[i].1) + } + + /// Where an error the instruction at `at` raised points, for an error that names the part `site` of its member + /// expression; `None` when the instruction has no member site. + pub fn site(&self, at: usize, site: Site) -> Option { + let i = self + .sites + .binary_search_by_key(&(at as u32), |(pc, _)| *pc) + .ok()?; + match site { + Site::Instruction => None, + Site::Object => Some(self.sites[i].1[0]), + Site::Key => Some(self.sites[i].1[1]), + } + } +} + +/// The part of a member expression an error points at, as the reference locates each failure at a node: a base that +/// cannot be read at the object, a namespace path's non-string key at the key, anything else at the instruction. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub enum Site { + #[default] + Instruction, + Object, + Key, +} + +#[derive(Clone)] +pub struct Program { + pub protos: Vec>, + pub consts: Vec, + /// Global names referenced by `GetGlobal`, by slot. + pub globals: Vec, + /// The strings of each tagged template site, for `Template`. + pub templates: Vec, +} + +/// A tagged template's text: each part cooked (`None` for an invalid escape) and raw, as string constants. +#[derive(Clone)] +pub struct TemplateSite { + pub cooked: Vec>, + pub raw: Vec, +} diff --git a/packages/codemode-rust/crates/psychoscript/src/classes.rs b/packages/codemode-rust/crates/psychoscript/src/classes.rs new file mode 100644 index 0000000000000..726feb9d0988b --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/classes.rs @@ -0,0 +1,598 @@ +//! Classes, as the reference's language layer has them: `class` declarations and expressions whose constructor only +//! `new` calls, instance and static methods, accessors and fields, and `extends` another class or an Error type with +//! `super(...)` and `super.x`. +//! +//! - A class is its constructor, a closure whose `FuncProto::class` is set, with a frozen `prototype`. Its methods +//! are closures with a home object (`Closure::home`), which `super.x` reads from; an arrow made in a method takes +//! its home with it. Its instance fields are a function of their own (`Closure::fields`) that defines them on +//! `this`, run when the constructor starts, or right after `super()` returns in a derived one. +//! - `new C(...)` calls the constructor with a fresh instance of `C.prototype` as `this`; a derived constructor gets +//! its new target there instead and binds `this` when `super()` returns. Its `return`s go through +//! `Op::CtorReturn`, which applies the return rules. + +use crate::bytecode::CLASS_DERIVED; +use crate::object::*; +use crate::value::{Id, Slot, Value}; +use crate::vm::Vm; + +const THIS_BEFORE_SUPER: &str = "Must call super constructor in derived class before accessing 'this' or returning from derived constructor"; + +impl Vm { + /// The class flags of `v`'s code, when it is a class constructor. + pub(crate) fn class_of(&self, v: &Value) -> u8 { + match v { + Value::Obj(id) => match &self.heap[*id as usize].kind { + Kind::Closure(c) => c.proto.class, + _ => 0, + }, + _ => 0, + } + } + + /// The error for calling a class constructor without `new`. + pub(crate) fn class_call_error(&mut self, id: Id) -> Value { + let nk = self.names.name; + let name = match self.peek(id, nk) { + Value::Str(s) => self.text(s).to_owned(), + v => self.quiet_string(&v), + }; + self.type_error(&format!( + "Class constructor {name} cannot be invoked without 'new'" + )) + } + + /// `new C(...)`, or `super(...)` for `new_target`: pushes C's constructor frame on a new instance of + /// `new_target.prototype`, or with `new_target` itself as `this` when C is derived (see `Op::SuperBind`). The + /// arguments are on the stack above the callee and receiver slots at `fpos`. + pub(crate) fn construct_class( + &mut self, + ctor: Id, + new_target: Id, + fpos: usize, + argc: usize, + ) -> Result<(), Value> { + let derived = self.class_of(&Value::Obj(ctor)) == CLASS_DERIVED; + let this = if derived { + Value::Obj(new_target) + } else { + let pk = self.names.prototype; + let proto = match self.get_obj(new_target, pk) { + Value::Obj(p) => p, + _ => self.realm.object_proto, + }; + Value::Obj(self.alloc(Obj::new(Some(proto), Kind::Ordinary))) + }; + self.stack[fpos] = Slot::pack(Value::Obj(ctor)); + self.stack[fpos + 1] = Slot::pack(this); + self.constructing = true; + let r = self.enter_closure(ctor, fpos, argc); + self.constructing = false; + r + } + + /// `Op::Class`: the constructor on top gets its prototype, and with a parent inherits from it. + pub(crate) fn class_op(&mut self, derived: bool) -> Result<(), Value> { + let ctor = self.pop().as_obj().unwrap_or(0); + let parent = if derived { + Some(self.class_parent()?) + } else { + None + }; + let proto_of_proto = match parent { + Some(p) => { + let pk = self.names.prototype; + match self.get_obj(p, pk) { + Value::Obj(pp) => Some(pp), + _ => Some(self.realm.object_proto), + } + } + None => Some(self.realm.object_proto), + }; + let proto = self.alloc(Obj::new(proto_of_proto, Kind::Ordinary)); + if let Some(p) = parent { + self.heap[ctor as usize].proto = Some(p); + } + if let Kind::Closure(c) = &mut self.heap[ctor as usize].kind { + c.home = Value::Obj(proto); + } + let (pk, ck) = (self.names.prototype, self.names.constructor); + self.define_flags(ctor, pk, Value::Obj(proto), FIXED); + self.define_flags(proto, ck, Value::Obj(ctor), HIDDEN); + self.push(Value::Obj(ctor)); + self.push(Value::Obj(proto)); + Ok(()) + } + + /// What a class may extend, popped: another class or an Error type. Other built-ins and `null` are refused. + fn class_parent(&mut self) -> Result { + let parent = self.pop(); + match parent { + Value::Null => Err(self.type_error("Classes extending null are not supported.")), + Value::Obj(id) + if self.class_of(&parent) != 0 || self.error_ctor_proto(id).is_some() => + { + Ok(id) + } + Value::Obj(id) + if matches!(self.heap[id as usize].kind, Kind::Native { ctor: true, .. }) => + { + let nk = self.names.name; + let name = match self.peek(id, nk) { + Value::Str(s) => self.text(s).to_owned(), + v => self.quiet_string(&v), + }; + Err(self.type_error(&format!( + "Extending the built-in {name} is not supported. Only classes and Error types can be extended." + ))) + } + _ => { + let d = crate::builtins::describe_value(self, &parent); + Err(self.type_error(&format!( + "Class extends value {d} is not a constructor or null." + ))) + } + } + } + + /// Whether `id` is an error type's constructor (`is_error_ctor`), as `Some(id)`. + pub(crate) fn error_ctor_proto(&mut self, id: Id) -> Option { + crate::builtins::object::is_error_ctor(self, id).then_some(id) + } + + /// Sets a property's value and attributes, replacing whatever was there (the reference's `define`). + pub(crate) fn define_flags(&mut self, id: Id, key: Atom, val: Value, flags: u8) { + let o = &mut self.heap[id as usize]; + match o.props.find(key) { + Some(i) => { + o.props.items[i].value = val; + o.props.items[i].flags = flags; + } + None => o.props.push_new(key, val, flags), + } + } + + /// `Op::DefineMethod`. + pub(crate) fn define_method(&mut self, key: Atom, flags: u8) -> Result<(), Value> { + let f = self.pop(); + let key = if flags & 2 != 0 { + let k = self.pop(); + self.key_of(&k)? + } else { + key + }; + let n = self.stack.len(); + let at = if flags & 1 != 0 { n - 2 } else { n - 1 }; + let home = self.stack[at].get().as_obj().unwrap_or(0); + let Value::Obj(fid) = f else { return Ok(()) }; + if let Kind::Closure(c) = &mut self.heap[fid as usize].kind { + c.home = Value::Obj(home); + } + if key == self.names.prototype && self.class_of(&Value::Obj(home)) != 0 { + return Err( + self.type_error("Classes may not have a static property named 'prototype'.") + ); + } + let shown = self.key_shown(key); + let nk = self.names.name; + if flags & 12 == 0 { + let name = self.str_val(&shown); + self.define_flags(fid, nk, name, 0); + self.define_flags(home, key, f, HIDDEN); + return Ok(()); + } + let setter = flags & 8 != 0; + let name = self.str_val(&format!("{} {shown}", if setter { "set" } else { "get" })); + self.define_flags(fid, nk, name, 0); + self.define_accessor_half(home, key, setter, f, false); + Ok(()) + } + + /// A key as a function's name: `[Symbol.iterator]` for the iterator symbols. + pub(crate) fn key_shown(&self, key: Atom) -> String { + match key { + SYM_ITERATOR => "[Symbol.iterator]".to_owned(), + SYM_ASYNC_ITERATOR => "[Symbol.asyncIterator]".to_owned(), + _ => self.key_text(key), + } + } + + /// `Op::NameByKey`: names the function on top by the key under it, unless it is a class with a static `name`. + pub(crate) fn name_by_key(&mut self, mode: u8) -> Result<(), Value> { + let n = self.stack.len(); + let Value::Obj(fid) = self.stack[n - 1].get() else { + return Ok(()); + }; + if !matches!(self.heap[fid as usize].kind, Kind::Closure(_)) || self.has_static_name(fid) { + return Ok(()); + } + let k = self.stack[n - 2].get(); + let key = self.key_of(&k)?; + let shown = self.key_shown(key); + let name = match mode { + 1 => format!("get {shown}"), + 2 => format!("set {shown}"), + _ => shown, + }; + let name = self.str_val(&name); + let nk = self.names.name; + self.define_flags(fid, nk, name, 0); + Ok(()) + } + + /// Whether a class has a static `name` member of its own: a method, an accessor, or anything not a string. + fn has_static_name(&self, fid: Id) -> bool { + if self.class_of(&Value::Obj(fid)) == 0 { + return false; + } + self.heap[fid as usize] + .props + .prop(self.names.name) + .is_some_and(|p| p.flags & ACCESSOR != 0 || !matches!(p.value, Value::Str(_))) + } + + /// `Op::SetFields`. + pub(crate) fn set_fields(&mut self) { + let f = self.pop(); + let n = self.stack.len(); + let (ctor, proto) = (self.stack[n - 2].get(), self.stack[n - 1].get()); + if let Value::Obj(fid) = f + && let Kind::Closure(c) = &mut self.heap[fid as usize].kind + { + c.home = proto; + } + if let Value::Obj(cid) = ctor + && let Kind::Closure(c) = &mut self.heap[cid as usize].kind + { + c.fields = f; + } + } + + /// `Op::InitFields` in the frame whose callee is at `callee`: calls the class's field initializer on `this` (on + /// top), or gives undefined when it has none. Whether a frame was pushed. + pub(crate) fn init_fields(&mut self, callee: Value) -> Result { + let this = self.pop(); + let fields = match callee { + Value::Obj(id) => match &self.heap[id as usize].kind { + Kind::Closure(c) => c.fields, + _ => Value::Undef, + }, + _ => Value::Undef, + }; + if let Value::Undef = fields { + self.push(Value::Undef); + return Ok(false); + } + self.push(fields); + self.push(this); + self.call_op(0) + } + + /// `Op::InitStatic`: `[ctor, fn]`, `fn` called on the constructor, its home. + pub(crate) fn init_static(&mut self) -> Result { + let f = self.pop(); + let ctor = self.pop(); + if let Value::Obj(fid) = f + && let Kind::Closure(c) = &mut self.heap[fid as usize].kind + { + c.home = ctor; + } + self.push(f); + self.push(ctor); + self.call_op(0) + } + + /// `Op::SuperCall` in the frame at `base`: constructs the running constructor's parent for the new target. + /// Whether a frame was pushed. + pub(crate) fn super_call(&mut self, base: usize, argc: u32, nt: u32) -> Result { + let args: Vec = if argc == u32::MAX { + match self.pop() { + Value::Obj(id) => match &self.heap[id as usize].kind { + Kind::Array(items) => crate::ops::without_holes(items), + _ => Vec::new(), + }, + _ => Vec::new(), + } + } else { + let n = self.stack.len() - argc as usize; + self.stack.drain(n..).map(|s| s.get()).collect() + }; + let new_target = self.stack[base + nt as usize].get().as_obj().unwrap_or(0); + let callee = self.stack[base - 2].get().as_obj().unwrap_or(0); + let parent = self.heap[callee as usize].proto; + let fpos = self.stack.len(); + self.push(Value::Undef); + self.push(Value::Undef); + self.stack.extend(args.iter().map(|v| Slot::pack(*v))); + match parent { + Some(p) if self.class_of(&Value::Obj(p)) != 0 => { + self.construct_class(p, new_target, fpos, args.len())?; + Ok(true) + } + Some(p) if self.error_ctor_proto(p).is_some() => { + self.stack[fpos] = Slot::pack(Value::Obj(p)); + self.new_target = Some(new_target); + let r = self.construct_op(args.len()); + self.new_target = None; + r + } + _ => { + self.stack.truncate(fpos); + let p = parent.map_or(Value::Null, Value::Obj); + let d = crate::builtins::describe_value(self, &p); + Err(self.type_error(&format!( + "Super constructor {d} of anonymous class is not a constructor" + ))) + } + } + } + + /// `Op::SuperBind`: `[instance, this] -> [instance]`, once. + pub(crate) fn super_bind(&mut self) -> Result<(), Value> { + let this = self.pop(); + if !matches!(this, Value::Uninit) { + return Err(self.reference_error("Super constructor may only be called once")); + } + Ok(()) + } + + /// The object `super.x` reads from: the home object's prototype. + fn super_base(&mut self, home: Value) -> Result { + match home { + Value::Obj(h) => { + match self.heap[h as usize].proto { + Some(p) => Ok(p), + None => Err(self + .type_error("Cannot use 'super' here: the home object has no prototype.")), + } + } + _ => Err(self.type_error("Cannot use 'super' here: the home object has no prototype.")), + } + } + + /// `Op::GetSuper`: the value, or `Some` getter to call with `this` (the receiver is pushed already when kept). + pub(crate) fn get_super( + &mut self, + key: Atom, + flags: u8, + ) -> Result, Value> { + let key = if flags & 2 != 0 { + let k = self.pop(); + self.key_of(&k)? + } else { + key + }; + let this = self.pop(); + let home = self.pop(); + let proto = self.super_base(home)?; + let v = self.read_with_receiver(proto, key, this); + if let Value::Uninit = v { + return Err(crate::builtins::accessor_error(self, proto, key)); + } + if let Some(g) = self.getter_hit.take() { + if flags & 1 != 0 { + return Ok(Some((g, this))); + } + return Ok(Some((g, this))); + } + self.push(v); + if flags & 1 != 0 { + self.push(this); + } + Ok(None) + } + + /// A named read from `proto`'s chain with `receiver` as the getter's receiver (the reference's `readObjProp`): a + /// program getter is handed back in `getter_hit`. + fn read_with_receiver(&mut self, proto: Id, key: Atom, receiver: Value) -> Value { + let mut cur = Some(proto); + while let Some(c) = cur { + if let Some(p) = self.heap[c as usize].props.prop(key) { + if p.flags & ACCESSOR == 0 { + if let Value::Uninit = p.value { + // A built-in accessor serves the receiver if it is of its kind. + return self.companion_value(receiver, key); + } + return p.value; + } + let pair = p.value; + self.op_access = true; + let v = self.accessor_read(pair, receiver, key); + self.op_access = false; + return v; + } + if self.has_own(c, key) { + return self.get_obj(c, key); + } + cur = self.heap[c as usize].proto; + } + Value::Undef + } + + /// `Op::PutSuper`: whether it met a program setter, which `setter_hit` holds for the instruction to call with + /// `this`; the value is pushed otherwise. + pub(crate) fn put_super( + &mut self, + key: Atom, + flags: u8, + ) -> Result, Value> { + let v = self.pop(); + let key = if flags & 2 != 0 { + let k = self.pop(); + self.key_of(&k)? + } else { + key + }; + let this = self.pop(); + let home = self.pop(); + let proto = self.super_base(home)?; + if let Some((pair, uninit)) = self.slot_on_chain(proto, key) { + if uninit { + let k = self.key_text(key); + return Err(self.type_error(&format!( + "Cannot set property {k}, which has only a getter." + ))); + } + let s = self.pair(pair).set; + if let Value::Undef = s { + let k = self.key_text(key); + return Err(self.type_error(&format!( + "Cannot set property {k}, which has only a getter." + ))); + } + if self.is_companion(&s) { + let id = s.as_obj().unwrap_or(0); + crate::accessors::companion_set(self, this, &[v], id)?; + self.push(v); + return Ok(None); + } + return Ok(Some((s, this, v))); + } + if !matches!(this, Value::Obj(_)) { + let k = self.key_text(key); + let d = crate::builtins::describe_value(self, &this); + return Err(self.type_error(&format!("Cannot set property {k} of {d}."))); + } + self.check_assignment_at(&this, key, &v)?; + if let Some(s) = self.op_write(&this, key, v)? { + return Ok(Some((s, this, v))); + } + self.push(v); + Ok(None) + } + + /// The accessor first found for `key` on `id`'s chain: its pair, or a built-in accessor (`true`). + fn slot_on_chain(&self, id: Id, key: Atom) -> Option<(Value, bool)> { + let mut cur = Some(id); + while let Some(c) = cur { + if let Some(p) = self.heap[c as usize].props.prop(key) { + if p.flags & ACCESSOR != 0 { + return Some((p.value, false)); + } + return matches!(p.value, Value::Uninit).then_some((Value::Undef, true)); + } + if self.has_own(c, key) { + return None; + } + cur = self.heap[c as usize].proto; + } + None + } + + /// `Op::CtorReturn`. + pub(crate) fn ctor_return(&mut self, derived: bool) -> Result<(), Value> { + let this = self.pop(); + let v = self.pop(); + if matches!(v, Value::Obj(_)) { + self.push(v); + return Ok(()); + } + if derived { + if !matches!(v, Value::Undef) { + return Err( + self.type_error("Derived constructors may only return object or undefined") + ); + } + if matches!(this, Value::Uninit) { + return Err(self.reference_error(THIS_BEFORE_SUPER)); + } + } + self.push(this); + Ok(()) + } + + /// The `this` TDZ error of a derived constructor. + pub(crate) fn this_before_super(&mut self) -> Value { + self.reference_error(THIS_BEFORE_SUPER) + } + + /// `Op::DefineClassField`: CreateDataPropertyOrThrow. + pub(crate) fn define_class_field(&mut self, key: Atom, computed: bool) -> Result<(), Value> { + let v = self.pop(); + let key = if computed { + let k = self.pop(); + self.key_of(&k)? + } else { + key + }; + let Value::Obj(id) = self.top() else { + return Ok(()); + }; + let desc = crate::accessors::Descriptor { + value: Some(v), + writable: Some(true), + enumerable: Some(true), + configurable: Some(true), + ..Default::default() + }; + if !self.define_own_property(id, key, &desc)? { + let k = match key { + SYM_ITERATOR => "Symbol(Symbol.iterator)".to_owned(), + SYM_ASYNC_ITERATOR => "Symbol(Symbol.asyncIterator)".to_owned(), + _ => self.key_text(key), + }; + return Err(self.type_error(&format!("Cannot define property {k}."))); + } + Ok(()) + } + + /// The running frame's home object: its callee's. + pub(crate) fn home_of(&self, callee: Value) -> Value { + match callee { + Value::Obj(id) => match &self.heap[id as usize].kind { + Kind::Closure(c) => c.home, + _ => Value::Undef, + }, + _ => Value::Undef, + } + } + + /// A function's own `name` when it is a string, else empty (the reference's `ownName`). + fn own_name(&mut self, id: Id) -> String { + let nk = self.names.name; + match self.own_slot(id, nk) { + Some(crate::accessors::OwnSlot { + value: crate::accessors::SlotValue::Data(Value::Str(s)), + .. + }) => self.text(s).to_owned(), + _ => String::new(), + } + } + + /// How `console.log` shows a class: `[class A]`, `[class B extends A]`. + pub(crate) fn class_shown(&mut self, id: Id) -> String { + let name = match self.own_name(id) { + n if n.is_empty() => "(anonymous)".to_owned(), + n => n, + }; + let parent = match self.heap[id as usize].proto { + Some(p) + if self.class_of(&Value::Obj(id)) == CLASS_DERIVED + && self.heap[p as usize].is_callable() => + { + self.own_name(p) + } + _ => String::new(), + }; + if parent.is_empty() { + format!("[class {name}]") + } else { + format!("[class {name} extends {parent}]") + } + } + + /// The class an instance was made by, from its prototype's own `constructor`, without running program code. + pub(crate) fn instance_class_name(&mut self, id: Id) -> Option { + let proto = self.heap[id as usize].proto?; + let ck = self.names.constructor; + let ctor = self.heap[proto as usize] + .props + .prop(ck) + .filter(|p| p.flags & ACCESSOR == 0) + .map(|p| p.value)?; + if self.class_of(&ctor) == 0 { + return None; + } + let name = self.own_name(ctor.as_obj()?); + (!name.is_empty()).then_some(name) + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/collector.rs b/packages/codemode-rust/crates/psychoscript/src/collector.rs new file mode 100644 index 0000000000000..9f315b608565c --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/collector.rs @@ -0,0 +1,893 @@ +//! Incremental mark-sweep for long-lived runs, in the style of Lua 5.1. +//! +//! Objects, closure cells and strings keep their ids: a freed slot goes on a free list and a later allocation reuses +//! it. A cycle runs Idle → Mark → Sweep → Idle, a bounded step at a time, and only at safe points (`Vm::gc_point`), +//! where every live value is in the VM's structures. Steps are paid for by allocation: a run that allocates nothing +//! does no collector work, and a run that never reaches the first threshold never collects at all. +//! +//! - Allocation stays a compare and a push. Each arena compares its length with a limit, which is the room left +//! before the next cycle; at the limit, or whenever a free list holds slots or a cycle runs, the limit is 0 and the +//! cold path (`gc_alloc` and friends) reuses slots, colours them and counts the debt that schedules steps. +//! - Colours: white (unreached), grey (reached, references not traced yet), black, and free. What a cycle allocates +//! survives it: a new object is black while marking, and black or white during the sweep depending on whether the +//! sweep has passed its slot. Cells and strings made after the cycle started are beyond the sweep's end, so they +//! survive without a colour. +//! - Marking keeps a snapshot of the heap as the cycle started (Yuasa): the roots are scanned once, at the start, and +//! everything they reached then survives. The first write to an object while marking traces it before the write +//! (`Heap`'s `IndexMut`), and overwriting a cell shades its old value (`Vm::gc_cell_write`), so no reference the +//! snapshot held is lost. Values only move between the roots and the heap, and the roots need no barrier: what the +//! program can reach later was in the snapshot or is new, hence black. Marking ends when nothing is grey, with no +//! atomic rescan. +//! - Work is counted in slots traced, and an object's long part (properties, elements, entries) is traced +//! `CHUNK` slots at a time, so a step stays short whatever the objects' sizes. Only the barrier traces a whole object +//! at once. +//! - Stack slots hold a cell as its raw index, which reads as a tiny number, so the stack is scanned conservatively for +//! cells: a slot whose bits are a valid cell index keeps that cell. Zero keeps cell 0. +//! - What a fresh runtime makes (objects, strings, cells and atoms below `snapshot_base`, a compiled program's atoms +//! among them) is permanent. +//! - An atom lives exactly as long as its string. Marking an object marks its keys' atoms, a Map or Set keeps a string +//! key as its atom's string, and so does `JSON.stringify` for the keys it holds. The interner is a weak table: while +//! a cycle runs, an atom it gives out is shaded, as anything the program obtains then is black. The sweep frees the +//! atoms whose strings were not reached, before it frees strings, and the interner reuses their ids. +//! - Short strings share an arena buffer. Once it is large a cycle retires it: the sweep copies its surviving strings +//! out, and the cycle after drops it. Any other shared buffer is dropped once no live string points into it. +//! - Snapshots save a freed object as an empty object, a freed string as "" and a freed cell as undefined, which a +//! resumed run collects again, and a freed atom as null, which it restores as a free id. + +use std::borrow::Cow; +use std::ops::{Deref, DerefMut, Index, IndexMut}; +use std::slice::SliceIndex; + +use crate::object::{Kind, Obj}; +use crate::reach::Ref; +use crate::strings::{Atom, NO_ATOM, NO_GROW, StrBuf, StrId, Strings}; +use crate::value::{Id, Slot, Value}; +use crate::vm::{MAX_OBJECTS, Vm}; + +const WHITE: u8 = 0; +const GREY: u8 = 1; +const BLACK: u8 = 2; +const FREE: u8 = 3; + +/// Slots in use (objects, cells and strings) at which the first cycle starts. A reducer event stays far below it, and +/// of the benchmark programs only the JSON round trip reaches it. +const FIRST: usize = 64 * 1024; +/// The least room a cycle leaves before the next one starts, so a small heap does not collect all the time. +const FLOOR: usize = 64 * 1024; +/// Allocations between steps. +const STEP: usize = 256; +/// Work units per allocation: enough to finish a cycle before the heap grows by about half. A unit is about what +/// tracing one slot costs, a nanosecond or so. +const MUL: usize = 128; +/// The most work units in one step, which bounds its pause. +const MAX_WORK: usize = 64 * 1024; +/// What freeing a slot's contents, or giving a string text of its own, costs on top: a call to the allocator. +const FREE_WORK: usize = 16; +/// The short strings' buffer is retired at a cycle's start once it holds this many bytes. +const ARENA_RETIRE: usize = 64 * 1024; +/// Slots of one object traced at a time; a few in the stress mode, so objects are often traced in part. +const CHUNK: usize = 4096; +const STRESS_CHUNK: usize = 3; +/// The least work units per step in the stress mode, where steps are as small as the debt allows, so cycles +/// interleave with the program as much as possible. +const STRESS_WORK: usize = 64; + +#[derive(Clone, Copy, PartialEq, Eq, Default)] +pub(crate) enum Phase { + #[default] + Idle, + Mark, + Sweep, +} + +/// Whether the stress mode is on: a cycle runs all the time, in tiny steps at every safe point the run reaches while +/// it allocates. Internal; tests turn it on with `PSYCHOSCRIPT_GC_STRESS=1` to find missing roots and barriers. +fn stress() -> bool { + static ON: std::sync::OnceLock = std::sync::OnceLock::new(); + *ON.get_or_init(|| std::env::var_os("PSYCHOSCRIPT_GC_STRESS").is_some_and(|v| v == "1")) +} + +pub(crate) fn first_limit() -> usize { + if stress() { 0 } else { FIRST } +} + +/// The run's objects. The first write to an object while marking traces it first: every `heap[id]` that may write +/// goes through `IndexMut`. +pub struct Heap { + objs: Vec, + pub(crate) marking: bool, + marks: Marks, +} + +#[derive(Default)] +struct Marks { + color: Vec, + grey: Vec, + /// A long object traced in part: its id and the first slot of its bulk (`reach::bulk`) not traced yet. + resume: Option<(Id, usize)>, + /// Strings, cells and atoms the barrier reached, which the next step marks: their colours are not the heap's. + pending: Vec, +} + +impl Heap { + pub fn with_capacity(n: usize) -> Heap { + Heap { + objs: Vec::with_capacity(n), + marking: false, + marks: Marks::default(), + } + } + + #[inline(always)] + pub fn push(&mut self, o: Obj) { + self.objs.push(o); + } + + /// Fills freed slot `i`, past the barrier: a reused slot is black or white already. The sweep left an empty + /// object there, which owns no memory, so it is forgotten rather than dropped: that keeps drop code out of every + /// `alloc`. + #[inline(always)] + pub(crate) fn put(&mut self, i: usize, o: Obj) { + std::mem::forget(std::mem::replace(&mut self.objs[i], o)); + } + + /// Traces object `i` as it is, before a write, unless it is black already. + #[cold] + #[inline(never)] + fn barrier(&mut self, i: usize) { + let m = &mut self.marks; + if !matches!(m.color.get(i), Some(&WHITE | &GREY)) { + return; + } + m.color[i] = BLACK; + // Objects are greyed here; strings, cells and atoms wait for the next step. + crate::reach::children(&self.objs[i], &mut |r| match r { + Ref::Obj(id) => { + if m.color.get(id as usize) == Some(&WHITE) { + m.color[id as usize] = GREY; + m.grey.push(id); + } + } + _ => m.pending.push(r), + }); + } +} + +impl Deref for Heap { + type Target = Vec; + + #[inline(always)] + fn deref(&self) -> &Vec { + &self.objs + } +} + +impl> Index for Heap { + type Output = I::Output; + + #[inline(always)] + fn index(&self, i: I) -> &I::Output { + &self.objs[i] + } +} + +impl IndexMut for Heap { + #[inline(always)] + fn index_mut(&mut self, i: usize) -> &mut Obj { + if self.marking { + self.barrier(i); + } + &mut self.objs[i] + } +} + +/// The collector's state for objects and cells; strings keep theirs in `Strings::gc`. +pub struct Gc { + phase: Phase, + /// An allocation at this length takes the cold path. + pub(crate) obj_limit: usize, + pub(crate) cell_limit: usize, + free: Vec, + cell_free: Vec, + cell_color: Vec, + /// Slots in use at which the next cycle starts. + trigger: usize, + /// Slots in use when marking ended, less what the sweep freed since: the live data the next threshold is set from. + /// What the program allocates during the sweep is left out, so this cycle's floating garbage does not raise it. + live: usize, + /// Allocations not yet paid for with collector work. + debt: usize, + /// A step is due at the next safe point. + requested: bool, + /// The collector set `suspend_wanted` to reach a safe point; nobody else wants the run to stop. + owns_suspend: bool, + obj_sweep: (usize, usize), + cell_sweep: (usize, usize), +} + +impl Gc { + pub fn new() -> Gc { + Gc { + phase: Phase::Idle, + obj_limit: first_limit(), + cell_limit: first_limit(), + free: Vec::new(), + cell_free: Vec::new(), + cell_color: Vec::new(), + trigger: first_limit(), + live: 0, + debt: 0, + requested: false, + owns_suspend: false, + obj_sweep: (0, 0), + cell_sweep: (0, 0), + } + } + + #[cfg(feature = "gc-stats")] + pub(crate) fn free_counts(&self) -> (usize, usize) { + (self.free.len(), self.cell_free.len()) + } + + /// Someone other than the collector asks the run to stop. + pub(crate) fn disown_suspend(&mut self) { + self.owns_suspend = false; + } +} + +/// The collector's state for strings, made on the first write to it, which comes once a run passes its first +/// threshold: a short run allocates none. Until then it reads as an idle collector's. +#[derive(Clone, Default)] +pub struct LazyStrGc(Option>); + +static IDLE: StrGc = StrGc::new(); + +impl Deref for LazyStrGc { + type Target = StrGc; + + fn deref(&self) -> &StrGc { + self.0.as_deref().unwrap_or(&IDLE) + } +} + +impl DerefMut for LazyStrGc { + fn deref_mut(&mut self) -> &mut StrGc { + self.0.get_or_insert_with(|| Box::new(StrGc::new())) + } +} + +/// The collector's state for strings, kept in `Strings` so its allocation paths can reach it. +#[derive(Clone)] +pub struct StrGc { + phase: Phase, + pub(crate) free: Vec, + color: Vec, + /// Allocations not yet paid for; the VM reads it, as strings cannot ask for a safe point themselves. + debt: usize, + /// The VM should look at the debt or the threshold. + pub(crate) wanted: bool, + sweep: (usize, usize), + /// Freed atoms, whose ids the interner reuses. + pub(crate) atom_free: Vec, + /// The atoms the sweep looks at: those made after the fresh runtime and before marking ended. + atom_sweep: (usize, usize), + /// Per shared buffer as of the cycle's start: whether a live string points into it. + grow_live: Vec, + /// Retired short-string buffers: their surviving strings are copied out at the sweep. + retired: Vec, + pub(crate) grow_free: Vec, +} + +impl StrGc { + const fn new() -> StrGc { + StrGc { + phase: Phase::Idle, + free: Vec::new(), + color: Vec::new(), + debt: 0, + wanted: false, + sweep: (0, 0), + atom_free: Vec::new(), + atom_sweep: (0, 0), + grow_live: Vec::new(), + retired: Vec::new(), + grow_free: Vec::new(), + } + } +} + +impl Strings { + /// `new_grow` at the index of a dropped buffer, which the current cycle must keep. + #[cold] + #[inline(never)] + pub(crate) fn reuse_grow(&mut self, s: String) -> usize { + let gc = &mut *self.gc; + let g = gc.grow_free.pop().unwrap_or_default(); + if let Some(l) = gc.grow_live.get_mut(g) { + *l = true; + } + if let Some(r) = gc.retired.get_mut(g) { + *r = false; + } + self.grow[g] = s; + g + } + + /// `push` past the limit: counts the debt, and gives a freed slot for a string whose text is in shared buffer + /// `grow`, coloured for the cycle in progress, or `None` to push it at the end. + #[cold] + #[inline(never)] + pub(crate) fn push_slow(&mut self, grow: u32) -> Option { + let gc = &mut self.gc; + gc.debt += 1; + gc.wanted = true; + if gc.phase != Phase::Idle + && let Some(l) = gc.grow_live.get_mut(grow as usize) + { + *l = true; + } + let id = gc.free.pop()?; + gc.color[id as usize] = reused_color(gc.phase, id as usize, gc.sweep.0, BLACK); + Some(id) + } + + /// Frees string `i`, or keeps it for the next cycle, copying it out of a retired buffer. Returns the work done. + fn sweep_str(&mut self, i: usize) -> usize { + match self.gc.color[i] { + WHITE => { + self.gc.color[i] = FREE; + // Text in a shared buffer frees nothing. + let work = if self.bufs[i].grow == NO_GROW { + FREE_WORK + } else { + 1 + }; + self.release(i); + self.gc.free.push(i as StrId); + 1 + work + } + BLACK => { + self.gc.color[i] = WHITE; + let g = self.bufs[i].grow as usize; + if self.gc.retired.get(g) != Some(&true) { + return 1; + } + self.own_text(i); + 1 + FREE_WORK + } + _ => 1, + } + } + + /// Starts a cycle: colours for what was made since the last one, and a fresh short-string buffer once it is large. + /// The fresh runtime's strings, below `base`, are never swept, so their buffers stay. + fn start_cycle(&mut self, base: usize) { + let gc = &mut self.gc; + gc.phase = Phase::Mark; + self.gc_limit = 0; + gc.color.resize(self.bufs.len(), WHITE); + gc.grow_live.clear(); + gc.grow_live.resize(self.grow.len(), false); + gc.retired.resize(self.grow.len(), false); + for b in &self.bufs[..base.min(self.bufs.len())] { + if let Some(l) = self.gc.grow_live.get_mut(b.grow as usize) { + *l = true; + } + } + let g = self.arena; + if g != NO_GROW && self.grow[g as usize].len() >= ARENA_RETIRE { + self.arena = NO_GROW; + self.gc.retired[g as usize] = true; + } + } + + /// Frees atom `a` if its string was not reached, before the string itself is swept. Returns the work done. + fn sweep_atom(&mut self, a: usize) -> usize { + let s = self.atom_str[a] as usize; + if self.gc.color.get(s) != Some(&WHITE) { + return 1; + } + // Out of the table for the lookup, which reads the text in it. + let mut map = std::mem::take(&mut self.map); + map.remove(self.get(s as StrId)); + self.map = map; + self.atom_str[a] = NO_ATOM; + self.atom_index[a] = u32::MAX; + self.gc.atom_free.push(a as Atom); + 1 + FREE_WORK + } + + /// `insert_atom` past the limit: at a freed atom's id if there is one, and surviving the cycle in progress. + #[cold] + #[inline(never)] + pub(crate) fn insert_atom_slow(&mut self, s: Cow<'static, str>, id: StrId) -> Atom { + let index = crate::value::index_of_key(&s).unwrap_or(u32::MAX); + let a = match self.gc.atom_free.pop() { + Some(a) => { + self.atom_str[a as usize] = id; + self.atom_index[a as usize] = index; + a + } + None => { + self.atom_str.push(id); + self.atom_index.push(index); + (self.atom_str.len() - 1) as Atom + } + }; + self.map.insert(s, a); + self.shade_atom(a) + } + + /// A saved run's freed atom, restored as a free id. + pub(crate) fn free_atom_slot(&mut self) { + let a = self.atom_str.len() as Atom; + self.atom_str.push(NO_ATOM); + self.atom_index.push(u32::MAX); + self.gc.atom_free.push(a); + self.gc_limit = 0; + } + + /// The interner's barrier: an atom it gives out while a cycle runs survives the cycle, as the string of a new one + /// does. While sweeping, it needs it only until both the atoms' sweep, which runs first, and the strings' have + /// passed it. + #[cold] + #[inline(never)] + pub(crate) fn shade_atom(&mut self, a: Atom) -> Atom { + let id = self.atom_str[a as usize] as usize; + let gc = &mut *self.gc; + let unswept = match gc.phase { + Phase::Idle => false, + Phase::Mark => true, + Phase::Sweep => a as usize >= gc.atom_sweep.0 || id >= gc.sweep.0, + }; + if !unswept || gc.color.get(id) != Some(&WHITE) { + return a; + } + gc.color[id] = BLACK; + let g = self.bufs[id].grow as usize; + if gc.retired.get(g) != Some(&true) + && let Some(l) = gc.grow_live.get_mut(g) + { + *l = true; + } + a + } + + /// Drops every shared buffer no live string points into, except the short strings' current one. + fn end_cycle(&mut self) { + for g in 0..self.gc.grow_live.len() { + if self.gc.grow_live[g] || g == self.arena as usize || self.grow[g].capacity() == 0 { + continue; + } + self.grow[g] = String::new(); + self.gc.retired[g] = false; + self.gc.grow_free.push(g); + } + self.gc.phase = Phase::Idle; + } + + /// Gives string `i` text of its own, out of its shared buffer. + fn own_text(&mut self, i: usize) { + let text = self.get(i as StrId).to_owned(); + let b = &mut self.bufs[i]; + b.s = std::borrow::Cow::Owned(text); + b.set_own(); + } + + /// Drops a freed string's text. + fn release(&mut self, i: usize) { + if let Some(w) = self.bufs[i].wtf_index() { + self.wtf[w] = Box::default(); + } + self.bufs[i] = StrBuf::empty(); + } +} + +/// The colour of a reused slot: what the cycle in progress makes survives it. While sweeping, a slot the sweep +/// already passed stays white for the next cycle. +fn reused_color(phase: Phase, id: usize, swept_to: usize, marked: u8) -> u8 { + match phase { + Phase::Idle => WHITE, + Phase::Mark => marked, + Phase::Sweep if id < swept_to => WHITE, + Phase::Sweep => BLACK, + } +} + +/// Traces from roots and grey objects, with the colours taken out of the VM so the VM can be read meanwhile. +struct Marker<'v> { + vm: &'v Vm, + marks: Marks, + cells: Vec, + strs: Vec, + grow_live: Vec, + work: usize, +} + +impl Marker<'_> { + fn mark(&mut self, r: Ref) { + self.work += 1; + match r { + Ref::Obj(id) => { + let m = &mut self.marks; + if let Some(c) = m.color.get_mut(id as usize) + && *c == WHITE + { + *c = GREY; + m.grey.push(id); + } + } + Ref::Str(s) => self.mark_str(s), + // An atom lives as long as its string; the fresh runtime's are never swept. + Ref::Atom(a) => { + if let Some(s) = self.vm.atoms.atom_str.get(a as usize) { + self.mark_str(*s); + } + } + Ref::Cell(c) => { + if let Some(k) = self.cells.get_mut(c as usize) + && *k == WHITE + { + *k = BLACK; + match self.vm.cells[c as usize].get() { + Value::Obj(id) => self.mark(Ref::Obj(id)), + Value::Str(s) => self.mark_str(s), + _ => {} + } + } + } + } + } + + fn mark_str(&mut self, s: StrId) { + if let Some(c) = self.strs.get_mut(s as usize) + && *c == WHITE + { + *c = BLACK; + let g = self.vm.atoms.bufs[s as usize].grow as usize; + // A retired buffer's strings are copied out at the sweep, so they do not keep it. + if self.vm.atoms.gc.retired.get(g) != Some(&true) + && let Some(l) = self.grow_live.get_mut(g) + { + *l = true; + } + } + } + + /// Marks what the barrier reached, then traces grey objects until the work reaches `budget` or none is left; + /// returns whether none is left. + fn propagate(&mut self, budget: usize) -> bool { + let vm = self.vm; + for r in std::mem::take(&mut self.marks.pending) { + self.mark(r); + } + while self.work < budget { + let next = self + .marks + .resume + .take() + .or_else(|| self.marks.grey.pop().map(|id| (id, 0))); + let Some((id, from)) = next else { + return true; + }; + // Black already when the barrier traced it. + if self.marks.color[id as usize] != GREY { + continue; + } + let o = &vm.heap[id as usize]; + if from == 0 { + self.work += 1; + crate::reach::head(o, &mut |r| self.mark(r)); + } + let len = crate::reach::bulk_len(o); + let to = from + if stress() { STRESS_CHUNK } else { CHUNK }; + self.work += to.min(len).saturating_sub(from); + crate::reach::bulk(o, from, to, &mut |r| self.mark(r)); + if to < len { + self.marks.resume = Some((id, to)); + continue; + } + self.marks.color[id as usize] = BLACK; + } + self.marks.grey.is_empty() && self.marks.resume.is_none() + } + + fn roots(&mut self) { + crate::reach::roots(self.vm, &mut |r| self.mark(r)); + } +} + +impl Vm { + /// `alloc` at its limit: a freed slot for the object, coloured for the cycle in progress, or `None` to push it + /// at the end. The object stays with `alloc`: passing it to this out-of-line function made every allocation build + /// it in memory first. + #[cold] + #[inline(never)] + pub(crate) fn gc_alloc(&mut self) -> Option { + self.gc.debt += 1; + let phase = self.gc.phase; + let id = self.gc.free.pop(); + match id { + Some(id) => { + self.heap.marks.color[id as usize] = + reused_color(phase, id as usize, self.gc.obj_sweep.0, BLACK); + } + None => { + if self.heap.len() >= MAX_OBJECTS { + self.out_of_memory(); + } + // Past the sweep's end, so the sweep never sees it. + match phase { + Phase::Mark => self.heap.marks.color.push(BLACK), + Phase::Sweep => self.heap.marks.color.push(WHITE), + Phase::Idle => {} + } + } + } + self.gc_poll(); + id + } + + /// A new closure cell at its limit, as `gc_alloc` does for objects. + #[cold] + #[inline(never)] + pub(crate) fn gc_new_cell(&mut self) -> u64 { + self.gc.debt += 1; + let c = match self.gc.cell_free.pop() { + Some(c) => { + self.cells[c as usize] = Slot::UNINIT; + let color = reused_color(self.gc.phase, c as usize, self.gc.cell_sweep.0, BLACK); + self.gc.cell_color[c as usize] = color; + c as u64 + } + None => { + self.cells.push(Slot::UNINIT); + self.cells.len() as u64 - 1 + } + }; + self.gc_poll(); + c + } + + /// The barrier of cells: the value a write to cell `c` overwrites while marking survives the cycle. + #[cold] + #[inline(never)] + pub(crate) fn gc_cell_write(&mut self, c: usize) { + let Some(v) = self.cells.get(c) else { + return; + }; + match v.get() { + Value::Obj(id) => { + if self.heap.marks.color.get(id as usize) == Some(&WHITE) { + self.heap.marks.color[id as usize] = GREY; + self.heap.marks.grey.push(id); + } + } + Value::Str(s) => self.heap.marks.pending.push(Ref::Str(s)), + _ => {} + } + } + + /// Decides whether a step is due, from the allocation paths and the fuel check; otherwise sets the room left + /// before the next cycle as the arenas' limits. + #[cold] + #[inline(never)] + pub(crate) fn gc_poll(&mut self) { + self.atoms.gc.wanted = false; + if self.gc.phase != Phase::Idle { + if stress() || self.gc.debt + self.atoms.gc.debt >= STEP { + self.gc_request(); + } + return; + } + let used = self.gc_used(); + if used >= self.gc.trigger { + self.gc.obj_limit = 0; + self.gc.cell_limit = 0; + self.atoms.gc_limit = 0; + self.gc_request(); + return; + } + // Each arena may take a third of the room before the next look, so together they never overshoot it. + let room = (self.gc.trigger - used) / 3; + let limit = |len: usize, free: bool| if free { 0 } else { len + room }; + self.gc.obj_limit = limit(self.heap.len(), !self.gc.free.is_empty()).min(MAX_OBJECTS); + self.gc.cell_limit = limit(self.cells.len(), !self.gc.cell_free.is_empty()); + let strings_free = !self.atoms.gc.free.is_empty() || !self.atoms.gc.atom_free.is_empty(); + self.atoms.gc_limit = limit(self.atoms.bufs.len(), strings_free); + } + + fn gc_request(&mut self) { + self.gc.requested = true; + if !self.suspend_wanted { + self.suspend_wanted = true; + self.gc.owns_suspend = true; + } + } + + /// Slots in use: every object, cell and string not on a free list. + fn gc_used(&self) -> usize { + self.heap.len() - self.gc.free.len() + self.cells.len() - self.gc.cell_free.len() + + self.atoms.bufs.len() + - self.atoms.gc.free.len() + } + + /// A safe point the run reached with `suspend_wanted` set: takes a collection step if one is due. Returns whether + /// the collector alone wanted the stop, so the run goes on. + pub(crate) fn gc_point(&mut self) -> bool { + // A conversion's replay or a native JSON walk holds values in Rust locals. + let busy = self.replay_meter.is_some() + || !self.replay.is_empty() + || self.convert_req.is_some() + || self.json_walk != 0; + if self.gc.requested && !busy { + self.gc.requested = false; + self.gc_step(); + } + if !self.gc.owns_suspend { + return false; + } + if !self.gc.requested { + self.gc.owns_suspend = false; + self.suspend_wanted = false; + } + true + } + + /// Whether a step is due, for the host stop. + pub(crate) fn gc_pending(&self) -> bool { + self.gc.requested + } + + fn gc_step(&mut self) { + #[cfg(feature = "gc-stats")] + let started = std::time::Instant::now(); + let debt = self.gc.debt + self.atoms.gc.debt; + let budget = if stress() { + (debt * MUL).max(STRESS_WORK) + } else { + (debt * MUL).clamp(STEP * MUL, MAX_WORK) + }; + let left = debt.saturating_sub(budget / MUL); + self.gc.debt = left; + self.atoms.gc.debt = 0; + match self.gc.phase { + Phase::Idle => self.gc_start(), + Phase::Mark => self.gc_mark(budget), + Phase::Sweep => self.gc_sweep(budget), + } + if self.gc.phase != Phase::Idle && (stress() || self.gc.debt >= STEP) { + self.gc_request(); + } + #[cfg(feature = "gc-stats")] + self.record_pause(started.elapsed().as_nanos() as u64); + } + + /// Idle → Mark: colours for what was made since the last cycle, then the roots and the fresh runtime's objects. + fn gc_start(&mut self) { + // What was allocated while idle reused freed slots; this cycle pays for none of it. + self.gc.debt = 0; + self.gc.phase = Phase::Mark; + self.gc.obj_limit = 0; + self.gc.cell_limit = 0; + self.heap.marks.color.resize(self.heap.len(), WHITE); + self.gc.cell_color.resize(self.cells.len(), WHITE); + self.atoms.start_cycle(self.snapshot_base.bufs); + self.heap.marking = true; + let base = self.snapshot_base.heap.min(self.heap.len()); + for id in 0..base { + self.heap.marks.color[id] = GREY; + self.heap.marks.grey.push(id as Id); + } + self.with_marker(|m| m.roots()); + } + + fn gc_mark(&mut self, budget: usize) { + if !self.with_marker(|m| m.propagate(budget)) { + return; + } + self.heap.marking = false; + self.gc.live = self.gc_used(); + self.gc.phase = Phase::Sweep; + self.atoms.gc.phase = Phase::Sweep; + let base = self.snapshot_base; + self.gc.obj_sweep = (base.heap, self.heap.len()); + self.gc.cell_sweep = (base.cells, self.gc.cell_color.len()); + self.atoms.gc.sweep = (base.bufs, self.atoms.gc.color.len()); + self.atoms.gc.atom_sweep = (base.atoms, self.atoms.atom_str.len()); + } + + /// Runs `f` with the colours taken out of the VM, then puts them back. + fn with_marker(&mut self, f: impl FnOnce(&mut Marker) -> R) -> R { + let marks = std::mem::take(&mut self.heap.marks); + let cells = std::mem::take(&mut self.gc.cell_color); + let strs = std::mem::take(&mut self.atoms.gc.color); + let grow_live = std::mem::take(&mut self.atoms.gc.grow_live); + let mut m = Marker { + vm: self, + marks, + cells, + strs, + grow_live, + work: 0, + }; + let r = f(&mut m); + let Marker { + marks, + cells, + strs, + grow_live, + .. + } = m; + self.heap.marks = marks; + self.gc.cell_color = cells; + self.atoms.gc.color = strs; + self.atoms.gc.grow_live = grow_live; + r + } + + /// Frees white slots from where the sweep stopped, objects first, then cells, then strings. + fn gc_sweep(&mut self, budget: usize) { + #[cfg(feature = "gc-stats")] + self.publish_stats(); + let mut work = 0; + let free = self.gc.free.len() + self.gc.cell_free.len() + self.atoms.gc.free.len(); + // Atoms go first, while their strings' texts are still there to find them by. + let (mut at, end) = self.atoms.gc.atom_sweep; + while at < end && work < budget { + work += self.atoms.sweep_atom(at); + at += 1; + } + self.atoms.gc.atom_sweep.0 = at; + let (mut at, end) = self.gc.obj_sweep; + while at < end && work < budget { + work += 1; + match self.heap.marks.color[at] { + WHITE => { + self.heap.marks.color[at] = FREE; + self.heap.objs[at] = Obj::new(None, Kind::Ordinary); + self.gc.free.push(at as Id); + work += FREE_WORK; + } + BLACK => self.heap.marks.color[at] = WHITE, + _ => {} + } + at += 1; + } + self.gc.obj_sweep.0 = at; + let (mut at, end) = self.gc.cell_sweep; + while at < end && work < budget { + work += 1; + match self.gc.cell_color[at] { + WHITE => { + self.gc.cell_color[at] = FREE; + self.cells[at] = Slot::UNDEF; + self.gc.cell_free.push(at as u32); + } + BLACK => self.gc.cell_color[at] = WHITE, + _ => {} + } + at += 1; + } + self.gc.cell_sweep.0 = at; + let (mut at, end) = self.atoms.gc.sweep; + while at < end && work < budget { + work += self.atoms.sweep_str(at); + at += 1; + self.atoms.gc.sweep.0 = at; + } + self.gc.live -= + self.gc.free.len() + self.gc.cell_free.len() + self.atoms.gc.free.len() - free; + if work >= budget { + return; + } + self.atoms.end_cycle(); + self.gc.phase = Phase::Idle; + self.gc.trigger = if stress() { + 0 + } else { + self.gc.live + self.gc.live.max(FLOOR) + }; + self.gc_poll(); + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/compiler.rs b/packages/codemode-rust/crates/psychoscript/src/compiler.rs new file mode 100644 index 0000000000000..e2da0fbc3983d --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/compiler.rs @@ -0,0 +1,4957 @@ +//! Parses with oxc, resolves bindings with oxc_semantic, rejects syntax outside the subset, and emits bytecode. + +use std::sync::Arc; + +use oxc_allocator::Allocator; +use oxc_ast::ast::*; +use oxc_ast_visit::{Visit, walk}; +use oxc_parser::{ParseOptions, Parser, ParserReturn}; +use oxc_semantic::{AstNodes, Scoping, SemanticBuilder}; +use oxc_span::{GetSpan, SourceType}; +use oxc_syntax::operator::{ + AssignmentOperator, BinaryOperator, LogicalOperator, UnaryOperator, UpdateOperator, +}; +use oxc_syntax::scope::ScopeId; +use oxc_syntax::symbol::{SymbolFlags, SymbolId}; +use rustc_hash::{FxHashMap, FxHashSet}; + +use crate::DiagnosticKind; +use crate::bytecode::{ + Arith, Capture, FuncProto, ITER_DELEGATE, ITER_DESTRUCTURE, ITER_FOR_AWAIT, ITER_FOR_OF, Op, + Program, TemplateSite, +}; +use crate::bytecode::{CLASS_BASE, CLASS_DERIVED}; +use crate::strings::{Atom, Strings}; +use crate::value::{Value, num_to_string}; +use crate::vm::{REQ_NEXT, REQ_RETURN, REQ_THROW}; + +pub struct CompileError { + pub kind: DiagnosticKind, + pub message: String, + pub offset: Option, +} + +type R = Result; + +/// Deepest syntactic nesting a program may have; it bounds the recursion of analysis and compilation. +const MAX_NESTING: u32 = 2_000; +/// Largest program accepted, which bounds the parser's own recursion. +const MAX_SOURCE_BYTES: usize = 256 * 1024; + +pub fn compile(source: &str, atoms: &mut Strings) -> R { + if source.len() > MAX_SOURCE_BYTES { + return Err(CompileError { + kind: DiagnosticKind::ParseError, + message: format!("Program is larger than {MAX_SOURCE_BYTES} bytes."), + offset: None, + }); + } + if source.trim().is_empty() { + return Err(CompileError { + kind: DiagnosticKind::ParseError, + message: "Code cannot be empty.".into(), + offset: None, + }); + } + let renamed: String; + let mut await_alias = None; + let allocator = Allocator::default(); + let mut parsed = parse(&allocator, source, SourceType::mjs()); + // The reference parses a script that allows top-level `await`: `await` is a plain name there, read as the + // operator only where an expression starts with it. A program whose first error is naming something `await` is + // parsed again as a script, unless it also uses `await` as an expression at the top level; then the names are + // renamed for the parse instead, keeping the expressions. + if parsed + .diagnostics + .errors() + .next() + .is_some_and(|d| names_await(source, d)) + { + let script = parse(&allocator, source, SourceType::script()); + if script.diagnostics.errors().next().is_none() + && !script.fatal_error + && !TopLevelAwait::uses(&script.program) + { + parsed = script; + } else if let Some((text, alias)) = rename_await_names(source) { + renamed = text; + parsed = parse(&allocator, &renamed, SourceType::mjs()); + await_alias = Some(alias); + } + } + if let Some(d) = parsed + .diagnostics + .errors() + .find(|d| !accepted_by_reference(d)) + { + return Err(parse_error(source, &parsed.program, d)); + } + if parsed.fatal_error { + return Err(CompileError { + kind: DiagnosticKind::ParseError, + message: parse_message("Unexpected token"), + offset: None, + }); + } + // Parsed as a module for top-level `await`, but bound as a script, like the reference: top-level functions and + // `var`s share one scope, so redeclaring one as the other is allowed. + parsed.program.source_type = SourceType::script(); + let program = &parsed.program; + if let Some(export) = program + .body + .iter() + .find(|s| s.is_module_declaration() && !matches!(s, Statement::ImportDeclaration(_))) + { + return Err(CompileError { + kind: DiagnosticKind::ParseError, + message: "SyntaxError: Exports aren't available. Return the result instead.".into(), + offset: Some(export.span().start), + }); + } + // Acorn does not read decorators: the first `@` is an unexpected character. + struct Decorators(Option); + impl<'a> Visit<'a> for Decorators { + fn visit_decorator(&mut self, it: &Decorator<'a>) { + if self.0.is_none_or(|at| it.span.start < at) { + self.0 = Some(it.span.start); + } + } + } + let mut decorators = Decorators(None); + decorators.visit_program(program); + if let Some(at) = decorators.0 { + return Err(CompileError { + kind: DiagnosticKind::ParseError, + message: parse_message("Unexpected character '@'"), + offset: Some(at), + }); + } + let mut depth = DepthCheck { + depth: 0, + deepest: None, + }; + depth.visit_program(program); + if let Some(offset) = depth.deepest { + return Err(CompileError { + kind: DiagnosticKind::ParseError, + message: format!("SyntaxError: Program is nested more than {MAX_NESTING} levels deep."), + offset: Some(offset), + }); + } + let semantic = SemanticBuilder::new() + .with_check_syntax_error(true) + .with_build_nodes(true) + .build(program); + if let Some(d) = semantic.diagnostics.errors().next() { + return Err(parse_error(source, program, d)); + } + let scoping = semantic.semantic.scoping(); + let mut c = Compiler::new(scoping, semantic.semantic.nodes(), atoms); + c.await_alias = await_alias; + c.find_unbound(program); + c.find_field_values(program); + c.compute_captured(); + c.compile_program(program)?; + Ok(Program { + protos: c.protos.into_iter().map(Arc::new).collect(), + consts: c.consts, + globals: c.globals, + templates: c.templates, + }) +} + +fn parse<'a>(allocator: &'a Allocator, text: &'a str, source_type: SourceType) -> ParserReturn<'a> { + let options = ParseOptions { + allow_return_outside_function: true, + preserve_parens: false, + ..ParseOptions::default() + }; + Parser::new(allocator, text, source_type) + .with_options(options) + .parse() +} + +/// The source with each `await` the reference reads as a name replaced by the returned five-letter identifier, which +/// the source does not contain, padded with spaces to keep every offset (an escaped `await` is longer); `await` +/// expressions stay. `None` when the module parse fails for another reason. +fn rename_await_names(source: &str) -> Option<(String, String)> { + let alias = (0..100) + .map(|i| format!("$aw{i:02}")) + .find(|p| !source.contains(p.as_str()))?; + let mut text = source.to_owned(); + for _ in 0..256 { + let allocator = Allocator::default(); + let parsed = parse(&allocator, &text, SourceType::mjs()); + let first = parsed.diagnostics.errors().next(); + // After an escaped `await` label, its `break` reports a plain unexpected token. + let escaped_await = |d: &oxc_diagnostics::OxcDiagnostic| { + d.labels.first().is_some_and(|l| { + text.get(l.offset() as usize..(l.offset() + l.len()) as usize) + .is_some_and(|w| w != "await" && unescape_identifier(w) == "await") + }) + }; + if first + .is_some_and(|d| !names_await(&text, d) && !(parsed.fatal_error && escaped_await(d))) + { + return None; + } + let spans: Vec<(usize, usize)> = match first { + // An escaped `await` stops the parse where it is: rename it and parse again. + Some(d) if parsed.fatal_error => d + .labels + .first() + .map(|l| (l.offset() as usize, l.offset() as usize + l.len() as usize)) + .into_iter() + .collect(), + _ => { + let mut names = AwaitNames { + source: &text, + alias: &alias, + asyncs: Vec::new(), + arrow_params: false, + spans: Vec::new(), + invalid: false, + }; + names.visit_program(&parsed.program); + if names.invalid { + return None; + } + names.spans + } + }; + if spans.is_empty() { + return first.is_none().then_some((text, alias)); + } + for (start, end) in spans { + let word = text.get(start..end)?; + if word.len() < alias.len() || !word.is_ascii() || word.starts_with(alias.as_str()) { + return None; + } + let name = format!("{alias}{}", " ".repeat(word.len() - alias.len())); + text.replace_range(start..end, &name); + } + } + None +} + +/// The `await`s the reference reads as names. Outside every function, a plain `await` starts an `await` expression +/// unless it declares something; inside a function, every `await` is a name; inside an async function's parameters +/// or body, none is. An arrow's parameters belong to the code around it, read as an expression first, and a function +/// declaration's name too. +struct AwaitNames<'s> { + source: &'s str, + alias: &'s str, + /// Whether each enclosing function, innermost last, is async. + asyncs: Vec, + /// In an arrow's parameters, where declarations are read like references. + arrow_params: bool, + spans: Vec<(usize, usize)>, + /// An escaped `await` renamed earlier turned out to be in an async function, where the reference rejects it. + invalid: bool, +} + +impl AwaitNames<'_> { + fn note(&mut self, name: &str, span: oxc_span::Span, declares: bool) { + let in_async = self.asyncs.last() == Some(&true); + if name == self.alias { + self.invalid |= in_async; + return; + } + if name != "await" || in_async { + return; + } + let escaped = self.source.get(span.start as usize..span.end as usize) != Some("await"); + if !self.asyncs.is_empty() || (declares && !self.arrow_params) || escaped { + self.spans.push((span.start as usize, span.end as usize)); + } + } +} + +impl<'a> Visit<'a> for AwaitNames<'_> { + fn visit_function(&mut self, it: &Function<'a>, _flags: oxc_syntax::scope::ScopeFlags) { + let declared = it.is_declaration(); + if declared && let Some(id) = &it.id { + self.visit_binding_identifier(id); + } + let arrow_params = std::mem::replace(&mut self.arrow_params, false); + self.asyncs.push(it.r#async); + if !declared && let Some(id) = &it.id { + self.visit_binding_identifier(id); + } + self.visit_formal_parameters(&it.params); + if let Some(body) = &it.body { + self.visit_function_body(body); + } + self.asyncs.pop(); + self.arrow_params = arrow_params; + } + + fn visit_arrow_function_expression(&mut self, it: &ArrowFunctionExpression<'a>) { + let arrow_params = std::mem::replace(&mut self.arrow_params, true); + if it.r#async { + self.asyncs.push(true); + } + self.visit_formal_parameters(&it.params); + if it.r#async { + self.asyncs.pop(); + } + self.arrow_params = false; + self.asyncs.push(it.r#async); + self.visit_arrow_function_body(&it.body); + self.asyncs.pop(); + self.arrow_params = arrow_params; + } + + fn visit_binding_identifier(&mut self, it: &BindingIdentifier<'a>) { + self.note(it.name.as_str(), it.span, true); + } + + fn visit_identifier_reference(&mut self, it: &IdentifierReference<'a>) { + self.note(it.name.as_str(), it.span, false); + } + + fn visit_label_identifier(&mut self, it: &LabelIdentifier<'a>) { + self.note(it.name.as_str(), it.span, false); + } +} + +/// Whether a parse error is only about `await` used as a name, which a module rejects and a script allows. +fn names_await(source: &str, d: &oxc_diagnostics::OxcDiagnostic) -> bool { + if d.message == "Cannot use `await` as an identifier in an async context" { + return true; + } + let Some(label) = d.labels.first() else { + return false; + }; + d.message == "Keywords cannot contain escape characters" + && source + .get(label.offset() as usize..(label.offset() + label.len()) as usize) + .is_some_and(|word| unescape_identifier(word) == "await") +} + +/// An identifier's text with its `\uXXXX` and `\u{X}` escapes decoded. +fn unescape_identifier(word: &str) -> String { + let mut out = String::new(); + let mut rest = word; + while let Some(at) = rest.find("\\u") { + out.push_str(&rest[..at]); + rest = &rest[at + 2..]; + let (hex, after) = match rest.strip_prefix('{') { + Some(braced) => match braced.find('}') { + Some(end) => (&braced[..end], &braced[end + 1..]), + None => return word.to_owned(), + }, + None if rest.len() >= 4 && rest.is_char_boundary(4) => (&rest[..4], &rest[4..]), + None => return word.to_owned(), + }; + match u32::from_str_radix(hex, 16).ok().and_then(char::from_u32) { + Some(c) => out.push(c), + None => return word.to_owned(), + } + rest = after; + } + out.push_str(rest); + out +} + +/// Finds `await` read as a name outside every function, where the reference reads it as the operator. +struct TopLevelAwait { + functions: u32, + /// In the parameters of an arrow outside every function. + arrow_params: bool, + found: bool, +} + +impl TopLevelAwait { + fn uses(program: &oxc_ast::ast::Program) -> bool { + let mut v = TopLevelAwait { + functions: 0, + arrow_params: false, + found: false, + }; + v.visit_program(program); + v.found + } +} + +impl<'a> Visit<'a> for TopLevelAwait { + fn visit_function(&mut self, it: &Function<'a>, flags: oxc_syntax::scope::ScopeFlags) { + self.functions += 1; + walk::walk_function(self, it, flags); + self.functions -= 1; + } + + fn visit_arrow_function_expression(&mut self, it: &ArrowFunctionExpression<'a>) { + // The parameters are read as an expression around the arrow first, where a plain `await` awaits. + if self.functions == 0 { + self.arrow_params = true; + self.visit_formal_parameters(&it.params); + self.arrow_params = false; + } + self.functions += 1; + walk::walk_arrow_function_expression(self, it); + self.functions -= 1; + } + + fn visit_binding_identifier(&mut self, it: &BindingIdentifier<'a>) { + if self.functions == 0 && self.arrow_params && it.name == "await" && it.span.size() == 5 { + self.found = true; + } + } + + fn visit_identifier_reference(&mut self, it: &IdentifierReference<'a>) { + if self.functions == 0 && it.name == "await" { + self.found = true; + } + } + + fn visit_label_identifier(&mut self, it: &LabelIdentifier<'a>) { + if self.functions == 0 && it.name == "await" && it.span.size() == 5 { + self.found = true; + } + } +} + +/// Measures nesting without recursing past the limit. +struct DepthCheck { + depth: u32, + deepest: Option, +} + +impl DepthCheck { + fn enter(&mut self, offset: u32) -> bool { + self.depth += 1; + if self.depth > MAX_NESTING { + self.deepest.get_or_insert(offset); + return false; + } + true + } +} + +impl<'a> Visit<'a> for DepthCheck { + fn visit_expression(&mut self, it: &Expression<'a>) { + if self.enter(it.span().start) { + walk::walk_expression(self, it); + } + self.depth -= 1; + } + + fn visit_statement(&mut self, it: &Statement<'a>) { + if self.enter(it.span().start) { + walk::walk_statement(self, it); + } + self.depth -= 1; + } + + fn visit_binding_pattern(&mut self, it: &BindingPattern<'a>) { + if self.enter(it.span().start) { + walk::walk_binding_pattern(self, it); + } + self.depth -= 1; + } + + fn visit_assignment_target(&mut self, it: &AssignmentTarget<'a>) { + if self.enter(it.span().start) { + walk::walk_assignment_target(self, it); + } + self.depth -= 1; + } +} + +/// A parse error as the reference reports it: acorn's wording and position for what oxc found, with the reference's +/// hint that the code must be a plain JavaScript program body. +fn parse_error( + source: &str, + program: &oxc_ast::ast::Program, + d: &oxc_diagnostics::OxcDiagnostic, +) -> CompileError { + let (reason, offset) = acorn_error(source, program, d); + CompileError { + kind: DiagnosticKind::ParseError, + message: parse_message(&reason), + offset, + } +} + +fn parse_message(reason: &str) -> String { + // The reference names the class features it refuses. + if reason == "Unexpected character '@'" { + return "SyntaxError: Decorators are not supported.".to_owned(); + } + if reason.starts_with("Private field '#") { + return "SyntaxError: Private class members (#name) are not supported. Use a regular property instead." + .to_owned(); + } + let dot = if reason.ends_with('.') { "" } else { "." }; + format!("SyntaxError: {reason}{dot} Code must be plain JavaScript written as a program body.") +} + +/// oxc reports these where acorn, parsing a script that allows imports and exports anywhere, reads on: an import +/// below the top level is ignored or throws when it runs, and a nested export throws as unsupported syntax. +fn accepted_by_reference(d: &oxc_diagnostics::OxcDiagnostic) -> bool { + d.message == "'import statement' declaration can only be used at the top level of a module" + || d.message + == "'export statement' declaration can only be used at the top level of a module" +} + +/// Acorn's message and offset for an oxc diagnostic. Where acorn stops at a later token than oxc names, the offset +/// moves there; a diagnostic with no acorn counterpart keeps oxc's text. +fn acorn_error( + source: &str, + program: &oxc_ast::ast::Program, + d: &oxc_diagnostics::OxcDiagnostic, +) -> (String, Option) { + let msg: &str = &d.message; + let label = |i: usize| d.labels.get(i).map(|l| (l.offset(), l.len())); + let Some((at, len)) = label(0) else { + return (msg.to_owned(), None); + }; + let second = label(1).map_or(at, |l| l.0); + let text = |a: u32, b: u32| source.get(a as usize..b as usize).unwrap_or(""); + let before = |a: u32| source.get(..a as usize).unwrap_or(""); + let unexpected = |o: u32| ("Unexpected token".to_owned(), Some(o)); + let named = |m: &str| -> Option { + let rest = msg.strip_prefix(m)?; + Some(rest.split('`').next().unwrap_or("").to_owned()) + }; + let same = |o: u32| (msg.trim_end_matches('.').to_owned(), Some(o)); + let r = |m: &str, o: u32| (m.to_owned(), Some(o)); + match msg { + "Unexpected token" if text(at, at + 4) == "enum" => r("The keyword 'enum' is reserved", at), + "Unexpected token" + | "Invalid function declaration" + | "Invalid class declaration" + | "Expected function name" + | "Invalid rest element target in destructuring pattern" + | "Argument of dynamic import cannot be a spread element." + | "Unexpected JSX expression" => unexpected(at), + "Type assertion expressions can only be used in TypeScript files." => { + unexpected(next_token(source, word_end(source, at))) + } + "The left-hand side of a `for...of` statement may not start with `let`" => r( + "The left-hand side of a for-of loop may not start with 'let'.", + at, + ), + "The left-hand side of a `for...of` statement may not be `async`" => { + let of = next_token(source, at + len); + unexpected(next_token(source, word_end(source, of))) + } + "Lexical declaration cannot appear in a single-statement context" => { + let decl = text(at, at + len); + if decl.starts_with("using") || decl.starts_with("await") { + r( + "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement", + at, + ) + } else { + unexpected(at) + } + } + "Invalid escape sequence" => { + let esc = text(at, (at + len.max(2) + 16).min(source.len() as u32)); + let reason = match esc.get(1..3) { + Some("u{") => { + let body = &esc[3..]; + let hex = body.split('}').next().unwrap_or(""); + let closed = body.len() > hex.len(); + if closed && !hex.is_empty() && hex.chars().all(|c| c.is_ascii_hexdigit()) { + ("Code point out of bounds", at + 3) + } else { + ("Bad character escape sequence", at + 3) + } + } + _ => ("Bad character escape sequence", at + 2), + }; + r(reason.0, reason.1) + } + "Expected a semicolon or an implicit semicolon after a statement, but found none" => { + unexpected(next_token(source, at)) + } + "Only a single declaration is allowed in a `for...of` statement" => { + unexpected(next_token(source, at + len)) + } + "A 'yield' expression is only allowed in a generator body." + | "`await` is only allowed within async functions and at the top levels of modules" + | "A rest parameter cannot have an initializer." => { + unexpected(next_token(source, word_end(source, at))) + } + "Generators can only be declared at the top level or inside a block" => { + unexpected(next_token(source, word_end(source, at))) + } + "import() requires a specifier." => { + let open = text(at, at + len) + .find('(') + .map_or(at, |i| at + i as u32 + 1); + unexpected(next_token(source, open)) + } + "Missing initializer in const declaration" => unexpected(at + len), + "Using declarations must have an initializer." => { + r("Missing initializer in using declaration", at + len) + } + "Missing initializer in destructuring declaration" => r( + "Complex binding patterns require an initialization value", + at + len, + ), + "`let` cannot be declared as a variable name inside of a `let` declaration" => { + r("let is disallowed as a lexically bound name", at) + } + "Delete of an unqualified identifier in strict mode." => r( + "Deleting local variable in strict mode", + keyword_before(before(at), "delete"), + ), + "The operand of a 'delete' operator cannot be a private identifier." => r( + "Private fields can not be deleted", + keyword_before(before(at), "delete"), + ), + "'0'-prefixed octal literals and octal escape sequences are deprecated" => { + if text(at, at + 1) == "\"" || text(at, at + 1) == "'" { + let slash = text(at, at + len).find('\\').map_or(at, |i| at + i as u32); + r("Octal literal in strict mode", slash) + } else { + r("Invalid number", at) + } + } + "Cannot use `await` as an identifier in an async context" => r( + "Cannot use 'await' as identifier inside an async function", + at, + ), + "Cannot use `yield` as an identifier in a generator context" => { + r("Cannot use 'yield' as identifier inside a generator", at) + } + "Unterminated string" => match text(at, at + 1) { + "`" => r("Unterminated template", at + 1), + _ => r("Unterminated string constant", at), + }, + "Unterminated multiline comment" => r("Unterminated comment", at), + "Numeric separators must appear between digits" => { + if text(at + 1, at + 2) == "_" { + r("Numeric separator must be exactly one underscore", at + 1) + } else if before(at).ends_with(|c: char| c.is_ascii_alphanumeric()) { + r("Numeric separator is not allowed at the last of digits", at) + } else { + r( + "Numeric separator is not allowed at the first of digits", + at + 1, + ) + } + } + "Unexpected end of file" | "Invalid characters after number" => { + let prefix = before(at); + let radix = |p: &str| { + let lower = p.to_ascii_lowercase(); + [("0x", 16), ("0o", 8), ("0b", 2)] + .into_iter() + .find(|(k, _)| lower.ends_with(k)) + .map(|(_, n)| n) + }; + if msg == "Invalid characters after number" && text(at, at + 1) == "_" { + r( + "Numeric separator is not allowed at the first of digits", + at, + ) + } else if msg == "Invalid characters after number" { + r("Identifier directly after number", at) + } else if let Some(n) = radix(prefix) { + (format!("Expected number in radix {n}"), Some(at)) + } else if prefix.ends_with(['e', 'E', '.', '+', '-']) { + r("Invalid number", number_start(prefix)) + } else { + unexpected(at) + } + } + "Invalid assignment in object literal" => { + let eq = text(at, at + len).find('=').map_or(at, |i| at + i as u32); + r( + "Shorthand property assignments are valid only in destructuring patterns", + eq, + ) + } + "A 'get' accessor must not have any formal parameters." => { + r("getter should have no params", at) + } + "A 'set' accessor must have exactly one parameter." => { + r("setter should have exactly one param", at) + } + "A 'set' accessor cannot have rest parameter." => r("Setter cannot use rest params", at), + "Logical expressions and coalesce expressions cannot be mixed" => { + let span = text(at, at + len); + let op = span + .match_indices("??") + .chain(span.match_indices("||")) + .chain(span.match_indices("&&")) + .map(|(i, _)| i) + .filter(|i| *i > 0) + .max() + .map_or(at, |i| at + i as u32); + r( + "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses", + op, + ) + } + "Missing catch or finally clause" => r(msg, keyword_before(before(at), "try")), + "A 'default' clause cannot appear more than once in a 'switch' statement." => { + r("Multiple default clauses", second) + } + "Illegal break statement" => r("Unsyntactic break", at), + "Illegal continue statement: no surrounding iteration statement" => { + r("Unsyntactic continue", at) + } + "Use of undefined label" => { + let b = before(at).rfind("break"); + let c = before(at).rfind("continue"); + let (word, o) = match (b, c) { + (Some(b), Some(c)) if c > b => ("continue", c), + (Some(b), _) => ("break", b), + (None, c) => ("continue", c.unwrap_or(at as usize)), + }; + (format!("Unsyntactic {word}"), Some(o as u32)) + } + "A `continue` statement can only jump to a label of an enclosing `for`, `while` or `do while` statement." => { + r( + "Unsyntactic continue", + keyword_before(before(second), "continue"), + ) + } + "Invalid optional chain from new expression." => r( + "Optional chaining cannot appear in the callee of new expressions", + at, + ), + "Tagged template expressions are not permitted in an optional chain" => r( + "Optional chaining cannot appear in the tag of tagged template expressions", + at, + ), + "The only valid property accesses on import are `import.meta`, `import.source()`, and `import.defer()`" => { + r( + "The only valid meta property for import is 'import.meta'", + after_dot(source, at), + ) + } + "The only valid meta property for new is new.target" => r( + "The only valid meta property for new is 'new.target'", + after_dot(source, at), + ), + "Unexpected new.target expression" => r( + "'new.target' can only be used in functions and class static block", + at, + ), + "'super' can only be referenced in members of derived classes or object literal expressions." => { + r("'super' keyword outside a method", at) + } + "Super calls are not permitted outside constructors or in nested functions inside constructors." => { + if in_method(program, at) { + r("super() call outside constructor of a subclass", at) + } else { + r("'super' keyword outside a method", at) + } + } + "'super' can only be referenced in a derived class." => { + r("super() call outside constructor of a subclass", at) + } + "A rest parameter or binding pattern may not have a trailing comma." => { + r("Comma is not permitted after the rest element", at) + } + "Illegal 'use strict' directive in function with non-simple parameter list" => { + r(msg, enclosing_function(program, at).unwrap_or(at)) + } + "Cannot assign to this expression" => { + if text(at, at + len).contains("?.") { + r("Optional chaining cannot appear in left-hand side", at) + } else { + r("Assigning to rvalue", at) + } + } + "'with' statements are not allowed" => r("'with' in strict mode", at), + "'using' declarations are not allowed at the top level of a script" + | "'using' declaration cannot appear in the bare case statement." => r( + "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement", + at, + ), + "Multiple constructor implementations are not allowed." => { + r("Duplicate constructor in the same class", second) + } + "Classes may not have a static property named 'prototype'" => { + r("Classes can't have a static field named 'prototype'", at) + } + "A 'return' statement cannot be used inside a class static block." => { + r("'return' outside of function", at) + } + "Flag g is mentioned twice in regular expression literal" => r( + "Duplicate regular expression flag", + regex_start(before(at)) + 1, + ), + _ => { + if let Some(name) = named("Identifier `") { + return if name == "__proto__" { + r("Redefinition of __proto__ property", second) + } else if label(1).is_some_and(|l| params_hold(program, at, l.0)) { + r("Argument name clash", second) + } else { + ( + format!("Identifier '{name}' has already been declared"), + Some(second), + ) + }; + } + if let Some(name) = named("Label `") { + return (format!("Label '{name}' is already declared"), Some(second)); + } + if msg.starts_with("Expected `") && msg.contains("` but found `") { + return unexpected(at); + } + if let Some(flag) = msg + .strip_prefix("Flag ") + .and_then(|m| m.strip_suffix(" is mentioned twice in regular expression literal")) + && !flag.is_empty() + { + return r( + "Duplicate regular expression flag", + regex_start(before(at)) + 1, + ); + } + if msg.starts_with("Unexpected flag ") + && msg.ends_with(" in regular expression literal") + { + return r( + "Invalid regular expression flag", + regex_start(before(at)) + 1, + ); + } + if let Some(name) = msg + .strip_prefix("Cannot assign to '") + .and_then(|m| m.strip_suffix("' in strict mode")) + { + let how = if binds_at(program, at) { + "Binding" + } else { + "Assigning to" + }; + return (format!("{how} {name} in strict mode"), Some(at)); + } + if let Some(word) = msg + .strip_prefix("Identifier expected. '") + .and_then(|m| m.strip_suffix("' is a reserved word that cannot be used here.")) + { + let reserved = matches!( + word, + "enum" + | "implements" + | "interface" + | "let" + | "package" + | "private" + | "protected" + | "public" + | "static" + | "yield" + | "await" + ); + return if reserved { + (format!("The keyword '{word}' is reserved"), Some(at)) + } else { + (format!("Unexpected keyword '{word}'"), Some(at)) + }; + } + if let Some(c) = msg + .strip_prefix("Invalid Character `") + .and_then(|m| m.strip_suffix('`')) + { + let lower = before(at).to_ascii_lowercase(); + return match [("0x", 16), ("0o", 8), ("0b", 2)] + .into_iter() + .find(|(k, _)| lower.ends_with(k)) + { + Some(_) if c == "_" => r( + "Numeric separator is not allowed at the first of digits", + at, + ), + Some((_, n)) => (format!("Expected number in radix {n}"), Some(at)), + None => (format!("Unexpected character '{c}'"), Some(at)), + }; + } + if let Some(name) = msg + .strip_prefix("Private identifier '") + .and_then(|m| m.strip_suffix("' is not allowed outside class bodies")) + { + return ( + format!("Private field '{name}' must be declared in an enclosing class"), + Some(at), + ); + } + same(at) + } + } +} + +/// Acorn's reason for a regular expression literal that the engine's syntax check (worded as the reference's host +/// words `new RegExp` failures) refuses. +fn acorn_regex_reason(reason: &str) -> &str { + match reason { + "missing )" => "Unterminated group", + "unmatched parentheses" => "Unmatched ')'", + "nothing to repeat" => "Nothing to repeat", + "range out of order in character class" => "Range out of order in character class", + "missing terminating ] for character class" => "Unterminated character class", + "duplicate group specifier name" => "Duplicate capture group name", + "invalid group specifier name" => "Invalid capture group name", + "invalid property expression" => "Invalid property name", + "invalid \\k<> named backreference" => "Invalid named capture referenced", + "invalid escaped character for Unicode pattern" => "Invalid escape", + "invalid Unicode \\u escape" => "Invalid unicode escape", + "invalid class set character" | "invalid operation in class set" => { + "Invalid character in character class" + } + "invalid range in character class for Unicode pattern" => "Invalid character class", + "unmatched ] or } bracket for Unicode pattern" => "Lone quantifier brackets", + "incomplete {} quantifier for Unicode pattern" => "Incomplete quantifier", + "negated class set may contain strings" => "Negated character class may contain strings", + "unrecognized character after (?" => "Invalid group", + "invalid regular expression modifier" => "Invalid regular expression modifiers", + other => other, + } +} + +/// Where the next token after `from` starts, past whitespace and comments. +fn next_token(source: &str, from: u32) -> u32 { + let bytes = source.as_bytes(); + let mut i = from as usize; + loop { + match bytes.get(i) { + Some(b' ' | b'\t' | b'\n' | b'\r') => i += 1, + Some(b'/') if bytes.get(i + 1) == Some(&b'/') => { + while bytes.get(i).is_some_and(|b| *b != b'\n') { + i += 1; + } + } + Some(b'/') if bytes.get(i + 1) == Some(&b'*') => { + match source.get(i + 2..).and_then(|r| r.find("*/")) { + Some(end) => i += end + 4, + None => return i as u32, + } + } + Some(_) if source.get(i..).is_some_and(|r| r.starts_with('\u{a0}')) => i += 2, + _ => return i as u32, + } + } +} + +/// The end of the word that starts at `at`. +fn word_end(source: &str, at: u32) -> u32 { + let rest = source.get(at as usize..).unwrap_or(""); + let n = rest + .find(|c: char| !(c.is_alphanumeric() || c == '_' || c == '$')) + .unwrap_or(rest.len()); + at + n as u32 +} + +/// The start of the last `word` in `before`, or its end when there is none. +fn keyword_before(before: &str, word: &str) -> u32 { + before.rfind(word).unwrap_or(before.len()) as u32 +} + +/// The offset of the property after `new.` or `import.` at `at`. +fn after_dot(source: &str, at: u32) -> u32 { + let rest = source.get(at as usize..).unwrap_or(""); + match rest.find('.') { + Some(i) => next_token(source, at + i as u32 + 1), + None => at, + } +} + +/// Where the number literal that `before` ends in starts. +fn number_start(before: &str) -> u32 { + let n = before + .bytes() + .rev() + .take_while(|b| b.is_ascii_alphanumeric() || matches!(b, b'.' | b'_' | b'+' | b'-')) + .count(); + let start = before.len() - n; + // A sign belongs to the number only after an exponent. + let digits = before[start..].trim_start_matches(['+', '-']); + (before.len() - digits.len()) as u32 +} + +/// Where the regular expression literal whose flags `before` ends inside starts: the `/` that opens it. +fn regex_start(before: &str) -> u32 { + let close = before.rfind('/').unwrap_or(0); + let bytes = before.as_bytes(); + let mut i = close; + while i > 0 { + i -= 1; + if bytes[i] == b'/' && (i == 0 || bytes[i - 1] != b'\\') { + return i as u32; + } + } + close as u32 +} + +/// Whether one parameter list holds both offsets: a duplicate parameter, which acorn calls a clash. +fn params_hold(program: &oxc_ast::ast::Program, a: u32, b: u32) -> bool { + struct Find(u32, u32, bool); + impl<'a> Visit<'a> for Find { + fn visit_formal_parameters(&mut self, it: &FormalParameters<'a>) { + if it.span.start <= self.0.min(self.1) && self.0.max(self.1) < it.span.end { + self.2 = true; + } + walk::walk_formal_parameters(self, it); + } + } + let mut f = Find(a, b, false); + f.visit_program(program); + f.2 +} + +/// Whether a name is declared, not assigned, at `at`. +fn binds_at(program: &oxc_ast::ast::Program, at: u32) -> bool { + struct Find(u32, bool); + impl<'a> Visit<'a> for Find { + fn visit_binding_identifier(&mut self, it: &BindingIdentifier<'a>) { + self.1 |= it.span.start == self.0; + } + } + let mut f = Find(at, false); + f.visit_program(program); + f.1 +} + +/// Where the innermost function around `at` starts, with any `async` or `function` keyword before it. +fn enclosing_function(program: &oxc_ast::ast::Program, at: u32) -> Option { + struct Find(u32, Option); + impl Find { + fn see(&mut self, span: oxc_span::Span) { + if span.start <= self.0 + && self.0 < span.end + && self.1.is_none_or(|s| span.size() < s.size()) + { + self.1 = Some(span); + } + } + } + impl<'a> Visit<'a> for Find { + fn visit_function(&mut self, it: &Function<'a>, flags: oxc_syntax::scope::ScopeFlags) { + self.see(it.span); + walk::walk_function(self, it, flags); + } + fn visit_arrow_function_expression(&mut self, it: &ArrowFunctionExpression<'a>) { + self.see(it.span); + walk::walk_arrow_function_expression(self, it); + } + } + let mut f = Find(at, None); + f.visit_program(program); + f.1.map(|s| s.start) +} + +/// Whether the innermost non-arrow function around `at` is a method, where acorn allows `super` but not `super()`. +fn in_method(program: &oxc_ast::ast::Program, at: u32) -> bool { + struct Find { + at: u32, + methods: FxHashSet, + inner: Option, + } + impl<'a> Visit<'a> for Find { + fn visit_object_property(&mut self, it: &ObjectProperty<'a>) { + if it.method || it.kind != PropertyKind::Init { + self.methods.insert(it.value.span().start); + } + walk::walk_object_property(self, it); + } + fn visit_method_definition(&mut self, it: &MethodDefinition<'a>) { + self.methods.insert(it.value.span.start); + walk::walk_method_definition(self, it); + } + fn visit_function(&mut self, it: &Function<'a>, flags: oxc_syntax::scope::ScopeFlags) { + let s = it.span; + if s.start <= self.at + && self.at < s.end + && self.inner.is_none_or(|i| s.size() < i.size()) + { + self.inner = Some(s); + } + walk::walk_function(self, it, flags); + } + } + let mut f = Find { + at, + methods: FxHashSet::default(), + inner: None, + }; + f.visit_program(program); + f.inner.is_some_and(|s| f.methods.contains(&s.start)) +} + +/// The reference's orientation to the supported subset, which unsupported syntax reports and suggests. +pub const SUPPORTED_SYNTAX: &str = "This is a restricted JavaScript-like language. Supported: plain and async functions, data literals, destructuring, standard control flow, await and Promise, and built-ins such as Array, Object, Math, JSON, Date, RegExp, Map, Set, and URL. Unsupported: classes, BigInt, and custom Symbols. Use plain functions and data objects instead."; + +fn unsupported(what: &str, span: oxc_span::Span) -> CompileError { + CompileError { + kind: DiagnosticKind::UnsupportedSyntax, + message: format!( + "{what} is not supported. This is a restricted JavaScript-like language: use plain functions and data objects instead." + ), + offset: Some(span.start), + } +} + +#[derive(Clone, Copy)] +enum Store { + Local(u32), + Cell(u32), +} + +#[derive(Clone, Copy)] +struct SymInfo { + depth: usize, + store: Store, + tdz: bool, + is_const: bool, + decl_end: u32, + switch_scoped: bool, + name: Atom, +} + +enum Control<'a> { + Loop { + labels: Vec<&'a str>, + breaks: Vec, + continues: Vec, + /// The iterator slot of a `for...of`, and whether it is a `for await`. + iter: Option<(u32, bool)>, + }, + Label { + label: &'a str, + breaks: Vec, + }, + Switch { + labels: Vec<&'a str>, + breaks: Vec, + }, + Try, + /// Array destructuring, guarded by a handler that closes its iterator. + Iter(u32), + Finally { + body: &'a BlockStatement<'a>, + }, +} + +struct FnState<'a> { + code: Vec, + pos: Vec, + nlocals: u32, + captures: Vec, + upval_of: FxHashMap, + /// Where this function keeps its `arguments` object, made once at entry. + args_store: Option, + /// The upvalue an arrow reads its enclosing function's `arguments` through. + args_upval: Option, + controls: Vec>, + is_arrow: bool, + is_async: bool, + is_generator: bool, + needs_extra: bool, + callees: Vec<(u32, Box)>, + sites: Vec<(u32, [u32; 2])>, + /// The instruction index a jump may land on; no instruction fuses across it. + barrier: usize, + /// A class constructor: `CLASS_BASE` or `CLASS_DERIVED`. + class: u8, + /// Whether its class has instance fields. + fields: bool, + /// A method, which `super.x` may appear in. + method: bool, + /// A derived constructor's `this` binding, unbound until `super()`, and its new target's local. + this_store: Option, + this_upval: Option, + new_target: u32, + /// A method whose `super` reads its home object, or an arrow that takes it from its method. + home: bool, +} + +struct Compiler<'a, 's> { + scoping: &'s Scoping, + nodes: &'s AstNodes<'a>, + atoms: &'s mut Strings, + fns: Vec>, + syms: FxHashMap, + captured: FxHashSet, + protos: Vec, + consts: Vec, + str_consts: FxHashMap, + num_consts: FxHashMap, + globals: Vec, + global_of: FxHashMap, + templates: Vec, + pos: u32, + chains: Vec>, + switch_scopes: FxHashSet, + /// Bindings that assignment cannot change: a named function expression's own name. + readonly: FxHashSet, + /// The name `await` names were renamed to for parsing (see `rename_await_names`), which compiles as `await`. + await_alias: Option, + /// Parameters of a function with parameter expressions, which are in their TDZ until bound in order. + param_tdz: FxHashSet, + /// Function scopes whose `arguments` is read, and whether an arrow inside reads it. + args_owner: FxHashMap, + /// `var`s declared only inside a `with` body, which never runs, so the reference never binds them. + unbound: FxHashSet, + /// The spans of class field initializers, which run in a function of their own (see `compile_class`). + field_values: Vec, + /// While a class is compiled, its name's symbol to its inner binding. + class_inner: FxHashMap, + /// A computed field's key binding, by the field's start. + field_keys: FxHashMap, + /// Bindings the compiler makes, numbered after the program's symbols. + pseudo: usize, + /// Whether the function compiled last uses its home object (`super`). + last_home: bool, +} + +#[derive(Clone, Copy, PartialEq)] +enum BindMode { + /// A declaration's initialization: no TDZ check, `const` allowed. + Init, + /// A plain assignment. + Assign, +} + +impl<'a, 's> Compiler<'a, 's> { + fn new(scoping: &'s Scoping, nodes: &'s AstNodes<'a>, atoms: &'s mut Strings) -> Self { + Compiler { + scoping, + nodes, + atoms, + fns: Vec::new(), + syms: FxHashMap::default(), + captured: FxHashSet::default(), + protos: Vec::new(), + consts: Vec::new(), + str_consts: FxHashMap::default(), + num_consts: FxHashMap::default(), + globals: Vec::new(), + global_of: FxHashMap::default(), + templates: Vec::new(), + pos: 0, + chains: Vec::new(), + switch_scopes: FxHashSet::default(), + readonly: FxHashSet::default(), + await_alias: None, + param_tdz: FxHashSet::default(), + args_owner: FxHashMap::default(), + unbound: FxHashSet::default(), + field_values: Vec::new(), + class_inner: FxHashMap::default(), + field_keys: FxHashMap::default(), + pseudo: 0, + last_home: false, + } + } + + fn fn_scope_of(&self, mut scope: ScopeId) -> ScopeId { + loop { + let flags = self.scoping.scope_flags(scope); + if flags.is_function() || flags.is_top() { + return scope; + } + match self.scoping.scope_parent_id(scope) { + Some(p) => scope = p, + None => return scope, + } + } + } + + /// A binding is captured when any reference to it sits in a different function than its declaration. + fn compute_captured(&mut self) { + // `arguments` belongs to the nearest enclosing function that is not an arrow. + if let Some(refs) = self.scoping.root_unresolved_references().get("arguments") { + for rid in refs { + let mut scope = self.scoping.get_reference(*rid).scope_id(); + let mut through_arrow = false; + loop { + let flags = self.scoping.scope_flags(scope); + if flags.is_top() { + break; + } + if flags.is_function() && !flags.is_arrow() { + *self.args_owner.entry(scope).or_insert(false) |= through_arrow; + break; + } + if flags.is_arrow() { + through_arrow = true; + } + match self.scoping.scope_parent_id(scope) { + Some(p) => scope = p, + None => break, + } + } + } + } + let mut memo: FxHashMap = FxHashMap::default(); + for sym in self.scoping.symbol_ids() { + let decl_scope = self.scoping.symbol_scope_id(sym); + let decl_fn = *memo + .entry(decl_scope) + .or_insert_with(|| self.fn_scope_of(decl_scope)); + for rid in self.scoping.get_resolved_reference_ids(sym) { + let rs = self.scoping.get_reference(*rid).scope_id(); + let ref_fn = match memo.get(&rs) { + Some(f) => *f, + None => { + let f = self.fn_scope_of(rs); + memo.insert(rs, f); + f + } + }; + let at = self + .nodes + .kind(self.scoping.get_reference(*rid).node_id()) + .span() + .start; + if ref_fn != decl_fn || self.in_other_field(at, self.scoping.symbol_span(sym).start) + { + self.captured.insert(sym); + break; + } + } + } + } + + // ---------- emission helpers ---------- + + fn f(&mut self) -> &mut FnState<'a> { + self.fns.last_mut().expect("function state") + } + + fn emit(&mut self, op: Op) -> usize { + let pos = self.pos; + let f = self.f(); + // Peephole fusion with the previous instruction, unless a jump lands between the two. + if f.barrier != f.code.len() + && let Some(prev) = f.code.last_mut() + { + let fused = match (*prev, op) { + // The operator raises any error, so the fused instruction is at the operator. + (Op::Int(k), op) => Arith::of(op).map(|a| { + if let Some(p) = f.pos.last_mut() { + *p = pos; + } + Op::ArithI(a, k) + }), + (Op::GetLocal(a), Op::GetLocal(b)) => Some(Op::GetLocal2(a, b)), + (Op::ArithI(a, k), Op::JumpIfFalse(t)) if a.is_comparison() => { + Some(Op::JumpUnlessI(a, k, t)) + } + (prev, Op::JumpIfFalse(t)) => Arith::of(prev) + .filter(|a| a.is_comparison()) + .map(|a| Op::JumpUnless(a, t)), + _ => None, + }; + if let Some(fused) = fused { + *prev = fused; + return f.code.len() - 1; + } + // A binding's TDZ marker that its initialization overwrites at once is dead. + let n = f.code.len(); + if let Op::SetLocal(l) = op + && n >= 2 + && f.barrier + 2 <= n + && f.code[n - 2] == Op::Uninit + && f.code[n - 1] == Op::SetLocal(l) + { + f.code.truncate(n - 2); + f.pos.truncate(n - 2); + } + } + f.code.push(op); + f.pos.push(pos); + f.code.len() - 1 + } + + /// Emits a member instruction, recording where its object and key are when an error from it may point at them + /// (see [`Site`]): the reference's object node has no parentheses, and its key is the computed key's expression. + fn emit_member(&mut self, op: Op, object: &Expression, key: Option<&Expression>) -> usize { + let at = self.emit(op); + let pos = self.pos; + let object = object.without_parentheses().span().start; + let key = key.map_or(pos, |k| k.without_parentheses().span().start); + if object != pos || key != pos { + self.f().sites.push((at as u32, [object, key])); + } + at + } + + fn emit_at(&mut self, pos: u32, op: Op) -> usize { + let saved = std::mem::replace(&mut self.pos, pos); + let at = self.emit(op); + self.pos = saved; + at + } + + fn here(&mut self) -> u32 { + let f = self.f(); + f.barrier = f.code.len(); + f.code.len() as u32 + } + + fn patch(&mut self, at: usize) { + let target = self.here(); + let op = &mut self.f().code[at]; + *op = match *op { + Op::Jump(_) => Op::Jump(target), + Op::JumpIfFalse(_) => Op::JumpIfFalse(target), + Op::JumpIfTrue(_) => Op::JumpIfTrue(target), + Op::JumpUnless(a, _) => Op::JumpUnless(a, target), + Op::JumpUnlessI(a, k, _) => Op::JumpUnlessI(a, k, target), + Op::JumpIfFalseKeep(_) => Op::JumpIfFalseKeep(target), + Op::JumpIfTrueKeep(_) => Op::JumpIfTrueKeep(target), + Op::JumpIfNotNullishKeep(_) => Op::JumpIfNotNullishKeep(target), + Op::JumpIfNotUndef(_) => Op::JumpIfNotUndef(target), + Op::OptChain(_) => Op::OptChain(target), + Op::OptCall(_) => Op::OptCall(target), + Op::PushCatch(_) => Op::PushCatch(target), + Op::PushFinally(_) => Op::PushFinally(target), + Op::IterNext(s, _) => Op::IterNext(s, target), + Op::Yield(_) => Op::Yield(target), + Op::YieldDrop(_) => Op::YieldDrop(target), + Op::YieldStar(_) => Op::YieldStar(target), + Op::DelegateCall(s, k, _) => Op::DelegateCall(s, k, target), + Op::DelegateResult(_, k) => Op::DelegateResult(target, k), + Op::AsyncClose(s, _) => Op::AsyncClose(s, target), + other => other, + }; + } + + /// Two locals for an open iterator: the iterator, then its `next` method, read once when it opens. + fn iter_slot(&mut self) -> u32 { + let slot = self.new_local(); + self.new_local(); + slot + } + + fn new_local(&mut self) -> u32 { + let f = self.f(); + f.nlocals += 1; + f.nlocals - 1 + } + + /// A local slot that holds a closure cell's index. + fn new_cell(&mut self) -> u32 { + self.new_local() + } + + fn atom(&mut self, s: &str) -> Atom { + let s = self.real_name(s); + self.atoms.intern(s) + } + + /// A name as the program wrote it: `await` for a name renamed for parsing. + fn real_name<'n>(&self, s: &'n str) -> &'n str { + match &self.await_alias { + Some(alias) if s == alias => "await", + _ => s, + } + } + + /// Compiles syntax the language does not support, named by its ESTree node type, to a throw at the node: as in + /// the reference, it fails only when it runs. + fn throw_syntax(&mut self, kind: &str, span: oxc_span::Span) -> R<()> { + let k = self.str_const(kind); + self.emit_at(span.start, Op::ThrowUnsupported(k)); + Ok(()) + } + + fn str_const(&mut self, s: &str) -> u32 { + if let Some(i) = self.str_consts.get(s) { + return *i; + } + let i = self.consts.len() as u32; + let id = self.atoms.alloc(s.to_owned()); + self.consts.push(Value::Str(id)); + self.str_consts.insert(s.to_owned(), i); + i + } + + fn push_num(&mut self, n: f64) { + if n.fract() == 0.0 && n.abs() <= i32::MAX as f64 && !(n == 0.0 && n.is_sign_negative()) { + self.emit(Op::Int(n as i32)); + return; + } + let bits = n.to_bits(); + let i = match self.num_consts.get(&bits) { + Some(i) => *i, + None => { + let i = self.consts.len() as u32; + self.consts.push(Value::Num(n)); + self.num_consts.insert(bits, i); + i + } + }; + self.emit(Op::Const(i)); + } + + fn push_str(&mut self, s: &str) { + let i = self.str_const(s); + self.emit(Op::Const(i)); + } + + fn global_slot(&mut self, name: &str) -> u32 { + let a = self.atom(name); + if let Some(s) = self.global_of.get(&a) { + return *s; + } + let s = self.globals.len() as u32; + self.globals.push(a); + self.global_of.insert(a, s); + s + } + + fn depth(&self) -> usize { + self.fns.len() - 1 + } + + // ---------- scopes and bindings ---------- + + /// Allocates storage for a scope's bindings and returns them in declaration order. + fn declare_scope(&mut self, scope: ScopeId) -> Vec { + let mut syms: Vec = self.scoping.get_bindings(scope).values().copied().collect(); + syms.sort(); + let switch_scoped = self.switch_scopes.contains(&scope); + syms.retain(|s| self.is_bound(*s)); + for s in &syms { + if self.syms.contains_key(s) { + continue; + } + self.declare_symbol(*s, None, switch_scoped); + } + syms + } + + fn declare_symbol(&mut self, s: SymbolId, param_slot: Option, switch_scoped: bool) { + let flags = self.scoping.symbol_flags(s); + let store = if self.captured.contains(&s) { + Store::Cell(self.new_cell()) + } else { + Store::Local(param_slot.unwrap_or_else(|| self.new_local())) + }; + let tdz = (flags.intersects(SymbolFlags::BlockScopedVariable | SymbolFlags::ConstVariable) + && !flags.contains(SymbolFlags::Function)) + || flags.is_class() + || self.param_tdz.contains(&s); + let decl_end = self.decl_end(s); + let name = self.atom(self.scoping.symbol_name(s)); + self.syms.insert( + s, + SymInfo { + depth: self.depth(), + store, + tdz, + is_const: flags.contains(SymbolFlags::ConstVariable), + decl_end, + switch_scoped, + name, + }, + ); + } + + fn decl_end(&self, s: SymbolId) -> u32 { + // The end of the whole declaration, so references from inside the initializer stay checked. + self.nodes + .kind(self.scoping.symbol_declaration(s)) + .span() + .end + } + + /// Emits a scope's entry: fresh cells, TDZ markers, `var` initial values. + fn init_scope(&mut self, syms: &[SymbolId]) { + for s in syms { + let Some(info) = self.syms.get(s).copied() else { + continue; + }; + if info.depth != self.depth() { + continue; + } + let flags = self.scoping.symbol_flags(*s); + if flags.contains(SymbolFlags::CatchVariable) { + continue; + } + match info.store { + Store::Cell(c) => { + self.emit(Op::NewCell(c)); + if !info.tdz && !flags.contains(SymbolFlags::Function) { + self.emit(Op::Undef); + self.emit(Op::SetCell(c)); + } + } + Store::Local(l) => { + if info.tdz { + self.emit(Op::Uninit); + self.emit(Op::SetLocal(l)); + } + } + } + } + } + + /// Binds every `import` before the body runs, loading each module through the host's `%import(specifier, + /// kind, name)` global: kind 0 a default import, 1 a namespace, 2 a named export, 3 a bare import. + fn imports(&mut self, stmts: &'a [Statement<'a>]) -> R<()> { + for st in stmts { + let Statement::ImportDeclaration(d) = st else { + continue; + }; + if d.import_kind.is_type() || d.phase.is_some() { + return Err(unsupported("This form of `import`", d.span)); + } + let source = js_str(&d.source.value); + let source = source.as_str(); + let Some(specifiers) = &d.specifiers else { + self.import_call( + d.span.start, + |c| { + c.push_str(source); + Ok(()) + }, + 3, + None, + )?; + self.emit(Op::Pop); + continue; + }; + if specifiers.is_empty() { + self.import_call( + d.span.start, + |c| { + c.push_str(source); + Ok(()) + }, + 3, + None, + )?; + self.emit(Op::Pop); + } + for spec in specifiers { + let (kind, name, local, pos) = match spec { + ImportDeclarationSpecifier::ImportDefaultSpecifier(x) => { + (0, None, &x.local, x.span.start) + } + ImportDeclarationSpecifier::ImportNamespaceSpecifier(x) => { + (1, None, &x.local, x.span.start) + } + ImportDeclarationSpecifier::ImportSpecifier(x) => { + (2, Some(x.imported.name().as_str()), &x.local, x.span.start) + } + }; + self.import_call( + pos, + |c| { + c.push_str(source); + Ok(()) + }, + kind, + name, + )?; + match local.symbol_id.get() { + Some(s) => self.store_symbol(s, BindMode::Init, pos)?, + None => { + self.emit(Op::Pop); + } + } + } + } + Ok(()) + } + + /// `%import(, kind, name)`, leaving its result on the stack. + fn import_call( + &mut self, + pos: u32, + specifier: impl FnOnce(&mut Self) -> R<()>, + kind: u8, + name: Option<&str>, + ) -> R<()> { + let g = self.global_slot(crate::host::IMPORT_GLOBAL); + self.emit(Op::GetGlobal(g)); + self.emit(Op::Undef); + specifier(self)?; + self.push_num(f64::from(kind)); + let argc = match name { + Some(name) => { + self.push_str(name); + 3 + } + None => 2, + }; + self.pos = pos; + self.emit(Op::Call(argc)); + Ok(()) + } + + fn hoist_functions(&mut self, stmts: &'a [Statement<'a>]) -> R<()> { + for st in stmts { + if let Statement::FunctionDeclaration(f) = st { + self.closure_for_function(f, None)?; + let id = f.id.as_ref().and_then(|id| id.symbol_id.get()); + match id { + Some(s) => self.store_symbol(s, BindMode::Init, f.span.start)?, + None => { + self.emit(Op::Pop); + } + } + } + } + Ok(()) + } + + fn needs_check(&self, info: &SymInfo, ref_pos: u32) -> bool { + info.tdz && (info.depth != self.depth() || info.switch_scoped || ref_pos < info.decl_end) + } + + fn resolve_upval(&mut self, depth: usize, s: SymbolId) -> R { + if let Some(i) = self.fns[depth].upval_of.get(&s) { + return Ok(*i); + } + let info = self.syms[&s]; + let cap = if depth - 1 == info.depth { + match info.store { + Store::Cell(c) => Capture::Cell(c), + Store::Local(_) => { + return Err(CompileError { + kind: DiagnosticKind::ExecutionFailure, + message: "internal: captured binding has no cell".into(), + offset: Some(self.pos), + }); + } + } + } else { + Capture::Upval(self.resolve_upval(depth - 1, s)?) + }; + let f = &mut self.fns[depth]; + f.captures.push(cap); + let i = f.captures.len() as u32 - 1; + f.upval_of.insert(s, i); + Ok(i) + } + + fn symbol_info(&self, s: SymbolId) -> R { + self.syms.get(&s).copied().ok_or_else(|| CompileError { + kind: DiagnosticKind::UnsupportedSyntax, + message: format!( + "'{}' is used before its scope is entered.", + self.scoping.symbol_name(s) + ), + offset: Some(self.pos), + }) + } + + fn load_symbol(&mut self, s: SymbolId, ref_pos: u32) -> R<()> { + let s = self.class_inner.get(&s).copied().unwrap_or(s); + let info = self.symbol_info(s)?; + let chk = self.needs_check(&info, ref_pos); + if info.depth == self.depth() { + match (info.store, chk) { + (Store::Local(l), false) => self.emit(Op::GetLocal(l)), + (Store::Local(l), true) => self.emit(Op::GetLocalChk(l, info.name)), + (Store::Cell(c), false) => self.emit(Op::GetCell(c)), + (Store::Cell(c), true) => self.emit(Op::GetCellChk(c, info.name)), + }; + } else { + let u = self.resolve_upval(self.depth(), s)?; + self.emit(if chk { + Op::GetUpvalChk(u, info.name) + } else { + Op::GetUpval(u) + }); + } + Ok(()) + } + + /// Pops the top of the stack into the binding. + fn store_symbol(&mut self, s: SymbolId, mode: BindMode, ref_pos: u32) -> R<()> { + let s = self.class_inner.get(&s).copied().unwrap_or(s); + let info = self.symbol_info(s)?; + if mode == BindMode::Assign { + if info.is_const || self.readonly.contains(&s) { + self.emit(Op::Pop); + self.emit(Op::ThrowConst(info.name)); + return Ok(()); + } + if self.needs_check(&info, ref_pos) { + self.load_symbol(s, ref_pos)?; + self.emit(Op::Pop); + } + } + if info.depth == self.depth() { + match info.store { + Store::Local(l) => self.emit(Op::SetLocal(l)), + Store::Cell(c) => self.emit(Op::SetCell(c)), + }; + } else { + let u = self.resolve_upval(self.depth(), s)?; + self.emit(Op::SetUpval(u)); + } + Ok(()) + } + + /// The binding a name refers to; `None` for a global. + fn ident_symbol(&self, id: &IdentifierReference) -> Option { + id.reference_id + .get() + .and_then(|r| self.scoping.get_reference(r).symbol_id()) + .filter(|s| self.is_bound(*s)) + } + + /// Whether the reference binds a declared name: not a class's name, nor a `var` that only syntax that never runs + /// declares. + fn is_bound(&self, s: SymbolId) -> bool { + !self.unbound.contains(&s) + } + + fn find_unbound(&mut self, program: &oxc_ast::ast::Program) { + struct Withs(Vec); + impl<'a> Visit<'a> for Withs { + fn visit_with_statement(&mut self, it: &WithStatement<'a>) { + self.0.push(it.body.span()); + } + } + let mut withs = Withs(Vec::new()); + withs.visit_program(program); + if withs.0.is_empty() { + return; + } + let inside = |span: oxc_span::Span| { + withs + .0 + .iter() + .any(|w| w.start <= span.start && span.end <= w.end) + }; + for sym in self.scoping.symbol_ids() { + if inside(self.scoping.symbol_span(sym)) + && self + .scoping + .symbol_redeclarations(sym) + .iter() + .all(|r| inside(r.span)) + { + self.unbound.insert(sym); + } + } + } + + /// Reads a name, failing (unknown, or in its TDZ) at the name itself, as the reference locates it even when it is + /// parenthesized or the target of an assignment. + fn load_ident(&mut self, id: &IdentifierReference) -> R<()> { + let saved = std::mem::replace(&mut self.pos, id.span.start); + let r = self.load_ident_here(id); + self.pos = saved; + r + } + + fn load_ident_here(&mut self, id: &IdentifierReference) -> R<()> { + if let Some(s) = self.ident_symbol(id) { + return self.load_symbol(s, id.span.start); + } + match id.name.as_str() { + "undefined" => { + self.emit(Op::Undef); + } + "arguments" if self.f().args_store.is_some() => match self.f().args_store { + Some(Store::Cell(c)) => { + self.emit(Op::GetCell(c)); + } + _ => { + let l = match self.f().args_store { + Some(Store::Local(l)) => l, + _ => 0, + }; + self.emit(Op::GetLocal(l)); + } + }, + "arguments" if self.f().is_arrow && self.args_depth().is_some() => { + let u = self.resolve_args_upval(self.depth())?; + self.emit(Op::GetUpval(u)); + } + name => { + let g = self.global_slot(name); + self.emit(Op::GetGlobal(g)); + } + } + Ok(()) + } + + /// The depth of the function whose `arguments` an arrow at the current depth reads. + fn args_depth(&self) -> Option { + let d = self.fns.iter().rposition(|f| !f.is_arrow)?; + self.fns[d].args_store.map(|_| d) + } + + fn resolve_args_upval(&mut self, depth: usize) -> R { + if let Some(u) = self.fns[depth].args_upval { + return Ok(u); + } + let parent = depth - 1; + let cap = if self.fns[parent].is_arrow { + Capture::Upval(self.resolve_args_upval(parent)?) + } else { + match self.fns[parent].args_store { + Some(Store::Cell(c)) => Capture::Cell(c), + _ => { + return Err(CompileError { + kind: DiagnosticKind::ExecutionFailure, + message: "internal: captured arguments have no cell".into(), + offset: Some(self.pos), + }); + } + } + }; + let f = &mut self.fns[depth]; + f.captures.push(cap); + let i = f.captures.len() as u32 - 1; + f.args_upval = Some(i); + Ok(i) + } + + /// Pops the top of the stack into a name, failing at the name itself (see `load_ident`). + fn store_ident(&mut self, id: &IdentifierReference) -> R<()> { + let saved = std::mem::replace(&mut self.pos, id.span.start); + let r = self.store_ident_here(id); + self.pos = saved; + r + } + + fn store_ident_here(&mut self, id: &IdentifierReference) -> R<()> { + match self.ident_symbol(id) { + Some(s) => self.store_symbol(s, BindMode::Assign, id.span.start), + // `arguments` is a mutable binding of its function. + None if id.name == "arguments" + && (self.f().args_store.is_some() + || (self.f().is_arrow && self.args_depth().is_some())) => + { + match self.f().args_store { + Some(Store::Cell(c)) => self.emit(Op::SetCell(c)), + Some(Store::Local(l)) => self.emit(Op::SetLocal(l)), + None => { + let u = self.resolve_args_upval(self.depth())?; + self.emit(Op::SetUpval(u)) + } + }; + Ok(()) + } + None => { + let a = self.atom(id.name.as_str()); + self.emit(Op::Pop); + if self.global_of.contains_key(&a) + || is_builtin_global(id.name.as_str()) + || id.name == "undefined" + { + self.emit(Op::ThrowConst(a)); + } else { + self.emit(Op::ThrowRef(a)); + } + Ok(()) + } + } + } + + /// A plain, initialized-for-sure local of the current function, for fused instructions. + fn plain_local(&self, id: &IdentifierReference) -> Option { + let s = self.ident_symbol(id)?; + let info = self.syms.get(&s)?; + if info.depth != self.depth() || info.is_const || self.needs_check(info, id.span.start) { + return None; + } + match info.store { + Store::Local(l) => Some(l), + Store::Cell(_) => None, + } + } + + // ---------- functions ---------- + + fn compile_program(&mut self, program: &'a oxc_ast::ast::Program<'a>) -> R<()> { + self.fns.push(FnState::new(false)); + self.f().is_async = true; + let name = self.atom(""); + let syms = match program.scope_id.get() { + Some(scope) => self.declare_scope(scope), + None => Vec::new(), + }; + self.init_scope(&syms); + self.imports(&program.body)?; + self.hoist_functions(&program.body)?; + if program.body.is_empty() + && let Some(d) = program.directives.last() + { + let text = js_str(&d.expression.value); + self.push_str(&text); + self.emit(Op::Return); + } + let n = program.body.len(); + for (i, st) in program.body.iter().enumerate() { + if i + 1 == n + && let Statement::ExpressionStatement(e) = st + { + self.pos = e.span.start; + self.expr(&e.expression)?; + self.emit(Op::Return); + break; + } + self.stmt(st)?; + } + self.emit(Op::Undef); + self.emit(Op::Return); + let f = self.fns.pop().expect("program state"); + self.protos.insert( + 0, + FuncProto { + name, + code: f.code, + pos: f.pos, + nparams: 0, + length: 0, + nlocals: f.nlocals, + captures: Vec::new(), + is_async: true, + is_generator: false, + is_arrow: false, + is_program: true, + class: 0, + home: false, + needs_extra: false, + callees: f.callees, + sites: f.sites, + }, + ); + // Closure instructions index `protos` assuming the program is not in the list; shift them. + for p in self.protos.iter_mut() { + for op in p.code.iter_mut() { + if let Op::Closure(i) = op { + *i += 1; + } + } + } + Ok(()) + } + + fn closure_for_function(&mut self, f: &'a Function<'a>, name: Option<&str>) -> R<()> { + let Some(body) = &f.body else { + return Err(unsupported("Function declarations without a body", f.span)); + }; + let own_name = + f.id.as_ref() + .map(|id| id.name.as_str()) + .or(name) + .unwrap_or(""); + let self_sym = match f.r#type { + FunctionType::FunctionExpression => f.id.as_ref().and_then(|id| id.symbol_id.get()), + _ => None, + }; + let idx = self.compile_function(FnSpec { + name: own_name, + params: Some(&f.params), + class: 0, + fields: false, + method: false, + body: FnBody::Block(body), + scope: f.scope_id.get(), + is_async: f.r#async, + is_generator: f.generator, + is_arrow: false, + self_sym, + })?; + self.emit(Op::Closure(idx)); + Ok(()) + } + + fn closure_for_arrow( + &mut self, + f: &'a ArrowFunctionExpression<'a>, + name: Option<&str>, + ) -> R<()> { + let body = match &f.body { + ArrowFunctionBody::FunctionBody(b) => FnBody::Block(b), + other => match other.as_expression() { + Some(e) => FnBody::Expr(e), + None => return Err(unsupported("This arrow function body", f.span)), + }, + }; + let idx = self.compile_function(FnSpec { + name: name.unwrap_or(""), + params: Some(&f.params), + class: 0, + fields: false, + method: false, + body, + scope: f.scope_id.get(), + is_async: f.r#async, + is_generator: false, + is_arrow: true, + self_sym: None, + })?; + self.emit(Op::Closure(idx)); + Ok(()) + } + + fn compile_function(&mut self, spec: FnSpec<'a, '_>) -> R { + let saved_pos = self.pos; + let saved_chains = std::mem::take(&mut self.chains); + self.fns.push(FnState::new(spec.is_arrow)); + self.f().is_async = spec.is_async; + self.f().is_generator = spec.is_generator; + self.f().class = spec.class; + self.f().fields = spec.fields; + self.f().method = spec.method; + let no_items: &[FormalParameter<'a>] = &[]; + let (items, rest) = match spec.params { + Some(p) => (&p.items[..], p.rest.as_deref()), + None => (no_items, None), + }; + let nparams = items.len() as u32; + self.f().nlocals = nparams; + let length = items.iter().take_while(|p| p.initializer.is_none()).count() as u32; + if rest.is_some() { + self.f().needs_extra = true; + } + // A derived constructor gets its new target as `this`; its own `this` is unbound until `super()`. + if spec.class == CLASS_DERIVED { + let nt = self.new_local(); + self.emit(Op::This); + self.emit(Op::SetLocal(nt)); + let c = self.new_cell(); + self.emit(Op::NewCell(c)); + self.emit(Op::Uninit); + self.emit(Op::SetCell(c)); + self.f().new_target = nt; + self.f().this_store = Some(Store::Cell(c)); + } + // Simple parameters bind straight to their argument slot. With parameter expressions, every parameter is + // bound in order instead, so one read before its turn is in its TDZ. + let simple = rest.is_none() + && items.iter().all(|p| { + p.initializer.is_none() && matches!(p.pattern, BindingPattern::BindingIdentifier(_)) + }); + for (i, p) in items.iter().enumerate() { + if let BindingPattern::BindingIdentifier(id) = &p.pattern + && let Some(s) = id.symbol_id.get() + { + if simple { + self.declare_symbol(s, Some(i as u32), false); + } else { + self.param_tdz.insert(s); + } + } + } + let syms = match spec.scope { + Some(scope) => self.declare_scope(scope), + None => Vec::new(), + }; + self.init_scope(&syms); + if !spec.is_arrow + && let Some(captured) = spec.scope.and_then(|s| self.args_owner.get(&s).copied()) + { + self.f().needs_extra = true; + self.emit(Op::Arguments); + let store = if captured { + let c = self.new_cell(); + self.emit(Op::NewCell(c)); + self.emit(Op::SetCell(c)); + Store::Cell(c) + } else { + let l = self.new_local(); + self.emit(Op::SetLocal(l)); + Store::Local(l) + }; + self.f().args_store = Some(store); + } + // A named function expression's own name is bound outside its parameters, so their defaults see it too. + if let Some(s) = spec.self_sym + && self.syms.get(&s).is_some_and(|i| i.depth == self.depth()) + { + self.readonly.insert(s); + self.emit(Op::Callee); + self.store_symbol(s, BindMode::Init, 0)?; + } + for (i, p) in items.iter().enumerate() { + if simple + && let BindingPattern::BindingIdentifier(id) = &p.pattern + && let Some(s) = id.symbol_id.get() + { + if let Some(Store::Cell(c)) = self.syms.get(&s).map(|i| i.store) { + self.emit(Op::GetLocal(i as u32)); + self.emit(Op::SetCell(c)); + } + continue; + } + self.pos = p.span.start; + self.emit(Op::GetLocal(i as u32)); + if let Some(init) = &p.initializer { + let j = self.emit(Op::JumpIfNotUndef(0)); + self.emit(Op::Pop); + let hint = pattern_name(&p.pattern); + self.expr_named(init, hint)?; + self.patch(j); + } + self.bind_pattern(&p.pattern, BindMode::Init)?; + } + if let Some(rest) = rest { + self.emit(Op::Rest(nparams)); + self.bind_pattern(&rest.rest.argument, BindMode::Init)?; + } + if spec.is_generator { + self.emit(Op::GeneratorStart); + } + // A base class's instance fields are defined as its constructor starts. + if spec.class == CLASS_BASE && spec.fields { + self.emit(Op::This); + self.emit(Op::InitFields); + self.emit(Op::Pop); + } + match spec.body { + FnBody::Block(b) => { + self.hoist_functions(&b.statements)?; + for st in &b.statements { + self.stmt(st)?; + } + if spec.class != 0 { + self.pos = b.span.start; + } + self.emit(Op::Undef); + self.ctor_result(); + self.emit(Op::Return); + } + FnBody::Expr(e) => { + self.expr(e)?; + self.emit(Op::Return); + } + FnBody::DefaultCtor(at) => { + self.pos = at; + if spec.class == CLASS_DERIVED { + self.f().needs_extra = true; + self.emit(Op::Rest(0)); + self.super_call_with(None, at)?; + self.emit(Op::Pop); + } + self.emit(Op::Undef); + self.ctor_result(); + self.emit(Op::Return); + } + FnBody::Fields(fields, at) => { + self.pos = at; + self.emit(Op::This); + for p in fields { + self.class_field(p)?; + } + self.pos = at; + self.emit(Op::Pop); + self.emit(Op::Undef); + self.emit(Op::Return); + } + } + let f = self.fns.pop().expect("function state"); + self.last_home = f.home; + self.chains = saved_chains; + self.pos = saved_pos; + let name = self.atom(spec.name); + self.protos.push(FuncProto { + name, + code: f.code, + pos: f.pos, + nparams, + length, + nlocals: f.nlocals, + captures: f.captures, + is_async: spec.is_async, + is_generator: spec.is_generator, + is_arrow: spec.is_arrow, + is_program: false, + class: spec.class, + home: spec.is_arrow && f.home, + needs_extra: f.needs_extra, + callees: f.callees, + sites: f.sites, + }); + Ok(self.protos.len() as u32 - 1) + } + + // ---------- statements ---------- + + fn stmts(&mut self, stmts: &'a [Statement<'a>]) -> R<()> { + for s in stmts { + self.stmt(s)?; + } + Ok(()) + } + + fn block(&mut self, b: &'a BlockStatement<'a>) -> R<()> { + let syms = match b.scope_id.get() { + Some(scope) => self.declare_scope(scope), + None => Vec::new(), + }; + self.init_scope(&syms); + self.hoist_functions(&b.body)?; + self.stmts(&b.body) + } + + fn stmt(&mut self, st: &'a Statement<'a>) -> R<()> { + self.pos = st.span().start; + match st { + Statement::BlockStatement(b) => self.block(b), + Statement::EmptyStatement(_) => Ok(()), + Statement::DebuggerStatement(d) => self.throw_syntax("DebuggerStatement", d.span), + Statement::ExpressionStatement(e) => self.expr_stmt(&e.expression), + Statement::VariableDeclaration(d) => self.var_decl(d), + Statement::FunctionDeclaration(_) => Ok(()), + Statement::IfStatement(s) => { + self.expr(&s.test)?; + let j = self.emit(Op::JumpIfFalse(0)); + self.stmt(&s.consequent)?; + match &s.alternate { + Some(alt) => { + let end = self.emit(Op::Jump(0)); + self.patch(j); + self.stmt(alt)?; + self.patch(end); + } + None => self.patch(j), + } + Ok(()) + } + Statement::ReturnStatement(r) => { + match &r.argument { + Some(a) => { + self.expr(a)?; + if self.f().is_async && self.f().is_generator { + self.emit(Op::Await); + } + } + None => { + self.emit(Op::Undef); + } + } + self.emit_return() + } + Statement::ThrowStatement(t) => { + self.expr(&t.argument)?; + self.emit(Op::Throw); + Ok(()) + } + Statement::WhileStatement(w) => self.while_loop(w, Vec::new()), + Statement::DoWhileStatement(w) => self.do_while(w, Vec::new()), + Statement::ForStatement(f) => self.for_loop(f, Vec::new()), + Statement::ForOfStatement(f) => self.for_of(f, Vec::new()), + Statement::ForInStatement(f) => self.for_in(f, Vec::new()), + Statement::BreakStatement(b) => { + self.jump_out(true, b.label.as_ref().map(|l| l.name.as_str())) + } + Statement::ContinueStatement(c) => { + self.jump_out(false, c.label.as_ref().map(|l| l.name.as_str())) + } + Statement::LabeledStatement(l) => self.labeled(l), + Statement::SwitchStatement(s) => self.switch(s, Vec::new()), + Statement::TryStatement(t) => self.try_stmt(t), + Statement::ClassDeclaration(c) => self.class_declaration(c), + Statement::WithStatement(w) => self.throw_syntax("WithStatement", w.span), + // Bound before the body runs (see `imports`); one below the top level of the program does nothing there, + // and in a function throws when it runs. + Statement::ImportDeclaration(d) => { + if self.depth() > 0 { + let msg = self.str_const( + "An import declaration may only appear at the top level of the program.", + ); + self.emit_at(d.span.start, Op::ThrowSyntax(msg)); + } + Ok(()) + } + // Only reached below the top level: `compile` refuses an export at the top. + Statement::ExportAllDeclaration(d) => self.throw_syntax("ExportAllDeclaration", d.span), + Statement::ExportDefaultDeclaration(d) => { + self.throw_syntax("ExportDefaultDeclaration", d.span) + } + Statement::ExportNamedDeclaration(d) => { + self.throw_syntax("ExportNamedDeclaration", d.span) + } + Statement::ExportDeclaration(d) => self.throw_syntax("ExportNamedDeclaration", d.span), + Statement::ExportFromDeclaration(d) => { + self.throw_syntax("ExportNamedDeclaration", d.span) + } + other => Err(unsupported("TypeScript syntax", other.span())), + } + } + + fn expr_stmt(&mut self, e: &'a Expression<'a>) -> R<()> { + if let Expression::UpdateExpression(u) = e + && u.operator == UpdateOperator::Increment + && let SimpleAssignmentTarget::AssignmentTargetIdentifier(id) = &u.argument + && let Some(l) = self.plain_local(id) + { + self.pos = u.span.start; + self.emit(Op::IncLocal(l)); + return Ok(()); + } + if let Expression::AssignmentExpression(a) = e + && a.operator == AssignmentOperator::Assign + && let AssignmentTarget::AssignmentTargetIdentifier(id) = &a.left + { + self.pos = a.span.start; + self.expr_named(&a.right, Some(id.name.as_str()))?; + return self.store_ident(id); + } + if let Expression::AssignmentExpression(a) = e + && a.operator == AssignmentOperator::Addition + && let AssignmentTarget::AssignmentTargetIdentifier(id) = &a.left + && let Some(l) = self.plain_local(id) + { + self.pos = a.span.start; + self.expr(&a.right)?; + self.emit(Op::AddLocal(l)); + return Ok(()); + } + if let Expression::YieldExpression(y) = e + && !y.delegate + { + return self.yield_expr(y, true); + } + self.expr(e)?; + self.emit(Op::Pop); + Ok(()) + } + + /// A `yield`. Resuming it with `next(v)` continues after the inline return path with `v` pushed, unless `drop`; + /// `return(v)` runs that path with `v` pushed, and `throw(e)` throws at the `yield`. + fn yield_expr(&mut self, y: &'a YieldExpression<'a>, drop: bool) -> R<()> { + match &y.argument { + Some(a) => self.expr(a)?, + None => { + self.emit(Op::Undef); + } + } + if y.delegate { + self.yield_delegate()?; + if drop { + self.emit(Op::Pop); + } + return Ok(()); + } + let is_async = self.f().is_async; + if is_async { + self.emit(Op::Await); + } + let at = self.emit(if drop { Op::YieldDrop(0) } else { Op::Yield(0) }); + self.return_path(is_async)?; + self.patch(at); + Ok(()) + } + + /// What a `return(v)` request runs at a `yield`: `v` is on the stack. + fn return_path(&mut self, is_async: bool) -> R<()> { + if is_async { + self.emit(Op::Await); + } + self.emit_return() + } + + /// `yield*` over the iterable on the stack, forwarding `next`, `throw` and `return` requests to its iterator. + fn yield_delegate(&mut self) -> R<()> { + let is_async = self.f().is_async; + let flag = if is_async { DELEGATE_ASYNC } else { 0 }; + let it = self.iter_slot(); + self.emit(if is_async { + Op::GetAsyncIter(it, ITER_DELEGATE) + } else { + Op::GetIter(it, ITER_DELEGATE) + }); + self.emit(Op::Undef); + let lp = self.here(); + self.emit(Op::DelegateCall(it, flag, 0)); + if is_async { + self.emit(Op::Await); + } + let mut dones = vec![self.emit(Op::DelegateResult(0, REQ_NEXT))]; + let ys = self.here(); + self.emit(Op::YieldStar(lp)); + let to_ret = self.emit(Op::Jump(0)); + // A `throw(e)` request resumes here with `e` on the stack. + let no_throw = self.emit(Op::DelegateCall(it, flag | 1, 0)); + if is_async { + self.emit(Op::Await); + } + dones.push(self.emit(Op::DelegateResult(0, REQ_THROW))); + self.emit(Op::Jump(ys)); + self.patch(no_throw); + self.emit(Op::Pop); + self.close_iter(it, is_async); + let msg = self.str_const("The delegated iterator does not provide a throw() method."); + self.emit(Op::ThrowType(msg)); + self.patch(to_ret); + if is_async { + self.emit(Op::Await); + } + let plain = self.emit(Op::DelegateCall(it, flag | 2, 0)); + if is_async { + self.emit(Op::Await); + } + let ret_done = self.emit(Op::DelegateResult(0, REQ_RETURN)); + self.emit(Op::Jump(ys)); + self.patch(plain); + self.patch(ret_done); + self.emit_return()?; + for d in dones { + self.patch(d); + } + Ok(()) + } + + /// Closes the iterator in `slot` on a normal completion: calls its `return()` and checks the result. + fn close_iter(&mut self, slot: u32, is_async: bool) { + if !is_async { + self.emit(Op::IterClose(slot)); + return; + } + let skip = self.emit(Op::AsyncClose(slot, 0)); + self.emit(Op::Await); + self.emit(Op::CheckObject); + self.emit(Op::Pop); + self.patch(skip); + } + + fn var_decl(&mut self, d: &'a VariableDeclaration<'a>) -> R<()> { + match d.kind { + // A `using` binding is a `const` that nothing disposes, as in the reference. + VariableDeclarationKind::Var + | VariableDeclarationKind::Let + | VariableDeclarationKind::Const + | VariableDeclarationKind::Using + | VariableDeclarationKind::AwaitUsing => {} + } + for decl in &d.declarations { + self.pos = decl.span.start; + match &decl.init { + Some(init) => { + self.expr_named(init, pattern_name(&decl.id))?; + self.bind_pattern(&decl.id, BindMode::Init)?; + } + None => { + if d.kind != VariableDeclarationKind::Var { + self.emit(Op::Undef); + self.bind_pattern(&decl.id, BindMode::Init)?; + } + } + } + } + Ok(()) + } + + fn emit_return(&mut self) -> R<()> { + let unwinding = self.f().controls.iter().any(|c| { + matches!( + c, + Control::Try + | Control::Iter(_) + | Control::Finally { .. } + | Control::Loop { iter: Some(_), .. } + ) + }); + if !unwinding { + self.ctor_result(); + self.emit(Op::Return); + return Ok(()); + } + let tmp = self.new_local(); + self.emit(Op::SetLocal(tmp)); + let n = self.f().controls.len(); + self.unwind_to(0, n)?; + self.emit(Op::GetLocal(tmp)); + self.ctor_result(); + self.emit(Op::Return); + Ok(()) + } + + /// Emits the cleanup for leaving controls `from..to` (innermost first). + fn unwind_to(&mut self, from: usize, to: usize) -> R<()> { + for i in (from..to).rev() { + match &self.f().controls[i] { + Control::Try => { + self.emit(Op::PopTry); + } + Control::Iter(slot) => { + let slot = *slot; + self.emit(Op::PopTry); + self.emit(Op::IterClose(slot)); + } + Control::Loop { + iter: Some((slot, is_async)), + .. + } => { + let (slot, is_async) = (*slot, *is_async); + self.emit(Op::PopTry); + self.close_iter(slot, is_async); + } + Control::Finally { body } => { + let body: &'a BlockStatement<'a> = body; + self.emit(Op::PopTry); + let tail = self.f().controls.split_off(i); + let r = self.block(body); + self.f().controls.extend(tail); + r?; + } + _ => {} + } + } + Ok(()) + } + + fn jump_out(&mut self, is_break: bool, label: Option<&str>) -> R<()> { + let controls = &self.f().controls; + let mut target = None; + for (i, c) in controls.iter().enumerate().rev() { + let hit = match (c, label) { + (Control::Loop { .. }, None) => true, + (Control::Switch { .. }, None) => is_break, + (Control::Loop { labels, .. }, Some(l)) => labels.contains(&l), + (Control::Switch { labels, .. }, Some(l)) => is_break && labels.contains(&l), + (Control::Label { label: x, .. }, Some(l)) => is_break && *x == l, + _ => false, + }; + if hit { + target = Some(i); + break; + } + } + let Some(t) = target else { + return Err(CompileError { + kind: DiagnosticKind::ParseError, + message: "SyntaxError: Illegal break or continue statement".into(), + offset: Some(self.pos), + }); + }; + let n = self.f().controls.len(); + self.unwind_to(t + 1, n)?; + if is_break + && let Control::Loop { + iter: Some((slot, is_async)), + .. + } = self.f().controls[t] + { + self.emit(Op::PopTry); + self.close_iter(slot, is_async); + } + let j = self.emit(Op::Jump(0)); + match &mut self.f().controls[t] { + Control::Loop { + breaks, continues, .. + } => { + if is_break { + breaks.push(j) + } else { + continues.push(j) + } + } + Control::Switch { breaks, .. } | Control::Label { breaks, .. } => breaks.push(j), + _ => {} + } + Ok(()) + } + + fn push_loop(&mut self, labels: Vec<&'a str>, iter: Option<(u32, bool)>) { + self.f().controls.push(Control::Loop { + labels, + breaks: Vec::new(), + continues: Vec::new(), + iter, + }); + } + + /// Pops the loop control, patching continues to `cont` and breaks to here. + fn pop_loop_continues(&mut self, cont: u32) -> Vec { + let Some(Control::Loop { + breaks, continues, .. + }) = self.f().controls.pop() + else { + return Vec::new(); + }; + for c in continues { + if let Op::Jump(_) = self.f().code[c] { + self.f().code[c] = Op::Jump(cont); + } + } + breaks + } + + fn while_loop(&mut self, w: &'a WhileStatement<'a>, labels: Vec<&'a str>) -> R<()> { + let top = self.here(); + self.expr(&w.test)?; + let exit = self.emit(Op::JumpIfFalse(0)); + self.push_loop(labels, None); + self.stmt(&w.body)?; + self.emit(Op::Jump(top)); + let breaks = self.pop_loop_continues(top); + self.patch(exit); + for b in breaks { + self.patch(b); + } + Ok(()) + } + + fn do_while(&mut self, w: &'a DoWhileStatement<'a>, labels: Vec<&'a str>) -> R<()> { + let top = self.here(); + self.push_loop(labels, None); + self.stmt(&w.body)?; + let cont = self.here(); + let breaks = self.pop_loop_continues(cont); + self.expr(&w.test)?; + self.emit(Op::JumpIfTrue(top)); + for b in breaks { + self.patch(b); + } + Ok(()) + } + + fn for_loop(&mut self, f: &'a ForStatement<'a>, labels: Vec<&'a str>) -> R<()> { + let syms = match f.scope_id.get() { + Some(scope) => self.declare_scope(scope), + None => Vec::new(), + }; + self.init_scope(&syms); + match &f.init { + Some(ForStatementInit::VariableDeclaration(d)) => self.var_decl(d)?, + Some(other) => { + if let Some(e) = other.as_expression() { + self.expr(e)?; + self.emit(Op::Pop); + } + } + None => {} + } + let per_iteration: Vec = syms + .iter() + .filter_map(|s| match self.syms.get(s) { + Some(SymInfo { + store: Store::Cell(c), + depth, + .. + }) if *depth == self.depth() => Some(*c), + _ => None, + }) + .collect(); + // The first iteration gets its own copy too, so closures made by the initializer keep the initial binding. + for c in &per_iteration { + self.emit(Op::GetCell(*c)); + self.emit(Op::NewCell(*c)); + self.emit(Op::SetCell(*c)); + } + let top = self.here(); + let exit = match &f.test { + Some(t) => { + self.expr(t)?; + Some(self.emit(Op::JumpIfFalse(0))) + } + None => None, + }; + self.push_loop(labels, None); + self.stmt(&f.body)?; + let cont = self.here(); + let breaks = self.pop_loop_continues(cont); + for c in &per_iteration { + self.emit(Op::GetCell(*c)); + self.emit(Op::NewCell(*c)); + self.emit(Op::SetCell(*c)); + } + if let Some(u) = &f.update { + self.expr_stmt(u)?; + } + self.emit(Op::Jump(top)); + if let Some(e) = exit { + self.patch(e); + } + for b in breaks { + self.patch(b); + } + Ok(()) + } + + /// Binds the loop variable of a `for...of`/`for...in` head from the value on the stack. + fn bind_for_left(&mut self, left: &'a ForStatementLeft<'a>, syms: &[SymbolId]) -> R<()> { + self.init_scope(syms); + match left { + ForStatementLeft::VariableDeclaration(d) => { + let Some(decl) = d.declarations.first() else { + return Ok(()); + }; + self.bind_pattern(&decl.id, BindMode::Init) + } + other => match other.as_assignment_target() { + Some(t) => self.assign_target(t), + None => Err(unsupported("This loop head", other.span())), + }, + } + } + + fn for_of(&mut self, f: &'a ForOfStatement<'a>, labels: Vec<&'a str>) -> R<()> { + if f.r#await { + return self.for_await(f, labels); + } + let syms = match f.scope_id.get() { + Some(scope) => self.declare_scope(scope), + None => Vec::new(), + }; + self.init_scope(&syms); + self.loop_head_expr(&f.right, &syms)?; + let slot = self.iter_slot(); + self.emit(Op::GetIter(slot, ITER_FOR_OF)); + let handler = self.emit(Op::PushFinally(0)); + let top = self.here(); + let exit = self.emit(Op::IterNext(slot, 0)); + self.push_loop(labels, Some((slot, false))); + self.bind_for_left(&f.left, &syms)?; + self.stmt(&f.body)?; + self.emit(Op::Jump(top)); + let breaks = self.pop_loop_continues(top); + self.patch(exit); + self.emit(Op::PopTry); + let end = self.emit(Op::Jump(0)); + self.patch(handler); + let exc = self.new_local(); + self.emit(Op::SetLocal(exc)); + self.emit(Op::IterCloseQuiet(slot)); + self.emit(Op::GetLocal(exc)); + self.emit(Op::Throw); + self.patch(end); + for b in breaks { + self.patch(b); + } + Ok(()) + } + + /// `for await`: each step awaits `next()` outside the body's handler, so a failed step does not close the + /// iterator, while a throw from the binding or body closes it and awaits `return()`. + fn for_await(&mut self, f: &'a ForOfStatement<'a>, labels: Vec<&'a str>) -> R<()> { + let syms = match f.scope_id.get() { + Some(scope) => self.declare_scope(scope), + None => Vec::new(), + }; + self.init_scope(&syms); + self.loop_head_expr(&f.right, &syms)?; + let slot = self.iter_slot(); + self.emit(Op::GetAsyncIter(slot, ITER_FOR_AWAIT)); + let top = self.here(); + self.emit(Op::Undef); + self.emit(Op::DelegateCall(slot, DELEGATE_ASYNC | DELEGATE_NO_ARG, 0)); + self.emit(Op::Await); + let exit = self.emit(Op::DelegateResult(0, REQ_NEXT)); + let handler = self.emit(Op::PushFinally(0)); + self.push_loop(labels, Some((slot, true))); + self.bind_for_left(&f.left, &syms)?; + self.stmt(&f.body)?; + let cont = self.here(); + self.emit(Op::PopTry); + self.emit(Op::Jump(top)); + let breaks = self.pop_loop_continues(cont); + self.patch(handler); + let exc = self.new_local(); + self.emit(Op::SetLocal(exc)); + let swallow = self.emit(Op::PushCatch(0)); + let skip = self.emit(Op::AsyncClose(slot, 0)); + self.emit(Op::Await); + self.emit(Op::Pop); + self.patch(skip); + self.emit(Op::PopTry); + let rethrow = self.emit(Op::Jump(0)); + self.patch(swallow); + self.emit(Op::Pop); + self.patch(rethrow); + self.emit(Op::GetLocal(exc)); + self.emit(Op::Throw); + self.patch(exit); + self.emit(Op::Pop); + for b in breaks { + self.patch(b); + } + Ok(()) + } + + /// The iterated expression of a `for...of`/`for...in` head, which sees the loop's own bindings in their TDZ + /// although it comes after them in the source. + fn loop_head_expr(&mut self, e: &'a Expression<'a>, syms: &[SymbolId]) -> R<()> { + let mut forced = Vec::new(); + for s in syms { + if let Some(info) = self.syms.get_mut(s) + && info.tdz + && !info.switch_scoped + { + info.switch_scoped = true; + forced.push(*s); + } + } + let r = self.expr(e); + for s in forced { + if let Some(info) = self.syms.get_mut(&s) { + info.switch_scoped = false; + } + } + r + } + + fn for_in(&mut self, f: &'a ForInStatement<'a>, labels: Vec<&'a str>) -> R<()> { + let syms = match f.scope_id.get() { + Some(scope) => self.declare_scope(scope), + None => Vec::new(), + }; + self.init_scope(&syms); + self.loop_head_expr(&f.right, &syms)?; + let slot = self.iter_slot(); + self.pos = f.right.span().start; + self.emit(Op::ForIn(slot)); + self.pos = f.span.start; + let top = self.here(); + let exit = self.emit(Op::IterNext(slot, 0)); + self.push_loop(labels, None); + self.bind_for_left(&f.left, &syms)?; + self.stmt(&f.body)?; + self.emit(Op::Jump(top)); + let breaks = self.pop_loop_continues(top); + self.patch(exit); + for b in breaks { + self.patch(b); + } + Ok(()) + } + + fn labeled(&mut self, l: &'a LabeledStatement<'a>) -> R<()> { + let mut labels = vec![l.label.name.as_str()]; + let mut body = &l.body; + while let Statement::LabeledStatement(inner) = body { + labels.push(inner.label.name.as_str()); + body = &inner.body; + } + self.pos = body.span().start; + match body { + Statement::WhileStatement(w) => self.while_loop(w, labels), + Statement::DoWhileStatement(w) => self.do_while(w, labels), + Statement::ForStatement(f) => self.for_loop(f, labels), + Statement::ForOfStatement(f) => self.for_of(f, labels), + Statement::ForInStatement(f) => self.for_in(f, labels), + Statement::SwitchStatement(s) => self.switch(s, labels), + other => { + for label in &labels { + self.f().controls.push(Control::Label { + label, + breaks: Vec::new(), + }); + } + self.stmt(other)?; + for _ in &labels { + if let Some(Control::Label { breaks, .. }) = self.f().controls.pop() { + for b in breaks { + self.patch(b); + } + } + } + Ok(()) + } + } + } + + fn switch(&mut self, s: &'a SwitchStatement<'a>, labels: Vec<&'a str>) -> R<()> { + self.expr(&s.discriminant)?; + let tmp = self.new_local(); + self.emit(Op::SetLocal(tmp)); + let syms = match s.scope_id.get() { + Some(scope) => { + self.switch_scopes.insert(scope); + self.declare_scope(scope) + } + None => Vec::new(), + }; + self.init_scope(&syms); + for case in &s.cases { + self.hoist_functions(&case.consequent)?; + } + let mut jumps = Vec::new(); + for case in &s.cases { + if let Some(t) = &case.test { + self.emit(Op::GetLocal(tmp)); + self.expr(t)?; + self.emit(Op::StrictEq); + jumps.push(Some(self.emit(Op::JumpIfTrue(0)))); + } else { + jumps.push(None); + } + } + let to_default = self.emit(Op::Jump(0)); + self.f().controls.push(Control::Switch { + labels, + breaks: Vec::new(), + }); + let mut default_at = None; + for (case, j) in s.cases.iter().zip(jumps) { + match j { + Some(j) => self.patch(j), + None => default_at = Some(self.here()), + } + self.stmts(&case.consequent)?; + } + let Some(Control::Switch { breaks, .. }) = self.f().controls.pop() else { + return Ok(()); + }; + match default_at { + Some(d) => self.f().code[to_default] = Op::Jump(d), + None => self.patch(to_default), + } + for b in breaks { + self.patch(b); + } + Ok(()) + } + + fn try_stmt(&mut self, t: &'a TryStatement<'a>) -> R<()> { + let fin = if let Some(fb) = &t.finalizer { + let h = self.emit(Op::PushFinally(0)); + self.f().controls.push(Control::Finally { body: fb }); + Some((h, fb)) + } else { + None + }; + match &t.handler { + Some(h) => { + let catch_at = self.emit(Op::PushCatch(0)); + self.f().controls.push(Control::Try); + self.block(&t.block)?; + self.f().controls.pop(); + self.emit(Op::PopTry); + let after = self.emit(Op::Jump(0)); + self.patch(catch_at); + let mut syms = match h.scope_id.get() { + Some(scope) => self.declare_scope(scope), + None => Vec::new(), + }; + if let Some(scope) = h.body.scope_id.get() { + syms.extend(self.declare_scope(scope)); + } + self.init_scope(&syms); + for s in &syms { + if self + .scoping + .symbol_flags(*s) + .contains(SymbolFlags::CatchVariable) + && let Some(SymInfo { + store: Store::Cell(c), + .. + }) = self.syms.get(s) + { + let c = *c; + self.emit(Op::NewCell(c)); + } + } + match &h.param { + Some(p) => self.bind_pattern(&p.pattern, BindMode::Init)?, + None => { + self.emit(Op::Pop); + } + } + self.block(&h.body)?; + self.patch(after); + } + None => self.block(&t.block)?, + } + if let Some((h, fb)) = fin { + self.f().controls.pop(); + self.emit(Op::PopTry); + self.block(fb)?; + let end = self.emit(Op::Jump(0)); + self.patch(h); + let exc = self.new_local(); + self.emit(Op::SetLocal(exc)); + self.block(fb)?; + self.emit(Op::GetLocal(exc)); + self.emit(Op::Throw); + self.patch(end); + } + Ok(()) + } + + // ---------- patterns ---------- + + /// Binds a declaration pattern from the value on the stack, consuming it. + fn bind_pattern(&mut self, p: &'a BindingPattern<'a>, mode: BindMode) -> R<()> { + match p { + BindingPattern::BindingIdentifier(id) => match id.symbol_id.get() { + Some(s) => self.store_symbol(s, mode, id.span.start), + None => { + self.emit(Op::Pop); + Ok(()) + } + }, + BindingPattern::AssignmentPattern(a) => { + let j = self.emit(Op::JumpIfNotUndef(0)); + self.emit(Op::Pop); + self.expr_named(&a.right, pattern_name(&a.left))?; + self.patch(j); + self.bind_pattern(&a.left, mode) + } + BindingPattern::ObjectPattern(o) => { + let saved = self.pos; + self.pos = o.span.start; + self.emit(Op::RequireCoercible); + let mut saved_keys = Vec::new(); + for prop in &o.properties { + self.pos = prop.span.start; + self.emit(Op::Dup); + let k = + self.destruct_key(&prop.key, prop.computed, prop.span, o.rest.is_some())?; + saved_keys.push(k); + self.bind_pattern(&prop.value, mode)?; + } + let r = match &o.rest { + Some(rest) => { + self.pos = rest.span.start; + self.push_keys(&saved_keys); + self.emit(Op::ObjRest(saved_keys.len() as u32)); + self.bind_pattern(&rest.argument, mode) + } + None => { + self.emit(Op::Pop); + Ok(()) + } + }; + self.pos = saved; + r + } + BindingPattern::ArrayPattern(a) => { + let saved = self.pos; + self.pos = a.span.start; + let slot = self.iter_slot(); + self.emit(Op::GetIter(slot, ITER_DESTRUCTURE)); + let guard = self.emit(Op::PushFinally(0)); + self.f().controls.push(Control::Iter(slot)); + for el in &a.elements { + self.pos = el.as_ref().map_or(a.span.start, |p| p.span().start); + self.emit(Op::IterStep(slot)); + match el { + Some(p) => self.bind_pattern(p, mode)?, + None => { + self.emit(Op::Pop); + } + } + } + if let Some(rest) = &a.rest { + self.pos = rest.span.start; + self.emit(Op::IterRest(slot)); + self.bind_pattern(&rest.argument, mode)?; + } + self.pos = a.span.start; + self.close_iter_guard(guard, slot); + self.pos = saved; + Ok(()) + } + } + } + + /// Reads a destructuring pattern property's key from the object on the stack, at the property, as the + /// reference's `GET_PROP`/`GET_ELEM` in destructuring mode do. A computed key is made a key at its expression + /// first, and kept in a local when `keep` (an object rest excludes it). + fn destruct_key( + &mut self, + key: &'a PropertyKey<'a>, + computed: bool, + span: Span, + keep: bool, + ) -> R { + if let Some(k) = static_key(key, computed) { + let a = self.atom(&k); + self.emit(Op::DestructProp(a)); + return Ok(KeyRef::Static(k)); + } + let Some(e) = key.as_expression() else { + return Err(unsupported("Private names", span)); + }; + self.expr(e)?; + self.pos = e.span().start; + self.emit(Op::ToKey); + self.pos = span.start; + let k = if keep { + let t = self.new_local(); + self.emit(Op::Dup); + self.emit(Op::SetLocal(t)); + KeyRef::Local(t) + } else { + KeyRef::Static(String::new()) + }; + self.emit(Op::DestructElem); + Ok(k) + } + + /// Ends array destructuring guarded by the `PushFinally` at `guard`: closes the iterator, and on an abrupt + /// completion closes it quietly and rethrows. + fn close_iter_guard(&mut self, guard: usize, slot: u32) { + self.f().controls.pop(); + self.emit(Op::PopTry); + self.emit(Op::IterClose(slot)); + let end = self.emit(Op::Jump(0)); + self.patch(guard); + let exc = self.new_local(); + self.emit(Op::SetLocal(exc)); + self.emit(Op::IterCloseQuiet(slot)); + self.emit(Op::GetLocal(exc)); + self.emit(Op::Throw); + self.patch(end); + } + + fn push_keys(&mut self, keys: &[KeyRef]) { + for k in keys { + match k { + KeyRef::Static(s) => self.push_str(s), + KeyRef::Local(l) => { + self.emit(Op::GetLocal(*l)); + } + } + } + } + + /// Assigns the value on the stack to an assignment target, consuming it. + fn assign_target(&mut self, t: &'a AssignmentTarget<'a>) -> R<()> { + match t { + AssignmentTarget::ArrayAssignmentTarget(a) => { + let saved = self.pos; + self.pos = a.span.start; + let slot = self.iter_slot(); + self.emit(Op::GetIter(slot, ITER_DESTRUCTURE)); + let guard = self.emit(Op::PushFinally(0)); + self.f().controls.push(Control::Iter(slot)); + for el in &a.elements { + self.pos = el.as_ref().map_or(a.span.start, |m| m.span().start); + self.emit(Op::IterStep(slot)); + match el { + Some(m) => self.assign_maybe_default(m)?, + None => { + self.emit(Op::Pop); + } + } + } + if let Some(rest) = &a.rest { + self.pos = rest.span.start; + self.emit(Op::IterRest(slot)); + self.assign_target(&rest.target)?; + } + self.pos = a.span.start; + self.close_iter_guard(guard, slot); + self.pos = saved; + Ok(()) + } + AssignmentTarget::ObjectAssignmentTarget(o) => { + let saved = self.pos; + self.pos = o.span.start; + self.emit(Op::RequireCoercible); + let mut saved_keys = Vec::new(); + for prop in &o.properties { + self.pos = prop.span().start; + self.emit(Op::Dup); + match prop { + AssignmentTargetProperty::AssignmentTargetPropertyIdentifier(p) => { + let name = p.binding.name.as_str(); + let a = self.atom(name); + self.emit(Op::DestructProp(a)); + saved_keys.push(KeyRef::Static(name.to_owned())); + if let Some(init) = &p.init { + let j = self.emit(Op::JumpIfNotUndef(0)); + self.emit(Op::Pop); + self.expr_named(init, Some(name))?; + self.patch(j); + } + self.pos = p.binding.span.start; + self.store_ident(&p.binding)?; + } + AssignmentTargetProperty::AssignmentTargetPropertyProperty(p) => { + let k = + self.destruct_key(&p.name, p.computed, p.span, o.rest.is_some())?; + saved_keys.push(k); + self.assign_maybe_default(&p.binding)?; + } + } + } + let r = match &o.rest { + Some(rest) => { + self.pos = rest.span.start; + self.push_keys(&saved_keys); + self.emit(Op::ObjRest(saved_keys.len() as u32)); + self.assign_target(&rest.target) + } + None => { + self.emit(Op::Pop); + Ok(()) + } + }; + self.pos = saved; + r + } + other => match other.as_simple_assignment_target() { + Some(s) => { + let saved = self.pos; + self.pos = s.span().start; + let r = self.assign_simple(s); + self.pos = saved; + r + } + None => Err(unsupported("This assignment target", other.span())), + }, + } + } + + fn assign_maybe_default(&mut self, m: &'a AssignmentTargetMaybeDefault<'a>) -> R<()> { + match m { + AssignmentTargetMaybeDefault::AssignmentTargetWithDefault(d) => { + let j = self.emit(Op::JumpIfNotUndef(0)); + self.emit(Op::Pop); + self.expr(&d.init)?; + self.patch(j); + self.assign_target(&d.binding) + } + other => match other.as_assignment_target() { + Some(t) => self.assign_target(t), + None => Err(unsupported("This assignment target", other.span())), + }, + } + } + + fn assign_simple(&mut self, s: &'a SimpleAssignmentTarget<'a>) -> R<()> { + if let Some(m) = Self::super_member(s.as_member_expression()) { + return self.super_target(m.object().span()); + } + match s { + SimpleAssignmentTarget::AssignmentTargetIdentifier(id) => self.store_ident(id), + SimpleAssignmentTarget::StaticMemberExpression(m) => { + self.expr(&m.object)?; + self.emit(Op::Swap); + let a = self.atom(m.property.name.as_str()); + self.emit_member(Op::SetProp(a), &m.object, None); + self.emit(Op::Pop); + Ok(()) + } + SimpleAssignmentTarget::ComputedMemberExpression(m) => { + self.expr(&m.object)?; + self.expr(&m.expression)?; + self.emit_member(Op::WriteKey, &m.object, Some(&m.expression)); + self.emit(Op::Rot3Back); + self.emit_member(Op::SetElem, &m.object, Some(&m.expression)); + self.emit(Op::Pop); + Ok(()) + } + other => Err(unsupported("This assignment target", other.span())), + } + } + + // ---------- expressions ---------- + + fn expr_named(&mut self, e: &'a Expression<'a>, name: Option<&str>) -> R<()> { + match e { + Expression::ClassExpression(c) if c.id.is_none() => { + self.pos = c.span.start; + self.compile_class(c, name) + } + Expression::ArrowFunctionExpression(a) => { + self.pos = a.span.start; + self.closure_for_arrow(a, name) + } + Expression::FunctionExpression(f) if f.id.is_none() => { + self.pos = f.span.start; + self.closure_for_function(f, name) + } + _ => self.expr(e), + } + } + + fn expr(&mut self, e: &'a Expression<'a>) -> R<()> { + let saved = self.pos; + self.pos = e.span().start; + let r = self.expr_inner(e); + self.pos = saved; + r + } + + fn expr_inner(&mut self, e: &'a Expression<'a>) -> R<()> { + match e { + Expression::BooleanLiteral(b) => { + self.emit(if b.value { Op::True } else { Op::False }); + } + Expression::NullLiteral(_) => { + self.emit(Op::Null); + } + Expression::NumericLiteral(n) => self.push_num(n.value), + Expression::StringLiteral(s) => { + let text = js_str(&s.value); + self.push_str(&text); + } + Expression::TemplateLiteral(t) => self.template(t)?, + Expression::Identifier(id) => self.load_ident(id)?, + Expression::ThisExpression(_) => self.emit_this()?, + Expression::ArrayExpression(a) => self.array_lit(a)?, + Expression::ObjectExpression(o) => self.object_lit(o)?, + Expression::ArrowFunctionExpression(a) => self.closure_for_arrow(a, None)?, + Expression::FunctionExpression(f) => self.closure_for_function(f, None)?, + Expression::UnaryExpression(u) => self.unary(u)?, + Expression::BinaryExpression(b) => { + self.expr(&b.left)?; + self.expr(&b.right)?; + self.emit(binary_op(b.operator)); + } + Expression::LogicalExpression(l) => { + self.expr(&l.left)?; + let j = self.emit(match l.operator { + LogicalOperator::And => Op::JumpIfFalseKeep(0), + LogicalOperator::Or => Op::JumpIfTrueKeep(0), + LogicalOperator::Coalesce => Op::JumpIfNotNullishKeep(0), + }); + self.expr(&l.right)?; + self.patch(j); + } + Expression::ConditionalExpression(c) => { + self.expr(&c.test)?; + let j = self.emit(Op::JumpIfFalse(0)); + self.expr(&c.consequent)?; + let end = self.emit(Op::Jump(0)); + self.patch(j); + self.expr(&c.alternate)?; + self.patch(end); + } + Expression::AssignmentExpression(a) => self.assignment(a)?, + Expression::UpdateExpression(u) => self.update(u)?, + Expression::SequenceExpression(s) => { + let n = s.expressions.len(); + for (i, x) in s.expressions.iter().enumerate() { + self.expr(x)?; + if i + 1 < n { + self.emit(Op::Pop); + } + } + } + Expression::ParenthesizedExpression(p) => self.expr(&p.expression)?, + Expression::CallExpression(c) => self.call(c)?, + Expression::NewExpression(n) => { + self.expr(&n.callee)?; + self.emit(Op::Undef); + let argc = self.args(&n.arguments)?; + self.pos = n.span.start; + let at = match argc { + Some(argc) => self.emit(Op::New(argc)), + None => self.emit(Op::NewSpread), + }; + self.name_callee(at, &n.callee); + } + Expression::StaticMemberExpression(m) if matches!(m.object, Expression::Super(_)) => { + if let Some(m) = e.as_member_expression() { + self.super_get(m, false)?; + } + } + Expression::ComputedMemberExpression(m) if matches!(m.object, Expression::Super(_)) => { + if let Some(m) = e.as_member_expression() { + self.super_get(m, false)?; + } + } + Expression::StaticMemberExpression(m) => { + self.expr(&m.object)?; + if m.optional { + self.opt_chain(); + } + let a = self.atom(m.property.name.as_str()); + self.emit_member(Op::GetProp(a), &m.object, None); + } + Expression::ComputedMemberExpression(m) => { + self.expr(&m.object)?; + if m.optional { + self.opt_chain(); + } + self.elem_key(&m.object, &m.expression)?; + } + Expression::ChainExpression(c) => { + self.chains.push(Vec::new()); + match &c.expression { + ChainElement::CallExpression(call) => self.call(call)?, + other => match other.as_member_expression() { + Some(m) => self.expr(m_as_expr(m))?, + None => return Err(unsupported("TypeScript syntax", other.span())), + }, + } + let patches = self.chains.pop().unwrap_or_default(); + for p in patches { + self.patch(p); + } + } + Expression::AwaitExpression(a) => { + self.expr(&a.argument)?; + self.emit(Op::Await); + } + Expression::YieldExpression(y) => self.yield_expr(y, false)?, + Expression::ClassExpression(c) => self.compile_class(c, None)?, + Expression::RegExpLiteral(r) => { + let pattern = r.regex.pattern.text.as_str(); + let flags = r.regex.flags.to_string(); + if let Err(message) = crate::builtins::regexp::validate_literal(pattern, &flags) { + let prefix = format!("Invalid regular expression: /{pattern}/{flags}: "); + let reason = match message.strip_prefix(&prefix) { + Some(reason) => format!( + "Invalid regular expression: /{pattern}/: {}", + acorn_regex_reason(reason) + ), + None => "Invalid regular expression flag".to_owned(), + }; + // Acorn locates a literal's errors just after its opening slash. + return Err(CompileError { + kind: DiagnosticKind::ParseError, + message: parse_message(&reason), + offset: Some(r.span.start + 1), + }); + } + self.push_str(pattern); + self.push_str(&flags); + self.emit(Op::RegExp); + } + Expression::BigIntLiteral(_) => { + let msg = self.str_const("BigInt literals are not supported."); + self.emit(Op::ThrowType(msg)); + } + Expression::TaggedTemplateExpression(t) => self.tagged_template(t)?, + Expression::Super(s) => self.throw_syntax("Super", s.span)?, + Expression::ImportExpression(i) => match &i.options { + // The options are evaluated, after the specifier's string, and ignored. + Some(options) => self.import_call( + i.span.start, + |c| { + c.expr(&i.source)?; + c.emit_at(i.source.span().start, Op::ToStr); + c.expr(options)?; + c.emit(Op::Pop); + Ok(()) + }, + 4, + None, + )?, + None => self.import_call(i.span.start, |c| c.expr(&i.source), 4, None)?, + }, + Expression::ImportMeta(m) => self.throw_syntax("MetaProperty", m.span)?, + Expression::NewTarget(m) => self.throw_syntax("MetaProperty", m.span)?, + Expression::PrivateFieldExpression(p) => { + return Err(unsupported("Private fields", p.span)); + } + Expression::PrivateInExpression(p) => { + return Err(unsupported("Private fields", p.span)); + } + other => return Err(unsupported("This syntax", other.span())), + } + Ok(()) + } + + fn opt_chain(&mut self) { + let j = self.emit(Op::OptChain(0)); + if let Some(c) = self.chains.last_mut() { + c.push(j); + } + } + + fn elem_key(&mut self, object: &'a Expression<'a>, key: &'a Expression<'a>) -> R<()> { + if let Expression::StringLiteral(s) = key { + let a = self.atom(&js_str(&s.value)); + if self.atoms.index(a).is_none() { + self.emit_member(Op::GetProp(a), object, Some(key)); + return Ok(()); + } + } + self.expr(key)?; + self.emit_member(Op::GetElem, object, Some(key)); + Ok(()) + } + + fn template(&mut self, t: &'a TemplateLiteral<'a>) -> R<()> { + let mut parts = 0u32; + for (i, q) in t.quasis.iter().enumerate() { + let cooked = + q.value.cooked.as_ref().map(js_str).unwrap_or_else(|| { + crate::strings::external_text(q.value.raw.as_str().to_owned()) + }); + if !cooked.is_empty() || (t.expressions.is_empty() && i == 0) { + self.push_str(&cooked); + parts += 1; + } + if let Some(e) = t.expressions.get(i) { + self.expr(e)?; + self.emit_at(e.without_parentheses().span().start, Op::ToStr); + parts += 1; + } + } + if parts != 1 { + self.emit(Op::Concat(parts)); + } + Ok(()) + } + + /// `tag\`...\``: calls the tag, read like a callee, with the site's strings array and the substitutions. + fn tagged_template(&mut self, t: &'a TaggedTemplateExpression<'a>) -> R<()> { + match &t.tag { + Expression::StaticMemberExpression(m) => { + self.expr(&m.object)?; + let a = self.atom(m.property.name.as_str()); + self.emit_member(Op::GetMethod(a), &m.object, None); + } + Expression::ComputedMemberExpression(m) => { + self.expr(&m.object)?; + self.emit(Op::Dup); + self.elem_key(&m.object, &m.expression)?; + self.emit(Op::Swap); + } + tag => { + self.expr(tag)?; + self.emit(Op::Undef); + } + } + let quasis = &t.quasi.quasis; + let cooked = quasis + .iter() + .map(|q| { + q.value.cooked.as_ref().map(|c| { + let i = self.str_const(&js_str(c)); + self.consts[i as usize] + }) + }) + .collect(); + let raw = quasis + .iter() + .map(|q| { + let i = self.str_const(&crate::strings::external_text( + q.value.raw.as_str().to_owned(), + )); + self.consts[i as usize] + }) + .collect(); + self.templates.push(TemplateSite { cooked, raw }); + self.emit(Op::Template(self.templates.len() as u32 - 1)); + for e in &t.quasi.expressions { + self.expr(e)?; + } + self.pos = t.span.start; + self.emit(Op::Call(1 + t.quasi.expressions.len() as u32)); + Ok(()) + } + + fn array_lit(&mut self, a: &'a ArrayExpression<'a>) -> R<()> { + let simple = a.elements.iter().all(|e| e.as_expression().is_some()); + if simple { + for el in &a.elements { + if let Some(e) = el.as_expression() { + self.expr(e)?; + } + } + self.emit(Op::NewArray(a.elements.len() as u32)); + return Ok(()); + } + self.emit(Op::NewArray(0)); + for el in &a.elements { + match el { + ArrayExpressionElement::SpreadElement(s) => { + self.expr(&s.argument)?; + self.pos = s.span.start; + self.emit(Op::ArraySpread); + } + ArrayExpressionElement::Elision(_) => { + // The TDZ marker is how an array holds a hole. + self.emit(Op::Uninit); + self.emit(Op::ArrayPush); + } + other => { + if let Some(e) = other.as_expression() { + self.expr(e)?; + self.emit(Op::ArrayPush); + } + } + } + } + Ok(()) + } + + fn object_lit(&mut self, o: &'a ObjectExpression<'a>) -> R<()> { + self.emit(Op::NewObject); + for p in &o.properties { + match p { + ObjectPropertyKind::SpreadProperty(s) => { + self.expr(&s.argument)?; + self.pos = s.span.start; + self.emit(Op::ObjectSpread); + } + ObjectPropertyKind::ObjectProperty(p) => { + if p.kind != PropertyKind::Init { + let setter = p.kind == PropertyKind::Set; + self.pos = p.span.start; + match static_key(&p.key, p.computed) { + Some(k) => { + let name = format!("{} {k}", if setter { "set" } else { "get" }); + self.object_method(&p.value, &name)?; + self.set_home(1); + let a = self.atom(&k); + self.pos = p.span.start; + self.emit(Op::DefineAccessor(a, setter)); + } + None => { + let Some(e) = p.key.as_expression() else { + return Err(unsupported("Private names", p.span)); + }; + self.expr(e)?; + self.emit_at(e.without_parentheses().span().start, Op::ToKey); + self.object_method(&p.value, "")?; + self.set_home(2); + self.pos = p.span.start; + self.emit(Op::DefineAccessorElem(setter)); + } + } + continue; + } + self.pos = p.span.start; + match static_key(&p.key, p.computed) { + Some(k) => { + if p.method { + self.object_method(&p.value, &k)?; + self.set_home(1); + } else { + self.expr_named(&p.value, Some(&k))?; + } + let a = self.atom(&k); + self.pos = p.span.start; + self.emit(Op::DefineField(a)); + } + None => { + let Some(e) = p.key.as_expression() else { + return Err(unsupported("Private names", p.span)); + }; + self.expr(e)?; + self.emit_at(e.without_parentheses().span().start, Op::ToKey); + if p.method { + self.object_method(&p.value, "")?; + } else { + self.expr(&p.value)?; + } + // A computed key names an anonymous function when the literal runs. + if is_anonymous_fn(&p.value) { + self.emit_at(p.value.span().start, Op::NameByKey(0)); + } + if p.method { + self.set_home(2); + } + self.pos = p.span.start; + self.emit(Op::DefineElem); + } + } + } + } + } + Ok(()) + } + + /// Pushes call arguments; returns the count, or `None` after building one array for spread arguments. + fn args(&mut self, args: &'a [Argument<'a>]) -> R> { + if args.iter().all(|a| a.as_expression().is_some()) { + for a in args { + if let Some(e) = a.as_expression() { + self.expr(e)?; + } + } + return Ok(Some(args.len() as u32)); + } + self.emit(Op::NewArray(0)); + for a in args { + match a { + Argument::SpreadElement(s) => { + self.expr(&s.argument)?; + self.pos = s.span.start; + self.emit(Op::ArraySpread); + } + other => { + if let Some(e) = other.as_expression() { + self.expr(e)?; + self.emit(Op::ArrayPush); + } + } + } + } + Ok(None) + } + + /// `delete`: a member expression deletes, optionally; an identifier fails when it runs, as in the reference; + /// anything else is evaluated and gives true. + fn delete(&mut self, argument: &'a Expression<'a>) -> R<()> { + let argument = argument.without_parentheses(); + if let Expression::Identifier(id) = argument { + let msg = self.str_const("Only data fields may be deleted."); + self.pos = id.span.start; + self.emit(Op::ThrowType(msg)); + return Ok(()); + } + let member = match argument { + Expression::ChainExpression(c) => c.expression.as_member_expression(), + other => other.as_member_expression(), + }; + let Some(member) = member else { + self.expr(argument)?; + self.emit(Op::Pop); + self.emit(Op::True); + return Ok(()); + }; + if let Some(m) = Self::super_member(Some(member)) { + return self.super_delete(m); + } + self.chains.push(Vec::new()); + match member { + MemberExpression::StaticMemberExpression(m) => { + self.expr(&m.object)?; + if m.optional { + self.opt_chain(); + } + let a = self.atom(m.property.name.as_str()); + self.pos = m.span.start; + self.emit_member(Op::DelProp(a), &m.object, None); + } + MemberExpression::ComputedMemberExpression(m) => { + self.expr(&m.object)?; + if m.optional { + self.opt_chain(); + } + self.expr(&m.expression)?; + self.pos = m.span.start; + self.emit_member(Op::DelElem, &m.object, Some(&m.expression)); + } + MemberExpression::PrivateFieldExpression(p) => { + return Err(unsupported("Private fields", p.span)); + } + } + // A short-circuited chain deletes nothing and gives true. + let patches = self.chains.pop().unwrap_or_default(); + if !patches.is_empty() { + let end = self.emit(Op::Jump(0)); + for p in patches { + self.patch(p); + } + self.emit(Op::Pop); + self.emit(Op::True); + self.patch(end); + } + Ok(()) + } + + fn call(&mut self, c: &'a CallExpression<'a>) -> R<()> { + match &c.callee { + callee if Self::super_member(callee.as_member_expression()).is_some() => { + if let Some(m) = callee.as_member_expression() { + self.super_get(m, true)?; + } + } + Expression::StaticMemberExpression(m) => { + self.expr(&m.object)?; + if m.optional { + self.opt_chain(); + } + let a = self.atom(m.property.name.as_str()); + self.emit_member(Op::GetMethod(a), &m.object, None); + } + Expression::ComputedMemberExpression(m) => { + self.expr(&m.object)?; + if m.optional { + self.opt_chain(); + } + self.emit(Op::Dup); + self.elem_key(&m.object, &m.expression)?; + self.emit(Op::Swap); + } + Expression::Super(_) => return self.super_call(c), + callee => { + self.expr(callee)?; + self.emit(Op::Undef); + } + } + if c.optional { + let j = self.emit(Op::OptCall(0)); + if let Some(ch) = self.chains.last_mut() { + ch.push(j); + } + } + self.pos = c.span.start; + let argc = self.args(&c.arguments)?; + self.pos = c.span.start; + let at = match argc { + Some(argc) => self.emit(Op::Call(argc)), + None => self.emit(Op::CallSpread), + }; + self.name_callee(at, &c.callee); + // A callee that isn't a function fails at the callee, which the reference's node has without parentheses. + let callee = c.callee.without_parentheses().span().start; + if callee != self.pos { + self.f().sites.push((at as u32, [callee, callee])); + } + Ok(()) + } + + /// Notes how the call or `new` at `at` names its callee in errors, when it can be named. + fn name_callee(&mut self, at: usize, callee: &Expression) { + if let Some(name) = callee_name(callee, &|n| self.real_name(n)) { + self.f().callees.push((at as u32, name.into())); + } + } + + fn unary(&mut self, u: &'a UnaryExpression<'a>) -> R<()> { + match u.operator { + UnaryOperator::Typeof => { + if let Expression::Identifier(id) = &u.argument + && self.ident_symbol(id).is_none() + && id.name.as_str() != "undefined" + && id.name.as_str() != "arguments" + { + let g = self.global_slot(id.name.as_str()); + self.emit(Op::TypeofGlobal(g)); + return Ok(()); + } + self.expr(&u.argument)?; + self.emit(Op::Typeof); + } + UnaryOperator::Delete => self.delete(&u.argument)?, + UnaryOperator::Void => { + self.expr(&u.argument)?; + self.emit(Op::Pop); + self.emit(Op::Undef); + } + op => { + if let (UnaryOperator::UnaryNegation, Expression::NumericLiteral(n)) = + (op, &u.argument) + { + self.push_num(-n.value); + return Ok(()); + } + self.expr(&u.argument)?; + self.emit(match op { + UnaryOperator::UnaryPlus => Op::ToNumber, + UnaryOperator::UnaryNegation => Op::Neg, + UnaryOperator::LogicalNot => Op::Not, + _ => Op::BitNot, + }); + } + } + Ok(()) + } + + fn assignment(&mut self, a: &'a AssignmentExpression<'a>) -> R<()> { + if let Some(m) = Self::super_member(a.left.as_member_expression()) { + return self.super_assign(m, a); + } + let op = a.operator; + if op == AssignmentOperator::Assign { + match &a.left { + AssignmentTarget::AssignmentTargetIdentifier(id) => { + self.expr_named(&a.right, Some(id.name.as_str()))?; + self.emit(Op::Dup); + return self.store_ident(id); + } + AssignmentTarget::StaticMemberExpression(m) => { + self.expr(&m.object)?; + self.expr(&a.right)?; + let at = self.atom(m.property.name.as_str()); + self.emit_member(Op::SetProp(at), &m.object, None); + return Ok(()); + } + AssignmentTarget::ComputedMemberExpression(m) => { + self.expr(&m.object)?; + self.expr(&m.expression)?; + self.emit_member(Op::WriteKey, &m.object, Some(&m.expression)); + self.expr(&a.right)?; + self.emit_member(Op::SetElem, &m.object, Some(&m.expression)); + return Ok(()); + } + AssignmentTarget::ArrayAssignmentTarget(_) + | AssignmentTarget::ObjectAssignmentTarget(_) => { + self.expr(&a.right)?; + self.emit(Op::Dup); + return self.assign_target(&a.left); + } + other => return Err(unsupported("This assignment target", other.span())), + } + } + let logical = match op { + AssignmentOperator::LogicalAnd => Some(Op::JumpIfFalseKeep(0)), + AssignmentOperator::LogicalOr => Some(Op::JumpIfTrueKeep(0)), + AssignmentOperator::LogicalNullish => Some(Op::JumpIfNotNullishKeep(0)), + _ => None, + }; + match &a.left { + AssignmentTarget::AssignmentTargetIdentifier(id) => { + if let Some(jop) = logical { + self.load_ident(id)?; + let j = self.emit(jop); + self.expr_named(&a.right, Some(id.name.as_str()))?; + self.emit(Op::Dup); + self.store_ident(id)?; + self.patch(j); + return Ok(()); + } + self.load_ident(id)?; + self.expr(&a.right)?; + self.emit(compound_op(op)); + self.emit(Op::Dup); + self.store_ident(id) + } + AssignmentTarget::StaticMemberExpression(m) => { + let at = self.atom(m.property.name.as_str()); + self.expr(&m.object)?; + self.emit(Op::Dup); + self.emit_member(Op::GetPropW(at), &m.object, None); + if let Some(jop) = logical { + let j = self.emit(jop); + self.expr(&a.right)?; + self.emit_member(Op::SetProp(at), &m.object, None); + let end = self.emit(Op::Jump(0)); + self.patch(j); + self.emit(Op::Swap); + self.emit(Op::Pop); + self.patch(end); + return Ok(()); + } + self.expr(&a.right)?; + self.emit(compound_op(op)); + self.emit_member(Op::SetProp(at), &m.object, None); + Ok(()) + } + AssignmentTarget::ComputedMemberExpression(m) => { + self.expr(&m.object)?; + self.expr(&m.expression)?; + self.emit_member(Op::WriteKey, &m.object, Some(&m.expression)); + self.emit(Op::Dup2); + self.emit_member(Op::GetElem, &m.object, Some(&m.expression)); + if let Some(jop) = logical { + let j = self.emit(jop); + self.expr(&a.right)?; + self.emit_member(Op::SetElem, &m.object, Some(&m.expression)); + let end = self.emit(Op::Jump(0)); + self.patch(j); + self.emit(Op::Rot3); + self.emit(Op::Pop); + self.emit(Op::Pop); + self.patch(end); + return Ok(()); + } + self.expr(&a.right)?; + self.emit(compound_op(op)); + self.emit_member(Op::SetElem, &m.object, Some(&m.expression)); + Ok(()) + } + other => Err(unsupported("This assignment target", other.span())), + } + } + + fn update(&mut self, u: &'a UpdateExpression<'a>) -> R<()> { + if let Some(m) = Self::super_member(u.argument.as_member_expression()) { + return self.super_update(m, u); + } + let step = if u.operator == UpdateOperator::Increment { + Op::Inc + } else { + Op::Dec + }; + match &u.argument { + SimpleAssignmentTarget::AssignmentTargetIdentifier(id) => { + self.load_ident(id)?; + if u.prefix { + self.emit(step); + self.emit(Op::Dup); + } else { + self.emit(Op::ToNumeric); + self.emit(Op::Dup); + self.emit(step); + } + self.store_ident(id) + } + SimpleAssignmentTarget::StaticMemberExpression(m) => { + let at = self.atom(m.property.name.as_str()); + self.expr(&m.object)?; + self.emit(Op::Dup); + self.emit_member(Op::GetPropW(at), &m.object, None); + if u.prefix { + self.emit(step); + self.emit_member(Op::SetProp(at), &m.object, None); + } else { + self.emit(Op::ToNumeric); + self.emit(Op::Dup); + self.emit(Op::Rot3); + self.emit(step); + self.emit_member(Op::SetProp(at), &m.object, None); + self.emit(Op::Pop); + } + Ok(()) + } + SimpleAssignmentTarget::ComputedMemberExpression(m) => { + self.expr(&m.object)?; + self.expr(&m.expression)?; + self.emit_member(Op::WriteKey, &m.object, Some(&m.expression)); + self.emit(Op::Dup2); + self.emit_member(Op::GetElem, &m.object, Some(&m.expression)); + if u.prefix { + self.emit(step); + self.emit_member(Op::SetElem, &m.object, Some(&m.expression)); + } else { + let t = self.new_local(); + self.emit(Op::ToNumeric); + self.emit(Op::Dup); + self.emit(Op::SetLocal(t)); + self.emit(step); + self.emit_member(Op::SetElem, &m.object, Some(&m.expression)); + self.emit(Op::Pop); + self.emit(Op::GetLocal(t)); + } + Ok(()) + } + other => Err(unsupported("This update target", other.span())), + } + } +} + +/// The `DelegateCall` flag for an async generator's `yield*`, whose results are awaited. +pub const DELEGATE_ASYNC: u8 = 4; +/// The `DelegateCall` flag for `for await`, which calls `next()` without an argument. +pub const DELEGATE_NO_ARG: u8 = 8; + +enum KeyRef { + Static(String), + Local(u32), +} + +enum FnBody<'a> { + Block(&'a FunctionBody<'a>), + Expr(&'a Expression<'a>), + /// A class without a constructor of its own: `constructor() {}`, or `constructor(...args) { super(...args) }`. + DefaultCtor(u32), + /// A class's field initializer: defines the fields on `this`, in order. + Fields(Vec<&'a PropertyDefinition<'a>>, u32), +} + +struct FnSpec<'a, 'n> { + name: &'n str, + params: Option<&'a FormalParameters<'a>>, + /// A class constructor (`CLASS_BASE`, `CLASS_DERIVED`) and whether its class has instance fields. + class: u8, + fields: bool, + method: bool, + body: FnBody<'a>, + scope: Option, + is_async: bool, + is_generator: bool, + is_arrow: bool, + self_sym: Option, +} + +impl<'a> FnState<'a> { + fn new(is_arrow: bool) -> Self { + FnState { + code: Vec::new(), + pos: Vec::new(), + nlocals: 0, + captures: Vec::new(), + upval_of: FxHashMap::default(), + args_store: None, + args_upval: None, + controls: Vec::new(), + is_arrow, + is_async: false, + is_generator: false, + needs_extra: false, + callees: Vec::new(), + sites: Vec::new(), + barrier: 0, + class: 0, + fields: false, + method: false, + this_store: None, + this_upval: None, + new_target: 0, + home: false, + } + } +} + +/// How the reference names a callee, like native engines: identifiers, member chains with plain keys, and calls of +/// those (`search(...).catch`). A chain with any other link has no name. +fn callee_name(e: &Expression, real: &dyn Fn(&str) -> &str) -> Option { + match e { + Expression::Identifier(id) => Some(real(id.name.as_str()).to_owned()), + Expression::CallExpression(c) => Some(format!("{}(...)", callee_name(&c.callee, real)?)), + Expression::StaticMemberExpression(m) => Some(format!( + "{}.{}", + callee_name(&m.object, real)?, + m.property.name + )), + Expression::ComputedMemberExpression(m) => match &m.expression { + Expression::StringLiteral(s) => Some(format!( + "{}.{}", + callee_name(&m.object, real)?, + js_str(&s.value) + )), + _ => None, + }, + _ => None, + } +} + +fn m_as_expr<'x, 'a>(m: &'x MemberExpression<'a>) -> &'x Expression<'a> { + m.as_expression() +} + +fn js_str(s: &oxc_str::JSStr) -> String { + match s.as_str() { + Some(t) => crate::strings::external_text(t.to_owned()), + None => crate::strings::from_units(&s.encode_utf16().collect::>()), + } +} + +fn static_key(key: &PropertyKey, computed: bool) -> Option { + match key { + PropertyKey::StaticIdentifier(id) if !computed => Some(id.name.as_str().to_owned()), + PropertyKey::StringLiteral(s) => Some(js_str(&s.value)), + PropertyKey::NumericLiteral(n) => Some(num_to_string(n.value)), + _ => None, + } +} + +fn pattern_name<'x>(p: &'x BindingPattern) -> Option<&'x str> { + match p { + BindingPattern::BindingIdentifier(id) => Some(id.name.as_str()), + _ => None, + } +} + +fn is_builtin_global(name: &str) -> bool { + crate::builtins::GLOBAL_NAMES.contains(&name) +} + +fn binary_op(op: BinaryOperator) -> Op { + match op { + BinaryOperator::Equality => Op::Eq, + BinaryOperator::Inequality => Op::Ne, + BinaryOperator::StrictEquality => Op::StrictEq, + BinaryOperator::StrictInequality => Op::StrictNe, + BinaryOperator::LessThan => Op::Lt, + BinaryOperator::LessEqualThan => Op::Le, + BinaryOperator::GreaterThan => Op::Gt, + BinaryOperator::GreaterEqualThan => Op::Ge, + BinaryOperator::Addition => Op::Add, + BinaryOperator::Subtraction => Op::Sub, + BinaryOperator::Multiplication => Op::Mul, + BinaryOperator::Division => Op::Div, + BinaryOperator::Remainder => Op::Mod, + BinaryOperator::Exponential => Op::Pow, + BinaryOperator::ShiftLeft => Op::Shl, + BinaryOperator::ShiftRight => Op::Shr, + BinaryOperator::ShiftRightZeroFill => Op::UShr, + BinaryOperator::BitwiseOR => Op::BitOr, + BinaryOperator::BitwiseXOR => Op::BitXor, + BinaryOperator::BitwiseAnd => Op::BitAnd, + BinaryOperator::In => Op::In, + BinaryOperator::Instanceof => Op::InstanceOf, + } +} + +fn compound_op(op: AssignmentOperator) -> Op { + match op { + AssignmentOperator::Addition => Op::Add, + AssignmentOperator::Subtraction => Op::Sub, + AssignmentOperator::Multiplication => Op::Mul, + AssignmentOperator::Division => Op::Div, + AssignmentOperator::Remainder => Op::Mod, + AssignmentOperator::Exponential => Op::Pow, + AssignmentOperator::ShiftLeft => Op::Shl, + AssignmentOperator::ShiftRight => Op::Shr, + AssignmentOperator::ShiftRightZeroFill => Op::UShr, + AssignmentOperator::BitwiseOR => Op::BitOr, + AssignmentOperator::BitwiseXOR => Op::BitXor, + AssignmentOperator::BitwiseAnd => Op::BitAnd, + _ => Op::Nop, + } +} + +// ---------- classes ---------- + +/// A class element the reference compiles: a method, an accessor or a field, with a plain or computed name. +fn supported_member(m: &ClassElement) -> bool { + let (key, computed) = match m { + ClassElement::MethodDefinition(d) => (&d.key, d.computed), + ClassElement::PropertyDefinition(d) => (&d.key, d.computed), + _ => return false, + }; + computed + || matches!( + key, + PropertyKey::StaticIdentifier(_) + | PropertyKey::StringLiteral(_) + | PropertyKey::NumericLiteral(_) + ) +} + +/// What an unsupported class element is called in the error (the reference's `classSyntaxName`). +fn class_syntax_name(m: &ClassElement) -> &'static str { + match m { + ClassElement::StaticBlock(_) => "StaticBlock", + ClassElement::MethodDefinition(d) => { + if matches!(d.key, PropertyKey::PrivateIdentifier(_)) { + "PrivateIdentifier" + } else if d.kind == MethodDefinitionKind::Get { + "Getter" + } else if d.kind == MethodDefinitionKind::Set { + "Setter" + } else if d.computed { + "ComputedClassMember" + } else if d.value.r#async { + "AsyncMethod" + } else { + "GeneratorMethod" + } + } + ClassElement::PropertyDefinition(d) => { + if matches!(d.key, PropertyKey::PrivateIdentifier(_)) { + "PrivateIdentifier" + } else if d.computed { + "ComputedClassMember" + } else { + "PropertyDefinition" + } + } + _ => "ClassHeritage", + } +} + +/// NamedEvaluation: whether `e` is an anonymous function or class definition, which takes the name it is given. +fn is_anonymous_fn(e: &Expression) -> bool { + match e { + Expression::ArrowFunctionExpression(_) => true, + Expression::FunctionExpression(f) => f.id.is_none(), + Expression::ClassExpression(c) => c.id.is_none(), + _ => false, + } +} + +impl<'a, 's> Compiler<'a, 's> { + /// Notes the class field initializers, whose references come from a function of their own. + fn find_field_values(&mut self, program: &oxc_ast::ast::Program) { + struct Fields(Vec); + impl<'a> Visit<'a> for Fields { + fn visit_property_definition(&mut self, it: &PropertyDefinition<'a>) { + if let Some(v) = &it.value { + self.0.push(v.span()); + } + walk::walk_property_definition(self, it); + } + } + let mut f = Fields(Vec::new()); + f.visit_program(program); + self.field_values = f.0; + } + + /// Whether a reference at `at` is in a field initializer that its declaration at `decl` is not in. + fn in_other_field(&self, at: u32, decl: u32) -> bool { + self.field_values + .iter() + .any(|v| v.start <= at && at < v.end && !(v.start <= decl && decl < v.end)) + } + + /// A binding the compiler makes, as a cell of the running function. + fn pseudo_binding(&mut self, name: &str, tdz: bool) -> (SymbolId, u32) { + let s = SymbolId::from_usize(self.scoping.symbols_len() + self.pseudo); + self.pseudo += 1; + let c = self.new_cell(); + let name = self.atom(name); + self.syms.insert( + s, + SymInfo { + depth: self.depth(), + store: Store::Cell(c), + tdz, + is_const: true, + decl_end: u32::MAX, + switch_scoped: false, + name, + }, + ); + (s, c) + } + + /// `this`: a derived constructor's binding (also from its arrows), checked for `super()`, or the frame's. + fn emit_this(&mut self) -> R<()> { + let Some(d) = self.fns.iter().rposition(|f| !f.is_arrow) else { + self.emit(Op::This); + return Ok(()); + }; + let Some(store) = self.fns[d].this_store else { + self.emit(Op::This); + return Ok(()); + }; + let name = self.atom("this"); + if d == self.depth() { + match store { + Store::Cell(c) => self.emit(Op::GetCellChk(c, name)), + Store::Local(l) => self.emit(Op::GetLocalChk(l, name)), + }; + return Ok(()); + } + let u = self.resolve_this_upval(self.depth())?; + self.emit(Op::GetUpvalChk(u, name)); + Ok(()) + } + + fn resolve_this_upval(&mut self, depth: usize) -> R { + if let Some(u) = self.fns[depth].this_upval { + return Ok(u); + } + let parent = depth - 1; + let cap = if self.fns[parent].is_arrow { + Capture::Upval(self.resolve_this_upval(parent)?) + } else { + match self.fns[parent].this_store { + Some(Store::Cell(c)) => Capture::Cell(c), + _ => { + return Err(CompileError { + kind: DiagnosticKind::ExecutionFailure, + message: "internal: a captured this has no cell".into(), + offset: Some(self.pos), + }); + } + } + }; + let f = &mut self.fns[depth]; + f.captures.push(cap); + let i = f.captures.len() as u32 - 1; + f.this_upval = Some(i); + Ok(i) + } + + /// Before a class constructor's `return`: `[v] -> [result]` by the return rules. + fn ctor_result(&mut self) { + let class = self.f().class; + if class == 0 { + return; + } + match self.f().this_store { + Some(Store::Cell(c)) => self.emit(Op::GetCell(c)), + Some(Store::Local(l)) => self.emit(Op::GetLocal(l)), + None => self.emit(Op::This), + }; + self.emit(Op::CtorReturn(class == CLASS_DERIVED)); + } + + fn class_declaration(&mut self, c: &'a Class<'a>) -> R<()> { + if c.body.body.iter().any(|m| !supported_member(m)) { + return self.compile_class(c, None); + } + self.compile_class(c, None)?; + match c.id.as_ref().and_then(|id| id.symbol_id.get()) { + Some(s) => self.store_symbol(s, BindMode::Init, c.span.start), + None => { + self.emit(Op::Pop); + Ok(()) + } + } + } + + /// A class definition, which leaves its constructor on the stack (see `classes.rs`). `name` is an anonymous + /// class's NamedEvaluation name. + fn compile_class(&mut self, c: &'a Class<'a>, name: Option<&str>) -> R<()> { + if let Some(m) = c.body.body.iter().find(|m| !supported_member(m)) { + return self.throw_syntax(class_syntax_name(m), m.span()); + } + let saved_pos = self.pos; + self.pos = c.span.start; + // The class's own name inside it: an immutable binding, in its TDZ until the class is defined. + let mut restore = None; + let inner = match &c.id { + Some(id) => { + let (ps, cell) = self.pseudo_binding(id.name.as_str(), true); + self.emit(Op::NewCell(cell)); + self.emit(Op::Uninit); + self.emit(Op::SetCell(cell)); + if let Some(s) = id.symbol_id.get() { + restore = Some((s, self.class_inner.insert(s, ps))); + } + Some(cell) + } + None => None, + }; + // A computed field's key is evaluated once, in order, into a binding of its own. + for m in &c.body.body { + if let ClassElement::PropertyDefinition(p) = m + && p.computed + { + let (ps, cell) = self.pseudo_binding("%key", false); + self.emit(Op::NewCell(cell)); + self.field_keys.insert(p.span.start, ps); + } + } + let heritage = c.heritage.as_ref().map(|h| &h.expression); + let derived = heritage.is_some(); + if let Some(sc) = heritage { + self.expr(sc)?; + } + let ctor = c.body.body.iter().find_map(|m| match m { + ClassElement::MethodDefinition(d) if d.kind == MethodDefinitionKind::Constructor => { + Some(d) + } + _ => None, + }); + let instance: Vec<&'a PropertyDefinition<'a>> = c + .body + .body + .iter() + .filter_map(|m| match m { + ClassElement::PropertyDefinition(p) if !p.r#static => Some(&**p), + _ => None, + }) + .collect(); + let statics: Vec<&'a PropertyDefinition<'a>> = c + .body + .body + .iter() + .filter_map(|m| match m { + ClassElement::PropertyDefinition(p) if p.r#static => Some(&**p), + _ => None, + }) + .collect(); + let class_name = + c.id.as_ref() + .map(|id| id.name.as_str()) + .or(name) + .unwrap_or(""); + let class = if derived { CLASS_DERIVED } else { CLASS_BASE }; + let fields = !instance.is_empty(); + let idx = match ctor { + Some(d) => { + let Some(body) = &d.value.body else { + return Err(unsupported("Function declarations without a body", d.span)); + }; + self.compile_function(FnSpec { + name: class_name, + params: Some(&d.value.params), + class, + fields, + method: true, + body: FnBody::Block(body), + scope: d.value.scope_id.get(), + is_async: false, + is_generator: false, + is_arrow: false, + self_sym: None, + })? + } + None => self.compile_function(FnSpec { + name: class_name, + params: None, + class, + fields, + method: true, + body: FnBody::DefaultCtor(c.span.start), + scope: None, + is_async: false, + is_generator: false, + is_arrow: false, + self_sym: None, + })?, + }; + self.pos = c.span.start; + self.emit(Op::Closure(idx)); + let at = heritage.map_or(c.span.start, |s| s.without_parentheses().span().start); + self.emit_at(at, Op::Class(derived)); + for m in &c.body.body { + match m { + ClassElement::PropertyDefinition(p) if p.computed => { + let Some(e) = p.key.as_expression() else { + continue; + }; + self.expr(e)?; + self.emit_at(e.without_parentheses().span().start, Op::ToKey); + if let Some(s) = self.field_keys.get(&p.span.start).copied() { + self.store_symbol(s, BindMode::Init, p.span.start)?; + } + } + ClassElement::MethodDefinition(d) + if d.kind != MethodDefinitionKind::Constructor => + { + let key = if d.computed { + let Some(e) = d.key.as_expression() else { + continue; + }; + self.expr(e)?; + self.emit_at(e.without_parentheses().span().start, Op::ToKey); + 0 + } else { + let k = static_key(&d.key, false).unwrap_or_default(); + self.atom(&k) + }; + let kind = match d.kind { + MethodDefinitionKind::Get => 4, + MethodDefinitionKind::Set => 8, + _ => 0, + }; + let flags = u8::from(d.r#static) | if d.computed { 2 } else { 0 } | kind; + self.pos = d.span.start; + self.closure_for_method(&d.value, "")?; + self.pos = d.span.start; + self.emit(Op::DefineMethod(key, flags)); + } + _ => {} + } + } + if fields { + let idx = self.compile_function(FnSpec { + name: "", + params: None, + class: 0, + fields: false, + method: true, + body: FnBody::Fields(instance, c.span.start), + scope: None, + is_async: false, + is_generator: false, + is_arrow: false, + self_sym: None, + })?; + self.pos = c.span.start; + self.emit(Op::Closure(idx)); + self.emit(Op::SetFields); + } + self.pos = c.span.start; + self.emit(Op::Pop); + if let Some(cell) = inner { + self.emit(Op::Dup); + self.emit(Op::SetCell(cell)); + } + if !statics.is_empty() { + let idx = self.compile_function(FnSpec { + name: "", + params: None, + class: 0, + fields: false, + method: true, + body: FnBody::Fields(statics, c.span.start), + scope: None, + is_async: false, + is_generator: false, + is_arrow: false, + self_sym: None, + })?; + self.pos = c.span.start; + self.emit(Op::Dup); + self.emit(Op::Closure(idx)); + self.emit(Op::InitStatic); + self.emit(Op::Pop); + } + if let Some((s, old)) = restore { + match old { + Some(o) => self.class_inner.insert(s, o), + None => self.class_inner.remove(&s), + }; + } + self.pos = saved_pos; + Ok(()) + } + + /// A method's closure: a function that may use `super`. + fn closure_for_method(&mut self, f: &'a Function<'a>, name: &str) -> R<()> { + let Some(body) = &f.body else { + return Err(unsupported("Function declarations without a body", f.span)); + }; + let idx = self.compile_function(FnSpec { + name, + params: Some(&f.params), + class: 0, + fields: false, + method: true, + body: FnBody::Block(body), + scope: f.scope_id.get(), + is_async: f.r#async, + is_generator: f.generator, + is_arrow: false, + self_sym: None, + })?; + self.emit(Op::Closure(idx)); + Ok(()) + } + + /// One field in a field initializer, `[this] -> [this]`. + fn class_field(&mut self, p: &'a PropertyDefinition<'a>) -> R<()> { + self.pos = p.span.start; + if let Some(s) = self.field_keys.get(&p.span.start).copied() { + self.load_symbol(s, p.span.start)?; + match &p.value { + Some(v) => { + self.expr(v)?; + if is_anonymous_fn(v) { + self.emit_at(v.span().start, Op::NameByKey(0)); + } + } + None => { + self.emit(Op::Undef); + } + } + self.pos = p.span.start; + self.emit(Op::DefineClassField(0, true)); + return Ok(()); + } + let name = static_key(&p.key, false).unwrap_or_default(); + match &p.value { + Some(v) => self.expr_named(v, Some(&name))?, + None => { + self.emit(Op::Undef); + } + } + let a = self.atom(&name); + self.pos = p.span.start; + self.emit(Op::DefineClassField(a, false)); + Ok(()) + } + + /// `super(...)` in a derived constructor. + fn super_call(&mut self, c: &'a CallExpression<'a>) -> R<()> { + if self.f().class != CLASS_DERIVED { + if self.f().is_arrow { + return self.throw_message( + "super() inside an arrow function is not supported. Call super() directly in the constructor.", + c.callee.span(), + ); + } + return self.throw_syntax("Super", c.callee.span()); + } + let argc = self.args(&c.arguments)?; + self.super_call_with(argc, c.span.start) + } + + /// Constructs the parent with the arguments on the stack (an array when `argc` is `None`), binds `this`, then + /// defines the instance fields: `[...] -> [instance]`. + fn super_call_with(&mut self, argc: Option, at: u32) -> R<()> { + self.pos = at; + let nt = self.f().new_target; + self.emit(Op::SuperCall(argc.unwrap_or(u32::MAX), nt)); + let Some(Store::Cell(c)) = self.f().this_store else { + return Ok(()); + }; + self.emit(Op::GetCell(c)); + self.emit(Op::SuperBind); + self.emit(Op::Dup); + self.emit(Op::SetCell(c)); + if self.f().fields { + self.emit(Op::Dup); + self.emit(Op::InitFields); + self.emit(Op::Pop); + } + Ok(()) + } + + /// An object literal's method or accessor: a method's closure, so it may use `super`. + fn object_method(&mut self, v: &'a Expression<'a>, name: &str) -> R<()> { + self.last_home = false; + match v { + Expression::FunctionExpression(f) => { + self.pos = f.span.start; + let Some(body) = &f.body else { + return Err(unsupported("Function declarations without a body", f.span)); + }; + let own = f.id.as_ref().map_or(name, |id| id.name.as_str()); + let idx = self.compile_function(FnSpec { + name: own, + params: Some(&f.params), + class: 0, + fields: false, + method: true, + body: FnBody::Block(body), + scope: f.scope_id.get(), + is_async: f.r#async, + is_generator: f.generator, + is_arrow: false, + self_sym: None, + })?; + self.emit(Op::Closure(idx)); + Ok(()) + } + other => self.expr_named(other, Some(name)), + } + } + + /// Gives the method just made the object `depth` below it as its home, when it uses `super`. + fn set_home(&mut self, depth: u32) { + if std::mem::take(&mut self.last_home) { + self.emit(Op::SetHome(depth)); + } + } + + /// Throws a SyntaxError of kind UnsupportedSyntax with this message when it runs. + fn throw_message(&mut self, message: &str, span: oxc_span::Span) -> R<()> { + self.throw_syntax(&format!("!{message}"), span) + } + + /// Whether `super` here is in a method (through arrows), whose home object it reads. + fn in_method(&self) -> bool { + self.fns + .iter() + .rposition(|f| !f.is_arrow) + .is_some_and(|d| self.fns[d].method) + } + + /// `super.x`'s base: pushes the home object and `this`. False, after the error, outside methods. + fn super_base(&mut self, at: oxc_span::Span) -> R { + let Some(d) = self.fns.iter().rposition(|f| !f.is_arrow) else { + self.throw_syntax("Super", at)?; + return Ok(false); + }; + if !self.fns[d].method { + self.throw_syntax("Super", at)?; + return Ok(false); + } + for f in &mut self.fns[d..] { + f.home = true; + } + self.emit(Op::Home); + self.emit_this()?; + Ok(true) + } + + /// `super.x` or `super[k]`'s base and key: `[home, this, (key)]`; false outside methods. + fn super_ref(&mut self, m: &'a MemberExpression<'a>) -> R> { + if !self.super_base(m.object().span())? { + return Ok(None); + } + Ok(Some(match m { + MemberExpression::ComputedMemberExpression(c) => { + self.expr(&c.expression)?; + self.emit_at(c.expression.without_parentheses().span().start, Op::ToKey); + (0, 2) + } + MemberExpression::StaticMemberExpression(s) => (self.atom(s.property.name.as_str()), 0), + MemberExpression::PrivateFieldExpression(_) => (0, 0), + })) + } + + /// `m` when it is a member of `super`. + fn super_member(m: Option<&'a MemberExpression<'a>>) -> Option<&'a MemberExpression<'a>> { + m.filter(|m| matches!(m.object(), Expression::Super(_))) + } + + /// Reads `super.x` (`keep`: `[f, this]` for a call). + fn super_get(&mut self, m: &'a MemberExpression<'a>, keep: bool) -> R<()> { + let Some((a, flags)) = self.super_ref(m)? else { + return Ok(()); + }; + self.pos = m.span().start; + self.emit(Op::GetSuper(a, flags | u8::from(keep))); + Ok(()) + } + + /// Stores `[home, this, (key)]` in locals for a read-modify-write of `super.x`. + fn super_save(&mut self, flags: u8) -> Vec { + let n = if flags & 2 != 0 { 3 } else { 2 }; + let locals: Vec = (0..n).map(|_| self.new_local()).collect(); + for l in locals.iter().rev() { + self.emit(Op::SetLocal(*l)); + } + locals + } + + fn super_load(&mut self, locals: &[u32]) { + for l in locals { + self.emit(Op::GetLocal(*l)); + } + } + + /// `super.x = v`, `super.x op= v` and the logical assignments. + fn super_assign( + &mut self, + m: &'a MemberExpression<'a>, + a: &'a AssignmentExpression<'a>, + ) -> R<()> { + let Some((key, flags)) = self.super_ref(m)? else { + return Ok(()); + }; + let at = m.span().start; + if a.operator == AssignmentOperator::Assign { + self.expr(&a.right)?; + self.pos = at; + self.emit(Op::PutSuper(key, flags)); + return Ok(()); + } + let base = self.super_save(flags); + self.super_load(&base); + self.pos = at; + self.emit(Op::GetSuper(key, flags)); + let logical = match a.operator { + AssignmentOperator::LogicalAnd => Some(Op::JumpIfFalseKeep(0)), + AssignmentOperator::LogicalOr => Some(Op::JumpIfTrueKeep(0)), + AssignmentOperator::LogicalNullish => Some(Op::JumpIfNotNullishKeep(0)), + _ => None, + }; + let v = self.new_local(); + if let Some(jop) = logical { + let j = self.emit(jop); + self.expr(&a.right)?; + self.emit(Op::SetLocal(v)); + self.super_load(&base); + self.emit(Op::GetLocal(v)); + self.pos = at; + self.emit(Op::PutSuper(key, flags)); + self.patch(j); + return Ok(()); + } + self.expr(&a.right)?; + self.pos = a.span.start; + self.emit(compound_op(a.operator)); + self.emit(Op::SetLocal(v)); + self.super_load(&base); + self.emit(Op::GetLocal(v)); + self.pos = at; + self.emit(Op::PutSuper(key, flags)); + Ok(()) + } + + /// `super.x++` and the like. + fn super_update(&mut self, m: &'a MemberExpression<'a>, u: &'a UpdateExpression<'a>) -> R<()> { + let Some((key, flags)) = self.super_ref(m)? else { + return Ok(()); + }; + let at = m.span().start; + let base = self.super_save(flags); + self.super_load(&base); + self.pos = at; + self.emit(Op::GetSuper(key, flags)); + self.emit(Op::ToNumeric); + let old = self.new_local(); + if !u.prefix { + self.emit(Op::Dup); + self.emit(Op::SetLocal(old)); + } + self.pos = u.span.start; + self.emit(if u.operator == UpdateOperator::Increment { + Op::Inc + } else { + Op::Dec + }); + let v = self.new_local(); + self.emit(Op::SetLocal(v)); + self.super_load(&base); + self.emit(Op::GetLocal(v)); + self.pos = at; + self.emit(Op::PutSuper(key, flags)); + if !u.prefix { + self.emit(Op::Pop); + self.emit(Op::GetLocal(old)); + } + Ok(()) + } + + /// `delete super.x`: evaluates the reference, then throws. + fn super_delete(&mut self, m: &'a MemberExpression<'a>) -> R<()> { + if self.super_ref(m)?.is_none() { + return Ok(()); + } + let msg = self.str_const("Unsupported reference to 'super'."); + self.pos = m.span().start; + self.emit(Op::ThrowReference(msg)); + Ok(()) + } + + /// A destructuring target `super.x`, which is not supported. + fn super_target(&mut self, at: oxc_span::Span) -> R<()> { + if self.in_method() { + return self.throw_message("Destructuring into super.x is not supported.", at); + } + self.throw_syntax("Super", at) + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/conversion.rs b/packages/codemode-rust/crates/psychoscript/src/conversion.rs new file mode 100644 index 0000000000000..6039f1e700f30 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/conversion.rs @@ -0,0 +1,964 @@ +//! Conversions that call the program: an object's own `valueOf` or `toString`, called by an operator or a built-in. +//! +//! The reference converts in its internal bytecode (`$vmToPrimitive`, `$vmBinary`, `$vmConvert`), so those calls are +//! bytecode calls that can park, suspend and be saved. Rust does the same with a convert frame (see `native.rs`): +//! +//! - A built-in called from bytecode (`Vm::call_op`) converts with `convert_ok` set. A conversion that would call +//! the program then does not call it: it records the request (`convert_req`) and fails with a sentinel. The call +//! pushes a convert frame, which runs ToPrimitive as calls, then runs the built-in again from the start with the +//! answers so far replayed in order, as the reference's `$vmConvert` reruns a built-in, until it completes. +//! - An instruction whose operand converts by calling the program pushes a convert frame for the operation, which +//! runs the operation's slow path (`Vm::op_slow`) the same way and hands its result back as the instruction would. +//! - A native frame's step converts a value explicitly (`Frame::convert`): the primitive comes back as a call's result. +//! +//! A replay spends no fuel twice: the fuel spent until the last answer is taken is rewound to what it was when the +//! replay started (`end_replay`), so the fuel and its order are those of the conversions made inline. + +use std::collections::VecDeque; + +use crate::bytecode::Arith; +use crate::native::{Frame, Input, NativeOp, Step}; +use crate::object::*; +use crate::ops::Hint; +use crate::value::{Id, Slot, Value}; +use crate::vm::{Res, Vm}; + +/// What a convert frame does once a value is converted, by its sub-op. +const OP: u16 = 0; +const NATIVE: u16 = 1; +const RETURN: u16 = 2; + +// The slots of a convert frame. +const VALUE: usize = 0; +const HINT: usize = 1; +/// The next of the value's two methods to try. +const STAGE: usize = 2; +/// The primitives so far, in the order they were asked for (an internal array). +const ANSWERS: usize = 3; +const PHASE: usize = 4; +/// An operation: its code, its operands, and what the code needs besides. +const CODE: usize = 5; +const A: usize = 6; +const B: usize = 7; +const C: usize = 8; +const EXTRA: usize = 9; +const EXTRA2: usize = 10; +/// A built-in: its function, receiver, whether its call was counted, whether it constructs, its arguments. +const CALLEE: usize = 5; +const THIS: usize = 6; +const COUNTED: usize = 7; +const CONSTRUCTING: usize = 8; +const ARGC: usize = 9; +/// A list of conversions (`fuel::Conversions`) being made: whether one is, its values and their hints (internal +/// arrays), whether each is made a number or a string too, the next, and those made so far. +const LISTING: usize = 11; +const LIST: usize = 12; +const HINTS: usize = 13; +const COERCE: usize = 14; +const LIST_I: usize = 15; +const LIST_OUT: usize = 16; +/// The getters read ahead for a built-in (receiver, key, value, …), the pairs still to read (receiver, key, …) and +/// the next of them (see `Request::Read`). +const READS: usize = 17; +const READ_PAIRS: usize = 18; +const READ_I: usize = 19; +const ARGS: usize = 20; + +/// Waiting for a conversion method's result; waiting for the frame a rerun built-in pushed. +const CONVERTING: usize = 0; +const WAITING: usize = 1; +/// Waiting for a getter read ahead. +const READING: usize = 2; +/// Waiting for a program getter of the value's method, `valueOf` or `toString`. +const GETTING: usize = 3; + +/// The operations an instruction converts in (`Vm::op_slow`). +pub(crate) mod code { + pub const SUB: u8 = 0; + pub const MUL: u8 = 1; + pub const DIV: u8 = 2; + pub const MOD: u8 = 3; + pub const POW: u8 = 4; + pub const BIT_AND: u8 = 5; + pub const BIT_OR: u8 = 6; + pub const BIT_XOR: u8 = 7; + pub const SHL: u8 = 8; + pub const SHR: u8 = 9; + pub const USHR: u8 = 10; + pub const ADD: u8 = 11; + pub const LT: u8 = 12; + pub const GT: u8 = 13; + pub const LE: u8 = 14; + pub const GE: u8 = 15; + /// `Vm::arith` with the `Arith` in `extra`. + pub const ARITH: u8 = 16; + pub const EQ: u8 = 17; + pub const NE: u8 = 18; + pub const NEG: u8 = 19; + /// `extra`: which message an opaque operand gets (0 for `++`, 1 for `--`, 2 for a unary operator). + pub const TO_NUMBER: u8 = 20; + pub const BIT_NOT: u8 = 21; + pub const INC: u8 = 22; + pub const DEC: u8 = 23; + pub const TO_STR: u8 = 24; + pub const GET_ELEM: u8 = 25; + pub const SET_ELEM: u8 = 26; + pub const DEL_ELEM: u8 = 27; + /// Defines `b` as key `a` on the object on top of the instruction's stack. + pub const DEFINE_ELEM: u8 = 28; + pub const TO_KEY: u8 = 29; + pub const IN: u8 = 30; + /// `extra` is the `Arith`, `extra2` the jump taken when the comparison fails. + pub const JUMP_UNLESS: u8 = 31; + /// Adds `b` to local `extra`. + pub const ADD_LOCAL: u8 = 32; + /// Increments local `extra` (`extra2` 1 to decrement). + pub const INC_LOCAL: u8 = 33; + /// `Vm::write_key` of key `a` on base `b`. + pub const WRITE_KEY: u8 = 34; +} + +const ARITHS: [Arith; 11] = [ + Arith::Add, + Arith::Sub, + Arith::Mul, + Arith::Div, + Arith::Mod, + Arith::Lt, + Arith::Le, + Arith::Gt, + Arith::Ge, + Arith::StrictEq, + Arith::StrictNe, +]; + +pub(crate) fn arith_code(a: Arith) -> u32 { + ARITHS.iter().position(|x| *x == a).unwrap_or(0) as u32 +} + +/// What a replay rewinds: the step budget and the meter. +pub(crate) type Meter = [i32; 4]; + +/// A conversion a restartable run asked for: one value, or a built-in's list of them (`fuel::Conversions`), whose +/// answer is the whole list converted. +pub(crate) enum Request { + One(Value, Hint), + List(Vec, Vec, bool), + /// Program getters a built-in met (`Vm::with_reads`), by receiver and key: read in program code, then the + /// built-in runs again with their values, as the reference's `$vmReplay` reads a `Prefetch`. + Read(Vec<(Value, Atom)>), +} + +impl Vm { + /// Whether converting `v` with `hint` calls the program: one of the methods ToPrimitive may call is not native. + pub(crate) fn converts_by_call(&mut self, v: &Value, hint: Hint) -> bool { + let Value::Obj(id) = v else { return false }; + // A namespace or a promise converts without consulting its methods (see `Vm::primitive_of`). + if matches!( + self.heap[*id as usize].kind, + Kind::Namespace(_) | Kind::Promise(_) + ) { + return false; + } + let hint = if hint == Hint::Default && crate::builtins::exotic::prefers_string(self, *id) { + Hint::String + } else { + hint + }; + let names = match hint { + Hint::String => [self.names.to_string, self.names.value_of], + _ => [self.names.value_of, self.names.to_string], + }; + names.into_iter().any(|name| { + // A program getter is program code, which runs where the conversion can be restarted. + if self.has_program_getter(*id, name) { + return true; + } + let f = self.get_obj(*id, name); + self.is_callable(&f) && !matches!(&f, Value::Obj(m) if matches!(self.heap[*m as usize].kind, Kind::Native { .. })) + }) + } + + /// Whether an operand of an instruction converts by calling the program, for any hint. + #[cold] + #[inline(never)] + pub(crate) fn operand_calls(&mut self, v: &Value) -> bool { + matches!(v, Value::Obj(_)) + && (self.converts_by_call(v, Hint::Number) || self.converts_by_call(v, Hint::String)) + } + + /// Whether `in` converts its key `k` by calling the program: only with a data object on the right (see + /// `Vm::has_property`). + #[cold] + #[inline(never)] + pub(crate) fn in_key_calls(&mut self, o: &Value, k: &Value) -> bool { + self.is_convertible_obj(o) && self.operand_calls(k) + } + + /// A conversion asked for where it can be restarted: the replayed answer, or the request (an `Err` the caller + /// passes on). `None` when the conversion is made inline. + #[inline] + pub(crate) fn restartable_conversion(&mut self, v: &Value, hint: Hint) -> Option { + if !self.convert_ok || !matches!(v, Value::Obj(_)) || !self.converts_by_call(v, hint) { + return None; + } + if let Some(a) = self.replay.pop_front() { + if self.replay.is_empty() { + self.end_replay(true); + } + return Some(Ok(a)); + } + if self.convert_req.is_none() { + self.convert_req = Some(Request::One(*v, hint)); + } + Some(Err(Value::Undef)) + } + + /// A built-in's list of conversions made where it can be restarted, once its bookkeeping is spent: the replayed + /// list, or the request. `None` when the list is converted inline. + pub(crate) fn restartable_list( + &mut self, + hints: &[Hint], + values: &[Value], + coerce: bool, + ) -> Option, Value>> { + if !self.convert_ok { + return None; + } + let calls = (0..values.len()) + .any(|i| self.converts_by_call(&values[i], hints[i.min(hints.len() - 1)])); + if !calls { + return None; + } + if let Some(a) = self.replay.pop_front() { + if self.replay.is_empty() { + self.end_replay(true); + } + let list = match a.as_obj().map(|id| &self.heap[id as usize].kind) { + Some(Kind::Array(items)) => items.clone(), + _ => values.to_vec(), + }; + return Some(Ok(list)); + } + if self.convert_req.is_none() { + let hints = (0..values.len()) + .map(|i| hints[i.min(hints.len() - 1)]) + .collect(); + self.convert_req = Some(Request::List(values.to_vec(), hints, coerce)); + } + Some(Err(Value::Undef)) + } + + /// Starts a replay of `answers`. + fn start_replay(&mut self, answers: Vec) { + self.replay = VecDeque::from(answers); + self.replay_meter = Some(self.meter_state()); + } + + /// Ends a replay: with `rewind`, the fuel spent since it started is given back. + pub(crate) fn end_replay(&mut self, rewind: bool) { + self.replay.clear(); + if let Some(m) = self.replay_meter.take() + && rewind + { + self.set_meter_state(m); + } + } + + /// Pushes a convert frame for the instruction operation `code` on `a`, `b` and `c`. + #[cold] + #[inline(never)] + pub(crate) fn convert_op( + &mut self, + code: u8, + a: Value, + b: Value, + c: Value, + extra: u32, + extra2: u32, + ) -> Res { + let mut slots = [Value::Undef; ARGS]; + slots[STAGE] = Value::Num(0.0); + slots[PHASE] = Value::Num(CONVERTING as f64); + slots[CODE] = Value::Num(code as f64); + slots[A] = a; + slots[B] = b; + slots[C] = c; + slots[EXTRA] = Value::Num(extra as f64); + slots[EXTRA2] = Value::Num(extra2 as f64); + slots[LISTING] = Value::Bool(false); + let r = self.enter_native_with(NativeOp::Convert, OP, Value::Undef, Value::Undef, &slots); + self.entered = false; + r + } + + /// After a built-in asked for a conversion: pushes the convert frame that converts, then reruns it. + #[cold] + #[inline(never)] + pub(crate) fn convert_native( + &mut self, + callee: Id, + this: Value, + args: &[Value], + counted: bool, + constructing: bool, + ) -> Res { + if self.convert_req.is_none() { + return Ok(Value::Undef); + } + self.end_replay(false); + self.entered = false; + let mut slots = vec![Value::Undef; ARGS]; + slots[STAGE] = Value::Num(0.0); + slots[PHASE] = Value::Num(CONVERTING as f64); + slots[CALLEE] = Value::Obj(callee); + slots[THIS] = this; + slots[COUNTED] = Value::Bool(counted); + slots[CONSTRUCTING] = Value::Bool(constructing); + slots[ARGC] = Value::Num(args.len() as f64); + slots[LISTING] = Value::Bool(false); + slots.extend_from_slice(args); + let r = self.enter_native_with(NativeOp::Convert, NATIVE, Value::Obj(callee), this, &slots); + self.entered = false; + // The frame starts with the request, as a rerun's next request (see `convert_next`). + // The frame ends the call as `call_op` would have ended it. + if r.is_ok() + && let Some(f) = self.frames.last_mut() + { + f.argc = counted as u32; + } + r + } + + /// An instruction's slow path on two operands, out of line: its result, or `None` once it pushed a convert frame + /// because an operand converts by calling the program. + #[inline(never)] + pub(crate) fn slow_op( + &mut self, + code: u8, + a: Value, + b: Value, + extra: u32, + extra2: u32, + ) -> Result, Value> { + if self.operand_calls(&a) || self.operand_calls(&b) { + self.convert_op(code, a, b, Value::Undef, extra, extra2)?; + return Ok(None); + } + self.op_slow(code, a, b, Value::Undef, extra, extra2) + .map(Some) + } + + /// The slow path of the instruction operation `code`, after its operands were popped: what the instruction + /// pushes. A local or a jump it writes itself is written by the convert frame (`finish_op`). + pub(crate) fn op_slow( + &mut self, + code: u8, + a: Value, + b: Value, + c: Value, + extra: u32, + extra2: u32, + ) -> Res { + use code::*; + Ok(match code { + SUB..=USHR => { + self.data_operands(&a, &b)?; + let x = self.op_number(&a, &b)?; + let y = self.op_number(&b, &a)?; + Value::Num(match code { + SUB => x - y, + MUL => x * y, + DIV => x / y, + MOD => crate::vm::js_rem(x, y), + POW => crate::vm::js_pow(x, y), + BIT_AND => (to_i32(x) & to_i32(y)) as f64, + BIT_OR => (to_i32(x) | to_i32(y)) as f64, + BIT_XOR => (to_i32(x) ^ to_i32(y)) as f64, + SHL => to_i32(x).wrapping_shl(to_u32(y) & 31) as f64, + SHR => (to_i32(x) >> (to_u32(y) & 31)) as f64, + _ => (to_u32(x) >> (to_u32(y) & 31)) as f64, + }) + } + ADD | ADD_LOCAL => self.add(a, b)?, + LT..=GE => { + self.data_operands(&a, &b)?; + let (swap, neg) = match code { + LT => (false, false), + GT => (true, false), + LE => (true, true), + _ => (false, true), + }; + let (l, r) = if swap { (b, a) } else { (a, b) }; + Value::Bool(match self.less_than(&l, &r, !swap)? { + Some(v) => v != neg, + None => false, + }) + } + ARITH | JUMP_UNLESS => self.arith(ARITHS[extra as usize % ARITHS.len()], a, b)?, + EQ | NE => { + self.loose_eq_operands(&a, &b)?; + Value::Bool(self.loose_eq(&a, &b)? == (code == EQ)) + } + NEG => { + self.data_operand(&a, "Unary operators require data values.")?; + Value::Num(-self.number_of(&a)?) + } + TO_NUMBER => { + if self.is_opaque_operand(&a) { + let msg = match extra { + 0 => "'++' requires a data value.", + 1 => "'--' requires a data value.", + _ => "Unary operators require data values.", + }; + return Err(self.invalid_data(msg)); + } + Value::Num(self.number_of(&a)?) + } + BIT_NOT => { + self.data_operand(&a, "Unary operators require data values.")?; + Value::Num(!to_i32(self.number_of(&a)?) as f64) + } + INC | DEC => { + let msg = if code == INC { + "'++' requires a data value." + } else { + "'--' requires a data value." + }; + self.data_operand(&a, msg)?; + let x = self.number_of(&a)?; + Value::Num(if code == INC { x + 1.0 } else { x - 1.0 }) + } + INC_LOCAL => { + self.data_operand( + &a, + if extra2 == 0 { + "'++' requires a data value." + } else { + "'--' requires a data value." + }, + )?; + let x = self.number_of(&a)?; + Value::Num(if extra2 == 0 { x + 1.0 } else { x - 1.0 }) + } + TO_STR => Value::Str(self.string_of(&a)?), + // A program getter or setter the access meets is handed back for the convert frame to call (`run_op`). + // A nullish base fails before its key converts. + GET_ELEM if a.is_nullish() => self.get_elem(&a, &b)?, + SET_ELEM if a.is_nullish() => { + self.set_elem(&a, &b, c)?; + c + } + GET_ELEM => { + let k = self.key_of(&b)?; + self.op_access = true; + let v = self.get(&a, k); + self.op_access = false; + v? + } + SET_ELEM => { + let k = self.key_of(&b)?; + self.check_assignment_at(&a, k, &c)?; + self.op_access = true; + let r = self.set(&a, k, c); + self.op_access = false; + r?; + c + } + DEL_ELEM => { + let k = self.key_of(&b)?; + Value::Bool(self.delete(&a, k)?) + } + DEFINE_ELEM => { + let k = self.key_of(&a)?; + Value::Num(k as f64) + } + WRITE_KEY => self.write_key(&b, &a)?, + TO_KEY => { + let k = self.key_of(&a)?; + if k <= SYM_ASYNC_ITERATOR { + Value::Sym(k) + } else { + self.atom_val(k) + } + } + IN => Value::Bool(self.has_property(&a, &b)?), + _ => Value::Undef, + }) + } +} + +fn to_i32(x: f64) -> i32 { + crate::value::to_int32(x) +} + +fn to_u32(x: f64) -> u32 { + crate::value::to_uint32(x) +} + +fn hint_code(h: Hint) -> f64 { + match h { + Hint::Number => 0.0, + Hint::String => 1.0, + Hint::Default => 2.0, + } +} + +fn hint_of(v: usize) -> Hint { + match v { + 0 => Hint::Number, + 1 => Hint::String, + _ => Hint::Default, + } +} + +impl Frame { + /// Converts `v` with `hint` for a native frame's step: the primitive comes back as `Input::Returned`. `v` must be + /// an object. + pub fn convert(self, vm: &mut Vm, v: Value, hint: Hint) -> Result { + let slots = [ + v, + Value::Num(hint_code(hint)), + Value::Num(0.0), + Value::Undef, + Value::Num(CONVERTING as f64), + ]; + vm.enter_native_with( + NativeOp::Convert, + RETURN, + Value::Undef, + Value::Undef, + &slots, + )?; + vm.entered = false; + Ok(Step::Pushed) + } +} + +/// The step of a convert frame. +pub(crate) fn step(vm: &mut Vm, sub: u16, fr: Frame, input: Input) -> Result { + match input { + Input::Start => match sub { + OP => run_op(vm, fr), + NATIVE => convert_next(vm, fr), + _ => begin(vm, fr), + }, + Input::Returned(r) if fr.index(vm, PHASE) == WAITING => Ok(Step::Done(r.get())), + Input::Returned(r) if fr.index(vm, PHASE) == GETTING => { + fr.set_index(vm, PHASE, CONVERTING); + let f = r.get(); + if vm.is_callable(&f) { + let v = fr.get(vm, VALUE); + return fr.call_slots(vm, Slot::pack(f), Slot::pack(v), []); + } + next_method(vm, fr) + } + Input::Returned(r) if fr.index(vm, PHASE) == READING => { + fr.set_index(vm, PHASE, CONVERTING); + read_one(vm, fr, r.get()); + next_read(vm, fr) + } + Input::Returned(r) => { + let r = r.get(); + if matches!(r, Value::Obj(_)) { + return next_method(vm, fr); + } + if sub != RETURN && matches!(fr.get(vm, LISTING), Value::Bool(true)) { + return listed(vm, fr, r); + } + answered(vm, sub, fr, r) + } + Input::Threw(e) => Err(e), + Input::Finished(_) => Ok(Step::Done(Value::Undef)), + } +} + +/// ToPrimitive of the frame's value, as `Vm::primitive_of` makes it: its fuel, then its first method. +fn begin(vm: &mut Vm, fr: Frame) -> Result { + vm.fuel(1); + if let Value::Obj(id) = fr.get(vm, VALUE) + && hint_of(fr.index(vm, HINT)) == Hint::Default + && crate::builtins::exotic::prefers_string(vm, id) + { + fr.set_index(vm, HINT, 1); + } + fr.set_index(vm, STAGE, 0); + fr.set_index(vm, PHASE, CONVERTING); + next_method(vm, fr) +} + +/// Calls the next of the value's methods that is callable, as bytecode calls it; none left fails. +fn next_method(vm: &mut Vm, fr: Frame) -> Result { + let v = fr.get(vm, VALUE); + let Value::Obj(id) = v else { + return Err(unconvertible(vm)); + }; + let names = match hint_of(fr.index(vm, HINT)) { + Hint::String => [vm.names.to_string, vm.names.value_of], + _ => [vm.names.value_of, vm.names.to_string], + }; + let mut stage = fr.index(vm, STAGE); + while stage < 2 { + vm.op_access = true; + let f = vm.get_obj(id, names[stage]); + vm.op_access = false; + stage += 1; + if let Some(g) = vm.getter_hit.take() { + // `v[name]` in the reference's `$vmToPrimitive`: the getter runs, then its value is called if callable. + fr.set_index(vm, STAGE, stage); + fr.set_index(vm, PHASE, GETTING); + return fr.call_slots(vm, Slot::pack(g), Slot::pack(v), []); + } + if vm.is_callable(&f) { + fr.set_index(vm, STAGE, stage); + return fr.call_slots(vm, Slot::pack(f), Slot::pack(v), []); + } + } + Err(unconvertible(vm)) +} + +/// A value with no method that converts it. The only member instructions that convert are those whose key does, so +/// at one the failure points at the key, as the reference's key conversion does. +fn unconvertible(vm: &mut Vm) -> Value { + let e = vm.type_error("Cannot convert object to primitive value."); + vm.at_site(e, crate::bytecode::Site::Key) +} + +/// A value converted to `r`: kept with the answers, then the operation or built-in runs again. +fn answered(vm: &mut Vm, sub: u16, fr: Frame, r: Value) -> Result { + if sub == RETURN { + return Ok(Step::Done(r)); + } + let answers = match fr.get(vm, ANSWERS) { + Value::Obj(a) => a, + _ => { + let a = vm.new_array(Vec::new()); + fr.set(vm, ANSWERS, a); + a.as_obj().unwrap_or(0) + } + }; + if let Kind::Array(items) = &mut vm.heap[answers as usize].kind { + items.push(r); + } + if sub == OP { + return run_op(vm, fr); + } + rerun_native(vm, fr) +} + +fn answers_of(vm: &Vm, fr: Frame) -> Vec { + match fr + .get(vm, ANSWERS) + .as_obj() + .map(|a| &vm.heap[a as usize].kind) + { + Some(Kind::Array(items)) => items.clone(), + _ => Vec::new(), + } +} + +/// After a run that asked for another conversion: converts that value, or that list, next. +fn convert_next(vm: &mut Vm, fr: Frame) -> Result { + let Some(req) = vm.convert_req.take() else { + return Ok(Step::Done(Value::Undef)); + }; + vm.end_replay(false); + match req { + Request::One(v, hint) => { + fr.set(vm, LISTING, Value::Bool(false)); + fr.set(vm, VALUE, v); + fr.set_index(vm, HINT, hint_code(hint) as usize); + begin(vm, fr) + } + Request::Read(pairs) => { + let flat: Vec = pairs + .iter() + .flat_map(|(r, k)| [*r, key_value(vm, *k)]) + .collect(); + let list = vm.new_array(flat); + fr.set(vm, READ_PAIRS, list); + fr.set_index(vm, READ_I, 0); + next_read(vm, fr) + } + Request::List(values, hints, coerce) => { + let list = vm.new_array(values); + let hints = vm.new_array( + hints + .into_iter() + .map(|h| Value::Num(hint_code(h))) + .collect(), + ); + let out = vm.new_array(Vec::new()); + fr.set(vm, LISTING, Value::Bool(true)); + fr.set(vm, LIST, list); + fr.set(vm, HINTS, hints); + fr.set(vm, COERCE, Value::Bool(coerce)); + fr.set_index(vm, LIST_I, 0); + fr.set(vm, LIST_OUT, out); + next_listed(vm, fr) + } + } +} + +/// A key as a value, for the frame's slots. +fn key_value(vm: &Vm, k: Atom) -> Value { + if k <= SYM_ASYNC_ITERATOR { + Value::Sym(k) + } else { + vm.atom_val(k) + } +} + +/// The pair at `READ_I`: its receiver and key. +fn read_pair(vm: &mut Vm, fr: Frame) -> Option<(Value, Atom)> { + let i = fr.index(vm, READ_I); + let list = fr.get(vm, READ_PAIRS).as_obj()?; + let (r, k) = match &vm.heap[list as usize].kind { + Kind::Array(items) => (*items.get(2 * i)?, *items.get(2 * i + 1)?), + _ => return None, + }; + let key = match k { + Value::Sym(s) => s, + k => vm.key_of(&k).ok()?, + }; + Some((r, key)) +} + +/// The pair at `READ_I` read as `v`: kept with the reads, then the next. +fn read_one(vm: &mut Vm, fr: Frame, v: Value) { + let Some((r, k)) = read_pair(vm, fr) else { + return; + }; + let kv = key_value(vm, k); + let reads = match fr.get(vm, READS) { + Value::Obj(a) => a, + _ => { + let a = vm.new_array(Vec::new()); + fr.set(vm, READS, a); + a.as_obj().unwrap_or(0) + } + }; + if let Kind::Array(items) = &mut vm.heap[reads as usize].kind { + items.extend([r, kv, v]); + } + let i = fr.index(vm, READ_I); + fr.set_index(vm, READ_I, i + 1); +} + +/// Reads the getters still to read, as the reference's `receiver[key]` reads each, then runs the built-in again. +fn next_read(vm: &mut Vm, fr: Frame) -> Result { + while let Some((r, k)) = read_pair(vm, fr) { + vm.op_access = true; + let got = vm.get(&r, k); + vm.op_access = false; + let v = got?; + if let Some(g) = vm.getter_hit.take() { + fr.set_index(vm, PHASE, READING); + return fr.call_slots(vm, Slot::pack(g), Slot::pack(r), []); + } + read_one(vm, fr, v); + } + rerun_native(vm, fr) +} + +/// The getters read ahead so far, as the table a built-in reads them from. +fn reads_of(vm: &Vm, fr: Frame) -> Vec<(Value, Atom, Value)> { + let items = match fr + .get(vm, READS) + .as_obj() + .map(|a| &vm.heap[a as usize].kind) + { + Some(Kind::Array(items)) => items.clone(), + _ => return Vec::new(), + }; + items + .chunks(3) + .filter_map(|c| match c { + [r, Value::Sym(s), v] => Some((*r, *s, *v)), + [r, Value::Str(s), v] => Some((*r, vm.atoms.lookup(vm.text(*s))?, *v)), + _ => None, + }) + .collect() +} + +/// The next value of a list of conversions, as `fuel::Conversions::convert` converts it: ToPrimitive, made a number +/// or a string with `coerce`, then a back-edge. A primitive is not called for. +fn next_listed(vm: &mut Vm, fr: Frame) -> Result { + loop { + let i = fr.index(vm, LIST_I); + let list = fr.get(vm, LIST).as_obj().unwrap_or(0); + let item = match &vm.heap[list as usize].kind { + Kind::Array(items) => items.get(i).copied(), + _ => None, + }; + let Some(v) = item else { + let out = fr.get(vm, LIST_OUT); + return answered(vm, NATIVE, fr, out); + }; + let hints = fr.get(vm, HINTS).as_obj().unwrap_or(0); + let hint = match &vm.heap[hints as usize].kind { + Kind::Array(h) => h.get(i).map_or(0, |x| x.as_num() as usize), + _ => 0, + }; + if vm.is_convertible_obj(&v) { + fr.set(vm, VALUE, v); + fr.set_index(vm, HINT, hint); + return begin(vm, fr); + } + push_listed(vm, fr, v, hint)?; + } +} + +/// A list's value converted to the primitive `p`: coerced, kept, then a back-edge. +fn push_listed(vm: &mut Vm, fr: Frame, p: Value, hint: usize) -> Result<(), Value> { + let p = match fr.get(vm, COERCE) { + Value::Bool(true) => match hint_of(hint) { + Hint::String => Value::Str(vm.string_of(&p)?), + _ => Value::Num(vm.number_of(&p)?), + }, + _ => p, + }; + if let Some(Kind::Array(out)) = fr + .get(vm, LIST_OUT) + .as_obj() + .map(|o| &mut vm.heap[o as usize].kind) + { + out.push(p); + } + crate::builtins::fuel::step(vm); + let i = fr.index(vm, LIST_I); + fr.set_index(vm, LIST_I, i + 1); + Ok(()) +} + +/// A list's object value converted to `r`: the rest of the list next. +fn listed(vm: &mut Vm, fr: Frame, r: Value) -> Result { + let hint = fr.index(vm, HINT); + push_listed(vm, fr, r, hint)?; + next_listed(vm, fr) +} + +/// Runs the operation with the answers so far. +fn run_op(vm: &mut Vm, fr: Frame) -> Result { + let answers = answers_of(vm, fr); + if !answers.is_empty() { + vm.start_replay(answers); + } + let code = fr.index(vm, CODE) as u8; + let (a, b, c) = (fr.get(vm, A), fr.get(vm, B), fr.get(vm, C)); + let (extra, extra2) = (fr.index(vm, EXTRA) as u32, fr.index(vm, EXTRA2) as u32); + vm.convert_ok = true; + let r = vm.op_slow(code, a, b, c, extra, extra2); + vm.convert_ok = false; + if vm.convert_req.is_some() { + vm.getter_hit = None; + vm.setter_hit = None; + return convert_next(vm, fr); + } + vm.end_replay(false); + let v = r?; + // The element read or written is a program accessor's: its call's outcome is the instruction's. + if let Some(g) = vm.getter_hit.take() { + fr.set_index(vm, PHASE, WAITING); + return fr.call_slots(vm, Slot::pack(g), Slot::pack(a), []); + } + if let Some(s) = vm.setter_hit.take() { + fr.set_index(vm, PHASE, WAITING); + vm.enter_setter(s, a, c)?; + return Ok(Step::Pushed); + } + finish_op(vm, fr, code, v, extra, extra2) +} + +/// Hands an operation's result back as its instruction does. +fn finish_op( + vm: &mut Vm, + fr: Frame, + code: u8, + v: Value, + extra: u32, + extra2: u32, +) -> Result { + let caller = vm.frames.len().saturating_sub(2); + match code { + code::JUMP_UNLESS => { + if !vm.truthy(&v) { + vm.frames[caller].pc = extra2 as usize; + } + Ok(Step::DoneEmpty) + } + code::ADD_LOCAL | code::INC_LOCAL => { + let at = vm.frames[caller].base + extra as usize; + if let Some(s) = vm.stack.get_mut(at) { + *s = Slot::pack(v); + } + Ok(Step::DoneEmpty) + } + code::DEFINE_ELEM => { + let (k, val) = (v.as_num() as u32, fr.get(vm, B)); + if let Some(id) = vm.stack[fr.base() - 3].obj() { + vm.define(id, k, val); + } + Ok(Step::DoneEmpty) + } + _ => Ok(Step::Done(v)), + } +} + +/// Runs the built-in again from the start with the answers so far, as `call_op` calls it. +fn namespace_call( + vm: &mut Vm, + _this: Value, + args: &[Value], + id: crate::value::Id, +) -> crate::vm::Res { + crate::host::call_namespace(vm, id, args, Value::Obj(id)) +} + +fn rerun_native(vm: &mut Vm, fr: Frame) -> Result { + let answers = answers_of(vm, fr); + vm.start_replay(answers); + let Some(id) = fr.slot(vm, CALLEE).obj() else { + return Ok(Step::Done(Value::Undef)); + }; + let f = match &vm.heap[id as usize].kind { + Kind::Native { f, .. } => *f, + // A host call through a namespace, whose arguments' getters were read ahead. + Kind::Namespace(_) => namespace_call, + _ => return Ok(Step::Done(Value::Undef)), + }; + let counted = matches!(fr.get(vm, COUNTED), Value::Bool(true)); + let this = match fr.get(vm, CONSTRUCTING) { + Value::Bool(true) => Value::Uninit, + _ => fr.get(vm, THIS), + }; + let argc = fr.index(vm, ARGC); + let at = fr.base() + ARGS; + let args: Vec = vm.stack[at..at + argc].iter().map(|s| s.get()).collect(); + vm.host.meter.counted = counted; + vm.convert_ok = true; + vm.reads.fault = None; + let table = reads_of(vm, fr); + let outer = std::mem::replace(&mut vm.reads.table, table); + let r = f(vm, this, &args, id); + vm.reads.table = outer; + let r = vm.checked_native(r); + vm.convert_ok = false; + if vm.convert_req.is_some() { + vm.entered = false; + return convert_next(vm, fr); + } + vm.end_replay(false); + if std::mem::take(&mut vm.entered) { + // The built-in went on in a frame of its own: its result is the call's. + if let Some(inner) = vm.frames.last_mut() { + inner.argc = counted as u32; + } + vm.host.meter.bytecode = false; + let me = vm.frames.len() - 2; + vm.frames[me].argc = 0; + fr.set_index(vm, PHASE, WAITING); + return Ok(Step::Pushed); + } + Ok(Step::Done(r?)) +} diff --git a/packages/codemode-rust/crates/psychoscript/src/convert.rs b/packages/codemode-rust/crates/psychoscript/src/convert.rs new file mode 100644 index 0000000000000..aab005aac0c07 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/convert.rs @@ -0,0 +1,1639 @@ +//! Crossing the host boundary as JSON copies, `JSON.stringify`/`JSON.parse`, and console formatting. + +use std::fmt::Write as _; + +use crate::object::*; + +use crate::value::{Id, Slot, Value, write_num}; +use crate::vm::{Res, Vm}; +use crate::{DiagnosticKind, Json}; + +pub const MAX_VALUE_DEPTH: usize = 32; + +/// A string of the result as run text (a carrier keeps unpaired surrogates: see `strings`), which `Data` decodes +/// once the result has crossed. +pub(crate) fn host_string(vm: &Vm, s: crate::strings::StrId) -> String { + vm.text(s).to_owned() +} + +/// Host data as a fresh program value, its strings exactly as the host gave them. +pub fn from_data(vm: &mut Vm, d: &crate::Data) -> Value { + use crate::Data; + match d { + Data::Null => Value::Null, + Data::Bool(b) => Value::Bool(*b), + Data::Number(n) => Value::Num(n.as_f64().unwrap_or(f64::NAN)), + Data::String(s) => vm.string_val(s.to_run_text()), + Data::Array(items) => { + let vals = items.iter().map(|i| from_data(vm, i)).collect(); + vm.new_array(vals) + } + Data::Object(fields) => { + let id = vm.new_object(); + for (k, v) in fields { + let val = from_data(vm, v); + let a = vm.atoms.intern(&k.to_run_text()); + vm.define(id, a, val); + } + Value::Obj(id) + } + } +} + +pub(crate) fn json_number(n: f64) -> Json { + if n.fract() == 0.0 && n.abs() < 9.2e18 { + return Json::from(n as i64); + } + serde_json::Number::from_f64(n) + .map(Json::Number) + .unwrap_or(Json::Null) +} + +/// A program value as the host sees it: what `JSON.stringify` would serialize, plus the boundary table. +pub fn to_json(vm: &mut Vm, v: &Value) -> Result { + let mut stack = Vec::new(); + Ok(to_json_inner(vm, v, Key::Empty, &mut stack)?.unwrap_or(Json::Null)) +} + +fn to_json_inner( + vm: &mut Vm, + v: &Value, + key: Key, + stack: &mut Vec, +) -> Result, Value> { + let v = apply_to_json(vm, v, key, None)?; + let v = crate::builtins::exotic::json_value(vm, &v, true)?; + Ok(Some(match &v { + Value::Null => Json::Null, + Value::Bool(b) => Json::Bool(*b), + Value::Num(n) => json_number(*n), + Value::Str(s) => Json::String(host_string(vm, *s)), + Value::Undef | Value::Uninit | Value::Sym(_) => return Ok(None), + Value::Obj(id) => { + let id = *id; + if vm.heap[id as usize].is_callable() { + return Ok(None); + } + if stack.contains(&id) { + return Err(vm.type_error("Converting circular structure to JSON")); + } + if stack.len() >= MAX_VALUE_DEPTH { + return Err(invalid_data(vm, "Data is nested more than 32 levels deep.")); + } + stack.push(id); + vm.densify(id)?; + let out = match &vm.heap[id as usize].kind { + Kind::Array(items) => { + let items = items.clone(); + let mut out = Vec::with_capacity(items.len()); + for (i, item) in items.iter().enumerate() { + out.push( + to_json_inner(vm, item, Key::Index(i), stack)?.unwrap_or(Json::Null), + ); + } + Json::Array(out) + } + Kind::Set(m) => { + let items: Vec = m.iter().map(|(k, _)| *k).collect(); + let mut out = Vec::with_capacity(items.len()); + for (i, item) in items.iter().enumerate() { + out.push( + to_json_inner(vm, item, Key::Index(i), stack)?.unwrap_or(Json::Null), + ); + } + Json::Array(out) + } + Kind::Error(_) => { + let mut map = serde_json::Map::new(); + let (name, message) = error_parts(vm, id); + map.insert("name".into(), Json::String(name)); + map.insert("message".into(), Json::String(message)); + for (k, val) in vm.own_entries(id) { + let ks = vm.atoms.text(k).to_owned(); + if ks == "__proto__" || ks == "name" || ks == "message" { + continue; + } + if let Some(j) = to_json_inner(vm, &val, Key::Atom(k), stack)? { + map.insert(ks, j); + } + } + Json::Object(map) + } + Kind::Ordinary | Kind::Arguments(_) => { + let mut map = serde_json::Map::new(); + for (k, val) in vm.own_entries(id) { + if vm.atoms.text(k) == "__proto__" { + continue; + } + if let Some(j) = to_json_inner(vm, &val, Key::Atom(k), stack)? { + map.insert(host_string(vm, vm.atoms.atom_str(k)), j); + } + } + Json::Object(map) + } + _ => Json::Object(serde_json::Map::new()), + }; + stack.pop(); + out + } + })) +} + +fn invalid_data(vm: &mut Vm, msg: &str) -> Value { + let p = vm.realm.type_error_proto; + vm.failure(p, msg, DiagnosticKind::InvalidDataValue) +} + +/// The key a value is serialized under, materialized only when a `toJSON` or replacer needs it. +#[derive(Clone, Copy)] +pub enum Key { + Empty, + Index(usize), + Atom(Atom), +} + +fn key_value(vm: &mut Vm, key: Key) -> Value { + match key { + Key::Empty => vm.static_str(""), + Key::Index(i) => vm.string_val(i.to_string()), + Key::Atom(a) => vm.atom_val(a), + } +} + +fn apply_to_json(vm: &mut Vm, v: &Value, key: Key, mode: Option<&Mode>) -> Res { + if let Value::Obj(id) = v + && !matches!( + vm.heap[*id as usize].kind, + Kind::Promise(_) + | Kind::Closure(_) + | Kind::Native { .. } + | Kind::Bound(_) + | Kind::Namespace(_) + ) + { + let k = vm.names.to_json; + let f = vm.get_obj(*id, k); + if vm.is_callable(&f) { + // The native walk calls only Date's and URL's own; any other makes it start over as the internal walk. + if let Some(mode) = mode + && !native_to_json(vm, &f) + { + mode.restart.set(true); + return Ok(Value::Undef); + } + let kv = key_value(vm, key); + return vm.call(&f, *v, &[kv]); + } + } + Ok(*v) +} + +pub fn error_parts(vm: &mut Vm, id: Id) -> (String, String) { + let (nk, mk) = (vm.names.name, vm.names.message); + let name = match vm.peek(id, nk) { + Value::Undef => "Error".to_owned(), + v => vm.quiet_string(&v), + }; + let message = match vm.peek(id, mk) { + Value::Undef => String::new(), + v => vm.quiet_string(&v), + }; + (name, message) +} + +/// `Error.prototype.toString`. +pub fn error_to_string(vm: &mut Vm, id: Id) -> String { + let (name, message) = error_parts(vm, id); + if message.is_empty() { + return name; + } + if name.is_empty() { + return message; + } + format!("{name}: {message}") +} + +// ---------- JSON.stringify ---------- + +pub struct Stringify { + pub indent: String, + pub replacer_fn: Option, + pub allow: Option>, +} + +/// How `JSON.stringify` runs in the reference, for its fuel: a native walk, or its internal bytecode walk +/// (`$vmJsonWalk`), which a replacer, a property list, a `toJSON` other than Date's and URL's, a promise, or more than +/// `REVISITS` visits of objects it has seen already need. The native walk (`write_json`, which calls no program code) +/// stops (`restart`) at the first value that needs the other, before it calls anything, and the stringify starts over +/// as that walk, which runs in a native frame (`stringify_step`). +struct Mode { + restart: std::cell::Cell, + /// The stamp of a native walk (see `Vm::start_json_walk`); one nested in another keeps the objects it has seen. + stamp: u32, + seen: std::cell::RefCell>, + revisits: std::cell::Cell, +} + +/// The visits of objects seen already the reference's native walk allows (its `VISIT_BUDGET`): it gives up at the +/// last. +const REVISITS: u32 = 2048; + +impl Mode { + fn new(vm: &mut Vm) -> Self { + Self { + restart: std::cell::Cell::new(false), + stamp: vm.start_json_walk().unwrap_or(0), + seen: Default::default(), + revisits: std::cell::Cell::new(REVISITS), + } + } + + /// Counts a native walk's visit of `id`; whether the walk gives up there. A function is not counted, and a promise + /// makes the walk give up anyway. + #[inline(always)] + fn revisited(&self, vm: &mut Vm, id: Id) -> bool { + let first = if self.stamp != 0 { + let o = &mut vm.heap[id as usize]; + std::mem::replace(&mut o.visit, self.stamp) != self.stamp + } else { + self.seen.borrow_mut().insert(id) + }; + if first + || vm.heap[id as usize].is_callable() + || matches!(vm.heap[id as usize].kind, Kind::Promise(_)) + { + return false; + } + let left = self.revisits.get() - 1; + self.revisits.set(left); + left == 0 + } + + /// Ends the walk, so another native walk may stamp objects. + fn end(&self, vm: &mut Vm) { + if self.stamp != 0 { + vm.json_walk = 0; + } + } +} + +/// `JSON.stringify` on the reference's native walk: its result (`None` for undefined), or `None` when it needs the +/// internal walk (`enter_stringify`). +pub fn stringify( + vm: &mut Vm, + v: &Value, + opts: &Stringify, +) -> Result>, Value> { + if opts.replacer_fn.is_some() || opts.allow.is_some() { + return Ok(None); + } + let mode = Mode::new(vm); + let out = stringify_in(vm, v, opts, &mode); + mode.end(vm); + let out = out?; + Ok(if mode.restart.get() { None } else { Some(out) }) +} + +fn stringify_in( + vm: &mut Vm, + v: &Value, + opts: &Stringify, + mode: &Mode, +) -> Result, Value> { + let mut out = String::new(); + let mut stack = Vec::new(); + // The holder `{ "": v }` the reference makes, though nothing here reads it. + let holder = vm.new_object(); + let empty = vm.atoms.intern_static(""); + vm.define(holder, empty, *v); + let ok = write_json(vm, &mut out, Key::Empty, *v, opts, mode, &mut stack, "")?; + Ok(if ok { Some(out) } else { None }) +} + +/// Whether `f` is Date's or URL's own `toJSON`, which the reference's native walk applies itself. +fn native_to_json(vm: &mut Vm, f: &Value) -> bool { + let k = vm.names.to_json; + let (date, url) = (vm.realm.std.date, vm.realm.std.url); + [date, url] + .into_iter() + .filter(|p| *p != 0) + .any(|p| matches!((vm.get_obj(p, k), f), (Value::Obj(a), Value::Obj(b)) if a == *b)) +} + +/// The native walk: writes `v` (`holder[key]`) and says whether it wrote anything. +#[allow(clippy::too_many_arguments)] +fn write_json( + vm: &mut Vm, + out: &mut String, + key: Key, + v: Value, + opts: &Stringify, + mode: &Mode, + stack: &mut Vec, + gap: &str, +) -> Result { + if mode.restart.get() { + return Ok(false); + } + // Every value is checked, a primitive too: the native walk stops past depth 32. + if stack.len() > 32 { + return Err(vm.range_error("Value exceeds the maximum depth of 32.")); + } + if let Value::Obj(id) = v + && mode.revisited(vm, id) + { + mode.restart.set(true); + return Ok(false); + } + // Program getters run in the internal walk, as the reference's fast path leaves them to its prelude walk. + if let Value::Obj(id) = v { + let (tk, nk, mk) = (vm.names.to_json, vm.names.name, vm.names.message); + if vm.heap[id as usize].flags & ACCESSORS != 0 + || vm.has_program_getter(id, tk) + || (matches!(vm.heap[id as usize].kind, Kind::Error(_)) + && (vm.has_program_getter(id, nk) || vm.has_program_getter(id, mk))) + { + mode.restart.set(true); + return Ok(false); + } + } + let mut v = apply_to_json(vm, &v, key, Some(mode))?; + if crate::builtins::exotic::may_have_json_forms(vm) { + let headers = + matches!(v, Value::Obj(id) if matches!(vm.heap[id as usize].kind, Kind::Headers(_))); + v = crate::builtins::exotic::json_value(vm, &v, false)?; + // Headers are JSON of their own in the reference, a record of their entries: neither the replacer nor the + // walk reaches inside, though a property list still picks among them. + if headers { + let mode = Mode::new(vm); + let r = write_json(vm, out, key, v, opts, &mode, stack, gap); + mode.end(vm); + return r; + } + } + match &v { + Value::Null => out.push_str("null"), + Value::Bool(b) => out.push_str(if *b { "true" } else { "false" }), + Value::Num(n) => write_number(out, *n), + Value::Str(s) => quote_str(vm, out, *s), + // The reference's walk takes a symbol for an object with no fields. + Value::Sym(_) => out.push_str("{}"), + Value::Undef | Value::Uninit => return Ok(false), + Value::Obj(id) => { + let id = *id; + if vm.heap[id as usize].is_callable() { + return Ok(false); + } + if matches!(vm.heap[id as usize].kind, Kind::Promise(_)) { + mode.restart.set(true); + return Ok(false); + } + if stack.contains(&id) { + return Err(vm.type_error("Converting circular structure to JSON")); + } + if stack.len() > 512 { + return Err(vm.range_error("Maximum call stack size exceeded")); + } + stack.push(id); + let inner = format!("{gap}{}", opts.indent); + let is_array = matches!(vm.heap[id as usize].kind, Kind::Array(_)); + if is_array { + vm.densify(id)?; + let len = match &vm.heap[id as usize].kind { + Kind::Array(items) => items.len(), + _ => 0, + }; + if len == 0 { + out.push_str("[]"); + } else { + out.push('['); + for i in 0..len { + if i > 0 { + out.push(','); + } + if !opts.indent.is_empty() { + out.push('\n'); + out.push_str(&inner); + } + let item = array_item(vm, id, i); + if !write_json(vm, out, Key::Index(i), item, opts, mode, stack, &inner)? { + out.push_str("null"); + } + } + if !opts.indent.is_empty() { + out.push('\n'); + out.push_str(gap); + } + out.push(']'); + } + } else { + let entries = json_entries(vm, id, opts.allow.as_deref()); + out.push('{'); + let mut first = true; + for (k, val) in entries { + let mark = out.len(); + if !first { + out.push(','); + } + if !opts.indent.is_empty() { + out.push('\n'); + out.push_str(&inner); + } + quote_str(vm, out, vm.atoms.atom_str(k)); + out.push(':'); + if !opts.indent.is_empty() { + out.push(' '); + } + if write_json(vm, out, Key::Atom(k), val, opts, mode, stack, &inner)? { + first = false; + } else { + out.truncate(mark); + } + } + if !first && !opts.indent.is_empty() { + out.push('\n'); + out.push_str(gap); + } + out.push('}'); + } + stack.pop(); + } + } + if out.len() > crate::ops::MAX_STRING_LEN { + return Err(vm.range_error("Invalid string length")); + } + Ok(true) +} + +#[inline(always)] +fn write_number(out: &mut String, n: f64) { + if n.fract() == 0.0 && n.abs() < 9_007_199_254_740_992.0 { + write_int(out, n); + } else if n.is_finite() { + write_num(out, n); + } else { + out.push_str("null"); + } +} + +/// Writes a safe integer as `write_num` does, without the formatting machinery. +fn write_int(out: &mut String, n: f64) { + if n < 0.0 { + out.push('-'); + } + out.push_str(digits(&mut [0; 20], n.abs() as u64)); +} + +/// The decimal digits of `n`, written into `buf`. +fn digits(buf: &mut [u8; 20], n: u64) -> &str { + let mut rest = n; + let mut at = buf.len(); + loop { + at -= 1; + buf[at] = b'0' + (rest % 10) as u8; + rest /= 10; + if rest == 0 { + break; + } + } + std::str::from_utf8(&buf[at..]).unwrap_or_default() +} + +/// The element at `i` of the dense array `id`, a hole as undefined. +#[inline(always)] +fn array_item(vm: &Vm, id: Id, i: usize) -> Value { + match &vm.heap[id as usize].kind { + Kind::Array(items) => match items.get(i) { + Some(Value::Uninit) | None => Value::Undef, + Some(v) => *v, + }, + _ => Value::Undef, + } +} + +/// The properties an object serializes, in order: an error's name and message first, then its own entries; only the +/// listed ones, in the list's order, when there is a property list. +fn json_entries(vm: &mut Vm, id: Id, allow: Option<&[Atom]>) -> Vec<(Atom, Value)> { + let entries: Vec<(Atom, Value)> = match &vm.heap[id as usize].kind { + Kind::Error(_) => { + let (name, message) = error_parts(vm, id); + let (nk, mk) = (vm.names.name, vm.names.message); + let (name, message) = (vm.string_val(name), vm.string_val(message)); + let mut e = vec![(nk, name), (mk, message)]; + e.extend( + vm.own_entries(id) + .into_iter() + .filter(|(k, _)| *k != nk && *k != mk), + ); + e + } + Kind::Ordinary | Kind::Arguments(_) => vm.own_entries(id), + _ => Vec::new(), + }; + match allow { + Some(allow) => allow + .iter() + .filter_map(|k| entries.iter().find(|(e, _)| e == k).cloned()) + .collect(), + None => entries, + } +} + +// ---------- JSON.stringify's internal walk ---------- + +/// The current key's atom as the walk keeps it in `J_ATOM`. A number holds no atom alive, but `J_KEY` always holds +/// the same key as its atom's string, which does. +fn atom_slot(a: Atom) -> Value { + Value::Num(a as f64) +} + +/// Pushes the reference's `$JsonNames` off the host boundary as atoms (an error's name and message first, then the own +/// keys), or with a property list the listed ones it has, in the list's order: how many. +fn push_walk_keys(vm: &mut Vm, id: Id, allow: Option) -> usize { + let (nk, mk) = (vm.names.name, vm.names.message); + let start = vm.stack.len(); + match vm.heap[id as usize].kind { + Kind::Error(_) => { + let rest = vm.own_keys(id).into_iter().filter(|k| *k != nk && *k != mk); + let keys: Vec = [nk, mk].into_iter().chain(rest).collect(); + vm.stack + .extend(keys.into_iter().map(|k| key_slot(&vm.atoms, k))); + } + Kind::Ordinary => { + // Without index keys, the own keys are the enumerable string-keyed properties in their order. + let props = &vm.heap[id as usize].props.items; + if props.iter().all(|p| vm.atoms.index(p.key).is_none()) { + vm.stack.extend( + props + .iter() + .filter(|p| p.flags & ENUMERABLE != 0 && p.key > SYM_ASYNC_ITERATOR) + .map(|p| key_slot(&vm.atoms, p.key)), + ); + } else { + let keys = vm.own_keys(id); + vm.stack + .extend(keys.into_iter().map(|k| key_slot(&vm.atoms, k))); + } + } + Kind::Arguments(_) => { + let keys = vm.own_keys(id); + vm.stack + .extend(keys.into_iter().map(|k| key_slot(&vm.atoms, k))); + } + _ => {} + } + // The property list holds the keys' atoms' strings, as the keys do. + if let Some(allow) = allow { + let own = vm.stack.split_off(start); + if let Kind::Array(listed) = &vm.heap[allow as usize].kind { + vm.stack.extend( + listed + .iter() + .map(|k| Slot::pack(*k)) + .filter(|k| own.contains(k)), + ); + } + } + vm.stack.len() - start +} + +/// A key as the walk's slots keep it: its atom's string, which keeps the atom alive while the walk holds it. +fn key_slot(atoms: &crate::strings::Strings, a: Atom) -> Slot { + Slot::pack(Value::Str(atoms.atom_str(a))) +} + +// The slots of the internal walk's frame: the replacer (or undefined), the property list (an internal array of its +// keys' atoms' strings, or undefined), the indent (undefined for none), the output written before the last call (an +// internal byte buffer, or undefined), and how many containers deep the walk is; then the value it visits +// (`holder[key]`, the key a number for an array's element, the value read once the visit starts), what the call it +// waits on is for, and the key's atom off an array; then, per container, an object's keys (as their atoms' strings, so +// the collector sees them), then the container, whether it is an +// object (undefined for an array), how many children it has, the next one, and whether none was written yet. The +// innermost container's slots are the top of the frame's stack whenever a step runs. +const J_F: usize = 0; +const J_ALLOW: usize = 1; +const J_INDENT: usize = 2; +const J_OUT: usize = 3; +const J_DEPTH: usize = 4; +const J_HOLDER: usize = 5; +const J_KEY: usize = 6; +const J_VAL: usize = 7; +const J_PHASE: usize = 8; +const J_ATOM: usize = 9; +const LEVEL: usize = 5; +const L_ID: usize = 0; +const L_OBJECT: usize = 1; +const L_N: usize = 2; +const L_I: usize = 3; +const L_FIRST: usize = 4; + +/// What the walk's call returns to: the value's `toJSON`, or the replacer. +const TO_JSON: usize = 0; +const REPLACED: usize = 1; +/// A program getter `holder[key]` met, whose value is the one visited. +const GOT: usize = 2; + +/// Where a step of the internal walk is. +#[derive(Clone, Copy)] +enum Stage { + /// The value's depth check and `toJSON`. + Visit, + /// The value read (`J_VAL`): its promise check and `toJSON`. + Check, + /// The replacer. + Replace, + /// Writing the value, or entering it. + Emit, + /// The innermost container goes on to its next child, or ends. + Child, + /// A value was visited, written or not; its container goes on. + After(bool), +} + +/// Pushes the frame of `JSON.stringify`'s internal walk over `v`, after `JSON.stringify`'s own call: `$vmJsonVisitor`, +/// the root `visit` generator and its first `next`. Each value then costs what `visit` spends (see `builtins/fuel.rs`). +pub fn enter_stringify(vm: &mut Vm, callee: Id, v: Value, opts: Stringify) -> Res { + vm.fuel(crate::vm::NATIVE_FUEL); + vm.fuel(1); + vm.fuel(1); + vm.fuel(crate::vm::NATIVE_FUEL); + let holder = vm.new_object(); + let empty = vm.atoms.intern_static(""); + vm.define(holder, empty, v); + let allow = match opts.allow { + Some(allow) => { + let keys = allow.into_iter().map(|a| vm.atom_val(a)).collect(); + vm.new_array(keys) + } + None => Value::Undef, + }; + let indent = if opts.indent.is_empty() { + Value::Undef + } else { + vm.string_val(opts.indent) + }; + let key = vm.atom_val(empty); + let slots = [ + opts.replacer_fn.unwrap_or_default(), + allow, + indent, + Value::Undef, + Value::Num(0.0), + Value::Obj(holder), + key, + Value::Undef, + Value::Num(0.0), + atom_slot(empty), + ]; + vm.enter_native_sub( + crate::native::NativeOp::Callbacks, + crate::builtins::object::SUB_STRINGIFY, + callee, + Value::Undef, + &slots, + ) +} + +/// The step of the internal walk: it writes what it can, and keeps what it wrote in its slots before each call of a +/// `toJSON` or the replacer. A key and its separator are written only once the value under it is known to be written, +/// so nothing written has to be taken back. +pub(crate) fn stringify_step( + vm: &mut Vm, + fr: crate::native::Frame, + input: crate::native::Input, +) -> Result { + // The text a step writes before it keeps it in the frame's buffer; its capacity is reused by the next step, as a + // replacer makes a step per value. + thread_local! { + static SCRATCH: std::cell::Cell = const { std::cell::Cell::new(String::new()) }; + } + let mut out = SCRATCH.take(); + let r = stringify_walk(vm, fr, input, &mut out); + out.clear(); + SCRATCH.set(out); + r +} + +fn stringify_walk( + vm: &mut Vm, + fr: crate::native::Frame, + input: crate::native::Input, + out: &mut String, +) -> Result { + use crate::native::{Input, Step}; + let indent = match fr.get(vm, J_INDENT) { + Value::Str(s) => vm.text(s).to_owned(), + _ => String::new(), + }; + let mut stage = match input { + Input::Start => Stage::Visit, + Input::Returned(r) => { + fr.set_slot(vm, J_VAL, r); + match fr.index(vm, J_PHASE) { + TO_JSON => Stage::Replace, + GOT => Stage::Check, + _ => Stage::Emit, + } + } + Input::Threw(e) => return Err(e), + Input::Finished(_) => return Ok(Step::Done(Value::Undef)), + }; + loop { + let depth = fr.index(vm, J_DEPTH); + stage = match stage { + Stage::Visit => { + // `$Throw` in `visit`, a native that throws and so costs nothing. + if depth > 100 { + return Err(vm.range_error("Value exceeds the maximum depth of 100.")); + } + // `holder[key]`, read as the walk reaches it. + let (holder, key) = (fr.get(vm, J_HOLDER), fr.get(vm, J_KEY)); + vm.op_access = true; + let v = match key { + Value::Num(_) => vm.get_elem(&holder, &key), + _ => { + let atom = fr.index(vm, J_ATOM) as Atom; + match plain_prop(vm, fr, holder, atom, depth) { + Some(v) => Ok(v), + None => vm.get(&holder, atom), + } + } + }; + vm.op_access = false; + let v = v?; + if let Some(g) = vm.getter_hit.take() { + flush(vm, fr, out); + fr.set_index(vm, J_PHASE, GOT); + return fr.call_slots(vm, Slot::pack(g), Slot::pack(holder), []); + } + fr.set(vm, J_VAL, v); + Stage::Check + } + Stage::Check => { + let v = fr.get(vm, J_VAL); + if matches!(v, Value::Obj(id) if matches!(vm.heap[id as usize].kind, Kind::Promise(_))) + { + return Err(vm.invalid_data( + "JSON.stringify received an un-awaited Promise; await it first - e.g. `const result = await \ + load(...)`.", + )); + } + if let Value::Obj(id) = v + && !matches!( + vm.heap[id as usize].kind, + Kind::Closure(_) + | Kind::Native { .. } + | Kind::Bound(_) + | Kind::Namespace(_) + ) + { + let k = vm.names.to_json; + let f = vm.get_calling(id, k)?; + if vm.is_callable(&f) { + let kv = walk_key(vm, fr); + flush(vm, fr, out); + fr.set_index(vm, J_PHASE, TO_JSON); + return fr.call_slots(vm, Slot::pack(f), Slot::pack(v), [Slot::pack(kv)]); + } + } + Stage::Replace + } + Stage::Replace => { + let f = fr.slot(vm, J_F); + if f.obj().is_none() { + Stage::Emit + } else { + let kv = walk_key(vm, fr); + flush(vm, fr, out); + fr.set_index(vm, J_PHASE, REPLACED); + let (holder, v) = (fr.slot(vm, J_HOLDER), fr.slot(vm, J_VAL)); + return fr.call_slots(vm, f, holder, [Slot::pack(kv), v]); + } + } + Stage::Emit => emit(vm, fr, out, &indent, depth)?, + Stage::Child => child(vm, fr, out, &indent, depth)?, + Stage::After(written) => { + if depth == 0 { + let buf = fr.get(vm, J_OUT).as_obj(); + let text = match buf.map(|b| &mut vm.heap[b as usize].kind) { + Some(Kind::Bytes(b)) => { + let mut bytes = std::mem::take(&mut *b.bytes()); + b.len = 0; + bytes.extend_from_slice(out.as_bytes()); + // Only whole strings were written to it. + String::from_utf8(bytes).unwrap_or_default() + } + _ => std::mem::take(out), + }; + vm.bytecode_builtin(); + return Ok(Step::Done(if written { + vm.string_val(text) + } else { + Value::Undef + })); + } + let at = top(vm, fr); + if fr.slot(vm, at + L_OBJECT) == Slot::UNDEF { + if !written { + out.push_str("null"); + } + } else if written { + fr.set_index(vm, at + L_FIRST, 0); + // `$Define` of the property. + vm.fuel(crate::vm::NATIVE_FUEL); + } + vm.fuel(1); + let i = fr.index(vm, at + L_I); + fr.set_index(vm, at + L_I, i + 1); + Stage::Child + } + }; + } +} + +/// Where the innermost container's slots start in the frame: at the top of its stack. +#[inline(always)] +fn top(vm: &Vm, fr: crate::native::Frame) -> usize { + vm.stack.len() - fr.base() - LEVEL +} + +/// The containers the walk is in, innermost first, off the frame's stack. +fn open_containers(stack: &[Slot], depth: usize) -> impl Iterator + '_ { + let mut end = stack.len(); + (0..depth).map(move |_| { + let at = end - LEVEL; + let keys = if stack[at + L_OBJECT] == Slot::UNDEF { + 0 + } else { + stack[at + L_N].f() as usize + }; + end = at - keys; + stack[at + L_ID].obj().unwrap_or(0) + }) +} + +/// `holder[atom]` for an ordinary object whose own property at the child's position is that key's plain value, as +/// it is when every own key serializes: the read without a search. +#[inline(always)] +fn plain_prop( + vm: &Vm, + fr: crate::native::Frame, + holder: Value, + atom: Atom, + depth: usize, +) -> Option { + let Value::Obj(id) = holder else { + return None; + }; + let o = &vm.heap[id as usize]; + if depth == 0 || !matches!(o.kind, Kind::Ordinary) { + return None; + } + let p = o.props.items.get(fr.index(vm, top(vm, fr) + L_I))?; + (p.key == atom && p.flags & ACCESSOR == 0 && !matches!(p.value, Value::Uninit)) + .then_some(p.value) +} + +/// The key of the value the walk visits, as a `toJSON` or the replacer receives it. +fn walk_key(vm: &mut Vm, fr: crate::native::Frame) -> Value { + match fr.get(vm, J_KEY) { + // An index's string, interned: an array's keys repeat from one array to the next. + Value::Num(i) => vm.static_str(digits(&mut [0; 20], i as u64)), + k => k, + } +} + +/// Keeps what the step wrote in the frame's slots, before a call: in a byte buffer the frame owns. +fn flush(vm: &mut Vm, fr: crate::native::Frame, out: &mut String) { + if out.is_empty() { + return; + } + let buf = match fr.get(vm, J_OUT).as_obj() { + Some(b) => b, + None => { + let bytes = crate::builtins::bytes::Bytes::new(Vec::new(), false); + let b = vm.alloc(Obj::new(None, Kind::Bytes(Box::new(bytes)))); + fr.set(vm, J_OUT, Value::Obj(b)); + b + } + }; + if let Kind::Bytes(b) = &mut vm.heap[buf as usize].kind { + b.bytes().extend_from_slice(out.as_bytes()); + b.len += out.len(); + } + out.clear(); +} + +/// How much the walk wrote before the last call. +fn flushed(vm: &Vm, fr: crate::native::Frame) -> usize { + match fr + .get(vm, J_OUT) + .as_obj() + .map(|b| &vm.heap[b as usize].kind) + { + Some(Kind::Bytes(b)) => b.len, + _ => 0, + } +} + +/// The length check after each value written, on all the walk has written. +fn check_length(vm: &mut Vm, fr: crate::native::Frame, out: &str) -> Result<(), Value> { + if flushed(vm, fr) + out.len() > crate::ops::MAX_STRING_LEN { + return Err(vm.range_error("Invalid string length")); + } + Ok(()) +} + +/// A new line indented `depth` times. +fn write_indent(out: &mut String, indent: &str, depth: usize) { + out.push('\n'); + for _ in 0..depth { + out.push_str(indent); + } +} + +/// Writes what goes before a value in an object: the separator, the indent, the key and the colon. +fn write_prefix(vm: &Vm, fr: crate::native::Frame, out: &mut String, indent: &str, depth: usize) { + if depth == 0 { + return; + } + let at = top(vm, fr); + if fr.slot(vm, at + L_OBJECT) == Slot::UNDEF { + return; + } + if fr.index(vm, at + L_FIRST) == 0 { + out.push(','); + } + if !indent.is_empty() { + write_indent(out, indent, depth); + } + if let Value::Str(k) = fr.get(vm, J_KEY) { + quote_str(vm, out, k); + } + out.push(':'); + if !indent.is_empty() { + out.push(' '); + } +} + +/// The value the walk visits, after its `toJSON` and the replacer: written, or entered when it is a container. +fn emit( + vm: &mut Vm, + fr: crate::native::Frame, + out: &mut String, + indent: &str, + depth: usize, +) -> Result { + let mut v = fr.get(vm, J_VAL); + if crate::builtins::exotic::may_have_json_forms(vm) { + let headers = + matches!(v, Value::Obj(id) if matches!(vm.heap[id as usize].kind, Kind::Headers(_))); + v = crate::builtins::exotic::json_value(vm, &v, false)?; + // Headers are JSON of their own in the reference, a record of their entries: neither the replacer nor the + // walk reaches inside, though a property list still picks among them. They are written on the native walk. + if headers { + return emit_headers(vm, fr, out, indent, depth, v); + } + } + match v { + Value::Null => out_value(vm, fr, out, indent, depth, |_, out| out.push_str("null")), + Value::Bool(b) => out_value(vm, fr, out, indent, depth, |_, out| { + out.push_str(if b { "true" } else { "false" }) + }), + Value::Num(n) => out_value(vm, fr, out, indent, depth, |_, out| write_number(out, n)), + Value::Str(s) => out_value(vm, fr, out, indent, depth, |vm, out| quote_str(vm, out, s)), + Value::Undef | Value::Uninit => Ok(Stage::After(false)), + // `$JsonSpecial` of a value that is not an object: an empty object. + Value::Sym(_) => out_value(vm, fr, out, indent, depth, |_, out| out.push_str("{}")), + Value::Obj(id) => { + if vm.heap[id as usize].is_callable() { + return Ok(Stage::After(false)); + } + if open_containers(&vm.stack, depth).any(|c| c == id) { + return Err(vm.type_error("Converting circular structure to JSON.")); + } + write_prefix(vm, fr, out, indent, depth); + let (object, n) = if matches!(vm.heap[id as usize].kind, Kind::Array(_)) { + vm.densify(id)?; + let len = match &vm.heap[id as usize].kind { + Kind::Array(items) => items.len(), + _ => 0, + }; + if len == 0 { + out.push_str("[]"); + check_length(vm, fr, out)?; + return Ok(Stage::After(true)); + } + out.push('['); + (Slot::UNDEF, len) + } else { + let allow = fr.slot(vm, J_ALLOW).obj(); + let n = push_walk_keys(vm, id, allow); + out.push('{'); + (Slot::index(1), n) + }; + vm.stack.extend_from_slice(&[ + Slot::pack(Value::Obj(id)), + object, + Slot::index(n), + Slot::index(0), + Slot::index(1), + ]); + fr.set_index(vm, J_DEPTH, depth + 1); + Ok(Stage::Child) + } + } +} + +/// Writes a primitive the walk visits. +fn out_value( + vm: &mut Vm, + fr: crate::native::Frame, + out: &mut String, + indent: &str, + depth: usize, + write: impl FnOnce(&Vm, &mut String), +) -> Result { + write_prefix(vm, fr, out, indent, depth); + write(vm, out); + check_length(vm, fr, out)?; + Ok(Stage::After(true)) +} + +/// The property list's keys. +fn allow_list(vm: &mut Vm, fr: crate::native::Frame) -> Option> { + let id = fr.get(vm, J_ALLOW).as_obj()?; + let keys = match &vm.heap[id as usize].kind { + Kind::Array(items) => items.clone(), + _ => Vec::new(), + }; + Some( + keys.iter() + .filter_map(|k| match k { + Value::Str(s) => Some(vm.atoms.intern_id(*s)), + _ => None, + }) + .collect(), + ) +} + +/// Headers the walk visits, as the record of entries `json_value` made of them, written on the native walk. +fn emit_headers( + vm: &mut Vm, + fr: crate::native::Frame, + out: &mut String, + indent: &str, + depth: usize, + v: Value, +) -> Result { + let mark = out.len(); + write_prefix(vm, fr, out, indent, depth); + let plain = Stringify { + indent: indent.to_owned(), + replacer_fn: None, + allow: allow_list(vm, fr), + }; + let mut stack: Vec = open_containers(&vm.stack, depth).collect(); + stack.reverse(); + let mode = Mode::new(vm); + let r = write_json( + vm, + out, + Key::Empty, + v, + &plain, + &mode, + &mut stack, + &indent.repeat(depth), + ); + mode.end(vm); + if !r? { + out.truncate(mark); + return Ok(Stage::After(false)); + } + check_length(vm, fr, out)?; + Ok(Stage::After(true)) +} + +/// The innermost container's next child, as its loop in `visit` opens it, or the container's end. +fn child( + vm: &mut Vm, + fr: crate::native::Frame, + out: &mut String, + indent: &str, + depth: usize, +) -> Result { + let at = top(vm, fr); + let id = fr.slot(vm, at + L_ID).obj().unwrap_or(0); + let (i, n) = (fr.index(vm, at + L_I), fr.index(vm, at + L_N)); + let object = fr.slot(vm, at + L_OBJECT) != Slot::UNDEF; + if i >= n { + if !indent.is_empty() && (!object || fr.index(vm, at + L_FIRST) == 0) { + write_indent(out, indent, depth - 1); + } + out.push(if object { '}' } else { ']' }); + vm.stack + .truncate(fr.base() + at - if object { n } else { 0 }); + fr.set_index(vm, J_DEPTH, depth - 1); + check_length(vm, fr, out)?; + return Ok(Stage::After(true)); + } + let key = match object { + false => { + if i > 0 { + out.push(','); + } + if !indent.is_empty() { + write_indent(out, indent, depth); + } + // `String(i)`, the child `visit` generator, `yield*` opening it and its `next`. + vm.fuel(crate::vm::NATIVE_FUEL); + vm.fuel(1); + vm.fuel(crate::vm::NATIVE_FUEL); + vm.fuel(crate::vm::NATIVE_FUEL); + Value::Num(i as f64) + } + true => { + vm.fuel(1); + vm.fuel(crate::vm::NATIVE_FUEL); + vm.fuel(crate::vm::NATIVE_FUEL); + let key = fr.get(vm, at - n + i); + let atom = match key { + Value::Str(s) => vm.atoms.intern_id(s), + _ => 0, + }; + fr.set_index(vm, J_ATOM, atom as usize); + key + } + }; + fr.set(vm, J_HOLDER, Value::Obj(id)); + fr.set(vm, J_KEY, key); + Ok(Stage::Visit) +} + +/// Quotes text as JSON.stringify does, checking it for a carrier first. +pub fn quote(out: &mut String, s: &str) { + if crate::strings::has_mark(s) { + return quote_units(out, s); + } + quote_plain(out, s); +} + +/// Quotes a run's string, whose carrier flag says how. +#[inline] +fn quote_str(vm: &Vm, out: &mut String, s: crate::strings::StrId) { + if vm.atoms.is_wtf(s) { + quote_units(out, vm.text(s)); + } else { + quote_plain(out, vm.text(s)); + } +} + +/// Quotes text that is not a carrier. +#[inline(always)] +fn quote_plain(out: &mut String, s: &str) { + out.push('"'); + let bytes = s.as_bytes(); + let mut start = 0; + for (i, &b) in bytes.iter().enumerate() { + let esc = match b { + b'"' => "\\\"", + b'\\' => "\\\\", + b'\n' => "\\n", + b'\r' => "\\r", + b'\t' => "\\t", + 0x08 => "\\b", + 0x0c => "\\f", + 0..=0x1f => "", + _ => continue, + }; + out.push_str(&s[start..i]); + if esc.is_empty() { + let _ = write!(out, "\\u{:04x}", b); + } else { + out.push_str(esc); + } + start = i + 1; + } + out.push_str(&s[start..]); + out.push('"'); +} + +/// `quote` for a carrier text: a lone surrogate is written as a `\\u` escape, as well-formed JSON.stringify does. +#[cold] +#[inline(never)] +fn quote_units(out: &mut String, s: &str) { + out.push('"'); + for r in char::decode_utf16(crate::strings::units_of(s)) { + match r { + Ok('"') => out.push_str("\\\""), + Ok('\\') => out.push_str("\\\\"), + Ok('\n') => out.push_str("\\n"), + Ok('\r') => out.push_str("\\r"), + Ok('\t') => out.push_str("\\t"), + Ok('\u{8}') => out.push_str("\\b"), + Ok('\u{c}') => out.push_str("\\f"), + Ok(c) if (c as u32) < 0x20 => { + let _ = write!(out, "\\u{:04x}", c as u32); + } + Ok(c) => crate::strings::push_char(out, c), + Err(e) => { + let _ = write!(out, "\\u{:04x}", e.unpaired_surrogate()); + } + } + } + out.push('"'); +} + +// ---------- JSON.parse ---------- + +struct Parser<'s> { + s: &'s [u8], + text: &'s str, + i: usize, + depth: usize, +} + +pub fn parse(vm: &mut Vm, text: &str) -> Res { + let mut p = Parser { + s: text.as_bytes(), + text, + i: 0, + depth: 0, + }; + p.ws(); + let v = p.value(vm)?; + p.ws(); + if p.i < p.s.len() { + return Err(p.error(vm)); + } + Ok(v) +} + +impl<'s> Parser<'s> { + fn ws(&mut self) { + while self.i < self.s.len() && matches!(self.s[self.i], b' ' | b'\t' | b'\n' | b'\r') { + self.i += 1; + } + } + + /// The reference's `JSON.parse` passes on its host runtime's message. + fn error(&self, vm: &mut Vm) -> Value { + let why = crate::streaming::json_parse_error(self.text); + vm.syntax_error(&format!("JSON.parse received invalid JSON: {why}")) + } + + fn value(&mut self, vm: &mut Vm) -> Res { + let Some(&c) = self.s.get(self.i) else { + return Err(self.error(vm)); + }; + match c { + b'{' => { + self.depth += 1; + if self.depth > 512 { + return Err(vm.range_error("Maximum call stack size exceeded")); + } + self.i += 1; + let id = vm.new_object(); + self.ws(); + if self.s.get(self.i) == Some(&b'}') { + self.i += 1; + self.depth -= 1; + return Ok(Value::Obj(id)); + } + loop { + self.ws(); + if self.s.get(self.i) != Some(&b'"') { + return Err(self.error(vm)); + } + let k = self.string(vm)?; + self.ws(); + if self.s.get(self.i) != Some(&b':') { + return Err(self.error(vm)); + } + self.i += 1; + self.ws(); + let v = self.value(vm)?; + let a = vm.atoms.intern(&k); + vm.define(id, a, v); + self.ws(); + match self.s.get(self.i) { + Some(b',') => self.i += 1, + Some(b'}') => { + self.i += 1; + self.depth -= 1; + return Ok(Value::Obj(id)); + } + _ => return Err(self.error(vm)), + } + } + } + b'[' => { + self.depth += 1; + if self.depth > 512 { + return Err(vm.range_error("Maximum call stack size exceeded")); + } + self.i += 1; + let mut items = Vec::new(); + self.ws(); + if self.s.get(self.i) == Some(&b']') { + self.i += 1; + self.depth -= 1; + return Ok(vm.new_array(items)); + } + loop { + self.ws(); + items.push(self.value(vm)?); + self.ws(); + match self.s.get(self.i) { + Some(b',') => self.i += 1, + Some(b']') => { + self.i += 1; + self.depth -= 1; + return Ok(vm.new_array(items)); + } + _ => return Err(self.error(vm)), + } + } + } + b'"' => { + let s = self.string(vm)?; + Ok(vm.string_val(s)) + } + b't' if self.s[self.i..].starts_with(b"true") => { + self.i += 4; + Ok(Value::Bool(true)) + } + b'f' if self.s[self.i..].starts_with(b"false") => { + self.i += 5; + Ok(Value::Bool(false)) + } + b'n' if self.s[self.i..].starts_with(b"null") => { + self.i += 4; + Ok(Value::Null) + } + b'-' | b'0'..=b'9' => { + let start = self.i; + if self.s[self.i] == b'-' { + self.i += 1; + } + let int_start = self.i; + while self.i < self.s.len() && self.s[self.i].is_ascii_digit() { + self.i += 1; + } + if self.i == int_start || (self.s[int_start] == b'0' && self.i - int_start > 1) { + return Err(self.error(vm)); + } + if self.s.get(self.i) == Some(&b'.') { + self.i += 1; + let f = self.i; + while self.i < self.s.len() && self.s[self.i].is_ascii_digit() { + self.i += 1; + } + if self.i == f { + return Err(self.error(vm)); + } + } + if matches!(self.s.get(self.i), Some(b'e' | b'E')) { + self.i += 1; + if matches!(self.s.get(self.i), Some(b'+' | b'-')) { + self.i += 1; + } + let e = self.i; + while self.i < self.s.len() && self.s[self.i].is_ascii_digit() { + self.i += 1; + } + if self.i == e { + return Err(self.error(vm)); + } + } + Ok(Value::Num( + self.text[start..self.i].parse().unwrap_or(f64::NAN), + )) + } + _ => Err(self.error(vm)), + } + } + + fn string(&mut self, vm: &mut Vm) -> Result { + self.i += 1; + let mut out = String::new(); + let mut start = self.i; + loop { + let Some(&c) = self.s.get(self.i) else { + return Err(self.error(vm)); + }; + match c { + b'"' => { + out.push_str(&self.text[start..self.i]); + self.i += 1; + return Ok(out); + } + b'\\' => { + out.push_str(&self.text[start..self.i]); + self.i += 1; + let Some(&e) = self.s.get(self.i) else { + return Err(self.error(vm)); + }; + self.i += 1; + match e { + b'"' => out.push('"'), + b'\\' => out.push('\\'), + b'/' => out.push('/'), + b'b' => out.push('\u{8}'), + b'f' => out.push('\u{c}'), + b'n' => out.push('\n'), + b'r' => out.push('\r'), + b't' => out.push('\t'), + b'u' => { + let mut units = vec![self.hex4(vm)?]; + while (0xd800..0xdc00).contains(units.last().unwrap_or(&0)) + && self.s.get(self.i) == Some(&b'\\') + && self.s.get(self.i + 1) == Some(&b'u') + { + self.i += 2; + units.push(self.hex4(vm)?); + } + out.push_str(&crate::strings::from_units(&units)); + } + _ => { + self.i -= 1; + return Err(self.error(vm)); + } + } + start = self.i; + } + 0..=0x1f => return Err(self.error(vm)), + _ => self.i += 1, + } + } + } + + fn hex4(&mut self, vm: &mut Vm) -> Result { + let h = self + .text + .get(self.i..self.i + 4) + .and_then(|h| u16::from_str_radix(h, 16).ok()); + match h { + Some(v) => { + self.i += 4; + Ok(v) + } + None => Err(self.error(vm)), + } + } +} + +// ---------- console ---------- + +/// One value as `console.log` shows it. +pub fn format_value(vm: &mut Vm, v: &Value) -> String { + match v { + Value::Undef | Value::Uninit => "undefined".into(), + Value::Str(s) => vm.text(*s).to_owned(), + _ => { + let mut out = String::new(); + let mut seen = Vec::new(); + format_inner(vm, &mut out, v, &mut seen); + out + } + } +} + +fn format_inner(vm: &mut Vm, out: &mut String, v: &Value, seen: &mut Vec) { + match v { + Value::Undef | Value::Uninit | Value::Null => out.push_str("null"), + Value::Str(s) => quote_str(vm, out, *s), + Value::Num(n) => write_num(out, *n), + Value::Bool(b) => out.push_str(if *b { "true" } else { "false" }), + Value::Sym(s) => out.push_str(crate::ops::symbol_text(*s)), + Value::Obj(id) => { + let id = *id; + if seen.len() > MAX_VALUE_DEPTH { + out.push_str("..."); + return; + } + if seen.contains(&id) { + out.push_str("[Circular]"); + return; + } + seen.push(id); + match &vm.heap[id as usize].kind { + Kind::Array(items) => { + let items = items.clone(); + let _ = vm.densify(id); + let items = match &vm.heap[id as usize].kind { + Kind::Array(dense) if dense.len() != items.len() => dense.clone(), + _ => items, + }; + out.push('['); + for (i, item) in items.iter().enumerate() { + if i > 0 { + out.push(','); + } + // A hole prints as nothing, as in an array literal. + if !matches!(item, Value::Uninit) { + format_inner(vm, out, item, seen); + } + } + // An array too long to lay out shows the elements it starts with. + if vm.heap[id as usize].flags & SPARSE != 0 { + out.push_str(",…"); + } + out.push(']'); + } + Kind::Closure(c) if c.proto.class != 0 => { + let s = vm.class_shown(id); + out.push_str(&s); + } + Kind::Ordinary | Kind::Arguments(_) => { + // An instance of a class shows its class's name first. + if let Some(name) = vm.instance_class_name(id) { + out.push_str(&name); + out.push(' '); + } + out.push('{'); + for (i, (k, val)) in vm.shown_entries(id).into_iter().enumerate() { + if i > 0 { + out.push(','); + } + quote_str(vm, out, vm.atoms.atom_str(k)); + out.push(':'); + match val { + Ok(val) => format_inner(vm, out, &val, seen), + // Showing a value never runs program code: a program accessor shows what it is. + Err(label) => out.push_str(label), + } + } + out.push('}'); + } + Kind::Error(_) => { + let s = error_to_string(vm, id); + out.push_str(&s); + } + Kind::Map(m) | Kind::Set(m) => { + let is_set = matches!(vm.heap[id as usize].kind, Kind::Set(_)); + let entries: Vec<(Value, Value)> = m.iter().cloned().collect(); + let _ = write!( + out, + "{}({}) [", + if is_set { "Set" } else { "Map" }, + entries.len() + ); + for (i, (k, val)) in entries.iter().enumerate() { + if i > 0 { + out.push(','); + } + if is_set { + format_inner(vm, out, k, seen); + } else { + out.push('['); + format_inner(vm, out, k, seen); + out.push(','); + format_inner(vm, out, val, seen); + out.push(']'); + } + } + out.push(']'); + } + Kind::Promise(_) => out.push_str("[Promise (await it to get its value)]"), + _ => match crate::builtins::exotic::inspect(vm, id) { + Some(s) => out.push_str(&s), + None => out.push_str("[opaque reference]"), + }, + } + seen.pop(); + } + } +} + +/// Whether a value holds what is not data, at any depth: a function, a promise, a namespace, an iterator, or a built-in +/// object such as a Map or a Date. The reference's `containsRuntimeReference`, which keeps a thrown value's internals +/// out of a run's failure. +pub fn holds_runtime_reference(vm: &Vm, v: &Value) -> bool { + let mut seen = Vec::new(); + let mut pending = vec![*v]; + while let Some(v) = pending.pop() { + let Value::Obj(id) = v else { + continue; + }; + if seen.contains(&id) { + continue; + } + seen.push(id); + let o = &vm.heap[id as usize]; + match &o.kind { + Kind::Ordinary => {} + Kind::Array(items) | Kind::Arguments(items) => pending.extend(items.iter().copied()), + _ => return true, + } + pending.extend( + o.props + .items + .iter() + .filter(|p| p.flags & ACCESSOR == 0) + .map(|p| p.value), + ); + } + false +} diff --git a/packages/codemode-rust/crates/psychoscript/src/cross.rs b/packages/codemode-rust/crates/psychoscript/src/cross.rs new file mode 100644 index 0000000000000..0488ded3f7a91 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/cross.rs @@ -0,0 +1,1231 @@ +//! Crossing to the host. A host call's arguments cross as the reference's `toHost` copies them (`host::host_args`); +//! under the runtime's `promises: await` translation, a call whose arguments hold a promise that hasn't fulfilled waits +//! for it, then calls again (`wait_async`, `wait_sync`: the reference's `$vmHostWait`). +//! +//! The program's result crosses as JSON: plain data on a native fast path (`fast`, the reference's +//! `tryFastBoundaryOrJson`); a value holding a promise, a `toJSON` of the program's, or shared objects revisited too +//! often through the reference's internal walk (`$vmResult` over the `visit` generators of `$vmJsonVisitor`), which +//! awaits each promise it meets. The walk here is a heap object (`Kind::Cross`), so a run suspended while it awaits +//! saves it, and it spends the fuel that bytecode spends, in the same order. A `toJSON` it calls runs from a native +//! frame (`frame_step`), as the reference calls it from its bytecode, so it can park for a host call's wait, suspend +//! and be saved in a snapshot. + +use rustc_hash::FxHashSet; + +use crate::Json; +use crate::object::*; +use crate::value::{Id, Slot, Value}; +use crate::vm::{NATIVE_FUEL, Reaction, Res, Vm}; + +/// The depth the fast path allows. +const FAST_DEPTH: u32 = 32; +/// The depth the walk allows. +const WALK_DEPTH: u32 = 100; +/// The visits of objects seen already the fast path allows (`VISIT_BUDGET`): it gives up at the last. +const REVISITS: u32 = 2048; + +/// A walk in progress: the values it crosses (`roots`), what it has crossed of them, and the `visit` generators that +/// run now, outermost first. +pub struct Cross { + pub roots: Vec, + pub crossed: Vec, + pub stack: Vec, + /// The containers the walk is inside, for the circular check. + pub ancestors: Vec, + pub waiting: Waiting, + /// A `next` that resumed the walk owes `$vmCross`'s loop its back-edge when the walk yields or ends again. + pub owed: bool, +} + +#[derive(Clone, Copy, PartialEq)] +pub enum Waiting { + No, + /// The program's result is a thenable, awaited before it is walked. + Root, + /// The innermost visit met a promise, which it yielded. + Value, + /// The innermost visit's read met a program getter, whose value is the read's. + Getter, +} + +/// One `visit(holder, key, depth)` generator. +pub struct Visit { + pub holder: Value, + pub key: Value, + pub depth: u32, + pub step: Step, +} + +/// Where a visit is: not past its promise check yet, or inside its container's loop, waiting for the child at `i`. +pub enum Step { + Start, + Array { + target: Value, + out: Id, + len: u32, + i: u32, + }, + Object { + target: Value, + out: Id, + names: Vec, + i: u32, + }, +} + +/// What the fast path made of a value: its JSON (`None` for undefined), or a need for the walk. +pub enum Fast { + Json(Option), + Walk, +} + +/// The reference's `tryFastBoundaryOrJson` at the host boundary. +pub fn fast(vm: &mut Vm, v: &Value) -> Result { + match v { + Value::Undef | Value::Uninit => return Ok(Fast::Json(None)), + Value::Null => return Ok(Fast::Json(Some(Json::Null))), + Value::Bool(b) => return Ok(Fast::Json(Some(Json::Bool(*b)))), + Value::Str(s) => { + return Ok(Fast::Json(Some(Json::String(crate::convert::host_string( + vm, *s, + ))))); + } + Value::Num(n) => return Ok(Fast::Json(Some(number(*n)))), + _ => {} + } + if let Some(j) = flat(vm, v) { + return Ok(Fast::Json(Some(j))); + } + let mut walk = FastWalk { + seen: FxHashSet::default(), + ancestors: Vec::new(), + revisits: REVISITS, + }; + Ok(match walk.visit(vm, v, 0)? { + Some(j) => Fast::Json(j), + None => Fast::Walk, + }) +} + +fn number(n: f64) -> Json { + if n.is_finite() { + crate::convert::json_number(n) + } else { + Json::Null + } +} + +/// A plain object of at most four data properties, all primitives, without its own `toJSON`. +fn flat(vm: &Vm, v: &Value) -> Option { + let Value::Obj(id) = v else { return None }; + let o = &vm.heap[*id as usize]; + if !matches!(o.kind, Kind::Ordinary) + || o.proto != Some(vm.realm.object_proto) + || o.props.items.len() > 4 + || o.props.find(vm.names.to_json).is_some() + || o.flags & ACCESSORS != 0 + || o.props.items.iter().any(|p| p.flags & ACCESSOR != 0) + { + return None; + } + let mut out = serde_json::Map::new(); + for p in &o.props.items { + if p.flags & ENUMERABLE == 0 || p.key <= SYM_ASYNC_ITERATOR { + continue; + } + let k = vm.atoms.text(p.key); + if k == "__proto__" { + continue; + } + let j = match p.value { + Value::Undef | Value::Uninit => continue, + Value::Null => Json::Null, + Value::Bool(b) => Json::Bool(b), + Value::Num(n) => number(n), + Value::Str(s) => Json::String(crate::convert::host_string(vm, s)), + _ => return None, + }; + out.insert(k.to_owned(), j); + } + Some(Json::Object(out)) +} + +struct FastWalk { + seen: FxHashSet, + ancestors: Vec, + revisits: u32, +} + +impl FastWalk { + /// A value's JSON, `Some(None)` for undefined; `None` when the walk is needed. + fn visit( + &mut self, + vm: &mut Vm, + cur: &Value, + depth: u32, + ) -> Result>, Value> { + if depth > FAST_DEPTH { + return Err( + vm.range_error(&format!("Value exceeds the maximum depth of {FAST_DEPTH}.")) + ); + } + let id = match cur { + Value::Undef | Value::Uninit => return Ok(Some(None)), + Value::Num(n) => return Ok(Some(Some(number(*n)))), + Value::Null => return Ok(Some(Some(Json::Null))), + Value::Bool(b) => return Ok(Some(Some(Json::Bool(*b)))), + Value::Str(s) => { + return Ok(Some(Some(Json::String(crate::convert::host_string( + vm, *s, + ))))); + } + Value::Sym(_) => return Ok(Some(Some(Json::Object(serde_json::Map::new())))), + Value::Obj(id) => *id, + }; + if vm.heap[id as usize].is_callable() { + return Ok(Some(None)); + } + if matches!(vm.heap[id as usize].kind, Kind::Promise(_)) { + return Ok(None); + } + // Program getters run in the walk. + let (tk, nk, mk) = (vm.names.to_json, vm.names.name, vm.names.message); + if vm.heap[id as usize].flags & ACCESSORS != 0 + || vm.has_program_getter(id, tk) + || (matches!(vm.heap[id as usize].kind, Kind::Error(_)) + && (vm.has_program_getter(id, nk) || vm.has_program_getter(id, mk))) + { + return Ok(None); + } + if !self.seen.insert(id) { + self.revisits -= 1; + if self.revisits == 0 { + return Ok(None); + } + } + let plain = is_plain(vm, id); + let tj = vm.names.to_json; + let to_json = if plain && vm.heap[id as usize].props.find(tj).is_none() { + Value::Undef + } else { + vm.get(cur, tj)? + }; + if vm.is_callable(&to_json) { + return Ok(builtin_to_json(vm, id, &to_json).map(Some)); + } + match &vm.heap[id as usize].kind { + Kind::Bytes(_) => { + return crate::builtins::exotic::json_value(vm, cur, true).map(|_| None); + } + Kind::SearchParams(_) | Kind::Headers(_) => { + let v = crate::builtins::exotic::json_value(vm, cur, true)?; + return Ok(Some(Some(plain_json(vm, &v).unwrap_or(Json::Null)))); + } + _ => {} + } + if self.ancestors.contains(&id) { + return Err(vm.type_error("Converting circular structure to JSON.")); + } + self.ancestors.push(id); + let r = self.children(vm, id, depth); + self.ancestors.pop(); + r + } + + fn children(&mut self, vm: &mut Vm, id: Id, depth: u32) -> Result>, Value> { + let items = match &vm.heap[id as usize].kind { + Kind::Array(_) => { + vm.densify(id)?; + match &vm.heap[id as usize].kind { + Kind::Array(items) => Some( + items + .iter() + .map(|v| { + if matches!(v, Value::Uninit) { + Value::Undef + } else { + *v + } + }) + .collect::>(), + ), + _ => Some(Vec::new()), + } + } + Kind::Set(m) => Some(m.iter().map(|(k, _)| *k).collect()), + _ => None, + }; + if let Some(items) = items { + let mut out = Vec::with_capacity(items.len()); + for item in items { + match self.visit(vm, &item, depth + 1)? { + None => return Ok(None), + Some(j) => out.push(j.unwrap_or(Json::Null)), + } + } + return Ok(Some(Some(Json::Array(out)))); + } + let mut out = serde_json::Map::new(); + if matches!(vm.heap[id as usize].kind, Kind::Error(_)) { + for k in [vm.names.name, vm.names.message] { + let v = vm.get_obj(id, k); + match self.visit(vm, &v, depth + 1)? { + None => return Ok(None), + Some(Some(j)) => { + out.insert(vm.atoms.text(k).to_owned(), j); + } + Some(None) => {} + } + } + } + for (k, v) in vm.own_entries(id) { + let name = vm.atoms.text(k); + if name == "__proto__" { + continue; + } + let name = name.to_owned(); + match self.visit(vm, &v, depth + 1)? { + None => return Ok(None), + Some(Some(j)) => { + out.insert(name, j); + } + Some(None) => {} + } + } + Ok(Some(Some(Json::Object(out)))) + } +} + +/// An object `{}` makes: an ordinary object whose prototype is `Object.prototype`. +fn is_plain(vm: &Vm, id: Id) -> bool { + let o = &vm.heap[id as usize]; + matches!(o.kind, Kind::Ordinary) && o.proto == Some(vm.realm.object_proto) +} + +/// The JSON of a Date or URL `id` whose `toJSON` `f` is its prototype's, which the fast path makes itself without +/// calling it, as the reference does (even when the program replaced the prototype's method); `None` for any other. +fn builtin_to_json(vm: &mut Vm, id: Id, f: &Value) -> Option { + let proto = match vm.heap[id as usize].kind { + Kind::Date(_) => vm.realm.std.date, + Kind::Url(_) => vm.realm.std.url, + _ => return None, + }; + if proto == 0 { + return None; + } + let k = vm.names.to_json; + if !matches!((vm.get_obj(proto, k), f), (Value::Obj(a), Value::Obj(b)) if a == *b) { + return None; + } + Some(match &vm.heap[id as usize].kind { + Kind::Date(t) if t.is_finite() => Json::String(crate::builtins::date::iso_string(*t)), + Kind::Url(u) => Json::String(u.url.as_str().to_owned()), + _ => Json::Null, + }) +} + +/// The reference's `toPlainJson`: what the walk built, as host JSON; `None` for undefined. +fn plain_json(vm: &Vm, v: &Value) -> Option { + Some(match v { + Value::Undef | Value::Uninit => return None, + Value::Null => Json::Null, + Value::Bool(b) => Json::Bool(*b), + Value::Num(n) => crate::convert::json_number(*n), + Value::Str(s) => Json::String(crate::convert::host_string(vm, *s)), + Value::Sym(_) => Json::Object(serde_json::Map::new()), + Value::Obj(id) => match &vm.heap[*id as usize].kind { + Kind::Array(items) => Json::Array( + items + .iter() + .map(|i| plain_json(vm, i).unwrap_or(Json::Null)) + .collect(), + ), + _ => { + let mut out = serde_json::Map::new(); + for p in &vm.heap[*id as usize].props.items { + if p.flags & ENUMERABLE == 0 || p.key <= SYM_ASYNC_ITERATOR { + continue; + } + if let Some(j) = plain_json(vm, &p.value) { + out.insert(vm.atoms.text(p.key).to_owned(), j); + } + } + Json::Object(out) + } + }, + }) +} + +// ---------- the result's walk ---------- + +/// The program returned `v`: its result once it has crossed. +pub fn program_result(vm: &mut Vm, v: Value) -> Result<(), Value> { + if !thenable(vm, &v) { + match fast(vm, &v) { + Ok(Fast::Json(j)) => { + vm.result_json = Some(j.unwrap_or(Json::Null)); + vm.outcome = Some(Ok(v)); + return Ok(()); + } + Ok(Fast::Walk) => {} + Err(e) => { + if vm.fatal.is_some() { + return Err(e); + } + vm.outcome = Some(Err(e)); + return Ok(()); + } + } + } + let id = start(vm, vec![v]); + advance(vm, id, None) +} + +/// Whether the reference's `$IsThenable` holds: a promise, or an object with a callable `then`. +fn thenable(vm: &mut Vm, v: &Value) -> bool { + let Value::Obj(id) = v else { return false }; + match vm.heap[*id as usize].kind { + Kind::Promise(_) => return true, + Kind::Namespace(_) => return false, + _ => {} + } + let then = vm.names.then; + if vm.has_program_getter(*id, then) { + return true; + } + let t = vm.get_obj(*id, then); + vm.is_callable(&t) +} + +/// Makes a walk over `roots` as a heap object. +pub fn start(vm: &mut Vm, roots: Vec) -> Id { + let n = roots.len(); + vm.alloc(Obj::new( + None, + Kind::Cross(Box::new(Cross { + roots, + crossed: Vec::with_capacity(n), + stack: Vec::new(), + ancestors: Vec::new(), + waiting: Waiting::No, + owed: false, + })), + )) +} + +/// The settled value a walk awaited (`resumed`), or the walk's start: runs it until it awaits again or ends, then +/// hands its outcome to the run. At a `toJSON` it pushes a native frame that calls it and runs the rest of the walk +/// (`frame_step`). A waiting host call (`wait_async`) resumes here too, by the same reaction. +pub fn advance(vm: &mut Vm, id: Id, resumed: Option>) -> Result<(), Value> { + if let (Kind::Array(_), Some(outcome)) = (&vm.heap[id as usize].kind, &resumed) { + let outcome = *outcome; + return resume_wait(vm, id, outcome); + } + let resume = match resumed { + None => Resume::Start, + Some(r) => Resume::Settled(r), + }; + match walk(vm, id, resume)? { + Walked::Await(awaited) => { + wait(vm, id, awaited); + Ok(()) + } + Walked::Call(call) => enter_frame(vm, id, CALL, call).map(|_| ()), + Walked::Done(outcome) => finish(vm, outcome), + } +} + +/// How a run of the walk starts: from where it is, with the settled value it awaited, or with what a `toJSON` it +/// called returned. +enum Resume { + Start, + Settled(Result), + Called(Value), +} + +/// How far a run of the walk got. +enum Walked { + /// It awaits this. + Await(Value), + /// It calls a `toJSON`: the function, its receiver and the key. + Call([Value; 3]), + /// It ended, with the result crossed or an error. + Done(Result>, Value>), +} + +/// Runs the walk until it awaits, calls a `toJSON` or ends; only a fatal error is an `Err`. +fn walk(vm: &mut Vm, id: Id, resume: Resume) -> Result { + let Kind::Cross(mut c) = std::mem::replace(&mut vm.heap[id as usize].kind, Kind::Ordinary) + else { + return Err(vm.type_error("The crossing is not running.")); + }; + let r = match resume { + Resume::Settled(Err(e)) => Err(e), + resume => step(vm, &mut c, resume), + }; + match r { + Ok(Pause::Await(awaited)) => { + vm.heap[id as usize].kind = Kind::Cross(c); + Ok(Walked::Await(awaited)) + } + Ok(Pause::Call(call)) => { + vm.heap[id as usize].kind = Kind::Cross(c); + Ok(Walked::Call(call)) + } + Ok(Pause::Done) => { + let crossed = c.crossed.iter().map(|v| plain_json(vm, v)).collect(); + Ok(Walked::Done(Ok(crossed))) + } + Err(e) if vm.fatal.is_some() => Err(e), + Err(e) => Ok(Walked::Done(Err(e))), + } +} + +/// `$vmResult`'s `await`: the walk resumes once `awaited` settles. +fn wait(vm: &mut Vm, id: Id, awaited: Value) { + let p = vm.promise_resolve(awaited); + vm.perform_then(p, Reaction::Cross(id)); +} + +// The slots of the walk's native frame: the walk, the `toJSON` call it makes (function, receiver, key), and where the +// frame is. +const F_CROSS: usize = 0; +const F_FN: usize = 1; +const F_THIS: usize = 2; +const F_KEY: usize = 3; +const F_PHASE: usize = 4; + +/// Where the walk's frame is: about to call the `toJSON` in its slots, or waiting for a `toJSON` it called. +const CALL: usize = 0; +const CALLED: usize = 2; + +/// Pushes a native frame that runs the walk `id` from `phase`. +fn enter_frame(vm: &mut Vm, id: Id, phase: usize, call: [Value; 3]) -> Res { + vm.enter_native_with( + crate::native::NativeOp::Callbacks, + crate::builtins::object::SUB_CROSS, + Value::Undef, + Value::Undef, + &[ + Value::Obj(id), + call[0], + call[1], + call[2], + Value::Num(phase as f64), + ], + ) +} + +/// The step of the walk's native frame: calls the `toJSON`s of the program the walk meets as bytecode calls them, so +/// they can park for a host call's wait and suspend, and hands each result back to the walk. A walk that awaits leaves the +/// rest to a job (`Reaction::Cross`). +pub(crate) fn frame_step( + vm: &mut Vm, + fr: crate::native::Frame, + input: crate::native::Input, +) -> Result { + use crate::native::{Input, Step}; + let Value::Obj(id) = fr.get(vm, F_CROSS) else { + return Ok(Step::Done(Value::Undef)); + }; + let phase = fr.index(vm, F_PHASE); + let resume = match input { + Input::Start if phase == CALL => return call_to_json(vm, fr), + Input::Start => Resume::Start, + Input::Returned(r) if phase == CALLED => Resume::Called(r.get()), + Input::Returned(r) | Input::Finished(r) => Resume::Settled(Ok(r.get())), + Input::Threw(e) => Resume::Settled(Err(e)), + }; + match walk(vm, id, resume)? { + Walked::Call(call) => { + fr.set(vm, F_FN, call[0]); + fr.set(vm, F_THIS, call[1]); + fr.set(vm, F_KEY, call[2]); + call_to_json(vm, fr) + } + Walked::Await(awaited) => { + wait(vm, id, awaited); + Ok(Step::Done(Value::Undef)) + } + Walked::Done(outcome) => { + finish(vm, outcome)?; + Ok(Step::Done(Value::Undef)) + } + } +} + +/// Calls the `toJSON` in the frame's slots as bytecode calls it; what it throws comes back to the frame. +fn call_to_json(vm: &mut Vm, fr: crate::native::Frame) -> Result { + fr.set_index(vm, F_PHASE, CALLED); + let (f, this, key) = (fr.slot(vm, F_FN), fr.slot(vm, F_THIS), fr.slot(vm, F_KEY)); + // A program getter the walk's read met is called with no arguments. + if let Value::Uninit = key.get() { + return fr.catching(vm, f, this, []); + } + fr.catching(vm, f, this, [key]) +} + +/// Asks the loop to park the frames of the waiting host call with the coroutine in its data, and costs nothing. A +/// snapshot names it with the host's natives (`host::snapshot_natives`): the heap may still hold one when the run +/// suspends. +pub(crate) fn park(vm: &mut Vm, _this: Value, _args: &[Value], callee: Id) -> Res { + if let Kind::Native { + data: Value::Num(c), + .. + } = vm.heap[callee as usize].kind + { + vm.park = true; + vm.park_coroutine = c as u32; + } + vm.bytecode_builtin(); + Ok(Value::Undef) +} + +fn finish(vm: &mut Vm, outcome: Result>, Value>) -> Result<(), Value> { + match outcome { + Ok(mut json) => { + vm.result_json = Some(json.pop().flatten().unwrap_or(Json::Null)); + vm.outcome = Some(Ok(Value::Undef)); + } + Err(e) => vm.outcome = Some(Err(e)), + } + Ok(()) +} + +/// What a step of the walk does next. +enum Act { + /// `$vmCross`'s loop over the roots, at its condition. + Root, + /// The innermost visit reads `holder[key]`. + Read, + /// The innermost visit has read its value. + Got(Value), + /// The innermost visit has its value past the promise check. + Value(Value), + /// The innermost visit has its value past its `toJSON`. + Classify(Value), + /// The innermost visit returned this. + Return(Value), +} + +/// Where a run of the walk stopped. +enum Pause { + /// It awaits this promise. + Await(Value), + /// The innermost visit calls a `toJSON` (function, receiver, key) and goes on with what it returns. + Call([Value; 3]), + /// Every root has crossed. + Done, +} + +/// Runs the walk until it pauses. +fn step(vm: &mut Vm, c: &mut Cross, resume: Resume) -> Result { + let resumed = match resume { + Resume::Called(v) if c.waiting == Waiting::Getter => { + c.waiting = Waiting::No; + return run(vm, c, Act::Got(v), false); + } + Resume::Called(v) => return run(vm, c, Act::Classify(v), false), + Resume::Settled(r) => Some(r.unwrap_or_default()), + Resume::Start => None, + }; + match (c.waiting, resumed) { + (Waiting::Root, Some(v)) => { + c.waiting = Waiting::No; + let at = c.crossed.len(); + c.roots[at] = v; + run(vm, c, Act::Root, true) + } + (Waiting::Value, Some(v)) => { + c.waiting = Waiting::No; + // `walk.next(v)`, then each enclosing `yield*` loops back and calls its inner `next`. + vm.fuel(NATIVE_FUEL); + for _ in 1..c.stack.len() { + vm.fuel(1); + vm.fuel(NATIVE_FUEL); + } + c.owed = true; + run(vm, c, Act::Value(v), false) + } + _ => run(vm, c, Act::Root, false), + } +} + +fn run(vm: &mut Vm, c: &mut Cross, mut act: Act, mut root_awaited: bool) -> Result { + loop { + act = match act { + Act::Root => { + let at = c.crossed.len(); + if at == c.roots.len() { + return Ok(Pause::Done); + } + let root = c.roots[at]; + if !root_awaited && thenable(vm, &root) { + c.waiting = Waiting::Root; + return Ok(Pause::Await(root)); + } + root_awaited = false; + // `$vmJsonVisitor(...)`, the root `visit` generator, and the first `next`. + vm.fuel(1); + let holder = vm.new_object(); + let empty = vm.atoms.intern_static(""); + vm.define(holder, empty, root); + vm.fuel(1); + let key = vm.static_str(""); + c.stack.push(Visit { + holder: Value::Obj(holder), + key, + depth: 0, + step: Step::Start, + }); + vm.fuel(NATIVE_FUEL); + Act::Read + } + Act::Read => { + let top = c.stack.last().expect("visit"); + // `$Throw`, a native that throws and so costs nothing. + if top.depth > WALK_DEPTH { + return Err(vm.range_error(&format!( + "Value exceeds the maximum depth of {WALK_DEPTH}." + ))); + } + let (holder, key) = (top.holder, top.key); + vm.op_access = true; + let val = vm.get_elem(&holder, &key); + vm.op_access = false; + let val = val?; + if let Some(g) = vm.getter_hit.take() { + c.waiting = Waiting::Getter; + return Ok(Pause::Call([g, holder, Value::Uninit])); + } + Act::Got(val) + } + Act::Got(val) => { + if matches!(val, Value::Obj(id) if matches!(vm.heap[id as usize].kind, Kind::Promise(_))) + { + if std::mem::take(&mut c.owed) { + vm.fuel(1); + } + c.waiting = Waiting::Value; + return Ok(Pause::Await(val)); + } + Act::Value(val) + } + Act::Value(val) => { + if let Value::Obj(_) = val { + let tj = vm.names.to_json; + let f = vm.get(&val, tj)?; + if vm.is_callable(&f) { + let key = c.stack.last().expect("visit").key; + return Ok(Pause::Call([f, val, key])); + } + } + Act::Classify(val) + } + Act::Classify(val) => match classify(vm, &val, &c.ancestors)? { + Class::Undefined => Act::Return(Value::Undef), + Class::Data => Act::Return(val), + Class::Null => Act::Return(Value::Null), + Class::Special => Act::Return(special(vm, &val)?), + Class::Set | Class::Object => { + let target = match val { + Value::Obj(id) if matches!(vm.heap[id as usize].kind, Kind::Set(_)) => { + let items = match &vm.heap[id as usize].kind { + Kind::Set(m) => m.iter().map(|(k, _)| *k).collect(), + _ => Vec::new(), + }; + vm.new_array(items) + } + v => v, + }; + c.ancestors.push(target); + enter(vm, c, target)? + } + }, + Act::Return(v) => { + c.stack.pop(); + if c.stack.is_empty() { + if std::mem::take(&mut c.owed) { + vm.fuel(1); + } + c.crossed.push(v); + // `$vmCross`'s loop over the roots. + vm.fuel(1); + Act::Root + } else { + returned(vm, c, v)? + } + } + }; + } +} + +/// Starts the innermost visit's loop over `target`'s children. +fn enter(vm: &mut Vm, c: &mut Cross, target: Value) -> Result { + let is_array = + matches!(target, Value::Obj(id) if matches!(vm.heap[id as usize].kind, Kind::Array(_))); + if is_array { + let Value::Obj(out) = vm.new_array(Vec::new()) else { + return Ok(Act::Return(Value::Undef)); + }; + let lk = vm.names.length; + let len = vm.get(&target, lk)?; + let len = match len { + Value::Num(n) if n > 0.0 => n as u32, + _ => 0, + }; + c.stack.last_mut().expect("visit").step = Step::Array { + target, + out, + len, + i: 0, + }; + return Ok(if len > 0 { child(vm, c) } else { done(c) }); + } + let out = vm.alloc(Obj::new(None, Kind::Ordinary)); + let names = json_names(vm, &target); + let any = !names.is_empty(); + c.stack.last_mut().expect("visit").step = Step::Object { + target, + out, + names, + i: 0, + }; + Ok(if any { child(vm, c) } else { done(c) }) +} + +/// Opens the visit of the child at the innermost visit's `i`: `String(i)` for an array, the child `visit` generator, +/// `yield*` opening it through its `Symbol.iterator`, and its first `next`. +fn child(vm: &mut Vm, c: &mut Cross) -> Act { + let top = c.stack.last().expect("visit"); + let depth = top.depth + 1; + let (holder, key) = match &top.step { + Step::Array { target, i, .. } => { + let (target, i) = (*target, *i); + vm.fuel(NATIVE_FUEL); + (target, vm.string_val(i.to_string())) + } + Step::Object { + target, names, i, .. + } => (*target, names[*i as usize]), + Step::Start => return Act::Return(Value::Undef), + }; + vm.fuel(1); + vm.fuel(NATIVE_FUEL); + vm.fuel(NATIVE_FUEL); + c.stack.push(Visit { + holder, + key, + depth, + step: Step::Start, + }); + Act::Read +} + +/// The innermost visit's loop ended: it returns what it built. +fn done(c: &mut Cross) -> Act { + c.ancestors.pop(); + match &c.stack.last().expect("visit").step { + Step::Array { out, .. } | Step::Object { out, .. } => Act::Return(Value::Obj(*out)), + Step::Start => Act::Return(Value::Undef), + } +} + +/// The innermost visit's child returned `v`: written into its output, then the loop's back-edge. +fn returned(vm: &mut Vm, c: &mut Cross, v: Value) -> Result { + let more = match &mut c.stack.last_mut().expect("visit").step { + Step::Array { out, len, i, .. } => { + let (out, at) = (*out, *i as usize); + let v = if matches!(v, Value::Undef) { + Value::Null + } else { + v + }; + if let Kind::Array(items) = &mut vm.heap[out as usize].kind { + items.resize(at, Value::Null); + items.push(v); + } + *i += 1; + *i < *len + } + Step::Object { out, names, i, .. } => { + let (out, k) = (*out, names[*i as usize]); + if !matches!(v, Value::Undef) { + // `$Define`. + vm.fuel(NATIVE_FUEL); + let key = vm.string_of(&k)?; + let atom = vm.atoms.intern_id(key); + vm.define(out, atom, v); + } + if let Step::Object { names, i, .. } = &mut c.stack.last_mut().expect("visit").step { + *i += 1; + (*i as usize) < names.len() + } else { + false + } + } + Step::Start => false, + }; + vm.fuel(1); + Ok(if more { child(vm, c) } else { done(c) }) +} + +enum Class { + Undefined, + Data, + Null, + Special, + Set, + Object, +} + +/// The reference's `$JsonClassify` at the boundary. +fn classify(vm: &mut Vm, v: &Value, ancestors: &[Value]) -> Result { + let id = match v { + Value::Undef | Value::Uninit => return Ok(Class::Undefined), + Value::Num(n) => { + return Ok(if n.is_finite() { + Class::Data + } else { + Class::Null + }); + } + Value::Null | Value::Str(_) | Value::Bool(_) => return Ok(Class::Data), + Value::Sym(_) => return Ok(Class::Special), + Value::Obj(id) => *id, + }; + if vm.heap[id as usize].is_callable() { + return Ok(Class::Undefined); + } + match vm.heap[id as usize].kind { + Kind::Bytes(_) => { + crate::builtins::exotic::json_value(vm, v, true)?; + return Ok(Class::Special); + } + Kind::SearchParams(_) | Kind::Headers(_) => return Ok(Class::Special), + _ => {} + } + if ancestors + .iter() + .any(|a| matches!(a, Value::Obj(x) if *x == id)) + { + return Err(vm.type_error("Converting circular structure to JSON.")); + } + Ok(if matches!(vm.heap[id as usize].kind, Kind::Set(_)) { + Class::Set + } else { + Class::Object + }) +} + +/// The reference's `$JsonSpecial` at the boundary. +fn special(vm: &mut Vm, v: &Value) -> Res { + if let Value::Obj(id) = v + && matches!( + vm.heap[*id as usize].kind, + Kind::SearchParams(_) | Kind::Headers(_) + ) + { + return crate::builtins::exotic::json_value(vm, v, true); + } + Ok(Value::Obj(vm.new_object())) +} + +/// The reference's `$JsonNames` at the boundary: an error's name and message first, then the own keys but +/// `__proto__`. +fn json_names(vm: &mut Vm, target: &Value) -> Vec { + let Value::Obj(id) = target else { + return Vec::new(); + }; + let id = *id; + let error = matches!(vm.heap[id as usize].kind, Kind::Error(_)); + let (nk, mk) = (vm.names.name, vm.names.message); + let mut out = Vec::new(); + if error { + out.push(vm.atom_val(nk)); + out.push(vm.atom_val(mk)); + } + for k in vm.own_keys(id) { + if (error && (k == nk || k == mk)) || vm.atoms.text(k) == "__proto__" { + continue; + } + out.push(vm.atom_val(k)); + } + out +} + +/// The values a walk holds, for the snapshot's reach. +pub fn values(c: &Cross) -> impl Iterator + '_ { + c.roots + .iter() + .chain(c.crossed.iter()) + .chain(c.ancestors.iter()) + .copied() + .chain(c.stack.iter().flat_map(|v| { + let mut out = vec![v.holder, v.key]; + match &v.step { + Step::Start => {} + Step::Array { target, out: o, .. } => out.extend([*target, Value::Obj(*o)]), + Step::Object { + target, + out: o, + names, + .. + } => { + out.extend([*target, Value::Obj(*o)]); + out.extend(names.iter().copied()); + } + } + out + })) +} + +// ---------- host-call arguments ---------- + +/// The error properties `toHost` leaves on a program's error. +pub(crate) fn uncrossed(key: &str) -> bool { + matches!( + key, + "stack" | "message" | "constructor" | "toString" | "__proto__" + ) +} + +/// The name a program's error has as the host's copy: its own `name`, or the name of an error type the host has, or +/// `Error`. +pub(crate) fn host_error_name(vm: &mut Vm, id: Id, name: String) -> String { + let own = vm.has_own(id, vm.names.name); + let known = matches!( + name.as_str(), + "TypeError" + | "RangeError" + | "SyntaxError" + | "ReferenceError" + | "EvalError" + | "URIError" + | "AggregateError" + ); + if own || known { name } else { "Error".into() } +} + +/// The objects `toHost` refuses: the interpreter's machinery, which is not data. +pub(crate) fn opaque(kind: &Kind) -> bool { + matches!( + kind, + Kind::Namespace(_) + | Kind::Promise(_) + | Kind::Generator(_) + | Kind::AsyncGenerator(_) + | Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } + | Kind::ExoticIter { .. } + | Kind::IterHelper(_) + | Kind::AsyncFromSync { .. } + | Kind::Resolvers { .. } + | Kind::Combinator(_) + | Kind::Cross(_) + ) +} + +// ---------- waiting host calls ---------- + +// A host call whose arguments hold promises that haven't fulfilled waits for each in turn, then calls its function +// again with the same arguments, which cross with their values now: the reference's `$vmHostWait`, an async function +// in its internal bytecode (`let i = 0; while (i < promises.length) { await promises[i]; i++ } return $Apply(callee, +// undefined, args)`). Each resumption is a job, and each turn of its loop a back-edge, as there. + +/// The wait of an async or durable host function's call, whose promise `p` the +/// caller already holds: `p` takes on what the call made again gives, or the reason a promise rejected with. The +/// wait's state is an array no program sees, `[promises, index, callee, args, p]`, resumed by `Reaction::Cross`. +pub fn wait_async(vm: &mut Vm, promises: Vec, callee: Value, args: &[Value], p: Id) { + let first = promises[0]; + let promises = vm.new_array(promises); + let args = vm.new_array(args.to_vec()); + let Value::Obj(state) = + vm.new_array(vec![promises, Value::Num(0.0), callee, args, Value::Obj(p)]) + else { + return; + }; + await_for(vm, state, first); +} + +fn await_for(vm: &mut Vm, state: Id, v: Value) { + let q = vm.promise_resolve(v); + vm.perform_then(q, Reaction::Cross(state)); +} + +/// The awaited promise of an `async` host function's wait settled. +fn resume_wait(vm: &mut Vm, state: Id, outcome: Result) -> Result<(), Value> { + let item = |vm: &Vm, i: usize| match &vm.heap[state as usize].kind { + Kind::Array(items) => items.get(i).copied().unwrap_or(Value::Undef), + _ => Value::Undef, + }; + let Value::Obj(p) = item(vm, 4) else { + return Ok(()); + }; + if let Err(e) = outcome { + vm.reject(p, e); + return Ok(()); + } + let next = match item(vm, 1) { + Value::Num(n) => n as usize + 1, + _ => 0, + }; + // The wait loop's back-edge. + vm.fuel_step(); + let promises = list(vm, item(vm, 0)); + if let Some(&awaited) = promises.get(next) { + if let Kind::Array(items) = &mut vm.heap[state as usize].kind { + items[1] = Value::Num(next as f64); + } + await_for(vm, state, awaited); + return Ok(()); + } + let (callee, args) = (item(vm, 2), list(vm, item(vm, 3))); + let r = match &vm.heap[callee.as_obj().unwrap_or(0) as usize].kind { + // A namespace function is called through its namespace, which costs the reference nothing. + Kind::Namespace(_) => { + crate::host::call_namespace(vm, callee.as_obj().unwrap_or(0), &args, callee) + } + _ => { + let r = vm.call(&callee, Value::Undef, &args); + vm.fuel(NATIVE_FUEL); + r + } + }; + match r { + Ok(v) => vm.resolve_promise(p, v), + Err(e) if vm.fatal.is_some() => return Err(e), + Err(e) => vm.reject(p, e), + } + Ok(()) +} + +fn list(vm: &Vm, v: Value) -> Vec { + match v { + Value::Obj(id) => match &vm.heap[id as usize].kind { + Kind::Array(items) => items.clone(), + _ => Vec::new(), + }, + _ => Vec::new(), + } +} + +/// The wait of a synchronous host function's call: its call waits where it is, as +/// an `await` there would, parking the frames from the nearest async function up, and they go on with what the call +/// made again returns. A call native code made, whose frame it drives itself, cannot wait, nor one with a generator or +/// such a call in between. +pub fn wait_sync(vm: &mut Vm, promises: Vec, callee: Value, args: &[Value]) -> Res { + let promises = vm.new_array(promises); + let args = vm.new_array(args.to_vec()); + vm.enter_native_with( + crate::native::NativeOp::Callbacks, + crate::builtins::object::SUB_HOST_WAIT, + Value::Undef, + Value::Undef, + &[ + promises, + callee, + args, + Value::Num(0.0), + Value::Num(0.0), + Value::Num(0.0), + ], + ) +} + +/// Where the wait's frames park, from the wait's own frame on top: nowhere when native code drives that frame. +fn parks_with(vm: &mut Vm) -> Option { + if vm.frames.last().is_none_or(|f| f.is_base) { + return None; + } + vm.parkable() +} + +#[cold] +fn cant_wait(vm: &mut Vm, callee: Value) -> Value { + let name = match callee.as_obj() { + Some(id) if vm.is_namespace(id) => vm.ns_label(&vm.ns_path(id)), + _ => crate::host::function_name(vm, &callee), + }; + let msg = format!( + "{name}(...) can't wait for a promise in its arguments here, in a callback or a generator; await it first." + ); + vm.invalid_data(&msg) +} + +// The slots of a synchronous call's wait: the promises, the function and its arguments, the promise it waits for now, +// the coroutine its frames park with, and where it is. +const W_PROMISES: usize = 0; +const W_CALLEE: usize = 1; +const W_ARGS: usize = 2; +const W_INDEX: usize = 3; +const W_COROUTINE: usize = 4; +const W_PHASE: usize = 5; + +/// Where a synchronous call's wait is: parked for a promise, or calling its function again. +const PARKED: usize = 1; +const RECALLED: usize = 2; + +/// The step of a synchronous call's wait. +pub(crate) fn wait_step( + vm: &mut Vm, + fr: crate::native::Frame, + input: crate::native::Input, +) -> Result { + use crate::native::{Input, Step}; + match (input, fr.index(vm, W_PHASE)) { + (Input::Start, _) => { + // The call from bytecode costs its fifty once it has entered the wait, before the wait runs. + if let Some(f) = vm.frames.last_mut() + && f.argc & 1 != 0 + { + f.argc &= !1; + vm.fuel(NATIVE_FUEL); + } + let Some(c) = parks_with(vm) else { + let callee = fr.get(vm, W_CALLEE); + return Err(cant_wait(vm, callee)); + }; + fr.set_index(vm, W_COROUTINE, c as usize); + park_for(vm, fr, 0) + } + (Input::Threw(e), PARKED) => Err(e), + (Input::Returned(_) | Input::Finished(_), PARKED) => { + let next = fr.index(vm, W_INDEX) + 1; + // The wait loop's back-edge. + vm.fuel_step(); + if next < list(vm, fr.get(vm, W_PROMISES)).len() { + return park_for(vm, fr, next); + } + fr.set_index(vm, W_PHASE, RECALLED); + let args = list(vm, fr.get(vm, W_ARGS)); + vm.stack.push(fr.slot(vm, W_CALLEE)); + vm.stack.push(Slot::UNDEF); + vm.stack.extend(args.iter().map(|v| Slot::pack(*v))); + vm.native_call(args.len()) + } + (Input::Returned(r) | Input::Finished(r), _) => Ok(Step::Done(r.get())), + (Input::Threw(e), _) => Err(e), + } +} + +/// Awaits the promise at `index`, parking the frames up to the nearest async function as an `await` does; what it +/// settles with comes back to this frame, a rejection through the handler. +fn park_for( + vm: &mut Vm, + fr: crate::native::Frame, + index: usize, +) -> Result { + let awaited = list(vm, fr.get(vm, W_PROMISES)) + .get(index) + .copied() + .unwrap_or(Value::Undef); + let c = fr.index(vm, W_COROUTINE) as u32; + fr.set_index(vm, W_INDEX, index); + fr.set_index(vm, W_PHASE, PARKED); + vm.await_value(awaited, c); + let park = vm.native_fn("", 0, park, Value::Num(c as f64)); + fr.catching(vm, Slot::pack(park), Slot::UNDEF, []) +} diff --git a/packages/codemode-rust/crates/psychoscript/src/data.rs b/packages/codemode-rust/crates/psychoscript/src/data.rs new file mode 100644 index 0000000000000..b529d5d5dbdce --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/data.rs @@ -0,0 +1,244 @@ +//! JSON data as a program left it, the reference's `Json`: like `serde_json::Value`, but its strings and keys are +//! [`HostString`]s, so a string with an unpaired surrogate stays exactly as the program had it. + +use crate::{HostString, Json}; + +/// JSON data as a program left it: its result. Strings and keys keep unpaired surrogates ([`HostString`]); +/// [`Data::to_json`] gives a `serde_json::Value`, with U+FFFD for each. +#[derive(Clone, Debug, PartialEq)] +pub enum Data { + Null, + Bool(bool), + Number(serde_json::Number), + String(HostString), + Array(Vec), + /// Keys in the order the program's object had them. + Object(Vec<(HostString, Data)>), +} + +impl Data { + /// The data as a `serde_json::Value`, with U+FFFD for each unpaired surrogate. + pub fn to_json(&self) -> Json { + match self { + Data::Null => Json::Null, + Data::Bool(b) => Json::Bool(*b), + Data::Number(n) => Json::Number(n.clone()), + Data::String(s) => Json::String(s.to_string_lossy().into_owned()), + Data::Array(items) => Json::Array(items.iter().map(Data::to_json).collect()), + Data::Object(fields) => Json::Object( + fields + .iter() + .map(|(k, v)| (k.to_string_lossy().into_owned(), v.to_json())) + .collect(), + ), + } + } + + /// The data of a `serde_json::Value`. + pub fn from_json(json: &Json) -> Self { + match json { + Json::Null => Data::Null, + Json::Bool(b) => Data::Bool(*b), + Json::Number(n) => Data::Number(n.clone()), + Json::String(s) => Data::String(s.into()), + Json::Array(items) => Data::Array(items.iter().map(Data::from_json).collect()), + Json::Object(map) => Data::Object( + map.iter() + .map(|(k, v)| (k.into(), Data::from_json(v))) + .collect(), + ), + } + } + + /// JSON whose strings and keys are a run's text (see `strings`), as the result crosses out of the run. + pub(crate) fn from_run_json(json: Json) -> Self { + match json { + Json::Null => Data::Null, + Json::Bool(b) => Data::Bool(b), + Json::Number(n) => Data::Number(n), + Json::String(s) => Data::String(HostString::from_run_text(&s)), + Json::Array(items) => Data::Array(items.into_iter().map(Data::from_run_json).collect()), + Json::Object(map) => Data::Object( + map.into_iter() + .map(|(k, v)| (HostString::from_run_text(&k), Data::from_run_json(v))) + .collect(), + ), + } + } + + /// The string, when the data is one. + pub fn as_string(&self) -> Option<&HostString> { + match self { + Data::String(s) => Some(s), + _ => None, + } + } + + /// The JSON text `JSON.stringify` writes for the data: compact, an unpaired surrogate as a `\u` escape. + pub fn to_json_string(&self) -> String { + let mut out = String::new(); + self.write(&mut out); + out + } + + fn write(&self, out: &mut String) { + match self { + Data::Null => out.push_str("null"), + Data::Bool(b) => out.push_str(if *b { "true" } else { "false" }), + Data::Number(n) => out.push_str(&Json::Number(n.clone()).to_string()), + Data::String(s) => write_string(out, s), + Data::Array(items) => { + out.push('['); + for (i, item) in items.iter().enumerate() { + if i > 0 { + out.push(','); + } + item.write(out); + } + out.push(']'); + } + Data::Object(fields) => { + out.push('{'); + for (i, (k, v)) in fields.iter().enumerate() { + if i > 0 { + out.push(','); + } + write_string(out, k); + out.push(':'); + v.write(out); + } + out.push('}'); + } + } + } +} + +fn write_string(out: &mut String, s: &HostString) { + if let Some(text) = s.as_str() { + out.push_str(&Json::String(text.to_owned()).to_string()); + return; + } + out.push('"'); + for unit in char::decode_utf16(s.to_utf16().iter().copied()) { + match unit { + Ok(c) => { + let quoted = Json::String(c.to_string()).to_string(); + out.push_str("ed[1..quoted.len() - 1]); + } + Err(e) => out.push_str(&format!("\\u{:04x}", e.unpaired_surrogate())), + } + } + out.push('"'); +} + +impl PartialEq for Data { + /// Equal when the data is well formed and has the same JSON; numbers compare as `serde_json` does. + fn eq(&self, other: &Json) -> bool { + match (self, other) { + (Data::Null, Json::Null) => true, + (Data::Bool(a), Json::Bool(b)) => a == b, + (Data::Number(a), Json::Number(b)) => a == b, + (Data::String(a), Json::String(b)) => a == b, + (Data::Array(a), Json::Array(b)) => { + a.len() == b.len() && a.iter().zip(b).all(|(a, b)| a == b) + } + (Data::Object(a), Json::Object(b)) => { + a.len() == b.len() + && a.iter() + .zip(b) + .all(|((ka, va), (kb, vb))| ka == kb && va == vb) + } + _ => false, + } + } +} + +impl From for Data { + fn from(json: Json) -> Self { + Data::from_json(&json) + } +} + +impl std::fmt::Display for Data { + /// The JSON text `JSON.stringify` writes for the data. + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(&self.to_json_string()) + } +} + +impl Data { + /// Whether it is `null`. + pub fn is_null(&self) -> bool { + matches!(self, Data::Null) + } + + /// The value at `key`, when the data is an object that has it. + pub fn get(&self, key: &str) -> Option<&Data> { + match self { + Data::Object(fields) => fields.iter().find(|(k, _)| k == key).map(|(_, v)| v), + _ => None, + } + } + + /// The data as a host value, for what saves it. + pub(crate) fn to_host(&self) -> crate::HostValue { + use crate::HostValue; + match self { + Data::Null => HostValue::Null, + Data::Bool(b) => HostValue::Bool(*b), + Data::Number(n) => HostValue::Number(n.as_f64().unwrap_or(f64::NAN)), + Data::String(s) => HostValue::String(s.clone()), + Data::Array(items) => HostValue::array(items.iter().map(Data::to_host)), + Data::Object(fields) => HostValue::Object( + fields + .iter() + .map(|(k, v)| (k.clone(), v.to_host())) + .collect(), + ), + } + } + + /// The data a host value saved by `to_host` holds. + pub(crate) fn from_host(v: &crate::HostValue) -> Self { + use crate::HostValue; + match v { + HostValue::Bool(b) => Data::Bool(*b), + HostValue::Number(n) => match crate::HostValue::Number(*n).to_json() { + Some(Json::Number(n)) => Data::Number(n), + _ => Data::Null, + }, + HostValue::String(s) => Data::String(s.clone()), + HostValue::Array(items) => Data::Array( + items + .iter() + .map(|i| i.as_ref().map_or(Data::Null, Data::from_host)) + .collect(), + ), + HostValue::Object(fields) => Data::Object( + fields + .iter() + .map(|(k, v)| (k.clone(), Data::from_host(v))) + .collect(), + ), + _ => Data::Null, + } + } +} + +impl From<&str> for Data { + fn from(s: &str) -> Self { + Data::String(s.into()) + } +} + +impl From for Data { + fn from(s: String) -> Self { + Data::String(s.into()) + } +} + +impl From for Data { + fn from(s: HostString) -> Self { + Data::String(s) + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/diagnostic.rs b/packages/codemode-rust/crates/psychoscript/src/diagnostic.rs new file mode 100644 index 0000000000000..eedfe67f1aa66 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/diagnostic.rs @@ -0,0 +1,98 @@ +//! What a run ends with besides its value: diagnostics and their kinds, the limits it runs under, and its +//! interruption. + +use std::fmt; + +#[derive(Clone, Copy, Debug, Default)] +pub struct Limits { + pub timeout_ms: Option, + pub max_output_bytes: Option, +} + +/// A diagnostic's kind: the language's own, or one a host function's failure names ([`Failure`](crate::Failure)), +/// the reference's `DiagnosticKind` string. +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum DiagnosticKind { + ParseError, + UnsupportedSyntax, + InvalidDataValue, + TimeoutExceeded, + ExecutionFailure, + /// Warning only: additional warnings were omitted by `max_output_bytes`. + Truncated, + /// A kind a host failure names. + Host(Box), +} + +impl DiagnosticKind { + /// The reference's name for the kind, such as `"ExecutionFailure"`. + pub fn name(&self) -> &str { + match self { + DiagnosticKind::ParseError => "ParseError", + DiagnosticKind::UnsupportedSyntax => "UnsupportedSyntax", + DiagnosticKind::InvalidDataValue => "InvalidDataValue", + DiagnosticKind::TimeoutExceeded => "TimeoutExceeded", + DiagnosticKind::ExecutionFailure => "ExecutionFailure", + DiagnosticKind::Truncated => "Truncated", + DiagnosticKind::Host(name) => name, + } + } + + /// The kind a name gives: the language's own kind by that name, or a host kind. + pub fn named(name: &str) -> Self { + match name { + "ParseError" => DiagnosticKind::ParseError, + "UnsupportedSyntax" => DiagnosticKind::UnsupportedSyntax, + "InvalidDataValue" => DiagnosticKind::InvalidDataValue, + "TimeoutExceeded" => DiagnosticKind::TimeoutExceeded, + "ExecutionFailure" => DiagnosticKind::ExecutionFailure, + "Truncated" => DiagnosticKind::Truncated, + other => DiagnosticKind::Host(other.into()), + } + } +} + +impl fmt::Display for DiagnosticKind { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(self.name()) + } +} + +/// A program's failure or warning. Its message and suggestions keep the program's text exactly, unpaired surrogates +/// included ([`HostString`](crate::HostString)); [`Diagnostic::message_lossy`] gives a Rust `String`. +#[derive(Clone, Debug)] +pub struct Diagnostic { + pub kind: DiagnosticKind, + pub message: crate::HostString, + /// 1-based line and column in the program source, when known. + pub location: Option<(u32, u32)>, + /// What the model could do about it, as a host failure gives them. + pub suggestions: Vec, +} + +impl Diagnostic { + /// The message as a Rust `String`, with U+FFFD for each unpaired surrogate. + pub fn message_lossy(&self) -> String { + self.message.to_string_lossy().into_owned() + } + + /// The suggestions as Rust `String`s, with U+FFFD for each unpaired surrogate. + pub fn suggestions_lossy(&self) -> Vec { + self.suggestions + .iter() + .map(|s| s.to_string_lossy().into_owned()) + .collect() + } +} + +/// A run that was interrupted, by a host call, instead of ending with an outcome. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct Interrupted; + +impl fmt::Display for Interrupted { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str("The run was interrupted.") + } +} + +impl std::error::Error for Interrupted {} diff --git a/packages/codemode-rust/crates/psychoscript/src/exec.rs b/packages/codemode-rust/crates/psychoscript/src/exec.rs new file mode 100644 index 0000000000000..f6fc04294aa2c --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/exec.rs @@ -0,0 +1,319 @@ +//! The small amount of executor a run needs without depending on one: a set of host futures woken individually, +//! a thread-parking `block_on`, and one shared timer thread that wakes runs at their deadline. + +use crate::offload::Home; +use std::collections::BinaryHeap; +use std::future::Future; +use std::pin::pin; +use std::sync::{Arc, Condvar, Mutex, OnceLock}; +use std::task::{Context, Poll, Wake, Waker}; +use std::time::Instant; + +/// A boxed future a host hands the runtime. `Send`, so a run can move between threads. +pub type BoxFuture<'a, T> = std::pin::Pin + Send + 'a>>; + +// ---------- block_on ---------- + +struct Parker { + woken: Mutex, + signal: Condvar, +} + +impl Wake for Parker { + fn wake(self: Arc) { + self.wake_by_ref(); + } + + fn wake_by_ref(self: &Arc) { + let mut woken = self.woken.lock().unwrap_or_else(|e| e.into_inner()); + *woken = true; + self.signal.notify_one(); + } +} + +/// Drives a future to completion on the calling thread, parking it while the future waits. +pub fn block_on(future: F) -> F::Output { + let mut future = pin!(future); + let parker = Arc::new(Parker { + woken: Mutex::new(false), + signal: Condvar::new(), + }); + let waker = Waker::from(parker.clone()); + let mut cx = Context::from_waker(&waker); + loop { + if let Poll::Ready(v) = future.as_mut().poll(&mut cx) { + return v; + } + let mut woken = parker.woken.lock().unwrap_or_else(|e| e.into_inner()); + while !*woken { + woken = parker.signal.wait(woken).unwrap_or_else(|e| e.into_inner()); + } + *woken = false; + } +} + +// ---------- the task set ---------- + +/// Which tasks were woken since the run last looked, and the run's own waker to pass the news on. +#[derive(Default)] +struct Shared { + ready: Vec, + parent: Option, +} + +struct TaskWaker { + index: usize, + shared: Arc>, +} + +impl Wake for TaskWaker { + fn wake(self: Arc) { + self.wake_by_ref(); + } + + fn wake_by_ref(self: &Arc) { + let parent = { + let mut shared = self.shared.lock().unwrap_or_else(|e| e.into_inner()); + shared.ready.push(self.index); + shared.parent.clone() + }; + if let Some(parent) = parent { + parent.wake(); + } + } +} + +struct ParentWaker(Arc>); + +impl Wake for ParentWaker { + fn wake(self: Arc) { + self.wake_by_ref(); + } + + fn wake_by_ref(self: &Arc) { + let parent = self + .0 + .lock() + .unwrap_or_else(|e| e.into_inner()) + .parent + .clone(); + if let Some(parent) = parent { + parent.wake(); + } + } +} + +struct Slot<'a, T> { + future: BoxFuture<'a, T>, + waker: Waker, + tag: u32, +} + +/// The host futures a run has in flight. Each has its own waker, so only woken ones are polled again. Dropping the +/// set drops, and so cancels, every one of them. +pub struct Tasks<'a, T> { + slots: Vec>>, + free: Vec, + live: usize, + shared: Arc>, +} + +impl<'a, T> Default for Tasks<'a, T> { + fn default() -> Self { + Self { + slots: Vec::new(), + free: Vec::new(), + live: 0, + shared: Arc::default(), + } + } +} + +impl<'a, T> Tasks<'a, T> { + pub fn is_empty(&self) -> bool { + self.live == 0 + } + + /// The tags of the futures in flight. + pub fn tags(&self) -> impl Iterator + '_ { + self.slots.iter().flatten().map(|slot| slot.tag) + } + + /// Starts a future: it is polled once now, so its work begins at the call. `Ready` means it finished already. + /// While the run computes on a worker thread, that poll happens back `home`, where the run is driven. + pub fn spawn(&mut self, tag: u32, future: BoxFuture<'a, T>, home: Option<&Home>) -> Poll + where + 'a: 'static, + T: Send + 'static, + { + let index = self.free.pop().unwrap_or_else(|| { + self.slots.push(None); + self.slots.len() - 1 + }); + let waker = Waker::from(Arc::new(TaskWaker { + index, + shared: self.shared.clone(), + })); + let first = |mut future: BoxFuture<'a, T>, waker: &Waker| { + let poll = future.as_mut().poll(&mut Context::from_waker(waker)); + (future, poll) + }; + let started = match home { + None => Some(first(future, &waker)), + Some(home) => { + let waker = waker.clone(); + home.run(move || first(future, &waker)) + } + }; + let future = match started { + Some((_, Poll::Ready(v))) => { + self.free.push(index); + return Poll::Ready(v); + } + Some((future, Poll::Pending)) => future, + // The run is being dropped: the future went with the request. + None => { + self.free.push(index); + return Poll::Pending; + } + }; + self.slots[index] = Some(Slot { future, waker, tag }); + self.live += 1; + Poll::Pending + } + + /// Polls every task woken since the last call; returns the finished ones with their tags, in completion order. + pub fn poll_ready(&mut self) -> Vec<(u32, T)> { + let ready = { + let mut shared = self.shared.lock().unwrap_or_else(|e| e.into_inner()); + std::mem::take(&mut shared.ready) + }; + let mut done = Vec::new(); + for index in ready { + let Some(Some(slot)) = self.slots.get_mut(index) else { + continue; + }; + let mut cx = Context::from_waker(&slot.waker); + if let Poll::Ready(v) = slot.future.as_mut().poll(&mut cx) { + let tag = slot.tag; + self.slots[index] = None; + self.free.push(index); + self.live -= 1; + done.push((tag, v)); + } + } + done + } + + /// Whether some task was woken and waits to be polled. + pub fn has_ready(&self) -> bool { + !self + .shared + .lock() + .unwrap_or_else(|e| e.into_inner()) + .ready + .is_empty() + } + + /// The waker to wake when a task becomes ready; `None` when nobody waits. + pub fn set_parent(&self, waker: Option<&Waker>) { + let mut shared = self.shared.lock().unwrap_or_else(|e| e.into_inner()); + shared.parent = waker.cloned(); + } + + /// A waker that wakes whoever waits on the set when it fires, even if that changes after it was made. + pub fn parent_waker(&self) -> Waker { + Waker::from(Arc::new(ParentWaker(self.shared.clone()))) + } + + /// Cancels every task by dropping it. + pub fn clear(&mut self) { + self.slots.clear(); + self.free.clear(); + self.live = 0; + } +} + +// ---------- the timer ---------- + +struct Timer { + queue: Mutex>, + signal: Condvar, +} + +struct Deadline { + at: Instant, + waker: Waker, +} + +impl PartialEq for Deadline { + fn eq(&self, other: &Self) -> bool { + self.at == other.at + } +} + +impl Eq for Deadline {} + +impl PartialOrd for Deadline { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl Ord for Deadline { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + other.at.cmp(&self.at) + } +} + +/// Wakes `waker` at `at`, from one timer thread shared by every run, started the first time a run waits with a +/// timeout. A run that already ended just gets a spurious wake. +pub fn wake_at(at: Instant, waker: &Waker) { + static TIMER: OnceLock>> = OnceLock::new(); + let timer = TIMER.get_or_init(|| { + let timer = Arc::new(Timer { + queue: Mutex::new(BinaryHeap::new()), + signal: Condvar::new(), + }); + let worker = timer.clone(); + std::thread::Builder::new() + .name("psychoscript-timer".into()) + .spawn(move || run_timer(&worker)) + .ok() + .map(|_| timer) + }); + match timer { + Some(timer) => { + let mut queue = timer.queue.lock().unwrap_or_else(|e| e.into_inner()); + queue.push(Deadline { + at, + waker: waker.clone(), + }); + timer.signal.notify_one(); + } + // No thread to wait on: wake now, so the run polls again and finds its deadline. + None => waker.wake_by_ref(), + } +} + +fn run_timer(timer: &Timer) { + let mut queue = timer.queue.lock().unwrap_or_else(|e| e.into_inner()); + loop { + let now = Instant::now(); + while queue.peek().is_some_and(|d| d.at <= now) { + if let Some(d) = queue.pop() { + d.waker.wake(); + } + } + queue = match queue.peek().map(|d| d.at) { + Some(at) => { + timer + .signal + .wait_timeout(queue, at.saturating_duration_since(now)) + .unwrap_or_else(|e| e.into_inner()) + .0 + } + None => timer.signal.wait(queue).unwrap_or_else(|e| e.into_inner()), + }; + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/gc.rs b/packages/codemode-rust/crates/psychoscript/src/gc.rs new file mode 100644 index 0000000000000..3ca3e6ecf9d08 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/gc.rs @@ -0,0 +1,58 @@ +//! Heap accounting, for measuring automatic memory management (`gc-stats` builds only). +//! +//! A run publishes its counts to its [`Run`](crate::Run) each time it stops for the host, so a harness reads them +//! between events with [`Run::heap_stats`](crate::Run::heap_stats). Collectors add their pauses as they make them. + +use crate::vm::Vm; + +/// A run's heap as of its last stop: live and peak slots of each kind, and what collecting cost. +#[derive(Clone, Debug, Default)] +pub struct HeapStats { + pub objects: u64, + pub cells: u64, + pub strings: u64, + pub atoms: u64, + pub peak_objects: u64, + pub peak_cells: u64, + pub peak_strings: u64, + pub peak_atoms: u64, + /// Collection steps taken, and their total and individual durations. + pub steps: u64, + pub gc_ns: u64, + pub pauses_ns: Vec, +} + +impl Vm { + /// Live slots now, freed ones left out: objects, cells, strings, atoms. + pub fn heap_counts(&self) -> (u64, u64, u64, u64) { + let (objects, cells) = self.gc.free_counts(); + ( + (self.heap.len() - objects) as u64, + (self.cells.len() - cells) as u64, + (self.atoms.bufs.len() - self.atoms.gc.free.len()) as u64, + (self.atoms.atom_str.len() - self.atoms.gc.atom_free.len()) as u64, + ) + } + + /// Copies the counts to the run's stats. A collector also calls it just before it frees, so the peaks hold. + pub fn publish_stats(&self) { + let (objects, cells, strings, atoms) = self.heap_counts(); + let mut s = self.host.run.stats(); + s.objects = objects; + s.cells = cells; + s.strings = strings; + s.atoms = atoms; + s.peak_objects = s.peak_objects.max(objects); + s.peak_cells = s.peak_cells.max(cells); + s.peak_strings = s.peak_strings.max(strings); + s.peak_atoms = s.peak_atoms.max(atoms); + } + + /// Records one collection step of `ns` nanoseconds. + pub fn record_pause(&self, ns: u64) { + let mut s = self.host.run.stats(); + s.steps += 1; + s.gc_ns += ns; + s.pauses_ns.push(ns.min(u32::MAX as u64) as u32); + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/host.rs b/packages/codemode-rust/crates/psychoscript/src/host.rs new file mode 100644 index 0000000000000..e08a1806f00cf --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/host.rs @@ -0,0 +1,2191 @@ +//! The VM's side of host work: the run's host globals (see [`crate::host_function`]) and modules, the host calls a run +//! has in flight and how they settle. Arguments cross out and results cross in as copies. + +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::{Arc, Mutex}; +use std::task::Poll; + +use rustc_hash::FxHashMap; + +use crate::exec::{BoxFuture, Tasks, block_on}; +use crate::host_function::{ + Body, DurableCall, DurableFunction, HostError, HostFunction, HostResult, HostString, HostValue, + Namespace, Resolved, Returned, SnapshotHooks, +}; +use crate::object::*; +use crate::runtime::{Run, Translate, TranslateFunctions, TranslatePromises}; +use crate::strings::Atom; +use crate::value::{Id, Value}; +use crate::vm::{NativeFn, Res, Vm}; +use crate::{Data, DiagnosticKind}; + +/// The names bound in every program before its host globals, as the reference's `globalNames` lists them. +pub const GLOBAL_NAMES: &[&str] = &[ + "require", + "undefined", + "NaN", + "Infinity", + "Object", + "Function", + "Array", + "Math", + "JSON", + "console", + "Promise", + "Symbol", + "Iterator", + "Number", + "String", + "Boolean", + "parseInt", + "parseFloat", + "isFinite", + "isNaN", + "Date", + "RegExp", + "Map", + "Set", + "WeakMap", + "WeakSet", + "URL", + "URLSearchParams", + "Headers", + "Uint8Array", + "Buffer", + "TextEncoder", + "TextDecoder", + "encodeURI", + "encodeURIComponent", + "decodeURI", + "decodeURIComponent", + "atob", + "btoa", + "crypto", + "structuredClone", + "Error", + "TypeError", + "RangeError", + "SyntaxError", + "ReferenceError", + "EvalError", + "URIError", + "AggregateError", +]; + +/// The hidden global the compiler loads modules through. Not an identifier, so programs cannot name it. +pub const IMPORT_GLOBAL: &str = "%import"; + +/// How a host call settles its promise. +pub enum Settlement { + Undefined, + Failure(Box), + /// A host call's value, or what it threw. + Host(Box), + /// A value a snapshot couldn't keep (a live response, the reference's `Lost`): the call fails with this message + /// once the run resumes, at the call's source offset. + Lost(String, Option), + /// The call interrupts the whole run. + Interrupted, +} + +/// A host call's outcome, with what converting it needs. +pub struct Settled { + pub result: HostResult, + /// Names the call in conversion errors. + pub label: String, + /// The global host function whose `snapshot` hooks save functions in the value, by label. + pub owner: Option, + /// The source offset of the call, where an error converting its value points. + pub site: Option, +} + +impl Settlement { + pub(crate) fn host( + result: HostResult, + label: String, + owner: Option, + site: Option, + ) -> Self { + Settlement::Host(Box::new(Settled { + result, + label, + owner, + site, + })) + } +} + +/// A host call's failure. Boxed, so the common successful settlement stays small. +pub struct Failed { + kind: DiagnosticKind, + message: HostString, + suggestions: Vec, +} + +impl Failed { + pub fn parts(&self) -> (&DiagnosticKind, &HostString, &[HostString]) { + (&self.kind, &self.message, &self.suggestions) + } + + pub fn from_parts( + kind: DiagnosticKind, + message: HostString, + suggestions: Vec, + ) -> Box { + Box::new(Failed { + kind, + message, + suggestions, + }) + } +} + +/// What a program function made from the host calls: a host function, or a durable one. +#[derive(Clone)] +pub enum Callee { + Fn(HostFunction), + Durable(DurableFunction), +} + +impl Callee { + /// Its own name, or `None` when it is to be named by where it is. + fn name(&self) -> Option<&str> { + match self { + Callee::Fn(f) if f.own_name || !f.name.is_empty() => Some(f.name()), + _ => None, + } + } + + fn length(&self) -> u8 { + match self { + Callee::Fn(f) => f.length, + Callee::Durable(_) => 0, + } + } +} + +/// A host function the program holds: what it calls, and where it is. +pub struct FnEntry { + pub(crate) f: Callee, + /// How the program names it in errors: `fetch`, `fs.readFile`, `api.issues.list`. + pub(crate) label: String, + /// Where it is among the run's host globals, so a resumed run can find it again; none inside a result. + pub(crate) path: Option>, + /// The global host function whose `snapshot` hooks save the values this function returns, by label. + pub(crate) owner: Option, + /// Whether it is among the globals, even where no path leads (inside an array): such a function never crosses + /// back to the host as itself. + pub(crate) installed: bool, +} + +/// A host call in flight, as a suspend sees it. +pub struct InFlight { + pub promise: Id, + pub call: u64, + /// How the program names the function: `fetch`, `api.issues.list`. + pub label: String, + /// Where the function is among the globals, to find it again on resume. + pub path: Option>, + /// The arguments as they crossed, for a call that starts again on resume. + pub args: Vec, + pub owner: Option, + pub site: Option, + pub kind: CallKind, + /// Whether host functions crossed back among its arguments: a suspend is refused until it completes. + pub holds_functions: bool, + /// Set when a suspend detaches the call, so its durable work is not cancelled. + pub detached: Arc, +} + +pub enum CallKind { + /// A suspend is refused while it runs. + Blocking, + /// Interrupted on suspend and run again on resume. + Idempotent, + /// A durable call: its data once `start` returned it (a suspend is refused before that), and what cancels it. + Durable(Arc>>, DurableFunction, DurableCall), +} + +/// A host result whose functions its owner's `snapshot` hooks can bring back: the value as the host returned it, +/// and the range of `functions` made from it, in the order `from_host` visits them. +pub struct ResultRoot { + pub owner: String, + pub value: HostValue, + pub functions: std::ops::Range, +} + +/// A run's id, shared by its calls and made the first time it is read, when the host gave none. +pub(crate) type RunId = Arc>; + +/// The key of a run's host call, `:`. +pub(crate) fn call_key(run_id: &RunId, call: u64) -> String { + format!("{}:{}", run_id.get_or_init(random_run_id), call) +} + +/// A random run id, as the reference uses a random UUID. +pub fn random_run_id() -> String { + use std::sync::atomic::AtomicU64; + static COUNTER: AtomicU64 = AtomicU64::new(0); + let seed = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .map(|d| d.as_nanos() as u64) + .unwrap_or(0) + ^ COUNTER.fetch_add(0x9e37_79b9_7f4a_7c15, Ordering::Relaxed); + let mix = |mut z: u64| { + z = (z ^ (z >> 30)).wrapping_mul(0xbf58_476d_1ce4_e5b9); + z = (z ^ (z >> 27)).wrapping_mul(0x94d0_49bb_1331_11eb); + z ^ (z >> 31) + }; + let (a, b) = (mix(seed), mix(seed.wrapping_add(0x9e37_79b9_7f4a_7c15))); + format!( + "{:08x}-{:04x}-4{:03x}-{:04x}-{:012x}", + a >> 32, + (a >> 16) & 0xffff, + a & 0x0fff, + ((b >> 48) & 0x3fff) | 0x8000, + b & 0xffff_ffff_ffff + ) +} + +/// What a run tells whoever may suspend it from another thread (its program's suspenders), and asks of them. +pub(crate) trait SuspendWatch: Send + Sync { + /// Whether a suspend is waiting for the run to reach a step boundary. + fn requested(&self) -> bool; + /// Whether anyone can suspend the run, so synchronous calls only record themselves when it matters. + fn watched(&self) -> bool; + /// A synchronous host call starts, named by its key and label: a suspend is refused until it returns. + fn enter_sync(&self, key: String, path: String); + fn leave_sync(&self); +} + +/// No one can suspend the run. +struct Unwatched; + +impl SuspendWatch for Unwatched { + fn requested(&self) -> bool { + false + } + fn watched(&self) -> bool { + false + } + fn enter_sync(&self, _: String, _: String) {} + fn leave_sync(&self) {} +} + +/// The host globals a run gets, made by the runtime's `globals(run)` when it starts or resumes. +pub type Globals = Arc<[(String, HostValue)]>; + +/// The host state of one run. +pub struct RunHost { + /// The run's host globals. + pub(crate) globals: Globals, + /// Module names that load a global, beyond its own name. + pub(crate) modules: Arc<[(String, String)]>, + pub(crate) translate: Translate, + /// The run as its globals see it: its id and metadata. + pub(crate) run: Run, + pub(crate) next_call: u64, + pub tasks: Tasks<'static, Settlement>, + pub(crate) functions: Vec, + /// Host calls in flight. + pub calls: Vec, + /// Results whose functions survive a suspend through their owner's hooks. + pub results: Vec, + /// Calls a resumed run starts again when it begins. + pub restarts: Vec, + /// Calls made since the last handover, which start at the next one (`launch`), as the reference queues them for + /// its driver. + pub(crate) queued: Vec, + /// Whoever may suspend the run: what they ask of it, and the synchronous call that refuses them meanwhile. + pub shared: Arc, + /// Set once the run is being suspended: an interruption then detaches a call instead of ending it. + pub(crate) suspending: Arc, + /// Suggestions attached to failure values, by error object. + pub suggestions: FxHashMap>, + pub(crate) promise_like: Option, + /// Whether a call interrupted the run. + pub interrupted: bool, + /// Moving long stretches of compute to a worker thread, for a run driven as a future. Boxed: the VM's hot fields + /// sit after this struct, and a few more bytes here measurably slow its dispatch loop. + pub(crate) offload: Option>, + /// Rejected promises nothing handled yet, with their reasons, for the run's warnings. + pub unhandled: Vec<(Id, Value)>, + pub(crate) modules_loaded: FxHashMap, + pub(crate) namespaces: FxHashMap, + /// The host namespaces among the globals, by the label of the global they are, with where they are. + /// The host namespaces among the globals, by the atom of the label of the global they are, with where they are. + pub(crate) host_namespaces: FxHashMap)>, + /// Counts the points where the reference hands queued calls to the host, for streaming responses. + pub(crate) epoch: crate::streaming::Epoch, + /// The VM's fuel counters, which it checks only when its step budget runs out. + pub(crate) meter: Meter, +} + +/// A call in flight a resumed run starts again: its promise, id, label, path, arguments, owner, site, and how. +pub struct Restart { + pub promise: Id, + pub call: u64, + pub label: String, + pub path: Option>, + pub args: Vec, + pub owner: Option, + pub site: Option, + pub start: Start, +} + +/// A call that starts at the next handover: an async or durable function's call, or the work a synchronous function +/// left pending. +pub(crate) enum Queued { + Call(Id, Callee, Box, bool), + Work(Id, BoxFuture<'static, Settlement>, Box), +} + +/// Starts the calls made since the last handover, in the order they were made: the reference hands its queued calls +/// to the driver at every stop. +pub fn launch(vm: &mut Vm) { + for queued in std::mem::take(&mut vm.host.queued) { + match queued { + Queued::Call(p, f, r, holds) => spawn_call(vm, p, &f, *r, holds), + Queued::Work(p, work, in_flight) => track(vm, p, work, || *in_flight), + } + } +} + +/// The reference's fuel left (`handover`) and the steps left until the VM next checks the clock (`fuel`), as of when +/// the VM's step budget was last set to `start`. +pub(crate) struct Meter { + pub start: i32, + pub handover: i32, + pub fuel: i32, + /// Set by a built-in the reference writes in bytecode as it returns: see `Vm::bytecode_builtin`. + pub bytecode: bool, + /// Whether the native called last stands for a call of the reference's bytecode, which spends fifty on it: see + /// `fuel::Conversions`. + pub counted: bool, +} + +impl RunHost { + /// A point where the reference starts the calls queued so far: a new job, or a finished synchronous call. + #[inline] + pub fn next_epoch(&self) { + use std::sync::atomic::Ordering::Relaxed; + self.epoch.store(self.epoch.load(Relaxed) + 1, Relaxed); + } + + pub(crate) fn new( + globals: Globals, + modules: Arc<[(String, String)]>, + translate: Translate, + run: Run, + ) -> Self { + Self { + globals, + modules, + translate, + run, + next_call: 0, + tasks: Tasks::default(), + functions: Vec::new(), + calls: Vec::new(), + results: Vec::new(), + restarts: Vec::new(), + queued: Vec::new(), + shared: Arc::new(Unwatched), + suspending: Arc::default(), + suggestions: FxHashMap::default(), + promise_like: None, + interrupted: false, + unhandled: Vec::new(), + offload: None, + modules_loaded: FxHashMap::default(), + namespaces: FxHashMap::default(), + host_namespaces: FxHashMap::default(), + epoch: Default::default(), + meter: Meter { + start: crate::vm::HANDOVER_FUEL, + handover: crate::vm::HANDOVER_FUEL, + fuel: crate::vm::FUEL, + bytecode: false, + counted: false, + }, + } + } + + /// A run with no host globals, for what the snapshot's tables need. + pub(crate) fn bare() -> Self { + Self::new( + Arc::from([]), + Arc::from([]), + Translate::default(), + Run::new(None, Data::Null), + ) + } + + /// Whether host work is still in flight, so an idle program is waiting rather than stuck. + pub fn waiting(&self) -> bool { + !self.tasks.is_empty() + } + + pub(crate) fn next_call(&mut self) -> u64 { + let id = self.next_call; + self.next_call += 1; + id + } + + /// The key of the call with this id. + pub fn key(&self, call: u64) -> String { + call_key(&self.run.id, call) + } + + /// What a host function's call gets. + pub(crate) fn call(&self, call: u64) -> crate::host_function::Call { + crate::host_function::Call::new(self.run.id.clone(), call, self.suspending.clone()) + } + + /// A synchronous host call starts: a suspend is refused until it returns (`SuspendWatch::enter_sync`). + pub(crate) fn enter_sync(&self, call: u64, label: String) { + if self.shared.watched() { + self.shared.enter_sync(self.key(call), label); + } + } + + pub(crate) fn leave_sync(&self) { + self.shared.leave_sync(); + } + + /// A call settled: it is no longer in flight. + pub fn settled(&mut self, promise: Id) { + if let Some(i) = self.calls.iter().position(|c| c.promise == promise) { + self.calls.swap_remove(i); + } + } + + /// The run's offload state, made on first use. + pub(crate) fn offload(&mut self) -> &mut crate::offload::Offload { + self.offload.get_or_insert_default() + } + + /// Stops durable work still running when the run ends or is interrupted for real; a suspend detaches it first. + pub fn cancel_durable(&mut self) { + for call in std::mem::take(&mut self.calls) { + let CallKind::Durable(data, f, durable) = &call.kind else { + continue; + }; + if call.detached.load(Ordering::Relaxed) { + continue; + } + let data = data.lock().unwrap_or_else(|e| e.into_inner()).clone(); + if let Some(data) = data { + block_on((f.cancel)(data, durable.clone())); + } + } + } + + /// The snapshot hooks of the global host function labelled `owner`. + pub(crate) fn hooks(&self, owner: &str) -> Option { + let mut found = None; + for (name, value) in self.globals.iter() { + labeled_functions(value, name, &mut |label, f| { + if found.is_none() && label == owner { + found = f.snapshot.clone(); + } + }); + } + found + } + + /// The function at `path` among the globals now, through objects and namespaces, as the reference's + /// `hosts.resolve` finds it for a resumed call. + pub(crate) fn resolve(&self, path: &[HostString]) -> Option { + let (first, rest) = path.split_first()?; + let mut at = &self.globals.iter().find(|(name, _)| first == name)?.1; + for (index, key) in rest.iter().enumerate() { + match at { + HostValue::Namespace(ns) => { + return match (ns.resolve)(&rest[index..]) { + Resolved::Function(f) => Some(Callee::Fn(f)), + Resolved::Durable(f) => Some(Callee::Durable(f)), + Resolved::Missing(_) => None, + }; + } + HostValue::Object(fields) => at = &fields.iter().find(|(k, _)| k == key)?.1, + _ => return None, + } + } + match at { + HostValue::Function(f) => Some(Callee::Fn(f.clone())), + HostValue::Durable(f) => Some(Callee::Durable(f.clone())), + _ => None, + } + } +} + +impl Drop for RunHost { + fn drop(&mut self) { + self.cancel_durable(); + } +} + +/// Visits the functions of a global value with their labels, in the order `from_host` meets them, through plain +/// objects only: `fs.readFile`. +pub(crate) fn labeled_functions( + v: &HostValue, + label: &str, + f: &mut dyn FnMut(&str, &HostFunction), +) { + match v { + HostValue::Function(hf) => f(label, hf), + HostValue::Object(fields) => { + for (k, item) in fields { + labeled_functions(item, &format!("{label}.{k}"), f); + } + } + _ => {} + } +} + +// ---------- setup ---------- + +/// Defines the host globals the program refers to: `require`, the import hook, and the run's host globals. The rest +/// are made only if a module import asks for them, so a run pays only for the globals it uses. +pub fn install(vm: &mut Vm, referenced: &[Atom]) { + for &a in referenced { + let name = vm.atoms.text(a).to_owned(); + define_host_global(vm, &name); + } +} + +/// Defines one host global by name; false when there is none. +fn define_host_global(vm: &mut Vm, name: &str) -> bool { + let v = match name { + "require" if !has_host_global(vm, name) => { + native(vm, "require", 1, require_native, Value::Undef) + } + IMPORT_GLOBAL => native(vm, "import", 2, import_native, Value::Undef), + _ => { + let globals = vm.host.globals.clone(); + let Some((_, value)) = globals.iter().find(|(n, _)| n == name) else { + return false; + }; + let place = Place { + global: Some(vec![name.into()]), + installed: true, + within: None, + }; + from_host(vm, value, name, &place, 0).unwrap_or(Value::Undef) + } + }; + global(vm, name, v); + true +} + +/// Whether the run's host globals have one by this name, which wins over a built-in of the same name. +pub(crate) fn has_host_global(vm: &Vm, name: &str) -> bool { + vm.host.globals.iter().any(|(n, _)| n == name) +} + +fn global(vm: &mut Vm, name: &str, v: Value) { + let a = vm.atoms.intern(name); + vm.global_map.insert(a, v); +} + +pub(crate) fn native(vm: &mut Vm, name: &str, length: u8, f: NativeFn, data: Value) -> Value { + let name = vm.atoms.intern(name); + let proto = vm.realm.function_proto; + Value::Obj(vm.alloc(Obj::new( + Some(proto), + Kind::Native { + f, + data, + name, + length, + ctor: false, + }, + ))) +} + +// ---------- host calls ---------- + +/// How a call's future begins: a new call, an idempotent call run again on resume, or a started durable call +/// reconnected to its work through its data. +pub enum Start { + Call, + Again, + Wait(Data), +} + +/// A promise was rejected with nothing to handle it: a warning, unless something handles it before the run ends. +pub fn unhandled(vm: &mut Vm, p: Id, reason: Value) { + if vm.fatal.is_none() { + vm.host.unhandled.push((p, reason)); + } +} + +/// A reaction was attached to a rejected promise, so its rejection is handled after all. +#[inline] +pub fn handled(vm: &mut Vm, p: Id) { + if !vm.host.unhandled.is_empty() { + vm.host.unhandled.retain(|(q, _)| *q != p); + } +} + +/// Stops the run at once: it ends interrupted, and calls still running are interrupted with it. +pub fn interrupt(vm: &mut Vm) { + vm.host.interrupted = true; + if vm.fatal.is_none() { + vm.fatal = Some(( + DiagnosticKind::ExecutionFailure, + crate::diagnostic::Interrupted.to_string(), + )); + } +} + +/// Settles a host call's promise with what it ended with. +#[inline] +pub fn settle(vm: &mut Vm, p: Id, s: Settlement) { + match s { + Settlement::Interrupted => interrupt(vm), + Settlement::Undefined => vm.fulfill(p, Value::Undef), + Settlement::Failure(f) => { + let e = failure_value(vm, f.kind, f.message, f.suggestions); + vm.reject(p, e); + } + Settlement::Lost(message, site) => { + let e = vm.type_error(&message); + locate_at(vm, &e, site); + vm.reject(p, e); + } + Settlement::Host(settled) => { + let Settled { + result, + label, + owner, + site, + } = *settled; + match result { + Ok(v) => { + let v = result_from_host(vm, v, &label, owner.as_deref()); + match v { + Ok(v) => vm.fulfill(p, v), + Err(e) => { + // The reference converts the value at the call, so its errors point there. + locate_at(vm, &e, site); + vm.reject(p, e) + } + } + } + Err(HostValue::Interrupt) => interrupt(vm), + Err(thrown) => { + let e = thrown_value(vm, &thrown, &label); + vm.reject(p, e); + } + } + } + } +} + +/// What a host function threw, as the program sees it: a failure keeps its kind and suggestions. +fn thrown_value(vm: &mut Vm, thrown: &HostValue, label: &str) -> Value { + match thrown { + HostValue::Failure(f) => failure_value( + vm, + DiagnosticKind::named(&f.kind), + f.message.clone(), + f.suggestions.clone(), + ), + thrown => from_host(vm, thrown, label, &Place::default(), 0).unwrap_or_else(|e| e), + } +} + +/// Points an error the VM made, not yet located, at a host call's source offset. +pub(crate) fn locate_at(vm: &mut Vm, e: &Value, site: Option) { + if let Value::Obj(id) = e + && let Kind::Error(Some(f)) = &mut vm.heap[*id as usize].kind + && f.offset.is_none() + { + f.offset = site; + } +} + +fn failure_value( + vm: &mut Vm, + kind: DiagnosticKind, + message: HostString, + suggestions: Vec, +) -> Value { + let proto = vm.realm.error_proto; + let e = vm.failure(proto, &message.to_run_text(), kind); + if !suggestions.is_empty() + && let Value::Obj(id) = e + { + vm.host.suggestions.insert(id, suggestions); + } + e +} + +/// Calls the function a namespace path names, as the reference's `callNamespace`: `resolve` gives the function, or +/// the failure the call throws. +pub fn call_namespace(vm: &mut Vm, id: Id, args: &[Value], callee: Value) -> Res { + let ns = vm.ns_path(id); + let Some((namespace, _)) = vm.host.host_namespaces.get(&ns.root) else { + let message = format!("The namespace {} is not available.", vm.atoms.text(ns.root)); + return Err(vm.type_error(&message)); + }; + let resolve = namespace.resolve.clone(); + let resolved = match home_of(vm) { + None => resolve(&ns.keys), + Some(home) => { + let keys = ns.keys.clone(); + let Some(resolved) = home.run(move || resolve(&keys)) else { + interrupt(vm); + return Err(Value::Undef); + }; + resolved + } + }; + let f = match resolved { + Resolved::Missing(f) => { + return Err(failure_value( + vm, + DiagnosticKind::named(&f.kind), + f.message, + f.suggestions, + )); + } + Resolved::Function(f) => Callee::Fn(f), + Resolved::Durable(f) => Callee::Durable(f), + }; + // Where the function is among the globals, which only a call that may start again on resume needs. + let path = match &f { + Callee::Fn(f) if !f.idempotent => None, + _ => vm + .host + .host_namespaces + .get(&ns.root) + .map(|(_, global)| global.iter().chain(ns.keys.iter()).cloned().collect()), + }; + let target = Target { + label: vm.ns_label(&ns), + path, + owner: None, + }; + call_host(vm, &f, args, target, callee) +} + +/// Where a host function is, and how its calls are named and saved: the reference's `HostTarget`. +struct Target { + label: String, + path: Option>, + owner: Option, +} + +/// Calls a host function from the program, which reached it as `callee`. Its arguments cross to the host now. An +/// async or durable function's call starts at once and the program gets its promise; a failure crossing rejects it. +/// A synchronous one is called now: its value crosses back at once, and work it left pending is a promise. When the +/// runtime awaits promises in arguments and one hasn't fulfilled, the call waits for them first. +fn call_host(vm: &mut Vm, f: &Callee, args: &[Value], target: Target, callee: Value) -> Res { + let takes = matches!(f, Callee::Fn(f) if f.takes_functions); + let concurrent = match f { + Callee::Durable(_) => true, + Callee::Fn(f) => f.is_async(), + }; + let mut back = false; + // Program getters in the arguments run first, as program code, before anything else happens for the call: no + // promise, no call id. The call is then made again with their values (`Vm::with_reads`). + let crossed = + match vm.with_reads(|vm| host_args(vm, args, &target.label, takes.then_some(&mut back))) { + crate::accessors::WithReads::Done(r) => r, + // An async call reads them in a frame that settles its promise, so a getter that throws rejects it. + crate::accessors::WithReads::Prefetch(_) + if concurrent && vm.reads.table.is_empty() && !reading_for_call(vm) => + { + let p = vm.new_promise(); + let (u, z) = (Value::Undef, Value::Num(0.0)); + let mut slots = vec![ + Value::Num(crate::promise::TRY as f64), + Value::Obj(p), + u, + z, + callee, + u, + Value::Num(args.len() as f64), + ]; + slots.extend_from_slice(args); + return vm.enter_native_with( + crate::native::NativeOp::Settle, + READ_FOR_CALL, + u, + u, + &slots, + ); + } + crate::accessors::WithReads::Prefetch(missing) => return Err(vm.prefetch(missing)), + }; + // What the arguments can't cross fails at the call, as the reference locates it. + let crossed = match crossed { + Err(e) => { + let site = vm.call_offset(); + locate_at(vm, &e, site); + Err(e) + } + ok => ok, + }; + if concurrent { + let site = vm.call_offset(); + let host_args = match crossed { + Ok(Args::Ready(host_args)) => host_args, + Ok(Args::Wait(promises)) => { + let p = vm.new_promise(); + crate::cross::wait_async(vm, promises, callee, args, p); + return Ok(Value::Obj(p)); + } + Err(e) if vm.fatal.is_none() => { + let p = vm.new_promise(); + vm.reject(p, e); + return Ok(Value::Obj(p)); + } + Err(e) => return Err(e), + }; + let p = vm.new_promise(); + let call = vm.host.next_call(); + let r = Restart { + promise: p, + call, + label: target.label, + path: target.path, + args: host_args, + owner: target.owner, + site, + start: Start::Call, + }; + vm.host + .queued + .push(Queued::Call(p, f.clone(), Box::new(r), back)); + return Ok(Value::Obj(p)); + } + let Callee::Fn(f) = f else { + unreachable!("durable functions are concurrent") + }; + let host_args = match crossed? { + Args::Ready(host_args) => host_args, + Args::Wait(promises) => return crate::cross::wait_sync(vm, promises, callee, args), + }; + let Body::Sync(body) = &f.body else { + unreachable!("a synchronous function has a synchronous body") + }; + let call_id = vm.host.next_call(); + vm.host.enter_sync(call_id, target.label.clone()); + let call = vm.host.call(call_id); + let returned = match home_of(vm) { + None => body(host_args, &call), + Some(home) => { + let body = body.clone(); + home.run(move || body(host_args, &call)) + .unwrap_or(Returned::Now(Err(HostValue::Interrupt))) + } + }; + let returned = match returned { + // The run waits for the work: the reference's driver takes over, starting the calls queued so far. + Returned::Block(work) => { + vm.host.next_epoch(); + launch(vm); + Returned::Now(block(vm, work)) + } + returned => returned, + }; + vm.host.leave_sync(); + match returned { + Returned::Now(Err(HostValue::Interrupt)) | Returned::Block(_) => { + interrupt(vm); + Err(Value::Undef) + } + Returned::Now(Ok(v)) => { + let site = vm.call_offset(); + let v = result_from_host(vm, v, &target.label, target.owner.as_deref()) + .inspect_err(|e| locate_at(vm, e, site))?; + Ok(if f.thenable { promise_like(vm, v) } else { v }) + } + Returned::Now(Err(thrown)) => Err(thrown_value(vm, &thrown, &target.label)), + Returned::Pending(work) => { + let site = vm.call_offset(); + let p = vm.new_promise(); + let (label, owner) = (target.label.clone(), target.owner.clone()); + let future: BoxFuture<'_, Settlement> = + Box::pin(async move { Settlement::host(work.await, label, owner, site) }); + let in_flight = InFlight { + promise: p, + call: call_id, + label: target.label, + path: None, + args: Vec::new(), + owner: None, + site, + kind: CallKind::Blocking, + holds_functions: false, + detached: Arc::default(), + }; + vm.host + .queued + .push(Queued::Work(p, future, Box::new(in_flight))); + Ok(Value::Obj(p)) + } + } +} + +/// Waits on the thread for work a synchronous call blocks on, while the run's other host calls keep running: what they +/// complete with waits in the inbox. The run's timeout stops the wait; the call then fails as the run times out. While +/// the run is on its worker, the wait and the other calls' polls happen where the run is driven. +fn block(vm: &mut Vm, work: BoxFuture<'static, HostResult>) -> HostResult { + let deadline = vm + .limits + .timeout_ms + .map(|ms| vm.start + std::time::Duration::from_millis(ms)); + let (settled, done) = match home_of(vm) { + None => wait(&mut vm.host.tasks, work, deadline), + Some(home) => { + let mut tasks = std::mem::take(&mut vm.host.tasks); + let Some((tasks, waited)) = home.run(move || { + let waited = wait(&mut tasks, work, deadline); + (tasks, waited) + }) else { + return Err(HostValue::Interrupt); + }; + vm.host.tasks = tasks; + waited + } + }; + for (p, s) in settled { + vm.host.settled(p); + vm.inbox.push_back((p, s)); + } + match done { + Some(r) => r, + None => { + let _ = vm.check_time(); + Err(HostValue::Undefined) + } + } +} + +/// Polls `work` to its end or the deadline, and the run's other host calls meanwhile: what they complete with, in +/// order, and the work's result, `None` past the deadline. +fn wait( + tasks: &mut crate::exec::Tasks<'static, Settlement>, + mut work: BoxFuture<'static, HostResult>, + deadline: Option, +) -> (Vec<(Id, Settlement)>, Option) { + let mut settled = Vec::new(); + let mut armed = false; + let done = block_on(std::future::poll_fn(|cx| { + tasks.set_parent(Some(cx.waker())); + settled.extend(tasks.poll_ready()); + if let Poll::Ready(r) = work.as_mut().poll(cx) { + return Poll::Ready(Some(r)); + } + match deadline { + Some(at) if std::time::Instant::now() >= at => Poll::Ready(None), + Some(at) if !armed => { + armed = true; + crate::exec::wake_at(at, cx.waker()); + Poll::Pending + } + _ => Poll::Pending, + } + })); + tasks.set_parent(None); + (settled, done) +} + +/// Where host code runs while the run computes on its worker thread; `None` while it runs where it is driven. +fn home_of(vm: &Vm) -> Option { + crate::offload::home(&vm.host.offload).cloned() +} + +/// Runs a future for a call, recorded as in flight while it runs. +fn track( + vm: &mut Vm, + p: Id, + future: BoxFuture<'static, Settlement>, + in_flight: impl FnOnce() -> InFlight, +) { + match vm + .host + .tasks + .spawn(p, future, crate::offload::home(&vm.host.offload)) + { + Poll::Ready(s) => vm.inbox.push_back((p, s)), + Poll::Pending => vm.host.calls.push(in_flight()), + } +} + +/// Starts an async or durable call whose promise is `p`, or starts one again on resume. +fn spawn_call(vm: &mut Vm, p: Id, f: &Callee, mut r: Restart, holds_functions: bool) { + let call = vm.host.call(r.call); + let home = home_of(vm); + let detached = Arc::new(AtomicBool::new(false)); + let (label, owner, site) = (r.label.clone(), r.owner.clone(), r.site); + let (kind, future): (CallKind, BoxFuture<'static, Settlement>) = match f { + Callee::Fn(f) => { + let Body::Async(body) = &f.body else { + unreachable!("only async functions are called concurrently") + }; + // Only an idempotent call starts again on resume, with the same arguments. + let (kind, args) = match f.idempotent { + true => (CallKind::Idempotent, r.args.clone()), + false => (CallKind::Blocking, std::mem::take(&mut r.args)), + }; + let work = match &home { + None => body(args, call), + Some(home) => { + let body = body.clone(); + home.run(move || body(args, call)) + .unwrap_or_else(|| Box::pin(async { Err(HostValue::Interrupt) })) + } + }; + ( + kind, + Box::pin(async move { Settlement::host(work.await, label, owner, site) }), + ) + } + Callee::Durable(d) => { + let data = Arc::new(Mutex::new(match &r.start { + Start::Wait(data) => Some(data.clone()), + _ => None, + })); + let durable = DurableCall { + call: call.clone(), + args: r.args.clone(), + }; + let (d2, phase, waiting) = (d.clone(), data.clone(), durable.clone()); + let started: BoxFuture<'static, Result> = match &r.start { + Start::Wait(data) => { + let data = data.clone(); + Box::pin(async move { Ok(data) }) + } + _ => match &home { + None => (d.start)(r.args.clone(), call), + Some(home) => { + let (d, args) = (d.clone(), r.args.clone()); + home.run(move || (d.start)(args, call)) + .unwrap_or_else(|| Box::pin(async { Err(HostValue::Interrupt) })) + } + }, + }; + let future: BoxFuture<'static, Settlement> = Box::pin(async move { + let result = match started.await { + Ok(data) => { + *phase.lock().unwrap_or_else(|e| e.into_inner()) = Some(data.clone()); + let r = (d2.wait)(data, waiting).await; + // Finished: there is nothing left to cancel. + *phase.lock().unwrap_or_else(|e| e.into_inner()) = None; + r + } + Err(e) => Err(e), + }; + Settlement::host(result, label, owner, site) + }); + (CallKind::Durable(data, d.clone(), durable), future) + } + }; + track(vm, p, future, || InFlight { + promise: p, + call: r.call, + label: r.label, + path: r.path, + args: r.args, + owner: r.owner, + site: r.site, + kind, + holds_functions, + detached, + }); +} + +/// Starts a restored call in flight again: an idempotent one runs again with its key, a started durable one waits on +/// its data. A function no longer at its path fails the call. +pub fn restart(vm: &mut Vm, r: Restart) { + let p = r.promise; + let found = r.path.as_deref().and_then(|path| vm.host.resolve(path)); + match found { + Some(f) => spawn_call(vm, p, &f, r, false), + None => { + let message = format!("{} is not available in this runtime.", r.label); + vm.inbox.push_back(( + p, + Settlement::Failure(Failed::from_parts( + DiagnosticKind::ExecutionFailure, + message.into(), + Vec::new(), + )), + )); + } + } +} + +/// The prototype of a sync-thenable function's object results: an ordinary object whose `then`, `catch` and +/// `finally` act on a settled copy, so a result can be used directly, awaited, or chained, while data views see only +/// its own fields. +fn promise_like(vm: &mut Vm, v: Value) -> Value { + if let Value::Obj(id) = v + && matches!(vm.heap[id as usize].kind, Kind::Ordinary) + && vm.heap[id as usize].proto == Some(vm.realm.object_proto) + { + let proto = promise_like_proto(vm); + vm.heap[id as usize].proto = Some(proto); + } + v +} + +fn promise_like_proto(vm: &mut Vm) -> Id { + if let Some(id) = vm.host.promise_like { + return id; + } + let object_proto = vm.realm.object_proto; + let id = vm.alloc(Obj::new(Some(object_proto), Kind::Ordinary)); + for (name, length) in [("then", 2u8), ("catch", 1), ("finally", 1)] { + let key = vm.atoms.intern(name); + let f = native( + vm, + name, + length, + promise_like_method, + Value::Str(vm.atoms.atom_str(key)), + ); + vm.define_hidden(id, key, f); + } + vm.host.promise_like = Some(id); + id +} + +fn promise_like_method(vm: &mut Vm, this: Value, args: &[Value], callee: Id) -> Res { + let Value::Obj(source) = this else { + return Err(vm.type_error("Method called on a non-object")); + }; + let copy = vm.new_object(); + for (k, v) in vm.own_entries(source) { + vm.define(copy, k, v); + } + let p = vm.new_promise(); + vm.fulfill(p, Value::Obj(copy)); + let Value::Str(name) = vm.native_data(callee) else { + return Ok(Value::Undef); + }; + // As the reference does, the promise's own `then`, `catch` or `finally` runs, whatever the program put on + // `Promise.prototype`: it only registers its reactions. + let derived = vm.new_promise(); + let (first, second) = (crate::builtins::arg(args, 0), crate::builtins::arg(args, 1)); + let reaction = match vm.text(name) { + "then" => crate::vm::Reaction::Then { + on_ful: first, + on_rej: second, + derived, + }, + "catch" => crate::vm::Reaction::Then { + on_ful: Value::Undef, + on_rej: first, + derived, + }, + _ if vm.is_callable(&first) => crate::vm::Reaction::Finally { + cleanup: first, + derived, + }, + _ => crate::vm::Reaction::Resolve(derived), + }; + vm.perform_then(p, reaction); + Ok(Value::Obj(derived)) +} + +// ---------- crossing ---------- + +/// What a host call's arguments came to: copies ready for the host, or the promises among them that haven't +/// fulfilled, in the order they were met, which the call waits for before its arguments cross again. +pub enum Args { + Ready(Vec), + Wait(Vec), +} + +/// Where a value crossing from the host is: among the run's host globals, at `global` (so a function there can be +/// found again on resume), or inside a value a host function with `snapshot` hooks returned (`within`). +#[derive(Clone, Default)] +struct Place { + global: Option>, + /// Whether it is among the globals at all, even where no path of names leads: inside an array, a Map or a Set. + installed: bool, + within: Option, +} + +impl Place { + fn child(&self, key: Option<&HostString>) -> Place { + Place { + global: match (&self.global, key) { + (Some(path), Some(key)) => { + let mut path = path.clone(); + path.push(key.clone()); + Some(path) + } + _ => None, + }, + installed: self.installed, + within: self.within.clone(), + } + } +} + +/// A host function's arguments as host values, as the reference's `toHost` copies them under the runtime's +/// translation (see `to_host`), or the promises among them to wait for first. With `back`, a function from a host +/// result crosses back as itself, and `back` says whether one did. +fn host_args( + vm: &mut Vm, + args: &[Value], + label: &str, + mut back: Option<&mut bool>, +) -> Result { + let mut waiting = Vec::new(); + let mut out = Vec::with_capacity(args.len()); + for (i, a) in args.iter().enumerate() { + let mut seen = Vec::new(); + let mut cx = ToHost { + callee: label, + arg: i, + seen: &mut seen, + waiting: &mut waiting, + back: back.as_deref_mut(), + }; + let v = to_host(vm, a, 0, &mut cx)?; + out.push(v.unwrap_or(HostValue::Undefined)); + } + if !waiting.is_empty() { + return Ok(Args::Wait(waiting)); + } + Ok(Args::Ready(out)) +} + +/// The `Settle` frame's sub-op for an async host call whose arguments' getters it reads before calling it again. +const READ_FOR_CALL: u16 = 1; + +/// Whether the call is the one that frame makes, which reads its getters ahead as a sync call does. +fn reading_for_call(vm: &Vm) -> bool { + matches!( + vm.frames.last().map(|f| f.kind), + Some(crate::vm::FrameKind::Native( + crate::native::NativeOp::Settle, + READ_FOR_CALL + )) + ) +} + +/// What a copy for the host carries along. +struct ToHost<'a> { + /// Names the call in messages, with the argument's position: `Argument 1 to fetch`, made only when one needs it. + callee: &'a str, + arg: usize, + seen: &'a mut Vec, + waiting: &'a mut Vec, + back: Option<&'a mut bool>, +} + +impl ToHost<'_> { + fn label(&self) -> String { + format!("Argument {} to {}", self.arg + 1, self.callee) + } +} + +/// The host function behind a function the program got inside a host result, which crosses back as itself to a host +/// function that takes functions. The functions among the globals don't: what the host runs around their calls runs +/// only when the program calls them. +fn hosted(vm: &Vm, id: Id) -> Option { + let Kind::Native { + f, + data: Value::Num(index), + .. + } = &vm.heap[id as usize].kind + else { + return None; + }; + if !std::ptr::fn_addr_eq(*f, host_native as crate::vm::NativeFn) { + return None; + } + let entry = vm.host.functions.get(*index as usize)?; + match &entry.f { + Callee::Fn(f) if !entry.installed => Some(f.clone()), + _ => None, + } +} + +/// How the reference describes a value that cannot be passed to the host. +pub(crate) fn describe(vm: &Vm, v: &Value) -> &'static str { + match v { + Value::Sym(_) => "a symbol", + Value::Obj(id) => match &vm.heap[*id as usize].kind { + Kind::Closure(_) | Kind::Native { .. } | Kind::Bound(_) => "a function", + Kind::Namespace(_) => "a namespace reference", + Kind::Promise(_) => "an un-awaited Promise", + Kind::Generator(_) | Kind::AsyncGenerator(_) => "a generator", + Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } + | Kind::ExoticIter { .. } + | Kind::IterHelper(_) + | Kind::AsyncFromSync { .. } => "an iterator", + _ => "an object", + }, + _ => "a value", + } +} + +/// A function's own name, as it was made. +pub(crate) fn function_name(vm: &Vm, v: &Value) -> String { + match v { + Value::Obj(id) => match &vm.heap[*id as usize].kind { + Kind::Native { name, .. } => vm.atoms.text(*name).to_owned(), + _ => String::new(), + }, + _ => String::new(), + } +} + +/// A program value copied out for a host function, as the reference's `toHost` copies it under the runtime's +/// translation. A function that came from a host result crosses back as the host function when the call takes +/// functions (`back`). Otherwise a function fails the call, or is left out under `functions: drop` (`None`: an +/// object's key is skipped, an array's item is `null`, a Map's or Set's is undefined). A promise fails the call, or +/// under `promises: await` is its value once fulfilled; one that hasn't fulfilled goes in `waiting`, for the call to +/// wait for. +fn to_host( + vm: &mut Vm, + v: &Value, + depth: usize, + cx: &mut ToHost, +) -> Result, Value> { + if depth > crate::convert::MAX_VALUE_DEPTH { + let msg = format!( + "{} exceeds the maximum value depth of {}.", + cx.label(), + crate::convert::MAX_VALUE_DEPTH + ); + return Err(vm.type_error(&msg)); + } + let id = match v { + Value::Undef | Value::Uninit => return Ok(Some(HostValue::Undefined)), + Value::Null => return Ok(Some(HostValue::Null)), + Value::Bool(b) => return Ok(Some(HostValue::Bool(*b))), + Value::Num(n) => return Ok(Some(HostValue::Number(*n))), + Value::Str(s) => { + return Ok(Some(HostValue::String(HostString::from_run_text( + vm.text(*s), + )))); + } + Value::Sym(_) => { + let msg = format!( + "{} contains a symbol, which cannot be passed to the host.", + cx.label() + ); + return Err(vm.type_error(&msg)); + } + Value::Obj(id) => *id, + }; + if let Some(back) = cx.back.as_deref_mut() + && let Some(f) = hosted(vm, id) + { + *back = true; + return Ok(Some(HostValue::Function(f))); + } + if vm.host.translate.functions == TranslateFunctions::Drop && vm.heap[id as usize].is_callable() + { + return Ok(None); + } + if cx.seen.contains(&id) { + return Err(vm.type_error(&format!("{} contains a circular value.", cx.label()))); + } + if vm.host.translate.promises == TranslatePromises::Await + && let Kind::Promise(p) = &vm.heap[id as usize].kind + { + let PromiseState::Fulfilled(result) = p.state else { + cx.waiting.push(*v); + return Ok(Some(HostValue::Undefined)); + }; + cx.seen.push(id); + let out = to_host(vm, &result, depth + 1, cx)?; + cx.seen.pop(); + return Ok(out); + } + if vm.heap[id as usize].is_callable() || crate::cross::opaque(&vm.heap[id as usize].kind) { + let msg = format!( + "{} contains {}, which cannot be passed to the host.", + cx.label(), + describe(vm, v) + ); + return Err(vm.type_error(&msg)); + } + cx.seen.push(id); + // A child left out of a Map or a Set is undefined there. + let kept = |vm: &mut Vm, item: &Value, cx: &mut ToHost| { + to_host(vm, item, depth + 1, cx).map(Option::unwrap_or_default) + }; + let out = match &vm.heap[id as usize].kind { + Kind::Date(t) => HostValue::Date(*t), + Kind::RegExp(r) => HostValue::RegExp { + source: HostString::from_run_text(&r.source), + flags: r.flags.clone(), + }, + Kind::Url(_) => HostValue::Url(crate::builtins::web::url_href(vm, id)), + Kind::SearchParams(p) => HostValue::SearchParams(p.list.clone()), + Kind::Headers(h) => HostValue::Headers(crate::builtins::web::header_entries(&h.list)), + Kind::Bytes(b) => { + let data = b.to_vec(); + if b.buffer { + HostValue::Buffer(data) + } else { + HostValue::Bytes(data) + } + } + Kind::Array(_) if vm.heap[id as usize].flags & SPARSE != 0 => { + vm.densify(id)?; + cx.seen.pop(); + return to_host(vm, v, depth, cx); + } + Kind::Array(items) => { + let items = items.clone(); + let mut out = Vec::with_capacity(items.len()); + for item in &items { + out.push(match item { + Value::Uninit => None, + item => Some(to_host(vm, item, depth + 1, cx)?.unwrap_or(HostValue::Null)), + }); + } + HostValue::Array(out) + } + Kind::Map(m) | Kind::Set(m) => { + let is_map = matches!(vm.heap[id as usize].kind, Kind::Map(_)); + let entries: Vec<(Value, Value)> = m.iter().copied().collect(); + if is_map { + let mut out = Vec::with_capacity(entries.len()); + for (k, val) in &entries { + let k = kept(vm, k, cx)?; + out.push((k, kept(vm, val, cx)?)); + } + HostValue::Map(out) + } else { + let mut out = Vec::with_capacity(entries.len()); + for (k, _) in &entries { + out.push(kept(vm, k, cx)?); + } + HostValue::Set(out) + } + } + Kind::Error(_) => { + let (name, message) = crate::convert::error_parts(vm, id); + let name = crate::cross::host_error_name(vm, id, name); + let mut error = HostError::named( + HostString::from_run_text(&name), + HostString::from_run_text(&message), + ); + let cause_key = vm.names.cause; + // A field that cannot cross is left behind, so the error itself always arrives. + let left_behind = |vm: &mut Vm, item: &Value, cx: &mut ToHost| { + let at = cx.seen.len(); + match to_host(vm, item, depth + 1, cx) { + Ok(item) => Ok(item), + Err(e) if vm.fatal.is_some() => Err(e), + Err(_) => { + cx.seen.truncate(at); + Ok(None) + } + } + }; + if vm.has_own(id, cause_key) && !vm.setter_only(id, cause_key) { + let cause = vm.get_obj(id, cause_key); + if let Some(c) = left_behind(vm, &cause, cx)? { + error.cause = Some(Box::new(c)); + } + } + for (k, val) in vm.own_entries(id) { + let key = HostString::from_run_text(vm.atoms.text(k)); + if key.as_str().is_some_and(crate::cross::uncrossed) + || k == cause_key + || vm.setter_only(id, k) + { + continue; + } + if let Some(item) = left_behind(vm, &val, cx)? { + error.fields.push((key, item)); + } + } + HostValue::Error(Box::new(error)) + } + _ => { + let mut out = Vec::new(); + for (k, val) in vm.own_entries(id) { + let key = HostString::from_run_text(vm.atoms.text(k)); + if key == "__proto__" || vm.setter_only(id, k) { + continue; + } + if let Some(item) = to_host(vm, &val, depth + 1, cx)? { + out.push((key, item)); + } + } + HostValue::Object(out) + } + }; + cx.seen.pop(); + Ok(Some(out)) +} + +/// A host value copied in, from where it is (`place`). +fn from_host( + vm: &mut Vm, + v: &HostValue, + label: &str, + place: &Place, + depth: usize, +) -> Result { + if depth > crate::convert::MAX_VALUE_DEPTH { + let msg = format!( + "{label} exceeds the maximum value depth of {}.", + crate::convert::MAX_VALUE_DEPTH + ); + return Err(vm.type_error(&msg)); + } + let next = |key: &str| format!("{label}.{key}"); + Ok(match v { + HostValue::Undefined | HostValue::Interrupt => Value::Undef, + HostValue::Null => Value::Null, + HostValue::Bool(b) => Value::Bool(*b), + HostValue::Number(n) => Value::Num(*n), + HostValue::String(s) => vm.string_val(s.to_run_text()), + HostValue::Function(f) => { + // A global host function with `snapshot` hooks saves what it returns; a function inside such a value + // saves with the same hooks. + let owner = match (&place.global, &f.snapshot) { + (Some(_), Some(_)) => Some(label.to_owned()), + _ => place.within.clone(), + }; + wrap(vm, Callee::Fn(f.clone()), label, place, owner) + } + HostValue::Durable(f) => wrap(vm, Callee::Durable(f.clone()), label, place, None), + HostValue::Namespace(ns) => match &place.global { + Some(global) => { + let name = vm.atoms.intern(label); + vm.host + .host_namespaces + .insert(name, (ns.clone(), global.clone())); + vm.ns_ref(NsPath { + parent: NsPath::ROOT, + name, + }) + } + None => { + let msg = format!("{label} produced a namespace, which the program cannot hold."); + return Err(vm.type_error(&msg)); + } + }, + HostValue::Failure(f) => failure_value( + vm, + DiagnosticKind::named(&f.kind), + f.message.clone(), + f.suggestions.clone(), + ), + HostValue::Array(items) => { + if items.len() > 10_000_000 { + let msg = format!( + "{label} produced an array of {} items; at most 10000000 can cross.", + items.len() + ); + return Err(vm.range_error(&msg)); + } + let mut out = Vec::with_capacity(items.len()); + for (i, item) in items.iter().enumerate() { + out.push(match item { + Some(item) => from_host( + vm, + item, + &format!("{label}[{i}]"), + &place.child(None), + depth + 1, + )?, + None => Value::Uninit, + }); + } + vm.new_array(out) + } + HostValue::Object(fields) => { + let id = vm.new_object(); + for (k, item) in fields { + let shown = k.to_string_lossy(); + let val = from_host(vm, item, &next(&shown), &place.child(Some(k)), depth + 1)?; + let key = vm.atoms.intern(&k.to_run_text()); + vm.define(id, key, val); + } + Value::Obj(id) + } + HostValue::Date(t) => { + crate::builtins::date::new_date(vm, crate::builtins::date::time_clip(*t)) + } + HostValue::RegExp { source, flags } => { + crate::builtins::regexp::new_regexp(vm, &source.to_run_text(), flags)? + } + HostValue::Url(href) => match url::Url::parse(href) { + Ok(u) => crate::builtins::web::new_url(vm, u), + Err(_) => { + let msg = format!("{label} produced an invalid URL '{href}'."); + return Err(vm.type_error(&msg)); + } + }, + HostValue::SearchParams(list) => crate::builtins::web::new_params(vm, list.clone()), + HostValue::Headers(list) => { + // As `new Headers(...)` leaves them: lowercase names and values without surrounding HTTP whitespace. + let list = list + .iter() + .map(|(k, v)| { + let v = v.trim_matches(|c| matches!(c, '\t' | '\n' | '\r' | ' ')); + (k.to_ascii_lowercase(), v.to_owned()) + }) + .collect(); + crate::builtins::web::new_headers(vm, list) + } + HostValue::Bytes(data) => crate::builtins::bytes::new_bytes(vm, data.clone(), false), + HostValue::Buffer(data) => crate::builtins::bytes::new_bytes(vm, data.clone(), true), + HostValue::Response(response) => response_from_host(vm, response, label, place, depth)?, + HostValue::Map(entries) => { + let proto = vm.realm.map_proto; + let id = vm.alloc(Obj::new(Some(proto), Kind::Map(Box::default()))); + for (k, item) in entries { + let k = from_host(vm, k, label, &place.child(None), depth + 1)?; + let item = from_host(vm, item, label, &place.child(None), depth + 1)?; + let mk = vm.map_key(&k); + let entry_key = vm.map_entry_key(mk, k); + if let Kind::Map(m) = &mut vm.heap[id as usize].kind { + m.set(mk, entry_key, item); + } + } + Value::Obj(id) + } + HostValue::Set(items) => { + let proto = vm.realm.set_proto; + let id = vm.alloc(Obj::new(Some(proto), Kind::Set(Box::default()))); + for item in items { + let k = from_host(vm, item, label, &place.child(None), depth + 1)?; + let mk = vm.map_key(&k); + let entry_key = vm.map_entry_key(mk, k); + if let Kind::Set(m) = &mut vm.heap[id as usize].kind { + m.set(mk, entry_key, Value::Undef); + } + } + Value::Obj(id) + } + HostValue::Error(e) => { + let proto = match e.name.as_str().unwrap_or_default() { + "TypeError" => vm.realm.type_error_proto, + "RangeError" => vm.realm.range_error_proto, + "SyntaxError" => vm.realm.syntax_error_proto, + "ReferenceError" => vm.realm.reference_error_proto, + "AggregateError" => vm.realm.aggregate_error_proto, + name @ ("URIError" | "EvalError") => { + crate::builtins::ensure_global(vm, name); + let g = vm.atoms.intern(name); + match vm.global_map.get(&g).copied() { + Some(Value::Obj(c)) => { + let key = vm.names.prototype; + vm.get_obj(c, key).as_obj().unwrap_or(vm.realm.error_proto) + } + _ => vm.realm.error_proto, + } + } + _ => vm.realm.error_proto, + }; + let err = vm.make_error(proto, &e.message.to_run_text()); + if let Value::Obj(id) = err { + if let Some(cause) = &e.cause + && let Ok(c) = + from_host(vm, cause, &next("cause"), &Place::default(), depth + 1) + { + let key = vm.names.cause; + vm.define_hidden(id, key, c); + } + for (k, item) in &e.fields { + if matches!( + k.as_str(), + Some("stack" | "message" | "constructor" | "toString" | "__proto__") + ) { + continue; + } + if matches!( + item, + HostValue::Function(_) | HostValue::Durable(_) | HostValue::Namespace(_) + ) { + continue; + } + let shown = k.to_string_lossy(); + if let Ok(val) = + from_host(vm, item, &next(&shown), &Place::default(), depth + 1) + { + let key = vm.atoms.intern(&k.to_run_text()); + vm.define(id, key, val); + } + } + } + err + } + }) +} + +/// A streaming response as the reference hands it over: its fields, a live `bodyUsed`, the reading methods, and a +/// `body` with a live `locked`, `cancel`, `getReader` and async iteration. +fn response_from_host( + vm: &mut Vm, + response: &crate::streaming::StreamingResponse, + label: &str, + place: &Place, + depth: usize, +) -> Result { + let surface = crate::streaming::surface(response, &vm.host.epoch); + let proto = vm.realm.object_proto; + let result = vm.alloc(Obj::new(Some(proto), Kind::Ordinary)); + let body = match surface.body { + Some((cancel, get_reader, iterate, locked)) => { + let body = vm.alloc(Obj::new(Some(proto), Kind::Ordinary)); + live_accessor( + vm, + body, + "locked", + locked, + &format!("{label}.body.locked"), + place, + ); + let methods = [ + (vm.atoms.intern_static("cancel"), cancel, "cancel"), + (vm.atoms.intern_static("getReader"), get_reader, "getReader"), + ( + crate::object::SYM_ASYNC_ITERATOR, + iterate, + "[Symbol.asyncIterator]", + ), + ]; + for (key, f, name) in methods { + let path = if name.starts_with('[') { + format!("{label}.body{name}") + } else { + format!("{label}.body.{name}") + }; + let f = response_fn(vm, f, &path, place); + vm.define(body, key, f); + } + Value::Obj(body) + } + None => Value::Null, + }; + let fields = [ + ("url", HostValue::from(response.url.as_str())), + ("status", HostValue::Number(response.status as f64)), + ("statusText", HostValue::from(response.status_text.as_str())), + ("ok", HostValue::Bool(response.ok())), + ("headers", HostValue::Headers(response.headers.clone())), + ]; + for (key, v) in fields { + let v = from_host( + vm, + &v, + &format!("{label}.{key}"), + &place.child(None), + depth + 1, + )?; + let key = vm.atoms.intern(key); + vm.define(result, key, v); + } + let key = vm.atoms.intern_static("redirected"); + vm.define(result, key, Value::Bool(response.redirected)); + let key = vm.atoms.intern_static("body"); + vm.define(result, key, body); + live_accessor( + vm, + result, + "bodyUsed", + surface.body_used, + &format!("{label}.bodyUsed"), + place, + ); + for (key, f) in surface.methods { + let f = response_fn(vm, f, &format!("{label}.{key}"), place); + let key = vm.atoms.intern(key); + vm.define(result, key, f); + } + Ok(Value::Obj(result)) +} + +/// A live response's state as a hidden accessor whose getter is a host function, the one kind of accessor made after +/// the built-ins: a run that suspends loses it, as every host function it holds. +fn live_accessor( + vm: &mut Vm, + id: Id, + key: &'static str, + g: crate::streaming::Getter, + label: &str, + place: &Place, +) { + let name = format!("get {key}"); + let f = HostFunction::live_getter(&name, g); + let f = wrap(vm, Callee::Fn(f), label, &place.child(None), None); + let k = vm.atoms.intern_static(key); + vm.define_accessor_half(id, k, false, f, false); +} + +/// A streaming response's method, which never saves with snapshot hooks: a live response can't be kept. +fn response_fn(vm: &mut Vm, f: HostFunction, label: &str, place: &Place) -> Value { + wrap(vm, Callee::Fn(f), label, &place.child(None), None) +} + +/// A host call's result copied in. When it is saved by an owner's `snapshot` hooks and holds functions, the value is +/// kept so a suspend can save them. +fn result_from_host( + vm: &mut Vm, + v: HostValue, + label: &str, + owner: Option<&str>, +) -> Result { + let start = vm.host.functions.len(); + let place = Place { + global: None, + installed: false, + within: owner.map(str::to_owned), + }; + let out = from_host(vm, &v, label, &place, 0); + let end = vm.host.functions.len(); + if let Some(owner) = owner + && end > start + { + vm.host.results.push(ResultRoot { + owner: owner.to_owned(), + value: v, + functions: start..end, + }); + } + out +} + +/// Natives the host makes, which a snapshot names like the built-ins'. +pub fn snapshot_natives() -> [NativeFn; 5] { + [ + require_native, + import_native, + host_native, + promise_like_method, + crate::cross::park, + ] +} + +/// A function the run lost on resume: calling it throws. +pub fn lost_function(name: &str) -> HostFunction { + let shown = if name.is_empty() { "(anonymous)" } else { name }; + let message = format!( + "The function {shown} came from the host and was lost when the run was suspended; get it again after resuming." + ); + HostFunction::lost(name, message) +} + +/// A host function as a program function, at `label`. A host function made with no name is named by where it is. +/// A constructible one is called the same way by `new`. +fn wrap(vm: &mut Vm, f: Callee, label: &str, place: &Place, owner: Option) -> Value { + let constructible = matches!(&f, Callee::Fn(f) if f.constructible); + let name = match f.name() { + Some(name) => name.to_owned(), + None => label[label.rfind('.').map_or(0, |i| i + 1)..].to_owned(), + }; + let length = f.length(); + let index = vm.host.functions.len(); + vm.host.functions.push(FnEntry { + f, + label: label.to_owned(), + path: place.global.clone(), + owner, + installed: place.installed, + }); + let made = native(vm, &name, length, host_native, Value::Num(index as f64)); + if constructible + && let Value::Obj(id) = made + && let Kind::Native { ctor, .. } = &mut vm.heap[id as usize].kind + { + *ctor = true; + } + made +} + +fn host_native(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let Value::Num(index) = vm.native_data(callee) else { + return Ok(Value::Undef); + }; + let entry = &vm.host.functions[index as usize]; + if let Callee::Fn(f) = &entry.f + && let Body::Lost(message) = &f.body + { + let message = message.clone(); + return Err(vm.type_error(&message)); + } + // A live response's state is read where the run is driven, with no host call. + if let Callee::Fn(f) = &entry.f + && let Body::Getter(g) = &f.body + { + let g = g.clone(); + return Ok(match crate::offload::home(&vm.host.offload) { + Some(home) => home.run(move || g()).unwrap_or(Value::Undef), + None => g(), + }); + } + let f = entry.f.clone(); + let target = Target { + label: entry.label.clone(), + path: entry.path.clone(), + owner: entry.owner.clone(), + }; + call_host(vm, &f, args, target, Value::Obj(callee)) +} + +// ---------- modules ---------- + +fn module_name(specifier: &str) -> &str { + specifier.strip_prefix("node:").unwrap_or(specifier) +} + +fn global_value(vm: &mut Vm, name: &str) -> Option { + let a = vm.atoms.intern(name); + if !vm.global_map.contains_key(&a) + && (has_host_global(vm, name) || !crate::builtins::ensure_global(vm, name)) + { + define_host_global(vm, name); + } + match vm.global_map.get(&a) { + Some(Value::Undef) | None => None, + Some(v) => Some(*v), + } +} + +/// A module, as `require` returns it and a default import binds it: a global, by its Node module name. +fn module(vm: &mut Vm, specifier: &str) -> Res { + let name = module_name(specifier).to_owned(); + if let Some(v) = vm.host.modules_loaded.get(&name) { + return Ok(*v); + } + // A module name the runtime maps to a global. + let modules = vm.host.modules.clone(); + let named = modules + .iter() + .find(|(m, _)| *m == name) + .map(|(_, global)| global.as_str()); + let found = match global_value(vm, &name) { + Some(v) => Some(v), + None => match named.and_then(|global| global_value(vm, global)) { + Some(v) => Some(v), + None => alias(vm, &name)?, + }, + }; + let Some(found) = found else { + let message = cannot_import(specifier); + let proto = vm.realm.error_proto; + // A failure, as the reference throws it at the import: the diagnostic says where. + return Err(vm.failure(proto, &message, DiagnosticKind::ExecutionFailure)); + }; + vm.host.modules_loaded.insert(name, found); + Ok(found) +} + +/// The globals that provide Node's other names for them. +fn alias(vm: &mut Vm, name: &str) -> Result, Value> { + Ok(match name { + "fs/promises" => match global_value(vm, "fs") { + Some(fs @ Value::Obj(_)) => { + let key = vm.atoms.intern("promises"); + match vm.get(&fs, key)? { + Value::Undef => None, + v => Some(v), + } + } + _ => None, + }, + "url" => pick(vm, &["URL", "URLSearchParams"]), + "util" => pick(vm, &["TextEncoder", "TextDecoder"]), + "buffer" => pick(vm, &["Buffer", "atob", "btoa"]), + _ => None, + }) +} + +/// Why `specifier` can't be loaded, split so the error names the kind of import that failed. +fn cannot_import(specifier: &str) -> String { + if specifier.starts_with('.') || specifier.starts_with('/') || specifier.starts_with("file:") { + return format!("Cannot import \"{specifier}\": local files can't be imported."); + } + if is_runtime_module(specifier) { + return format!("Cannot import \"{specifier}\": this runtime doesn't provide it."); + } + format!("Cannot import \"{specifier}\": packages can't be installed here.") +} + +/// Node's core modules, fixed so every host gives the same answer, as the reference fixes them. +const CORE_MODULES: &[&str] = &[ + "assert", + "async_hooks", + "buffer", + "child_process", + "cluster", + "console", + "constants", + "crypto", + "dgram", + "diagnostics_channel", + "dns", + "domain", + "events", + "fs", + "http", + "http2", + "https", + "inspector", + "module", + "net", + "os", + "path", + "perf_hooks", + "process", + "punycode", + "querystring", + "readline", + "repl", + "stream", + "string_decoder", + "sys", + "timers", + "tls", + "trace_events", + "tty", + "url", + "util", + "v8", + "vm", + "wasi", + "worker_threads", + "zlib", +]; + +/// Whether a specifier names a module a runtime provides, as Node's and Bun's own modules are, rather than a package. +fn is_runtime_module(specifier: &str) -> bool { + specifier.starts_with("node:") + || specifier == "bun" + || specifier.starts_with("bun:") + || CORE_MODULES.contains(&specifier.split('/').next().unwrap_or_default()) +} + +fn pick(vm: &mut Vm, names: &[&str]) -> Option { + let found: Vec<(&str, Value)> = names + .iter() + .filter_map(|n| global_value(vm, n).map(|v| (*n, v))) + .collect(); + if found.is_empty() { + return None; + } + let id = vm.alloc(Obj::new(None, Kind::Ordinary)); + for (name, v) in found { + let key = vm.atoms.intern(name); + vm.define(id, key, v); + } + Some(Value::Obj(id)) +} + +/// What `import * as` and `import()` see: the module's own properties, and the module itself as `default`. +fn namespace(vm: &mut Vm, specifier: &str) -> Res { + let module = module(vm, specifier)?; + let name = module_name(specifier).to_owned(); + if let Some(v) = vm.host.namespaces.get(&name) { + return Ok(*v); + } + let id = vm.alloc(Obj::new(None, Kind::Ordinary)); + if let Value::Obj(m) = module { + for (k, v) in vm.own_entries(m) { + vm.define(id, k, v); + } + } + let key = vm.atoms.intern("default"); + vm.define(id, key, module); + vm.host.namespaces.insert(name, Value::Obj(id)); + Ok(Value::Obj(id)) +} + +fn require_native(vm: &mut Vm, _this: Value, args: &[Value], _callee: Id) -> Res { + let Some(Value::Str(s)) = args.first() else { + return Err(vm.type_error("require expects a module name string.")); + }; + let specifier = crate::strings::host_text(vm.text(*s)).into_owned(); + module(vm, &specifier) +} + +/// The compiler's import hook: `%import(specifier, kind, name)`. Kinds: 0 a default import, 1 a namespace, 2 a +/// named export, 3 a side-effect import, 4 `import()`. +fn import_native(vm: &mut Vm, _this: Value, args: &[Value], _callee: Id) -> Res { + let specifier = match args.first() { + Some(Value::Str(s)) => crate::strings::host_text(vm.text(*s)).into_owned(), + Some(other) => { + let other = *other; + let s = vm.string_of(&other)?; + crate::strings::host_text(vm.text(s)).into_owned() + } + None => String::new(), + }; + let kind = match args.get(1) { + Some(Value::Num(n)) => *n as u8, + _ => 0, + }; + match kind { + 0 => module(vm, &specifier), + 1 => namespace(vm, &specifier), + 2 => { + let ns = namespace(vm, &specifier)?; + let Some(Value::Str(name)) = args.get(2) else { + return Ok(Value::Undef); + }; + let name = vm.text(*name).to_owned(); + let key: Atom = vm.atoms.intern(&name); + let ns_id = ns.as_obj().unwrap_or(0); + if !vm.has_own(ns_id, key) { + let msg = format!("\"{specifier}\" has no export named \"{name}\"."); + return Err(vm.syntax_error(&msg)); + } + Ok(vm.get_obj(ns_id, key)) + } + 3 => module(vm, &specifier).map(|_| Value::Undef), + _ => { + let p = vm.new_promise(); + match namespace(vm, &specifier) { + Ok(ns) => vm.fulfill(p, ns), + // The rejection reports the `import()`, as the reference locates it. + Err(e) => { + let site = vm.call_offset(); + locate_at(vm, &e, site); + vm.reject(p, e) + } + } + Ok(Value::Obj(p)) + } + } +} + +/// The names directly under a namespace path, as the reference's `namespaceKeys` lists them, or what listing them +/// threw. +pub(crate) fn namespace_keys(vm: &mut Vm, id: Id) -> Result, Value> { + let ns = vm.ns_path(id); + let Some((namespace, _)) = vm.host.host_namespaces.get(&ns.root).cloned() else { + let message = format!("The namespace {} is not available.", vm.atoms.text(ns.root)); + return Err(vm.type_error(&message)); + }; + let listed = match home_of(vm) { + None => (namespace.keys)(&ns.keys), + Some(home) => { + let keys = ns.keys.clone(); + let Some(listed) = home.run(move || (namespace.keys)(&keys)) else { + interrupt(vm); + return Err(Value::Undef); + }; + listed + } + }; + listed.map_err(|thrown| { + let label = vm.ns_label(&ns); + thrown_value(vm, &thrown, &label) + }) +} diff --git a/packages/codemode-rust/crates/psychoscript/src/host_function.rs b/packages/codemode-rust/crates/psychoscript/src/host_function.rs new file mode 100644 index 0000000000000..696124ba4b5db --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/host_function.rs @@ -0,0 +1,903 @@ +//! Host functions a program calls as globals, the counterpart of the reference's `Host` (`host-function.ts`): plain +//! functions ([`HostFunction`], `Host.fn`), functions whose work keeps running across a suspend ([`DurableFunction`], +//! `Host.durableFn`), lazy path-addressed objects of functions ([`Namespace`], `Host.namespace`), and failures with +//! their own diagnostic kind ([`Failure`], `Host.fail` and `Host.missing`). +//! +//! Every value crossing in either direction is a copy ([`HostValue`]), never shared: plain data, `Date`, `Map`, `Set`, +//! `Uint8Array`, `URL`, `Headers` and errors. A function inside a result is callable too. Work a host function does is +//! a future instead of the reference's Effect. + +use std::fmt; +use std::future::Future; +use std::sync::Arc; +use std::sync::atomic::{AtomicBool, Ordering}; + +use crate::exec::BoxFuture; +use crate::host::RunId; +use crate::{Data, Json}; + +/// A string crossing the boundary: any string a program can hold, including one with an unpaired surrogate, which +/// has no UTF-8 form. It keeps such a string's UTF-16 code units, so a host sees and returns exactly what the program +/// had; [`HostString::to_string_lossy`] gives a Rust `String` when one is wanted, with U+FFFD for each unpaired +/// surrogate. +#[derive(Clone, Default, PartialEq, Eq, Hash)] +pub struct HostString(Text); + +#[derive(Clone, PartialEq, Eq, Hash)] +enum Text { + Utf8(String), + /// Code units holding at least one unpaired surrogate. + Utf16(Box<[u16]>), +} + +impl Default for Text { + fn default() -> Self { + Text::Utf8(String::new()) + } +} + +impl HostString { + /// The string of UTF-16 code units, well formed or not. + pub fn from_utf16(units: &[u16]) -> Self { + match String::from_utf16(units) { + Ok(s) => HostString(Text::Utf8(s)), + Err(_) => HostString(Text::Utf16(units.into())), + } + } + + /// The string as UTF-8, when it has no unpaired surrogate. + pub fn as_str(&self) -> Option<&str> { + match &self.0 { + Text::Utf8(s) => Some(s), + Text::Utf16(_) => None, + } + } + + /// Whether it has no unpaired surrogate, so it has a UTF-8 form. + pub fn is_well_formed(&self) -> bool { + matches!(self.0, Text::Utf8(_)) + } + + /// The string as UTF-8, with U+FFFD for each unpaired surrogate. + pub fn to_string_lossy(&self) -> std::borrow::Cow<'_, str> { + match &self.0 { + Text::Utf8(s) => std::borrow::Cow::Borrowed(s), + Text::Utf16(units) => std::borrow::Cow::Owned(String::from_utf16_lossy(units)), + } + } + + /// The string's UTF-16 code units. + pub fn to_utf16(&self) -> std::borrow::Cow<'_, [u16]> { + match &self.0 { + Text::Utf8(s) => std::borrow::Cow::Owned(s.encode_utf16().collect()), + Text::Utf16(units) => std::borrow::Cow::Borrowed(units), + } + } + + /// The string as UTF-8 when it is well formed, or itself. + pub fn into_string(self) -> Result { + match self.0 { + Text::Utf8(s) => Ok(s), + text => Err(HostString(text)), + } + } + + /// The text a run's string has (its carrier form: see `strings`). + pub(crate) fn from_run_text(text: &str) -> Self { + if !crate::strings::has_mark(text) { + return HostString(Text::Utf8(text.to_owned())); + } + Self::from_utf16(&crate::strings::units_of(text)) + } + + /// The string as a run's text: its carrier form when it has an unpaired surrogate or a `MARK`. + pub(crate) fn to_run_text(&self) -> String { + match &self.0 { + Text::Utf8(s) => crate::strings::external_text(s.clone()), + Text::Utf16(units) => crate::strings::from_units(units), + } + } +} + +impl From for HostString { + fn from(s: String) -> Self { + HostString(Text::Utf8(s)) + } +} + +impl From<&str> for HostString { + fn from(s: &str) -> Self { + HostString(Text::Utf8(s.to_owned())) + } +} + +impl From<&String> for HostString { + fn from(s: &String) -> Self { + HostString(Text::Utf8(s.clone())) + } +} + +impl PartialEq for HostString { + fn eq(&self, other: &str) -> bool { + self.as_str() == Some(other) + } +} + +impl PartialEq<&str> for HostString { + fn eq(&self, other: &&str) -> bool { + self.as_str() == Some(*other) + } +} + +impl PartialEq for HostString { + fn eq(&self, other: &String) -> bool { + self.as_str() == Some(other.as_str()) + } +} + +impl fmt::Display for HostString { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(&self.to_string_lossy()) + } +} + +impl fmt::Debug for HostString { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match &self.0 { + Text::Utf8(s) => fmt::Debug::fmt(s, f), + Text::Utf16(units) => write!(f, "HostString::from_utf16(&{units:?})"), + } + } +} + +/// A value on the host's side of the boundary. +#[derive(Clone, Debug, Default)] +pub enum HostValue { + #[default] + Undefined, + Null, + Bool(bool), + Number(f64), + String(HostString), + /// `None` is a hole. + Array(Vec>), + Object(Vec<(HostString, HostValue)>), + Map(Vec<(HostValue, HostValue)>), + Set(Vec), + Function(HostFunction), + /// A durable function, among a runtime's globals. + Durable(DurableFunction), + /// A namespace of functions, among a runtime's globals. + Namespace(Namespace), + Error(Box), + /// A failure with its own diagnostic kind, which a host function throws: see [`Failure`]. + Failure(Failure), + /// Milliseconds since the epoch; `NaN` is an invalid date. + Date(f64), + RegExp { + source: HostString, + flags: String, + }, + /// A URL by its `href`. + Url(String), + /// `URLSearchParams` by its name-value pairs. + SearchParams(Vec<(String, String)>), + /// `Headers` by its entries. + Headers(Vec<(String, String)>), + /// A `Uint8Array`, or an `ArrayBuffer`'s bytes. + Bytes(Vec), + /// A Node `Buffer`. + Buffer(Vec), + /// A live HTTP response whose body the host streams, the reference's `StreamingResponse`. + Response(crate::streaming::StreamingResponse), + /// What a host function throws (`Err(HostValue::Interrupt)`) to interrupt the whole run, as the reference's + /// host functions do with `Effect.interrupt`: the run ends with [`Interrupted`](crate::Interrupted). + Interrupt, +} + +impl HostValue { + pub fn object>(fields: impl IntoIterator) -> Self { + HostValue::Object(fields.into_iter().map(|(k, v)| (k.into(), v)).collect()) + } + + pub fn array(items: impl IntoIterator) -> Self { + HostValue::Array(items.into_iter().map(Some).collect()) + } + + /// A field of an object, if it is one. + pub fn get(&self, key: &str) -> Option<&HostValue> { + match self { + HostValue::Object(fields) => fields.iter().find(|(k, _)| k == key).map(|(_, v)| v), + _ => None, + } + } + + pub fn as_str(&self) -> Option<&str> { + match self { + HostValue::String(s) => s.as_str(), + _ => None, + } + } + + /// The string, when the value is one, unpaired surrogates kept. + pub fn as_host_string(&self) -> Option { + match self { + HostValue::String(s) => Some(s.clone()), + _ => None, + } + } + + pub fn as_f64(&self) -> Option { + match self { + HostValue::Number(n) => Some(*n), + _ => None, + } + } + + /// Plain JSON data as a host value. + pub fn from_json(json: &Json) -> Self { + match json { + Json::Null => HostValue::Null, + Json::Bool(b) => HostValue::Bool(*b), + Json::Number(n) => HostValue::Number(n.as_f64().unwrap_or(f64::NAN)), + Json::String(s) => HostValue::String(s.into()), + Json::Array(items) => HostValue::array(items.iter().map(HostValue::from_json)), + Json::Object(map) => HostValue::Object( + map.iter() + .map(|(k, v)| (k.into(), HostValue::from_json(v))) + .collect(), + ), + } + } + + /// The value as JSON, the way `JSON.stringify` would see it: functions and `undefined` vanish. + pub fn to_json(&self) -> Option { + Some(match self { + HostValue::Undefined + | HostValue::Function(_) + | HostValue::Durable(_) + | HostValue::Namespace(_) + | HostValue::Interrupt => return None, + HostValue::Null => Json::Null, + HostValue::Bool(b) => Json::Bool(*b), + HostValue::Number(n) if n.fract() == 0.0 && n.abs() < 9.0e15 => Json::from(*n as i64), + HostValue::Number(n) => { + serde_json::Number::from_f64(*n).map_or(Json::Null, Json::Number) + } + HostValue::String(s) => Json::String(s.to_string_lossy().into_owned()), + HostValue::Array(items) => Json::Array( + items + .iter() + .map(|i| { + i.as_ref() + .and_then(HostValue::to_json) + .unwrap_or(Json::Null) + }) + .collect(), + ), + HostValue::Set(items) => Json::Array( + items + .iter() + .map(|i| i.to_json().unwrap_or(Json::Null)) + .collect(), + ), + HostValue::Object(fields) => Json::Object( + fields + .iter() + .filter_map(|(k, v)| v.to_json().map(|j| (k.to_string_lossy().into_owned(), j))) + .collect(), + ), + HostValue::Map(_) + | HostValue::RegExp { .. } + | HostValue::SearchParams(_) + | HostValue::Headers(_) => Json::Object(Default::default()), + HostValue::Response(r) => { + serde_json::json!({ "response": {}, "redirected": r.redirected }) + } + HostValue::Date(t) => match t.is_finite() { + true => Json::String(crate::builtins::date::iso_string(*t)), + false => Json::Null, + }, + HostValue::Url(href) => Json::String(href.clone()), + HostValue::Bytes(data) => Json::Object( + data.iter() + .enumerate() + .map(|(i, b)| (i.to_string(), Json::from(*b))) + .collect(), + ), + HostValue::Buffer(data) => serde_json::json!({ "type": "Buffer", "data": data }), + HostValue::Error(e) => { + let mut map = serde_json::Map::new(); + map.insert( + "name".into(), + Json::String(e.name.to_string_lossy().into_owned()), + ); + map.insert( + "message".into(), + Json::String(e.message.to_string_lossy().into_owned()), + ); + Json::Object(map) + } + HostValue::Failure(f) => { + let lossy = |s: &HostString| Json::String(s.to_string_lossy().into_owned()); + serde_json::json!({ + "kind": f.kind, + "message": lossy(&f.message), + "suggestions": f.suggestions.iter().map(lossy).collect::>(), + }) + } + }) + } +} + +impl From<&str> for HostValue { + fn from(s: &str) -> Self { + HostValue::String(s.into()) + } +} + +impl From for HostValue { + fn from(s: String) -> Self { + HostValue::String(s.into()) + } +} + +impl From for HostValue { + fn from(n: f64) -> Self { + HostValue::Number(n) + } +} + +impl From for HostValue { + fn from(b: bool) -> Self { + HostValue::Bool(b) + } +} + +impl From for HostValue { + fn from(f: HostFunction) -> Self { + HostValue::Function(f) + } +} + +impl From for HostValue { + fn from(f: DurableFunction) -> Self { + HostValue::Durable(f) + } +} + +impl From for HostValue { + fn from(n: Namespace) -> Self { + HostValue::Namespace(n) + } +} + +impl From for HostValue { + fn from(e: HostError) -> Self { + HostValue::Error(Box::new(e)) + } +} + +impl From for HostValue { + fn from(f: Failure) -> Self { + HostValue::Failure(f) + } +} + +/// An error crossing the boundary: its name (`TypeError`, ...), message, cause, and own data such as Node's `code`. +#[derive(Clone, Debug, Default)] +pub struct HostError { + pub name: HostString, + pub message: HostString, + pub cause: Option>, + pub fields: Vec<(HostString, HostValue)>, +} + +impl HostError { + /// An `Error`. + pub fn new(message: impl Into) -> Self { + Self::named("Error", message) + } + + /// An error of a built-in type: `TypeError`, `RangeError`, `SyntaxError`, ... Other names become `Error`. + pub fn named(name: impl Into, message: impl Into) -> Self { + Self { + name: name.into(), + message: message.into(), + cause: None, + fields: Vec::new(), + } + } + + pub fn with_cause(mut self, cause: impl Into) -> Self { + self.cause = Some(Box::new(cause.into())); + self + } + + pub fn with_field(mut self, key: impl Into, value: impl Into) -> Self { + self.fields.push((key.into(), value.into())); + self + } +} + +impl fmt::Display for HostError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + if self.message == "" { + write!(f, "{}", self.name) + } else { + write!(f, "{}: {}", self.name, self.message) + } + } +} + +impl std::error::Error for HostError {} + +/// A failure with its own diagnostic `kind` and `suggestions`, the reference's `Host.fail` and `Host.missing`: a host +/// function throws it (`Err(failure.into())`), and a namespace resolves a path with no function to it. Uncaught, the +/// run fails with that kind, message and suggestions. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Failure { + pub kind: String, + pub message: HostString, + pub suggestions: Vec, +} + +impl Failure { + /// `Host.fail(kind, message)`. + pub fn new(kind: impl Into, message: impl Into) -> Self { + Self { + kind: kind.into(), + message: message.into(), + suggestions: Vec::new(), + } + } + + /// `Host.missing(message)`: what a namespace gives for a path with no function, an `ExecutionFailure` unless + /// [`Failure::kind`] says otherwise. + pub fn missing(message: impl Into) -> Self { + Self::new("ExecutionFailure", message) + } + + pub fn kind(mut self, kind: impl Into) -> Self { + self.kind = kind.into(); + self + } + + pub fn suggestions>( + mut self, + suggestions: impl IntoIterator, + ) -> Self { + self.suggestions = suggestions.into_iter().map(Into::into).collect(); + self + } +} + +impl fmt::Display for Failure { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(&self.message.to_string_lossy()) + } +} + +impl std::error::Error for Failure {} + +/// What a host function gives back: a value, or a value it throws (a [`HostValue::Error`] or [`HostValue::Failure`]). +pub type HostResult = Result; + +/// What a synchronous host function returns, the forms the reference's `Host.fn` result takes. +pub enum Returned { + /// Its outcome now: a value, or what it throws. + Now(HostResult), + /// Work still pending, which reaches the program as a promise, the reference's returned Promise. It starts at the + /// run's next handover, as the reference queues it. + Pending(BoxFuture<'static, HostResult>), + /// Work the program waits for before its next statement, the reference's returned Effect: the run's queued host + /// calls start first and keep running meanwhile, and a suspend is refused until it completes. Its value reaches + /// the program as `Now`'s does. + Block(BoxFuture<'static, HostResult>), +} + +impl From for Returned { + fn from(r: HostResult) -> Self { + Returned::Now(r) + } +} + +impl From for Returned { + fn from(v: HostValue) -> Self { + Returned::Now(Ok(v)) + } +} + +/// What every call of a host function gets. +#[derive(Clone)] +pub struct Call { + run_id: RunId, + call: u64, + suspending: Arc, +} + +impl Call { + pub(crate) fn new(run_id: RunId, call: u64, suspending: Arc) -> Self { + Self { + run_id, + call, + suspending, + } + } + + /// The call's key, `:`: the same across a suspended run's resumes. + pub fn key(&self) -> String { + crate::host::call_key(&self.run_id, self.call) + } + + /// Whether the run is being suspended: an interruption now detaches the call instead of ending it. + pub fn suspending(&self) -> bool { + self.suspending.load(Ordering::Relaxed) + } +} + +impl fmt::Debug for Call { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "Call({})", self.key()) + } +} + +/// What every call of a durable function gets: also the arguments it was called with, as they crossed. +#[derive(Clone, Debug)] +pub struct DurableCall { + pub call: Call, + pub args: Vec, +} + +impl std::ops::Deref for DurableCall { + type Target = Call; + fn deref(&self) -> &Call { + &self.call + } +} + +type SyncFn = dyn Fn(Vec, &Call) -> Returned + Send + Sync; +type AsyncFn = dyn Fn(Vec, Call) -> BoxFuture<'static, HostResult> + Send + Sync; + +#[derive(Clone)] +pub(crate) enum Body { + Sync(Arc), + Async(Arc), + /// A function a resumed run lost: calling it throws this message at the call. + Lost(Arc), + /// A live response's state, read with no call of the host (the reference's `hostGetter`). + Getter(crate::streaming::Getter), +} + +/// How a call of a host function reaches the program, the reference's `Host.Type`. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum CallType { + /// The program waits for the function: its value, or a promise for work it left pending. + Sync, + /// The program gets a promise at once, and the function runs once the program's current step ends. + Async, + /// As `Sync`, and an object result also has hidden `then`, `catch` and `finally`. + SyncThenable, +} + +/// A host function, the reference's `Host.fn`: it gets the program's arguments, as they crossed, and the call. +/// +/// A synchronous function returns before the next statement, like `fs.readFileSync`, and may block the thread to do +/// so; work it leaves pending reaches the program as a promise. An asynchronous one hands the program a promise, and +/// its future runs on whatever drives the program. +#[derive(Clone)] +pub struct HostFunction { + pub(crate) name: Arc, + pub(crate) length: u8, + pub(crate) body: Body, + pub(crate) thenable: bool, + pub(crate) idempotent: bool, + pub(crate) constructible: bool, + pub(crate) takes_functions: bool, + pub(crate) snapshot: Option, + /// Whether its name is its own, even when empty; otherwise an unnamed function is named by where it is. + pub(crate) own_name: bool, +} + +impl HostFunction { + /// A synchronous function: the program waits for it. It returns a [`HostResult`], a [`HostValue`], or a + /// [`Returned::Pending`] future, which the program holds as a promise. + pub fn new>( + f: impl Fn(Vec, &Call) -> R + Send + Sync + 'static, + ) -> Self { + Self::with_body(Body::Sync(Arc::new(move |args, call| f(args, call).into()))) + } + + /// An asynchronous function: the program gets a promise at once. + pub fn new_async(f: impl Fn(Vec, Call) -> F + Send + Sync + 'static) -> Self + where + F: Future + Send + 'static, + { + Self::with_body(Body::Async(Arc::new(move |args, call| { + Box::pin(f(args, call)) + }))) + } + + /// A function the crate makes for its own globals (a streaming response's methods), named and with a `length`. + pub(crate) fn internal( + name: &str, + length: u8, + f: impl Fn(Vec) -> HostResult + Send + Sync + 'static, + ) -> Self { + let mut made = Self::new(move |args, _: &Call| f(args)); + made.name = name.into(); + made.length = length; + made.own_name = true; + made + } + + pub(crate) fn internal_async( + name: &str, + length: u8, + f: impl Fn(Vec) -> F + Send + Sync + 'static, + ) -> Self + where + F: Future + Send + 'static, + { + // A plain function of the reference that returns a promise: it runs at the call, and its work reaches the + // program as a promise. + let mut made = Self::new(move |args, _: &Call| Returned::Pending(Box::pin(f(args)))); + made.name = name.into(); + made.length = length; + made.own_name = true; + made + } + + fn with_body(body: Body) -> Self { + Self { + name: Arc::from(""), + length: 0, + body, + thenable: false, + idempotent: false, + constructible: false, + takes_functions: false, + snapshot: None, + own_name: false, + } + } + + /// A function a resumed run lost: calling it throws `message`. + /// The getter of a live response's accessor (`get bodyUsed`, `get locked`). + pub(crate) fn live_getter(name: &str, g: crate::streaming::Getter) -> Self { + let mut made = Self::with_body(Body::Getter(g)); + made.name = name.into(); + made.own_name = true; + made + } + + pub(crate) fn lost(name: &str, message: String) -> Self { + let mut made = Self::with_body(Body::Lost(message.into())); + made.name = name.into(); + made.own_name = true; + made + } + + /// The name the program reads as the function's `name`; by default, the last part of where it is + /// (`readFile` for `fs.readFile`). + pub fn named(mut self, name: impl Into) -> Self { + self.name = Arc::from(name.into()); + self.own_name = true; + self + } + + /// What the program reads as the function's `length`. + pub fn length(mut self, length: u8) -> Self { + self.length = length; + self + } + + /// The reference's `"sync-thenable"` type: as a synchronous function, and an object result also has hidden + /// `then`, `catch` and `finally`, so the program can use it directly or await it. + /// + /// # Panics + /// + /// On an asynchronous function. + pub fn thenable(mut self) -> Self { + assert!( + !matches!(self.body, Body::Async(_)), + "A sync-thenable function is synchronous." + ); + self.thenable = true; + self + } + + /// Safe to run twice: a suspend interrupts a call in progress, and the resumed run calls it again with the same + /// key. Without it, a suspend fails while a call is in progress. + /// + /// # Panics + /// + /// On a synchronous function: idempotent applies only to asynchronous ones, as in the reference. + pub fn idempotent(mut self) -> Self { + assert!( + matches!(self.body, Body::Async(_)), + "idempotent applies only to async functions." + ); + self.idempotent = true; + self + } + + /// Lets a program call the function with `new`, as it would a class. `new` calls it the same way a plain call + /// does, and the program gets what it returns. + pub fn constructible(mut self) -> Self { + self.constructible = true; + self + } + + /// Lets the program pass back a function that was inside a result, on its own or inside an argument: it arrives as + /// the host function itself, and the run can't be suspended until the call completes. Without it, such a function + /// is treated like any other function in an argument (see [`Translate`](crate::Translate)). + pub fn takes_functions(mut self) -> Self { + self.takes_functions = true; + self + } + + /// Lets a saved run keep the functions inside values this function returned: `encode` gets such a value and gives + /// plain data (JSON values and bytes); `decode` gets that data back on resume and gives a value of the same shape, + /// whose functions the program's copies call from then on. Without it, those functions are lost on resume. + pub fn snapshot( + mut self, + encode: impl Fn(&HostValue) -> Result + Send + Sync + 'static, + decode: impl Fn(HostValue) -> HostValue + Send + Sync + 'static, + ) -> Self { + self.snapshot = Some(SnapshotHooks { + encode: Arc::new(encode), + decode: Arc::new(decode), + }); + self + } + + pub fn name(&self) -> &str { + &self.name + } + + /// How its calls reach the program. + pub fn call_type(&self) -> CallType { + match (&self.body, self.thenable) { + (Body::Async(_), _) => CallType::Async, + (_, true) => CallType::SyncThenable, + _ => CallType::Sync, + } + } + + pub fn is_async(&self) -> bool { + matches!(self.body, Body::Async(_)) + } + + pub fn is_idempotent(&self) -> bool { + self.idempotent + } + + pub fn is_constructible(&self) -> bool { + self.constructible + } + + pub fn accepts_functions(&self) -> bool { + self.takes_functions + } +} + +impl fmt::Debug for HostFunction { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "[Function {}]", self.name) + } +} + +/// A host function's `snapshot` hooks; see [`HostFunction::snapshot`]. +#[derive(Clone)] +pub struct SnapshotHooks { + pub(crate) encode: Arc, + pub(crate) decode: Arc, +} + +pub type SnapshotEncode = dyn Fn(&HostValue) -> Result + Send + Sync; +pub type SnapshotDecode = dyn Fn(HostValue) -> HostValue + Send + Sync; + +impl fmt::Debug for SnapshotHooks { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str("SnapshotHooks") + } +} + +type StartFn = + dyn Fn(Vec, Call) -> BoxFuture<'static, Result> + Send + Sync; +type WaitFn = dyn Fn(Data, DurableCall) -> BoxFuture<'static, HostResult> + Send + Sync; +type CancelFn = dyn Fn(Data, DurableCall) -> BoxFuture<'static, ()> + Send + Sync; + +/// A host function whose work keeps running across a suspend, the reference's `Host.durableFn`. `start` begins it +/// and gives JSON data, kept in a saved run; `wait(data)` runs right after, and again after a resume, for the result. +/// `cancel(data)` runs only when the run is interrupted, or ends with the work still running. The program always gets +/// a promise. +#[derive(Clone)] +pub struct DurableFunction { + pub(crate) start: Arc, + pub(crate) wait: Arc, + pub(crate) cancel: Arc, +} + +impl DurableFunction { + pub fn new( + start: impl Fn(Vec, Call) -> S + Send + Sync + 'static, + wait: impl Fn(Data, DurableCall) -> W + Send + Sync + 'static, + cancel: impl Fn(Data, DurableCall) -> C + Send + Sync + 'static, + ) -> Self + where + S: Future> + Send + 'static, + W: Future + Send + 'static, + C: Future + Send + 'static, + { + Self { + start: Arc::new(move |args, call| Box::pin(start(args, call))), + wait: Arc::new(move |data, call| Box::pin(wait(data, call))), + cancel: Arc::new(move |data, call| Box::pin(cancel(data, call))), + } + } +} + +impl fmt::Debug for DurableFunction { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str("[DurableFunction]") + } +} + +/// What a namespace gives for a path: the function a call reaches, or the failure the call throws. +pub enum Resolved { + Function(HostFunction), + Durable(DurableFunction), + Missing(Failure), +} + +impl From for Resolved { + fn from(f: HostFunction) -> Self { + Resolved::Function(f) + } +} + +impl From for Resolved { + fn from(f: DurableFunction) -> Self { + Resolved::Durable(f) + } +} + +impl From for Resolved { + fn from(f: Failure) -> Self { + Resolved::Missing(f) + } +} + +type KeysFn = dyn Fn(&[HostString]) -> Result, HostValue> + Send + Sync; +type ResolveFn = dyn Fn(&[HostString]) -> Resolved + Send + Sync; + +/// A lazy object of host functions, for sets of functions too large to build as objects, the reference's `Host.namespace`. +/// `keys(path)` lists the names under a path, for `Object.keys` and `for...in`, or fails with what `Object.keys` then +/// throws (a [`Failure`], say); `resolve(path)` gives the function a call reaches, or a failure (see +/// [`Failure::missing`]) the call throws. Any path can be read, so `ns.a.b` is a path +/// whether or not anything is there. +#[derive(Clone)] +pub struct Namespace { + pub(crate) keys: Arc, + pub(crate) resolve: Arc, +} + +impl Namespace { + pub fn new>( + keys: impl Fn(&[HostString]) -> Result, HostValue> + Send + Sync + 'static, + resolve: impl Fn(&[HostString]) -> R + Send + Sync + 'static, + ) -> Self { + Self { + keys: Arc::new(keys), + resolve: Arc::new(move |path| resolve(path).into()), + } + } +} + +impl fmt::Debug for Namespace { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str("[Namespace]") + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/iteration.rs b/packages/codemode-rust/crates/psychoscript/src/iteration.rs new file mode 100644 index 0000000000000..f79c74bc84f73 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/iteration.rs @@ -0,0 +1,816 @@ +//! Iteration in bytecode over an iterator the VM does not step itself: one whose `[Symbol.iterator]`, `next` or +//! `return` is the program's (or a helper's, or the host's). The iteration instruction pushes a native frame (see +//! `native.rs`) that makes the call and hands the result back to the instruction's frame as the instruction would: +//! a value pushed, or for a finished `for...of` a jump to its exit, as a finished generator hands its end back +//! (`Vm::generator_done`). A step that fails forgets the iterator first, so it is not closed afterwards. +//! +//! `yield*` and `for await` do the same: a delegated iterator's `next`, `throw` or `return` of the program's, a +//! delegated generator resumed with a `return` or `throw` request, the sync iterator behind an async-from-sync one +//! (its step's promise settled once the call returns), and an async open or close that calls the program. + +use crate::native::{Frame, Input, NativeOp, Step}; +use crate::object::*; +use crate::value::{Id, Slot, Value}; +use crate::vm::{REQ_RETURN, Reaction, Res, Vm}; + +/// The steps, by the frame's sub-op. +const OPEN: u16 = 0; +const NEXT: u16 = 1; +const STEP: u16 = 2; +const REST: u16 = 3; +const SPREAD: u16 = 4; +const CLOSE: u16 = 5; +/// A delegated iterator's `next`, `throw` or `return` for `yield*` or `for await`, or an async iterator's `return` +/// closing it, called as native code calls: its result is pushed. +const CALL: u16 = 6; +/// A `yield*` over a generator suspended at a `yield` that gets a `return` or `throw` request: the generator resumed +/// with it, its value pushed and the `DelegateResult` after skipped or left through its exit. +const RESUME: u16 = 7; +/// A step of an async-from-sync iterator (`for await` or an async generator's `yield*` over a sync iterable): the sync +/// iterator's method called or its generator resumed, then the step's promise settled from the result. +const ADAPT: u16 = 8; +/// `GetAsyncIter` over a value whose `[Symbol.asyncIterator]` or `[Symbol.iterator]` is the program's. +const ASYNC_OPEN: u16 = 9; + +// Slots shared by the steps. +const IT: usize = 0; +const NEXT_FN: usize = 1; +/// The instruction's iterator slot, in its frame. +const SLOT: usize = 2; +/// `for...of`'s exit; for an open or a close, its fuel; for a close, whether it is quiet (`IterCloseQuiet`). +const EXTRA: usize = 3; +/// The values collected so far (an internal array) for a rest element or a spread; for an open, the source. +const OUT: usize = 4; +/// Whether a spread has opened its iterator yet; whether an async open adapts a sync iterator. +const FLAG: usize = 5; + +// The slots of a call (`CALL`): its argument, and whether it has one. +const ARG: usize = 0; +const HAS_ARG: usize = 1; + +// The slots of a resumed generator (`RESUME`). +const GEN: usize = 0; +const MODE: usize = 1; +const SENT: usize = 2; + +// The slots of an async-from-sync step (`ADAPT`): the step's promise, the sync iterator, the request (`REQ_*`), its +// argument and whether it has one, and how the step goes (`BY_*`). +const MADE: usize = 0; +const SYNC: usize = 1; +const KIND: usize = 2; +const SYNC_ARG: usize = 3; +const SYNC_HAS_ARG: usize = 4; +const HOW: usize = 5; +/// The sync iterator's method called as native code calls it. +pub(crate) const BY_UNCOUNTED: usize = 0; +/// Its `next` called as bytecode calls it. +pub(crate) const BY_COUNTED: usize = 1; +/// The sync iterator, a generator, resumed with `next`. +pub(crate) const BY_RESUME: usize = 2; +/// Its `return` called to close it, as it lacks the `throw` asked for: the promise is rejected after. +pub(crate) const BY_CLOSE: usize = 3; + +impl Vm { + /// Whether `it`, kept with `next` in an iterator record, is stepped through a call the VM makes for it: anything + /// but a built-in iterator stepped directly and a generator. + pub(crate) fn steps_by_call(&self, it: Slot, next: Slot) -> bool { + let Some(id) = it.obj() else { return false }; + match self.heap[id as usize].kind { + Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } => !next.get().is_nullish(), + Kind::Generator(_) => false, + _ => true, + } + } + + /// `GetIter` over a value whose `[Symbol.iterator]` the program wrote: checks it as `get_iterator_in` does, then + /// pushes a frame that calls it. `None` when opening it makes no call. + pub(crate) fn open_by_call(&mut self, v: &Value, slot: u32, ctx: u8) -> Option { + let method = match self.program_iterator_method(v)? { + Ok(m) => m, + Err(e) => return Some(Err(e)), + }; + if !self.is_iterable(v) { + return Some(Err(self.not_iterable(v, ctx))); + } + if !self.is_callable(&method) { + return Some(Err(self.type_error("Iterator method must be a function."))); + } + let cost = self.open_fuel(v, ctx); + let slots = [ + Value::Undef, + Value::Undef, + Value::Num(slot as f64), + Value::Num(cost as f64), + *v, + Value::Undef, + ]; + Some(self.enter_native_with(NativeOp::Iteration, OPEN, method, Value::Undef, &slots)) + } + + /// The `[Symbol.iterator]` method opening `v` calls, when it is not one the VM runs itself. + pub(crate) fn program_iterator_method(&mut self, v: &Value) -> Option { + let Value::Obj(id) = v else { return None }; + if self.walks(v) + || matches!( + self.heap[*id as usize].kind, + Kind::Generator(_) + | Kind::Arguments(_) + | Kind::ArrayIter { .. } + | Kind::StrIter { .. } + ) + { + return None; + } + if self.has_program_getter(*id, SYM_ITERATOR) { + return Some(self.get_calling(*id, SYM_ITERATOR)); + } + let f = self.get_obj(*id, SYM_ITERATOR); + (!f.is_nullish() && !matches!(&f, Value::Obj(m) if matches!(self.heap[*m as usize].kind, Kind::Native { .. }))) + .then_some(Ok(f)) + } + + /// `IterNext` (`exit` is its jump), `IterStep` (`exit` none) or `IterRest` (`rest`) over an iterator stepped by a + /// call: pushes the frame that steps it. + pub(crate) fn step_by_call( + &mut self, + it: Slot, + next: Slot, + slot: u32, + exit: Option, + rest: bool, + ) -> Res { + let sub = match (exit, rest) { + (_, true) => REST, + (Some(_), _) => NEXT, + (None, _) => STEP, + }; + let out = if rest { + self.new_array(Vec::new()) + } else { + Value::Undef + }; + let exit = Value::Num(exit.unwrap_or(0) as f64); + let slots = [ + it.get(), + next.get(), + Value::Num(slot as f64), + exit, + out, + Value::Undef, + ]; + self.enter_native_with(NativeOp::Iteration, sub, Value::Undef, Value::Undef, &slots) + } + + /// `ArraySpread` of a value opened or stepped by a call into the array below it: pushes the frame that does it. + pub(crate) fn spread_by_call(&mut self, src: Value) -> Option { + let Value::Obj(id) = src else { return None }; + if self.walks(&src) || matches!(self.heap[id as usize].kind, Kind::Generator(_)) { + return None; + } + let method = self.get_obj(id, SYM_ITERATOR); + let native = matches!(&method, Value::Obj(m) if matches!(self.heap[*m as usize].kind, Kind::Native { .. })); + let stepped_by_call = matches!( + self.heap[id as usize].kind, + Kind::IterHelper(_) | Kind::ExoticIter { .. } + ); + if native && !stepped_by_call && !matches!(self.heap[id as usize].kind, Kind::Ordinary) { + return None; + } + let slots = [ + Value::Undef, + Value::Undef, + Value::Num(0.0), + Value::Num(0.0), + src, + Value::Undef, + ]; + Some(self.enter_native_with( + NativeOp::Iteration, + SPREAD, + Value::Undef, + Value::Undef, + &slots, + )) + } + + /// `IterClose` or `IterCloseQuiet` of an iterator closed by a call (a generator suspended at a `yield`, or one with + /// a `return` method that is not the VM's): pushes the frame that closes it. `None` when closing makes no call. + pub(crate) fn close_by_call(&mut self, it: &Value, quiet: bool) -> Option { + let Value::Obj(id) = it else { return None }; + let call = match &self.heap[*id as usize].kind { + Kind::Generator(GenState::Suspended(_)) => true, + Kind::Generator(_) + | Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } => false, + _ => { + let rk = self.names.return_; + let f = self.get_obj(*id, rk); + self.is_callable(&f) + } + }; + if !call { + return None; + } + let cost = self.close_fuel(it); + let slots = [ + *it, + Value::Undef, + Value::Num(0.0), + Value::Num(cost as f64), + Value::Bool(quiet), + Value::Undef, + ]; + Some(self.enter_native_with( + NativeOp::Iteration, + CLOSE, + Value::Undef, + Value::Undef, + &slots, + )) + } + + /// Whether calling `f` runs code of the program's (or a bound function or namespace path over it), which a frame + /// calls; a native is called at once. + pub(crate) fn calls_program(&self, f: &Value) -> bool { + matches!(f, Value::Obj(id) if self.heap[*id as usize].is_callable() + && !matches!(self.heap[*id as usize].kind, Kind::Native { .. })) + } + + /// `DelegateCall` or `AsyncClose` calling the iterator's method `m` (see `calls_program`) on `it`, with `arg` if + /// any: pushes the frame that calls it and pushes its result for the instruction. + pub(crate) fn delegate_by_call(&mut self, m: Value, it: Value, arg: Option) -> Res { + let slots = [arg.unwrap_or_default(), Value::Bool(arg.is_some())]; + self.enter_native_with(NativeOp::Iteration, CALL, m, it, &slots) + } + + /// `DelegateCall` with a `return` (`mode` 1) or `throw` (2) request for the suspended generator `g`: pushes the + /// frame that resumes it. + pub(crate) fn resume_delegate_by_frame(&mut self, g: Id, mode: u8, sent: Value) -> Res { + let slots = [Value::Obj(g), Value::Num(mode as f64), sent]; + self.enter_native_with( + NativeOp::Iteration, + RESUME, + Value::Undef, + Value::Undef, + &slots, + ) + } + + /// A step of an async-from-sync iterator over `sync` that calls the program or resumes a generator (`how` is one + /// of `BY_*`; `m` the method to call): pushes the frame that takes it and settles `made` after. + #[allow(clippy::too_many_arguments)] + pub(crate) fn adapt_by_frame( + &mut self, + how: usize, + made: Id, + sync: Id, + kind: u8, + arg: Option, + m: Value, + ) -> Res { + let slots = [ + Value::Obj(made), + Value::Obj(sync), + Value::Num(kind as f64), + arg.unwrap_or_default(), + Value::Bool(arg.is_some()), + Value::Num(how as f64), + ]; + self.enter_native_with(NativeOp::Iteration, ADAPT, m, Value::Undef, &slots) + } + + /// Settles the promise `made` of an async-from-sync step from the sync iterator's answer: with the value once it + /// resolved (closing the iterator if that fails and it is not done), or rejected with what the step threw. + pub(crate) fn settle_from_sync( + &mut self, + made: Id, + sync: Id, + kind: u8, + step: Result<(Value, bool), Value>, + ) -> Result<(), Value> { + match step { + Ok((v, done)) => { + let close = (kind != REQ_RETURN && !done).then_some(sync); + let w = self.promise_resolve(v); + self.perform_then(w, Reaction::FromSync { made, done, close }); + } + Err(e) => { + if self.fatal.is_some() { + return Err(e); + } + self.reject(made, e); + } + } + Ok(()) + } + + /// `GetAsyncIter` opening `v` with the program's `method`: its `[Symbol.asyncIterator]`, or with `sync_open` (the + /// open's fuel) its `[Symbol.iterator]`, whose iterator is adapted. Pushes the frame that calls it and writes the + /// instruction's iterator record. + pub(crate) fn open_async_by_call( + &mut self, + method: Value, + v: Value, + slot: u32, + sync_open: Option, + ) -> Res { + let slots = [ + Value::Undef, + Value::Undef, + Value::Num(slot as f64), + Value::Num(sync_open.unwrap_or(0) as f64), + v, + Value::Bool(sync_open.is_some()), + ]; + self.enter_native_with(NativeOp::Iteration, ASYNC_OPEN, method, v, &slots) + } +} + +/// The step of an iteration frame. +pub(crate) fn step(vm: &mut Vm, sub: u16, fr: Frame, input: Input) -> Result { + match sub { + OPEN => open_step(vm, fr, input), + NEXT | STEP | REST => next_step(vm, sub, fr, input), + SPREAD => spread_step(vm, fr, input), + CLOSE => close_step(vm, fr, input), + CALL => call_step(vm, fr, input), + RESUME => resume_step(vm, fr, input), + ADAPT => adapt_step(vm, fr, input), + ASYNC_OPEN => async_open_step(vm, fr, input), + _ => Ok(Step::Done(Value::Undef)), + } +} + +/// The frame below the iteration frame: the instruction's. +fn caller(vm: &Vm) -> usize { + vm.frames.len().saturating_sub(2) +} + +/// Writes the instruction's iterator slot (and the slot after it, its record's `next`). +fn set_caller_slot(vm: &mut Vm, fr: Frame, k: usize, v: Slot) { + let c = caller(vm); + let at = vm.frames[c].base + fr.index(vm, SLOT) + k; + if let Some(s) = vm.stack.get_mut(at) { + *s = v; + } +} + +fn open_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + match input { + Input::Start => { + let (f, src) = (fr.callee(vm), fr.slot(vm, OUT)); + fr.call_slots_as(vm, f, src, [], Step::CallUncounted) + } + Input::Returned(r) => { + let it = r.get(); + let Value::Obj(id) = it else { + return Err(vm.type_error("Iterator method result must be an object.")); + }; + let nk = vm.names.next; + let next = vm.get_calling(id, nk)?; + if !vm.is_callable(&next) { + return Err(vm.type_error("Iterator next must be a function.")); + } + vm.fuel(fr.index(vm, EXTRA) as i32); + let src = fr.get(vm, OUT); + let next = vm.record_next_read(&src, &it, next)?; + set_caller_slot(vm, fr, 0, Slot::pack(it)); + set_caller_slot(vm, fr, 1, Slot::pack(next)); + Ok(Step::DoneEmpty) + } + Input::Threw(e) => Err(e), + Input::Finished(_) => Ok(Step::DoneEmpty), + } +} + +/// Calls the iterator's `next` as `Vm::iter_step_with` does: the VM's own iterators and helpers without a native's +/// fifty, any other as bytecode calls it. A throw comes back to the frame, which forgets the iterator. +fn call_next(vm: &mut Vm, fr: Frame, it: Slot, next: Slot) -> Result { + let id = it.obj().unwrap_or(0); + let direct = next.get().is_nullish(); + let f = if direct { + let nk = vm.names.next; + Slot::pack(vm.get_calling(id, nk)?) + } else { + next + }; + let uncounted = match vm.heap[id as usize].kind { + Kind::IterHelper(_) => true, + Kind::ExoticIter { .. } => direct, + _ => false, + }; + let sp = (vm.stack.len() - fr.base()) as u32; + vm.handlers_mut().push(crate::vm::Handler { + pc: crate::native::THREW as u32, + sp, + }); + let mode = if uncounted { + Step::CallUncounted + } else { + Step::Call + }; + fr.call_slots_as(vm, f, it, [], mode) +} + +/// What a `next()` result says: its value, or `None` when done. +fn result_of(vm: &mut Vm, r: Slot) -> Result, Value> { + let Some(rid) = r.obj() else { + return Err(vm.type_error("Iterator next() result must be an object.")); + }; + let (dk, vk) = (vm.names.done, vm.names.value); + let d = vm.get_calling(rid, dk)?; + if vm.truthy(&d) { + return Ok(None); + } + Ok(Some(vm.get_calling(rid, vk)?)) +} + +fn next_step(vm: &mut Vm, sub: u16, fr: Frame, input: Input) -> Result { + let (it, next) = (fr.slot(vm, IT), fr.slot(vm, NEXT_FN)); + let got = match input { + Input::Start => return call_next(vm, fr, it, next), + Input::Returned(r) => result_of(vm, r), + Input::Threw(e) => Err(e), + Input::Finished(_) => Ok(None), + }; + let got = match got { + Ok(g) => g, + Err(e) => { + set_caller_slot(vm, fr, 0, Slot::UNDEF); + return Err(e); + } + }; + match (sub, got) { + (REST, Some(v)) => { + let out = fr.slot(vm, OUT).obj().unwrap_or(0); + if let Kind::Array(items) = &mut vm.heap[out as usize].kind { + items.push(v); + } + call_next(vm, fr, it, next) + } + (REST, None) => { + set_caller_slot(vm, fr, 0, Slot::UNDEF); + Ok(Step::Done(fr.get(vm, OUT))) + } + (_, Some(v)) => Ok(Step::Done(v)), + (NEXT, None) => { + set_caller_slot(vm, fr, 0, Slot::UNDEF); + let c = caller(vm); + vm.frames[c].pc = fr.index(vm, EXTRA); + Ok(Step::DoneEmpty) + } + (_, None) => { + set_caller_slot(vm, fr, 0, Slot::UNDEF); + Ok(Step::Done(Value::Undef)) + } + } +} + +/// A spread: opened as `iterate_to_vec` opens it, then stepped to its end, its values appended to the array below. +fn spread_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + match input { + Input::Start => { + let src = fr.get(vm, OUT); + if let Some(method) = vm.program_iterator_method(&src) { + let method = method?; + if !vm.is_callable(&method) { + return Err(vm.type_error("Iterator method must be a function.")); + } + fr.set_index(vm, FLAG, 1); + return fr.call_slots_as( + vm, + Slot::pack(method), + Slot::pack(src), + [], + Step::CallUncounted, + ); + } + let it = vm.get_iterator(&src)?; + let next = vm.record_next_of(&src, &it)?; + fr.set(vm, IT, it); + fr.set(vm, NEXT_FN, next); + let out = vm.new_array(Vec::new()); + fr.set(vm, OUT, out); + } + Input::Returned(r) if fr.index(vm, FLAG) == 1 => { + // The opening call returned the iterator. + let it = r.get(); + let Value::Obj(id) = it else { + return Err(vm.type_error("Iterator method result must be an object.")); + }; + let nk = vm.names.next; + let next = vm.get_calling(id, nk)?; + if !vm.is_callable(&next) { + return Err(vm.type_error("Iterator next must be a function.")); + } + let src = fr.get(vm, OUT); + let next = vm.record_next_read(&src, &it, next)?; + fr.set(vm, IT, it); + fr.set(vm, NEXT_FN, next); + fr.set_index(vm, FLAG, 0); + let out = vm.new_array(Vec::new()); + fr.set(vm, OUT, out); + } + Input::Returned(r) => match result_of(vm, r)? { + Some(v) => { + let out = fr.slot(vm, OUT).obj().unwrap_or(0); + if let Kind::Array(items) = &mut vm.heap[out as usize].kind { + if items.len() >= crate::ops::MAX_ARRAY_LEN { + return Err(vm.range_error("Invalid array length")); + } + items.push(v); + } + } + None => return spread_done(vm, fr), + }, + Input::Threw(e) => return Err(e), + Input::Finished(_) => return spread_done(vm, fr), + } + let (it, next) = (fr.slot(vm, IT), fr.slot(vm, NEXT_FN)); + if !vm.steps_by_call(it, next) { + // The VM steps it itself after all: the rest of it at once. + let (itv, nextv) = (it.get(), next.get()); + let out = fr.slot(vm, OUT).obj().unwrap_or(0); + while let Some(v) = vm.iter_step_with(&itv, nextv)? { + if let Kind::Array(items) = &mut vm.heap[out as usize].kind { + if items.len() >= crate::ops::MAX_ARRAY_LEN { + return Err(vm.range_error("Invalid array length")); + } + items.push(v); + } + } + return spread_done(vm, fr); + } + let id = it.obj().unwrap_or(0); + let direct = next.get().is_nullish(); + let f = if direct { + let nk = vm.names.next; + Slot::pack(vm.get_calling(id, nk)?) + } else { + next + }; + let uncounted = match vm.heap[id as usize].kind { + Kind::IterHelper(_) => true, + Kind::ExoticIter { .. } => direct, + _ => false, + }; + let mode = if uncounted { + Step::CallUncounted + } else { + Step::Call + }; + fr.call_slots_as(vm, f, it, [], mode) +} + +/// Appends a spread's values to the array below the frame's callee and receiver. +fn spread_done(vm: &mut Vm, fr: Frame) -> Result { + let items = match fr + .slot(vm, OUT) + .obj() + .map(|o| &mut vm.heap[o as usize].kind) + { + Some(Kind::Array(items)) => std::mem::take(items), + _ => Vec::new(), + }; + let target = vm.stack[fr.base() - 3].obj(); + if let Some(Kind::Array(arr)) = target.map(|t: Id| &mut vm.heap[t as usize].kind) { + arr.extend(items); + } + Ok(Step::DoneEmpty) +} + +/// A close: the generator resumed with a return, or the iterator's `return` called as native code calls it; then its +/// fuel. A quiet close ignores how it went; a plain one throws what it threw, after the fuel. +fn close_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + let it = fr.get(vm, IT); + let quiet = matches!(fr.get(vm, OUT), Value::Bool(true)); + let outcome = match input { + Input::Start => { + let Value::Obj(id) = it else { + return Ok(Step::DoneEmpty); + }; + if matches!(vm.heap[id as usize].kind, Kind::Generator(_)) { + let sp = (vm.stack.len() - fr.base()) as u32; + vm.handlers_mut().push(crate::vm::Handler { + pc: crate::native::THREW as u32, + sp, + }); + return match vm.native_resume(id, 1, Value::Undef) { + Ok(None) => Ok(Step::Pushed), + Ok(Some(_)) => close_done(vm, fr, Ok(()), quiet), + Err(e) => close_done(vm, fr, Err(e), quiet), + }; + } + let rk = vm.names.return_; + let f = Slot::pack(vm.get_calling(id, rk)?); + let sp = (vm.stack.len() - fr.base()) as u32; + vm.handlers_mut().push(crate::vm::Handler { + pc: crate::native::THREW as u32, + sp, + }); + return fr.call_slots_as(vm, f, Slot::pack(it), [], Step::CallUncounted); + } + Input::Returned(r) => { + let generator = matches!(it, Value::Obj(id) if matches!(vm.heap[id as usize].kind, Kind::Generator(_))); + if !generator && r.obj().is_none() { + Err(vm.type_error("Iterator return() result must be an object.")) + } else { + Ok(()) + } + } + Input::Threw(e) => Err(e), + Input::Finished(_) => Ok(()), + }; + close_done(vm, fr, outcome, quiet) +} + +fn close_done( + vm: &mut Vm, + fr: Frame, + outcome: Result<(), Value>, + quiet: bool, +) -> Result { + vm.fuel(fr.index(vm, EXTRA) as i32); + match outcome { + Err(e) if !quiet || vm.fatal.is_some() => Err(e), + _ => Ok(Step::DoneEmpty), + } +} + +/// Calls the frame's callee on its receiver, with its argument if it has one, as `mode` asks. A closure costs the +/// same either way, so its frame is pushed at once. +fn call_with_arg( + vm: &mut Vm, + fr: Frame, + this: Slot, + arg: Option, + mode: fn(usize) -> Step, +) -> Result { + let f = fr.callee(vm); + if f.obj() + .is_some_and(|id| matches!(vm.heap[id as usize].kind, Kind::Closure(_))) + { + return match arg { + Some(a) => fr.call_slots(vm, f, this, [a]), + None => fr.call_slots(vm, f, this, []), + }; + } + match arg { + Some(a) => fr.call_slots_as(vm, f, this, [a], mode), + None => fr.call_slots_as(vm, f, this, [], mode), + } +} + +/// A delegated iterator's method: its result goes to the instruction as it is. +fn call_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + match input { + Input::Start => { + let arg = matches!(fr.get(vm, HAS_ARG), Value::Bool(true)).then(|| fr.slot(vm, ARG)); + let this = fr.this_slot(vm); + call_with_arg(vm, fr, this, arg, Step::CallUncounted) + } + Input::Returned(r) | Input::Finished(r) => Ok(Step::Done(r.get())), + Input::Threw(e) => Err(e), + } +} + +/// A delegated generator resumed with a `return` or `throw` request: what it yields or returns goes to the +/// instruction as a value and a done flag, as `Vm::sync_delegate_step` hands them over. +fn resume_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + let (v, done) = match input { + Input::Start => { + let g = fr.slot(vm, GEN).obj().unwrap_or(0); + let (mode, sent) = (fr.index(vm, MODE) as u8, fr.get(vm, SENT)); + match crate::builtins::collections::resume_catching(vm, fr, g, mode, sent)? { + None => return Ok(Step::Pushed), + Some(step) => step, + } + } + Input::Returned(r) => (r.get(), false), + Input::Finished(r) => (r.get(), true), + Input::Threw(e) => return Err(e), + }; + // The value is pushed; a done one leaves through the following `DelegateResult`'s exit, else it is skipped. + let c = caller(vm); + let f = &mut vm.frames[c]; + f.pc = match f.func.code.get(f.pc) { + Some(crate::bytecode::Op::DelegateResult(exit, _)) if done => *exit as usize, + _ => crate::vm::delegate_continue(&f.func.code, f.pc + 1), + }; + Ok(Step::Done(v)) +} + +/// An async-from-sync step: the sync iterator's answer, or what its step threw, settles the step's promise, which +/// goes to the instruction. +fn adapt_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + let how = fr.index(vm, HOW); + let made = fr.slot(vm, MADE).obj().unwrap_or(0); + let sync = fr.slot(vm, SYNC).obj().unwrap_or(0); + let kind = fr.index(vm, KIND) as u8; + let step = match input { + Input::Start if how == BY_RESUME => { + let arg = fr.get(vm, SYNC_ARG); + match crate::builtins::collections::resume_catching(vm, fr, sync, 0, arg) { + Ok(None) => return Ok(Step::Pushed), + Ok(Some(step)) => Ok(step), + Err(e) => Err(e), + } + } + Input::Start => { + let sp = (vm.stack.len() - fr.base()) as u32; + vm.handlers_mut().push(crate::vm::Handler { + pc: crate::native::THREW as u32, + sp, + }); + let arg = matches!(fr.get(vm, SYNC_HAS_ARG), Value::Bool(true)) + .then(|| fr.slot(vm, SYNC_ARG)); + let mode = if how == BY_COUNTED { + Step::Call + } else { + Step::CallUncounted + }; + return call_with_arg(vm, fr, fr.slot(vm, SYNC), arg, mode); + } + Input::Returned(r) => match how { + BY_RESUME => Ok((r.get(), false)), + BY_CLOSE if r.obj().is_none() => { + Err(vm.type_error("Iterator return() result must be an object.")) + } + BY_CLOSE => { + Err(vm.type_error("The delegated iterator does not provide a throw() method.")) + } + _ => vm.iter_result_parts(&r.get(), kind), + }, + Input::Finished(r) => Ok((r.get(), true)), + Input::Threw(e) => Err(e), + }; + if how == BY_CLOSE { + // Closing ends in a rejection either way: with what it threw, or for the missing `throw`. + if let Err(e) = step { + vm.reject(made, e); + } + return Ok(Step::Done(Value::Obj(made))); + } + vm.settle_from_sync(made, sync, kind, step)?; + Ok(Step::Done(Value::Obj(made))) +} + +/// An async open: the method returned the iterator, checked as `Vm::open_with` checks it, then kept in the +/// instruction's iterator record, adapted when it is a sync one. +fn async_open_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + let r = match input { + Input::Start => { + let (f, src) = (fr.callee(vm), fr.slot(vm, OUT)); + return fr.call_slots_as(vm, f, src, [], Step::CallUncounted); + } + Input::Returned(r) => r, + Input::Threw(e) => return Err(e), + Input::Finished(_) => return Ok(Step::DoneEmpty), + }; + let Value::Obj(id) = r.get() else { + return Err(vm.type_error("Iterator method result must be an object.")); + }; + let nk = vm.names.next; + let next = vm.get_calling(id, nk)?; + if !vm.is_callable(&next) { + return Err(vm.type_error("Iterator next must be a function.")); + } + let it = if matches!(fr.get(vm, FLAG), Value::Bool(true)) { + vm.fuel(fr.index(vm, EXTRA) as i32); + let src = fr.get(vm, OUT); + let next = vm.record_next_read(&src, &Value::Obj(id), next)?; + let proto = vm.realm.async_from_sync_proto; + Value::Obj(vm.alloc(Obj::new( + Some(proto), + Kind::AsyncFromSync { sync: id, next }, + ))) + } else { + // The reference calls the method as bytecode calls it. + if !vm.is_closure(&fr.callee(vm).get()) { + vm.fuel(crate::vm::NATIVE_FUEL); + } + Value::Obj(id) + }; + // The `next` read above, unless the record keeps none. + let next = match it { + Value::Obj(i) if i == id => match vm.heap[id as usize].kind { + Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } + | Kind::ExoticIter { .. } + | Kind::Generator(_) + | Kind::AsyncFromSync { .. } => Value::Undef, + _ => next, + }, + _ => vm.record_next(&it)?, + }; + set_caller_slot(vm, fr, 0, Slot::pack(it)); + set_caller_slot(vm, fr, 1, Slot::pack(next)); + Ok(Step::DoneEmpty) +} diff --git a/packages/codemode-rust/crates/psychoscript/src/lib.rs b/packages/codemode-rust/crates/psychoscript/src/lib.rs new file mode 100644 index 0000000000000..9611f05e0e9ff --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/lib.rs @@ -0,0 +1,69 @@ +//! PsychoScript: a confined, JavaScript-like language whose programs call the host's functions, embeddable in Rust. +//! +//! This crate is the Rust implementation of the reference's language layer (`src/language/` of `@opencode/codemode`): +//! [`Runtime`] is `Runtime.make`, [`HostFunction`] is `Host.fn`, [`DurableFunction`] is `Host.durableFn`, +//! [`Namespace`] is `Host.namespace`, [`Failure`] is `Host.fail` and `Host.missing`, and [`Program`] is +//! `runtime.program`. Host work is a [`Future`](std::future::Future) instead of an Effect; [`Runtime::execute_async`] +//! runs on any executor, and [`Runtime::execute`] drives it on the calling thread. +//! +//! The public API below is shared with the benchmark and conformance harnesses, so change it only together with them. + +mod accessors; +mod builtins; +mod bytecode; +mod classes; +mod collector; +mod compiler; +mod conversion; +mod convert; +mod cross; +mod data; +mod diagnostic; +mod exec; +#[cfg(feature = "gc-stats")] +mod gc; +mod host; +mod host_function; +mod iteration; +mod native; +mod nesting; +mod object; +mod offload; +mod ops; +mod program; +mod promise; +mod reach; +mod run; +mod runtime; +mod snapshot; +mod streaming; +mod strings; +#[cfg(feature = "test262")] +#[doc(hidden)] +pub mod test262; +mod value; +mod vm; + +pub use data::Data; +pub use diagnostic::{Diagnostic, DiagnosticKind, Interrupted, Limits}; +pub use exec::BoxFuture; +#[cfg(feature = "gc-stats")] +#[doc(hidden)] +pub use gc::HeapStats; +pub use host_function::{ + Call, CallType, DurableCall, DurableFunction, Failure, HostError, HostFunction, HostResult, + HostString, HostValue, Namespace, Resolved, Returned, SnapshotHooks, +}; +pub use program::{Program, RunOutcome, RunningCall, SuspendError, Suspended, Suspender}; +pub use run::{Code, Compiled}; +pub use runtime::{ + Outcome, ProgramOptions, Run, Runtime, Translate, TranslateFunctions, TranslatePromises, +}; +pub use serde_json::Value as Json; +pub use snapshot::{Snapshot, SnapshotError, from_bytes, to_bytes}; +pub use streaming::{HttpBody, StreamingResponse}; + +/// The names bound in every program before its host globals, the reference's `globalNames`. +pub fn global_names() -> &'static [&'static str] { + host::GLOBAL_NAMES +} diff --git a/packages/codemode-rust/crates/psychoscript/src/native.rs b/packages/codemode-rust/crates/psychoscript/src/native.rs new file mode 100644 index 0000000000000..9e52a198e1354 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/native.rs @@ -0,0 +1,771 @@ +//! Native frames: built-ins that call back into the program, run by the dispatch loop like bytecode. +//! +//! A built-in that calls a callback (`Array.prototype.map`), a conversion method or a promise handler does not call it +//! from Rust. It checks its arguments, then pushes a native frame (`Vm::enter_native`) holding its state in the frame's +//! slots, as a bytecode frame holds its locals: the callback, the index, the accumulator. The dispatch loop runs the +//! built-in's step function whenever the frame is on top, instead of code. A step either asks for a call, whose frame the +//! loop pushes above it as a call from bytecode, or finishes with the built-in's result, which the caller receives as +//! a native's. When the called frame returns, the step function runs again with its value; when it throws past a +//! handler the step pushed, with what it threw. +//! +//! No Rust frame waits on a callback, so a native frame parks for a host call's wait, suspends and snapshots like any +//! other: a snapshot saves its slots with the stack and its step function by `NativeOp`. + +use crate::bytecode::{FuncProto, Op}; + +/// Where a native frame continues, as its `pc`: with the value a call returned, with what a call threw (the `pc` of +/// the handlers it pushes), or from the start. +pub const RETURNED: usize = 0; +pub const THREW: usize = 1; +pub const START: usize = 2; +/// With the completion value of a generator it resumed (`Vm::native_resume`). +pub const FINISHED: usize = 3; +use crate::value::{Slot, Value}; +use crate::vm::{Res, Vm}; + +/// The step function a native frame runs, saved by its number in snapshots. +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +#[repr(u16)] +pub enum NativeOp { + /// The callback methods of arrays that visit each index (`forEach`, `map`, `filter`, `some`, `every`, the find + /// methods): see `builtins::array::each_step`. + ArrayEach, + /// `reduce` and `reduceRight`. + ArrayReduce, + /// A sort with a comparator. + SortWith, + /// `Array.from` over an iterable. + ArrayFromIterable, + /// `new Map(iterable)` and `new Set(iterable)`. + FillCollection, + /// A promise handler, a `finally` cleanup, a thenable job, an executor or a `Promise.try` callback. + Settle, + /// A callback called on a list of arguments fixed when it starts (see `enter_call_list`). + CallList, + /// `Map.prototype.forEach` and `Set.prototype.forEach`. + MapForEach, + /// `Array.prototype.flatMap`. + FlatMap, + /// `Array.from` over an array-like value, with a mapper. + ArrayFromLike, + /// `Array.prototype.toLocaleString`. + ToLocaleString, + /// `Object.groupBy` and `Map.groupBy`. + GroupBy, + /// `replace` and `replaceAll` with a callback. + ReplaceWith, + /// `forEach`, `some`, `every`, `find`, `toArray` and `reduce` of `Iterator.prototype`. + IterConsume, + /// `JSON.parse` with a reviver. + Revive, + /// `Function.prototype.call` and `apply`. + Invoke, + /// The steps of a family of built-ins, by the frame's sub-op, each in the family's own file: `Uint8Array` and + /// arrays (`builtins::bytes::family_step`), iterators (`builtins::iterator::family_step`), collections + /// (`builtins::sets::family_step`), and other callbacks: JSON, crossings, strings, web + /// (`builtins::object::family_step`). A family numbers its own steps and keeps each number once a snapshot may + /// hold it. Push one with `Vm::enter_native_sub`. + Arrays, + Iterators, + Collections, + Callbacks, + /// Iteration in bytecode over an iterator the VM does not step itself, by sub-op (see `iteration.rs`). + Iteration, + /// A conversion that calls the program, by sub-op (see `conversion.rs`). + Convert, +} + +const OPS: [NativeOp; 22] = [ + NativeOp::ArrayEach, + NativeOp::ArrayReduce, + NativeOp::SortWith, + NativeOp::ArrayFromIterable, + NativeOp::FillCollection, + NativeOp::Settle, + NativeOp::CallList, + NativeOp::MapForEach, + NativeOp::FlatMap, + NativeOp::ArrayFromLike, + NativeOp::ToLocaleString, + NativeOp::GroupBy, + NativeOp::ReplaceWith, + NativeOp::IterConsume, + NativeOp::Revive, + NativeOp::Invoke, + NativeOp::Arrays, + NativeOp::Iterators, + NativeOp::Collections, + NativeOp::Callbacks, + NativeOp::Iteration, + NativeOp::Convert, +]; + +impl NativeOp { + pub fn code(self) -> u16 { + self as u16 + } + + pub fn from_code(code: u16) -> Option { + OPS.get(code as usize).copied() + } +} + +/// What a native frame continues with. +pub enum Input { + /// It was just pushed. + Start, + /// The call it asked for returned this. + Returned(Slot), + /// The call it asked for threw this, which a handler it pushed (`catching`) caught. + Threw(Value), + /// The generator it resumed finished with this. + Finished(Slot), +} + +/// What a step asks of the loop. +pub enum Step { + /// Call the callee pushed above the frame's slots, with its receiver and this many arguments (see `call`). + Call(usize), + /// The frame of the call was pushed already. + Pushed, + /// Finished without a result for the caller, whose frame the step has updated (see `iteration.rs`). + DoneEmpty, + /// `Call`, as native code calls: a native costs no fifty. + CallUncounted(usize), + /// `Call`, as the reference enters a promise handler (`enterSettlingCall`): a plain function's frame and a + /// promise's resolve function for nothing, anything else as bytecode calls it. + CallSettling(usize), + /// The built-in's result: the frame is popped and its caller receives this. + Done(Value), +} + +/// The code of every native frame, which never runs: one instruction for each place it continues from. +pub fn proto() -> FuncProto { + FuncProto { + name: 0, + code: vec![Op::Nop; 4], + pos: Vec::new(), + nparams: 0, + length: 0, + nlocals: 0, + captures: Vec::new(), + is_async: false, + is_generator: false, + is_arrow: false, + is_program: false, + class: 0, + home: false, + needs_extra: false, + callees: Vec::new(), + sites: Vec::new(), + } +} + +pub fn step(vm: &mut Vm, op: NativeOp, sub: u16, base: usize, input: Input) -> Result { + let frame = Frame(base); + match op { + NativeOp::ArrayEach => crate::builtins::array::each_step(vm, frame, input), + NativeOp::ArrayReduce => crate::builtins::array::reduce_step(vm, frame, input), + NativeOp::SortWith => crate::builtins::array::sort_step(vm, frame, input), + NativeOp::ArrayFromIterable => { + for_of_step::(vm, frame, input) + } + NativeOp::FillCollection => { + for_of_step::(vm, frame, input) + } + NativeOp::Settle => crate::promise::settle_step(vm, frame, input), + NativeOp::CallList => call_list_step(vm, frame, input), + NativeOp::MapForEach => crate::builtins::collections::map_for_each_step(vm, frame, input), + NativeOp::FlatMap => crate::builtins::array::flat_map_step(vm, frame, input), + NativeOp::ArrayFromLike => crate::builtins::array::from_like_step(vm, frame, input), + NativeOp::ToLocaleString => crate::builtins::array::to_locale_string_step(vm, frame, input), + NativeOp::GroupBy => for_of_step::(vm, frame, input), + NativeOp::ReplaceWith => crate::builtins::string::replace_with_step(vm, frame, input), + NativeOp::IterConsume => { + for_of_step::(vm, frame, input) + } + NativeOp::Revive => crate::builtins::object::revive_step(vm, frame, input), + NativeOp::Invoke => crate::builtins::object::invoke_step(vm, frame, input), + NativeOp::Arrays => crate::builtins::bytes::family_step(vm, sub, frame, input), + NativeOp::Iterators => crate::builtins::iterator::family_step(vm, sub, frame, input), + NativeOp::Collections => crate::builtins::sets::family_step(vm, sub, frame, input), + NativeOp::Callbacks => crate::builtins::object::family_step(vm, sub, frame, input), + NativeOp::Iteration => crate::iteration::step(vm, sub, frame, input), + NativeOp::Convert => crate::conversion::step(vm, sub, frame, input), + } +} + +/// A native frame's slots, by index: what the built-in passed to `enter_native`, then anything it keeps. +#[derive(Clone, Copy)] +pub struct Frame(usize); + +impl Frame { + #[inline] + pub fn get(self, vm: &Vm, k: usize) -> Value { + vm.stack[self.0 + k].get() + } + + /// Where the frame's slots start on the stack. + #[inline(always)] + pub fn base(self) -> usize { + self.0 + } + + #[inline(always)] + pub fn slot(self, vm: &Vm, k: usize) -> Slot { + vm.stack[self.0 + k] + } + + #[inline(always)] + pub fn set_slot(self, vm: &mut Vm, k: usize, s: Slot) { + vm.stack[self.0 + k] = s; + } + + /// A slot holding an index or a count. + #[inline(always)] + pub fn index(self, vm: &Vm, k: usize) -> usize { + vm.stack[self.0 + k].f() as usize + } + + #[inline(always)] + pub fn set_index(self, vm: &mut Vm, k: usize, i: usize) { + vm.stack[self.0 + k] = Slot::index(i); + } + + /// The built-in the frame runs for (or what a frame no built-in made keeps there). + #[inline(always)] + pub fn callee(self, vm: &Vm) -> Slot { + vm.stack[self.0 - 2] + } + + /// The receiver the built-in was called on. + #[inline(always)] + pub fn this_slot(self, vm: &Vm) -> Slot { + vm.stack[self.0 - 1] + } + + /// Calls `f` with `this` and `args`, as a call instruction would; the frame's next step receives the result. + #[inline(always)] + pub fn call_slots( + self, + vm: &mut Vm, + f: Slot, + this: Slot, + args: [Slot; N], + ) -> Result { + vm.stack.extend_from_slice(&[f, this]); + vm.stack.extend_from_slice(&args); + vm.native_call(N) + } + + /// `call_slots` with another kind of call (`Step::CallUncounted`, `Step::CallSettling`). + pub fn call_slots_as( + self, + vm: &mut Vm, + f: Slot, + this: Slot, + args: [Slot; N], + mode: fn(usize) -> Step, + ) -> Result { + vm.stack.extend_from_slice(&[f, this]); + vm.stack.extend_from_slice(&args); + Ok(mode(N)) + } + + /// `call_slots`, with what the call throws coming back to this frame as `Input::Threw`. + pub fn catching( + self, + vm: &mut Vm, + f: Slot, + this: Slot, + args: [Slot; N], + ) -> Result { + let sp = (vm.stack.len() - self.0) as u32; + vm.handlers_mut().push(crate::vm::Handler { + pc: THREW as u32, + sp, + }); + self.call_slots(vm, f, this, args) + } + + /// A call of `f` with any number of arguments, of the kind `mode` asks for, with what it throws coming back to this + /// frame as `Input::Threw`. + pub fn catching_list( + self, + vm: &mut Vm, + f: Slot, + this: Slot, + args: &[Slot], + mode: fn(usize) -> Step, + ) -> Step { + let sp = (vm.stack.len() - self.0) as u32; + vm.handlers_mut().push(crate::vm::Handler { + pc: THREW as u32, + sp, + }); + vm.stack.extend_from_slice(&[f, this]); + vm.stack.extend_from_slice(args); + mode(args.len()) + } + + #[inline(always)] + pub fn set(self, vm: &mut Vm, k: usize, v: Value) { + vm.stack[self.0 + k] = Slot::pack(v); + } +} + +/// A built-in that iterates a value as the reference's prelude does with `for...of` (see `fuel::for_of`): opened as +/// the reference opens it, stepped one value at a time, closed when the built-in stops early or its body throws. +/// Its frame's first `FOR_OF_SLOTS` slots are the loop's; its own follow. +pub trait ForOf { + /// One value from the iterator. + fn item(vm: &mut Vm, fr: Frame, x: Value) -> Result; + /// The result of the call `item` or `returned` asked for with `Flow::Call`. + fn returned(_vm: &mut Vm, _fr: Frame, _r: Slot) -> Result { + Ok(Flow::Next) + } + /// The built-in's result once the iterator is done. + fn finish(vm: &mut Vm, fr: Frame) -> Res; + /// The body stopped the loop (`Flow::Stop`) and the iterator closed. + fn stopped(_vm: &mut Vm) {} + /// What the frame does once the iterator is done: by default it finishes with `finish`. A built-in with work + /// left that calls the program (a mapper over what it collected) may call instead: its next step then goes to + /// `after`. + fn done(vm: &mut Vm, fr: Frame) -> Result { + Ok(Step::Done(Self::finish(vm, fr)?)) + } + /// A step after `done` called. + fn after(_vm: &mut Vm, _fr: Frame, _input: Input) -> Result { + Ok(Step::Done(Value::Undef)) + } +} + +/// What a `ForOf` body does next. +pub enum Flow { + /// Go on to the next value (after a back-edge). + Next, + /// Close the iterator, then finish with this. + Stop(Value), + /// The body called `Frame::catching` and waits for its result (`ForOf::returned`); a throw closes the iterator. + Call(Step), +} + +const LOOP_SOURCE: usize = 0; +const LOOP_IT: usize = 1; +const LOOP_NEXT: usize = 2; +const LOOP_PHASE: usize = 3; +/// Opening: the fuel the open costs once the method returned. Closing: the error to throw once closed, or the result. +const LOOP_STASH: usize = 4; +pub const FOR_OF_SLOTS: usize = 5; + +/// Where a loop is: what the call it waits on, if any, is for. +const OPENING: usize = 0; +const STEPPING: usize = 1; +const BODY: usize = 2; +const CLOSING: usize = 3; +const CLOSING_THROW: usize = 4; +const STEP: usize = 5; +const START_LOOP: usize = 6; +/// The iterator is done and the built-in's own work goes on (`ForOf::after`). +const AFTER: usize = 7; + +/// Pushes a `ForOf` frame over `source`, with the built-in's own slots after the loop's. +pub fn enter_for_of( + vm: &mut Vm, + op: NativeOp, + callee: crate::value::Id, + this: Value, + source: Value, + own: &[Value], +) -> Res { + enter_for_of_sub(vm, op, 0, callee, this, source, own) +} + +/// `enter_for_of` for one of a family's steps (see `NativeOp::Arrays`). +pub fn enter_for_of_sub( + vm: &mut Vm, + op: NativeOp, + sub: u16, + callee: crate::value::Id, + this: Value, + source: Value, + own: &[Value], +) -> Res { + let mut slots = vec![ + source, + Value::Undef, + Value::Undef, + Value::Num(START_LOOP as f64), + Value::Undef, + ]; + slots.extend_from_slice(own); + vm.enter_native_sub(op, sub, callee, this, &slots) +} + +/// Pushes a `ForOf` frame over an iterator record already open: `next` is the method to call, or undefined to step +/// the iterator as the reference steps its own. +#[allow(clippy::too_many_arguments)] +pub fn enter_for_of_record( + vm: &mut Vm, + op: NativeOp, + callee: crate::value::Id, + this: Value, + it: Value, + next: Value, + own: &[Value], +) -> Res { + enter_for_of_record_sub(vm, op, 0, callee, this, it, next, own) +} + +/// `enter_for_of_record` for one of a family's steps (see `NativeOp::Arrays`). +#[allow(clippy::too_many_arguments)] +pub fn enter_for_of_record_sub( + vm: &mut Vm, + op: NativeOp, + sub: u16, + callee: crate::value::Id, + this: Value, + it: Value, + next: Value, + own: &[Value], +) -> Res { + let mut slots = vec![ + Value::Undef, + it, + next, + Value::Num(STEP as f64), + Value::Undef, + ]; + slots.extend_from_slice(own); + vm.enter_native_sub(op, sub, callee, this, &slots) +} + +/// The step of a `ForOf` frame. +pub fn for_of_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + let mut phase = fr.index(vm, LOOP_PHASE); + if phase == AFTER { + return C::after(vm, fr, input); + } + let mut flow = None; + match input { + Input::Start => {} + Input::Returned(r) => match phase { + OPENING => { + let it = r.get(); + let Value::Obj(id) = it else { + return Err(vm.type_error("Iterator method result must be an object.")); + }; + let nk = vm.names.next; + let next = vm.get_calling(id, nk)?; + if !vm.is_callable(&next) { + return Err(vm.type_error("Iterator next must be a function.")); + } + let open = fr.index(vm, LOOP_STASH) as i32; + vm.fuel(open); + let source = fr.get(vm, LOOP_SOURCE); + let next = vm.record_next_read(&source, &it, next)?; + fr.set(vm, LOOP_IT, it); + fr.set(vm, LOOP_NEXT, next); + phase = STEP; + } + STEPPING => { + let Some(rid) = r.obj() else { + return Err(vm.type_error("Iterator next() result must be an object.")); + }; + let (dk, vk) = (vm.names.done, vm.names.value); + let d = vm.get_calling(rid, dk)?; + if vm.truthy(&d) { + return loop_done::(vm, fr); + } + let v = vm.get_calling(rid, vk)?; + flow = Some(body::(vm, fr, |vm, fr| C::item(vm, fr, v))); + } + // A generator yielded. + STEP => flow = Some(body::(vm, fr, |vm, fr| C::item(vm, fr, r.get()))), + BODY => flow = Some(body::(vm, fr, |vm, fr| C::returned(vm, fr, r))), + CLOSING => return close_done::(vm, fr, Some(r)), + _ => return close_done::(vm, fr, None), + }, + Input::Finished(_) => match phase { + STEP => return loop_done::(vm, fr), + _ => return close_done::(vm, fr, None), + }, + Input::Threw(e) => match phase { + BODY => return close::(vm, fr, Err(e)), + // A close after the loop stopped throws what closing threw, before its fuel. + CLOSING => return Err(e), + // A failing close of a loop that threw keeps the loop's error. + _ => return close_done::(vm, fr, None), + }, + } + if phase == START_LOOP { + let source = fr.get(vm, LOOP_SOURCE); + let open = vm.open_fuel(&source, crate::bytecode::ITER_FOR_OF); + let method = match source { + Value::Obj(id) if !vm.walks(&source) && !is_builtin_iterator(vm, id) => { + vm.get_calling(id, crate::object::SYM_ITERATOR)? + } + _ => Value::Undef, + }; + if method.is_nullish() { + let it = vm.get_iterator(&source)?; + vm.fuel(open); + let next = vm.record_next_of(&source, &it)?; + fr.set(vm, LOOP_IT, it); + fr.set(vm, LOOP_NEXT, next); + } else { + if !vm.is_callable(&method) { + return Err(vm.type_error("Iterator method must be a function.")); + } + fr.set_index(vm, LOOP_STASH, open as usize); + fr.set_index(vm, LOOP_PHASE, OPENING); + return fr.call_slots_as( + vm, + Slot::pack(method), + Slot::pack(source), + [], + Step::CallUncounted, + ); + } + } + loop { + match flow.take() { + None => {} + Some(Err(e)) => return close::(vm, fr, Err(e)), + Some(Ok(Flow::Next)) => crate::builtins::fuel::step(vm), + Some(Ok(Flow::Stop(v))) => return close::(vm, fr, Ok(v)), + Some(Ok(Flow::Call(step))) => { + fr.set_index(vm, LOOP_PHASE, BODY); + return Ok(step); + } + } + // The next value. + let (it, next) = (fr.get(vm, LOOP_IT), fr.get(vm, LOOP_NEXT)); + let Value::Obj(id) = it else { + return loop_done::(vm, fr); + }; + let direct = next.is_nullish(); + let kind = &vm.heap[id as usize].kind; + use crate::object::Kind; + let stepped = match kind { + Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } + if direct => + { + None + } + Kind::Generator(_) => { + fr.set_index(vm, LOOP_PHASE, STEP); + match vm.native_resume(id, 0, Value::Undef)? { + None => return Ok(Step::Pushed), + Some((_, true)) => return loop_done::(vm, fr), + Some((v, false)) => Some(v), + } + } + _ => { + let uncounted = match kind { + Kind::IterHelper(_) => true, + Kind::ExoticIter { .. } => direct, + _ => false, + }; + let f = if direct { + let nk = vm.names.next; + vm.get_calling(id, nk)? + } else { + next + }; + fr.set_index(vm, LOOP_PHASE, STEPPING); + let mode = if uncounted { + Step::CallUncounted + } else { + Step::Call + }; + return fr.call_slots_as(vm, Slot::pack(f), Slot::pack(it), [], mode); + } + }; + let x = match stepped { + Some(v) => v, + None => match vm.iter_step_with(&it, next)? { + Some(v) => v, + None => return loop_done::(vm, fr), + }, + }; + flow = Some(body::(vm, fr, |vm, fr| C::item(vm, fr, x))); + } +} + +/// The iterator is done: the built-in finishes, or goes on to work of its own (`ForOf::done`). +fn loop_done(vm: &mut Vm, fr: Frame) -> Result { + fr.set_index(vm, LOOP_PHASE, AFTER); + C::done(vm, fr) +} + +/// Runs a body hook, closing the iterator if it fails before calling anything. +fn body( + vm: &mut Vm, + fr: Frame, + f: impl FnOnce(&mut Vm, Frame) -> Result, +) -> Result { + fr.set_index(vm, LOOP_PHASE, BODY); + f(vm, fr) +} + +fn is_builtin_iterator(vm: &Vm, id: crate::value::Id) -> bool { + use crate::object::Kind; + matches!( + vm.heap[id as usize].kind, + Kind::Generator(_) + | Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } + | Kind::Arguments(_) + ) +} + +/// Closes the loop's iterator: after the loop stopped with `Ok(result)`, or threw `Err(error)` (unless fatal). +fn close(vm: &mut Vm, fr: Frame, outcome: Result) -> Result { + if let Err(e) = &outcome + && vm.fatal.is_some() + { + return Err(*e); + } + let throwing = outcome.is_err(); + let stash = match outcome { + Ok(v) | Err(v) => v, + }; + fr.set(vm, LOOP_STASH, stash); + fr.set_index( + vm, + LOOP_PHASE, + if throwing { CLOSING_THROW } else { CLOSING }, + ); + let it = fr.get(vm, LOOP_IT); + let Value::Obj(id) = it else { + return close_done::(vm, fr, None); + }; + use crate::object::{GenState, Kind}; + match &vm.heap[id as usize].kind { + Kind::Generator(GenState::Suspended(_)) => { + // What closing throws comes back to the frame (see `Vm::native_resume`). + let sp = (vm.stack.len() - fr.0) as u32; + vm.handlers_mut().push(crate::vm::Handler { + pc: THREW as u32, + sp, + }); + match vm.native_resume(id, 1, Value::Undef) { + Ok(None) => Ok(Step::Pushed), + Ok(Some(_)) => close_done::(vm, fr, None), + Err(_) if throwing => close_done::(vm, fr, None), + Err(e) => Err(e), + } + } + Kind::Generator(_) + | Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } => close_done::(vm, fr, None), + _ => { + let rk = vm.names.return_; + let f = vm.get_calling(id, rk)?; + if f.is_nullish() { + return close_done::(vm, fr, None); + } + if !vm.is_callable(&f) { + if throwing { + return close_done::(vm, fr, None); + } + return Err(vm.type_error("Iterator return must be a function.")); + } + if throwing { + let sp = (vm.stack.len() - fr.0) as u32; + vm.handlers_mut().push(crate::vm::Handler { + pc: THREW as u32, + sp, + }); + } + fr.call_slots_as(vm, Slot::pack(f), Slot::pack(it), [], Step::CallUncounted) + } + } +} + +/// The iterator closed (`result` is what its `return()` returned, when it was called): spends the close's fuel, then +/// throws the loop's error or finishes with its result. +fn close_done(vm: &mut Vm, fr: Frame, result: Option) -> Result { + let throwing = fr.index(vm, LOOP_PHASE) == CLOSING_THROW; + if !throwing + && let Some(r) = result + && r.obj().is_none() + { + return Err(vm.type_error("Iterator return() result must be an object.")); + } + let it = fr.get(vm, LOOP_IT); + let cost = vm.close_fuel(&it); + vm.fuel(cost); + let stash = fr.get(vm, LOOP_STASH); + if throwing { + return Err(stash); + } + C::stopped(vm); + Ok(Step::Done(stash)) +} + +// The slots of a `CallList` frame: the callback, its receiver, the result, how many calls, the next one, and how many +// arguments each takes; then the arguments of every call. +const LIST_F: usize = 0; +const LIST_THIS: usize = 1; +const LIST_RESULT: usize = 2; +const LIST_N: usize = 3; +const LIST_K: usize = 4; +const LIST_ARITY: usize = 5; +const LIST_ARGS: usize = 6; + +/// Pushes a frame that calls `f` once per entry of `calls`, each `arity` arguments, as a counted call with a back-edge +/// after it, as the prelude loops over a list do; it ends as a bytecode built-in's call with `result`. +pub fn enter_call_list( + vm: &mut Vm, + callee: crate::value::Id, + f: Value, + this_arg: Value, + arity: usize, + calls: Vec, + result: Value, +) -> Res { + let n = calls.len() / arity.max(1); + let mut slots = vec![ + f, + this_arg, + result, + Value::Num(n as f64), + Value::Num(0.0), + Value::Num(arity as f64), + ]; + slots.extend(calls); + vm.enter_native(NativeOp::CallList, callee, Value::Undef, &slots) +} + +fn call_list_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + let mut k = fr.index(vm, LIST_K); + match input { + Input::Returned(_) => { + crate::builtins::fuel::step(vm); + k += 1; + fr.set_index(vm, LIST_K, k); + } + Input::Threw(e) => return Err(e), + Input::Start | Input::Finished(_) => {} + } + if k >= fr.index(vm, LIST_N) { + vm.bytecode_builtin(); + return Ok(Step::Done(fr.get(vm, LIST_RESULT))); + } + let arity = fr.index(vm, LIST_ARITY); + let at = fr.base() + LIST_ARGS + k * arity; + let args: Vec = vm.stack[at..at + arity].to_vec(); + let (f, this) = (fr.slot(vm, LIST_F), fr.slot(vm, LIST_THIS)); + vm.stack.extend_from_slice(&[f, this]); + vm.stack.extend_from_slice(&args); + vm.native_call(arity) +} diff --git a/packages/codemode-rust/crates/psychoscript/src/nesting.rs b/packages/codemode-rust/crates/psychoscript/src/nesting.rs new file mode 100644 index 0000000000000..a6bf669ef5897 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/nesting.rs @@ -0,0 +1,664 @@ +//! A cheap upper bound on how deeply a program's syntax nests, read from its bytes without parsing. Parsing and +//! compiling recurse once per level of syntax, and the parser has no guard of its own: a bound that came out too low +//! could overflow the native stack, which aborts the process. So the bound is conservative by construction: wherever +//! the scan cannot tell how the parser reads the source, it takes a reading that can only count more. +//! +//! Within one bracket group, a path through the syntax tree passes at most one node per token of the statement or +//! list item it is in, so the bound adds the tokens of the longest item in each group along the deepest chain of +//! groups. `;`, `,` and line breaks where a statement cannot continue end an item. `else` and `do` chain statements +//! across semicolons, so they count for the whole group. +//! +//! The only doubt in reading JavaScript without parsing it is whether a `/` starts a regular expression or divides. +//! Each `/` is a regex, a division, or either, by the token before it. From a `/` that may be either, the rest of the +//! line is counted raw: every non-blank byte is a token, every opening bracket opens a group, and closing brackets +//! close nothing. No reading of that line can nest deeper than that, and the readings agree again at the line's end, +//! unless the line can start something that spans lines (a template, a block comment, a string continued with a +//! backslash); then, as after source the parser cannot tokenize, everything to the end counts raw. + +/// The bound for `code`: never less than its deepest syntax nesting, close to it for ordinary programs. +pub fn bound(code: &str) -> usize { + let mut scan = Scan { + src: code.as_bytes(), + at: 0, + frames: vec![Frame::new(b'\0', false)], + prev: START, + newline: false, + control: false, + dot: false, + }; + scan.run(); + let mut child = 0; + while let Some(mut frame) = scan.frames.pop() { + frame.child = frame.child.max(child); + child = frame.close(); + } + child +} + +struct Frame { + /// The bracket that opened the group, `$` for a template substitution. + open: u8, + /// Tokens of the current item, and the deepest group nested in it. + tokens: usize, + child: usize, + /// The deepest item closed so far. + best: usize, + /// `else` and `do` seen anywhere in the group. + chained: usize, + /// Parentheses holding an `if`, `for`, `while` or `with` head: a statement follows. + control: bool, +} + +impl Frame { + fn new(open: u8, control: bool) -> Self { + Self { + open, + tokens: 0, + child: 0, + best: 0, + chained: 0, + control, + } + } + + fn end_item(&mut self) { + self.best = self.best.max(self.tokens + self.child); + self.tokens = 0; + self.child = 0; + } + + fn close(&mut self) -> usize { + self.end_item(); + 1 + self.best + self.chained + } +} + +/// How a `/` after a token reads. +#[derive(Clone, Copy, PartialEq)] +enum Slash { + Regex, + Division, + Either, +} + +/// What the previous token tells the scan: how a `/` after it reads, and whether a line break after it may end a +/// statement before a token that starts one. +#[derive(Clone, Copy, PartialEq)] +struct Prev { + slash: Slash, + ends: bool, +} + +/// The start, an operator, an opening bracket, a separator, or a keyword an expression follows. +const START: Prev = Prev { + slash: Slash::Regex, + ends: false, +}; +const OPERATOR: Prev = START; +/// The closing parenthesis of a control head: a statement follows. +const CONTROL_HEAD: Prev = START; +/// A name, literal, `)` or `]`. +const VALUE: Prev = Prev { + slash: Slash::Division, + ends: true, +}; +/// A name a line break may not end, such as `get` before a method name. +const PREFIX: Prev = Prev { + slash: Slash::Division, + ends: false, +}; +/// A `}`, which ends a block (a regex may follow) or an object (a division may). +const BRACE: Prev = Prev { + slash: Slash::Either, + ends: true, +}; +/// A token the scan cannot place: `++`, `--`, a name that may be a keyword, a byte outside ASCII, or the end of a +/// line counted raw. +const EITHER: Prev = Prev { + slash: Slash::Either, + ends: false, +}; + +struct Scan<'a> { + src: &'a [u8], + at: usize, + frames: Vec, + prev: Prev, + /// A line break since the previous token. + newline: bool, + /// The previous token was `if`, `for`, `while` or `with`. + control: bool, + /// The previous token was a `.` of member access: a keyword after it is a property name. + dot: bool, +} + +impl Scan<'_> { + fn run(&mut self) { + if self.src.starts_with(b"#!") { + self.raw(false); + } + while let Some(&b) = self.src.get(self.at) { + match b { + b'\n' | b'\r' => { + self.newline = true; + self.at += 1; + } + 0xe2 if line_separator(self.src, self.at) => { + self.newline = true; + self.at += 3; + } + b' ' | b'\t' | 0x0b | 0x0c => self.at += 1, + b'/' if self.peek(1) == Some(b'/') => self.at = line_end(self.src, self.at), + b'/' if self.peek(1) == Some(b'*') => { + let rest = &self.src[self.at + 2..]; + let len = rest.windows(2).position(|w| w == b"*/"); + let body = &rest[..len.unwrap_or(rest.len())]; + self.newline |= line_end(body, 0) < body.len(); + self.at += 2 + len.map_or(rest.len(), |n| n + 2); + } + // An HTML-like comment in a script, an operator in a module: counted raw, either way. + b'<' if self.src[self.at..].starts_with(b"") + && (self.newline || self.prev == START) => + { + self.raw(false) + } + b'(' | b'[' | b'{' => { + self.token(false); + let control = b == b'(' && self.control; + self.frames.push(Frame::new(b, control)); + self.after(OPERATOR); + self.at += 1; + } + b')' | b']' | b'}' => { + self.at += 1; + self.close(b); + } + b';' | b',' => { + self.top().end_item(); + self.after(OPERATOR); + self.at += 1; + } + b'\'' | b'"' => { + let start = self.at; + self.token(true); + if !self.string(b) { + self.at = start; + return self.raw(true); + } + self.after(VALUE); + } + b'`' => { + self.token(false); + self.at += 1; + self.template(); + } + b'/' => match self.prev.slash { + Slash::Regex => { + let start = self.at; + self.token(false); + if !self.regex() { + self.at = start; + return self.raw(true); + } + self.after(VALUE); + } + Slash::Division => { + self.token(false); + self.after(OPERATOR); + self.at += 1; + } + Slash::Either => self.raw(false), + }, + b'0'..=b'9' => { + self.token(true); + self.number(); + self.after(VALUE); + } + b'.' if self.peek(1).is_some_and(|c| c.is_ascii_digit()) => { + self.token(true); + self.number(); + self.after(VALUE); + } + _ if is_name(b) => self.word(), + b'.' => { + self.token(false); + let spread = self.peek(1) == Some(b'.') + || (self.at > 0 && self.src[self.at - 1] == b'.'); + self.after(OPERATOR); + self.dot = !spread; + self.at += 1; + } + // `++` and `--` may be postfix, after which a `/` divides, or prefix, after which it may not. + b'+' | b'-' => { + self.token(false); + let doubled = self.at > 0 && self.src[self.at - 1] == b; + self.after(if doubled { EITHER } else { OPERATOR }); + self.at += 1; + } + // Outside ASCII a byte may be part of a name or a space; a backslash starts an escaped name. + _ if b >= 0x80 || b == b'\\' => { + self.token(false); + self.after(EITHER); + self.at += 1; + } + // Every other character is an operator or part of one; counting each keeps `!!x` and `~~x` deep. + _ => { + self.token(false); + self.after(OPERATOR); + self.at += 1; + } + } + } + } + + fn peek(&self, n: usize) -> Option { + self.src.get(self.at + n).copied() + } + + fn top(&mut self) -> &mut Frame { + self.frames + .last_mut() + .expect("the program's own frame stays") + } + + /// Counts a token in the current item, first ending the item when a line break before it ends a statement. + fn token(&mut self, starts_statement: bool) { + if self.newline && starts_statement && self.prev.ends { + self.top().end_item(); + } + self.newline = false; + self.top().tokens += 1; + } + + fn after(&mut self, prev: Prev) { + self.prev = prev; + self.control = false; + self.dot = false; + } + + /// Counts from here to the end of the line, or of the source, without telling code from text: every non-blank + /// byte is a token and every opening bracket opens a group that only a later closer outside the raw span closes. + fn raw(&mut self, to_end: bool) { + let line = line_end(self.src, self.at); + let spans_lines = { + let rest = &self.src[self.at..line]; + rest.contains(&b'`') + || rest.windows(2).any(|w| w == b"/*") + || rest.last() == Some(&b'\\') + }; + let end = if to_end || spans_lines { + self.src.len() + } else { + line + }; + self.newline = false; + for i in self.at..end { + let b = self.src[i]; + if b.is_ascii_whitespace() { + continue; + } + self.top().tokens += 1; + if matches!(b, b'(' | b'[' | b'{') { + self.frames.push(Frame::new(b, false)); + } + } + self.at = end; + self.after(EITHER); + } + + fn close(&mut self, b: u8) { + let open = match b { + b')' => b'(', + b']' => b'[', + _ => b'{', + }; + // A closer that does not match is counted, not obeyed: popping on it could only lower the bound. + let top = self.top().open; + if self.frames.len() == 1 || (top != open && !(top == b'$' && b == b'}')) { + self.token(false); + self.after(EITHER); + return; + } + let mut frame = self.frames.pop().expect("checked above"); + let depth = frame.close(); + let parent = self.top(); + parent.child = parent.child.max(depth); + match frame.open { + b'$' => self.template(), + b'{' => self.after(BRACE), + _ if frame.control => self.after(CONTROL_HEAD), + _ => self.after(VALUE), + } + } + + fn word(&mut self) { + let start = self.at; + while self + .src + .get(self.at) + .is_some_and(|&c| is_name(c) || c.is_ascii_digit()) + { + self.at += 1; + } + let word = &self.src[start..self.at]; + let member = self.dot; + // Words that continue the statement before a line break. + let continues = !member + && matches!( + word, + b"in" | b"instanceof" | b"of" | b"else" | b"catch" | b"finally" | b"while" + ); + self.token(!continues); + if matches!(word, b"else" | b"do") { + self.top().chained += 1; + } + let prev = match word { + _ if member => VALUE, + b"this" | b"null" | b"true" | b"false" | b"super" => VALUE, + // Keywords in some places and names in others. + b"await" | b"yield" | b"of" | b"let" => EITHER, + b"get" | b"set" | b"static" | b"async" | b"accessor" => PREFIX, + _ if is_keyword(word) => OPERATOR, + _ => VALUE, + }; + let control = !member + && (matches!(word, b"if" | b"for" | b"while" | b"with") + || (self.control && word == b"await")); + self.after(prev); + self.control = control; + } + + /// Scans a string; false when it does not end on its line. + fn string(&mut self, quote: u8) -> bool { + self.at += 1; + while let Some(&c) = self.src.get(self.at) { + self.at += 1; + match c { + b'\\' if self.src[self.at..].starts_with(b"\r\n") => self.at += 2, + b'\\' => self.at += 1, + b'\n' | b'\r' => return false, + _ if c == quote => return true, + _ => {} + } + } + false + } + + /// Scans template text up to its end or its next substitution, which opens a group. + fn template(&mut self) { + while let Some(&c) = self.src.get(self.at) { + self.at += 1; + match c { + b'\\' => self.at += 1, + b'`' => { + self.after(VALUE); + return; + } + b'$' if self.src.get(self.at) == Some(&b'{') => { + self.at += 1; + self.frames.push(Frame::new(b'$', false)); + self.after(OPERATOR); + return; + } + _ => {} + } + } + } + + /// Scans a regex; false when it does not end on its line. + fn regex(&mut self) -> bool { + self.at += 1; + let mut class = false; + loop { + if self.at >= self.src.len() || matches!(self.src[self.at], b'\n' | b'\r') { + return false; + } + if line_separator(self.src, self.at) { + return false; + } + let c = self.src[self.at]; + self.at += 1; + match c { + b'\\' => { + let next = self.src.get(self.at); + if next.is_none_or(|&n| matches!(n, b'\n' | b'\r')) + || line_separator(self.src, self.at) + { + return false; + } + self.at += 1; + } + b'[' => class = true, + b']' => class = false, + b'/' if !class => break, + _ => {} + } + } + while self.src.get(self.at).is_some_and(|&c| is_name(c)) { + self.at += 1; + } + true + } + + fn number(&mut self) { + let hex = matches!(self.src.get(self.at + 1), Some(b'x' | b'X')); + while let Some(&c) = self.src.get(self.at) { + let exponent_sign = + !hex && matches!(c, b'+' | b'-') && matches!(self.src[self.at - 1], b'e' | b'E'); + if !(c.is_ascii_alphanumeric() || c == b'.' || c == b'_' || exponent_sign) { + return; + } + self.at += 1; + } + } +} + +fn is_name(b: u8) -> bool { + b.is_ascii_alphabetic() || b == b'_' || b == b'$' +} + +/// U+2028 or U+2029, which end a line as `\n` does. +fn line_separator(src: &[u8], at: usize) -> bool { + src[at..].starts_with(&[0xe2, 0x80, 0xa8]) || src[at..].starts_with(&[0xe2, 0x80, 0xa9]) +} + +/// Where the line holding `at` ends. +fn line_end(src: &[u8], at: usize) -> usize { + (at..src.len()) + .find(|&i| matches!(src[i], b'\n' | b'\r') || line_separator(src, i)) + .unwrap_or(src.len()) +} + +/// Words after which an expression, not an operator, comes next. +fn is_keyword(word: &[u8]) -> bool { + matches!( + word, + b"break" + | b"case" + | b"catch" + | b"class" + | b"const" + | b"continue" + | b"debugger" + | b"default" + | b"delete" + | b"do" + | b"else" + | b"export" + | b"extends" + | b"finally" + | b"for" + | b"function" + | b"if" + | b"import" + | b"in" + | b"instanceof" + | b"new" + | b"return" + | b"switch" + | b"throw" + | b"try" + | b"typeof" + | b"var" + | b"void" + | b"while" + | b"with" + ) +} + +#[cfg(test)] +mod tests { + use super::bound; + + #[test] + fn brackets_in_strings_comments_templates_and_regexes_do_not_count() { + assert_eq!(bound("return 1"), bound(r#"return ")))(((" // ((((("#)); + assert_eq!(bound("return 1"), bound("/* ((( */ return 1")); + assert_eq!(bound("return `${1}`"), bound("return `((( ${1} )))`")); + assert_eq!(bound("return 1"), bound(r"return /[)\]]((/g")); + } + + #[test] + fn grows_with_every_nesting_form() { + let forms: &[(&str, &str, &str)] = &[ + ("return ", "(", ")"), + ("return ", "[", "]"), + ("", "{", "}"), + ("return ", "!", ""), + ("return ", "- ", ""), + ("return ", "a ? 1 : ", "0"), + ("let a; return ", "a = ", "1"), + ("return ", "() => ", "1"), + ("return 1", " + 1", ""), + ("return o", ".a()", ""), + ("return ", "`${", "}`"), + ("let a = 1; ", "if (a) ", "a = 2"), + ("let a = 1; ", "if (a)\n", "a = 2"), + ("let a = 1; ", "if (a) a = 1; else ", "a = 2"), + ("let a = 1;\n", "if (a) a = 1\nelse ", "a = 2"), + ("", "do ", "x; while (a)"), + ("", "a: ", "x"), + ("return ", "function () { return ", " }"), + ]; + for (head, open, close) in forms { + let at = |n: usize| bound(&format!("{head}{}1{}", open.repeat(n), close.repeat(n))); + assert!( + at(200) - at(100) >= 100, + "{open:?} grows by {}", + at(200) - at(100) + ); + } + } + + #[test] + fn statements_on_their_own_lines_do_not_add_up() { + let line = + "if (event.type === \"x\") { const s = await tools.git.status(); return { s } }\n"; + let calls = "f(x)\nlet y = 1\nconsole.log(y)\n"; + assert!( + bound(&line.repeat(200)) < 30, + "{}", + bound(&line.repeat(200)) + ); + assert!( + bound(&calls.repeat(200)) < 30, + "{}", + bound(&calls.repeat(200)) + ); + assert!(bound(&"x = 1;".repeat(1000)) < 10); + } + + /// Stack bytes per repetition of each form, measured with `bench/examples/stack_probe.rs` (release, debug). + #[test] + fn covers_the_measured_stack_use() { + let measured: &[(&str, &str, &str, usize, usize)] = &[ + ("return ", "(", ")", 778, 3481), + ("return ", "[", "]", 819, 12574), + ("return ", "{a:", "}", 942, 13189), + ("", "{", "}", 942, 3031), + ("return ", "f(", ")", 1147, 14540), + ("return ", "() => ", "", 1475, 16261), + ("return ", "function () { return ", " }", 2171, 18472), + ("", "if (a) {} else ", "{}", 655, 2212), + ("", "if (a) ", "", 655, 2212), + ("return ", "!", "", 819, 12902), + ("return ", "a ? 1 : ", "0", 860, 11509), + ("return ", "a = ", "", 983, 17858), + ("return 1", " + 1", "", 819, 11509), + ("return o", ".a()", "", 983, 13475), + ("return ", "`${", "}`", 1761, 12247), + ("return ", "typeof ", "", 819, 12902), + ("return ", "void ", "", 819, 12902), + ("return ", "await ", "", 819, 11509), + ("return ", "new ", "()", 819, 11509), + ("return ", "- ", "", 819, 12861), + ("return ", "[...", "]", 860, 12574), + ("const ", "[", "]", 1270, 2294), + ("(", "{a:", "}", 1270, 4915), + ("return o", "?.a", "", 819, 11509), + ("", "while (a) ", "", 655, 3113), + ]; + for (head, open, close, release, debug) in measured { + let at = |n: usize| bound(&format!("{head}{}1{}", open.repeat(n), close.repeat(n))); + let per = (at(600) - at(200)) / 400; + let need = if cfg!(debug_assertions) { + debug + } else { + release + }; + assert!( + per * crate::run::COMPILE_STACK_PER_LEVEL >= *need, + "{open:?}: {per} per level" + ); + } + } + + /// Each source hides a group nested 400 deep from a scan that guessed wrong about a `/`, a line end, or a byte. + #[test] + fn no_reading_of_an_unclear_token_hides_nesting() { + let n = 400; + let d = format!("{}1{}", "(".repeat(n), ")".repeat(n)); + let typeofs = "typeof\u{a0}".repeat(n); + let cases = [ + format!("let a = 1, g = 1; a++ / {d} / g"), + format!("let a = 1, g = 1; a-- /{d}/ g"), + format!("function f(s) {{ if (s) {{}} /}}/.test(s); return {d} }}"), + format!("function f(s) {{ if (s) {{}} /))))/.test(s); return [{d}] }}"), + format!("const o = {{}} / {d} / 2"), + format!("let await = 1, g = 1; await / {d} / g"), + format!("let of = 1, g = 1; of / {d} / g"), + format!("const x = {{}}; x.return / {d} / 2"), + format!("let a = 1; a\u{a0}/ {d} /\u{a0}1"), + format!("return {typeofs}1"), + format!("x = 1 {d}"), + format!("// note\u{2028}{d}"), + format!("/* note */ {d}"), + format!("const s = 'unterminated\n{d}"), + format!("const r = /unterminated\n{d}"), + format!("let a = 1; a++ / `${{1}}\n${{{d}}}` / 1"), + format!("let a = 1; a++ / 1 /* ((( \n */ {d}"), + format!("let a = 1; x = a++ / 'x\\\n{d}'"), + ]; + for case in cases { + let b = bound(&case); + assert!(b >= n, "{} is bounded by {b}", &case[..case.len().min(70)]); + } + } + + #[test] + fn regexes_and_divisions_the_scan_is_sure_of_stay_cheap() { + let plain = bound("const r = /[(]+/g; const q = a / b / c; return r.test(q)"); + assert!(plain < 20, "{plain}"); + let after_block = bound("if (a) { b() }\nconst c = d / e"); + assert!(after_block < 20, "{after_block}"); + } + + #[test] + fn unmatched_closers_do_not_lower_the_bound() { + let deep = format!("return {}1{}", "(".repeat(300), ")".repeat(300)); + assert!(bound(&format!("{deep} ]]]}}}}")) >= bound(&deep)); + assert!(bound(&format!("]]]}}}} {deep}")) >= bound(&deep)); + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/object.rs b/packages/codemode-rust/crates/psychoscript/src/object.rs new file mode 100644 index 0000000000000..5f034baf29667 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/object.rs @@ -0,0 +1,774 @@ +//! Heap objects, property storage and the atom interner. + +use std::sync::Arc; + +use rustc_hash::FxHashMap; + +use crate::DiagnosticKind; +use crate::bytecode::FuncProto; +pub use crate::strings::{Atom, SYM_ASYNC_ITERATOR, SYM_ITERATOR}; +use crate::value::{Id, Value}; +use crate::vm::{NativeFn, SavedFrame}; + +pub const ENUMERABLE: u8 = 1; +pub const WRITABLE: u8 = 2; +pub const DEFAULT_FLAGS: u8 = ENUMERABLE | WRITABLE; +pub const HIDDEN: u8 = WRITABLE; +/// Not configurable, so `delete` refuses it: the reference's frozen built-in constants and prototypes. +pub const FIXED: u8 = 4; +/// An accessor property: its value is a `Kind::Accessor` object holding the getter and the setter. Its `WRITABLE` +/// bit means nothing. +pub const ACCESSOR: u8 = 8; + +#[derive(Clone)] +pub struct Prop { + pub key: Atom, + pub value: Value, + pub flags: u8, +} + +/// Insertion-ordered properties; small objects scan linearly, larger ones keep a hash index. +#[derive(Default, Clone)] +pub struct Props { + pub items: Vec, + index: Option>>, +} + +const INDEX_THRESHOLD: usize = 12; + +impl Props { + pub fn from_items(items: Vec) -> Self { + let mut props = Props::default(); + for p in items { + props.push_new(p.key, p.value, p.flags); + } + props + } + + #[inline] + pub fn find(&self, key: Atom) -> Option { + if let Some(idx) = &self.index { + return idx.get(&key).map(|i| *i as usize); + } + self.items.iter().position(|p| p.key == key) + } + + #[inline] + pub fn get(&self, key: Atom) -> Option<&Value> { + self.find(key).map(|i| &self.items[i].value) + } + + pub fn insert(&mut self, key: Atom, value: Value, flags: u8) { + if let Some(i) = self.find(key) { + self.items[i].value = value; + return; + } + self.push_new(key, value, flags); + } + + /// Appends a key known to be absent. + pub fn push_new(&mut self, key: Atom, value: Value, flags: u8) { + let i = self.items.len(); + self.items.push(Prop { key, value, flags }); + if let Some(idx) = &mut self.index { + idx.insert(key, i as u32); + } else if self.items.len() > INDEX_THRESHOLD { + let map = self + .items + .iter() + .enumerate() + .map(|(i, p)| (p.key, i as u32)) + .collect(); + self.index = Some(Box::new(map)); + } + } + + pub fn remove(&mut self, key: Atom) -> bool { + let Some(i) = self.find(key) else { + return false; + }; + self.items.remove(i); + if self.index.is_some() { + let map = self + .items + .iter() + .enumerate() + .map(|(i, p)| (p.key, i as u32)) + .collect(); + self.index = Some(Box::new(map)); + } + true + } + + pub fn len(&self) -> usize { + self.items.len() + } + + /// The property `key`, data or accessor. + #[inline] + pub fn prop(&self, key: Atom) -> Option<&Prop> { + self.find(key).map(|i| &self.items[i]) + } +} + +/// An accessor property's halves: a function, or undefined for a missing half. A native half is the companion of a +/// built-in's accessor (see `builtins::accessors`); anything else callable is a program function, which only program +/// code may call. +#[derive(Clone, Copy, Debug)] +pub struct Accessor { + pub get: Value, + pub set: Value, +} + +/// A path into a host namespace among the globals, as a small heap object: the path it was read from (`parent`) and +/// the name read (`name`); a namespace global itself has no parent, and its name is the global's label. Each read makes +/// a new one, as the reference's `HostNamespace` does; its whole path and label are built only when a call or a +/// message needs them (`Vm::ns_path`). +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct NsPath { + pub parent: u32, + pub name: crate::strings::Atom, +} + +impl NsPath { + /// The `parent` of a namespace global. + pub const ROOT: u32 = u32::MAX; + + pub fn is_root(&self) -> bool { + self.parent == Self::ROOT + } +} + +/// A namespace path spelled out: the global it is under, by its label's atom, and the names below it. +pub struct NsRef { + pub root: crate::strings::Atom, + pub keys: Vec, +} + +/// Appends `.key`, or `["key"]` when the key is not an identifier, to a label, as the reference's `member` writes it +/// (`JSON.stringify` escapes an unpaired surrogate, so a label is always well formed). +pub fn push_member(out: &mut String, key: &crate::HostString) { + let ident = key.as_str().filter(|k| { + let mut chars = k.chars(); + chars + .next() + .is_some_and(|c| c.is_ascii_alphabetic() || c == '_' || c == '$') + && chars.all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '$') + }); + match ident { + Some(k) => { + out.push('.'); + out.push_str(k); + } + None => { + out.push('['); + out.push_str(&crate::Data::String(key.clone()).to_json_string()); + out.push(']'); + } + } +} + +/// A failure the interpreter or host raised, kept on the error object so a rethrow reports the same diagnostic. +#[derive(Clone, Debug)] +pub struct Failure { + pub kind: DiagnosticKind, + pub message: String, + /// Source offset of the instruction that raised it, filled in when first thrown. + pub offset: Option, + /// The part of the raising member expression the offset is taken from when it is filled in. + pub site: crate::bytecode::Site, +} + +pub struct Closure { + pub proto: Arc, + pub upvals: Arc<[u32]>, + pub this: Value, + /// [[HomeObject]]: the object a method was defined on, which `super` reads from; undefined for others. + pub home: Value, + /// A class constructor's instance field initializer, once its class has one. + pub fields: Value, +} + +pub enum PromiseState { + Pending, + Fulfilled(Value), + Rejected(Value), +} + +pub struct PromiseData { + pub state: PromiseState, + pub reactions: Vec, +} + +/// Key for Map and Set under SameValueZero; strings compare by their interned atom. +#[derive(Clone, Copy, PartialEq, Eq)] +pub enum MapKey { + Undef, + Null, + Bool(bool), + Num(u64), + Str(Atom), + Obj(Id), + Sym(u32), +} + +/// One word per key. A number's bits fold their high half into the low half: an integer's double has its low +/// mantissa bits all zero, and those are the bits the Fx hash puts in the table's tag, which then matches in every +/// slot of a probed group. +impl std::hash::Hash for MapKey { + fn hash(&self, state: &mut H) { + let (tag, x) = match *self { + MapKey::Undef => (0u64, 0), + MapKey::Null => (1, 0), + MapKey::Bool(b) => (2, b as u64), + MapKey::Num(n) => (3, n ^ (n >> 32)), + MapKey::Str(a) => (4, a as u64), + MapKey::Obj(id) => (5, id as u64), + MapKey::Sym(s) => (6, s as u64), + }; + state.write_u64(x ^ (tag << 61)); + } +} + +/// Insertion-ordered hash map. Each entry has a logical position, numbered in insertion order and never reused, and +/// iterators hold logical positions, so they stay valid across deletes, inserts, `clear()` and compaction. +/// A delete leaves a tombstone (`None`); once tombstones outnumber live entries they are dropped. +#[derive(Default)] +pub struct OrderedMap { + entries: Vec>, + /// While `sparse` is `None`, entry `i` is at logical position `base + i`. + base: u64, + sparse: Option, + /// Key to slot in `entries`, plus `shift` (wrapping), so dropping entries off the front leaves it as it is. + index: FxHashMap, + shift: u32, + pub live: usize, +} + +/// The logical positions of a map whose compaction left gaps between them. +struct Sparse { + /// One per entry, increasing. + positions: Vec, + /// The position the next inserted entry gets. + next: u64, +} + +impl OrderedMap { + /// A map with these live entries at these logical positions and the position the next insert gets, as a + /// snapshot saved it, or `None` if the positions don't increase below `end`. + pub fn restore(end: u64, entries: Vec<(u64, Value, Value)>, keys: Vec) -> Option { + if !entries.windows(2).all(|w| w[0].0 < w[1].0) + || entries.last().is_some_and(|e| e.0 >= end) + { + return None; + } + let positions = entries.iter().map(|e| e.0).collect(); + let mut map = OrderedMap { + index: keys.into_iter().zip(0..).collect(), + live: entries.len(), + entries: entries.into_iter().map(|e| Some((e.1, e.2))).collect(), + ..OrderedMap::default() + }; + map.place(positions, end); + Some(map) + } + + /// The storage, deleted entries included, for tracing it a range at a time. A delete may compact it; the collector + /// traces a map whole before any write to it, so a range never shifts under it. + pub fn slots(&self) -> &[Option<(Value, Value)>] { + &self.entries + } + + /// The live entries in insertion order. + pub fn iter(&self) -> impl Iterator { + self.entries.iter().flatten() + } + + /// The live entries in insertion order, with their logical positions. + pub fn positioned(&self) -> impl Iterator + '_ { + self.entries + .iter() + .enumerate() + .filter_map(|(i, e)| e.map(|(k, v)| (self.position(i), k, v))) + } + + /// The logical position the next inserted entry gets. + pub fn end(&self) -> u64 { + match &self.sparse { + Some(s) => s.next, + None => self.base + self.entries.len() as u64, + } + } + + /// The first live entry at logical position `*at` or after; moves `*at` just past it. + #[inline(always)] + pub fn next_entry(&self, at: &mut u64) -> Option<(Value, Value)> { + // An iterator's next entry is usually the one right after its last. + if self.sparse.is_none() + && let Some(&Some(e)) = at + .checked_sub(self.base) + .and_then(|i| self.entries.get(usize::try_from(i).ok()?)) + { + *at += 1; + return Some(e); + } + self.seek(at) + } + + /// Out of line, so iterators inline only the common case of `next_entry`. + #[inline(never)] + fn seek(&self, at: &mut u64) -> Option<(Value, Value)> { + let mut i = match &self.sparse { + Some(s) => s.positions.partition_point(|&q| q < *at), + None => usize::try_from(at.saturating_sub(self.base)).unwrap_or(usize::MAX), + }; + while let Some(e) = self.entries.get(i) { + if let Some(e) = *e { + *at = self.position(i) + 1; + return Some(e); + } + i += 1; + } + None + } + + fn position(&self, i: usize) -> u64 { + match &self.sparse { + Some(s) => s.positions[i], + None => self.base + i as u64, + } + } + + pub fn get(&self, key: MapKey) -> Option { + let i = self.index.get(&key)?.wrapping_sub(self.shift); + self.entries[i as usize].as_ref().map(|e| e.1) + } + + pub fn has(&self, key: MapKey) -> bool { + self.index.contains_key(&key) + } + + pub fn set(&mut self, key: MapKey, k: Value, v: Value) { + let next = (self.entries.len() as u32).wrapping_add(self.shift); + match self.index.entry(key) { + std::collections::hash_map::Entry::Occupied(i) => { + if let Some(e) = &mut self.entries[i.get().wrapping_sub(self.shift) as usize] { + e.1 = v; + } + } + std::collections::hash_map::Entry::Vacant(slot) => { + slot.insert(next); + let k = if let Value::Num(n) = k { + Value::Num(if n == 0.0 { 0.0 } else { n }) + } else { + k + }; + self.entries.push(Some((k, v))); + if let Some(s) = &mut self.sparse { + s.positions.push(s.next); + s.next += 1; + } + self.live += 1; + } + } + } + + pub fn delete(&mut self, key: MapKey) -> bool { + let Some(i) = self.index.remove(&key) else { + return false; + }; + self.entries[i.wrapping_sub(self.shift) as usize] = None; + self.live -= 1; + if self.entries.len() - self.live > self.live.max(32) { + self.compact(); + } + true + } + + /// Entries added after a `clear()` follow every position handed out before it, so iterators continue with them. + pub fn clear(&mut self) { + let end = self.end(); + self.entries.clear(); + self.index.clear(); + self.live = 0; + self.place(Vec::new(), end); + } + + /// Drops the tombstones, keeping each survivor's logical position: those in front alone if few are left behind + /// them, which moves the rest down without touching the index. + #[inline(never)] + fn compact(&mut self) { + let end = self.end(); + let front = self.entries.iter().take_while(|e| e.is_none()).count(); + if self.entries.len() - self.live - front <= self.live.max(32) / 2 { + self.entries.drain(..front); + self.shift = self.shift.wrapping_add(front as u32); + match self.sparse.take() { + Some(mut s) => { + s.positions.drain(..front); + self.place(s.positions, end); + } + None => self.base += front as u64, + } + return; + } + let old = self.sparse.take(); + let mut slots = vec![0; self.entries.len()]; + let mut positions = Vec::with_capacity(self.live); + let mut kept = 0; + for i in 0..self.entries.len() { + slots[i] = kept as u32; + if let Some(e) = self.entries[i] { + self.entries[kept] = Some(e); + positions.push(match &old { + Some(old) => old.positions[i], + None => self.base + i as u64, + }); + kept += 1; + } + } + self.entries.truncate(kept); + for i in self.index.values_mut() { + *i = slots[i.wrapping_sub(self.shift) as usize]; + } + self.shift = 0; + self.place(positions, end); + } + + /// Gives the entries these increasing logical positions, below `end`, the position the next insert gets. + fn place(&mut self, positions: Vec, end: u64) { + match positions.first() { + None => { + self.base = end; + self.sparse = None; + } + Some(&first) if first + positions.len() as u64 == end => { + self.base = first; + self.sparse = None; + } + Some(_) => { + self.sparse = Some(Sparse { + positions, + next: end, + }) + } + } + } +} + +#[derive(Clone, Copy, PartialEq, Eq)] +pub enum IterKind { + Keys, + Values, + Entries, +} + +pub enum GenState { + /// Not running: its frame and its own value stack. + Suspended(Box), + /// Running on its own stack; the box holds the stack of whoever resumed it, until it yields or finishes. + Running(Box), + Done, +} + +/// An async generator: its body, where it is, and the requests waiting for it. +pub struct AsyncGen { + pub state: GenState, + pub phase: AsyncPhase, + pub queue: std::collections::VecDeque, +} + +#[derive(Clone, Copy, PartialEq, Eq)] +pub enum AsyncPhase { + Start, + /// Suspended at a `yield`, waiting for a request. + Yield, + /// Running, or suspended at an `await` inside its body. + Executing, + /// Settling a `return` request after the body ended. + AwaitingReturn, + Completed, +} + +/// A `next`, `throw` or `return` (0, 1, 2) request and the promise it answers. +pub struct AsyncRequest { + pub kind: u8, + pub value: Value, + pub promise: Id, +} + +pub enum Kind { + Ordinary, + Array(Vec), + Arguments(Vec), + Closure(Box), + Native { + f: NativeFn, + data: Value, + name: Atom, + length: u8, + ctor: bool, + }, + Bound(Box<(Value, Value, Vec)>), + Error(Option>), + Promise(Box), + Map(Box), + Set(Box), + Generator(GenState), + ArrayIter { + target: Id, + pos: u32, + kind: IterKind, + }, + MapIter { + target: Id, + /// The logical position to continue from (see `OrderedMap`), `u64::MAX` once done. + pos: u64, + kind: IterKind, + }, + StrIter { + s: crate::strings::StrId, + pos: u32, + }, + ListIter { + items: Arc<[Value]>, + pos: u32, + }, + /// A path into a host namespace among the globals, the reference's `HostNamespace`. + Namespace(NsPath), + /// Shared state of a promise's resolve/reject pair: the promise, and whether either already ran. + Resolvers { + promise: Id, + done: bool, + }, + /// Shared state of a `Promise.all`-family combinator. + Combinator(Box), + RegExp(Box), + /// A Date's time value. + Date(f64), + Bytes(Box), + TextDecoder(Box), + WeakMap(Box), + WeakSet(Box), + IterHelper(Box), + Url(Box), + SearchParams(Box), + Headers(Box), + /// A live iterator over a standard-library collection. + /// A crossing to the host in progress (see `cross`). + Cross(Box), + ExoticIter { + target: Id, + pos: u32, + kind: IterKind, + }, + AsyncGenerator(Box), + /// An async iterator over a sync one, for `for await` and an async generator's `yield*`. + AsyncFromSync { + sync: Id, + next: Value, + }, + /// An object with accessors the host answers, such as a streaming response. + /// The getter and setter of an accessor property (see `ACCESSOR`), never reachable as a value. + Accessor(Box), +} + +pub struct Combinator { + pub kind: CombKind, + pub promise: Id, + pub values: Vec, + pub remaining: usize, +} + +#[derive(Clone, Copy, PartialEq, Eq)] +pub enum CombKind { + All, + AllSettled, + Any, +} + +pub const NON_EXTENSIBLE: u8 = 1; +pub const FROZEN: u8 = 2; +pub const SEALED: u8 = 4; +/// A function whose own `name` was deleted; it reads the inherited one. +pub const NAME_DELETED: u8 = 8; +/// A function whose own `length` was deleted; it reads the inherited one. +pub const LENGTH_DELETED: u8 = 16; +/// An array too long for its items: they hold a dense prefix, and its other elements and its length are own +/// properties (see `Vm::array_len`). +pub const SPARSE: u8 = 32; +/// A built-in callback sites don't admit (the reference's `callback: false`): the `Promise` statics and `Symbol`. +pub const NOT_CALLBACK: u8 = 64; +/// A program accessor was defined here at some point (the reference's `hasProgramAccessors`): the bulk readers' cue to +/// take their slow paths. +pub const ACCESSORS: u8 = 128; + +pub struct Obj { + pub proto: Option, + pub props: Props, + pub kind: Kind, + pub flags: u8, + /// The native `JSON.stringify` walk that last visited it (`Vm::json_walk`); it fits in the padding. + pub visit: u32, +} + +impl Obj { + pub fn new(proto: Option, kind: Kind) -> Obj { + Obj { + proto, + props: Props::default(), + kind, + flags: 0, + visit: 0, + } + } + + pub fn is_callable(&self) -> bool { + match &self.kind { + Kind::Closure(_) | Kind::Native { .. } | Kind::Bound(_) => true, + Kind::Namespace(n) => !n.is_root(), + _ => false, + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn key(n: u64) -> (MapKey, Value) { + (MapKey::Num((n as f64).to_bits()), Value::Num(n as f64)) + } + + fn num(v: Value) -> f64 { + match v { + Value::Num(n) => n, + _ => unreachable!(), + } + } + + fn keys(m: &OrderedMap) -> Vec { + m.iter().map(|(k, _)| num(*k)).collect() + } + + /// A small deterministic generator. + fn lcg(state: &mut u64) -> u64 { + *state = state + .wrapping_mul(6364136223846793005) + .wrapping_add(1442695040888963407); + *state >> 33 + } + + fn assert_bounded(m: &OrderedMap) { + assert!( + m.entries.len() <= m.live + m.live.max(32), + "{} slots for {} entries", + m.entries.len(), + m.live + ); + } + + #[test] + fn churn_around_two_thousand_entries_stays_within_twice_the_live_ones() { + // A Map deleting random keys, and a Set deleting its oldest: 400k operations each around 2,000 entries. + let (mut map, mut set) = (OrderedMap::default(), OrderedMap::default()); + let (mut live, mut order) = (Vec::new(), std::collections::VecDeque::new()); + let mut rng = 7; + for n in 0..200_000u64 { + let (k, v) = key(n); + map.set(k, v, v); + set.set(k, v, Value::Undef); + live.push(n); + order.push_back(n); + if live.len() > 2000 { + let gone = live.swap_remove(lcg(&mut rng) as usize % live.len()); + assert!(map.delete(key(gone).0)); + assert!(set.delete(key(order.pop_front().unwrap()).0)); + } + assert_bounded(&map); + assert_bounded(&set); + } + live.sort_unstable(); + let mut got = keys(&map); + got.sort_by(f64::total_cmp); + assert_eq!(got, live.iter().map(|&n| n as f64).collect::>()); + assert_eq!( + keys(&set), + order.iter().map(|&n| n as f64).collect::>() + ); + assert_eq!(map.get(key(199_999).0).map(num), Some(199_999.0)); + } + + #[test] + fn a_permanent_first_key_with_churn_behind_it_stays_bounded() { + let mut m = OrderedMap::default(); + let (k, v) = key(u64::MAX >> 12); + m.set(k, v, v); + for n in 0..400_000u64 { + let (k, v) = key(n); + m.set(k, v, v); + if n >= 2000 { + assert!(m.delete(key(n - 2000).0)); + } + assert_bounded(&m); + } + assert!(m.sparse.is_some()); + let got = keys(&m); + assert_eq!(got[0], (u64::MAX >> 12) as f64); + assert_eq!( + got[1..], + (398_000..400_000).map(|n| n as f64).collect::>()[..] + ); + let mut at = 0; + assert_eq!(m.next_entry(&mut at).map(|e| num(e.0)), Some(num(v))); + assert_eq!(m.get(key(399_999).0).map(num), Some(399_999.0)); + } + + /// Cursors over a compacting map step exactly as over a list that only ever gains tombstones. + #[test] + fn cursors_follow_logical_positions_through_compaction_and_clear() { + let mut m = OrderedMap::default(); + let mut model: Vec> = Vec::new(); + let mut slot = std::collections::HashMap::new(); + let mut live = Vec::new(); + let mut cursors = [(0u64, 0usize); 4]; + let mut rng = 11; + let mut next = 0; + for round in 0..200_000 { + match lcg(&mut rng) % 100 { + 0..45 => { + let (k, v) = key(next); + m.set(k, v, v); + slot.insert(next, model.len()); + model.push(Some(next)); + live.push(next); + next += 1; + } + 45..90 if !live.is_empty() => { + let gone = live.swap_remove(lcg(&mut rng) as usize % live.len()); + assert!(m.delete(key(gone).0)); + model[slot.remove(&gone).unwrap()] = None; + } + 90 if round % 7 == 0 => { + m.clear(); + model.iter_mut().for_each(|e| *e = None); + slot.clear(); + live.clear(); + } + _ => { + let (at, i) = &mut cursors[lcg(&mut rng) as usize % 4]; + while *i < model.len() && model[*i].is_none() { + *i += 1; + } + let want = model.get(*i).copied().flatten(); + if want.is_some() { + *i += 1; + } + let got = m.next_entry(at).map(|e| num(e.0)); + assert_eq!(got, want.map(|n| n as f64)); + } + } + assert_bounded(&m); + } + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/offload.rs b/packages/codemode-rust/crates/psychoscript/src/offload.rs new file mode 100644 index 0000000000000..37b35880d2dc0 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/offload.rs @@ -0,0 +1,182 @@ +//! Moving long stretches of a run's compute off the thread that drives it. A run driven as a future that computes +//! past [`OFFLOAD_AFTER`] without stopping finishes that stretch on a worker thread of its own; the next stretch starts +//! where the run is driven again. Host code stays there: each tool call, extension call, host accessor and first poll +//! of a host future the worker meets is handed back and runs there while the worker waits, so host code runs on the +//! same thread, in the same order, as before. A handed-back call costs a few microseconds, which only stretches already +//! past the budget pay. + +use std::panic::AssertUnwindSafe; +use std::sync::mpsc::{self, Receiver, Sender, TryRecvError}; +use std::sync::{Arc, Mutex, PoisonError}; +use std::task::{Context, Poll, Waker}; +use std::thread::JoinHandle; +use std::time::{Duration, Instant}; + +use crate::program::Running; +use crate::run::{RUN_STACK_BUDGET, THREAD_STACK_BASE}; + +/// How long a run may compute on the thread driving it, without stopping, before it moves to a worker thread. +pub const OFFLOAD_AFTER: Duration = Duration::from_millis(1); + +type Job = Box; + +/// A run's side of moving: when the stretch of compute in progress has run long enough to move, whether it stopped to, +/// and where its host code runs while it is away. +#[derive(Default)] +pub struct Offload { + pub at: Option, + pub due: bool, + pub home: Option, +} + +enum ToHome { + /// Host code for the driving thread to run. + Job(Job), + /// The run, back after a stretch of compute. + Back(Box), + /// The interpreter panicked on the worker; the panic continues where the run is driven, as it would have there. + Panicked(Box), +} + +/// Where host code runs while a run with this offload state computes on a worker thread. +pub fn home(offload: &Option>) -> Option<&Home> { + offload.as_ref()?.home.as_ref() +} + +/// The way back to the thread driving a run, for its host code. +#[derive(Clone)] +pub struct Home { + tx: Sender, + waker: Arc>>, +} + +impl Home { + /// Runs `f` on the thread driving the run and waits for its result; `None` when the run is being dropped. + pub fn run(&self, f: impl FnOnce() -> R + Send + 'static) -> Option { + let (reply, answer) = mpsc::sync_channel(1); + self.send(ToHome::Job(Box::new(move || { + let _ = reply.send(f()); + }))) + .ok()?; + answer.recv().ok() + } + + fn send(&self, message: ToHome) -> Result<(), ToHome> { + self.tx.send(message).map_err(|e| e.0)?; + if let Some(w) = self + .waker + .lock() + .unwrap_or_else(PoisonError::into_inner) + .take() + { + w.wake(); + } + Ok(()) + } +} + +/// A run's worker thread. +pub struct Worker { + to_worker: Option>>, + from_worker: Receiver, + waker: Arc>>, + thread: Option>, +} + +impl Worker { + pub fn spawn() -> std::io::Result { + let (to_worker, runs) = mpsc::channel::>(); + let (tx, from_worker) = mpsc::channel(); + let waker = Arc::new(Mutex::new(None)); + let home = Home { + tx, + waker: waker.clone(), + }; + let thread = std::thread::Builder::new() + .name("psychoscript-run".into()) + .stack_size(RUN_STACK_BUDGET + THREAD_STACK_BASE) + .spawn(move || { + while let Ok(mut r) = runs.recv() { + let message = match std::panic::catch_unwind(AssertUnwindSafe(|| { + compute(&mut r, &home); + })) { + Ok(()) => ToHome::Back(r), + Err(panic) => ToHome::Panicked(panic), + }; + if home.send(message).is_err() { + return; + } + } + })?; + Ok(Self { + to_worker: Some(to_worker), + from_worker, + waker, + thread: Some(thread), + }) + } + + /// Hands the run to the worker for its next stretch of compute. + pub fn compute(&self, r: Box) { + if let Some(tx) = &self.to_worker { + // The worker only stops when this sender is dropped, so it is there to receive. + let _ = tx.send(r); + } + } + + /// Runs the host code the worker hands back, until the run comes back. + pub fn poll(&self, cx: &Context<'_>) -> Poll> { + let mut registered = false; + loop { + match self.from_worker.try_recv() { + Ok(ToHome::Job(job)) => job(), + Ok(ToHome::Back(r)) => return Poll::Ready(r), + Ok(ToHome::Panicked(panic)) => std::panic::resume_unwind(panic), + Err(TryRecvError::Disconnected) => { + unreachable!("the worker only stops once its run is back or abandoned") + } + Err(TryRecvError::Empty) if registered => return Poll::Pending, + // Look again after registering, for a message sent in between. + Err(TryRecvError::Empty) => { + *self.waker.lock().unwrap_or_else(PoisonError::into_inner) = + Some(cx.waker().clone()); + registered = true; + } + } + } + } + + /// Waits for the run to come back, running none of its host code, so it is dropped on the driving thread. The run + /// was asked to stop, which it does at its next safe point. + pub fn reclaim(&self) -> Option> { + loop { + match self.from_worker.recv() { + Ok(ToHome::Job(job)) => drop(job), + Ok(ToHome::Back(r)) => return Some(r), + Ok(ToHome::Panicked(_)) | Err(_) => return None, + } + } + } +} + +impl Drop for Worker { + fn drop(&mut self) { + self.to_worker = None; + if let Some(thread) = self.thread.take() { + let _ = thread.join(); + } + } +} + +/// One stretch of compute: until the run ends, waits on the host, or stops at a safe point. +fn compute(r: &mut Running, home: &Home) { + let probe = 0u8; + r.vm.stack_base = &probe as *const u8 as usize; + r.vm.stack_budget = RUN_STACK_BUDGET; + r.vm.host.offload().home = Some(home.clone()); + let _ = r.vm.continue_frames(); + if !r.vm.suspended { + let _ = r.vm.drive(); + } + r.vm.host.offload().home = None; +} diff --git a/packages/codemode-rust/crates/psychoscript/src/ops.rs b/packages/codemode-rust/crates/psychoscript/src/ops.rs new file mode 100644 index 0000000000000..c0531e65ec876 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/ops.rs @@ -0,0 +1,2521 @@ +//! Property access, conversions, operators and iteration on program values. + +use crate::builtins::exotic; +use crate::bytecode::{ITER_FOR_OF, Site}; +use crate::iteration::{BY_CLOSE, BY_COUNTED, BY_RESUME, BY_UNCOUNTED}; +use crate::object::*; +use crate::strings::StrId; +use crate::value::{Id, Value, num_to_string, str_to_num}; +use crate::vm::{NATIVE_FUEL, REQ_NEXT, REQ_RETURN, Res, Vm}; + +pub const MAX_STRING_LEN: usize = 1 << 24; +const UNAWAITED: &str = + "This value is an un-awaited Promise; await it first - e.g. `const result = await load(...)`."; +pub const MAX_ARRAY_LEN: usize = 10_000_000; + +#[derive(Clone, Copy, PartialEq)] +pub enum Hint { + Default, + Number, + String, +} + +impl Vm { + // ---------- property reads ---------- + + #[inline(never)] + pub fn get(&mut self, v: &Value, key: Atom) -> Res { + match v { + Value::Obj(id) => { + let v = self.get_obj(*id, key); + if let Value::Uninit = v { + return Err(crate::builtins::accessor_error(self, *id, key)); + } + if matches!(v, Value::Undef) + && matches!(self.heap[*id as usize].kind, Kind::Promise(_)) + && !self.has_key(*id, key) + { + return Err(self.unawaited()); + } + Ok(v) + } + Value::Str(s) => { + let s = *s; + if key == self.names.length { + return Ok(Value::Num(self.atoms.sref(s).len16() as f64)); + } + if let Some(i) = self.atoms.index(key) { + return Ok(match self.atoms.sref(s).code_unit(i as usize) { + Some(c) => self.char_str(c), + None => Value::Undef, + }); + } + let p = self.realm.string_proto; + Ok(self.get_obj(p, key)) + } + Value::Num(_) => { + let p = self.realm.number_proto; + Ok(self.get_obj(p, key)) + } + Value::Bool(_) => { + let p = self.realm.boolean_proto; + Ok(self.get_obj(p, key)) + } + // A symbol has no wrapper prototype in the reference. + Value::Sym(_) => { + Err(self.type_error("Cannot access a property on a non-object value.")) + } + Value::Undef | Value::Null | Value::Uninit => { + let k = self.key_text(key); + let t = if let Value::Null = v { + "null" + } else { + "undefined" + }; + Err(self.nullish_read(t, &k)) + } + } + } + + /// A destructuring pattern's read: a member read, except that a promise's missing key reads as undefined + /// instead of reporting a missing await, as the reference's `destructuredProperty` does. + pub fn get_destructured(&mut self, v: &Value, key: Atom) -> Res { + if let Value::Obj(id) = v + && self.is_promise(*id) + { + let r = self.get_obj(*id, key); + if let Value::Uninit = r { + return Err(crate::builtins::accessor_error(self, *id, key)); + } + return Ok(r); + } + self.get(v, key) + } + + /// [`Vm::get_destructured`] with a key value `ToKey` made. + pub fn get_elem_destructured(&mut self, v: &Value, k: &Value) -> Res { + if let Value::Obj(id) = v + && self.is_promise(*id) + { + let a = self.key_of(k)?; + return self.get_destructured(v, a); + } + self.get_elem(v, k) + } + + pub fn key_text(&self, key: Atom) -> String { + if key <= SYM_ASYNC_ITERATOR { + return symbol_text(key).to_owned(); + } + self.atoms.text(key).to_owned() + } + + /// A key's text in a message about a nullish base, made without calling the program, as the reference's + /// `coerceToString` does. + fn key_message(&mut self, k: &Value) -> String { + match k { + Value::Obj(_) => crate::builtins::builtin_string(self, k).unwrap_or_default(), + k => self.quiet_string(k), + } + } + + #[inline(never)] + pub fn get_obj(&mut self, id: Id, key: Atom) -> Value { + let mut cur = id; + loop { + let o = &self.heap[cur as usize]; + match &o.kind { + Kind::Array(items) => { + if let Some(i) = self.atoms.index(key) { + // A hole or an index past the end may still be inherited. + if let Some(v) = items.get(i as usize) + && !matches!(v, Value::Uninit) + { + return *v; + } + } else if key == self.names.length && o.flags & SPARSE == 0 { + return Value::Num(items.len() as f64); + } + } + Kind::Arguments(items) => { + // An arguments object is ordinary: an index past its arguments is a plain property, and its + // `length` is a hidden one. + if let Some(i) = self.atoms.index(key) + && let Some(v) = items.get(i as usize) + && !matches!(v, Value::Uninit) + { + return *v; + } + } + Kind::Closure(c) if o.props.find(key).is_none() => { + if key == self.names.name && o.flags & NAME_DELETED == 0 { + return Value::Str(self.atoms.atom_str(c.proto.name)); + } + if key == self.names.length && o.flags & LENGTH_DELETED == 0 { + return Value::Num(c.proto.length as f64); + } + } + Kind::Native { name, length, .. } if o.props.find(key).is_none() => { + if key == self.names.name && o.flags & NAME_DELETED == 0 { + return Value::Str(self.atoms.atom_str(*name)); + } + if key == self.names.length && o.flags & LENGTH_DELETED == 0 { + return Value::Num(*length as f64); + } + } + Kind::Map(m) | Kind::Set(m) if cur == id && key == self.names.size => { + return Value::Num(m.live as f64); + } + Kind::Namespace(_) if cur == id => { + // `then` is a path like any other; a namespace is never a thenable (`resolve_promise`). + if key <= SYM_ASYNC_ITERATOR { + return Value::Undef; + } + return self.ns_ref(NsPath { + parent: id, + name: key, + }); + } + // A Map's or Set's only own accessor is `size`, above. + Kind::Map(_) | Kind::Set(_) => {} + k if cur == id && exotic::is_exotic(k) => { + if let Some(v) = exotic::get(self, id, key) { + return v; + } + } + _ => {} + } + let o = &self.heap[cur as usize]; + if let Some(p) = o.props.prop(key) { + if p.flags & ACCESSOR == 0 { + return p.value; + } + let pair = p.value; + return self.accessor_read(pair, Value::Obj(id), key); + } + match o.proto { + Some(p) => cur = p, + None => return Value::Undef, + } + } + } + + /// The accessor property `key` a primitive's wrapper prototype chain has first, if any. + pub(crate) fn primitive_accessor(&self, v: &Value, key: Atom) -> Option { + let proto = match v { + Value::Str(_) => self.realm.string_proto, + Value::Num(_) => self.realm.number_proto, + Value::Bool(_) => self.realm.boolean_proto, + _ => return None, + }; + if !self.accessors_on_chain(proto) { + return None; + } + let mut cur = Some(proto); + while let Some(c) = cur { + if self.has_own(c, key) { + return self.heap[c as usize] + .props + .prop(key) + .filter(|p| p.flags & ACCESSOR != 0) + .map(|p| p.value); + } + cur = self.heap[c as usize].proto; + } + None + } + + /// The accessor property `key` on the chain above `id`, when the first property found there is one. + pub(crate) fn inherited_accessor(&self, id: Id, key: Atom) -> Option { + let proto = self.heap[id as usize].proto?; + if !self.accessors_on_chain(proto) { + return None; + } + let mut cur = Some(proto); + while let Some(c) = cur { + if self.has_own(c, key) { + return self.heap[c as usize] + .props + .prop(key) + .filter(|p| p.flags & ACCESSOR != 0) + .map(|p| p.value); + } + cur = self.heap[c as usize].proto; + } + None + } + + /// A write that reached an accessor property on `receiver`'s chain: its setter takes it. A program setter is not + /// called here: an instruction calls it (`setter_hit`); a built-in cannot (`Reads::fault`). + pub(crate) fn accessor_write( + &mut self, + pair: Value, + receiver: Value, + key: Atom, + val: Value, + ) -> Result<(), Value> { + let s = self.pair(pair).set; + if let Value::Undef = s { + let k = self.key_text(key); + let d = crate::builtins::describe_value(self, &receiver); + return Err(self.type_error(&format!( + "Cannot set property '{k}' of {d} which has only a getter." + ))); + } + if self.is_restricted(&s) { + return crate::builtins::object::restricted(self, receiver, &[], 0).map(|_| ()); + } + if self.is_companion(&s) { + let id = s.as_obj().unwrap_or(0); + crate::accessors::companion_set(self, receiver, &[val], id)?; + return Ok(()); + } + if self.op_access { + self.setter_hit = Some(s); + } else if self.reads.fault.is_none() { + self.reads.fault = Some(key); + } + Ok(()) + } + + /// An array's element that is a hole or past its end, which its prototypes may still have. + #[cold] + pub(crate) fn missing_elem(&mut self, id: Id, i: usize) -> Value { + self.inherited_elem(id, i).unwrap_or_default() + } + + /// Element `i` of `id`'s prototypes, if one has it. An index never used as a key can still sit in an array + /// prototype's items (`Array.prototype[0] = x`), which store it without interning it. + #[cold] + pub(crate) fn inherited_elem(&mut self, id: Id, i: usize) -> Option { + if self.heap[id as usize].flags & SPARSE != 0 + && let Some(key) = self.atoms.lookup(&i.to_string()) + && let Some(v) = self.heap[id as usize].props.get(key) + { + return Some(*v); + } + let proto = self.heap[id as usize].proto?; + if let Some(key) = self.atoms.lookup(&i.to_string()) { + return self.has_key(proto, key).then(|| self.get_obj(proto, key)); + } + let mut cur = Some(proto); + while let Some(p) = cur { + let o = &self.heap[p as usize]; + if let Kind::Array(items) = &o.kind + && let Some(v) = items.get(i) + && !matches!(v, Value::Uninit) + { + return Some(*v); + } + cur = o.proto; + } + None + } + + #[inline(never)] + pub fn get_elem(&mut self, v: &Value, k: &Value) -> Res { + match (v, k) { + (Value::Obj(id), Value::Num(n)) => { + if let Kind::Array(items) = &self.heap[*id as usize].kind { + let i = *n as usize; + // 2^32 - 1 and above are not array indexes but plain keys. + if i as f64 == *n && i < u32::MAX as usize { + return Ok(match items.get(i) { + Some(v) if !matches!(v, Value::Uninit) => *v, + _ => self.missing_elem(*id, i), + }); + } + } + if self.is_namespace(*id) { + return Err(self.namespace_key_error(*id)); + } + } + (Value::Obj(id), Value::Sym(_)) if self.is_namespace(*id) => { + return Err(self.namespace_key_error(*id)); + } + (Value::Str(s), Value::Num(n)) => { + let i = *n as usize; + if i as f64 == *n { + return Ok(match self.atoms.sref(*s).code_unit(i) { + Some(c) => self.char_str(c), + None => Value::Undef, + }); + } + } + (Value::Undef | Value::Null, _) => { + let k = self.key_message(k); + let t = if let Value::Null = v { + "null" + } else { + "undefined" + }; + return Err(self.nullish_read(t, &k)); + } + _ => {} + } + let a = self.key_of(k)?; + self.get(v, a) + } + + #[inline(never)] + pub fn key_of(&mut self, k: &Value) -> Result { + Ok(match k { + Value::Str(s) => self.atoms.intern_id(*s), + Value::Num(n) => { + let s = num_to_string(*n); + self.atoms.intern(&s) + } + Value::Sym(s) => *s, + Value::Obj(_) => { + // A member's key that fails to convert fails at the key. + let p = self + .primitive_of(k, Hint::String) + .map_err(|e| self.at_site(e, Site::Key))?; + // A namespace or a promise stays as it is; its key is its text. + if let Value::Obj(_) = p { + let s = self.string_of(&p)?; + return Ok(self.atoms.intern_id(s)); + } + return self.key_of(&p); + } + Value::Bool(b) => self.atoms.intern(if *b { "true" } else { "false" }), + Value::Null => self.atoms.intern_static("null"), + Value::Undef | Value::Uninit => self.atoms.intern_static("undefined"), + }) + } + + // ---------- data guards ---------- + + /// Whether `id` is a namespace reference, which the reference keeps outside its objects (`HostNamespace`). + #[inline] + pub(crate) fn is_namespace(&self, id: Id) -> bool { + matches!(self.heap[id as usize].kind, Kind::Namespace(_)) + } + + #[inline] + pub(crate) fn is_promise(&self, id: Id) -> bool { + matches!(self.heap[id as usize].kind, Kind::Promise(_)) + } + + /// Whether `v` is an object the reference converts (`instanceof Obj`): not a primitive and not a namespace. + #[inline] + pub(crate) fn is_convertible_obj(&self, v: &Value) -> bool { + matches!(v, Value::Obj(id) if !self.is_namespace(*id)) + } + + /// Promises and namespace paths are not data: operators reject them, as the reference does. + pub fn is_opaque_operand(&self, v: &Value) -> bool { + matches!(v, Value::Obj(id) if matches!(self.heap[*id as usize].kind, Kind::Promise(_) | Kind::Namespace(_))) + } + + pub fn data_operand(&mut self, v: &Value, msg: &str) -> Result<(), Value> { + if self.is_opaque_operand(v) { + return Err(self.invalid_data(msg)); + } + Ok(()) + } + + #[inline] + pub fn data_operands(&mut self, a: &Value, b: &Value) -> Result<(), Value> { + if self.is_opaque_operand(a) || self.is_opaque_operand(b) { + return Err(self.invalid_data("Binary operators require data values.")); + } + Ok(()) + } + + /// `==` compares objects by identity and nullish values without coercion, so only a mixed comparison of an + /// opaque value with data is rejected. + pub fn loose_eq_operands(&mut self, a: &Value, b: &Value) -> Result<(), Value> { + match (a, b) { + (Value::Obj(_), Value::Obj(_)) => Ok(()), + (x, y) if x.is_nullish() || y.is_nullish() => Ok(()), + _ => self.data_operands(a, b), + } + } + + // ---------- property writes ---------- + + /// Rejects storing `value` into `container` when `container` is reachable from it through data objects, as + /// the reference does, so a value never refers to itself. Opaque values (functions, promises, collections) end + /// the walk but still match. + #[inline(never)] + pub fn reject_circular( + &mut self, + container: Id, + value: &Value, + label: &str, + ) -> Result<(), Value> { + let Value::Obj(start) = value else { + return Ok(()); + }; + let mut pending = vec![*start]; + let mut seen = rustc_hash::FxHashSet::default(); + while let Some(id) = pending.pop() { + if id == container { + let msg = format!("{label} contains a circular value."); + let p = self.realm.type_error_proto; + return Err(self.failure(p, &msg, crate::DiagnosticKind::InvalidDataValue)); + } + if !seen.insert(id) { + continue; + } + let o = &self.heap[id as usize]; + if let Kind::Array(items) | Kind::Arguments(items) = &o.kind { + pending.extend(items.iter().filter_map(Value::as_obj)); + } else if !matches!(o.kind, Kind::Ordinary | Kind::Error(_)) { + continue; + } + pending.extend( + o.props + .items + .iter() + .filter(|p| p.flags & ACCESSOR == 0) + .filter_map(|p| p.value.as_obj()), + ); + } + Ok(()) + } + + /// The circularity check of a member assignment `o[k] = v`. + #[inline] + pub fn check_assignment(&mut self, o: &Value, v: &Value) -> Result<(), Value> { + if let (Value::Obj(c), Value::Obj(_)) = (o, v) { + let label = if matches!(self.heap[*c as usize].kind, Kind::Array(_)) { + "Array assignment result" + } else { + "Object assignment result" + }; + return self.reject_circular(*c, v, label); + } + Ok(()) + } + + /// `check_assignment` for a write of `key`: a write an accessor takes makes no cycle, as in the reference's + /// `assignToReference`. + pub fn check_assignment_at(&mut self, o: &Value, key: Atom, v: &Value) -> Result<(), Value> { + let r = self.check_assignment(o, v); + if r.is_err() + && let Value::Obj(id) = o + && self.accessor_on_chain(*id, key).is_some() + { + return Ok(()); + } + r + } + + #[inline(never)] + pub fn set(&mut self, v: &Value, key: Atom, val: Value) -> Result<(), Value> { + match v { + Value::Obj(id) => self.set_obj(*id, key, val), + // The reference resolves the base as a read does, so a nullish one fails as a read. + Value::Undef | Value::Null | Value::Uninit => { + let k = self.key_text(key); + let t = if let Value::Null = v { + "null" + } else { + "undefined" + }; + Err(self.nullish_read(t, &k)) + } + Value::Sym(_) => { + Err(self.type_error("Cannot access a property on a non-object value.")) + } + // A string's length and indexes are its own values, not fields. + Value::Str(_) if key == self.names.length || self.atoms.index(key).is_some() => { + Err(self.type_error("Only data fields may be assigned.")) + } + // Only an inherited setter can take a primitive's write, with the primitive as `this`. + Value::Str(_) | Value::Num(_) | Value::Bool(_) + if self.primitive_accessor(v, key).is_some() => + { + let pair = self.primitive_accessor(v, key).unwrap_or_default(); + self.accessor_write(pair, *v, key, val) + } + _ => { + let k = self.key_text(key); + let t = self.type_of(v); + let s = self.string_of(v)?; + let s = self.text(s).to_owned(); + Err(self.type_error(&format!("Cannot create property '{k}' on {t} '{s}'."))) + } + } + } + + /// Whether a member write through `v` needs [`Vm::check_writable`]: it is not a plain object. + #[inline] + pub(crate) fn write_checked(&self, v: &Value) -> bool { + !matches!(v, Value::Obj(id) if !self.is_namespace(*id) && !self.is_promise(*id)) + } + + /// The reference's check of the member an assignment or update writes through before it reads or writes it + /// (`writableReference`, then `readReference`): only a data field of an object, of a promise one it has. + #[cold] + #[inline(never)] + pub(crate) fn check_writable(&mut self, v: &Value, key: Atom) -> Result<(), Value> { + match v { + Value::Obj(id) if self.is_namespace(*id) => { + if key <= SYM_ASYNC_ITERATOR { + return Err(self.namespace_key_error(*id)); + } + Err(self.type_error("Only data fields may be assigned.")) + } + Value::Obj(id) if self.is_promise(*id) && !self.has_key(*id, key) => { + Err(self.unawaited()) + } + Value::Obj(_) => Ok(()), + Value::Undef | Value::Null | Value::Uninit => { + let k = self.key_text(key); + let t = if let Value::Null = v { + "null" + } else { + "undefined" + }; + Err(self.nullish_read(t, &k)) + } + // A primitive has no field to write: the write fails as it would. + v => self.set(v, key, Value::Undef), + } + } + + /// A computed member's key as a write target: `[o, k]` -> the key, after the base is checked as read (a nullish + /// one fails before the key converts) and then as written, as the reference's `emitWritableKey` checks it. + pub(crate) fn write_key(&mut self, o: &Value, k: &Value) -> Res { + if o.is_nullish() { + let k = self.key_message(k); + let t = if let Value::Null = o { + "null" + } else { + "undefined" + }; + return Err(self.nullish_read(t, &k)); + } + // A number stays a number, as the reference's `TO_KEY` keeps it: a namespace path refuses it. + let key = match k { + Value::Num(_) | Value::Str(_) | Value::Sym(_) => *k, + k => { + let a = self.key_of(k)?; + if a <= SYM_ASYNC_ITERATOR { + Value::Sym(a) + } else { + self.atom_val(a) + } + } + }; + if self.write_checked(o) { + if let (Value::Num(_), Value::Obj(id)) = (&key, o) + && self.is_namespace(*id) + { + return Err(self.namespace_key_error(*id)); + } + let a = self.key_of(&key)?; + self.check_writable(o, a)?; + } + Ok(key) + } + + #[inline(never)] + pub fn set_obj(&mut self, id: Id, key: Atom, val: Value) -> Result<(), Value> { + if matches!(self.heap[id as usize].kind, Kind::Promise(_)) && !self.has_key(id, key) { + return Err(self.unawaited()); + } + let flags = self.heap[id as usize].flags; + let length = self.names.length; + let index = self.atoms.index(key); + let is_name_or_length = key == length || key == self.names.name; + match &mut self.heap[id as usize].kind { + Kind::Array(items) => { + if let Some(i) = index { + let i = i as usize; + if flags & FROZEN != 0 { + return Err(self.read_only(key)); + } + if i < items.len() && !matches!(items[i], Value::Uninit) { + items[i] = val; + return Ok(()); + } + // A hole or a new element looks at the prototypes first, which may hold a program setter there. + if let Some(pair) = self.inherited_accessor(id, key) { + return self.accessor_write(pair, Value::Obj(id), key, val); + } + let Kind::Array(items) = &mut self.heap[id as usize].kind else { + return Ok(()); + }; + if flags & NON_EXTENSIBLE != 0 { + return Err(self.not_extensible(key)); + } + if i < items.len() { + items[i] = val; + return Ok(()); + } + if flags & SPARSE != 0 || i >= MAX_ARRAY_LEN { + self.sparse_set(id, key, i, val); + return Ok(()); + } + items.resize(i, Value::Uninit); + items.push(val); + return Ok(()); + } + if key == length { + if flags & FROZEN != 0 { + return Err(self.read_only(key)); + } + let n = match val { + Value::Num(n) => n, + _ => self.number_of(&val)?, + }; + if n < 0.0 || n.fract() != 0.0 || n as usize > MAX_ARRAY_LEN { + return Err(self.range_error("Invalid array length")); + } + if flags & SPARSE != 0 { + self.unsparse(id, n as usize); + } else if let Kind::Array(items) = &mut self.heap[id as usize].kind { + items.resize(n as usize, Value::Uninit); + } + return Ok(()); + } + } + Kind::Arguments(items) => { + if let Some(i) = index + && let Some(slot) = items.get_mut(i as usize) + { + if flags & FROZEN != 0 { + return Err(self.read_only(key)); + } + if matches!(slot, Value::Uninit) && flags & NON_EXTENSIBLE != 0 { + return Err(self.not_extensible(key)); + } + *slot = val; + return Ok(()); + } + } + Kind::Closure(_) | Kind::Native { .. } | Kind::Bound(_) if is_name_or_length => { + return Err(self.read_only(key)); + } + Kind::Namespace(_) => return Err(self.type_error("Only data fields may be assigned.")), + k if exotic::is_exotic(k) => { + if let Some(r) = exotic::set(self, id, key, val) { + return r; + } + } + _ => {} + } + let o = &self.heap[id as usize]; + match o.props.find(key) { + Some(i) => { + let p = &o.props.items[i]; + if p.flags & ACCESSOR != 0 { + let pair = p.value; + return self.accessor_write(pair, Value::Obj(id), key, val); + } + // A built-in accessor on the prototype itself: as the inherited one, its getter takes no write. + if matches!(p.value, Value::Uninit) { + let text = self.atoms.text(key).to_owned(); + if id == self.realm.std.url && text != "origin" && text != "searchParams" { + return Err(crate::builtins::incompatible( + self, + &format!("URL.prototype.{text}"), + &Value::Obj(id), + )); + } + return Err(self.only_getter(&Value::Obj(id), key)); + } + if flags & FROZEN != 0 || p.flags & WRITABLE == 0 { + return Err(self.read_only(key)); + } + self.heap[id as usize].props.items[i].value = val; + } + None => { + if let Some(pair) = self.inherited_accessor(id, key) { + return self.accessor_write(pair, Value::Obj(id), key, val); + } + if let Some(e) = self.builtin_accessor_write(id, key) { + return Err(e); + } + if flags & NON_EXTENSIBLE != 0 { + return Err(self.not_extensible(key)); + } + self.heap[id as usize] + .props + .push_new(key, val, DEFAULT_FLAGS); + } + } + Ok(()) + } + + /// The error for a write a built-in accessor with no setter refuses, as the reference's `failedAssignment` words it. + pub(crate) fn only_getter(&mut self, receiver: &Value, key: Atom) -> Value { + let k = self.key_text(key); + let d = crate::builtins::describe_value(self, receiver); + self.type_error(&format!( + "Cannot set property '{k}' of {d} which has only a getter." + )) + } + + /// A write that reaches a built-in accessor (an `Uninit` slot) on the chain above `id` before any other property: + /// a URL field's setter refuses a receiver of another kind, and an accessor with no setter refuses the write. + fn builtin_accessor_write(&mut self, id: Id, key: Atom) -> Option { + let mut cur = self.heap[id as usize].proto; + while let Some(c) = cur { + if let Some(p) = self.heap[c as usize].props.prop(key) { + if !matches!(p.value, Value::Uninit) { + return None; + } + let text = self.atoms.text(key).to_owned(); + if c == self.realm.std.url && text != "origin" && text != "searchParams" { + return Some(crate::builtins::incompatible( + self, + &format!("URL.prototype.{text}"), + &Value::Obj(id), + )); + } + return Some(self.only_getter(&Value::Obj(id), key)); + } + if self.has_own(c, key) { + return None; + } + cur = self.heap[c as usize].proto; + } + None + } + + fn read_only(&mut self, key: Atom) -> Value { + let k = self.key_text(key); + self.type_error(&format!("Cannot assign to read only property '{k}'.")) + } + + fn not_extensible(&mut self, key: Atom) -> Value { + let k = self.key_text(key); + self.type_error(&format!( + "Cannot add property {k}, object is not extensible." + )) + } + + #[inline(never)] + pub fn set_elem(&mut self, v: &Value, k: &Value, val: Value) -> Result<(), Value> { + if let (Value::Obj(id), Value::Num(_) | Value::Sym(_)) = (v, k) + && self.is_namespace(*id) + { + return Err(self.namespace_key_error(*id)); + } + if let (Value::Obj(id), Value::Num(n)) = (v, k) { + let o = &mut self.heap[*id as usize]; + if o.flags == 0 + && let Kind::Array(items) = &mut o.kind + { + let i = *n as usize; + if i as f64 == *n && i < items.len() { + items[i] = val; + return Ok(()); + } + if i as f64 == *n && i == items.len() { + items.push(val); + return Ok(()); + } + } + } + // The reference resolves the base as a read does, so a nullish one fails as a read. + if v.is_nullish() { + let k = self.key_message(k); + let t = if let Value::Null = v { + "null" + } else { + "undefined" + }; + return Err(self.nullish_read(t, &k)); + } + let a = self.key_of(k)?; + self.set(v, a, val) + } + + /// Defines an own enumerable data property, as object literals do. + #[inline(never)] + pub fn define(&mut self, id: Id, key: Atom, val: Value) { + let index = self.atoms.index(key); + let o = &mut self.heap[id as usize]; + if let (Kind::Array(items), Some(i)) = (&mut o.kind, index) { + let i = i as usize; + if i < items.len() { + items[i] = val; + } else if i < MAX_ARRAY_LEN && o.flags & SPARSE == 0 { + items.resize(i, Value::Uninit); + items.push(val); + } else { + self.sparse_set(id, key, i, val); + } + return; + } + match o.props.find(key) { + Some(i) => { + o.props.items[i].value = val; + o.props.items[i].flags = DEFAULT_FLAGS; + } + None => o.props.push_new(key, val, DEFAULT_FLAGS), + } + } + + pub fn define_hidden(&mut self, id: Id, key: Atom, val: Value) { + self.heap[id as usize].props.insert(key, val, HIDDEN); + } + + #[inline(never)] + pub fn delete(&mut self, v: &Value, key: Atom) -> Result { + let Value::Obj(id) = v else { + return self.delete_primitive(v, key); + }; + let id = *id; + if exotic::is_exotic(&self.heap[id as usize].kind) + && let Some(r) = exotic::delete(self, id, key) + { + return r; + } + let flags = self.heap[id as usize].flags; + let index = self.atoms.index(key); + let (name, length) = (self.names.name, self.names.length); + let fixed = flags & (FROZEN | SEALED) != 0; + let own_fn_key = self.own_name_or_length(flags, key); + // Whether an own property is there that cannot be deleted; a missing one deletes fine. + let o = &mut self.heap[id as usize]; + let refused = match &mut o.kind { + Kind::Namespace(_) => return Err(self.invalid_data("Only data fields may be deleted.")), + Kind::Array(_) if key == length => true, + Kind::Array(items) | Kind::Arguments(items) if index.is_some() => { + match items.get_mut(index.unwrap_or_default() as usize) { + Some(Value::Uninit) => false, + // A sparse array's far element is a property. + None => fixed && o.props.find(key).is_some(), + Some(_) if fixed => true, + Some(slot) => { + *slot = Value::Uninit; + return Ok(true); + } + } + } + Kind::Closure(_) | Kind::Native { .. } if own_fn_key && o.props.find(key).is_none() => { + if !fixed { + o.flags |= if key == name { + NAME_DELETED + } else { + LENGTH_DELETED + }; + return Ok(true); + } + true + } + _ => o + .props + .find(key) + .is_some_and(|i| fixed || o.props.items[i].flags & FIXED != 0), + }; + if refused { + let k = self.key_text(key); + return Err(self.type_error(&format!("Cannot delete property '{k}'."))); + } + self.heap[id as usize].props.remove(key); + Ok(true) + } + + /// `delete` on a primitive deletes from its wrapper, whose only own properties are a string's indexes and + /// length. + fn delete_primitive(&mut self, v: &Value, key: Atom) -> Result { + let k = self.key_text(key); + match v { + Value::Undef | Value::Null | Value::Uninit => { + let t = if let Value::Null = v { + "null" + } else { + "undefined" + }; + Err(self.nullish_read(t, &k)) + } + Value::Str(s) + if key == self.names.length + || self + .atoms + .index(key) + .is_some_and(|i| (i as usize) < self.atoms.sref(*s).len16()) => + { + let mut quoted = String::new(); + crate::convert::quote(&mut quoted, self.text(*s)); + Err(self.type_error(&format!("Cannot delete property '{k}' of {quoted}."))) + } + Value::Sym(_) => { + Err(self.type_error("Cannot access a property on a non-object value.")) + } + _ => Ok(true), + } + } + + #[inline(never)] + pub fn has_property(&mut self, o: &Value, k: &Value) -> Result { + // The reference's `in`: a data object on the right and no namespace on the left, else an opaque operand is + // not data, else the right side is no object. + if let Value::Obj(id) = o + && !self.is_namespace(*id) + && !matches!(k, Value::Obj(kid) if self.is_namespace(*kid)) + { + let key = self.key_of(k)?; + return Ok(self.has_key(*id, key)); + } + if self.is_opaque_value(o) || self.is_opaque_value(k) { + return Err(self.invalid_data("Binary operators require data values.")); + } + Err(self.type_error("The 'in' operator requires a data object on the right-hand side.")) + } + + /// The reference's `isOpaque`: a function, a promise, a generator, an iterator or a namespace. + fn is_opaque_value(&self, v: &Value) -> bool { + matches!(v, Value::Obj(id) if { + let o = &self.heap[*id as usize]; + o.is_callable() || crate::cross::opaque(&o.kind) + }) + } + + pub fn has_key(&self, id: Id, key: Atom) -> bool { + let mut cur = id; + loop { + let o = &self.heap[cur as usize]; + match &o.kind { + Kind::Array(items) | Kind::Arguments(items) => { + if let Some(i) = self.atoms.index(key) { + if items + .get(i as usize) + .is_some_and(|v| !matches!(v, Value::Uninit)) + { + return true; + } + } else if key == self.names.length && matches!(o.kind, Kind::Array(_)) { + return true; + } + } + Kind::Closure(_) | Kind::Native { .. } if self.own_name_or_length(o.flags, key) => { + return true; + } + k if exotic::is_exotic(k) && exotic::has_own(self, cur, key) => return true, + _ => {} + } + if o.props.find(key).is_some() { + return true; + } + match o.proto { + Some(p) => cur = p, + None => return false, + } + } + } + + /// Whether a function still has its own `name` or `length` slot for `key`. + fn own_name_or_length(&self, flags: u8, key: Atom) -> bool { + (key == self.names.name && flags & NAME_DELETED == 0) + || (key == self.names.length && flags & LENGTH_DELETED == 0) + } + + pub fn has_own(&self, id: Id, key: Atom) -> bool { + let o = &self.heap[id as usize]; + match &o.kind { + Kind::Array(items) | Kind::Arguments(items) => { + if let Some(i) = self.atoms.index(key) { + // A sparse array keeps far elements as properties. + if items + .get(i as usize) + .is_some_and(|v| !matches!(v, Value::Uninit)) + { + return true; + } + } else if key == self.names.length && matches!(o.kind, Kind::Array(_)) { + return true; + } + } + Kind::Closure(_) | Kind::Native { .. } if self.own_name_or_length(o.flags, key) => { + return true; + } + k if exotic::is_exotic(k) && exotic::has_own(self, id, key) => return true, + _ => {} + } + o.props.find(key).is_some() + } + + #[inline(never)] + pub fn instance_of(&mut self, v: &Value, c: &Value) -> Result { + let Value::Obj(cid) = c else { + return Err(self.type_error("The right-hand side of 'instanceof' is not callable.")); + }; + if !self.is_callable(c) || self.is_namespace(*cid) { + return Err(self.type_error("The right-hand side of 'instanceof' is not callable.")); + } + let pk = self.names.prototype; + let Value::Obj(proto) = self.get_obj(*cid, pk) else { + return Err( + self.type_error("The right-hand side of 'instanceof' has no 'prototype' object.") + ); + }; + // A namespace is no object, so it has no prototype chain. + let Value::Obj(cur) = v else { return Ok(false) }; + if self.is_namespace(*cur) { + return Ok(false); + } + let mut cur = *cur; + while let Some(p) = self.heap[cur as usize].proto { + if p == proto { + return Ok(true); + } + cur = p; + } + Ok(false) + } + + /// An array's length; a sparse array keeps it as an own property. + #[inline] + pub fn array_len(&self, id: Id) -> usize { + let o = &self.heap[id as usize]; + match &o.kind { + Kind::Array(_) if o.flags & SPARSE != 0 => match o.props.get(self.names.length) { + Some(Value::Num(n)) => *n as usize, + _ => 0, + }, + Kind::Array(items) => items.len(), + _ => 0, + } + } + + /// Writes element `i` of an array past its items: a far element is an own property, which makes the array + /// sparse, and the length grows to cover it. + #[cold] + #[inline(never)] + fn sparse_set(&mut self, id: Id, key: Atom, i: usize, val: Value) { + let len = self.array_len(id); + let lk = self.names.length; + let o = &mut self.heap[id as usize]; + o.flags |= SPARSE; + o.props.insert(key, val, DEFAULT_FLAGS); + if i >= len { + o.props.insert(lk, Value::Num((i + 1) as f64), 0); + } + } + + /// The indexes and values of a sparse array's elements past its items, in index order. + pub fn sparse_tail(&self, id: Id) -> Vec<(usize, Value)> { + let o = &self.heap[id as usize]; + let mut tail: Vec<(usize, Value)> = o + .props + .items + .iter() + .filter_map(|p| Some((self.atoms.index(p.key)? as usize, p.value))) + .collect(); + tail.sort_unstable_by_key(|(i, _)| *i); + tail + } + + /// Makes a sparse array of length `n` (at most `MAX_ARRAY_LEN`) dense again, dropping elements at `n` and past. + #[cold] + #[inline(never)] + pub(crate) fn unsparse(&mut self, id: Id, n: usize) { + let tail = self.sparse_tail(id); + let lk = self.names.length; + let o = &mut self.heap[id as usize]; + let keys: Vec = o + .props + .items + .iter() + .filter(|p| p.key == lk || self.atoms.index(p.key).is_some()) + .map(|p| p.key) + .collect(); + for k in keys { + o.props.remove(k); + } + o.flags &= !SPARSE; + if let Kind::Array(items) = &mut o.kind { + items.resize(n, Value::Uninit); + for (i, v) in tail { + if i < n { + items[i] = v; + } + } + } + } + + /// Makes an array dense for code that walks its items, which fails when it is longer than an array may be. + #[inline] + pub fn densify(&mut self, id: Id) -> Result<(), Value> { + if self.heap[id as usize].flags & SPARSE == 0 { + return Ok(()); + } + self.densify_sparse(id) + } + + #[cold] + #[inline(never)] + fn densify_sparse(&mut self, id: Id) -> Result<(), Value> { + let n = self.array_len(id); + if n > MAX_ARRAY_LEN { + return Err(self.range_error("Invalid array length.")); + } + self.unsparse(id, n); + Ok(()) + } + + /// Own enumerable string keys in JavaScript order: integer keys ascending, then insertion order. + pub fn own_keys(&mut self, id: Id) -> Vec { + if self.is_namespace(id) { + return self.namespace_names(id).unwrap_or_default(); + } + let mut out = Vec::new(); + match &self.heap[id as usize].kind { + Kind::Array(items) | Kind::Arguments(items) => { + for (i, v) in items.iter().enumerate() { + if !matches!(v, Value::Uninit) { + out.push(self.atoms.intern(&i.to_string())); + } + } + } + k if exotic::is_exotic(k) => { + for i in 0..exotic::index_len(self, id) { + out.push(self.atoms.intern(&i.to_string())); + } + } + _ => {} + } + let props = &self.heap[id as usize].props; + let mut ints = Vec::new(); + let mut strs = Vec::new(); + for p in &props.items { + if p.flags & ENUMERABLE == 0 || p.key <= SYM_ASYNC_ITERATOR { + continue; + } + match self.atoms.index(p.key) { + Some(i) => ints.push((i, p.key)), + None => strs.push(p.key), + } + } + if !ints.is_empty() { + ints.sort_unstable_by_key(|(i, _)| *i); + out.extend(ints.into_iter().map(|(_, k)| k)); + } + // A function's `length` and `name` come first, where the reference makes them. + if matches!( + self.heap[id as usize].kind, + Kind::Closure(_) | Kind::Native { .. } + ) { + let (lk, nk) = (self.names.length, self.names.name); + let lead: Vec = [lk, nk].into_iter().filter(|k| strs.contains(k)).collect(); + strs.retain(|k| !lead.contains(k)); + out.extend(lead); + } + out.extend(strs); + out + } + + /// Own enumerable entries of an object in key order. + pub fn own_entries(&mut self, id: Id) -> Vec<(Atom, Value)> { + if let Kind::Ordinary | Kind::Error(_) = self.heap[id as usize].kind { + let props = &self.heap[id as usize].props; + let simple = props + .items + .iter() + .all(|p| self.atoms.index(p.key).is_none() && p.flags & ACCESSOR == 0); + if simple { + return props + .items + .iter() + .filter(|p| p.flags & ENUMERABLE != 0 && p.key > SYM_ASYNC_ITERATOR) + .map(|p| (p.key, p.value)) + .collect(); + } + } + let keys = self.own_keys(id); + keys.into_iter().map(|k| (k, self.get_obj(id, k))).collect() + } + + /// Own enumerable properties keyed by the two confined symbols, which spread and `Object.assign` copy too. + pub fn own_symbol_entries(&mut self, id: Id) -> Vec<(Atom, Value)> { + let keys: Vec = self.heap[id as usize] + .props + .items + .iter() + .filter(|p| p.key <= SYM_ASYNC_ITERATOR && p.flags & ENUMERABLE != 0) + .map(|p| p.key) + .collect(); + keys.into_iter().map(|k| (k, self.get_obj(id, k))).collect() + } + + /// CopyDataProperties from a source with program accessors (the reference's `$vmCopyDataProps`): its own keys + /// (strings and the iterator symbols, less `excluded`), each copied as data if it is enumerable when it is reached, + /// its getter called then, in key order. + pub(crate) fn copy_data_calling( + &mut self, + target: Id, + src: Id, + excluded: &[Atom], + strings_only: bool, + ) -> Result, Value> { + let keys = self.own_property_keys(src); + let mut out = Vec::new(); + for k in keys { + if (strings_only && k <= SYM_ASYNC_ITERATOR) || excluded.contains(&k) { + continue; + } + if !self.own_slot(src, k).is_some_and(|s| s.enumerable) { + continue; + } + let v = self.get_calling(src, k)?; + if target != 0 || !strings_only { + self.define(target, k, v); + } + out.push((k, v)); + } + Ok(out) + } + + /// A namespace path read with a number or a symbol, which the reference refuses. + #[cold] + pub(crate) fn namespace_key_error(&mut self, id: Id) -> Value { + let message = format!( + "{} paths must use string property names.", + self.namespace_root(id) + ); + let e = self.type_error(&message); + self.at_site(e, Site::Key) + } + + /// Reading `key` of a nullish base, which the reference reports at the member's object. + #[cold] + fn nullish_read(&mut self, t: &str, k: &str) -> Value { + let e = self.type_error(&format!("Cannot read properties of {t} (reading '{k}').")); + self.at_site(e, Site::Object) + } + + /// A member of a promise it doesn't have, read or written: a missing await, reported at the member's object. + #[cold] + fn unawaited(&mut self) -> Value { + let e = self.invalid_data(UNAWAITED); + self.at_site(e, Site::Object) + } + + /// The reference's `enumerableSource`: the value whose own enumerable properties `label` (`Object.keys(...)`, + /// `for...in`, `Object spread`, ...) reads. Null and undefined have none to read, and a promise or a namespace + /// is not data; anything else reads as its own properties (a primitive as an empty object, a string as its + /// characters). + #[inline(never)] + pub(crate) fn enumerable_source(&mut self, label: &str, v: &Value) -> Result<(), Value> { + match v { + Value::Null => { + Err(self.type_error(&format!("{label} cannot convert null to an object."))) + } + Value::Undef | Value::Uninit => { + Err(self.type_error(&format!("{label} cannot convert undefined to an object."))) + } + Value::Obj(id) if self.is_promise(*id) => Err(self.invalid_data(&format!( + "{label} received an un-awaited Promise; await it before inspecting the result." + ))), + Value::Obj(id) if self.is_namespace(*id) => { + let root = self.namespace_root(*id); + Err(self.invalid_data(&format!( + "{label} cannot read {root}: it is a namespace of host functions, not plain data. Use \ + Object.keys({root}) for its names." + ))) + } + _ => Ok(()), + } + } + + /// An object spread of `v` into `target`: null and undefined spread nothing. + #[inline(never)] + pub(crate) fn spread_props(&mut self, target: Id, v: &Value) -> Result<(), Value> { + if !v.is_nullish() { + self.enumerable_source("Object spread", v)?; + } + self.copy_props(target, v, &[]) + } + + /// An object rest pattern's properties of `v`, but `excluded`, copied into `target`. + #[inline(never)] + pub(crate) fn rest_props( + &mut self, + target: Id, + v: &Value, + excluded: &[Atom], + ) -> Result<(), Value> { + self.enumerable_source("Object destructuring", v)?; + self.copy_props(target, v, excluded) + } + + /// A `for...in` source: a namespace lists its names, and null and undefined iterate nothing. + #[inline(never)] + pub(crate) fn for_in_source(&mut self, v: &Value) -> Result<(), Value> { + match v { + Value::Obj(id) if self.is_namespace(*id) => Ok(()), + v if v.is_nullish() => Ok(()), + v => self.enumerable_source("for...in", v), + } + } + + /// The names under a namespace path, for `Object.keys` and `for...in`, or what listing them threw. + pub(crate) fn namespace_names(&mut self, id: Id) -> Result, Value> { + if !self.is_namespace(id) { + return Ok(Vec::new()); + } + let names = crate::host::namespace_keys(self, id)?; + Ok(names + .iter() + .map(|c| self.atoms.intern(&c.to_run_text())) + .collect()) + } + + /// The global a namespace path is under, which names it in messages. + pub(crate) fn namespace_root(&self, id: Id) -> String { + let root = self.ns_path(id).root; + self.atoms.text(root).to_owned() + } + + #[inline(never)] + pub fn copy_props(&mut self, target: Id, src: &Value, excluded: &[Atom]) -> Result<(), Value> { + match src { + Value::Obj(id) => { + if let Kind::Map(_) | Kind::Set(_) | Kind::Closure(_) | Kind::Native { .. } = + self.heap[*id as usize].kind + && self.heap[*id as usize].props.len() == 0 + { + return Ok(()); + } + if self.heap[*id as usize].flags & ACCESSORS != 0 { + self.copy_data_calling(target, *id, excluded, false)?; + return Ok(()); + } + let mut entries = self.own_entries(*id); + entries.extend(self.own_symbol_entries(*id)); + for (k, v) in entries { + if !excluded.contains(&k) { + self.define(target, k, v); + } + } + } + Value::Str(s) => { + let units = self.atoms.sref(*s).utf16(); + for (i, c) in units.iter().enumerate() { + let k = self.atoms.intern(&i.to_string()); + if !excluded.contains(&k) { + let v = self.char_str(*c); + self.define(target, k, v); + } + } + } + _ => {} + } + Ok(()) + } + + #[inline(never)] + pub fn for_in_keys(&mut self, v: &Value) -> Vec { + match v { + Value::Obj(id) => { + // Each level's own enumerable keys that no nearer level has as an own key of any kind. + let mut chain = vec![*id]; + let mut cur = self.heap[*id as usize].proto; + while let Some(p) = cur { + chain.push(p); + cur = self.heap[p as usize].proto; + } + let mut out: Vec = Vec::new(); + for (depth, level) in chain.iter().enumerate() { + for k in self.own_keys(*level) { + if !chain[..depth].iter().any(|n| self.has_own(*n, k)) { + out.push(k); + } + } + } + out.into_iter() + .map(|k| Value::Str(self.atoms.atom_str(k))) + .collect() + } + Value::Str(s) => { + let n = self.atoms.sref(*s).len16(); + (0..n).map(|i| self.string_val(i.to_string())).collect() + } + _ => Vec::new(), + } + } + + // ---------- conversions ---------- + + pub fn truthy(&self, v: &Value) -> bool { + match v { + Value::Bool(b) => *b, + Value::Num(n) => *n != 0.0 && !n.is_nan(), + Value::Str(s) => !self.atoms.get(*s).is_empty(), + Value::Obj(_) | Value::Sym(_) => true, + Value::Undef | Value::Null | Value::Uninit => false, + } + } + + pub fn is_callable(&self, v: &Value) -> bool { + match v { + Value::Obj(id) => self.heap[*id as usize].is_callable(), + _ => false, + } + } + + // Inlined in the dispatch loop (see `Vm::new_object`). + #[inline] + pub fn type_of(&self, v: &Value) -> &'static str { + match v { + Value::Undef | Value::Uninit => "undefined", + Value::Null => "object", + Value::Bool(_) => "boolean", + Value::Num(_) => "number", + Value::Str(_) => "string", + Value::Sym(_) => "symbol", + Value::Obj(_) => { + if self.is_callable(v) { + "function" + } else { + "object" + } + } + } + } + + /// A value's string for a message, made inline with a failure ignored: never a restartable conversion, whose + /// request an ignored failure would leave behind (see `conversion.rs`). + pub(crate) fn quiet_string(&mut self, v: &Value) -> String { + let ok = std::mem::replace(&mut self.convert_ok, false); + let s = self + .string_of(v) + .map(|s| self.text(s).to_owned()) + .unwrap_or_default(); + self.convert_ok = ok; + s + } + + #[inline(never)] + pub fn number_of(&mut self, v: &Value) -> Result { + Ok(match v { + Value::Num(n) => *n, + Value::Str(s) => str_to_num(self.atoms.get(*s)), + Value::Bool(b) => *b as u8 as f64, + Value::Null => 0.0, + Value::Undef | Value::Uninit => f64::NAN, + Value::Sym(_) => { + return Err(self.type_error("Cannot convert a symbol to a number")); + } + Value::Obj(id) => { + // A namespace is not an object to the reference: it converts without a call, as "[object Object]". + if self.is_namespace(*id) || self.is_promise(*id) { + return Ok(f64::NAN); + } + let p = self.primitive_of(v, Hint::Number)?; + return self.number_of(&p); + } + }) + } + + #[inline(never)] + pub fn string_of(&mut self, v: &Value) -> Result { + Ok(match v { + Value::Str(s) => *s, + Value::Num(n) => { + if *n >= 0.0 && *n < 10.0 && n.fract() == 0.0 { + return Ok(self.char_strs[b'0' as usize + *n as usize]); + } + if self.atoms.bufs.len() >= crate::vm::MAX_STRINGS { + self.out_of_memory(); + } + self.atoms.alloc_num(*n) + } + Value::Bool(b) => return Ok(self.static_id(if *b { "true" } else { "false" })), + Value::Null => return Ok(self.static_id("null")), + Value::Undef | Value::Uninit => return Ok(self.static_id("undefined")), + // The reference's ToString of a symbol is its host's `String`, which names it. + Value::Sym(s) => return Ok(self.static_id(symbol_text(*s))), + Value::Obj(id) => { + if self.is_namespace(*id) { + return Ok(self.static_id("[object Object]")); + } + // A promise converts without consulting its methods (`$vmToPrimitive` keeps it). + if self.is_promise(*id) { + return Ok(self.static_id("[object Promise]")); + } + let p = self.primitive_of(v, Hint::String)?; + return self.string_of(&p); + } + }) + } + + pub fn map_key(&mut self, v: &Value) -> MapKey { + match v { + Value::Undef | Value::Uninit => MapKey::Undef, + Value::Null => MapKey::Null, + Value::Bool(b) => MapKey::Bool(*b), + Value::Num(n) => { + let n = if *n == 0.0 { 0.0 } else { *n }; + MapKey::Num(if n.is_nan() { + f64::NAN.to_bits() + } else { + n.to_bits() + }) + } + Value::Str(s) => MapKey::Str(self.atoms.intern_id(*s)), + Value::Obj(id) => MapKey::Obj(*id), + Value::Sym(s) => MapKey::Sym(*s), + } + } + + /// A Map or Set key as its entry keeps it: a string as its atom's own string, so the entry keeps the atom, and + /// with it the key's hash, alive. + pub fn map_entry_key(&self, key: MapKey, k: Value) -> Value { + match key { + MapKey::Str(a) => self.atom_val(a), + _ => k, + } + } + + pub fn static_id(&mut self, s: &str) -> StrId { + let a = self.atoms.intern(s); + self.atoms.atom_str(a) + } + + /// ToPrimitive. The reference runs it in its internal bytecode (`$vmToPrimitive`), entered for one unit, and + /// calls `toString` and `valueOf` as bytecode calls them (see `builtins/fuel.rs`). + pub fn primitive_of(&mut self, v: &Value, hint: Hint) -> Res { + let Value::Obj(id) = v else { + return Ok(*v); + }; + // A namespace is not an object to the reference's `$vmToPrimitive`: it stays as it is, for nothing. + if self.is_namespace(*id) { + return Ok(*v); + } + if self.convert_ok + && let Some(r) = self.restartable_conversion(v, hint) + { + return r; + } + self.fuel(1); + // `$vmToPrimitive` keeps a promise, so that what reads it rejects it as an un-awaited value. + if self.is_promise(*id) { + return Ok(*v); + } + let hint = if hint == Hint::Default && exotic::prefers_string(self, *id) { + Hint::String + } else { + hint + }; + let order = if hint == Hint::String { + [self.names.to_string, self.names.value_of] + } else { + [self.names.value_of, self.names.to_string] + }; + for name in order { + let f = self.get_calling(*id, name)?; + if self.is_callable(&f) { + let r = self.call_counted(&f, *v, &[])?; + if !matches!(r, Value::Obj(_)) { + return Ok(r); + } + } + } + Err(self.type_error("Cannot convert object to primitive value.")) + } + + /// An operand of a binary operator that converts its operands: once either is an object, the reference's + /// `$vmBinary` runs ToPrimitive on both, so a primitive costs its call too. + #[inline] + pub fn op_primitive(&mut self, v: &Value, other: &Value, hint: Hint) -> Res { + if !matches!(v, Value::Obj(_)) && matches!(other, Value::Obj(_)) { + self.fuel(1); + } + self.primitive_of(v, hint) + } + + /// `op_primitive` as a number. + #[inline(never)] + pub fn op_number(&mut self, v: &Value, other: &Value) -> Result { + let p = self.op_primitive(v, other, Hint::Number)?; + self.number_of(&p) + } + + /// `Strings::concat_num`, counted against the strings a run may make. + #[inline] + fn concat_num(&mut self, s: StrId, n: f64, num_first: bool) -> Option { + if self.atoms.bufs.len() >= crate::vm::MAX_STRINGS { + return None; + } + self.atoms.concat_num(s, n, num_first).map(Value::Str) + } + + fn concat(&mut self, x: &str, y: &str) -> Res { + if x.len() + y.len() > MAX_STRING_LEN { + return Err(self.range_error("Invalid string length")); + } + let mut s = String::with_capacity(x.len() + y.len()); + s.push_str(x); + s.push_str(y); + Ok(self.string_val(s)) + } + + fn concat_ids(&mut self, x: StrId, y: StrId) -> Res { + if self.atoms.get(x).len() + self.atoms.get(y).len() > MAX_STRING_LEN { + return Err(self.range_error("Invalid string length")); + } + Ok(self.concat_strs(&[x, y])) + } + + #[inline(never)] + pub fn add(&mut self, a: Value, b: Value) -> Res { + match (&a, &b) { + (Value::Num(x), Value::Num(y)) => return Ok(Value::Num(x + y)), + (Value::Str(x), Value::Str(y)) => return self.concat_ids(*x, *y), + (Value::Str(x), Value::Num(y)) => { + if let Some(s) = self.concat_num(*x, *y, false) { + return Ok(s); + } + let y = self.string_of(&Value::Num(*y))?; + return self.concat_ids(*x, y); + } + (Value::Num(x), Value::Str(y)) => { + if let Some(s) = self.concat_num(*y, *x, true) { + return Ok(s); + } + let x = num_to_string(*x); + let y = self.atoms.get(*y).to_owned(); + return self.concat(&x, &y); + } + _ => {} + } + self.data_operands(&a, &b)?; + let pa = self.op_primitive(&a, &b, Hint::Default)?; + let pb = self.op_primitive(&b, &a, Hint::Default)?; + if matches!(pa, Value::Str(_)) || matches!(pb, Value::Str(_)) { + // The host's `+`, unlike its `String`, refuses to make a symbol text. + if matches!(pa, Value::Sym(_)) || matches!(pb, Value::Sym(_)) { + return Err(self.type_error("Cannot convert a symbol to a string")); + } + let x = self.string_of(&pa)?; + let y = self.string_of(&pb)?; + return self.concat_ids(x, y); + } + Ok(Value::Num(self.number_of(&pa)? + self.number_of(&pb)?)) + } + + /// The generic form of an operator fused with an immediate operand. + #[inline(never)] + pub fn arith(&mut self, op: crate::bytecode::Arith, a: Value, b: Value) -> Res { + use crate::bytecode::Arith as A; + if !matches!(op, A::Add | A::StrictEq | A::StrictNe) { + self.data_operands(&a, &b)?; + } + Ok(match op { + A::Add => return self.add(a, b), + A::Sub | A::Mul | A::Div | A::Mod => { + let x = self.op_number(&a, &b)?; + let y = self.op_number(&b, &a)?; + Value::Num(match op { + A::Sub => x - y, + A::Mul => x * y, + A::Div => x / y, + _ => crate::vm::js_rem(x, y), + }) + } + A::Lt => Value::Bool(self.less_than(&a, &b, true)?.unwrap_or(false)), + A::Gt => Value::Bool(self.less_than(&b, &a, false)?.unwrap_or(false)), + A::Le => Value::Bool(self.less_than(&b, &a, false)?.is_some_and(|v| !v)), + A::Ge => Value::Bool(self.less_than(&a, &b, true)?.is_some_and(|v| !v)), + A::StrictEq => Value::Bool(self.strict_eq(&a, &b)), + A::StrictNe => Value::Bool(!self.strict_eq(&a, &b)), + }) + } + + /// IsLessThan: `None` when either side is NaN. + #[inline(never)] + pub fn less_than( + &mut self, + a: &Value, + b: &Value, + left_first: bool, + ) -> Result, Value> { + let (pa, pb) = if left_first { + let pa = self.op_primitive(a, b, Hint::Number)?; + (pa, self.op_primitive(b, a, Hint::Number)?) + } else { + let pb = self.op_primitive(b, a, Hint::Number)?; + (self.op_primitive(a, b, Hint::Number)?, pb) + }; + if let (Value::Str(x), Value::Str(y)) = (&pa, &pb) { + return Ok(Some(self.atoms.sref(*x).cmp16(self.atoms.sref(*y)).is_lt())); + } + let x = self.number_of(&pa)?; + let y = self.number_of(&pb)?; + if x.is_nan() || y.is_nan() { + return Ok(None); + } + Ok(Some(x < y)) + } + + #[inline(never)] + pub fn loose_eq(&mut self, a: &Value, b: &Value) -> Result { + Ok(match (a, b) { + (Value::Undef | Value::Null, Value::Undef | Value::Null) => true, + (Value::Undef | Value::Null, _) | (_, Value::Undef | Value::Null) => false, + (Value::Num(x), Value::Str(s)) | (Value::Str(s), Value::Num(x)) => { + *x == str_to_num(self.atoms.get(*s)) + } + (Value::Str(x), Value::Str(y)) => self.atoms.get(*x) == self.atoms.get(*y), + (Value::Bool(x), _) => { + let n = Value::Num(*x as u8 as f64); + return self.loose_eq(&n, b); + } + (_, Value::Bool(y)) => { + let n = Value::Num(*y as u8 as f64); + return self.loose_eq(a, &n); + } + (Value::Obj(_), Value::Num(_) | Value::Str(_) | Value::Sym(_)) => { + let p = self.primitive_of(a, Hint::Default)?; + self.fuel(1); + if let Value::Obj(_) = p { + return Ok(false); + } + return self.loose_eq(&p, b); + } + (Value::Num(_) | Value::Str(_) | Value::Sym(_), Value::Obj(_)) => { + self.fuel(1); + let p = self.primitive_of(b, Hint::Default)?; + if let Value::Obj(_) = p { + return Ok(false); + } + return self.loose_eq(a, &p); + } + _ => self.strict_eq(a, b), + }) + } + + #[cfg(feature = "test262")] + pub fn error_text(&mut self, e: &Value) -> String { + if let Value::Obj(id) = e + && let Kind::Error(_) = self.heap[*id as usize].kind + { + let m = self.names.message; + if let Value::Str(s) = self.get_obj(*id, m) { + return self.text(s).to_owned(); + } + } + crate::convert::format_value(self, e) + } + + // ---------- iteration ---------- + + #[inline(never)] + pub fn iterate_to_vec(&mut self, v: &Value) -> Result, Value> { + if let Value::Obj(id) = v { + match &self.heap[*id as usize].kind { + Kind::Array(_) if self.heap[*id as usize].flags & SPARSE != 0 => { + if self.array_len(*id) > MAX_ARRAY_LEN { + return Err(self.range_error("Invalid array length")); + } + self.densify(*id)?; + return self.iterate_to_vec(v); + } + Kind::Array(items) => return Ok(without_holes(items)), + Kind::Set(m) => { + return Ok(m.iter().map(|(k, _)| *k).collect()); + } + Kind::Generator(GenState::Suspended(_)) => return self.collect_generator(*id), + _ => {} + } + } + if let Value::Str(s) = v { + let text = self.atoms.get(*s).to_owned(); + let mut out = Vec::new(); + let mut at = 0; + while let Some(cp) = crate::strings::code_point_at(&text, at) { + at += cp.len(); + out.push(match cp.as_bytes() { + [b] if *b < 128 => Value::Str(self.char_strs[*b as usize]), + _ => self.str_val(cp), + }); + } + return Ok(out); + } + let it = self.get_iterator(v)?; + let next = self.record_next_of(v, &it)?; + let mut out = Vec::new(); + while let Some(x) = self.iter_step_with(&it, next)? { + if out.len() >= MAX_ARRAY_LEN { + return Err(self.range_error("Invalid array length")); + } + out.push(x); + } + Ok(out) + } + + /// Calls an iterator method that is present, which must be a function returning an object with a `next` + /// method. + fn open_with(&mut self, f: &Value, v: &Value) -> Res { + if !self.is_callable(f) { + return Err(self.type_error("Iterator method must be a function.")); + } + let it = self.call(f, *v, &[])?; + let Value::Obj(id) = it else { + return Err(self.type_error("Iterator method result must be an object.")); + }; + let nk = self.names.next; + let next = self.get_calling(id, nk)?; + if !self.is_callable(&next) { + return Err(self.type_error("Iterator next must be a function.")); + } + // The `next` read, for the record its caller keeps (`Vm::record_next_of`): a getter is called once. + self.opened_next = Some((id, next)); + Ok(it) + } + + /// GetIterator, with the error for a value that is not iterable worded for where it is iterated. + pub fn get_iterator_in(&mut self, v: &Value, ctx: u8) -> Res { + if !self.is_iterable(v) { + return Err(self.not_iterable(v, ctx)); + } + self.get_iterator(v) + } + + /// Whether `v` has a sync iterator to get. + pub fn is_iterable(&mut self, v: &Value) -> bool { + match v { + Value::Str(_) => true, + Value::Obj(id) => match &self.heap[*id as usize].kind { + Kind::Array(_) + | Kind::Arguments(_) + | Kind::Map(_) + | Kind::Set(_) + | Kind::Generator(_) + | Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } => true, + _ => { + self.has_program_getter(*id, SYM_ITERATOR) + || !self.get_obj(*id, SYM_ITERATOR).is_nullish() + } + }, + _ => false, + } + } + + /// How the reference names a value in a data error: `a data object`, `a function`, `null`, `a Date`. + pub fn describe_data(&self, v: &Value) -> String { + crate::builtins::describe_value(self, v) + } + + pub fn not_iterable(&mut self, v: &Value, ctx: u8) -> Value { + use crate::bytecode::{ITER_DELEGATE, ITER_DESTRUCTURE, ITER_FOR_AWAIT, ITER_SPREAD}; + match ctx { + ITER_DESTRUCTURE => { + self.type_error("Array destructuring requires a supported iterable value.") + } + ITER_DELEGATE => self.type_error("yield* requires a compatible iterable value."), + ITER_SPREAD => self.type_error("Spread requires a synchronous iterable."), + _ => { + let what = if ctx == ITER_FOR_AWAIT { + "for await...of" + } else { + "for...of" + }; + let d = self.describe_data(v); + self.invalid_data(&format!("{what} requires an iterable value, received {d}.")) + } + } + } + + #[inline(never)] + pub fn get_iterator(&mut self, v: &Value) -> Res { + let proto = self.realm.iter_proto; + match v { + Value::Obj(id) => { + if let Kind::Arguments(_) = self.heap[*id as usize].kind { + // Like the reference: the values of its enumerable own keys when iteration starts. + let items: std::sync::Arc<[Value]> = + self.own_entries(*id).into_iter().map(|(_, v)| v).collect(); + let it = Kind::ListIter { items, pos: 0 }; + return Ok(Value::Obj(self.alloc(Obj::new(Some(proto), it)))); + } + let kind = match &self.heap[*id as usize].kind { + Kind::Array(_) => Some(Kind::ArrayIter { + target: *id, + pos: 0, + kind: IterKind::Values, + }), + Kind::Map(_) => Some(Kind::MapIter { + target: *id, + pos: 0, + kind: IterKind::Entries, + }), + Kind::Set(_) => Some(Kind::MapIter { + target: *id, + pos: 0, + kind: IterKind::Values, + }), + Kind::Generator(_) + | Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } => return Ok(*v), + _ => None, + }; + if let Some(k) = kind { + return Ok(Value::Obj(self.alloc(Obj::new(Some(proto), k)))); + } + let f = self.get_calling(*id, SYM_ITERATOR)?; + if !f.is_nullish() { + return self.open_with(&f, v); + } + } + Value::Str(s) => { + return Ok(Value::Obj( + self.alloc(Obj::new(Some(proto), Kind::StrIter { s: *s, pos: 0 })), + )); + } + _ => {} + } + // Where the reference iterates in its prelude, a value with no iterator fails its `for...of`. + Err(self.not_iterable(v, crate::bytecode::ITER_FOR_OF)) + } + + /// A `yield*` step on an iterator the VM runs itself, as a value and a done flag: `Ok(None)` for any other + /// iterator, `Ok(Some(None))` when it lacks the `throw` or `return` method asked for. A suspended generator is + /// resumed in a frame (`Vm::resume_delegate_by_frame`), which hands its answer to the instruction itself: the + /// caller sees `Vm::entered`. + #[inline(never)] + pub fn sync_delegate_step( + &mut self, + it: Value, + kind: u8, + received: Value, + ) -> Result>, Value> { + let Value::Obj(id) = it else { return Ok(None) }; + match &self.heap[id as usize].kind { + Kind::Generator(state) => { + let mode = match kind { + REQ_NEXT => 0, + REQ_RETURN => 1, + _ => 2, + }; + // The reference's `throw` or `return` here is the generator's native method, which costs fifty + // unless it throws before the body runs (a running generator, or a finished one asked to throw). + // `next` was charged by the caller. + let charged = kind != REQ_NEXT; + if matches!(state, GenState::Suspended(_)) { + if charged { + self.fuel(NATIVE_FUEL); + } + self.resume_delegate_by_frame(id, mode, received)?; + return Ok(Some(Some((Value::Undef, false)))); + } + let step = self.resume_generator(id, mode, received)?; + if charged { + self.fuel(NATIVE_FUEL); + } + Ok(Some(Some(step))) + } + Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } + | Kind::ExoticIter { .. } => { + if kind != REQ_NEXT { + return Ok(Some(None)); + } + Ok(Some(Some(match self.iter_step(&it)? { + Some(v) => (v, false), + None => (Value::Undef, true), + }))) + } + _ => Ok(None), + } + } + + /// Calls an iterator's `next`, `throw` or `return` for `yield*` or `for await`, returning its result; `None` when + /// `throw` or `return` is missing. A method of the program's is called by a frame, which pushes the result for + /// the instruction itself: the caller sees `Vm::entered`. + #[inline(never)] + pub fn delegate_call( + &mut self, + it: Value, + kind: u8, + arg: Option, + cached_next: Value, + ) -> Result, Value> { + if let Value::Obj(id) = it + && let Kind::AsyncFromSync { sync, next } = self.heap[id as usize].kind + { + // The adapter's `throw` and `return` are natives, each called for fifty (`next` was charged by the caller). + if kind != REQ_NEXT { + self.fuel(NATIVE_FUEL); + } + return self.async_from_sync_call(sync, next, kind, arg).map(Some); + } + let m = if kind == REQ_NEXT && !cached_next.is_nullish() { + cached_next + } else { + let name = self.request_name(kind); + self.get_calling_value(&it, name)? + }; + if kind != REQ_NEXT && m.is_nullish() { + return Ok(None); + } + if kind != REQ_NEXT && !self.is_callable(&m) { + let name = self.request_name(kind); + let name = self.atoms.text(name).to_owned(); + return Err(self.type_error(&format!("Iterator {name} must be a function."))); + } + if self.calls_program(&m) { + self.delegate_by_call(m, it, arg)?; + return Ok(Some(Value::Undef)); + } + // A native `throw` or `return` costs fifty, before an async generator's body it resumes runs. + if kind != REQ_NEXT { + self.fuel(NATIVE_FUEL); + } + let args: &[Value] = match &arg { + Some(a) => std::slice::from_ref(a), + None => &[], + }; + self.call(&m, it, args).map(Some) + } + + /// Whether a call of `f` as bytecode makes it runs a closure (through any bound functions), which costs one + /// unit rather than a native's fifty. + #[inline] + pub(crate) fn calls_closure(&self, f: &Value) -> bool { + let mut f = *f; + while let Value::Obj(id) = f { + match &self.heap[id as usize].kind { + Kind::Closure(_) => return true, + Kind::Bound(b) => f = b.0, + _ => return false, + } + } + false + } + + fn request_name(&mut self, kind: u8) -> Atom { + match kind { + REQ_NEXT => self.names.next, + REQ_RETURN => self.names.return_, + _ => self.atoms.intern_static("throw"), + } + } + + /// The `value` and `done` of the result of an iterator's `next`, `throw` or `return` (`REQ_*`), which must be + /// an object. + pub fn iter_result_parts(&mut self, r: &Value, kind: u8) -> Result<(Value, bool), Value> { + let Value::Obj(rid) = r else { + let name = self.request_name(kind); + let name = self.atoms.text(name).to_owned(); + return Err(self.type_error(&format!("Iterator {name}() result must be an object."))); + }; + let (dk, vk) = (self.names.done, self.names.value); + let d = self.get_calling(*rid, dk)?; + let done = self.truthy(&d); + Ok((self.get_calling(*rid, vk)?, done)) + } + + /// GetIterator for `for await` (`ITER_FOR_AWAIT`) or an async generator's `yield*` (`ITER_DELEGATE`), with the + /// async hint: `[Symbol.asyncIterator]()`, or the sync iterator adapted. A method of the program's is called by a + /// frame, which writes the instruction's iterator record in `slot` itself: the caller sees `Vm::entered`. + #[inline(never)] + pub fn get_async_iterator(&mut self, v: &Value, ctx: u8, slot: u32) -> Res { + if let Value::Obj(id) = v { + let f = self.get_calling(*id, SYM_ASYNC_ITERATOR)?; + if !f.is_nullish() { + if self.calls_program(&f) { + return self.open_async_by_call(f, *v, slot, None); + } + // The reference calls the method as bytecode calls it. + let it = self.open_with(&f, v)?; + if !self.is_closure(&f) { + self.fuel(NATIVE_FUEL); + } + return Ok(it); + } + } + // Anything but a value the reference walks itself it opens in its internal bytecode + // (`$vmOpenSyncForAsync`), entered for one unit, which calls the `Symbol.iterator` method. + let open = self.open_fuel(v, ITER_FOR_OF); + if !self.walks(v) && self.is_iterable(v) { + self.fuel(1); + } + if self.is_iterable(v) + && let Some(method) = self.program_iterator_method(v) + { + let method = method?; + if self.calls_program(&method) { + return self.open_async_by_call(method, *v, slot, Some(open)); + } + } + let Value::Obj(sync) = self.get_iterator_in(v, ctx)? else { + return Err(self.type_error("Iterator method result must be an object.")); + }; + self.fuel(open); + let next = self.record_next_of(v, &Value::Obj(sync))?; + let proto = self.realm.async_from_sync_proto; + Ok(Value::Obj(self.alloc(Obj::new( + Some(proto), + Kind::AsyncFromSync { sync, next }, + )))) + } + + /// The promise of an async-from-sync iterator's `next`, `throw` or `return`. A step that calls the program or + /// resumes a generator is taken by a frame (`Vm::adapt_by_frame`), which hands the promise to the instruction + /// itself: the caller sees `Vm::entered`. + fn async_from_sync_call(&mut self, sync: Id, next: Value, kind: u8, arg: Option) -> Res { + let made = self.new_promise(); + let sv = Value::Obj(sync); + let step = match kind { + REQ_NEXT => self.sync_step(made, sync, arg, next), + _ => { + let name = self.request_name(kind); + let m = self.get_calling(sync, name)?; + if m.is_nullish() { + if kind == REQ_RETURN { + let r = self.iter_result(arg.unwrap_or_default(), true); + self.resolve_promise(made, r); + return Ok(Value::Obj(made)); + } + let rk = self.names.return_; + let generator = matches!( + self.heap[sync as usize].kind, + Kind::Generator(GenState::Suspended(_)) + ); + let ret = match self.heap[sync as usize].kind { + // A suspended generator closes through its own `return`, from a frame, for nothing. + Kind::Generator(GenState::Suspended(_)) => self.get_obj(sync, rk), + Kind::Generator(_) + | Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } => Value::Undef, + _ => self.get_obj(sync, rk), + }; + let closed = if generator || self.calls_program(&ret) { + match self.adapt_by_frame(BY_CLOSE, made, sync, kind, None, ret) { + Ok(_) => return Ok(Value::Undef), + Err(e) => Err(e), + } + } else { + self.iter_close(&sv) + }; + let e = match closed { + Err(e) => e, + Ok(()) => self.type_error( + "The delegated iterator does not provide a throw() method.", + ), + }; + self.reject(made, e); + return Ok(Value::Obj(made)); + } + if self.calls_program(&m) { + self.adapt_by_frame(BY_UNCOUNTED, made, sync, kind, arg, m) + .map(|_| None) + } else if matches!( + self.heap[sync as usize].kind, + Kind::Generator(GenState::Suspended(_)) + ) { + // A generator's own method runs its body: from a frame, as bytecode calls it. + self.adapt_by_frame(BY_COUNTED, made, sync, kind, arg, m) + .map(|_| None) + } else { + let args: &[Value] = match &arg { + Some(a) => std::slice::from_ref(a), + None => &[], + }; + // `$vmAsyncFromSync` calls it as bytecode calls it. + self.call_counted(&m, sv, args) + .and_then(|r| self.iter_result_parts(&r, kind)) + .map(Some) + } + } + }; + let Some(step) = step.transpose() else { + return Ok(Value::Undef); + }; + self.settle_from_sync(made, sync, kind, step)?; + Ok(Value::Obj(made)) + } + + /// One `next` on a sync iterator, as a value and a done flag, or `None` once a frame takes it for the promise + /// `made` (a call of the program's `next`, a generator resumed). The reference's `$vmAsyncFromSync` calls it as + /// bytecode calls it, except on an iterator it walks itself: a generator's or helper's native `next` costs its + /// fifty before the body runs. + fn sync_step( + &mut self, + made: Id, + sync: Id, + arg: Option, + next: Value, + ) -> Result, Value> { + let it = Value::Obj(sync); + let generator = matches!( + self.heap[sync as usize].kind, + Kind::Generator(_) | Kind::IterHelper(_) + ); + if generator { + self.fuel(NATIVE_FUEL); + } + if next.is_nullish() { + if matches!( + self.heap[sync as usize].kind, + Kind::Generator(GenState::Suspended(_)) + ) { + self.adapt_by_frame(BY_RESUME, made, sync, REQ_NEXT, arg, Value::Undef)?; + return Ok(None); + } + if let Some(Some(step)) = + self.sync_delegate_step(it, REQ_NEXT, arg.unwrap_or_default())? + { + return Ok(Some(step)); + } + } + let m = if next.is_nullish() { + let nk = self.names.next; + self.get_calling_value(&it, nk)? + } else { + next + }; + if self.calls_program(&m) { + let how = if generator { BY_UNCOUNTED } else { BY_COUNTED }; + self.adapt_by_frame(how, made, sync, REQ_NEXT, arg, m)?; + return Ok(None); + } + let args: &[Value] = match &arg { + Some(a) => std::slice::from_ref(a), + None => &[], + }; + let r = if generator { + self.call(&m, it, args)? + } else { + self.call_counted(&m, it, args)? + }; + self.iter_result_parts(&r, REQ_NEXT).map(Some) + } + + /// Starts closing an async iterator: the result of its `return()`, or `None` when it has none. A `return` of the + /// program's is called by a frame, which pushes the result for the instruction itself: the caller sees + /// `Vm::entered`. + #[inline(never)] + pub fn async_close(&mut self, it: Value) -> Result, Value> { + match it { + Value::Undef | Value::Null => Ok(None), + Value::Obj(id) + if !matches!(self.heap[id as usize].kind, Kind::AsyncFromSync { .. }) => + { + let rk = self.names.return_; + let m = self.get_calling_value(&it, rk)?; + if m.is_nullish() { + return Ok(None); + } + if !self.is_callable(&m) { + return Err(self.type_error("Iterator return must be a function.")); + } + if self.calls_program(&m) { + self.delegate_by_call(m, it, None)?; + return Ok(Some(Value::Undef)); + } + // The reference calls it as bytecode calls it. + self.call_counted(&m, it, &[]).map(Some) + } + _ => self.delegate_call(it, REQ_RETURN, None, Value::Undef), + } + } + + #[inline(never)] + pub fn iter_step(&mut self, it: &Value) -> Result, Value> { + self.iter_step_with(it, Value::Undef) + } + + /// The `next` method of an iterator the VM does not run itself, read once when it opens, as iterator records + /// keep it; `Undef` for any other iterator. + pub fn record_next(&mut self, it: &Value) -> Res { + let Value::Obj(id) = it else { + return Ok(Value::Undef); + }; + match self.heap[*id as usize].kind { + Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } + | Kind::ExoticIter { .. } + | Kind::Generator(_) + | Kind::AsyncFromSync { .. } => Ok(Value::Undef), + _ => { + let next = self.names.next; + self.get_calling_value(it, next) + } + } + } + + /// One iterator step, calling `next` (when not `Undef`) instead of reading the iterator's `next` again. A built-in + /// iterator is stepped directly only when its record keeps no `next` (see `Vm::record_next_of`). + #[inline(never)] + pub fn iter_step_with(&mut self, it: &Value, next: Value) -> Result, Value> { + let Value::Obj(id) = it else { return Ok(None) }; + let id = *id; + let direct = next.is_nullish(); + match &self.heap[id as usize].kind { + Kind::ArrayIter { target, pos, kind } if direct => { + let (target, pos, kind) = (*target, *pos as usize, *kind); + let item = match &self.heap[target as usize].kind { + Kind::Array(items) | Kind::Arguments(items) => { + items.get(pos).map(|v| match v { + Value::Uninit => Value::Undef, + v => *v, + }) + } + _ => None, + }; + let item = match item { + None if self.heap[target as usize].flags & SPARSE != 0 + && pos < self.array_len(target) => + { + Some(self.inherited_elem(target, pos).unwrap_or_default()) + } + item => item, + }; + let step = if item.is_some() { 1 } else { u32::MAX }; + if let Kind::ArrayIter { pos: p, .. } = &mut self.heap[id as usize].kind { + *p = p.saturating_add(step); + } + let Some(v) = item else { return Ok(None) }; + Ok(Some(match kind { + IterKind::Values => v, + IterKind::Keys => Value::Num(pos as f64), + IterKind::Entries => self.new_array(vec![Value::Num(pos as f64), v]), + })) + } + Kind::MapIter { target, pos, kind } if direct => { + let (target, mut at, kind) = (*target, *pos, *kind); + let target = &self.heap[target as usize].kind; + let is_set = matches!(target, Kind::Set(_)); + let entry = match target { + Kind::Map(m) | Kind::Set(m) => m.next_entry(&mut at), + _ => None, + }; + if let Kind::MapIter { pos: p, .. } = &mut self.heap[id as usize].kind { + *p = if entry.is_some() { at } else { u64::MAX }; + } + let Some((k, v)) = entry else { return Ok(None) }; + let v = if is_set { k } else { v }; + Ok(Some(match kind { + IterKind::Keys => k, + IterKind::Values => v, + IterKind::Entries => self.new_array(vec![k, v]), + })) + } + Kind::StrIter { s, pos } if direct => { + let p = *pos as usize; + let Some(cp) = crate::strings::code_point_at(self.atoms.get(*s), p) else { + return Ok(None); + }; + let step = cp.len() as u32; + let v = match cp.as_bytes() { + [b] if *b < 128 => self.char_str(*b as u16), + _ => { + let cp = cp.to_owned(); + self.string_val(cp) + } + }; + if let Kind::StrIter { pos, .. } = &mut self.heap[id as usize].kind { + *pos += step; + } + Ok(Some(v)) + } + Kind::ListIter { items, pos } if direct => { + let v = items.get(*pos as usize).cloned(); + if v.is_some() + && let Kind::ListIter { pos, .. } = &mut self.heap[id as usize].kind + { + *pos += 1; + } + Ok(v) + } + Kind::Generator(_) => { + let (v, done) = self.resume_generator(id, 0, Value::Undef)?; + Ok(if done { None } else { Some(v) }) + } + _ => { + let f = if next.is_nullish() { + let nk = self.names.next; + self.get_calling(id, nk)? + } else { + next + }; + // The reference steps its own iterators and helpers without a call; any other `next` is called as + // bytecode calls it. + let r = if match self.heap[id as usize].kind { + Kind::IterHelper(_) => true, + Kind::ExoticIter { .. } => direct, + _ => false, + } { + self.call(&f, *it, &[])? + } else { + self.call_counted(&f, *it, &[])? + }; + let Value::Obj(rid) = r else { + return Err(self.type_error("Iterator next() result must be an object.")); + }; + let done = self.names.done; + let d = self.get_calling(rid, done)?; + if self.truthy(&d) { + return Ok(None); + } + let value = self.names.value; + Ok(Some(self.get_calling(rid, value)?)) + } + } + } + + #[inline(never)] + pub fn iter_close(&mut self, it: &Value) -> Result<(), Value> { + let Value::Obj(id) = it else { return Ok(()) }; + let id = *id; + match &self.heap[id as usize].kind { + Kind::Generator(GenState::Suspended(_)) => { + self.resume_generator(id, 1, Value::Undef)?; + Ok(()) + } + Kind::Generator(_) + | Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } => Ok(()), + _ => { + let ret = self.names.return_; + let f = self.get_calling(id, ret)?; + if f.is_nullish() { + return Ok(()); + } + if !self.is_callable(&f) { + return Err(self.type_error("Iterator return must be a function.")); + } + let r = self.call(&f, *it, &[])?; + if !matches!(r, Value::Obj(_)) { + return Err(self.type_error("Iterator return() result must be an object.")); + } + Ok(()) + } + } + } +} + +/// An array's items with each hole read as `undefined`, as spreading and iterating read them. +pub fn without_holes(items: &[Value]) -> Vec { + let mut out = items.to_vec(); + for v in &mut out { + if let Value::Uninit = v { + *v = Value::Undef; + } + } + out +} + +/// How the reference's host names one of its two symbols. +pub(crate) fn symbol_text(s: Atom) -> &'static str { + if s == SYM_ITERATOR { + "Symbol(codemode.iterator)" + } else { + "Symbol(codemode.async-iterator)" + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/program.rs b/packages/codemode-rust/crates/psychoscript/src/program.rs new file mode 100644 index 0000000000000..71a086d01b789 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/program.rs @@ -0,0 +1,675 @@ +//! One run of a program, the counterpart of the reference's `runtime.program(...)`: nothing runs until it is driven, +//! and it is driven to its end, or to a suspend, on the calling thread or as a future. + +use std::fmt; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::{Arc, Condvar, Mutex}; +use std::task::{Context, Poll, Waker}; +use std::time::{Duration, Instant}; + +use crate::exec; +use crate::offload; +use crate::run; +use crate::runtime::ProgramOptions; +use crate::snapshot::{self, Refusal, Snapshot}; +use crate::vm::Vm; +use crate::{Code, Interrupted, Outcome, Runtime}; + +enum State { + Running(Box), + /// Computing on the program's worker thread. + Away, + /// It ended before running: the program did not compile. + Failed(Box), + Done, +} + +pub(crate) struct Running { + pub vm: Vm, + pub code: Arc, + started: bool, + timer_armed: bool, + /// Active time earlier runs of the same execution used, before a resume. + pub active_before: Duration, + /// Back-edges until the next round trip, in the round-trip test mode. + round_trip_every: u32, + /// Round trips still to skip after one that saved a large state. + skip: u32, +} + +/// How a run ended: with its outcome, or suspended with its saved state. +#[derive(Clone, Debug)] +pub enum RunOutcome { + Done(Outcome), + Suspended(Suspended), +} + +/// A suspended run: its state, which [`Runtime::resume`] continues, here or in another process built from the same +/// version. +#[derive(Clone, Debug)] +pub struct Suspended { + pub state: Snapshot, +} + +/// A call that keeps a run from suspending. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct RunningCall { + /// The call's key, `:`. + pub key: String, + /// How the program names the function: `fetch`, `fs.readFile`, `api.issues.list`. + pub path: String, +} + +/// Why a suspend was refused: a host call that can't be detached is running, or the state can't be saved. The run +/// goes on untouched. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct SuspendError { + pub message: String, + pub running: Vec, +} + +impl fmt::Display for SuspendError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(&self.message) + } +} + +impl std::error::Error for SuspendError {} + +impl SuspendError { + fn running(running: Vec) -> Self { + let paths: Vec<&str> = running.iter().map(|c| c.path.as_str()).collect(); + let verb = if paths.len() == 1 { "is" } else { "are" }; + Self { + message: format!( + "The run can't be suspended while {} {verb} running.", + paths.join(", ") + ), + running, + } + } + + fn other(message: String) -> Self { + Self { + message, + running: Vec::new(), + } + } +} + +/// What a run shares with its suspenders: the pending request, the synchronous call in progress, and the answer. +#[derive(Default)] +pub struct Shared { + pub(crate) requested: AtomicBool, + /// Whether anyone can suspend the run, so synchronous calls only record themselves when it matters. + watched: AtomicBool, + inner: Mutex, + answered: Condvar, +} + +#[derive(Default)] +struct Inner { + /// `Some(max_bytes)` while a suspend waits for the run. + request: Option>, + reply: Option>, + sync_call: Option, + waker: Option, + finished: Option, +} + +impl Shared { + fn lock(&self) -> std::sync::MutexGuard<'_, Inner> { + self.inner.lock().unwrap_or_else(|e| e.into_inner()) + } + + fn set_waker(&self, waker: &Waker) { + if self.watched.load(Ordering::Relaxed) { + self.lock().waker = Some(waker.clone()); + } + } + + /// The pending request, if any: its byte limit. + fn take_request(&self) -> Option> { + let mut inner = self.lock(); + let r = inner.request.take(); + if r.is_some() { + self.requested.store(false, Ordering::Relaxed); + } + r + } + + fn answer(&self, reply: Result) { + self.lock().reply = Some(reply); + self.answered.notify_all(); + } + + fn finish(&self, outcome: &RunOutcome) { + let mut inner = self.lock(); + inner.finished = Some(outcome.clone()); + if inner.request.take().is_some() { + inner.reply = Some(Ok(outcome.clone())); + } + self.requested.store(false, Ordering::Relaxed); + drop(inner); + self.answered.notify_all(); + } +} + +impl crate::host::SuspendWatch for Shared { + fn requested(&self) -> bool { + self.requested.load(Ordering::Relaxed) + } + + fn watched(&self) -> bool { + self.watched.load(Ordering::Relaxed) + } + + fn enter_sync(&self, key: String, path: String) { + self.lock().sync_call = Some(RunningCall { key, path }); + } + + fn leave_sync(&self) { + if self.watched.load(Ordering::Relaxed) { + self.lock().sync_call = None; + } + } +} + +/// Suspends a run from another thread, the counterpart of the reference's `program.suspend()`. +#[derive(Clone)] +pub struct Suspender(Arc); + +impl Suspender { + /// Saves the run's state and stops it at its next step boundary; the run then returns the same + /// [`RunOutcome::Suspended`]. It waits for the run to start and to reach that boundary. It fails with a + /// [`SuspendError`], leaving the run running, while a host call that can't be suspended is in progress (a + /// synchronous one, an async one that isn't idempotent, a durable one still in `start`, or one holding host + /// functions), or when the state can't be saved or takes more than `max_bytes`. A run that already ended gives + /// its outcome. + pub fn suspend(&self, max_bytes: Option) -> Result { + let shared = &self.0; + let mut inner = shared.lock(); + if let Some(done) = &inner.finished { + return Ok(done.clone()); + } + if let Some(call) = &inner.sync_call { + return Err(SuspendError::running(vec![call.clone()])); + } + inner.request = Some(max_bytes); + inner.reply = None; + shared.requested.store(true, Ordering::Relaxed); + if let Some(w) = inner.waker.take() { + w.wake(); + } + loop { + if let Some(reply) = inner.reply.take() { + return reply; + } + if let Some(done) = &inner.finished { + return Ok(done.clone()); + } + if let Some(call) = &inner.sync_call { + let call = call.clone(); + inner.request = None; + shared.requested.store(false, Ordering::Relaxed); + return Err(SuspendError::running(vec![call])); + } + inner = shared + .answered + .wait_timeout(inner, Duration::from_millis(5)) + .map(|(g, _)| g) + .unwrap_or_else(|e| e.into_inner().0); + } + } +} + +/// A program ready to run once. Dropping it interrupts the run and cancels every host call in flight. +pub struct Program<'a> { + rt: &'a Runtime, + state: State, + shared: Arc, + /// Driven as a future, so a long stretch of compute moves to a worker thread instead of holding the executor's. + offload: bool, + worker: Option, + /// The stretch of compute in progress continues on the worker. + move_away: bool, +} + +impl<'a> Program<'a> { + /// Compiles the program and sets up its globals; nothing runs yet. + pub(crate) fn new(rt: &'a Runtime, code: Code<'_>, options: &ProgramOptions) -> Self { + let started = run::start(rt, code, options); + let state = match started { + Ok(r) => State::Running(r), + Err(outcome) => State::Failed(outcome), + }; + Self::with(rt, state) + } + + fn with(rt: &'a Runtime, mut state: State) -> Self { + let shared = Arc::::default(); + if let State::Running(r) = &mut state { + r.vm.host.shared = shared.clone(); + } + Self { + rt, + state, + shared, + offload: false, + worker: None, + move_away: false, + } + } + + /// A program continuing a suspended run's state, checked against this runtime. + pub(crate) fn resume( + rt: &'a Runtime, + state: &Snapshot, + ) -> Result { + let running = restore(rt, state)?; + Ok(Self::with(rt, State::Running(running))) + } + + /// What suspends this run from another thread. + pub fn suspender(&self) -> Suspender { + self.shared.watched.store(true, Ordering::Relaxed); + Suspender(self.shared.clone()) + } + + /// Runs the program to its end on the calling thread, blocking on asynchronous host work. A host call can + /// interrupt the run instead ([`HostFunction`](crate::HostFunction)). A program suspended through a + /// [`Suspender`] needs [`Program::run_resumable`], which returns its state; this one reports a failure. + pub fn run(self) -> Result { + self.run_resumable().map(done_or_suspended) + } + + /// Runs the program as a future on any executor. Asynchronous host calls run on that executor; a timeout wakes + /// the run from a shared timer thread. Dropping the future interrupts the run and every host call in flight. A + /// stretch of compute longer than a millisecond continues on a worker thread, so the executor's thread is free + /// meanwhile; every host function, namespace and accessor still runs on the executor. + pub async fn run_async(self) -> Result { + self.run_resumable_async().await.map(done_or_suspended) + } + + /// Runs the program to its end or until a [`Suspender`] stops it, on the calling thread. + pub fn run_resumable(mut self) -> Result { + exec::block_on(std::future::poll_fn(|cx| self.advance(cx))) + } + + /// [`Program::run_resumable`] as a future, which moves long stretches of compute as [`Program::run_async`] does. + pub async fn run_resumable_async(mut self) -> Result { + self.offload = true; + std::future::poll_fn(|cx| self.advance(cx)).await + } + + fn advance(&mut self, cx: &mut Context<'_>) -> Poll> { + let probe = 0u8; + if let State::Failed(_) = self.state { + let State::Failed(outcome) = std::mem::replace(&mut self.state, State::Done) else { + unreachable!() + }; + let outcome = RunOutcome::Done(*outcome); + self.shared.finish(&outcome); + return Poll::Ready(Ok(outcome)); + } + loop { + // Back from a stretch of compute on the worker, or still away running its host code. + let computed = matches!(self.state, State::Away); + if computed { + let Some(worker) = &self.worker else { + unreachable!("a run is only away on its worker") + }; + match worker.poll(cx) { + Poll::Ready(r) => self.state = State::Running(r), + Poll::Pending => return Poll::Pending, + } + } + let State::Running(r) = &mut self.state else { + return Poll::Pending; + }; + if !computed { + // Between jobs no native frame of the run is on the stack, so it may continue from wherever it is polled. + r.vm.stack_base = &probe as *const u8 as usize; + r.vm.stack_budget = run::RUN_STACK_BUDGET; + if r.vm.check_time().is_err() { + break; + } + if self.offload { + r.vm.host.offload().at = Some(Instant::now() + offload::OFFLOAD_AFTER); + } + if !r.started { + r.started = true; + r.vm.start = Instant::now() + .checked_sub(r.active_before) + .unwrap_or_else(Instant::now); + if round_trips(&self.shared) { + r.vm.start_roundtrip(r.round_trip_every); + } + snapshot::restart_calls(&mut r.vm); + if r.vm.frames.is_empty() && !r.resumed() { + run::call_main(&mut r.vm); + } + } + for (p, s) in r.vm.host.tasks.poll_ready() { + r.vm.host.settled(p); + if let crate::host::Settlement::Interrupted = s { + crate::host::interrupt(&mut r.vm); + } + r.vm.inbox.push_back((p, s)); + } + let away = std::mem::take(&mut self.move_away); + if let Some(worker) = self.worker.as_ref().filter(|_| away) { + r.vm.host.offload().at = None; + let State::Running(r) = std::mem::replace(&mut self.state, State::Away) else { + unreachable!() + }; + worker.compute(r); + continue; + } + let _ = r.vm.continue_frames(); + if !r.vm.suspended { + let _ = r.vm.drive(); + } + // The stop for the host is a safe point: a step that came due on the way finishes here. + if r.vm.gc_pending() && r.vm.fatal.is_none() { + r.vm.gc_point(); + } + #[cfg(feature = "gc-stats")] + r.vm.publish_stats(); + if let Some(o) = &mut r.vm.host.offload { + o.at = None; + } + } + // The run stopped: the reference's driver starts the host calls queued so far. + if !r.vm.host.queued.is_empty() { + crate::host::launch(&mut r.vm); + if r.vm.outcome.is_none() && r.vm.fatal.is_none() && !r.vm.suspended { + continue; + } + } + if r.vm.outcome.is_some() || r.vm.fatal.is_some() { + break; + } + // A stop to move only: the stretch continues on the worker, and the next one starts here again. A suspend at + // the same stop goes first. + if r.vm.suspended + && r.vm + .host + .offload + .as_mut() + .is_some_and(|o| std::mem::take(&mut o.due)) + && !self.shared.requested.load(Ordering::Relaxed) + { + r.vm.suspended = false; + r.vm.suspend_wanted = false; + if self.worker.is_none() { + self.worker = offload::Worker::spawn().ok(); + } + self.move_away = self.worker.is_some(); + self.offload = self.move_away; + continue; + } + if r.vm.suspended { + match self.checkpoint() { + Some(done) => return Poll::Ready(Ok(done)), + None => continue, + } + } + let State::Running(r) = &mut self.state else { + return Poll::Pending; + }; + if r.vm.host.tasks.has_ready() { + continue; + } + if round_trips(&self.shared) && !r.vm.host.calls.is_empty() { + // A host stop: save and restore before waiting. + r.vm.suspend_wanted = true; + r.vm.suspended = true; + if let Some(done) = self.checkpoint() { + return Poll::Ready(Ok(done)); + } + let State::Running(r) = &mut self.state else { + return Poll::Pending; + }; + r.vm.suspended = false; + r.vm.suspend_wanted = false; + } + let State::Running(r) = &mut self.state else { + return Poll::Pending; + }; + r.vm.host.tasks.set_parent(Some(cx.waker())); + self.shared.set_waker(cx.waker()); + if self.shared.requested.load(Ordering::Relaxed) { + continue; + } + if !r.timer_armed + && let Some(ms) = r.vm.limits.timeout_ms + { + r.timer_armed = true; + exec::wake_at( + r.vm.start + Duration::from_millis(ms), + &r.vm.host.tasks.parent_waker(), + ); + } + // A task may have finished between the poll and handing over the waker. + if r.vm.host.tasks.has_ready() { + continue; + } + return Poll::Pending; + } + let State::Running(r) = std::mem::replace(&mut self.state, State::Done) else { + unreachable!() + }; + if r.vm.host.interrupted { + drop(r); + self.shared + .finish(&RunOutcome::Done(run::failed_interrupted())); + return Poll::Ready(Err(Interrupted)); + } + let outcome = RunOutcome::Done(run::finish(*r)); + self.shared.finish(&outcome); + Poll::Ready(Ok(outcome)) + } + + /// The run stopped at a safe point: answer a suspend, or make a round trip. Returns the outcome when the run is + /// suspended for good; otherwise the run goes on. + fn checkpoint(&mut self) -> Option { + let State::Running(r) = &mut self.state else { + return None; + }; + r.vm.suspended = false; + r.vm.suspend_wanted = false; + // The reference hands queued calls to its driver at every stop, before anyone can suspend the run. + crate::host::launch(&mut r.vm); + let request = self.shared.take_request(); + if request.is_none() && r.skip > 0 { + r.skip -= 1; + return None; + } + let start = r.vm.start; + let active_ms = start.elapsed().max(r.active_before).as_millis() as u64; + let captured = snapshot::capture( + &r.vm, + &snapshot::Capture { + code: &r.code, + active_ms, + }, + ); + match request { + Some(max_bytes) => { + let result = captured + .map_err(|refusal| match refusal { + Refusal::Running(calls) => SuspendError::running( + calls + .into_iter() + .map(|(call, path)| RunningCall { + key: r.vm.host.key(call), + path, + }) + .collect(), + ), + Refusal::Other(message) => SuspendError::other(format!( + "The run's state couldn't be saved: {message}" + )), + }) + .and_then(|state| { + let size = snapshot::to_bytes(&state).len(); + match max_bytes { + Some(max) if size > max => Err(SuspendError::other(format!( + "The run's state takes {size} bytes, more than the {max}-byte limit, so it couldn't be suspended." + ))), + _ => Ok(state), + } + }); + match result { + Ok(state) => { + let outcome = RunOutcome::Suspended(Suspended { state }); + self.detach(); + self.shared.answer(Ok(outcome.clone())); + self.shared.finish(&outcome); + Some(outcome) + } + Err(e) => { + self.shared.answer(Err(e)); + None + } + } + } + None => { + // The round-trip test mode: continue from the state, in a brand-new VM. + let Ok(state) = captured else { + return None; + }; + // A call whose function can't be found again holds live host values: as the reference does, the + // round trip waits until it completes. + if r.vm.host.calls.iter().any(|c| c.path.is_none()) { + return None; + } + let bytes = snapshot::to_bytes(&state); + // A large state skips the next round trips in proportion to its size, as the reference's round-trip + // mode does (at a quarter of its rate, to keep more points): a deep or heavy run still round-trips + // its large states without paying for it at every point. + let saved = r.vm.heap.len().saturating_sub(r.vm.snapshot_base.heap); + let skip = (saved / 800 + bytes.len() / 400_000) as u32; + let state = snapshot::from_bytes(&bytes).ok()?; + match restore(self.rt, &state) { + Ok(mut fresh) => { + fresh.vm.host.shared = self.shared.clone(); + // A round trip is not a pause: the run's clock keeps its start, which the header would + // round to whole milliseconds. + fresh.active_before = start.elapsed(); + // Twice as long each time, so a long loop takes a few round trips, not thousands. + fresh.round_trip_every = + r.round_trip_every.saturating_mul(2).min(ROUNDTRIP_MAX); + fresh.skip = skip; + self.detach(); + self.state = State::Running(fresh); + None + } + Err(e) => { + let State::Running(r) = &mut self.state else { + return None; + }; + r.vm.fatal = Some(( + crate::DiagnosticKind::ExecutionFailure, + format!("Round trip failed: {}", e.message), + )); + None + } + } + } + } + } + + /// Detaches the run's calls before its state is dropped for a suspend: idempotent calls are interrupted, durable + /// ones are left running, and each sees that the run is suspending. + fn detach(&mut self) { + let State::Running(r) = &mut self.state else { + return; + }; + r.vm.host.suspending.store(true, Ordering::Relaxed); + for call in &r.vm.host.calls { + call.detached.store(true, Ordering::Relaxed); + } + r.vm.host.calls.clear(); + r.vm.host.tasks.clear(); + } +} + +impl Drop for Program<'_> { + /// A run away on its worker is asked to stop at its next safe point and comes back, so it ends here, where its + /// host calls are cancelled. + fn drop(&mut self) { + let Some(worker) = self.worker.take() else { + return; + }; + if let State::Away = self.state { + self.shared.requested.store(true, Ordering::Relaxed); + drop(worker.reclaim()); + } + } +} + +fn done_or_suspended(o: RunOutcome) -> Outcome { + match o { + RunOutcome::Done(o) => o, + RunOutcome::Suspended(_) => run::failed_suspended(), + } +} + +/// Rebuilds a suspended run in a fresh VM of this runtime. +fn restore(rt: &Runtime, state: &Snapshot) -> Result, snapshot::SnapshotError> { + let restored = snapshot::header(state)?; + let active_ms = restored.active_ms; + let mut started = run::start_for_resume(rt, restored)?; + snapshot::restore(&mut started.running.vm, state, &started.bytecode)?; + let mut r = started.running; + r.active_before = Duration::from_millis(active_ms); + // The program's body already started: what runs next comes from the saved frames and jobs. + r.mark_resumed(); + Ok(r) +} + +impl Running { + pub fn new(vm: Vm, code: Arc) -> Self { + Self { + vm, + code, + started: false, + timer_armed: false, + active_before: Duration::ZERO, + round_trip_every: ROUNDTRIP_TICKS, + skip: 0, + } + } + + fn resumed(&self) -> bool { + self.vm.resumed + } + + fn mark_resumed(&mut self) { + self.vm.resumed = true; + } +} + +/// Round-trip mode leaves alone a program that has a `Suspender`: its owner suspends it. +fn round_trips(shared: &Shared) -> bool { + roundtrip() && !shared.watched.load(Ordering::Relaxed) +} + +/// Whether the round-trip test mode is on: every run is saved to bytes and restored into a brand-new VM at every +/// host stop and after 64 loop iterations, then 128, 256 and so on, proving its state is plain data. Internal; tests turn it on with +/// `PSYCHOSCRIPT_ROUNDTRIP=1`. +fn roundtrip() -> bool { + static ON: std::sync::OnceLock = std::sync::OnceLock::new(); + *ON.get_or_init(|| std::env::var_os("PSYCHOSCRIPT_ROUNDTRIP").is_some_and(|v| v == "1")) +} + +const ROUNDTRIP_TICKS: u32 = 64; +const ROUNDTRIP_MAX: u32 = 1 << 16; + +// A run's state may move to another thread between steps. +const _: () = { + const fn send() {} + send::() +}; diff --git a/packages/codemode-rust/crates/psychoscript/src/promise.rs b/packages/codemode-rust/crates/psychoscript/src/promise.rs new file mode 100644 index 0000000000000..2156ed0116289 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/promise.rs @@ -0,0 +1,778 @@ +//! Promises and the job queue, following the ECMAScript reaction and thenable-job ordering. + +use crate::native::{Frame, Input, Step}; +use crate::object::*; +use crate::value::{Id, Slot, Value}; +use crate::vm::{Job, NATIVE_FUEL, REQ_NEXT, REQ_RETURN, REQ_THROW, Reaction, Res, Vm}; + +/// What a `Settle` frame's call is for (see `settle_step`). +pub(crate) const THEN: usize = 0; +pub(crate) const FINALLY: usize = 1; +pub(crate) const THENABLE: usize = 2; +pub(crate) const EXECUTOR: usize = 3; +pub(crate) const TRY: usize = 4; +/// A thenable whose `then` is a program getter: the getter runs in this job, then `then` as a `THENABLE` would, +/// as the reference's `$vmThenableGet`. +pub(crate) const THENABLE_GET: usize = 5; + +// The slots of a `Settle` frame: its kind; the promise it settles (for a thenable job, the resolve function); for a +// thenable job or an executor the reject function, for a `finally` the outcome it restores (its kind, then its value), +// and for `Promise.try` whether its call was counted; then the call: callee, receiver, argument count and arguments. +const SETTLE_KIND: usize = 0; +const SETTLE_TARGET: usize = 1; +const SETTLE_A: usize = 2; +const SETTLE_B: usize = 3; +const SETTLE_F: usize = 4; +const SETTLE_THIS: usize = 5; +const SETTLE_ARGC: usize = 6; +const SETTLE_ARGS: usize = 7; + +/// Pushes a `Settle` frame for a promise handler, a `finally` cleanup, a thenable job's `then`, an executor or a +/// `Promise.try` callback: it calls `f` as the reference enters it (`Step::CallSettling`), then settles with how it +/// ended. +#[allow(clippy::too_many_arguments)] +pub(crate) fn enter_settle( + vm: &mut Vm, + callee: Value, + kind: usize, + target: Value, + a: Value, + b: Value, + f: Value, + this: Value, + args: &[Value], +) -> Res { + let mut slots = vec![ + Value::Num(kind as f64), + target, + a, + b, + f, + this, + Value::Num(args.len() as f64), + ]; + slots.extend_from_slice(args); + vm.enter_native_with( + crate::native::NativeOp::Settle, + 0, + callee, + Value::Undef, + &slots, + ) +} + +/// The step of a `Settle` frame. +pub(crate) fn settle_step(vm: &mut Vm, fr: Frame, input: Input) -> Result { + let kind = fr.index(vm, SETTLE_KIND); + let target = fr.get(vm, SETTLE_TARGET); + let outcome = match input { + Input::Start => { + let (f, this, argc) = ( + fr.slot(vm, SETTLE_F), + fr.slot(vm, SETTLE_THIS), + fr.index(vm, SETTLE_ARGC), + ); + let at = fr.base() + SETTLE_ARGS; + let args: Vec<_> = vm.stack[at..at + argc].to_vec(); + return Ok(fr.catching_list(vm, f, this, &args, Step::CallSettling)); + } + Input::Returned(r) if kind == THENABLE_GET => { + let then = r.get(); + let res = target; + if vm.is_callable(&then) { + fr.set_index(vm, SETTLE_KIND, THENABLE); + let (this, rej) = (fr.slot(vm, SETTLE_THIS), fr.slot(vm, SETTLE_B)); + return Ok(fr.catching_list( + vm, + Slot::pack(then), + this, + &[Slot::pack(res), rej], + Step::CallSettling, + )); + } + // Fulfilled with the thenable itself, without adopting it again. + if let Some(q) = res.as_obj().and_then(|r| vm.take_resolver(r)) { + let thenable = fr.get(vm, SETTLE_THIS); + vm.fulfill(q, thenable); + } + return Ok(Step::Done(Value::Undef)); + } + Input::Returned(r) => Ok(r.get()), + Input::Threw(e) => Err(e), + Input::Finished(_) => return Ok(Step::Done(Value::Undef)), + }; + let p = target.as_obj().unwrap_or(0); + match (kind, outcome) { + (THEN, Ok(r)) | (TRY, Ok(r)) => vm.resolve_promise(p, r), + (THEN, Err(e)) | (TRY, Err(e)) | (FINALLY, Err(e)) => vm.reject(p, e), + (FINALLY, Ok(r)) => { + // As the spec chains `then(valueThunk)` onto the cleanup's promise, the reference passes its outcome + // through one more promise, a job later. + let value = fr.get(vm, SETTLE_B); + let restored = match fr.index(vm, SETTLE_A) { + 0 => Ok(value), + _ => Err(value), + }; + let q = vm.promise_resolve(r); + let cleaned = vm.new_promise(); + vm.perform_then(q, Reaction::Resolve(cleaned)); + vm.perform_then( + cleaned, + Reaction::Restore { + derived: p, + outcome: restored, + }, + ); + } + (THENABLE, Err(e)) | (THENABLE_GET, Err(e)) => { + if let Some(q) = vm.take_resolver(p) { + vm.reject(q, e); + } + } + (EXECUTOR, Err(e)) => { + let rej = fr.get(vm, SETTLE_A); + vm.call(&rej, Value::Undef, &[e])?; + } + _ => {} + } + Ok(Step::Done(match kind { + EXECUTOR => target, + TRY => { + if fr.index(vm, SETTLE_B) != 0 { + vm.bytecode_builtin(); + } + target + } + _ => Value::Undef, + })) +} + +impl Vm { + pub fn new_promise(&mut self) -> Id { + let proto = self.realm.promise_proto; + self.alloc(Obj::new( + Some(proto), + Kind::Promise(Box::new(PromiseData { + state: PromiseState::Pending, + reactions: Vec::new(), + })), + )) + } + + pub fn as_promise(&self, v: &Value) -> Option { + match v { + Value::Obj(id) if matches!(self.heap[*id as usize].kind, Kind::Promise(_)) => Some(*id), + _ => None, + } + } + + pub fn is_pending(&self, p: Id) -> bool { + matches!(&self.heap[p as usize].kind, Kind::Promise(d) if matches!(d.state, PromiseState::Pending)) + } + + pub fn settle(&mut self, p: Id, outcome: Result) { + let Kind::Promise(d) = &mut self.heap[p as usize].kind else { + return; + }; + if !matches!(d.state, PromiseState::Pending) { + return; + } + d.state = match &outcome { + Ok(v) => PromiseState::Fulfilled(*v), + Err(e) => PromiseState::Rejected(*e), + }; + let reactions = std::mem::take(&mut d.reactions); + if let Err(e) = outcome + && reactions.is_empty() + { + crate::host::unhandled(self, p, e); + } + for r in reactions { + self.jobs.push_back(Job::Reaction(r, outcome)); + } + } + + pub fn fulfill(&mut self, p: Id, v: Value) { + self.settle(p, Ok(v)); + } + + pub fn reject(&mut self, p: Id, e: Value) { + self.settle(p, Err(e)); + } + + pub fn perform_then(&mut self, p: Id, reaction: Reaction) { + let Kind::Promise(d) = &mut self.heap[p as usize].kind else { + return; + }; + let outcome = match &d.state { + PromiseState::Pending => { + d.reactions.push(reaction); + return; + } + PromiseState::Fulfilled(v) => Ok(*v), + PromiseState::Rejected(e) => Err(*e), + }; + if outcome.is_err() { + crate::host::handled(self, p); + } + self.jobs.push_back(Job::Reaction(reaction, outcome)); + } + + /// A promise's resolve function: adopts thenables through a job, fulfills with anything else. + pub fn resolve_promise(&mut self, p: Id, v: Value) { + if !self.is_pending(p) { + return; + } + if let Value::Obj(id) = v { + if id == p { + let e = self.type_error("Chaining cycle detected for promise #"); + self.reject(p, e); + return; + } + // A namespace is no object to the reference, so never a thenable, though `then` names a path in it. + let namespace = matches!(self.heap[id as usize].kind, Kind::Namespace(_)); + let then_key = self.names.then; + if !namespace && self.has_program_getter(id, then_key) { + self.jobs.push_back(Job::Thenable { + promise: p, + thenable: v, + then: Value::Undef, + }); + return; + } + let then = if namespace { + Value::Undef + } else { + self.get_obj(id, then_key) + }; + if self.is_callable(&then) { + self.jobs.push_back(Job::Thenable { + promise: p, + thenable: v, + then, + }); + return; + } + } + self.fulfill(p, v); + } + + /// `Promise.resolve`: a promise passes through, anything else is wrapped. + pub fn promise_resolve(&mut self, v: Value) -> Id { + if let Some(p) = self.as_promise(&v) { + return p; + } + let p = self.new_promise(); + self.resolve_promise(p, v); + p + } + + pub fn await_value(&mut self, v: Value, c: u32) { + let p = self.promise_resolve(v); + self.perform_then(p, Reaction::Await(c)); + } + + pub fn create_resolvers(&mut self, p: Id) -> (Value, Value) { + let proto = self.realm.object_proto; + let state = self.alloc(Obj::new( + Some(proto), + Kind::Resolvers { + promise: p, + done: false, + }, + )); + let resolve = self.native_fn("", 1, resolver_resolve, Value::Obj(state)); + let reject = self.native_fn("", 1, resolver_reject, Value::Obj(state)); + (resolve, reject) + } + + /// Runs the native frame a job pushed, as the base of a run that may stop for a suspend and continue later. + fn run_job_frame(&mut self) -> Result<(), Value> { + self.take_entered(); + self.resumable_run = true; + let r = self.run(); + self.resumable_run = false; + r.map(|_| ()) + } + + /// Marks a resolver pair used; returns its promise if this is the first use. + pub(crate) fn take_resolver(&mut self, callee: Id) -> Option { + let Kind::Native { + data: Value::Obj(state), + .. + } = &self.heap[callee as usize].kind + else { + return None; + }; + let state = *state; + match &mut self.heap[state as usize].kind { + Kind::Resolvers { promise, done } if !*done => { + *done = true; + Some(*promise) + } + _ => None, + } + } + + pub fn run_job(&mut self, job: Job) -> Result<(), Value> { + match job { + Job::Thenable { + promise, + thenable, + then, + } => { + if let Value::Undef = then { + // A program `then` getter (see `resolve_promise`). + let (res, rej) = self.create_resolvers(promise); + let getter = match thenable { + Value::Obj(id) => self + .accessor_on_chain(id, self.names.then) + .map_or(Value::Undef, |a| a.get), + _ => Value::Undef, + }; + enter_settle( + self, + Value::Undef, + THENABLE_GET, + res, + res, + rej, + getter, + thenable, + &[], + )?; + return self.run_job_frame(); + } + let intrinsic = matches!(then, Value::Obj(t) if t == self.realm.promise_then); + if intrinsic && let Some(q) = self.as_promise(&thenable) { + self.perform_then(q, Reaction::Resolve(promise)); + return Ok(()); + } + let (res, rej) = self.create_resolvers(promise); + enter_settle( + self, + Value::Undef, + THENABLE, + res, + rej, + Value::Undef, + then, + thenable, + &[res, rej], + )?; + self.run_job_frame() + } + Job::Reaction(reaction, outcome) => self.run_reaction(reaction, outcome), + } + } + + fn run_reaction( + &mut self, + reaction: Reaction, + outcome: Result, + ) -> Result<(), Value> { + match reaction { + Reaction::Then { + on_ful, + on_rej, + derived, + } => { + let (handler, arg, ok) = match outcome { + Ok(v) => (on_ful, v, true), + Err(e) => (on_rej, e, false), + }; + if self.is_callable(&handler) { + let d = Value::Obj(derived); + enter_settle( + self, + Value::Undef, + THEN, + d, + Value::Undef, + Value::Undef, + handler, + Value::Undef, + &[arg], + )?; + return self.run_job_frame(); + } else if ok { + self.fulfill(derived, arg); + } else { + self.reject(derived, arg); + } + Ok(()) + } + Reaction::Await(c) => { + self.resumable_run = true; + let r = self.resume_coroutine(c, outcome); + self.resumable_run = false; + r + } + Reaction::Resolve(target) => { + self.settle(target, outcome); + Ok(()) + } + Reaction::Comb { comb, index } => { + self.combinator_step(comb, index as usize, outcome); + Ok(()) + } + Reaction::Finally { cleanup, derived } => { + let (failed, value) = match outcome { + Ok(v) => (0.0, v), + Err(e) => (1.0, e), + }; + let d = Value::Obj(derived); + enter_settle( + self, + Value::Undef, + FINALLY, + d, + Value::Num(failed), + value, + cleanup, + Value::Undef, + &[], + )?; + self.run_job_frame() + } + Reaction::Restore { + derived, + outcome: original, + } => { + match outcome { + Ok(_) => self.settle(derived, original), + Err(e) => self.reject(derived, e), + } + Ok(()) + } + Reaction::AwaitGen(g) => { + self.resumable_run = true; + let r = self.run_async_generator(g, REQ_NEXT, outcome, true); + self.resumable_run = false; + r + } + Reaction::GenReturn(g) => { + self.async_generator_finish(g, outcome); + Ok(()) + } + Reaction::FromSync { made, done, close } => { + match outcome { + Ok(v) => { + let r = self.iter_result(v, done); + self.resolve_promise(made, r); + } + Err(e) => { + if let Some(sync) = close { + let closed = self.iter_close(&Value::Obj(sync)); + if self.fatal.is_some() { + return closed; + } + } + self.reject(made, e); + } + } + Ok(()) + } + Reaction::Cross(id) => { + crate::cross::advance(self, id, Some(outcome))?; + if self.entered { + return self.run_job_frame(); + } + Ok(()) + } + Reaction::Program => { + if self.outcome.is_none() { + self.outcome = Some(outcome); + } + Ok(()) + } + } + } + + fn combinator_step(&mut self, comb: Id, index: usize, outcome: Result) { + let status = self.names.status; + let value_key = self.names.value; + let reason = self.names.reason; + let record = match (&self.heap[comb as usize].kind, &outcome) { + (Kind::Combinator(c), _) if c.kind == CombKind::AllSettled => { + let o = self.new_object(); + match &outcome { + Ok(v) => { + let t = self.static_str("fulfilled"); + self.define(o, status, t); + self.define(o, value_key, *v); + } + Err(e) => { + let t = self.static_str("rejected"); + self.define(o, status, t); + self.define(o, reason, *e); + } + } + Some(Value::Obj(o)) + } + _ => None, + }; + let Kind::Combinator(c) = &mut self.heap[comb as usize].kind else { + return; + }; + let promise = c.promise; + let finished = match (c.kind, outcome) { + (CombKind::All, Ok(v)) => { + c.values[index] = v; + c.remaining -= 1; + c.remaining == 0 + } + (CombKind::All, Err(e)) => { + self.reject(promise, e); + return; + } + (CombKind::AllSettled, _) => { + c.values[index] = record.unwrap_or_default(); + c.remaining -= 1; + c.remaining == 0 + } + (CombKind::Any, Ok(v)) => { + self.resolve_promise(promise, v); + return; + } + (CombKind::Any, Err(e)) => { + c.values[index] = e; + c.remaining -= 1; + c.remaining == 0 + } + }; + if !finished { + return; + } + let kind = c.kind; + let values = std::mem::take(&mut c.values); + let arr = self.new_array(values); + if kind == CombKind::Any { + let proto = self.realm.aggregate_error_proto; + let e = self.make_error(proto, "All promises were rejected"); + if let Value::Obj(eid) = e { + let errors = self.names.errors; + self.define_hidden(eid, errors, arr); + } + self.reject(promise, e); + } else { + self.resolve_promise(promise, arr); + } + } +} + +/// Natives promises make at run time, which a snapshot names like the built-ins'. +pub fn snapshot_natives() -> [crate::vm::NativeFn; 2] { + [resolver_resolve, resolver_reject] +} + +fn resolver_resolve(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Result { + if let Some(p) = vm.take_resolver(callee) { + vm.resolve_promise(p, args.first().cloned().unwrap_or_default()); + } + Ok(Value::Undef) +} + +fn resolver_reject(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Result { + if let Some(p) = vm.take_resolver(callee) { + vm.reject(p, args.first().cloned().unwrap_or_default()); + } + Ok(Value::Undef) +} + +// ---------- async generators ---------- + +impl Vm { + /// Creates the async iterator prototypes. Runs while built-ins are set up. + pub fn setup_async_iteration(&mut self) { + let op = self.realm.object_proto; + let aip = self.alloc(Obj::new(Some(op), Kind::Ordinary)); + let f = self.native_fn("[Symbol.asyncIterator]", 0, async_iter_self, Value::Undef); + self.define_hidden(aip, SYM_ASYNC_ITERATOR, f); + let agp = self.alloc(Obj::new(Some(aip), Kind::Ordinary)); + let fp = self.realm.function_proto; + let agfp = self.alloc(Obj::new(Some(fp), Kind::Ordinary)); + self.realm.async_generator_function_proto = agfp; + let ck = self.names.constructor; + self.heap[agp as usize] + .props + .push_new(ck, Value::Obj(agfp), 0); + self.method(agp, "next", 1, async_gen_next); + self.method(agp, "return", 1, async_gen_return); + self.method(agp, "throw", 1, async_gen_throw); + self.realm.async_generator_proto = agp; + self.realm.async_from_sync_proto = self.alloc(Obj::new(Some(aip), Kind::Ordinary)); + self.realm.async_function_proto = self.alloc(Obj::new(Some(fp), Kind::Ordinary)); + // Each generator function's default `prototype`'s prototype, read-only as the reference's. + let pk = self.names.prototype; + let (gfp, gp) = ( + self.realm.generator_function_proto, + self.realm.generator_proto, + ); + self.heap[gfp as usize].props.insert(pk, Value::Obj(gp), 0); + let (agfp, agp) = ( + self.realm.async_generator_function_proto, + self.realm.async_generator_proto, + ); + self.heap[agfp as usize] + .props + .insert(pk, Value::Obj(agp), 0); + } + + fn async_gen(&mut self, g: Id) -> Option<&mut AsyncGen> { + match &mut self.heap[g as usize].kind { + Kind::AsyncGenerator(a) => Some(a), + _ => None, + } + } + + /// AsyncGenerator.prototype.next/return/throw: queue the request with its promise, and run the body now if it + /// waits for one. A request that arrives while the body runs is answered when the body reaches it. + fn async_gen_request(&mut self, this: Value, kind: u8, v: Value) -> Res { + let p = self.new_promise(); + let g = match this { + Value::Obj(g) if self.is_async_generator(g) => g, + _ => { + let name = ["next", "throw", "return"][kind as usize]; + let e = self.type_error(&format!( + "AsyncGenerator.prototype.{name} called on incompatible receiver." + )); + self.reject(p, e); + return Ok(Value::Obj(p)); + } + }; + let Some(a) = self.async_gen(g) else { + return Ok(Value::Obj(p)); + }; + let phase = a.phase; + if kind == REQ_NEXT && phase == AsyncPhase::Completed { + let r = self.iter_result(Value::Undef, true); + self.resolve_promise(p, r); + return Ok(Value::Obj(p)); + } + if kind == REQ_THROW && matches!(phase, AsyncPhase::Start | AsyncPhase::Completed) { + if let Some(a) = self.async_gen(g) { + a.phase = AsyncPhase::Completed; + a.state = GenState::Done; + } + self.reject(p, v); + return Ok(Value::Obj(p)); + } + let Some(a) = self.async_gen(g) else { + return Ok(Value::Obj(p)); + }; + a.queue.push_back(AsyncRequest { + kind, + value: v, + promise: p, + }); + if kind == REQ_RETURN && matches!(phase, AsyncPhase::Start | AsyncPhase::Completed) { + a.phase = AsyncPhase::AwaitingReturn; + a.state = GenState::Done; + self.await_return(g); + return Ok(Value::Obj(p)); + } + if !matches!(phase, AsyncPhase::Start | AsyncPhase::Yield) { + return Ok(Value::Obj(p)); + } + a.phase = AsyncPhase::Executing; + self.run_async_generator(g, kind, Ok(v), false)?; + Ok(Value::Obj(p)) + } + + /// Answers the oldest request with an iterator result, or rejects it. + fn complete_step(&mut self, g: Id, outcome: Result, done: bool) { + let Some(front) = self.async_gen(g).and_then(|a| a.queue.pop_front()) else { + return; + }; + match outcome { + Ok(v) => { + let r = self.iter_result(v, done); + self.resolve_promise(front.promise, r); + } + Err(e) => self.reject(front.promise, e), + } + } + + /// A `yield` answered the oldest request. Returns the next queued request to continue with, or suspends. + pub fn async_generator_yielded(&mut self, g: Id, v: Value) -> Option<(u8, Value)> { + self.complete_step(g, Ok(v), false); + let a = self.async_gen(g)?; + match a.queue.front() { + Some(r) => Some((r.kind, r.value)), + None => { + a.phase = AsyncPhase::Yield; + None + } + } + } + + /// The body returned or threw: answer the oldest request with that, then the rest in order. + pub fn async_generator_finish(&mut self, g: Id, outcome: Result) { + self.complete_step(g, outcome, true); + self.drain_requests(g); + } + + /// AsyncGeneratorDrainQueue: once the body has ended, answer the remaining requests in order. + fn drain_requests(&mut self, g: Id) { + loop { + let Some(a) = self.async_gen(g) else { return }; + a.phase = AsyncPhase::Completed; + let Some(front) = a.queue.front() else { return }; + let (kind, value) = (front.kind, front.value); + if kind == REQ_RETURN { + a.phase = AsyncPhase::AwaitingReturn; + self.await_return(g); + return; + } + let outcome = if kind == REQ_THROW { + Err(value) + } else { + Ok(Value::Undef) + }; + self.complete_step(g, outcome, true); + } + } + + /// AsyncGeneratorAwaitReturn: a `return(value)` on an ended or unstarted generator settles once `value` does. + fn await_return(&mut self, g: Id) { + let Some(v) = self + .async_gen(g) + .and_then(|a| a.queue.front().map(|r| r.value)) + else { + return; + }; + let p = self.promise_resolve(v); + self.perform_then(p, Reaction::GenReturn(g)); + } +} + +fn async_iter_self(_vm: &mut Vm, this: Value, _args: &[Value], _: Id) -> Res { + Ok(this) +} + +fn async_gen_next(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + request(vm, this, REQ_NEXT, args) +} + +fn async_gen_return(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + request(vm, this, REQ_RETURN, args) +} + +fn async_gen_throw(vm: &mut Vm, this: Value, args: &[Value], _: Id) -> Res { + request(vm, this, REQ_THROW, args) +} + +/// An async generator's request. The reference's native returns before the body runs, so a call from bytecode spends +/// its fifty first and the call costs nothing more. +fn request(vm: &mut Vm, this: Value, kind: u8, args: &[Value]) -> Res { + let counted = vm.host.meter.counted; + if counted { + vm.fuel(NATIVE_FUEL); + } + let r = vm.async_gen_request(this, kind, args.first().copied().unwrap_or_default()); + if counted && r.is_ok() { + vm.bytecode_builtin(); + } + r +} diff --git a/packages/codemode-rust/crates/psychoscript/src/reach.rs b/packages/codemode-rust/crates/psychoscript/src/reach.rs new file mode 100644 index 0000000000000..73729ed42d8f5 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/reach.rs @@ -0,0 +1,412 @@ +//! Which heap objects a run can still reach. [`roots`] lists every reference the VM holds outside its heap, and +//! [`children`] every reference one object holds: a walk over the two (the collector's marking) sees everything a run +//! can reach. + +use crate::object::*; +use crate::strings::{Atom, StrId}; +use crate::value::{Id, Slot, Value}; +use crate::vm::{Frame, FrameKind, Job, Reaction, Resume, SavedFrame, Vm}; + +/// What a walk finds: an object, a string, a closure cell, or an atom (a property key or a name). A stack slot whose +/// bits could be a cell's raw index (see `Op::NewCell`) is reported as that cell, which may not exist. +#[derive(Clone, Copy)] +pub enum Ref { + Obj(Id), + Str(StrId), + Cell(u32), + Atom(Atom), +} + +/// Every reference the VM holds outside its heap objects and cells: stacks, frames, globals, constants, the realm's +/// lazily made prototypes, jobs, coroutines, the host's calls (queued, in flight, settled), and the outcome. +pub fn roots(vm: &Vm, visit: &mut impl FnMut(Ref)) { + let mut t = Tracer(visit); + t.slots(&vm.stack); + for f in &vm.frames { + t.frame(f); + } + t.vals(vm.globals.iter()); + for (k, v) in &vm.global_map { + t.atom(*k); + t.val(v); + } + for a in &vm.global_names { + t.atom(*a); + } + t.vals(vm.consts.iter()); + let std = &vm.realm.std; + for id in [ + std.regexp, + std.date, + std.uint8, + std.buffer, + std.text_encoder, + std.text_decoder, + std.weak_map, + std.weak_set, + std.iterator_helper, + std.uri_error, + std.url, + std.params, + std.headers, + ] { + t.id(id); + } + for id in vm.template_objs_ref().iter().flatten() { + t.id(*id); + } + for j in &vm.jobs { + match j { + Job::Reaction(r, o) => { + t.reaction(r); + t.outcome(o); + } + Job::Thenable { + promise, + thenable, + then, + } => { + t.id(*promise); + t.val(thenable); + t.val(then); + } + } + } + for (p, _) in &vm.inbox { + t.id(*p); + } + for c in &vm.coroutines { + if let Some(s) = &c.saved { + t.saved(s); + } + if let Some(p) = c.promise { + t.id(p); + } + } + t.vals(vm.replay.iter()); + match &vm.convert_req { + Some(crate::conversion::Request::One(v, _)) => t.val(v), + Some(crate::conversion::Request::List(values, ..)) => t.vals(values.iter()), + Some(crate::conversion::Request::Read(pairs)) => { + for (r, _) in pairs { + t.val(r); + } + } + None => {} + } + for (r, _, v) in &vm.reads.table { + t.val(r); + t.val(v); + } + for (r, _) in &vm.reads.missing { + t.val(r); + } + if let Some((it, next)) = &vm.opened_next { + t.id(*it); + t.val(next); + } + let h = &vm.host; + for q in &h.queued { + match q { + crate::host::Queued::Call(p, _, r, _) => { + t.id(*p); + t.id(r.promise); + } + crate::host::Queued::Work(p, _, f) => { + t.id(*p); + t.id(f.promise); + } + } + } + for tag in h.tasks.tags() { + t.id(tag); + } + for call in &h.calls { + t.id(call.promise); + } + for r in &h.restarts { + t.id(r.promise); + } + for id in h.suggestions.keys() { + t.id(*id); + } + if let Some(p) = h.promise_like { + t.id(p); + } + for (p, v) in &h.unhandled { + t.id(*p); + t.val(v); + } + t.vals(h.modules_loaded.values()); + t.vals(h.namespaces.values()); + for a in h.host_namespaces.keys() { + t.atom(*a); + } + if let Some(o) = &vm.outcome { + t.outcome(o); + } +} + +/// Every reference an object holds: its prototype, its properties, and what its kind keeps. +pub fn children(o: &Obj, visit: &mut impl FnMut(Ref)) { + head(o, visit); + bulk(o, 0, usize::MAX, visit); +} + +/// What `o` holds apart from its [`bulk`]: a bounded number of references, unless its kind keeps a list (a bound +/// function's arguments, a promise's reactions, a generator's saved stack). +pub fn head(o: &Obj, visit: &mut impl FnMut(Ref)) { + Tracer(visit).head(o); +} + +/// The slots of `o` from `from` to `to`, of the [`bulk_len`] there are: its properties (key and value), then its +/// elements or entries. These are what may be long, which the collector traces a range at a time. +pub fn bulk(o: &Obj, from: usize, to: usize, visit: &mut impl FnMut(Ref)) { + let mut t = Tracer(visit); + let props = &o.props.items; + for p in range(props, from, to) { + t.atom(p.key); + t.val(&p.value); + } + let (from, to) = ( + from.saturating_sub(props.len()), + to.saturating_sub(props.len()), + ); + match &o.kind { + Kind::Array(items) | Kind::Arguments(items) => t.vals(range(items, from, to)), + Kind::ListIter { items, .. } => t.vals(range(items, from, to)), + Kind::Map(m) | Kind::Set(m) | Kind::WeakMap(m) | Kind::WeakSet(m) => { + for (k, v) in range(m.slots(), from, to).iter().flatten() { + t.val(k); + t.val(v); + } + } + _ => {} + } +} + +/// How many slots [`bulk`] has for `o`. +pub fn bulk_len(o: &Obj) -> usize { + o.props.items.len() + + match &o.kind { + Kind::Array(items) | Kind::Arguments(items) => items.len(), + Kind::ListIter { items, .. } => items.len(), + Kind::Map(m) | Kind::Set(m) | Kind::WeakMap(m) | Kind::WeakSet(m) => m.slots().len(), + _ => 0, + } +} + +/// The part of `s` from `from` to `to`, as far as it goes. +fn range(s: &[T], from: usize, to: usize) -> &[T] { + &s[from.min(s.len())..to.min(s.len())] +} + +struct Tracer<'f, F>(&'f mut F); + +impl Tracer<'_, F> { + fn id(&mut self, id: Id) { + (self.0)(Ref::Obj(id)); + } + + fn atom(&mut self, a: Atom) { + (self.0)(Ref::Atom(a)); + } + + fn val(&mut self, v: &Value) { + match v { + Value::Obj(id) => (self.0)(Ref::Obj(*id)), + Value::Str(s) => (self.0)(Ref::Str(*s)), + _ => {} + } + } + + fn vals<'a>(&mut self, vs: impl IntoIterator) { + for v in vs { + self.val(v); + } + } + + fn slots(&mut self, slots: &[Slot]) { + for s in slots { + if let Ok(c) = u32::try_from(s.0) { + (self.0)(Ref::Cell(c)); + } + self.val(&s.get()); + } + } + + fn frame(&mut self, f: &Frame) { + self.vals(f.extra.iter()); + for c in f.upvals.iter() { + (self.0)(Ref::Cell(*c)); + } + if let FrameKind::Generator(g, resume) = f.kind { + self.id(g); + if let Resume::Collect(a) = resume { + self.id(a); + } + } + } + + fn saved(&mut self, s: &SavedFrame) { + if let Some(f) = &s.frame { + self.frame(f); + } + for f in &s.above { + self.frame(f); + } + self.slots(&s.stack); + } + + fn gen_state(&mut self, g: &GenState) { + match g { + GenState::Suspended(s) | GenState::Running(s) => self.saved(s), + GenState::Done => {} + } + } + + fn outcome(&mut self, o: &Result) { + match o { + Ok(v) | Err(v) => self.val(v), + } + } + + fn reaction(&mut self, r: &Reaction) { + match r { + Reaction::Then { + on_ful, + on_rej, + derived, + } => { + self.val(on_ful); + self.val(on_rej); + self.id(*derived); + } + Reaction::Await(_) | Reaction::Program => {} + Reaction::Cross(id) => self.id(*id), + Reaction::Resolve(t) => self.id(*t), + Reaction::Comb { comb, .. } => self.id(*comb), + Reaction::Finally { cleanup, derived } => { + self.val(cleanup); + self.id(*derived); + } + Reaction::Restore { derived, outcome } => { + self.id(*derived); + self.outcome(outcome); + } + Reaction::AwaitGen(g) | Reaction::GenReturn(g) => self.id(*g), + Reaction::FromSync { made, close, .. } => { + self.id(*made); + if let Some(c) = close { + self.id(*c); + } + } + } + } + + fn head(&mut self, o: &Obj) { + if let Some(p) = o.proto { + self.id(p); + } + match &o.kind { + Kind::Ordinary + | Kind::Array(_) + | Kind::Arguments(_) + | Kind::ListIter { .. } + | Kind::Map(_) + | Kind::Set(_) + | Kind::WeakMap(_) + | Kind::WeakSet(_) + | Kind::Error(_) + | Kind::RegExp(_) + | Kind::Date(_) + | Kind::Bytes(_) + | Kind::TextDecoder(_) + | Kind::Headers(_) => {} + Kind::StrIter { s, .. } => self.val(&Value::Str(*s)), + Kind::Namespace(ns) => { + self.atom(ns.name); + if !ns.is_root() { + self.id(ns.parent); + } + } + Kind::Closure(c) => { + self.val(&c.this); + self.val(&c.home); + self.val(&c.fields); + for cell in c.upvals.iter() { + (self.0)(Ref::Cell(*cell)); + } + } + Kind::Native { data, name, .. } => { + self.atom(*name); + self.val(data); + } + Kind::Bound(b) => { + self.val(&b.0); + self.val(&b.1); + self.vals(b.2.iter()); + } + Kind::Promise(p) => { + match &p.state { + PromiseState::Pending => {} + PromiseState::Fulfilled(v) | PromiseState::Rejected(v) => self.val(v), + } + for r in &p.reactions { + self.reaction(r); + } + } + Kind::Generator(g) => self.gen_state(g), + Kind::ArrayIter { target, .. } + | Kind::MapIter { target, .. } + | Kind::ExoticIter { target, .. } => self.id(*target), + Kind::Resolvers { promise, .. } => self.id(*promise), + Kind::Cross(c) => { + let values: Vec = crate::cross::values(c).collect(); + self.vals(values.iter()); + } + Kind::Combinator(c) => { + self.id(c.promise); + self.vals(c.values.iter()); + } + Kind::IterHelper(h) => { + use crate::builtins::iterator::HelperOp; + self.val(&h.iter); + self.val(&h.next); + self.val(&h.site); + match &h.op { + HelperOp::Map(f) | HelperOp::Filter(f) => self.val(f), + HelperOp::FlatMap(f, inner) => { + self.val(f); + if let Some((a, b)) = inner { + self.val(a); + self.val(b); + } + } + HelperOp::Wrap | HelperOp::Take(_) | HelperOp::Drop(_) => {} + } + } + Kind::Url(u) => self.id(u.params), + Kind::SearchParams(p) => { + if let Some(u) = p.url { + self.id(u); + } + } + Kind::AsyncGenerator(a) => { + self.gen_state(&a.state); + for r in &a.queue { + self.val(&r.value); + self.id(r.promise); + } + } + Kind::Accessor(a) => { + self.val(&a.get); + self.val(&a.set); + } + Kind::AsyncFromSync { sync, next } => { + self.id(*sync); + self.val(next); + } + } + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/run.rs b/packages/codemode-rust/crates/psychoscript/src/run.rs new file mode 100644 index 0000000000000..4b799bb9bbba7 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/run.rs @@ -0,0 +1,514 @@ +//! Compiling a program, setting up its heap, built-ins and host globals, and copying its outcome out. + +use std::panic::AssertUnwindSafe; +use std::sync::Arc; + +use crate::bytecode::Program; +use crate::compiler::{self, CompileError}; +use crate::convert; +use crate::host::{self, RunHost}; +use crate::nesting; +use crate::object::{Closure, Kind, Obj}; +use crate::program::Running; +use crate::runtime::{ProgramOptions, Run}; +use crate::strings::Strings; +use crate::value::Value; +use crate::vm::Vm; +use crate::{Data, Diagnostic, DiagnosticKind, HostString, Outcome, Runtime}; + +/// Native stack that parsing and compiling may use per unit of [`nesting::bound`], measured with +/// `bench/examples/stack_probe.rs`, with headroom. The costliest form per unit is a chain of prefix operators: 819 B a +/// level in release builds and 12.9 KB in debug builds. +pub const COMPILE_STACK_PER_LEVEL: usize = if cfg!(debug_assertions) { + 16 << 10 +} else { + 1 << 10 +}; +/// The native stack a run may use from where it is driven, wherever it runs: past it a call fails with a RangeError, so +/// where a program runs never changes what it can do. A run on the caller's thread assumes this much is free there. +pub const RUN_STACK_BUDGET: usize = 512 << 10; +/// Room on a thread beyond what its work is measured to need. +pub(crate) const THREAD_STACK_BASE: usize = 256 << 10; + +/// A program compiled once to run many times: its bytecode and the strings it interned, which every run starts from +/// a copy of, so a run of it is the same as a run of its source. Cheap to clone, and shared across threads. +#[derive(Clone)] +pub struct Compiled(Arc); + +struct CompiledProgram { + code: Arc, + program: Program, + atoms: Strings, +} + +impl Compiled { + /// The program's source. + pub fn code(&self) -> &str { + &self.0.code + } +} + +impl std::fmt::Debug for Compiled { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Compiled") + .field("bytes", &self.0.code.len()) + .finish() + } +} + +/// A program to run: its source, or the program [`Runtime::compile`] made of it. +#[derive(Clone, Copy, Debug)] +pub enum Code<'a> { + Source(&'a str), + Compiled(&'a Compiled), +} + +impl<'a> From<&'a str> for Code<'a> { + fn from(code: &'a str) -> Self { + Code::Source(code) + } +} + +impl<'a> From<&'a String> for Code<'a> { + fn from(code: &'a String) -> Self { + Code::Source(code) + } +} + +impl<'a> From<&'a Compiled> for Code<'a> { + fn from(code: &'a Compiled) -> Self { + Code::Compiled(code) + } +} + +/// Parses and compiles a program, or the diagnostic a run of it would fail with before running anything. +pub fn compile_program(code: &str) -> Result { + let mut atoms = Strings::new(); + let program = compile(code, &mut atoms).map_err(|e| compile_diagnostic(code, e))?; + Ok(Compiled(Arc::new(CompiledProgram { + code: Arc::from(code), + program, + atoms, + }))) +} + +fn compile_diagnostic(code: &str, e: CompileError) -> Diagnostic { + let location = e.offset.map(|o| line_col(code, o)); + let message = format!("{}{}", e.message, suffix(location)); + Diagnostic { + kind: e.kind, + message: message.into(), + location, + suggestions: Vec::new(), + } +} + +pub fn execute(rt: &Runtime, code: Code<'_>, options: &ProgramOptions) -> Outcome { + let run = AssertUnwindSafe(|| settled(rt.program(code, options).run())); + std::panic::catch_unwind(run).unwrap_or_else(|_| internal_error()) +} + +/// Compiles on the caller's thread when the program's syntax is shallow enough to compile within the run's stack +/// budget, whatever its length; a deeper one compiles on a thread with the stack its nesting needs. Running needs no +/// more native stack for deep syntax, so only compiling moves. +pub fn compile(code: &str, atoms: &mut Strings) -> Result { + let need = nesting::bound(code).saturating_mul(COMPILE_STACK_PER_LEVEL); + if need <= RUN_STACK_BUDGET { + return compiler::compile(code, atoms); + } + std::thread::scope(|s| { + std::thread::Builder::new() + .stack_size(need.saturating_add(THREAD_STACK_BASE)) + .spawn_scoped(s, || compiler::compile(code, atoms)) + .map_err(|_| CompileError { + kind: DiagnosticKind::ExecutionFailure, + message: + "The program is nested too deeply to compile: no thread with enough stack." + .into(), + offset: None, + })? + .join() + .unwrap_or_else(|panic| std::panic::resume_unwind(panic)) + }) +} + +/// The outcome of a run, or for an interrupted one, an `ExecutionFailure` that says so. +fn settled(run: Result) -> Outcome { + run.unwrap_or_else(|i| failed(diagnostic(DiagnosticKind::ExecutionFailure, i.to_string()))) +} + +/// A defect in the interpreter, reported instead of unwinding into the host. +fn internal_error() -> Outcome { + failed(Diagnostic { + kind: DiagnosticKind::ExecutionFailure, + message: "Internal interpreter error.".into(), + location: None, + suggestions: Vec::new(), + }) +} + +fn failed(error: Diagnostic) -> Outcome { + Outcome { + result: Err(error), + warnings: Vec::new(), + logs: Vec::new(), + truncated: false, + metadata: Data::Null, + } +} + +/// Compiles a program and sets up its run, or the outcome when it does not compile. +pub fn start( + rt: &Runtime, + code: Code<'_>, + options: &ProgramOptions, +) -> Result, Box> { + let (code, program, atoms) = match code { + Code::Compiled(c) => (c.0.code.clone(), c.0.program.clone(), c.0.atoms.clone()), + Code::Source(code) => { + let mut atoms = Strings::new(); + match compile(code, &mut atoms) { + Ok(p) => (Arc::from(code), p, atoms), + Err(e) => return Err(Box::new(failed(compile_diagnostic(code, e)))), + } + } + }; + let setup = rt.setup(); + let run = Run::new(options.run_id.clone(), Data::Null); + let globals = setup.globals_for(&run); + let host = RunHost::new(globals, setup.modules.clone(), setup.translate, run); + let mut vm = Vm::new(host, setup.limits, atoms); + vm.setup(); + crate::builtins::ensure_globals(&mut vm, &program.globals); + host::install(&mut vm, &program.globals); + vm.snapshot_base = crate::snapshot::Base::of(&vm); + for (k, v) in &options.bindings { + // Host globals of the same name win, as in the reference. + if k.as_str().is_some_and(|k| host::has_host_global(&vm, k)) { + continue; + } + let val = convert::from_data(&mut vm, v); + let a = vm.atoms.intern(&k.to_run_text()); + vm.global_map.insert(a, val); + } + vm.load(program); + Ok(Box::new(Running::new(vm, code))) +} + +/// A fresh run for a saved program: compiled and set up with the saved limits and no bindings, ready to be filled in. +pub struct Resumed { + pub running: Box, + pub bytecode: String, +} + +pub fn start_for_resume( + rt: &Runtime, + restored: crate::snapshot::Restored, +) -> Result { + let code = restored.code; + let mut atoms = Strings::new(); + let program = compile(&code, &mut atoms).map_err(|_| { + crate::snapshot::SnapshotError::new( + "Source main does not compile in this build, so it can't resume.", + ) + })?; + let bytecode = crate::snapshot::bytecode_hash(&program); + let setup = rt.setup(); + let run = Run::new(restored.run_id, restored.metadata); + let globals = setup.globals_for(&run); + if crate::snapshot::hosts_id(&globals) != restored.hosts { + return Err(crate::snapshot::SnapshotError::new( + "This state was saved by a runtime with other host globals; resume it with the same ones.", + )); + } + let host = RunHost::new(globals, setup.modules.clone(), setup.translate, run); + let mut vm = Vm::new(host, restored.limits, atoms); + vm.setup(); + crate::builtins::ensure_globals(&mut vm, &program.globals); + host::install(&mut vm, &program.globals); + vm.snapshot_base = crate::snapshot::Base::of(&vm); + vm.load(program); + Ok(Resumed { + running: Box::new(Running::new(vm, Arc::from(code))), + bytecode, + }) +} + +/// The outcome reported for an interrupted run, to a suspend that asks after it. +pub fn failed_interrupted() -> Outcome { + failed(diagnostic( + DiagnosticKind::ExecutionFailure, + crate::Interrupted.to_string(), + )) +} + +/// What `Program::run` reports for a run a suspender stopped. +pub fn failed_suspended() -> Outcome { + failed(diagnostic( + DiagnosticKind::ExecutionFailure, + "The run was suspended; run it with run_resumable to get its state.".into(), + )) +} + +/// Runs the program's body to its first suspension. +pub fn call_main(vm: &mut Vm) { + let proto = vm.protos[0].clone(); + let fp = vm.realm.function_proto; + let main = Value::Obj(vm.alloc(Obj::new( + Some(fp), + Kind::Closure(Box::new(Closure { + proto, + upvals: Arc::from(Vec::new()), + this: Value::Undef, + home: Value::Undef, + fields: Value::Undef, + })), + ))); + vm.resumable_run = true; + vm.start_handover_fuel(); + let r = vm.call(&main, Value::Undef, &[]); + vm.resumable_run = false; + if let Err(e) = r + && vm.outcome.is_none() + { + vm.outcome = Some(Err(e)); + } +} + +/// The outcome of a run that ended: host work it left running is interrupted, then the result is copied out. +pub fn finish(r: Running) -> Outcome { + let Running { mut vm, code, .. } = r; + let code: &str = &code; + vm.host.tasks.clear(); + let vm = &mut vm; + let result = match (vm.fatal.clone(), vm.outcome.take()) { + (Some((kind, message)), _) => Err(diagnostic(kind, message)), + (None, Some(Ok(v))) => match vm.result_json.take() { + Some(j) => Ok(Data::from_run_json(j)), + None => match convert::to_json(vm, &v) { + Ok(j) => Ok(Data::from_run_json(j)), + Err(e) => Err(diagnose(vm, &e, code)), + }, + }, + (None, Some(Err(e))) => Err(diagnose(vm, &e, code)), + (None, None) => Err(diagnostic( + DiagnosticKind::ExecutionFailure, + "The program did not finish.".into(), + )), + }; + let result = match (vm.fatal.clone(), result) { + (Some((kind, message)), Ok(_)) => Err(diagnostic(kind, message)), + (_, r) => r, + }; + let warnings = if result.is_ok() { + warnings(vm, code) + } else { + Vec::new() + }; + let logs = std::mem::take(&mut vm.logs) + .iter() + .map(|l| HostString::from_run_text(l)) + .collect(); + let metadata = vm.host.run.metadata(); + bound_output( + Outcome { + result, + warnings, + logs, + truncated: false, + metadata, + }, + vm.limits.max_output_bytes, + ) +} + +/// Rejections nothing handled, in promise creation order, once completed host calls have settled their promises. +fn warnings(vm: &mut Vm, code: &str) -> Vec { + while let Some((p, s)) = vm.inbox.pop_front() { + if !matches!(s, host::Settlement::Interrupted) { + host::settle(vm, p, s); + } + } + let mut unhandled = std::mem::take(&mut vm.host.unhandled); + unhandled.sort_by_key(|(p, _)| *p); + unhandled + .into_iter() + .map(|(_, reason)| { + diagnose_with( + vm, + &reason, + code, + "Unhandled rejection from an un-awaited promise: ", + ) + }) + .collect() +} + +/// The JSON text a diagnostic crosses the reference's boundary as, for the output budget. +fn diagnostic_json(d: &Diagnostic) -> String { + let mut fields = vec![ + (HostString::from("kind"), Data::String(d.kind.name().into())), + (HostString::from("message"), Data::String(d.message.clone())), + ]; + if let Some((line, column)) = d.location { + fields.push(( + "location".into(), + Data::from(serde_json::json!({ "line": line, "column": column })), + )); + } + if !d.suggestions.is_empty() { + fields.push(( + "suggestions".into(), + Data::Array(d.suggestions.iter().cloned().map(Data::String).collect()), + )); + } + Data::Object(fields).to_json_string() +} + +/// A diagnostic whose message is a run's text (see `strings`), which keeps unpaired surrogates. +fn diagnostic(kind: DiagnosticKind, message: String) -> Diagnostic { + Diagnostic { + kind, + message: HostString::from_run_text(&message), + location: None, + suggestions: Vec::new(), + } +} + +/// The diagnostic for an uncaught value. +fn diagnose(vm: &mut Vm, e: &Value, code: &str) -> Diagnostic { + diagnose_with(vm, e, code, "") +} + +/// The diagnostic for an uncaught value, its message after `prefix`. +fn diagnose_with(vm: &mut Vm, e: &Value, code: &str, prefix: &str) -> Diagnostic { + let (kind, message, location, suggestions) = diagnose_text(vm, e, code); + Diagnostic { + kind, + message: HostString::from_run_text(&format!("{prefix}{message}")), + location, + suggestions, + } +} + +/// An uncaught value's kind, message as a run's text, location and suggestions. +type Diagnosed = (DiagnosticKind, String, Option<(u32, u32)>, Vec); + +fn diagnose_text(vm: &mut Vm, e: &Value, code: &str) -> Diagnosed { + if let Value::Obj(id) = e + && let Kind::Error(failure) = &vm.heap[*id as usize].kind + { + let id = *id; + if let Some(f) = failure.clone() { + let location = f.offset.map(|o| line_col(code, o)); + let message = match f.kind { + DiagnosticKind::ExecutionFailure + | DiagnosticKind::InvalidDataValue + | DiagnosticKind::UnsupportedSyntax => { + let (name, _) = convert::error_parts(vm, id); + format!("{name}: {}{}", f.message, suffix(location)) + } + _ => f.message.clone(), + }; + let suggestions = vm.host.suggestions.get(&id).cloned().unwrap_or_default(); + return (f.kind, message, location, suggestions); + } + let message = convert::error_to_string(vm, id); + return (DiagnosticKind::ExecutionFailure, message, None, Vec::new()); + } + // As the reference does, a thrown value's internals never show through a failure. + let text = if convert::holds_runtime_reference(vm, e) { + "a non-data value".to_owned() + } else { + convert::format_value(vm, e) + }; + ( + DiagnosticKind::ExecutionFailure, + format!("Uncaught: {text}"), + None, + Vec::new(), + ) +} + +fn suffix(location: Option<(u32, u32)>) -> String { + match location { + Some((line, col)) => format!(" (line {line}, col {col})"), + None => String::new(), + } +} + +/// 1-based line and column (in UTF-16 units) of a byte offset. +fn line_col(code: &str, offset: u32) -> (u32, u32) { + let offset = (offset as usize).min(code.len()); + let before = code.get(..offset).unwrap_or(code); + let line = before.matches('\n').count() as u32 + 1; + let line_start = before.rfind('\n').map(|i| i + 1).unwrap_or(0); + let col = before[line_start..].encode_utf16().count() as u32 + 1; + (line, col) +} + +/// Keeps the result and logs within `max_output_bytes`, the way the reference does. +fn bound_output(mut outcome: Outcome, max: Option) -> Outcome { + let Some(max) = max else { return outcome }; + let mut value_bytes = 0; + if let Ok(v) = &outcome.result { + let text = v.to_json_string(); + value_bytes = text.len(); + if value_bytes > max { + let mut cut = max; + while !text.is_char_boundary(cut) { + cut -= 1; + } + outcome.result = Ok(Data::String(HostString::from(format!( + "{} [result truncated: {value_bytes} bytes exceeds the {max}-byte output limit; return a smaller value]", + &text[..cut] + )))); + outcome.truncated = true; + } + } + // Warnings have a budget of their own, so result data cannot starve them. + let mut used = 0; + let fit = outcome + .warnings + .iter() + .take_while(|w| { + used += diagnostic_json(w).len() + 1; + used <= max + }) + .count(); + if fit < outcome.warnings.len() { + let omitted = outcome.warnings.len() - fit; + outcome.warnings.truncate(fit); + outcome.warnings.push(diagnostic( + DiagnosticKind::Truncated, + format!("{omitted} additional warnings omitted by the output limit."), + )); + outcome.truncated = true; + } + let budget = max.saturating_sub(value_bytes.min(max)); + let mut used = 0; + let mut kept = 0; + for line in &outcome.logs { + // As UTF-8, an unpaired surrogate takes U+FFFD's three bytes. + used += line.to_string_lossy().len() + 1; + if used > budget { + break; + } + kept += 1; + } + if kept < outcome.logs.len() { + let total = outcome.logs.len(); + outcome.logs.truncate(kept); + outcome + .logs + .push(format!("[logs truncated: showing {kept} of {total} lines]").into()); + outcome.truncated = true; + } + outcome +} + +// A compiled program is shared by runs on any thread. +const _: () = { + const fn shared() {} + shared::() +}; diff --git a/packages/codemode-rust/crates/psychoscript/src/runtime.rs b/packages/codemode-rust/crates/psychoscript/src/runtime.rs new file mode 100644 index 0000000000000..173d5183f7e0f --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/runtime.rs @@ -0,0 +1,311 @@ +//! The runtime a host makes, the counterpart of the reference's `Runtime.make`: the host globals every run gets, its +//! modules, limits and translation, and the outcome of a run. + +use std::sync::{Arc, Mutex}; + +use crate::host::RunId; +use crate::{ + Code, Compiled, Data, Diagnostic, HostString, HostValue, Interrupted, Json, Limits, Program, + Snapshot, SnapshotError, from_bytes, +}; + +/// How a run ended: its value or failure, with what it logged and its metadata. +#[derive(Clone, Debug)] +pub struct Outcome { + /// `Ok(value)`: the program's value as JSON data, `undefined` as `null`. Its strings keep unpaired surrogates; + /// [`Outcome::json`] gives it as a `serde_json::Value`. + pub result: Result, + /// Non-fatal diagnostics. + pub warnings: Vec, + /// What the program logged, a line each, with unpaired surrogates kept; [`Outcome::log_lines`] gives `String`s. + pub logs: Vec, + /// Whether `max_output_bytes` cut the retained result or logs. + pub truncated: bool, + /// The run's metadata as its host functions left it (see [`Run::set_metadata`]); `null` when none was set. + pub metadata: Data, +} + +impl Outcome { + /// The result with its value as a `serde_json::Value`, U+FFFD for each unpaired surrogate. + pub fn json(&self) -> Result { + self.result + .as_ref() + .map(Data::to_json) + .map_err(Clone::clone) + } + + /// The logs as `String`s, U+FFFD for each unpaired surrogate. + pub fn log_lines(&self) -> Vec { + self.logs + .iter() + .map(|l| l.to_string_lossy().into_owned()) + .collect() + } +} + +/// The run a runtime's globals are made for, the reference's `Run`: its id, and metadata its host functions may keep +/// across a suspend. A clone is the same run. +#[derive(Clone)] +pub struct Run { + pub(crate) id: RunId, + metadata: Arc>, + #[cfg(feature = "gc-stats")] + stats: Arc>, +} + +impl Run { + pub(crate) fn new(id: Option, metadata: Data) -> Self { + Self { + id: Arc::new(id.map(std::sync::OnceLock::from).unwrap_or_default()), + metadata: Arc::new(Mutex::new(metadata)), + #[cfg(feature = "gc-stats")] + stats: Arc::default(), + } + } + + /// The run's heap as of its last stop for the host (`gc-stats` builds only). + #[cfg(feature = "gc-stats")] + #[doc(hidden)] + pub fn heap_stats(&self) -> crate::HeapStats { + self.stats().clone() + } + + #[cfg(feature = "gc-stats")] + pub(crate) fn stats(&self) -> std::sync::MutexGuard<'_, crate::HeapStats> { + self.stats.lock().unwrap_or_else(|e| e.into_inner()) + } + + /// The run's id, the first part of its calls' keys: the one [`ProgramOptions::run_id`] gave, or a random UUID. + pub fn id(&self) -> &str { + self.id.get_or_init(crate::host::random_run_id) + } + + /// The run's metadata: JSON data its host functions keep, which a saved run keeps in its state and the outcome + /// reports. `null` until set. + pub fn metadata(&self) -> Data { + self.lock().clone() + } + + pub fn set_metadata(&self, metadata: impl Into) { + *self.lock() = metadata.into(); + } + + /// Changes the metadata in place. + pub fn update_metadata(&self, f: impl FnOnce(&mut Data) -> T) -> T { + f(&mut self.lock()) + } + + fn lock(&self) -> std::sync::MutexGuard<'_, Data> { + self.metadata.lock().unwrap_or_else(|e| e.into_inner()) + } +} + +impl std::fmt::Debug for Run { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Run") + .field("id", &self.id.get()) + .field("metadata", &*self.lock()) + .finish() + } +} + +/// How a host call's arguments carry program values the host can't hold, the reference's `Translate`. Every host +/// function in the runtime gets its arguments this way; results are not affected. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct Translate { + pub functions: TranslateFunctions, + pub promises: TranslatePromises, +} + +/// A program function inside an argument. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub enum TranslateFunctions { + /// Fails the call. + #[default] + Error, + /// Leaves it out, as `JSON.stringify` does: an object's key is left out, an array's item is `null`, and an + /// argument is `undefined`. + Drop, +} + +/// A program promise inside an argument. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub enum TranslatePromises { + /// Fails the call. + #[default] + Error, + /// Makes the call wait for it to settle and use its value. A rejection fails the call with its reason. + Await, +} + +/// Options for one program: [`Runtime::program`], [`Runtime::execute_with`], the reference's `ProgramOptions`. +#[derive(Clone, Debug, Default)] +pub struct ProgramOptions { + pub(crate) bindings: Vec<(HostString, Data)>, + pub(crate) run_id: Option, +} + +impl ProgramOptions { + pub fn new() -> Self { + Self::default() + } + + /// Read-only JSON values bound in the program's outer scope, shadowable by top-level declarations. A host + /// global of the same name wins. + /// They take a `serde_json::Map`, or names and [`Data`] when a string must keep an unpaired surrogate. + pub fn bindings, V: Into>( + mut self, + bindings: impl IntoIterator, + ) -> Self { + self.bindings = bindings + .into_iter() + .map(|(k, v)| (k.into(), v.into())) + .collect(); + self + } + + /// Names this run's host calls (`:`); a random UUID by default. + pub fn run_id(mut self, run_id: impl Into) -> Self { + self.run_id = Some(run_id.into()); + self + } +} + +type GlobalsFn = dyn Fn(&Run) -> Vec<(String, HostValue)> + Send + Sync; + +/// What a runtime shares with every run it starts. +#[derive(Default)] +pub(crate) struct Setup { + pub globals: Option>, + pub modules: Arc<[(String, String)]>, + pub limits: Limits, + pub translate: Translate, +} + +impl Setup { + /// The host globals for a run, made when it starts or resumes. + pub(crate) fn globals_for(&self, run: &Run) -> crate::host::Globals { + match &self.globals { + Some(globals) => globals(run).into(), + None => std::sync::Arc::from([]), + } + } +} + +/// A reusable confined runtime over host globals: each run of a program is independent. +#[derive(Default)] +pub struct Runtime { + setup: Setup, +} + +impl Runtime { + /// A runtime with no host globals, no limits, and the default translation; the reference's `Runtime.make()`. + pub fn make() -> Self { + Self::default() + } + + /// The globals a program reaches, made for each run when it starts and again when it resumes, so they can keep + /// the run's own state in its metadata: [`HostFunction`](crate::HostFunction)s, + /// [`DurableFunction`](crate::DurableFunction)s, [`Namespace`](crate::Namespace)s, and plain values of them. A + /// host global wins over a built-in of the same name. + pub fn globals(mut self, globals: F) -> Self + where + F: Fn(&Run) -> I + Send + Sync + 'static, + I: IntoIterator, + K: Into, + V: Into, + { + self.setup.globals = Some(Box::new(move |run| { + globals(run) + .into_iter() + .map(|(k, v)| (k.into(), v.into())) + .collect() + })); + self + } + + /// Module names that load a global, beyond its own name: `("bun", "Bun")` makes `import "bun"` load `Bun`. + pub fn modules, V: Into>( + mut self, + modules: impl IntoIterator, + ) -> Self { + self.setup.modules = modules + .into_iter() + .map(|(k, v)| (k.into(), v.into())) + .collect::>() + .into(); + self + } + + /// Budgets enforced on each run. Time counts active time only, across every resume of a run. + /// + /// # Panics + /// + /// When `timeout_ms` is `Some(0)`, which the reference refuses with a `RangeError`. + pub fn limits(mut self, limits: Limits) -> Self { + assert!( + limits.timeout_ms != Some(0), + "timeoutMs must be a safe integer greater than or equal to 1." + ); + self.setup.limits = limits; + self + } + + /// How host calls' arguments carry functions and promises; see [`Translate`]. + pub fn translate(mut self, translate: Translate) -> Self { + self.setup.translate = translate; + self + } + + /// Parses, compiles and runs `code` on the calling thread, blocking on asynchronous host work. An interrupted + /// run ends with an `ExecutionFailure` saying so; [`Program::run`] tells the two apart. + pub fn execute<'c>(&self, code: impl Into>) -> Outcome { + crate::run::execute(self, code.into(), &ProgramOptions::default()) + } + + /// [`Runtime::execute`] with [`ProgramOptions`]: bindings, a run id. + pub fn execute_with<'c>(&self, code: impl Into>, options: &ProgramOptions) -> Outcome { + crate::run::execute(self, code.into(), options) + } + + /// Runs `code` as a future on any executor. Dropping it interrupts the run and every host call in flight; a host + /// call can interrupt it too, and then it ends with [`Interrupted`]. + pub async fn execute_async<'c>( + &self, + code: impl Into>, + options: &ProgramOptions, + ) -> Result { + self.program(code, options).run_async().await + } + + /// A program, from its source or [compiled](Runtime::compile), ready to run once; nothing runs until + /// [`Program::run`] or [`Program::run_async`]. + pub fn program<'c>(&self, code: impl Into>, options: &ProgramOptions) -> Program<'_> { + Program::new(self, code.into(), options) + } + + /// Parses and compiles a program once, for [`Runtime::program`] and the `execute` methods to run many times + /// without doing it again; or the diagnostic a run of it would fail with first (an empty program, a syntax + /// error). Unsupported syntax still fails where it runs, as from source. A compiled program runs in any runtime. + pub fn compile(&self, code: &str) -> Result { + crate::run::compile_program(code) + } + + /// A program continuing a suspended run, from its state. It keeps the limits it was saved with, and its globals + /// are made again for the run with its saved id and metadata. Fails with a [`SnapshotError`] when the state was + /// saved by another build, with other host globals, from a source that no longer compiles the same, or is + /// malformed. + pub fn resume(&self, state: &Snapshot) -> Result, SnapshotError> { + Program::resume(self, state) + } + + /// [`Runtime::resume`] from [`to_bytes`](crate::to_bytes). + pub fn resume_bytes(&self, bytes: &[u8]) -> Result, SnapshotError> { + let state = from_bytes(bytes)?; + Program::resume(self, &state) + } + + pub(crate) fn setup(&self) -> &Setup { + &self.setup + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/snapshot.rs b/packages/codemode-rust/crates/psychoscript/src/snapshot.rs new file mode 100644 index 0000000000000..2672c407bfa3b --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/snapshot.rs @@ -0,0 +1,2265 @@ +//! Saving a run's state as plain data and restoring it into a fresh VM, the counterpart of the reference's +//! `src/snapshot*`. +//! +//! - **Code is never saved.** A snapshot keeps the program's source; restoring compiles it again and refuses it when +//! the bytecode differs, so a pc always means the same instruction. +//! - **Built-ins are saved by position.** A fresh run makes the same objects, strings and host globals in the same +//! order before the program starts (the base). Only base objects the run changed are saved, and everything made +//! after the base is saved whole. +//! - **Natives are named** by their index in a table of every native the VM can make, built once per process. +//! - **Host calls in flight** are saved by kind: an idempotent call as queued, to run again with the same key; a +//! started durable call with its data, to wait on again. Any other one in flight refuses the suspend. + +use std::collections::VecDeque; +use std::fmt; +use std::sync::Arc; +use std::sync::OnceLock; + +use rustc_hash::FxHashMap; +use serde_json::{Value as J, json}; + +use crate::host::{self, CallKind, Callee, FnEntry, ResultRoot, Settled, Settlement}; +use crate::host_function::{HostError, HostFunction, HostValue}; +use crate::object::*; +use crate::value::{Id, Slot, Value}; +use crate::vm::{ + Coroutine, Frame, FrameKind, Handler, Job, NativeFn, Reaction, Resume, SavedFrame, Vm, +}; +use crate::{DiagnosticKind, Json, Limits}; + +/// Bumped whenever the shape of saved state changes. +pub const FORMAT: u64 = 1; + +/// A run's saved state: plain JSON, with a `header` that says where it can resume. +#[derive(Clone, Debug, PartialEq)] +pub struct Snapshot(pub Json); + +/// The state as bytes, to store or send. +pub fn to_bytes(state: &Snapshot) -> Vec { + serde_json::to_vec(&state.0).unwrap_or_default() +} + +/// A state read back from [`to_bytes`]. +pub fn from_bytes(bytes: &[u8]) -> Result { + serde_json::from_slice(bytes) + .map(Snapshot) + .map_err(|e| SnapshotError::new(format!("Invalid snapshot: {e}."))) +} + +/// Why a state cannot resume here: another build, other host globals, a changed source, or malformed data. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct SnapshotError { + pub message: String, +} + +impl SnapshotError { + pub(crate) fn new(message: impl Into) -> Self { + Self { + message: message.into(), + } + } +} + +impl fmt::Display for SnapshotError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(&self.message) + } +} + +impl std::error::Error for SnapshotError {} + +fn invalid(message: impl fmt::Display) -> SnapshotError { + SnapshotError::new(format!("Invalid snapshot: {message}")) +} + +type R = Result; + +/// What a fresh run has made before its program starts. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct Base { + pub heap: usize, + pub bufs: usize, + pub atoms: usize, + pub cells: usize, + pub functions: usize, +} + +impl Base { + pub fn of(vm: &Vm) -> Base { + let (bufs, atoms) = vm.atoms.counts(); + Base { + heap: vm.heap.len(), + bufs, + atoms, + cells: vm.cells.len(), + functions: vm.host.functions.len(), + } + } + + fn json(&self) -> J { + json!([self.heap, self.bufs, self.atoms, self.cells, self.functions]) + } +} + +// ---------- the native table ---------- + +struct Natives { + list: Vec, + index: FxHashMap, + /// Identifies what a fresh VM makes, for the build id. + shape: u64, +} + +fn natives() -> &'static Natives { + static TABLE: OnceLock = OnceLock::new(); + TABLE.get_or_init(|| { + let mut vm = Vm::new( + host::RunHost::bare(), + Limits::default(), + crate::strings::Strings::new(), + ); + vm.setup(); + let base = vm.heap.len(); + for bit in 0..8 { + crate::builtins::ensure(&mut vm, 1 << bit); + } + let mut list: Vec = Vec::new(); + list.extend(host::snapshot_natives()); + list.extend(crate::promise::snapshot_natives()); + for o in vm.heap.iter() { + if let Kind::Native { f, .. } = &o.kind { + list.push(*f); + } + } + let mut index = FxHashMap::default(); + let mut unique = Vec::new(); + for f in list { + if let std::collections::hash_map::Entry::Vacant(e) = index.entry(f as usize) { + e.insert(unique.len() as u32); + unique.push(f); + } + } + let shape = hash( + format!( + "{FORMAT} {} {base} {} {:?}", + unique.len(), + vm.heap.len(), + vm.atoms.counts() + ) + .as_bytes(), + ); + Natives { + list: unique, + index, + shape, + } + }) +} + +/// The build a snapshot belongs to: the package version and the shape of what the VM makes. +pub fn build_id() -> String { + format!("{}+{:016x}", env!("CARGO_PKG_VERSION"), natives().shape) +} + +/// FNV-1a, for the build and source hashes. +fn hash(bytes: &[u8]) -> u64 { + let mut h: u64 = 0xcbf2_9ce4_8422_2325; + for b in bytes { + h ^= *b as u64; + h = h.wrapping_mul(0x0100_0000_01b3); + } + h +} + +fn hex(h: u64) -> String { + format!("{h:016x}") +} + +/// The shape of a run's host globals: their names, the functions among them by label (with whether they have +/// `snapshot` hooks or are durable), and their namespaces, the reference's `hosts` shape. +pub(crate) fn hosts_id(globals: &[(String, HostValue)]) -> String { + fn shape(v: &HostValue, label: &str, text: &mut String) { + match v { + HostValue::Function(f) => { + text.push_str(label); + text.push_str(if f.snapshot.is_some() { "+;" } else { ";" }); + } + HostValue::Durable(_) => { + text.push_str(label); + text.push_str("~;"); + } + HostValue::Namespace(_) => { + text.push_str(label); + text.push_str("*;"); + } + HostValue::Object(fields) => { + for (k, item) in fields { + shape(item, &format!("{label}.{k}"), text); + } + } + _ => {} + } + } + let mut text = String::new(); + for (name, value) in globals { + text.push_str(name); + text.push(','); + shape(value, name, &mut text); + text.push('\n'); + } + hex(hash(text.as_bytes())) +} + +/// The bytecode of a compiled program, for checking a restore compiles the same instructions. +pub fn bytecode_hash(program: &crate::bytecode::Program) -> String { + let mut text = String::new(); + for p in &program.protos { + text.push_str(&format!("{:?}|{:?}|{}\n", p.code, p.pos, p.nlocals)); + } + text.push_str(&format!("{}", program.consts.len())); + hex(hash(text.as_bytes())) +} + +// ---------- values ---------- + +fn num(n: f64) -> J { + if n.is_nan() { + return J::from("NaN"); + } + if n.is_infinite() { + return J::from(if n > 0.0 { "Inf" } else { "-Inf" }); + } + if n == 0.0 && n.is_sign_negative() { + return J::from("-0"); + } + serde_json::Number::from_f64(n).map_or(J::Null, J::Number) +} + +fn val(v: &Value) -> J { + match v { + Value::Undef => J::from("u"), + Value::Null => J::Null, + Value::Bool(b) => J::Bool(*b), + Value::Num(n) => num(*n), + Value::Str(s) => J::from(format!("s{s}")), + Value::Obj(o) => J::from(format!("o{o}")), + Value::Sym(s) => J::from(format!("y{s}")), + Value::Uninit => J::from("i"), + } +} + +fn slot(s: &Slot) -> J { + val(&s.get()) +} + +fn vals(items: &[Value]) -> J { + J::Array(items.iter().map(val).collect()) +} + +fn outcome(o: &Result) -> J { + match o { + Ok(v) => json!(["ok", val(v)]), + Err(e) => json!(["err", val(e)]), + } +} + +fn opt_id(id: Option) -> J { + id.map_or(J::Null, J::from) +} + +/// A crossing to the host in progress (`cross::Cross`). +fn cross(c: &crate::cross::Cross) -> J { + use crate::cross::{Step, Waiting}; + let stack: Vec = c + .stack + .iter() + .map(|v| { + let step = match &v.step { + Step::Start => json!(["s"]), + Step::Array { + target, + out, + len, + i, + } => json!(["a", val(target), out, len, i]), + Step::Object { + target, + out, + names, + i, + } => json!(["o", val(target), out, vals(names), i]), + }; + json!([val(&v.holder), val(&v.key), v.depth, step]) + }) + .collect(); + let waiting = match c.waiting { + Waiting::No => 0, + Waiting::Root => 1, + Waiting::Value => 2, + Waiting::Getter => 3, + }; + json!([ + "x", + vals(&c.roots), + vals(&c.crossed), + stack, + vals(&c.ancestors), + json!(["result"]), + waiting, + c.owed + ]) +} + +// ---------- capture ---------- + +/// What a capture needs to know beyond the VM. +pub struct Capture<'c> { + pub code: &'c str, + pub active_ms: u64, +} + +struct Enc<'v> { + vm: &'v Vm, + natives: &'static Natives, + protos: FxHashMap, + buffers: Vec>>>, +} + +/// Why a suspend was refused: the calls that block it, or a state that can't be saved. +pub enum Refusal { + Running(Vec<(u64, String)>), + Other(String), +} + +/// Saves the VM's state as it is now. The VM must be at a safe point: between jobs, or stopped at a back-edge. +pub fn capture(vm: &Vm, c: &Capture) -> Result { + let running: Vec<(u64, String)> = vm + .host + .calls + .iter() + .filter(|call| { + call.holds_functions + || match &call.kind { + CallKind::Blocking => true, + CallKind::Idempotent => false, + CallKind::Durable(data, ..) => data.lock().map(|d| d.is_none()).unwrap_or(true), + } + }) + .map(|call| (call.call, call.label.clone())) + .collect(); + if !running.is_empty() { + let mut running = running; + running.sort_by_key(|(call, _)| *call); + return Err(Refusal::Running(running)); + } + let mut enc = Enc { + vm, + natives: natives(), + protos: vm + .protos + .iter() + .enumerate() + .map(|(i, p)| (Arc::as_ptr(p) as usize, i)) + .collect(), + buffers: Vec::new(), + }; + let state = enc.state(c).map_err(|e| Refusal::Other(e.message))?; + let base = vm.snapshot_base; + let program = crate::run::compile(c.code, &mut crate::strings::Strings::new()) + .map_err(|e| Refusal::Other(e.message))?; + let limits = vm.limits; + let metadata = vm.host.run.metadata(); + let header = json!({ + "build": build_id(), + "hosts": hosts_id(&vm.host.globals), + "runId": vm.host.run.id.get().cloned(), + "metadata": metadata.to_json(), + "metadataData": (!well_formed(&metadata)).then(|| host_value(&metadata.to_host())), + "source": { + "code": c.code, + "hash": hex(hash(c.code.as_bytes())), + "bytecode": bytecode_hash(&program), + }, + "limits": { + "timeoutMs": limits.timeout_ms, + "maxOutputBytes": limits.max_output_bytes, + }, + "budget": { "activeMs": c.active_ms }, + "base": base.json(), + }); + Ok(Snapshot( + json!({ "format": FORMAT, "header": header, "state": state }), + )) +} + +impl Enc<'_> { + fn state(&mut self, c: &Capture) -> R { + let vm = self.vm; + let base = vm.snapshot_base; + let (texts, atoms) = vm.atoms.save_from(base.bufs, base.atoms); + let baseline = baseline(vm, c.code)?; + let mut changed = Vec::new(); + for (id, o) in vm.heap.iter().enumerate().take(base.heap) { + let now = self.obj(o)?; + let fresh = baseline.get(id); + if fresh != Some(&now) { + changed.push(json!([id, now])); + } + } + let mut rest = Vec::new(); + for o in vm.heap.iter().skip(base.heap) { + rest.push(self.obj(o)?); + } + let mut global_map: Vec<(&u32, &Value)> = vm.global_map.iter().collect(); + global_map.sort_by_key(|(a, _)| **a); + let host = self.host(c)?; + let std = &vm.realm.std; + Ok(json!({ + "strings": texts.iter().map(|(t, b)| json!([t, b])).collect::>(), + "atoms": atoms, + "cells": vm.cells[base.cells.min(vm.cells.len())..].iter().map(slot).collect::>(), + "changed": changed, + "heap": rest, + "buffers": self.buffers.iter().map(|b| J::from(bytes_hex(&b.lock().unwrap_or_else(std::sync::PoisonError::into_inner)))).collect::>(), + "stack": vm.stack.iter().map(slot).collect::>(), + "frames": vm.frames.iter().map(|f| self.frame(f)).collect::>>()?, + "handlers": vm.handlers_ref().iter().map(handler).collect::>(), + "globals": vals(&vm.globals), + "globalMap": global_map.iter().map(|(a, v)| json!([a, val(v)])).collect::>(), + "templates": vm.template_objs_ref().iter().map(|t| opt_id(*t)).collect::>(), + "jobs": vm.jobs.iter().map(|j| self.job(j)).collect::>(), + "inbox": vm.inbox.iter().map(|(p, s)| self.settlement(*p, s)).collect::>>()?, + "coroutines": vm.coroutines.iter().map(|co| self.coroutine(co)).collect::>>()?, + "logs": vm.logs, + "rng": vm.rng.to_string(), + "std": [std.regexp, std.date, std.uint8, std.buffer, std.text_encoder, std.text_decoder, + std.weak_map, std.weak_set, std.iterator_helper, std.uri_error, std.url, std.params, + std.headers, std.loaded], + "host": host, + })) + } + + fn host(&mut self, _c: &Capture) -> R { + let h = &self.vm.host; + let base = self.vm.snapshot_base; + // Each result its owner's hooks can bring back, as the data its `encode` made. + let mut results = Vec::new(); + for root in &h.results { + let Some(hooks) = h.hooks(&root.owner) else { + continue; + }; + let data = encode(&hooks, &root.owner, &root.value)?; + results.push(json!([ + root.owner, + host_value(&data), + root.functions.start, + root.functions.end + ])); + } + let functions: Vec = h.functions[base.functions.min(h.functions.len())..] + .iter() + .map(|f| { + let (name, length, own) = match &f.f { + Callee::Fn(hf) => (hf.name(), hf.length, hf.own_name), + Callee::Durable(_) => ("", 0, false), + }; + json!([ + f.label, + f.path.as_deref().map(texts), + f.owner, + f.installed, + name, + length, + own + ]) + }) + .collect(); + let mut suggestions: Vec<(&Id, &Vec)> = h.suggestions.iter().collect(); + suggestions.sort_by_key(|(id, _)| **id); + let mut modules: Vec<(&String, &Value)> = h.modules_loaded.iter().collect(); + modules.sort_by(|a, b| a.0.cmp(b.0)); + let mut namespaces: Vec<(&String, &Value)> = h.namespaces.iter().collect(); + namespaces.sort_by(|a, b| a.0.cmp(b.0)); + let mut calls = Vec::new(); + for call in &h.calls { + let args = J::Array(call.args.iter().map(host_value).collect()); + let start = match &call.kind { + CallKind::Idempotent => json!(["again"]), + CallKind::Durable(data, ..) => match data.lock().map(|d| d.clone()).unwrap_or(None) + { + Some(data) => json!(["wait", host_value(&data.to_host())]), + None => continue, + }, + CallKind::Blocking => continue, + }; + if !call.args.iter().all(plain_arg) { + return Err(SnapshotError::new(format!( + "The call {} ({}) holds arguments with no data form.", + h.key(call.call), + call.label + ))); + } + calls.push(json!([ + start, + call.promise, + call.call, + call.label, + call.path.as_deref().map(texts), + args, + call.owner, + call.site + ])); + } + Ok(json!({ + "nextCall": h.next_call, + "functions": functions, + "results": results, + "suggestions": suggestions.iter().map(|(id, s)| json!([id, texts(s)])).collect::>(), + "promiseLike": opt_id(h.promise_like), + "unhandled": h.unhandled.iter().map(|(p, v)| json!([p, val(v)])).collect::>(), + "modules": modules.iter().map(|(k, v)| json!([k, val(v)])).collect::>(), + "namespaces": namespaces.iter().map(|(k, v)| json!([k, val(v)])).collect::>(), + "calls": calls, + })) + } + + fn obj(&mut self, o: &Obj) -> R { + let props: Vec = o + .props + .items + .iter() + .map(|p| json!([p.key, val(&p.value), p.flags])) + .collect(); + Ok(json!([ + opt_id(o.proto), + o.flags, + props, + self.kind(&o.kind)? + ])) + } + + fn kind(&mut self, k: &Kind) -> R { + Ok(match k { + Kind::Ordinary => J::from("o"), + Kind::Array(items) => json!(["a", vals(items)]), + Kind::Arguments(items) => json!(["g", vals(items)]), + Kind::Closure(c) => { + let proto = self.proto(&c.proto)?; + json!([ + "c", + proto, + c.upvals.to_vec(), + val(&c.this), + val(&c.home), + val(&c.fields) + ]) + } + Kind::Native { + f, + data, + name, + length, + ctor, + } => { + let Some(i) = self.natives.index.get(&(*f as usize)).map(|&i| i as usize) else { + return Err(SnapshotError::new( + "The run can't be suspended: it holds a native function this build can't name.", + )); + }; + json!(["n", i, val(data), name, length, ctor]) + } + Kind::Bound(b) => json!(["b", val(&b.0), val(&b.1), vals(&b.2)]), + Kind::Error(f) => match f { + None => json!(["e", J::Null]), + Some(f) => json!(["e", [f.kind.name(), f.message, f.offset]]), + }, + Kind::Promise(d) => { + let state = match &d.state { + PromiseState::Pending => json!(["pending"]), + PromiseState::Fulfilled(v) => json!(["ok", val(v)]), + PromiseState::Rejected(e) => json!(["err", val(e)]), + }; + let reactions: Vec = d.reactions.iter().map(reaction).collect(); + json!(["p", state, reactions]) + } + Kind::Map(m) => json!(["m", map(m)]), + Kind::Set(m) => json!(["s", map(m)]), + Kind::WeakMap(m) => json!(["wm", map(m)]), + Kind::WeakSet(m) => json!(["ws", map(m)]), + Kind::Generator(g) => json!(["gen", self.gen_state(g)?]), + Kind::ArrayIter { target, pos, kind } => json!(["ai", target, pos, iter_kind(*kind)]), + Kind::MapIter { target, pos, kind } => json!(["mi", target, pos, iter_kind(*kind)]), + Kind::ExoticIter { target, pos, kind } => { + json!(["xi", target, pos, iter_kind(*kind)]) + } + Kind::StrIter { s, pos } => json!(["si", s, pos]), + Kind::Cross(c) => cross(c), + Kind::ListIter { items, pos } => json!(["li", vals(items), pos]), + Kind::Namespace(ns) => json!(["t", (!ns.is_root()).then_some(ns.parent), ns.name]), + Kind::Resolvers { promise, done } => json!(["r", promise, done]), + Kind::Combinator(c) => { + let kind = match c.kind { + CombKind::All => 0, + CombKind::AllSettled => 1, + CombKind::Any => 2, + }; + json!(["cb", kind, c.promise, vals(&c.values), c.remaining]) + } + Kind::RegExp(r) => json!(["re", r.source, r.flags, num(r.last_index)]), + Kind::Date(t) => json!(["d", num(*t)]), + Kind::Bytes(b) => { + let i = match self.buffers.iter().position(|x| Arc::ptr_eq(x, &b.buf)) { + Some(i) => i, + None => { + self.buffers.push(b.buf.clone()); + self.buffers.len() - 1 + } + }; + json!(["y", i, b.start, b.len, b.buffer]) + } + Kind::TextDecoder(d) => { + json!(["td", d.fatal, d.ignore_bom, bytes_hex(&d.queued), d.seen]) + } + Kind::IterHelper(h) => { + use crate::builtins::iterator::{HelperOp, HelperState}; + let op = match &h.op { + HelperOp::Wrap => json!(["wrap"]), + HelperOp::Map(f) => json!(["map", val(f)]), + HelperOp::Filter(f) => json!(["filter", val(f)]), + HelperOp::Take(n) => json!(["take", num(*n)]), + HelperOp::Drop(n) => json!(["drop", num(*n)]), + HelperOp::FlatMap(f, inner) => json!([ + "flatmap", + val(f), + inner.map_or(J::Null, |(a, b)| json!([val(&a), val(&b)])) + ]), + }; + let state = match h.state { + HelperState::Start => 0, + HelperState::Suspended => 1, + HelperState::Running => 2, + HelperState::Done => 3, + }; + json!([ + "ih", + val(&h.iter), + val(&h.next), + op, + num(h.counter), + state, + val(&h.site) + ]) + } + Kind::Url(u) => json!(["url", u.url.as_str(), u.params]), + Kind::SearchParams(p) => json!(["sp", p.list, opt_id(p.url)]), + Kind::Headers(h) => json!(["h", h.list]), + Kind::AsyncGenerator(a) => { + let phase = match a.phase { + AsyncPhase::Start => 0, + AsyncPhase::Yield => 1, + AsyncPhase::Executing => 2, + AsyncPhase::AwaitingReturn => 3, + AsyncPhase::Completed => 4, + }; + let queue: Vec = a + .queue + .iter() + .map(|r| json!([r.kind, val(&r.value), r.promise])) + .collect(); + json!(["ag", self.gen_state(&a.state)?, phase, queue]) + } + Kind::AsyncFromSync { sync, next } => json!(["afs", sync, val(next)]), + Kind::Accessor(a) => json!(["acc", val(&a.get), val(&a.set)]), + }) + } + + fn proto(&self, p: &Arc) -> R { + self.protos + .get(&(Arc::as_ptr(p) as usize)) + .copied() + .ok_or_else(|| { + SnapshotError::new("The run can't be suspended: a function is not this run's code.") + }) + } + + fn gen_state(&self, g: &GenState) -> R { + Ok(match g { + GenState::Done => json!(["done"]), + GenState::Suspended(s) => json!(["susp", self.saved(s)?]), + GenState::Running(s) => json!(["run", self.saved(s)?]), + }) + } + + fn saved(&self, s: &SavedFrame) -> R { + let frame = match &s.frame { + Some(f) => self.frame(f)?, + None => J::Null, + }; + let mut out = json!([ + frame, + s.stack.iter().map(slot).collect::>(), + s.handlers.iter().map(handler).collect::>(), + s.started + ]); + if !s.above.is_empty() + && let J::Array(items) = &mut out + { + items.push(J::Array( + s.above + .iter() + .map(|f| self.frame(f)) + .collect::>>()?, + )); + if !s.splits.is_empty() { + items.push(json!(s.splits)); + } + } + Ok(out) + } + + fn frame(&self, f: &Frame) -> R { + let kind = match f.kind { + FrameKind::Normal => json!(["n"]), + FrameKind::Native(op, sub) => json!(["x", op.code(), sub]), + FrameKind::Async(c) => json!(["a", c]), + FrameKind::Generator(g, r) => { + let r = match r { + Resume::Iter => json!("i"), + Resume::Delegate => json!("d"), + Resume::Collect(a) => json!(["c", a]), + Resume::Result => json!("r"), + Resume::Native => json!("x"), + }; + json!(["g", g, r]) + } + }; + // A native frame's code is not the program's: its step function is in its mode. + let proto = match f.kind { + FrameKind::Native(..) => 0, + _ => self.proto(&f.func)?, + }; + Ok(json!([ + proto, + f.pc, + f.base, + f.upvals.to_vec(), + f.hbase, + vals(&f.extra), + f.argc, + kind, + f.is_base, + f.yield_pc + ])) + } + + fn coroutine(&self, c: &Coroutine) -> R { + let saved = match &c.saved { + Some(s) => self.saved(s)?, + None => J::Null, + }; + Ok(json!([saved, opt_id(c.promise)])) + } + + fn job(&self, j: &Job) -> J { + match j { + Job::Reaction(r, o) => json!(["r", reaction(r), outcome(o)]), + Job::Thenable { + promise, + thenable, + then, + } => json!(["t", promise, val(thenable), val(then)]), + } + } + + fn settlement(&self, p: Id, s: &Settlement) -> R { + Ok(match s { + Settlement::Undefined => json!([p, "undef"]), + Settlement::Failure(f) => { + let (kind, message, suggestions) = f.parts(); + json!([p, "fail", kind.name(), text(message), texts(suggestions)]) + } + Settlement::Lost(message, site) => json!([p, "lost", message, site]), + Settlement::Host(h) => { + let Settled { + result, + label, + owner, + site, + } = h.as_ref(); + let (ok, v) = match result { + Ok(v) => (true, v), + Err(v) => (false, v), + }; + let hooks = owner.as_deref().and_then(|o| self.vm.host.hooks(o)); + let (hooked, data) = match (hooks, owner) { + (Some(hooks), Some(owner)) if ok && has_functions(v) => { + (true, encode(&hooks, owner, v)?) + } + _ => (false, v.clone()), + }; + json!([p, "host", ok, label, owner, hooked, host_value(&data), site]) + } + Settlement::Interrupted => json!([p, "interrupted"]), + }) + } +} + +/// What a host function's `snapshot` hooks save of a value it returned: plain data, or why they can't. +fn encode(hooks: &crate::SnapshotHooks, owner: &str, v: &HostValue) -> R { + let data = (hooks.encode)(v).map_err(|e| { + SnapshotError::new(format!( + "The host function {owner} couldn't save a value it returned: {}", + e.message + )) + })?; + if !plain(&data) { + return Err(SnapshotError::new(format!( + "The host function {owner} couldn't save a value it returned: it gave data that isn't plain." + ))); + } + Ok(data) +} + +/// An argument a resumed call can be given again: anything but a function. +fn plain_arg(v: &HostValue) -> bool { + let mut fns = Vec::new(); + collect_functions(v, &mut fns); + fns.is_empty() + && !matches!( + v, + HostValue::Durable(_) | HostValue::Namespace(_) | HostValue::Response(_) + ) +} + +fn handler(h: &Handler) -> J { + json!([h.pc, h.sp]) +} + +fn iter_kind(k: IterKind) -> u8 { + match k { + IterKind::Keys => 0, + IterKind::Values => 1, + IterKind::Entries => 2, + } +} + +/// The live entries with their logical positions, which iterators and native frames hold. +fn map(m: &OrderedMap) -> J { + let entries: Vec = m + .positioned() + .map(|(p, k, v)| json!([p, val(&k), val(&v)])) + .collect(); + json!([m.end(), entries]) +} + +fn reaction(r: &Reaction) -> J { + match r { + Reaction::Then { + on_ful, + on_rej, + derived, + } => json!(["then", val(on_ful), val(on_rej), derived]), + Reaction::Await(c) => json!(["await", c]), + Reaction::Resolve(t) => json!(["resolve", t]), + Reaction::Comb { comb, index } => json!(["comb", comb, index]), + Reaction::Finally { cleanup, derived } => json!(["finally", val(cleanup), derived]), + Reaction::Restore { + derived, + outcome: o, + } => json!(["restore", derived, outcome(o)]), + Reaction::Program => json!(["program"]), + Reaction::Cross(id) => json!(["cross", id]), + Reaction::AwaitGen(g) => json!(["awaitgen", g]), + Reaction::GenReturn(g) => json!(["genreturn", g]), + Reaction::FromSync { made, done, close } => json!(["fromsync", made, done, opt_id(*close)]), + } +} + +fn bytes_hex(b: &[u8]) -> String { + let mut s = String::with_capacity(b.len() * 2); + for x in b { + s.push_str(&format!("{x:02x}")); + } + s +} + +fn hex_bytes(s: &str) -> R> { + if !s.is_ascii() || !s.len().is_multiple_of(2) { + return Err(invalid("a byte string is not hex.")); + } + (0..s.len()) + .step_by(2) + .map(|i| { + u8::from_str_radix(&s[i..i + 2], 16).map_err(|_| invalid("a byte string is not hex.")) + }) + .collect() +} + +/// Each object of a fresh run's base, encoded, to see which ones the run changed. +fn baseline(vm: &Vm, code: &str) -> R> { + let mut atoms = crate::strings::Strings::new(); + let program = + crate::run::compile(code, &mut atoms).map_err(|e| SnapshotError::new(e.message))?; + let h = &vm.host; + let host = host::RunHost::new( + h.globals.clone(), + h.modules.clone(), + h.translate, + h.run.clone(), + ); + let mut fresh = Vm::new(host, vm.limits, atoms); + fresh.setup(); + crate::builtins::ensure_globals(&mut fresh, &program.globals); + host::install(&mut fresh, &program.globals); + let mut enc = Enc { + vm: &fresh, + natives: natives(), + protos: FxHashMap::default(), + buffers: Vec::new(), + }; + fresh.heap.iter().map(|o| enc.obj(o)).collect() +} + +// ---------- host values ---------- + +fn has_functions(v: &HostValue) -> bool { + let mut out = Vec::new(); + collect_functions(v, &mut out); + !out.is_empty() +} + +/// The functions of a host value, in the order the VM wraps them when it copies the value in. +fn collect_functions(v: &HostValue, out: &mut Vec) { + match v { + HostValue::Function(f) => out.push(f.clone()), + HostValue::Array(items) => items + .iter() + .flatten() + .for_each(|i| collect_functions(i, out)), + HostValue::Object(fields) => fields.iter().for_each(|(_, i)| collect_functions(i, out)), + HostValue::Map(entries) => entries.iter().for_each(|(k, i)| { + collect_functions(k, out); + collect_functions(i, out); + }), + HostValue::Set(items) => items.iter().for_each(|i| collect_functions(i, out)), + // An error's own functions are dropped when it crosses; only its cause can hold some. + HostValue::Error(e) => { + if let Some(c) = &e.cause { + collect_functions(c, out); + } + } + _ => {} + } +} + +/// Plain data, as `snapshot.encode` must return: JSON values and bytes. +fn plain(v: &HostValue) -> bool { + match v { + HostValue::Null + | HostValue::Bool(_) + | HostValue::Number(_) + | HostValue::String(_) + | HostValue::Bytes(_) => true, + HostValue::Array(items) => items.iter().all(|i| i.as_ref().is_some_and(plain)), + HostValue::Object(fields) => fields.iter().all(|(_, i)| plain(i)), + _ => false, + } +} + +fn host_value(v: &HostValue) -> J { + match v { + HostValue::Undefined => json!(["u"]), + HostValue::Null => J::Null, + HostValue::Bool(b) => J::Bool(*b), + HostValue::Number(n) => json!(["n", num(*n)]), + HostValue::String(s) => text(s), + HostValue::Array(items) => json!([ + "a", + items + .iter() + .map(|i| i.as_ref().map_or(json!(["hole"]), host_value)) + .collect::>() + ]), + HostValue::Object(fields) => json!([ + "o", + fields + .iter() + .map(|(k, v)| json!([text(k), host_value(v)])) + .collect::>() + ]), + HostValue::Map(entries) => json!([ + "m", + entries + .iter() + .map(|(k, v)| json!([host_value(k), host_value(v)])) + .collect::>() + ]), + HostValue::Set(items) => json!(["set", items.iter().map(host_value).collect::>()]), + HostValue::Function(f) => json!(["f", f.name(), f.length]), + HostValue::Durable(_) | HostValue::Namespace(_) => json!(["f", "", 0]), + HostValue::Interrupt => json!(["u"]), + HostValue::Failure(f) => json!(["fail", f.kind, text(&f.message), texts(&f.suggestions)]), + HostValue::Date(t) => json!(["date", num(*t)]), + HostValue::RegExp { source, flags } => json!(["re", text(source), flags]), + HostValue::Url(href) => json!(["url", href]), + HostValue::SearchParams(pairs) => json!(["sp", pairs]), + HostValue::Headers(entries) => json!(["hd", entries]), + HostValue::Bytes(b) => json!(["u8", bytes_hex(b)]), + HostValue::Buffer(b) => json!(["buf", bytes_hex(b)]), + HostValue::Response(_) => json!(["resp"]), + HostValue::Error(e) => json!([ + "e", + text(&e.name), + text(&e.message), + e.cause.as_ref().map_or(J::Null, |c| host_value(c)), + e.fields + .iter() + .map(|(k, v)| json!([text(k), host_value(v)])) + .collect::>() + ]), + } +} + +/// Where a saved host value holds a live response, named as the reference names what crosses: `label.key` in an +/// object, `label[i]` in an array, `label` in a Map or Set. +fn lost_path(j: &J, label: &str) -> Option { + let J::Array(a) = j else { + return None; + }; + let items = || a.get(1).and_then(J::as_array).into_iter().flatten(); + match a.first().and_then(J::as_str)? { + "resp" => Some(label.to_owned()), + "a" => items() + .enumerate() + .find_map(|(i, item)| lost_path(item, &format!("{label}[{i}]"))), + "o" => items().find_map(|p| { + let key = p.get(0).and_then(J::as_str).unwrap_or(""); + lost_path(p.get(1)?, &format!("{label}.{key}")) + }), + "m" => items() + .find_map(|p| lost_path(p.get(0)?, label).or_else(|| lost_path(p.get(1)?, label))), + "set" => items().find_map(|item| lost_path(item, label)), + _ => None, + } +} + +/// Whether data's strings and keys are all well formed, so plain JSON holds it exactly. +fn well_formed(d: &crate::Data) -> bool { + use crate::Data; + match d { + Data::String(s) => s.is_well_formed(), + Data::Array(items) => items.iter().all(well_formed), + Data::Object(fields) => fields + .iter() + .all(|(k, v)| k.is_well_formed() && well_formed(v)), + _ => true, + } +} + +/// A host string as saved: JSON text when well formed, else its UTF-16 code units. +fn text(s: &crate::HostString) -> J { + match s.as_str() { + Some(s) => J::from(s), + None => json!(["s16", s.to_utf16()]), + } +} + +fn texts(list: &[crate::HostString]) -> J { + J::Array(list.iter().map(text).collect()) +} + +fn texts_from(j: &J) -> R> { + j.as_array() + .ok_or_else(|| invalid("a list of strings is not a list."))? + .iter() + .map(text_from) + .collect() +} + +fn text_from(j: &J) -> R { + match j { + J::String(s) => Ok(s.into()), + J::Array(a) if a.first().and_then(J::as_str) == Some("s16") => { + let units = list(a.get(1))? + .iter() + .map(|u| u.as_u64().and_then(|u| u16::try_from(u).ok())) + .collect::>>() + .ok_or_else(|| invalid("a string's code units are malformed."))?; + Ok(crate::HostString::from_utf16(&units)) + } + _ => Err(invalid("a string is malformed.")), + } +} + +fn host_value_from(j: &J) -> R { + Ok(match j { + J::Null => HostValue::Null, + J::Bool(b) => HostValue::Bool(*b), + J::String(s) => HostValue::String(s.into()), + J::Array(a) => match a.first().and_then(J::as_str) { + Some("s16") => HostValue::String(text_from(j)?), + Some("u") => HostValue::Undefined, + Some("n") => HostValue::Number(unnum(a.get(1).unwrap_or(&J::Null))?), + Some("a") => HostValue::Array( + list(a.get(1))? + .iter() + .map(|i| match i { + J::Array(x) if x.first().and_then(J::as_str) == Some("hole") => Ok(None), + other => host_value_from(other).map(Some), + }) + .collect::>()?, + ), + Some("o") => HostValue::Object( + list(a.get(1))? + .iter() + .map(|p| Ok((text_from(at(p, 0)?)?, host_value_from(at(p, 1)?)?))) + .collect::>()?, + ), + Some("m") => HostValue::Map( + list(a.get(1))? + .iter() + .map(|p| Ok((host_value_from(at(p, 0)?)?, host_value_from(at(p, 1)?)?))) + .collect::>()?, + ), + Some("set") => HostValue::Set( + list(a.get(1))? + .iter() + .map(host_value_from) + .collect::>()?, + ), + Some("f") => HostValue::Function(host::lost_function( + a.get(1).and_then(J::as_str).unwrap_or(""), + )), + Some("fail") => HostValue::Failure( + crate::Failure::new(string(at(j, 1)?)?, text_from(at(j, 2)?)?) + .suggestions(texts_from(at(j, 3)?)?), + ), + Some("date") => HostValue::Date(unnum(a.get(1).unwrap_or(&J::Null))?), + Some("re") => HostValue::RegExp { + source: text_from(at(j, 1)?)?, + flags: string(at(j, 2)?)?, + }, + Some("url") => HostValue::Url(string(at(j, 1)?)?), + Some("sp") => HostValue::SearchParams(pairs(at(j, 1)?)?), + Some("hd") => HostValue::Headers(pairs(at(j, 1)?)?), + Some("u8") => HostValue::Bytes(hex_bytes(&string(at(j, 1)?)?)?), + Some("buf") => HostValue::Buffer(hex_bytes(&string(at(j, 1)?)?)?), + // A live response has no data form; a settlement holding one is restored as `lost_path` says. + Some("resp") => HostValue::Undefined, + Some("e") => HostValue::Error(Box::new(HostError { + name: text_from(at(j, 1)?)?, + message: text_from(at(j, 2)?)?, + cause: match at(j, 3)? { + J::Null => None, + c => Some(Box::new(host_value_from(c)?)), + }, + fields: list(a.get(4))? + .iter() + .map(|p| Ok((text_from(at(p, 0)?)?, host_value_from(at(p, 1)?)?))) + .collect::>()?, + })), + _ => return Err(invalid("a host value has an unknown tag.")), + }, + J::Number(_) | J::Object(_) => return Err(invalid("a host value is malformed.")), + }) +} + +// ---------- decoding helpers ---------- + +fn at(j: &J, i: usize) -> R<&J> { + j.as_array() + .and_then(|a| a.get(i)) + .ok_or_else(|| invalid(format!("an entry lacks field {i}."))) +} + +fn list(j: Option<&J>) -> R<&Vec> { + j.and_then(J::as_array) + .ok_or_else(|| invalid("a list is missing.")) +} + +fn field<'j>(j: &'j J, name: &str) -> R<&'j J> { + j.get(name) + .ok_or_else(|| invalid(format!("the state lacks {name}."))) +} + +fn field_list<'j>(j: &'j J, name: &str) -> R<&'j Vec> { + field(j, name)? + .as_array() + .ok_or_else(|| invalid(format!("{name} is not a list."))) +} + +fn uint(j: &J) -> R { + j.as_u64() + .ok_or_else(|| invalid("a count is not a number.")) +} + +fn u32_(j: &J) -> R { + u32::try_from(uint(j)?).map_err(|_| invalid("a count is out of range.")) +} + +fn usize_(j: &J) -> R { + usize::try_from(uint(j)?).map_err(|_| invalid("a count is out of range.")) +} + +fn boolean(j: &J) -> R { + j.as_bool() + .ok_or_else(|| invalid("a flag is not a boolean.")) +} + +fn string(j: &J) -> R { + j.as_str() + .map(str::to_owned) + .ok_or_else(|| invalid("a text is not a string.")) +} + +fn unnum(j: &J) -> R { + match j { + J::Number(n) => n.as_f64().ok_or_else(|| invalid("a number is malformed.")), + J::String(s) => match s.as_str() { + "NaN" => Ok(f64::NAN), + "Inf" => Ok(f64::INFINITY), + "-Inf" => Ok(f64::NEG_INFINITY), + "-0" => Ok(-0.0), + _ => Err(invalid("a number is malformed.")), + }, + _ => Err(invalid("a number is malformed.")), + } +} + +fn opt_u32(j: &J) -> R> { + match j { + J::Null => Ok(None), + other => u32_(other).map(Some), + } +} + +fn kind_named(name: &str) -> R { + Ok(DiagnosticKind::named(name)) +} + +// ---------- restore ---------- + +struct Dec<'p> { + natives: &'static Natives, + heap_len: usize, + bufs_len: usize, + protos: usize, + buffers: Vec>>>, + _p: std::marker::PhantomData<&'p ()>, +} + +impl Dec<'_> { + fn val(&self, j: &J) -> R { + let id = |s: &str| -> R { + s[1..] + .parse::() + .map_err(|_| invalid("a value reference is malformed.")) + }; + Ok(match j { + J::Null => Value::Null, + J::Bool(b) => Value::Bool(*b), + J::Number(_) => Value::Num(unnum(j)?), + J::String(s) => match s.as_str() { + "u" => Value::Undef, + "i" => Value::Uninit, + "NaN" | "Inf" | "-Inf" | "-0" => Value::Num(unnum(j)?), + t if t.starts_with('s') => { + let s = id(t)?; + if s as usize >= self.bufs_len { + return Err(invalid("a string reference is out of range.")); + } + Value::Str(s) + } + t if t.starts_with('o') => { + let o = id(t)?; + if o as usize >= self.heap_len { + return Err(invalid("an object reference is out of range.")); + } + Value::Obj(o) + } + t if t.starts_with('y') => { + let a = id(t)?; + if a > SYM_ASYNC_ITERATOR { + return Err(invalid("a symbol is unknown.")); + } + Value::Sym(a) + } + _ => return Err(invalid("a value is malformed.")), + }, + _ => return Err(invalid("a value is malformed.")), + }) + } + + fn vals(&self, j: &J) -> R> { + j.as_array() + .ok_or_else(|| invalid("a value list is not a list."))? + .iter() + .map(|v| self.val(v)) + .collect() + } + + fn slot(&self, j: &J) -> R { + Ok(Slot::pack(self.val(j)?)) + } + + fn slots(&self, j: &J) -> R> { + j.as_array() + .ok_or_else(|| invalid("a stack is not a list."))? + .iter() + .map(|v| self.slot(v)) + .collect() + } + + fn id(&self, j: &J) -> R { + let id = u32_(j)?; + if id as usize >= self.heap_len { + return Err(invalid("an object id is out of range.")); + } + Ok(id) + } + + fn opt_id(&self, j: &J) -> R> { + match j { + J::Null => Ok(None), + other => self.id(other).map(Some), + } + } + + fn outcome(&self, j: &J) -> R> { + let v = self.val(at(j, 1)?)?; + match at(j, 0)?.as_str() { + Some("ok") => Ok(Ok(v)), + Some("err") => Ok(Err(v)), + _ => Err(invalid("an outcome is malformed.")), + } + } + + fn reaction(&self, j: &J) -> R { + let tag = at(j, 0)?.as_str().unwrap_or(""); + Ok(match tag { + "then" => Reaction::Then { + on_ful: self.val(at(j, 1)?)?, + on_rej: self.val(at(j, 2)?)?, + derived: self.id(at(j, 3)?)?, + }, + "await" => Reaction::Await(u32_(at(j, 1)?)?), + "resolve" => Reaction::Resolve(self.id(at(j, 1)?)?), + "comb" => Reaction::Comb { + comb: self.id(at(j, 1)?)?, + index: u32_(at(j, 2)?)?, + }, + "finally" => Reaction::Finally { + cleanup: self.val(at(j, 1)?)?, + derived: self.id(at(j, 2)?)?, + }, + "restore" => Reaction::Restore { + derived: self.id(at(j, 1)?)?, + outcome: self.outcome(at(j, 2)?)?, + }, + "program" => Reaction::Program, + "cross" => Reaction::Cross(self.id(at(j, 1)?)?), + "awaitgen" => Reaction::AwaitGen(self.id(at(j, 1)?)?), + "genreturn" => Reaction::GenReturn(self.id(at(j, 1)?)?), + "fromsync" => Reaction::FromSync { + made: self.id(at(j, 1)?)?, + done: boolean(at(j, 2)?)?, + close: self.opt_id(at(j, 3)?)?, + }, + _ => return Err(invalid(format!("unknown reaction {tag}."))), + }) + } + + fn handlers(&self, j: &J) -> R> { + j.as_array() + .ok_or_else(|| invalid("handlers are not a list."))? + .iter() + .map(|h| { + Ok(Handler { + pc: u32_(at(h, 0)?)?, + sp: u32_(at(h, 1)?)?, + }) + }) + .collect() + } + + fn frame(&self, vm: &Vm, j: &J) -> R> { + let kind = at(j, 7)?; + let native = at(kind, 0)?.as_str() == Some("x"); + let proto = usize_(at(j, 0)?)?; + if !native && proto >= self.protos { + return Err(invalid("a frame's function is not in the program.")); + } + let func = match native { + true => vm.native_proto.clone(), + false => vm.protos[proto].clone(), + }; + let pc = usize_(at(j, 1)?)?; + if pc >= func.code.len() { + return Err(invalid(format!("a frame's pc {pc} is out of range."))); + } + let kind = match at(kind, 0)?.as_str() { + Some("n") => FrameKind::Normal, + Some("x") => { + let code = u32_(at(kind, 1)?)?; + let op = u16::try_from(code) + .ok() + .and_then(crate::native::NativeOp::from_code) + .ok_or_else(|| invalid("a native frame's step is unknown."))?; + let sub = match kind.get(2) { + Some(s) => u16::try_from(u32_(s)?) + .map_err(|_| invalid("a native frame's step is unknown."))?, + None => 0, + }; + FrameKind::Native(op, sub) + } + Some("a") => FrameKind::Async(u32_(at(kind, 1)?)?), + Some("g") => { + let g = self.id(at(kind, 1)?)?; + let r = at(kind, 2)?; + let r = match r { + J::String(s) if s == "i" => Resume::Iter, + J::String(s) if s == "d" => Resume::Delegate, + J::String(s) if s == "r" => Resume::Result, + J::String(s) if s == "x" => Resume::Native, + J::Array(_) => Resume::Collect(self.id(at(r, 1)?)?), + _ => return Err(invalid("a generator frame's resume is unknown.")), + }; + FrameKind::Generator(g, r) + } + _ => return Err(invalid("a frame's mode is unknown.")), + }; + Ok(Box::new(Frame { + func, + pc, + base: usize_(at(j, 2)?)?, + upvals: at(j, 3)? + .as_array() + .ok_or_else(|| invalid("a frame's upvalues are not a list."))? + .iter() + .map(u32_) + .collect::>>()? + .into(), + hbase: u32_(at(j, 4)?)?, + extra: self.vals(at(j, 5)?)?.into(), + argc: u32_(at(j, 6)?)?, + kind, + is_base: boolean(at(j, 8)?)?, + yield_pc: u32_(at(j, 9)?)?, + depth: 0, + })) + } + + fn saved(&self, vm: &Vm, j: &J) -> R> { + let frame = match at(j, 0)? { + J::Null => None, + f => Some(self.frame(vm, f)?), + }; + let above = match j.get(4) { + Some(J::Array(items)) => items + .iter() + .map(|f| self.frame(vm, f)) + .collect::>>()?, + _ => Vec::new(), + }; + let splits = match j.get(5) { + Some(J::Array(items)) => items + .iter() + .map(|s| Ok((u32_(at(s, 0)?)?, u32_(at(s, 1)?)?))) + .collect::>>()?, + _ => Vec::new(), + }; + Ok(Box::new(SavedFrame { + frame, + stack: self.slots(at(j, 1)?)?, + handlers: self.handlers(at(j, 2)?)?, + started: boolean(at(j, 3)?)?, + above, + splits, + })) + } + + fn gen_state(&self, vm: &Vm, j: &J) -> R { + Ok(match at(j, 0)?.as_str() { + Some("done") => GenState::Done, + Some("susp") => GenState::Suspended(self.saved(vm, at(j, 1)?)?), + Some("run") => GenState::Running(self.saved(vm, at(j, 1)?)?), + _ => return Err(invalid("a generator's state is unknown.")), + }) + } + + fn map(&self, vm: &mut Vm, j: &J) -> R> { + let mut entries = Vec::new(); + let mut keys = Vec::new(); + for e in at(j, 1)? + .as_array() + .ok_or_else(|| invalid("a map is not a list."))? + { + let k = self.val(at(e, 1)?)?; + let v = self.val(at(e, 2)?)?; + let key = vm.map_key(&k); + keys.push(key); + entries.push((uint(at(e, 0)?)?, vm.map_entry_key(key, k), v)); + } + OrderedMap::restore(uint(at(j, 0)?)?, entries, keys) + .map(Box::new) + .ok_or_else(|| invalid("a map's positions are out of order.")) + } + + fn iter_kind(j: &J) -> R { + Ok(match uint(j)? { + 0 => IterKind::Keys, + 1 => IterKind::Values, + 2 => IterKind::Entries, + _ => return Err(invalid("an iterator kind is unknown.")), + }) + } + + fn obj(&self, vm: &mut Vm, j: &J) -> R { + let proto = self.opt_id(at(j, 0)?)?; + let flags = u32_(at(j, 1)?)? as u8; + let mut items = Vec::new(); + for p in at(j, 2)? + .as_array() + .ok_or_else(|| invalid("properties are not a list."))? + { + items.push(Prop { + key: u32_(at(p, 0)?)?, + value: self.val(at(p, 1)?)?, + flags: u32_(at(p, 2)?)? as u8, + }); + } + let kind = self.kind(vm, at(j, 3)?)?; + Ok(Obj { + proto, + props: Props::from_items(items), + kind, + flags, + visit: 0, + }) + } + + fn cross<'j>(&self, f: impl Fn(usize) -> R<&'j J>) -> R { + use crate::cross::{Cross, Step, Visit, Waiting}; + let stack = f(3)? + .as_array() + .ok_or_else(|| invalid("a crossing's visits are not a list."))? + .iter() + .map(|v| { + let s = at(v, 3)?; + let step = match at(s, 0)?.as_str() { + Some("s") => Step::Start, + Some("a") => Step::Array { + target: self.val(at(s, 1)?)?, + out: self.id(at(s, 2)?)?, + len: u32_(at(s, 3)?)?, + i: u32_(at(s, 4)?)?, + }, + Some("o") => Step::Object { + target: self.val(at(s, 1)?)?, + out: self.id(at(s, 2)?)?, + names: self.vals(at(s, 3)?)?, + i: u32_(at(s, 4)?)?, + }, + _ => return Err(invalid("a crossing's visit is unknown.")), + }; + Ok(Visit { + holder: self.val(at(v, 0)?)?, + key: self.val(at(v, 1)?)?, + depth: u32_(at(v, 2)?)?, + step, + }) + }) + .collect::>>()?; + // Only the program's result crosses this way. + if at(f(5)?, 0)?.as_str() != Some("result") { + return Err(invalid("a crossing's target is unknown.")); + } + let waiting = match uint(f(6)?)? { + 0 => Waiting::No, + 1 => Waiting::Root, + 3 => Waiting::Getter, + _ => Waiting::Value, + }; + Ok(Kind::Cross(Box::new(Cross { + roots: self.vals(f(1)?)?, + crossed: self.vals(f(2)?)?, + stack, + ancestors: self.vals(f(4)?)?, + waiting, + owed: boolean(f(7)?)?, + }))) + } + + fn kind(&self, vm: &mut Vm, j: &J) -> R { + if j.as_str() == Some("o") { + return Ok(Kind::Ordinary); + } + let tag = at(j, 0)?.as_str().unwrap_or("").to_owned(); + let f = |i: usize| at(j, i); + Ok(match tag.as_str() { + "a" => Kind::Array(self.vals(f(1)?)?), + "g" => Kind::Arguments(self.vals(f(1)?)?), + "c" => { + let proto = usize_(f(1)?)?; + if proto >= self.protos { + return Err(invalid("a closure's function is not in the program.")); + } + let upvals: Vec = f(2)? + .as_array() + .ok_or_else(|| invalid("a closure's cells are not a list."))? + .iter() + .map(u32_) + .collect::>()?; + let p = vm.protos[proto].clone(); + if upvals.len() != p.captures.len() { + return Err(invalid("a closure's cells do not match its captures.")); + } + Kind::Closure(Box::new(Closure { + proto: p, + upvals: upvals.into(), + this: self.val(f(3)?)?, + home: self.val(f(4)?)?, + fields: self.val(f(5)?)?, + })) + } + "n" => { + let i = usize_(f(1)?)?; + let Some(native) = self.natives.list.get(i) else { + return Err(invalid("a native function is unknown.")); + }; + Kind::Native { + f: *native, + data: self.val(f(2)?)?, + name: u32_(f(3)?)?, + length: u32_(f(4)?)? as u8, + ctor: boolean(f(5)?)?, + } + } + "b" => Kind::Bound(Box::new(( + self.val(f(1)?)?, + self.val(f(2)?)?, + self.vals(f(3)?)?, + ))), + "e" => Kind::Error(match f(1)? { + J::Null => None, + e => Some(Box::new(Failure { + kind: kind_named(&string(at(e, 0)?)?)?, + message: string(at(e, 1)?)?, + offset: opt_u32(at(e, 2)?)?, + site: Default::default(), + })), + }), + "p" => { + let s = f(1)?; + let state = match at(s, 0)?.as_str() { + Some("pending") => PromiseState::Pending, + Some("ok") => PromiseState::Fulfilled(self.val(at(s, 1)?)?), + Some("err") => PromiseState::Rejected(self.val(at(s, 1)?)?), + _ => return Err(invalid("a promise state is unknown.")), + }; + let reactions = f(2)? + .as_array() + .ok_or_else(|| invalid("reactions are not a list."))? + .iter() + .map(|r| self.reaction(r)) + .collect::>()?; + Kind::Promise(Box::new(PromiseData { state, reactions })) + } + "m" => Kind::Map(self.map(vm, f(1)?)?), + "s" => Kind::Set(self.map(vm, f(1)?)?), + "wm" => Kind::WeakMap(self.map(vm, f(1)?)?), + "ws" => Kind::WeakSet(self.map(vm, f(1)?)?), + "gen" => Kind::Generator(self.gen_state(vm, f(1)?)?), + "ai" | "mi" | "xi" => { + let target = self.id(f(1)?)?; + let kind = Self::iter_kind(f(3)?)?; + match tag.as_str() { + "ai" => Kind::ArrayIter { + target, + pos: u32_(f(2)?)?, + kind, + }, + "mi" => Kind::MapIter { + target, + pos: uint(f(2)?)?, + kind, + }, + _ => Kind::ExoticIter { + target, + pos: u32_(f(2)?)?, + kind, + }, + } + } + "si" => { + let s = u32_(f(1)?)?; + if s as usize >= self.bufs_len { + return Err(invalid("a string iterator's string is out of range.")); + } + Kind::StrIter { + s, + pos: u32_(f(2)?)?, + } + } + "li" => Kind::ListIter { + items: self.vals(f(1)?)?.into(), + pos: u32_(f(2)?)?, + }, + "t" => Kind::Namespace(NsPath { + parent: match f(1)? { + J::Null => NsPath::ROOT, + p => self.id(p)?, + }, + name: u32_(f(2)?)?, + }), + "r" => Kind::Resolvers { + promise: self.id(f(1)?)?, + done: boolean(f(2)?)?, + }, + "x" => self.cross(f)?, + "cb" => Kind::Combinator(Box::new(Combinator { + kind: match uint(f(1)?)? { + 0 => CombKind::All, + 1 => CombKind::AllSettled, + _ => CombKind::Any, + }, + promise: self.id(f(2)?)?, + values: self.vals(f(3)?)?, + remaining: usize_(f(4)?)?, + })), + "re" => { + let source = string(f(1)?)?; + let flags = string(f(2)?)?; + let (regex, flags) = crate::builtins::regexp::compile(&source, &flags) + .map_err(|_| invalid("a regular expression does not compile."))?; + Kind::RegExp(Box::new(crate::builtins::regexp::RegExpData { + source, + flags, + regex, + last_index: unnum(f(3)?)?, + })) + } + "d" => Kind::Date(unnum(f(1)?)?), + "y" => { + let i = usize_(f(1)?)?; + let Some(buf) = self.buffers.get(i) else { + return Err(invalid("a byte array's buffer is missing.")); + }; + let (start, len) = (usize_(f(2)?)?, usize_(f(3)?)?); + if start + len + > buf + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) + .len() + { + return Err(invalid("a byte array's view is out of range.")); + } + Kind::Bytes(Box::new(crate::builtins::bytes::Bytes { + buf: buf.clone(), + start, + len, + buffer: boolean(f(4)?)?, + })) + } + "td" => Kind::TextDecoder(Box::new(crate::builtins::bytes::Decoder { + fatal: boolean(f(1)?)?, + ignore_bom: boolean(f(2)?)?, + queued: hex_bytes(&string(f(3)?)?)?, + seen: boolean(f(4)?)?, + })), + "ih" => { + use crate::builtins::iterator::{Helper, HelperOp, HelperState}; + let op = f(3)?; + let op = match at(op, 0)?.as_str() { + Some("wrap") => HelperOp::Wrap, + Some("map") => HelperOp::Map(self.val(at(op, 1)?)?), + Some("filter") => HelperOp::Filter(self.val(at(op, 1)?)?), + Some("take") => HelperOp::Take(unnum(at(op, 1)?)?), + Some("drop") => HelperOp::Drop(unnum(at(op, 1)?)?), + Some("flatmap") => HelperOp::FlatMap( + self.val(at(op, 1)?)?, + match at(op, 2)? { + J::Null => None, + p => Some((self.val(at(p, 0)?)?, self.val(at(p, 1)?)?)), + }, + ), + _ => return Err(invalid("an iterator helper is unknown.")), + }; + let state = match uint(f(5)?)? { + 0 => HelperState::Start, + 1 => HelperState::Suspended, + 2 => HelperState::Running, + _ => HelperState::Done, + }; + Kind::IterHelper(Box::new(Helper { + iter: self.val(f(1)?)?, + next: self.val(f(2)?)?, + op, + counter: unnum(f(4)?)?, + state, + site: self.val(f(6)?)?, + })) + } + "url" => { + let url = url::Url::parse(&string(f(1)?)?) + .map_err(|_| invalid("a URL does not parse."))?; + Kind::Url(Box::new(crate::builtins::web::UrlData { + url, + params: self.id(f(2)?)?, + })) + } + "sp" => Kind::SearchParams(Box::new(crate::builtins::web::Params { + list: pairs(f(1)?)?, + url: self.opt_id(f(2)?)?, + })), + "h" => Kind::Headers(Box::new(crate::builtins::web::HeaderList { + list: pairs(f(1)?)?, + })), + "ag" => { + let phase = match uint(f(2)?)? { + 0 => AsyncPhase::Start, + 1 => AsyncPhase::Yield, + 2 => AsyncPhase::Executing, + 3 => AsyncPhase::AwaitingReturn, + _ => AsyncPhase::Completed, + }; + let mut queue = VecDeque::new(); + for r in f(3)? + .as_array() + .ok_or_else(|| invalid("a request queue is not a list."))? + { + queue.push_back(AsyncRequest { + kind: u32_(at(r, 0)?)? as u8, + value: self.val(at(r, 1)?)?, + promise: self.id(at(r, 2)?)?, + }); + } + Kind::AsyncGenerator(Box::new(AsyncGen { + state: self.gen_state(vm, f(1)?)?, + phase, + queue, + })) + } + "acc" => Kind::Accessor(Box::new(Accessor { + get: self.val(f(1)?)?, + set: self.val(f(2)?)?, + })), + "afs" => Kind::AsyncFromSync { + sync: self.id(f(1)?)?, + next: self.val(f(2)?)?, + }, + _ => return Err(invalid(format!("an object kind {tag} is unknown."))), + }) + } + + fn job(&self, j: &J) -> R { + Ok(match at(j, 0)?.as_str() { + Some("r") => Job::Reaction(self.reaction(at(j, 1)?)?, self.outcome(at(j, 2)?)?), + Some("t") => Job::Thenable { + promise: self.id(at(j, 1)?)?, + thenable: self.val(at(j, 2)?)?, + then: self.val(at(j, 3)?)?, + }, + _ => return Err(invalid("a job is unknown.")), + }) + } +} + +fn pairs(j: &J) -> R> { + j.as_array() + .ok_or_else(|| invalid("a list of pairs is not a list."))? + .iter() + .map(|p| Ok((string(at(p, 0)?)?, string(at(p, 1)?)?))) + .collect() +} + +/// A saved state, checked against this runtime and ready to resume. +pub struct Restored { + pub code: String, + pub run_id: Option, + pub metadata: crate::Data, + /// The shape of the host globals it was saved with (`hosts_id`). + pub hosts: String, + pub limits: Limits, + pub active_ms: u64, +} + +/// Reads a state's header, checking it belongs to this build and its source matches its hash; the run's setup then +/// checks its host globals (`hosts_id`). +pub fn header(snapshot: &Snapshot) -> R { + let s = &snapshot.0; + if s.get("format").and_then(J::as_u64) != Some(FORMAT) { + return Err(invalid("its format is unknown.")); + } + let header = field(s, "header")?; + let build = field(header, "build")?.as_str().unwrap_or(""); + let expected = build_id(); + if build != expected { + return Err(SnapshotError::new(format!( + "This state was saved by another PsychoScript build ({build}); this runtime is {expected}, so it can't resume it." + ))); + } + let source = field(header, "source")?; + let code = string(field(source, "code")?)?; + if field(source, "hash")?.as_str() != Some(hex(hash(code.as_bytes())).as_str()) { + return Err(SnapshotError::new("Source main does not match its hash.")); + } + let limits = field(header, "limits")?; + let opt = |name: &str| field(limits, name).map(J::as_u64); + let budget = field(header, "budget")?; + Ok(Restored { + code, + run_id: field(header, "runId")?.as_str().map(str::to_owned), + metadata: match header.get("metadataData") { + Some(saved) if !saved.is_null() => crate::Data::from_host(&host_value_from(saved)?), + _ => crate::Data::from_json(header.get("metadata").unwrap_or(&J::Null)), + }, + hosts: string(field(header, "hosts")?)?, + limits: Limits { + timeout_ms: opt("timeoutMs")?, + max_output_bytes: opt("maxOutputBytes")?.map(|n| n as usize), + }, + active_ms: field(budget, "activeMs")?.as_u64().unwrap_or(0), + }) +} + +/// Fills `vm`, made fresh for the saved program (compiled, set up and loaded with no bindings), with the state. +pub fn restore(vm: &mut Vm, snapshot: &Snapshot, program_hash: &str) -> R<()> { + let s = &snapshot.0; + let header = field(s, "header")?; + let source = field(header, "source")?; + if field(source, "bytecode")?.as_str() != Some(program_hash) { + return Err(SnapshotError::new( + "Source main compiles to other bytecode in this build, so it can't resume.", + )); + } + let base = field(header, "base")?; + let base = Base { + heap: usize_(at(base, 0)?)?, + bufs: usize_(at(base, 1)?)?, + atoms: usize_(at(base, 2)?)?, + cells: usize_(at(base, 3)?)?, + functions: usize_(at(base, 4)?)?, + }; + if base != vm.snapshot_base { + return Err(invalid( + "the state's built-ins do not match this runtime's.", + )); + } + let st = field(s, "state")?; + + // Strings first: values refer to them. + let mut texts = Vec::new(); + for t in field_list(st, "strings")? { + texts.push((string(at(t, 0)?)?, boolean(at(t, 1)?)?)); + } + // A freed atom is saved as null and restored as a free id. + let atoms: Vec> = field_list(st, "atoms")? + .iter() + .map(|a| { + if a.is_null() { + Ok(None) + } else { + u32_(a).map(Some) + } + }) + .collect::>()?; + vm.atoms.restore(texts, atoms).map_err(invalid)?; + + let rest = field_list(st, "heap")?; + let changed = field_list(st, "changed")?; + let mut buffers = Vec::new(); + for b in field_list(st, "buffers")? { + buffers.push(Arc::new(std::sync::Mutex::new(hex_bytes(&string(b)?)?))); + } + let dec = Dec { + natives: natives(), + heap_len: base.heap + rest.len(), + bufs_len: vm.atoms.counts().0, + protos: vm.protos.len(), + buffers, + _p: std::marker::PhantomData, + }; + if vm.heap.len() != base.heap { + return Err(invalid( + "the state's built-ins do not match this runtime's.", + )); + } + // Placeholders first, so objects can refer forward; then each one decoded in place. + for _ in 0..rest.len() { + vm.heap.push(Obj::new(None, Kind::Ordinary)); + } + for c in changed { + let id = usize_(at(c, 0)?)?; + if id >= base.heap { + return Err(invalid("a changed built-in is out of range.")); + } + vm.heap[id] = dec.obj(vm, at(c, 1)?)?; + } + for (i, o) in rest.iter().enumerate() { + vm.heap[base.heap + i] = dec.obj(vm, o)?; + } + + let cells = field_list(st, "cells")?; + vm.cells.truncate(base.cells); + for c in cells { + vm.cells.push(dec.slot(c)?); + } + vm.stack = dec.slots(field(st, "stack")?)?; + vm.frames = field_list(st, "frames")? + .iter() + .map(|f| dec.frame(vm, f)) + .collect::>()?; + vm.recount_frames(); + *vm.handlers_mut() = dec.handlers(field(st, "handlers")?)?; + vm.globals = dec.vals(field(st, "globals")?)?; + if vm.globals.len() != vm.global_names.len() { + return Err(invalid("the program's globals do not match.")); + } + vm.global_map.clear(); + for g in field_list(st, "globalMap")? { + vm.global_map.insert(u32_(at(g, 0)?)?, dec.val(at(g, 1)?)?); + } + let templates: Vec> = field_list(st, "templates")? + .iter() + .map(|t| dec.opt_id(t)) + .collect::>()?; + if templates.len() != vm.template_objs_ref().len() { + return Err(invalid("the program's template sites do not match.")); + } + *vm.template_objs_mut() = templates; + vm.jobs = field_list(st, "jobs")? + .iter() + .map(|j| dec.job(j)) + .collect::>()?; + vm.coroutines = field_list(st, "coroutines")? + .iter() + .map(|c| { + Ok(Coroutine { + saved: match at(c, 0)? { + J::Null => None, + sv => Some(dec.saved(vm, sv)?), + }, + promise: dec.opt_id(at(c, 1)?)?, + }) + }) + .collect::>()?; + vm.logs = field_list(st, "logs")? + .iter() + .map(string) + .collect::>()?; + vm.rng = field(st, "rng")? + .as_str() + .and_then(|r| r.parse().ok()) + .ok_or_else(|| invalid("the random state is malformed."))?; + let std = field_list(st, "std")?; + let id = |i: usize| -> R { + u32_( + std.get(i) + .ok_or_else(|| invalid("built-in prototypes are missing."))?, + ) + }; + let realm = &mut vm.realm.std; + realm.regexp = id(0)?; + realm.date = id(1)?; + realm.uint8 = id(2)?; + realm.buffer = id(3)?; + realm.text_encoder = id(4)?; + realm.text_decoder = id(5)?; + realm.weak_map = id(6)?; + realm.weak_set = id(7)?; + realm.iterator_helper = id(8)?; + realm.uri_error = id(9)?; + realm.url = id(10)?; + realm.params = id(11)?; + realm.headers = id(12)?; + realm.loaded = id(13)? as u8; + + restore_host(vm, &dec, field(st, "host")?, base)?; + let inbox = field_list(st, "inbox")?; + for i in inbox { + let entry = restore_settlement(vm, &dec, i)?; + vm.inbox.push_back(entry); + } + Ok(()) +} + +fn restore_settlement(vm: &mut Vm, dec: &Dec, j: &J) -> R<(Id, Settlement)> { + let p = dec.id(at(j, 0)?)?; + let s = match at(j, 1)?.as_str() { + Some("undef") => Settlement::Undefined, + Some("fail") => Settlement::Failure(host::Failed::from_parts( + kind_named(&string(at(j, 2)?)?)?, + text_from(at(j, 3)?)?, + texts_from(at(j, 4)?)?, + )), + Some("host") => { + let ok = boolean(at(j, 2)?)?; + let label = string(at(j, 3)?)?; + let owner = opt_string(at(j, 4)?)?; + let hooked = boolean(at(j, 5)?)?; + let saved = at(j, 6)?; + // The reference saves a value with no data form (a live response) as a `Lost`, which can't cross into the + // program once the run resumes: the call fails there, at the place that names it. + let site = j.get(7).and_then(J::as_u64).map(|s| s as u32); + if ok && let Some(at_label) = lost_path(saved, &label) { + let message = format!("{at_label} produced a Lost, which the program cannot hold."); + return Ok((p, Settlement::Lost(message, site))); + } + let mut v = host_value_from(saved)?; + if hooked && let Some(owner) = &owner { + v = decode(vm, owner, v)?; + } + Settlement::host(if ok { Ok(v) } else { Err(v) }, label, owner, site) + } + Some("lost") => Settlement::Lost( + string(at(j, 2)?)?, + j.get(3).and_then(J::as_u64).map(|s| s as u32), + ), + Some("interrupted") => Settlement::Interrupted, + _ => return Err(invalid("a settlement is unknown.")), + }; + Ok((p, s)) +} + +fn opt_string(j: &J) -> R> { + match j { + J::Null => Ok(None), + other => string(other).map(Some), + } +} + +fn opt_path(j: &J) -> R>> { + match j { + J::Null => Ok(None), + other => texts_from(other).map(Some), + } +} + +/// A value its owner's `snapshot` hooks bring back from their data. +fn decode(vm: &Vm, owner: &str, data: HostValue) -> R { + let hooks = vm.host.hooks(owner).ok_or_else(|| { + SnapshotError::new(format!("The host function {owner} has no snapshot hooks.")) + })?; + Ok((hooks.decode)(data)) +} + +fn restore_host(vm: &mut Vm, dec: &Dec, j: &J, base: Base) -> R<()> { + vm.host.next_call = uint(field(j, "nextCall")?)?; + // Results their owners' hooks saved: decoded once each, their functions taken in order. + let mut restored: Vec<(usize, Vec)> = Vec::new(); + for r in field_list(j, "results")? { + let owner = string(at(r, 0)?)?; + let value = decode(vm, &owner, host_value_from(at(r, 1)?)?)?; + let mut fns = Vec::new(); + collect_functions(&value, &mut fns); + let start = usize_(at(r, 2)?)?; + let end = usize_(at(r, 3)?)?; + if fns.len() != end.saturating_sub(start) { + return Err(SnapshotError::new(format!( + "The host function {owner} restored a value of another shape, so this state can't resume." + ))); + } + restored.push((start, fns)); + vm.host.results.push(ResultRoot { + owner, + value, + functions: start..end, + }); + } + vm.host.functions.truncate(base.functions); + for (i, f) in field_list(j, "functions")?.iter().enumerate() { + let index = base.functions + i; + let label = string(at(f, 0)?)?; + let path = opt_path(at(f, 1)?)?; + let owner = opt_string(at(f, 2)?)?; + let installed = boolean(at(f, 3)?)?; + let name = string(at(f, 4)?)?; + let from_root = restored + .iter() + .find_map(|(start, fns)| index.checked_sub(*start).and_then(|k| fns.get(k)).cloned()); + // A function among the globals is found again at its path; one inside a result through its owner's hooks. + let found = match &path { + Some(path) => vm.host.resolve(path), + None => from_root.map(Callee::Fn), + }; + vm.host.functions.push(FnEntry { + f: found.unwrap_or_else(|| Callee::Fn(host::lost_function(&name))), + label, + path, + owner, + installed, + }); + } + vm.host.suggestions.clear(); + for s in field_list(j, "suggestions")? { + vm.host + .suggestions + .insert(dec.id(at(s, 0)?)?, texts_from(at(s, 1)?)?); + } + vm.host.promise_like = dec.opt_id(field(j, "promiseLike")?)?; + vm.host.unhandled = field_list(j, "unhandled")? + .iter() + .map(|u| Ok((dec.id(at(u, 0)?)?, dec.val(at(u, 1)?)?))) + .collect::>()?; + vm.host.modules_loaded.clear(); + for m in field_list(j, "modules")? { + vm.host + .modules_loaded + .insert(string(at(m, 0)?)?, dec.val(at(m, 1)?)?); + } + vm.host.namespaces.clear(); + for m in field_list(j, "namespaces")? { + vm.host + .namespaces + .insert(string(at(m, 0)?)?, dec.val(at(m, 1)?)?); + } + // Calls in flight start again: an idempotent one reruns with its key, a started durable one waits on its data. + for c in field_list(j, "calls")? { + let start = at(c, 0)?; + let label = string(at(c, 3)?)?; + let path = opt_path(at(c, 4)?)?; + let start = match at(start, 0)?.as_str() { + Some("again") => host::Start::Again, + Some("wait") => { + let durable = path + .as_deref() + .and_then(|path| vm.host.resolve(path)) + .is_some_and(|f| matches!(f, Callee::Durable(_))); + let call = uint(at(c, 2)?)?; + if !durable { + return Err(SnapshotError::new(format!( + "The pending durable call {} ({label}) cannot resume because that function is no longer a durable function in this runtime.", + vm.host.key(call) + ))); + } + host::Start::Wait(crate::Data::from_host(&host_value_from(at(start, 1)?)?)) + } + _ => return Err(invalid("a call in flight is unknown.")), + }; + let restart = host::Restart { + promise: dec.id(at(c, 1)?)?, + call: uint(at(c, 2)?)?, + label, + path, + args: at(c, 5)? + .as_array() + .ok_or_else(|| invalid("a call's arguments are not a list."))? + .iter() + .map(host_value_from) + .collect::>()?, + owner: opt_string(at(c, 6)?)?, + site: at(c, 7)?.as_u64().map(|s| s as u32), + start, + }; + vm.host.restarts.push(restart); + } + Ok(()) +} + +/// The calls a resumed run restarts, in the order they were in flight, so their futures start on the run's executor. +pub fn restart_calls(vm: &mut Vm) { + for r in std::mem::take(&mut vm.host.restarts) { + host::restart(vm, r); + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/streaming.rs b/packages/codemode-rust/crates/psychoscript/src/streaming.rs new file mode 100644 index 0000000000000..841b3359d2b65 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/streaming.rs @@ -0,0 +1,867 @@ +//! Streaming HTTP responses an extension hands a program, the counterpart of the reference's +//! `Extension.StreamingResponse`. +//! +//! The program gets a plain object with the response's fields, a live `bodyUsed`, the reading methods (`text`, +//! `json`, `bytes`, `arrayBuffer`) and a `body` with a live `locked`, `cancel`, `getReader` and async iteration. The +//! host supplies the body as chunks through [`HttpBody`]; reading, locking and cancelling follow the reference's host +//! runtime, `ReadableStream` errors included. +//! +//! The reference hands the program the response's methods as plain functions inside a result, which it calls at once: +//! a read or cancel the program starts takes effect when it is called, so `locked` and `bodyUsed` change right away. + +use std::collections::VecDeque; +use std::fmt; +use std::future::Future; +use std::pin::Pin; +use std::sync::atomic::{AtomicU64, Ordering}; +use std::sync::{Arc, Mutex, MutexGuard}; +use std::task::{Context, Poll, Waker}; + +use rustc_hash::FxHashMap; + +use crate::host_function::{HostError, HostFunction, HostResult, HostValue}; +use crate::value::Value; + +/// A response body the host streams to the program. +pub trait HttpBody: Send + 'static { + /// The next chunk: `Ready(None)` at the end of the body, `Ready(Some(Err(reason)))` when it failed, and the + /// program sees `reason` as the read's error. + fn poll_chunk(&mut self, cx: &mut Context<'_>) -> Poll, HostValue>>>; + + /// The program cancelled the body with `reason`; no chunk is read after this. + fn cancel(&mut self, reason: HostValue) { + let _ = reason; + } +} + +/// A live HTTP response whose body the host streams for as long as the program holds it. Clones share the body. +#[derive(Clone)] +pub struct StreamingResponse { + pub url: String, + pub status: u16, + pub status_text: String, + /// Header pairs; names are lowercased and repeated ones combined as `Headers` does. + pub headers: Vec<(String, String)>, + pub redirected: bool, + pub(crate) body: Option>>, +} + +impl StreamingResponse { + /// A response with this status and body; `None` is a response without one, such as a 204. + pub fn new(status: u16, body: Option>) -> Self { + Self { + url: String::new(), + status, + status_text: String::new(), + headers: Vec::new(), + redirected: false, + body: body.map(|body| Arc::new(Mutex::new(Stream::new(body)))), + } + } + + pub fn with_url(mut self, url: impl Into) -> Self { + self.url = url.into(); + self + } + + pub fn with_status_text(mut self, text: impl Into) -> Self { + self.status_text = text.into(); + self + } + + pub fn with_header(mut self, name: impl Into, value: impl Into) -> Self { + self.headers.push((name.into(), value.into())); + self + } + + pub fn with_redirected(mut self, redirected: bool) -> Self { + self.redirected = redirected; + self + } + + pub fn ok(&self) -> bool { + (200..300).contains(&self.status) + } + + pub fn has_body(&self) -> bool { + self.body.is_some() + } +} + +impl fmt::Debug for StreamingResponse { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "StreamingResponse({} {:?})", self.status, self.url) + } +} + +/// The getter of a host accessor: an own, read-only, non-enumerable property whose value the host answers live. +pub type Getter = Arc Value + Send + Sync>; + +/// Counts the points where queued host calls start: a new job, or the end of a synchronous extension call. +pub type Epoch = Arc; + +// ---------- the stream ---------- + +const CONSUMER: u64 = u64::MAX; + +enum Flow { + Readable, + Closed, + Errored(HostValue), +} + +#[derive(Clone, Copy)] +pub(crate) enum Consume { + Text, + Json, + Bytes, + ArrayBuffer, +} + +enum Op { + Consume(Consume), + Read(u64), + CancelReader(u64, HostValue), + CancelStream(HostValue), + Next(u64), + Return(u64), +} + +enum Progress { + Done(HostResult), + Read { reader: u64, iter: Option }, + Consume { kind: Consume, buf: Vec }, +} + +struct Iter { + reader: u64, + finished: bool, +} + +pub(crate) struct Stream { + body: Box, + flow: Flow, + disturbed: bool, + reader: Option, + next_id: u64, + /// Calls not started yet, with the epoch they were made in. + queued: VecDeque<(u64, u64, Op)>, + started: FxHashMap, + /// Started calls that wait for chunks, served in order. + reading: VecDeque, + iters: FxHashMap, + wakers: Vec, +} + +fn type_error(message: &str) -> HostValue { + HostValue::Error(Box::new(HostError::named("TypeError", message))) +} + +fn locked() -> HostValue { + type_error("Invalid state: ReadableStream is locked") +} + +fn detached() -> HostValue { + type_error("Invalid state: The reader is not attached to a stream") +} + +fn step(value: HostValue, done: bool) -> HostValue { + HostValue::object([("value", value), ("done", HostValue::Bool(done))]) +} + +impl Stream { + fn new(body: Box) -> Self { + Self { + body, + flow: Flow::Readable, + disturbed: false, + reader: None, + next_id: 0, + queued: VecDeque::new(), + started: FxHashMap::default(), + reading: VecDeque::new(), + iters: FxHashMap::default(), + wakers: Vec::new(), + } + } + + fn id(&mut self) -> u64 { + self.next_id += 1; + self.next_id + } + + fn wake(&mut self) { + for w in self.wakers.drain(..) { + w.wake(); + } + } + + /// Starts every call made before epoch `now`, as the reference would have by then. + fn observe(&mut self, now: u64) { + while self + .queued + .front() + .is_some_and(|(_, epoch, _)| *epoch < now) + { + let (ticket, _, op) = self.queued.pop_front().unwrap(); + self.start(ticket, op); + } + } + + /// Starts every call up to and including `ticket`. + fn start_through(&mut self, ticket: u64) { + while let Some((t, _, _)) = self.queued.front() { + let t = *t; + let (_, _, op) = self.queued.pop_front().unwrap(); + self.start(t, op); + if t == ticket { + break; + } + } + } + + fn enqueue(&mut self, now: u64, op: Op) -> u64 { + self.observe(now); + let ticket = self.id(); + self.queued.push_back((ticket, now, op)); + ticket + } + + fn start(&mut self, ticket: u64, op: Op) { + let progress = match op { + Op::Consume(kind) => { + if self.disturbed { + Progress::Done(Err(type_error("Body already used"))) + } else if self.reader.is_some() { + Progress::Done(Err(locked())) + } else { + self.reader = Some(CONSUMER); + self.disturbed = true; + self.reading.push_back(ticket); + Progress::Consume { + kind, + buf: Vec::new(), + } + } + } + Op::Read(reader) => { + if self.reader != Some(reader) { + Progress::Done(Err(detached())) + } else { + self.disturbed = true; + self.reading.push_back(ticket); + Progress::Read { reader, iter: None } + } + } + Op::CancelReader(reader, reason) => { + if self.reader != Some(reader) { + Progress::Done(Err(detached())) + } else { + Progress::Done(self.cancel(reason)) + } + } + Op::CancelStream(reason) => { + if self.reader.is_some() { + Progress::Done(Err(locked())) + } else { + Progress::Done(self.cancel(reason)) + } + } + Op::Next(iter) => match self.iters.get(&iter) { + Some(it) if !it.finished => { + let reader = it.reader; + self.disturbed = true; + self.reading.push_back(ticket); + Progress::Read { + reader, + iter: Some(iter), + } + } + _ => Progress::Done(Ok(step(HostValue::Undefined, true))), + }, + Op::Return(iter) => match self.iters.get_mut(&iter) { + Some(it) if !it.finished => { + it.finished = true; + let reader = it.reader; + let cancelled = self.cancel(HostValue::Undefined); + self.release(reader); + Progress::Done(cancelled.map(|_| step(HostValue::Undefined, true))) + } + _ => Progress::Done(Ok(step(HostValue::Undefined, true))), + }, + }; + self.started.insert(ticket, progress); + self.wake(); + } + + fn cancel(&mut self, reason: HostValue) -> HostResult { + self.disturbed = true; + match &self.flow { + Flow::Closed => Ok(HostValue::Undefined), + Flow::Errored(e) => Err(e.clone()), + Flow::Readable => { + self.flow = Flow::Closed; + self.body.cancel(reason); + self.wake(); + Ok(HostValue::Undefined) + } + } + } + + /// Detaches `reader`, failing the reads it still waits on. + fn release(&mut self, reader: u64) { + if self.reader != Some(reader) { + return; + } + self.reader = None; + let started = &mut self.started; + self.reading.retain(|t| match started.get(t) { + Some(Progress::Read { reader: r, .. }) if *r == reader => { + started.insert( + *t, + Progress::Done(Err(type_error("Invalid state: Releasing reader"))), + ); + false + } + _ => true, + }); + self.wake(); + } + + fn attach(&mut self) -> Result { + if self.reader.is_some() { + return Err(locked()); + } + let id = self.id(); + self.reader = Some(id); + Ok(id) + } + + /// Drives a started call: the front reader of `reading` pulls chunks for itself. + fn pump(&mut self, ticket: u64, cx: &mut Context<'_>) -> Poll { + loop { + if let Some(Progress::Done(_)) = self.started.get(&ticket) { + let Some(Progress::Done(result)) = self.started.remove(&ticket) else { + unreachable!() + }; + return Poll::Ready(result); + } + if self.reading.front() != Some(&ticket) { + self.wakers.push(cx.waker().clone()); + return Poll::Pending; + } + let chunk = match &self.flow { + Flow::Closed => None, + Flow::Errored(e) => Some(Err(e.clone())), + Flow::Readable => match self.body.poll_chunk(cx) { + Poll::Pending => return Poll::Pending, + Poll::Ready(None) => { + self.flow = Flow::Closed; + None + } + Poll::Ready(Some(Err(e))) => { + self.flow = Flow::Errored(e.clone()); + Some(Err(e)) + } + Poll::Ready(Some(Ok(b))) => Some(Ok(b)), + }, + }; + let progress = self.started.get_mut(&ticket).expect("a started call"); + let done = match progress { + Progress::Consume { kind, buf } => match chunk { + Some(Ok(b)) => { + buf.extend_from_slice(&b); + continue; + } + None => consumed(*kind, std::mem::take(buf)), + Some(Err(e)) => Err(e), + }, + Progress::Read { iter, .. } => { + let iter = *iter; + let ended = !matches!(chunk, Some(Ok(_))); + let result = match chunk { + Some(Ok(b)) => Ok(step(HostValue::Bytes(b), false)), + None => Ok(step(HostValue::Undefined, true)), + Some(Err(e)) => Err(e), + }; + if ended + && let Some(iter) = iter + && let Some(it) = self.iters.get_mut(&iter) + { + it.finished = true; + let reader = it.reader; + self.release(reader); + } + result + } + Progress::Done(_) => unreachable!(), + }; + self.reading.pop_front(); + self.started.insert(ticket, Progress::Done(done)); + self.wake(); + } + } +} + +/// What a reading method answers with the whole body. +fn consumed(kind: Consume, buf: Vec) -> HostResult { + match kind { + Consume::Bytes | Consume::ArrayBuffer => Ok(HostValue::Bytes(buf)), + Consume::Text => Ok(HostValue::String(decode(&buf).into())), + Consume::Json => parse_json(&decode(&buf)), + } +} + +/// UTF-8 decoding as `Response.text` does it: a leading byte order mark dropped, bad sequences replaced. +fn decode(buf: &[u8]) -> String { + let text = String::from_utf8_lossy(buf); + text.strip_prefix('\u{feff}').unwrap_or(&text).to_owned() +} + +/// A call on the stream, started where the reference would start it. +struct Call { + stream: Arc>, + ticket: u64, + polled: bool, +} + +fn lock(stream: &Mutex) -> MutexGuard<'_, Stream> { + stream.lock().unwrap_or_else(|e| e.into_inner()) +} + +impl Future for Call { + type Output = HostResult; + + fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + let this = &mut *self; + let mut s = lock(&this.stream); + if s.queued.iter().any(|(t, _, _)| *t == this.ticket) { + if !this.polled { + // The call was just made: it starts when the run next hands calls over, unless observed first. + this.polled = true; + cx.waker().wake_by_ref(); + return Poll::Pending; + } + s.start_through(this.ticket); + } + s.pump(this.ticket, cx) + } +} + +// ---------- what the program holds ---------- + +/// The functions and accessors of a streaming response, made once when it crosses to the program. +pub(crate) struct Surface { + /// `text`, `json`, `bytes`, `arrayBuffer`. + pub methods: Vec<(&'static str, HostFunction)>, + pub body_used: Getter, + /// `cancel`, `getReader`, and the `Symbol.asyncIterator` method, with the `locked` getter. + pub body: Option<(HostFunction, HostFunction, HostFunction, Getter)>, +} + +fn op_call(stream: &Arc>, epoch: &Epoch, op: Op) -> Call { + let now = epoch.load(Ordering::Relaxed); + // The reference's response methods are plain functions, which the host calls at once: the operation starts now. + let ticket = { + let mut s = lock(stream); + let ticket = s.enqueue(now, op); + s.start_through(ticket); + ticket + }; + Call { + stream: stream.clone(), + ticket, + polled: false, + } +} + +fn observed<'s>(stream: &'s Arc>, epoch: &Epoch) -> MutexGuard<'s, Stream> { + let mut s = lock(stream); + s.observe(epoch.load(Ordering::Relaxed)); + s +} + +fn first(args: Vec) -> HostValue { + args.into_iter().next().unwrap_or_default() +} + +pub(crate) fn surface(response: &StreamingResponse, epoch: &Epoch) -> Surface { + let kinds = [ + ("text", Consume::Text), + ("json", Consume::Json), + ("bytes", Consume::Bytes), + ("arrayBuffer", Consume::ArrayBuffer), + ]; + let methods = kinds + .into_iter() + .map(|(key, kind)| { + let stream = response.body.clone(); + let epoch = epoch.clone(); + let f = HostFunction::internal_async("", 0, move |_| { + let call = stream + .as_ref() + .map(|s| op_call(s, &epoch, Op::Consume(kind))); + async move { + match call { + Some(call) => call.await, + None => match kind { + Consume::Json => Err(HostValue::Error(Box::new(HostError::named( + "SyntaxError", + "Unexpected end of JSON input", + )))), + kind => consumed(kind, Vec::new()), + }, + } + } + }); + (key, f) + }) + .collect(); + let Some(stream) = response.body.clone() else { + return Surface { + methods, + body_used: Arc::new(|| Value::Bool(false)), + body: None, + }; + }; + let body_used = { + let (stream, epoch) = (stream.clone(), epoch.clone()); + Arc::new(move || Value::Bool(observed(&stream, &epoch).disturbed)) as Getter + }; + let is_locked = { + let (stream, epoch) = (stream.clone(), epoch.clone()); + Arc::new(move || Value::Bool(observed(&stream, &epoch).reader.is_some())) as Getter + }; + let cancel = { + let (stream, epoch) = (stream.clone(), epoch.clone()); + HostFunction::internal_async("", 1, move |args| { + op_call(&stream, &epoch, Op::CancelStream(first(args))) + }) + }; + let get_reader = { + let (stream, epoch) = (stream.clone(), epoch.clone()); + HostFunction::internal("", 1, move |args| { + if let Some(HostValue::Object(fields)) = args.first() + && fields + .iter() + .any(|(k, v)| k == "mode" && !matches!(v, HostValue::Undefined)) + { + return Err(type_error("Only the default stream reader is supported.")); + } + let reader = observed(&stream, &epoch).attach()?; + Ok(reader_object(&stream, &epoch, reader)) + }) + }; + let iterate = { + let (stream, epoch) = (stream.clone(), epoch.clone()); + HostFunction::internal("", 0, move |_| { + let mut s = observed(&stream, &epoch); + let reader = s.attach()?; + let iter = s.id(); + s.iters.insert( + iter, + Iter { + reader, + finished: false, + }, + ); + drop(s); + let next = { + let (stream, epoch) = (stream.clone(), epoch.clone()); + HostFunction::internal_async("next", 0, move |_| { + op_call(&stream, &epoch, Op::Next(iter)) + }) + }; + let ret = { + let (stream, epoch) = (stream.clone(), epoch.clone()); + HostFunction::internal_async("return", 0, move |_| { + op_call(&stream, &epoch, Op::Return(iter)) + }) + }; + Ok(HostValue::object([ + ("next", HostValue::Function(next)), + ("return", HostValue::Function(ret)), + ])) + }) + }; + Surface { + methods, + body_used, + body: Some((cancel, get_reader, iterate, is_locked)), + } +} + +fn reader_object(stream: &Arc>, epoch: &Epoch, reader: u64) -> HostValue { + let read = { + let (stream, epoch) = (stream.clone(), epoch.clone()); + HostFunction::internal_async("read", 0, move |_| { + op_call(&stream, &epoch, Op::Read(reader)) + }) + }; + let cancel = { + let (stream, epoch) = (stream.clone(), epoch.clone()); + HostFunction::internal_async("cancel", 1, move |args| { + op_call(&stream, &epoch, Op::CancelReader(reader, first(args))) + }) + }; + let release = { + let (stream, epoch) = (stream.clone(), epoch.clone()); + HostFunction::internal("releaseLock", 0, move |_| { + observed(&stream, &epoch).release(reader); + Ok(HostValue::Undefined) + }) + }; + HostValue::object([ + ("read", HostValue::Function(read)), + ("cancel", HostValue::Function(cancel)), + ("releaseLock", HostValue::Function(release)), + ]) +} + +// ---------- `json()` ---------- + +/// Why the reference's host runtime can't parse `text` as JSON, as its `JSON.parse` says it (`JSON Parse error: ...`). +pub(crate) fn json_parse_error(text: &str) -> String { + match parse_json(text) { + Err(HostValue::Error(e)) => e.message.to_string_lossy().into_owned(), + _ => "JSON Parse error: Unable to parse JSON string".into(), + } +} + +/// Parses a body as the reference's host runtime does for `Response.json`, with its error messages. +fn parse_json(text: &str) -> HostResult { + let mut p = Json { + s: text.as_bytes(), + text, + i: 0, + }; + let fail = |m: String| { + HostValue::Error(Box::new(HostError::named( + "SyntaxError", + format!("JSON Parse error: {m}"), + ))) + }; + let tok = p.lex().map_err(fail)?; + let value = p.value(tok).map_err(fail)?; + match p.lex() { + Ok(Tok::Eof) => Ok(value), + _ => Err(fail("Unable to parse JSON string".into())), + } +} + +enum Tok { + Eof, + Punct(u8), + Str(String), + Num(f64), + Lit(HostValue), + Ident(String), +} + +struct Json<'s> { + s: &'s [u8], + text: &'s str, + i: usize, +} + +type J = Result; + +impl Json<'_> { + fn lex(&mut self) -> J { + while self.i < self.s.len() && matches!(self.s[self.i], b' ' | b'\t' | b'\n' | b'\r') { + self.i += 1; + } + let Some(&c) = self.s.get(self.i) else { + return Ok(Tok::Eof); + }; + match c { + b'{' | b'}' | b'[' | b']' | b',' | b':' | b'.' => { + self.i += 1; + Ok(Tok::Punct(c)) + } + b'"' => self.string().map(Tok::Str), + b'\'' => Err("Single quotes (') are not allowed in JSON".into()), + b'-' | b'0'..=b'9' => self.number().map(Tok::Num), + c if c.is_ascii_alphabetic() || c == b'_' || c == b'$' => { + let rest = &self.text[self.i..]; + for (word, value) in [ + ("true", HostValue::Bool(true)), + ("false", HostValue::Bool(false)), + ("null", HostValue::Null), + ] { + if rest.starts_with(word) { + self.i += word.len(); + return Ok(Tok::Lit(value)); + } + } + let end = rest + .find(|c: char| !(c.is_ascii_alphanumeric() || c == '_' || c == '$')) + .unwrap_or(rest.len()); + self.i += end; + Ok(Tok::Ident(rest[..end].to_owned())) + } + _ => { + let c = self.text[self.i..].chars().next().unwrap_or(' '); + Err(format!("Unrecognized token '{c}'")) + } + } + } + + /// A string as run text: lone surrogates from `\u` escapes kept in carrier form. + fn string(&mut self) -> J { + self.i += 1; + let mut units: Vec = Vec::new(); + let mut buf = [0u16; 2]; + loop { + let Some(&c) = self.s.get(self.i) else { + return Err("Unterminated string".into()); + }; + match c { + b'"' => { + self.i += 1; + return Ok(crate::strings::from_units(&units)); + } + 0..=0x1f => return Err("Unterminated string".into()), + b'\\' => { + let Some(&e) = self.s.get(self.i + 1) else { + return Err("Unterminated string".into()); + }; + self.i += 2; + let simple = match e { + b'"' => Some('"'), + b'\\' => Some('\\'), + b'/' => Some('/'), + b'b' => Some('\u{8}'), + b'f' => Some('\u{c}'), + b'n' => Some('\n'), + b'r' => Some('\r'), + b't' => Some('\t'), + _ => None, + }; + if let Some(ch) = simple { + units.extend_from_slice(ch.encode_utf16(&mut buf)); + continue; + } + if e != b'u' { + let ch = self.text[self.i - 1..].chars().next().unwrap_or(' '); + return Err(format!("Invalid escape character {ch}")); + } + let hex = self.s.get(self.i..self.i + 4); + let Some(unit) = hex + .filter(|h| h.iter().all(u8::is_ascii_hexdigit)) + .and_then(|h| u16::from_str_radix(std::str::from_utf8(h).ok()?, 16).ok()) + else { + return Err("\\u must be followed by 4 hex digits".into()); + }; + self.i += 4; + units.push(unit); + } + _ => { + let ch = self.text[self.i..].chars().next().unwrap_or(' '); + self.i += ch.len_utf8(); + units.extend_from_slice(ch.encode_utf16(&mut buf)); + } + } + } + } + + fn number(&mut self) -> J { + let start = self.i; + let digits = |p: &mut Self| { + let from = p.i; + while p.s.get(p.i).is_some_and(u8::is_ascii_digit) { + p.i += 1; + } + p.i - from + }; + if self.s[self.i] == b'-' { + self.i += 1; + } + match self.s.get(self.i) { + Some(b'0') => self.i += 1, + Some(b'1'..=b'9') => { + digits(self); + } + _ => return Err("Invalid number".into()), + } + if self.s.get(self.i) == Some(&b'.') { + self.i += 1; + if digits(self) == 0 { + return Err("Invalid digits after decimal point".into()); + } + } + if matches!(self.s.get(self.i), Some(b'e' | b'E')) { + let mut at = self.i + 1; + if matches!(self.s.get(at), Some(b'+' | b'-')) { + at += 1; + } + if self.s.get(at).is_some_and(u8::is_ascii_digit) { + self.i = at; + digits(self); + } + } + Ok(self.text[start..self.i].parse().unwrap_or(f64::NAN)) + } + + fn value(&mut self, tok: Tok) -> J { + match tok { + Tok::Eof => Err("Unexpected EOF".into()), + Tok::Str(s) => Ok(HostValue::String(crate::HostString::from_run_text(&s))), + Tok::Num(n) => Ok(HostValue::Number(n)), + Tok::Lit(v) => Ok(v), + Tok::Ident(name) => Err(format!("Unexpected identifier \"{name}\"")), + Tok::Punct(b'[') => { + let mut items = Vec::new(); + let mut tok = self.lex()?; + if matches!(tok, Tok::Punct(b']')) { + return Ok(HostValue::Array(items)); + } + loop { + items.push(Some(self.value(tok)?)); + match self.lex()? { + Tok::Punct(b',') => { + tok = self.lex()?; + if matches!(tok, Tok::Punct(b']')) { + return Err( + "Unexpected comma at the end of array expression".into() + ); + } + } + Tok::Punct(b']') => return Ok(HostValue::Array(items)), + _ => return Err("Expected ']'".into()), + } + } + } + Tok::Punct(b'{') => { + let mut fields: Vec<(crate::HostString, HostValue)> = Vec::new(); + let mut key = match self.lex()? { + Tok::Punct(b'}') => return Ok(HostValue::Object(fields)), + Tok::Str(s) => crate::HostString::from_run_text(&s), + _ => return Err("Expected '}'".into()), + }; + loop { + if !matches!(self.lex()?, Tok::Punct(b':')) { + return Err( + "Expected ':' before value in object property definition".into() + ); + } + let tok = self.lex()?; + let value = self.value(tok)?; + match fields.iter_mut().find(|(k, _)| *k == key) { + Some(slot) => slot.1 = value, + None => fields.push((key, value)), + } + match self.lex()? { + Tok::Punct(b',') => match self.lex()? { + Tok::Str(s) => key = crate::HostString::from_run_text(&s), + _ => return Err("Property name must be a string literal".into()), + }, + Tok::Punct(b'}') => return Ok(HostValue::Object(fields)), + _ => return Err("Expected '}'".into()), + } + } + } + Tok::Punct(c) => Err(format!("Unexpected token '{}'", c as char)), + } + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/strings.rs b/packages/codemode-rust/crates/psychoscript/src/strings.rs new file mode 100644 index 0000000000000..bf4575f3c550a --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/strings.rs @@ -0,0 +1,797 @@ +//! The per-run string arena and the property-key interner. +//! +//! Strings live for the whole run, like objects, so `Value` can be `Copy`. They are immutable, except that a string +//! built by `local += x` is held only by that local until the local is read, and grows in place meanwhile. +//! +//! Concatenation results are ranges of shared growable buffers: a long one starts a buffer of its own, a short one +//! goes at the end of the buffer all short results share, so making it allocates nothing. Appending to the string +//! that ends its buffer extends the buffer and makes a longer range, so `s = s + x` in a loop costs amortized linear +//! time while every earlier `s` keeps its text. +//! +//! A string that is not well-formed UTF-16 (it holds a lone surrogate) has no UTF-8 form. It keeps its code units in +//! `Strings::wtf`, and its text is a carrier: UTF-8 in which each lone surrogate is `MARK` followed by one +//! private-use character that encodes it, and a real `MARK` is doubled. The carrier is canonical, so text equality +//! is string equality and property keys work unchanged, and every allocation decodes it again, which joins a high +//! and a low surrogate brought together into their character. Code that works on code units reads `wtf` through +//! `StrRef`; text that leaves the run goes through `host_text`, where lone surrogates become U+FFFD as in UTF-8. + +use std::borrow::Cow; + +use rustc_hash::FxHashMap; + +use crate::value::index_of_key; + +pub type StrId = u32; +/// An interned property key. +pub type Atom = u32; + +/// The atom of `Symbol.iterator`, unreachable from strings. +pub const SYM_ITERATOR: Atom = 0; +/// The atom of `Symbol.asyncIterator`, unreachable from strings. +pub const SYM_ASYNC_ITERATOR: Atom = 1; + +#[derive(Clone)] +pub struct StrBuf { + /// Built-in names borrow their static text, so setting up a run allocates little. + pub s: Cow<'static, str>, + pub ascii: bool, + /// Only one local slot holds this string, so `+=` may append in place. + pub builder: bool, + /// When not `NO_GROW`, the text is the `len` bytes at `aux` in `Strings::grow[grow]` rather than `s`. + pub(crate) grow: u32, + len: u32, + /// For a string in a `grow` buffer, its offset there. Otherwise, when not `NO_WTF`, the text is a carrier and + /// `Strings::wtf[aux]` holds the code units. + aux: u32, +} + +pub(crate) const NO_GROW: u32 = u32::MAX; +/// The string of a freed atom. +pub(crate) const NO_ATOM: StrId = StrId::MAX; +const NO_WTF: u32 = u32::MAX; + +impl StrBuf { + /// The entry of a freed string, or of one whose entry moved to another id. + pub(crate) fn empty() -> StrBuf { + StrBuf { + s: Cow::Borrowed(""), + ascii: true, + builder: false, + grow: NO_GROW, + len: 0, + aux: NO_WTF, + } + } + + /// For a carrier, its index in `Strings::wtf`. + pub(crate) fn wtf_index(&self) -> Option { + (self.grow == NO_GROW && self.aux != NO_WTF).then_some(self.aux as usize) + } + + /// The text is `s` from now on, no longer a range of a shared buffer. + pub(crate) fn set_own(&mut self) { + self.grow = NO_GROW; + self.aux = NO_WTF; + self.len = 0; + } +} + +/// Starts an escape in a carrier text. U+10FFFF is a noncharacter, so real text almost never holds one. +pub const MARK: char = '\u{10FFFF}'; +/// A lone surrogate `u` follows `MARK` as the character `PAYLOAD + (u - 0xD800)`. +const PAYLOAD: u32 = 0x10F000; +const MARK_UTF8: [u8; 4] = [0xF4, 0x8F, 0xBF, 0xBF]; + +/// Whether `s` holds `MARK`, so it may be a carrier. +#[inline] +pub fn has_mark(s: &str) -> bool { + if s.is_ascii() { + return false; + } + let b = s.as_bytes(); + let mut from = 0; + while let Some(i) = b[from..].iter().position(|c| *c == 0xF4) { + if b.get(from + i..from + i + 4) == Some(&MARK_UTF8[..]) { + return true; + } + from += i + 1; + } + false +} + +/// The text of UTF-16 code units: plain UTF-8 when they are well formed and hold no `MARK`, else the carrier. +pub fn from_units(units: &[u16]) -> String { + let mut out = String::with_capacity(units.len()); + for r in char::decode_utf16(units.iter().copied()) { + match r { + Ok(MARK) => { + out.push(MARK); + out.push(MARK); + } + Ok(c) => out.push(c), + Err(e) => { + out.push(MARK); + let c = PAYLOAD + (e.unpaired_surrogate() as u32 - 0xD800); + out.push(char::from_u32(c).unwrap_or(char::REPLACEMENT_CHARACTER)); + } + } + } + out +} + +/// Appends a decoded character to text that becomes a string: a real `MARK` is doubled. +#[inline] +pub fn push_char(out: &mut String, c: char) { + out.push(c); + if c == MARK { + out.push(MARK); + } +} + +/// The UTF-16 code units of a text, decoding a carrier. +pub fn units_of(text: &str) -> Vec { + let mut out = Vec::with_capacity(text.len()); + let mut chars = text.chars().peekable(); + let mut buf = [0u16; 2]; + while let Some(c) = chars.next() { + if c == MARK { + match chars.peek().map(|n| *n as u32) { + Some(n) if n == MARK as u32 => { + chars.next(); + } + Some(n) if (PAYLOAD..PAYLOAD + 0x800).contains(&n) => { + chars.next(); + out.push((0xD800 + n - PAYLOAD) as u16); + continue; + } + _ => {} + } + } + out.extend_from_slice(c.encode_utf16(&mut buf)); + } + out +} + +/// The text of the code point at byte `at` of a text: one character, or the two that escape a lone surrogate or a +/// `MARK` in a carrier. +pub fn code_point_at(text: &str, at: usize) -> Option<&str> { + let rest = text.get(at..)?; + let mut chars = rest.chars(); + let c = chars.next()?; + let mut end = c.len_utf8(); + if c == MARK + && let Some(n) = chars.next() + && (n == MARK || (PAYLOAD..PAYLOAD + 0x800).contains(&(n as u32))) + { + end += n.len_utf8(); + } + Some(&rest[..end]) +} + +/// Text as it leaves the run for the host, logs or UTF-8 bytes: a lone surrogate becomes U+FFFD, as `TextEncoder` +/// writes it. +pub fn host_text(s: &str) -> Cow<'_, str> { + if !has_mark(s) { + return Cow::Borrowed(s); + } + Cow::Owned(String::from_utf16_lossy(&units_of(s))) +} + +/// Text from outside the run, which is plain UTF-8: a `MARK` in it is real, so it is doubled to keep it. +pub fn external_text(s: String) -> String { + if !has_mark(&s) { + return s; + } + s.replace(MARK, "\u{10FFFF}\u{10FFFF}") +} +/// Concatenations shorter than this copy into a plain string. +const GROW_MIN: usize = 64; + +#[derive(Clone)] +pub struct Strings { + pub bufs: Vec, + pub(crate) grow: Vec, + /// The `grow` buffer short strings are appended to, so making one allocates nothing of its own. + pub(crate) arena: u32, + pub(crate) wtf: Vec>, + pub(crate) map: FxHashMap, Atom>, + pub(crate) atom_str: Vec, + pub(crate) atom_index: Vec, + /// A new string or atom at this many strings takes the collector's path (`push_slow`, `insert_atom_slow`): 0 + /// while a cycle runs or freed strings or atoms wait for reuse. The rest of its state is boxed, as only + /// this is read on every allocation, and a larger `Strings` moves the VM's fields after it out of the dispatch + /// loop's short addressing. + pub(crate) gc_limit: usize, + pub(crate) gc: crate::collector::LazyStrGc, +} + +/// A borrowed string with its ASCII flag and, for a carrier, its code units, for code-unit arithmetic. +#[derive(Clone, Copy)] +pub struct StrRef<'a> { + pub s: &'a str, + pub ascii: bool, + pub units: Option<&'a [u16]>, +} + +impl Strings { + pub fn new() -> Self { + let mut s = Strings { + bufs: Vec::new(), + grow: Vec::new(), + arena: NO_GROW, + wtf: Vec::new(), + map: FxHashMap::default(), + atom_str: Vec::new(), + atom_index: Vec::new(), + gc_limit: crate::collector::first_limit(), + gc: Default::default(), + }; + for name in ["Symbol(Symbol.iterator)", "Symbol(Symbol.asyncIterator)"] { + let id = s.alloc_static(name); + s.atom_str.push(id); + s.atom_index.push(u32::MAX); + } + s + } + + #[inline] + pub fn alloc(&mut self, s: String) -> StrId { + let ascii = s.is_ascii(); + if !ascii { + return self.alloc_wide(s); + } + self.push(Cow::Owned(s), ascii) + } + + /// `alloc` for text beyond ASCII, which may be a carrier. + #[inline(never)] + fn alloc_wide(&mut self, s: String) -> StrId { + if has_mark(&s) { + return self.alloc_units(&units_of(&s)); + } + self.push(Cow::Owned(s), false) + } + + /// A string of UTF-16 code units, which may hold lone surrogates. + pub fn alloc_units(&mut self, units: &[u16]) -> StrId { + let text = from_units(units); + if !has_mark(&text) { + let ascii = text.is_ascii(); + return self.push(Cow::Owned(text), ascii); + } + let id = self.push(Cow::Owned(text), false); + self.bufs[id as usize].aux = self.wtf.len() as u32; + self.wtf.push(units.into()); + id + } + + /// Whether a string's text is a carrier. + #[inline] + pub fn is_wtf(&self, id: StrId) -> bool { + let b = &self.bufs[id as usize]; + b.grow == NO_GROW && b.aux != NO_WTF + } + + pub fn alloc_static(&mut self, s: &'static str) -> StrId { + // Built-in names, interned once each, skip a collector's path (`push_entry`): a string pushed at the end + // with text of its own needs no colour, and setting up a run makes over a thousand. + self.bufs.push(StrBuf { + s: Cow::Borrowed(s), + ascii: s.is_ascii(), + builder: false, + grow: NO_GROW, + len: 0, + aux: NO_WTF, + }); + (self.bufs.len() - 1) as StrId + } + + fn push(&mut self, s: Cow<'static, str>, ascii: bool) -> StrId { + self.push_entry(StrBuf { + s, + ascii, + builder: false, + grow: NO_GROW, + len: 0, + aux: NO_WTF, + }) + } + + #[inline] + fn push_entry(&mut self, entry: StrBuf) -> StrId { + if self.bufs.len() >= self.gc_limit + && let Some(id) = self.push_slow(entry.grow) + { + // A freed slot holds `StrBuf::empty()`, which owns nothing: see `Heap::put`. + std::mem::forget(std::mem::replace(&mut self.bufs[id as usize], entry)); + return id; + } + self.bufs.push(entry); + (self.bufs.len() - 1) as StrId + } + + /// A new shared buffer holding `s`; a collector may give it the index of a dropped one. + #[inline] + fn new_grow(&mut self, s: String) -> usize { + if !self.gc.grow_free.is_empty() { + return self.reuse_grow(s); + } + self.grow.push(s); + self.grow.len() - 1 + } + + #[inline] + pub fn get(&self, id: StrId) -> &str { + let b = &self.bufs[id as usize]; + if b.grow == NO_GROW { + return &b.s; + } + let off = b.aux as usize; + self.grow[b.grow as usize] + .get(off..off + b.len as usize) + .unwrap_or_default() + } + + /// The concatenation of `parts`, which must not be empty. Extends the first part's buffer when it ends there. + /// A short ASCII string joined with a number's text (`"k" + i`, `i + "k"`): one new string, the number written + /// straight into it. `None` for a string this does not take, which `concat` joins instead. + pub fn concat_num(&mut self, s: StrId, n: f64, num_first: bool) -> Option { + if self.is_wtf(s) || self.get(s).len() + 24 >= GROW_MIN { + return None; + } + let ascii = self.bufs[s as usize].ascii; + let g = self.arena(); + let mut buf = std::mem::take(&mut self.grow[g]); + let start = buf.len(); + if !num_first { + self.append_to(&mut buf, g, s); + } + crate::value::write_num(&mut buf, n); + if num_first { + self.append_to(&mut buf, g, s); + } + Some(self.push_grown(buf, g, start, ascii)) + } + + /// A number's text, written at the end of the short strings' buffer. + pub fn alloc_num(&mut self, n: f64) -> StrId { + let g = self.arena(); + let mut buf = std::mem::take(&mut self.grow[g]); + let start = buf.len(); + crate::value::write_num(&mut buf, n); + self.push_grown(buf, g, start, true) + } + + /// The index of the short strings' buffer, made on first use. + fn arena(&mut self) -> usize { + if self.arena == NO_GROW { + self.arena = self.new_grow(String::with_capacity(1024)) as u32; + } + self.arena as usize + } + + /// A string of the text `buf` got from `start` on, `buf` going back to `grow[g]` it was taken from. + fn push_grown(&mut self, buf: String, g: usize, start: usize, ascii: bool) -> StrId { + let len = (buf.len() - start) as u32; + self.grow[g] = buf; + self.push_entry(StrBuf { + s: Cow::Borrowed(""), + ascii, + builder: false, + grow: g as u32, + len, + aux: start as u32, + }) + } + + pub fn concat(&mut self, parts: &[StrId]) -> StrId { + let Some((&first, rest)) = parts.split_first() else { + return self.alloc_static(""); + }; + let total: usize = parts.iter().map(|p| self.get(*p).len()).sum(); + let ascii = parts.iter().all(|p| self.bufs[*p as usize].ascii); + // A carrier is never ASCII. + if !ascii && parts.iter().any(|p| self.is_wtf(*p)) { + return self.concat_wtf(parts, total); + } + let f = &self.bufs[first as usize]; + // The first part ends its buffer: the result extends it. Otherwise a long result starts a buffer of its own, + // and a short one goes at the end of the short strings' buffer. + let (g, start, rest) = + if f.grow != NO_GROW && self.grow[f.grow as usize].len() == (f.aux + f.len) as usize { + (f.grow as usize, f.aux as usize, rest) + } else if total >= GROW_MIN { + (self.new_grow(String::with_capacity(total * 2)), 0, parts) + } else { + let g = self.arena(); + (g, self.grow[g].len(), parts) + }; + let mut buf = std::mem::take(&mut self.grow[g]); + for p in rest { + self.append_to(&mut buf, g, *p); + } + self.push_grown(buf, g, start, ascii) + } + + /// `concat` with a carrier among the parts, decoded afresh so a high and a low surrogate that meet become one + /// character. + #[cold] + #[inline(never)] + fn concat_wtf(&mut self, parts: &[StrId], total: usize) -> StrId { + let mut out = String::with_capacity(total); + for p in parts { + out.push_str(self.get(*p)); + } + self.alloc(out) + } + + /// Appends `b` to `a` itself; only for a string that nothing else can observe. + #[inline(never)] + pub fn push_in_place(&mut self, a: StrId, b: StrId) { + let ascii = self.bufs[b as usize].ascii; + if !(ascii && self.bufs[a as usize].ascii) && (self.is_wtf(a) || self.is_wtf(b)) { + return self.push_wtf(a, b); + } + let ab = &self.bufs[a as usize]; + // A builder made short leaves the short strings' buffer for text of its own, which it extends from now on. + if ab.grow == self.arena && ab.grow != NO_GROW { + let own = self.get(a).to_owned(); + let entry = &mut self.bufs[a as usize]; + entry.s = Cow::Owned(own); + entry.grow = NO_GROW; + entry.aux = NO_WTF; + entry.len = 0; + return self.push_in_place(a, b); + } + if ab.grow == NO_GROW { + let mut s = std::mem::take(&mut self.bufs[a as usize].s); + s.to_mut().push_str(self.get(b)); + let entry = &mut self.bufs[a as usize]; + entry.s = s; + entry.ascii &= ascii; + return; + } + let g = ab.grow as usize; + if self.grow[g].len() != (ab.aux + ab.len) as usize { + let mut s = String::with_capacity(ab.len as usize * 2); + s.push_str(self.get(a)); + let g = self.new_grow(s); + let entry = &mut self.bufs[a as usize]; + entry.grow = g as u32; + entry.aux = 0; + return self.push_in_place(a, b); + } + let mut buf = std::mem::take(&mut self.grow[g]); + self.append_to(&mut buf, g, b); + let entry = &mut self.bufs[a as usize]; + entry.len = buf.len() as u32 - entry.aux; + entry.ascii &= ascii; + self.grow[g] = buf; + } + + /// `push_in_place` with a carrier: the joined text is decoded afresh into `a`'s entry. + #[cold] + #[inline(never)] + fn push_wtf(&mut self, a: StrId, b: StrId) { + let joined = format!("{}{}", self.get(a), self.get(b)); + let made = self.alloc(joined); + let builder = self.bufs[a as usize].builder; + // A collector may have made it in a freed slot rather than at the end. + let mut entry = if made as usize + 1 == self.bufs.len() { + self.bufs.pop().unwrap_or_else(StrBuf::empty) + } else { + std::mem::replace(&mut self.bufs[made as usize], StrBuf::empty()) + }; + entry.builder = builder; + self.bufs[a as usize] = entry; + } + + /// Appends the text of `p` to `buf`, which was taken out of `grow[g]`. + fn append_to(&self, buf: &mut String, g: usize, p: StrId) { + let pb = &self.bufs[p as usize]; + if pb.grow as usize == g { + let off = pb.aux as usize; + buf.extend_from_within(off..off + pb.len as usize); + } else { + buf.push_str(self.get(p)); + } + } + + #[inline] + pub fn sref(&self, id: StrId) -> StrRef<'_> { + let b = &self.bufs[id as usize]; + StrRef { + s: self.get(id), + ascii: b.ascii, + units: (b.grow == NO_GROW && b.aux != NO_WTF).then(|| &*self.wtf[b.aux as usize]), + } + } + + pub fn intern(&mut self, s: &str) -> Atom { + if let Some(a) = self.map.get(s) { + return self.found(*a); + } + if has_mark(s) { + // Keyed by the canonical carrier the string gets. + let id = self.alloc(s.to_owned()); + return self.intern_id(id); + } + let id = self.alloc(s.to_owned()); + self.insert_atom(Cow::Owned(s.to_owned()), id) + } + + /// The atom for `s` if one was ever made; no object can have a key that has no atom. + pub fn lookup(&self, s: &str) -> Option { + self.map.get(s).copied() + } + + pub fn intern_static(&mut self, s: &'static str) -> Atom { + if let Some(a) = self.map.get(s) { + return self.found(*a); + } + let id = self.alloc_static(s); + self.insert_atom(Cow::Borrowed(s), id) + } + + pub fn intern_id(&mut self, id: StrId) -> Atom { + if let Some(a) = self.map.get(self.get(id)) { + return self.found(*a); + } + let b = &self.bufs[id as usize]; + let text = if b.grow == NO_GROW { + b.s.clone() + } else { + Cow::Owned(self.get(id).to_owned()) + }; + self.insert_atom(text, id) + } + + /// How many strings and atoms there are, for a snapshot's base. + pub(crate) fn counts(&self) -> (usize, usize) { + (self.bufs.len(), self.atom_str.len()) + } + + /// The strings and atoms made after the given counts: each string's text and builder flag, and each atom's + /// string, `None` for a freed atom. + pub(crate) fn save_from( + &self, + bufs: usize, + atoms: usize, + ) -> (Vec<(String, bool)>, Vec>) { + let texts = (bufs..self.bufs.len()) + .map(|i| (self.get(i as StrId).to_owned(), self.bufs[i].builder)) + .collect(); + let atoms = self.atom_str[atoms..] + .iter() + .map(|id| (*id != NO_ATOM).then_some(*id)) + .collect(); + (texts, atoms) + } + + /// Appends saved strings and atoms after the base this table has, each atom at its saved id. + pub(crate) fn restore( + &mut self, + texts: Vec<(String, bool)>, + atoms: Vec>, + ) -> Result<(), String> { + for (text, builder) in texts { + let id = self.alloc(text); + self.bufs[id as usize].builder = builder; + } + for id in atoms { + let Some(id) = id else { + self.free_atom_slot(); + continue; + }; + if id as usize >= self.bufs.len() { + return Err(format!("atom string {id} does not exist")); + } + let text = self.get(id).to_owned(); + if self.map.contains_key(text.as_str()) { + return Err(format!("atom {text:?} is saved twice")); + } + let a = self.atom_str.len() as Atom; + self.atom_str.push(id); + self.atom_index + .push(index_of_key(&text).unwrap_or(u32::MAX)); + self.map.insert(Cow::Owned(text), a); + } + Ok(()) + } + + fn insert_atom(&mut self, s: Cow<'static, str>, id: StrId) -> Atom { + if self.gc_limit == 0 { + return self.insert_atom_slow(s, id); + } + let a = self.atom_str.len() as Atom; + self.atom_str.push(id); + self.atom_index.push(index_of_key(&s).unwrap_or(u32::MAX)); + self.map.insert(s, a); + a + } + + /// An atom the interner gives out: while a cycle runs, it must survive it, as everything the program comes by + /// then does. + #[inline(always)] + fn found(&mut self, a: Atom) -> Atom { + if self.gc_limit != 0 { + return a; + } + // A tail call, so the interner's lookups need no frame of their own for it. + self.shade_atom(a) + } + + /// The string value of an atom. + #[inline] + pub fn atom_str(&self, a: Atom) -> StrId { + self.atom_str[a as usize] + } + + #[inline] + pub fn text(&self, a: Atom) -> &str { + self.get(self.atom_str[a as usize]) + } + + /// The array index an atom names, if it is canonical. + #[inline] + pub fn index(&self, a: Atom) -> Option { + let i = self.atom_index[a as usize]; + if i == u32::MAX { None } else { Some(i) } + } +} + +impl<'a> StrRef<'a> { + /// Length in UTF-16 code units, as JavaScript counts it. + pub fn len16(self) -> usize { + match self.units { + Some(u) => u.len(), + None if self.ascii => self.s.len(), + None => self.s.encode_utf16().count(), + } + } + + pub fn utf16(self) -> Vec { + match self.units { + Some(u) => u.to_vec(), + None => self.s.encode_utf16().collect(), + } + } + + /// The code units one by one. + pub fn iter16(self) -> Units16<'a> { + match self.units { + Some(u) => Units16::Units(u.iter()), + None => Units16::Text(self.s.encode_utf16()), + } + } + + pub fn code_unit(self, i: usize) -> Option { + match self.units { + Some(u) => u.get(i).copied(), + None if self.ascii => self.s.as_bytes().get(i).map(|b| *b as u16), + None => self.s.encode_utf16().nth(i), + } + } + + /// Whether the string is well-formed UTF-16: it holds no lone surrogate. + pub fn well_formed(self) -> bool { + self.units + .is_none_or(|u| char::decode_utf16(u.iter().copied()).all(|r| r.is_ok())) + } + + /// The code units `start..end` (clamped), as text: a slice that cuts a pair holds a lone surrogate. + pub fn slice16(self, start: usize, end: usize) -> String { + if self.ascii { + let len = self.s.len(); + let (s, e) = (start.min(len), end.min(len)); + return if s >= e { + String::new() + } else { + self.s[s..e].to_owned() + }; + } + let units = self.utf16(); + let (s, e) = (start.min(units.len()), end.min(units.len())); + if s >= e { + String::new() + } else { + from_units(&units[s..e]) + } + } + + /// Compares by UTF-16 code units, as JavaScript orders strings. + pub fn cmp16(self, other: StrRef) -> std::cmp::Ordering { + if self.ascii && other.ascii { + return self.s.cmp(other.s); + } + self.iter16().cmp(other.iter16()) + } +} + +/// The code units of a `StrRef`. +pub enum Units16<'a> { + Units(std::slice::Iter<'a, u16>), + Text(std::str::EncodeUtf16<'a>), +} + +impl Iterator for Units16<'_> { + type Item = u16; + + #[inline] + fn next(&mut self) -> Option { + match self { + Units16::Units(u) => u.next().copied(), + Units16::Text(t) => t.next(), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn carriers_round_trip_code_units() { + let cases: [&[u16]; 6] = [ + &[0x61, 0xd800, 0x62], + &[0xdc00, 0xd800], + &[0xd83d, 0xde00], + &[0xdbff, 0xdfff, 0xd800], + &[0xdbff, 0xdfff], + &[], + ]; + for units in cases { + let text = from_units(units); + assert_eq!(units_of(&text), units); + } + assert!(!has_mark(&from_units(&[0xd83d, 0xde00]))); + assert!(has_mark(&from_units(&[0xdbff, 0xdfff]))); + } + + #[test] + fn allocation_joins_surrogates_that_meet() { + let mut s = Strings::new(); + let (h, l) = (s.alloc_units(&[0xd83d]), s.alloc_units(&[0xde00])); + assert!(s.is_wtf(h) && s.is_wtf(l)); + let joined = s.concat(&[h, l]); + assert!(!s.is_wtf(joined)); + assert_eq!(s.get(joined), "\u{1f600}"); + let back = s.concat(&[l, h]); + assert_eq!(s.sref(back).utf16(), [0xde00, 0xd83d]); + assert_eq!(host_text(s.get(back)), "\u{fffd}\u{fffd}"); + } + + #[test] + fn short_strings_share_a_buffer_and_keep_their_text() { + let mut s = Strings::new(); + let k = s.alloc_static("k"); + let a = s.concat_num(k, 12.0, false).expect("short"); + // `a` ends the shared buffer, so this extends it; `c` no longer can. + let b = s.concat(&[a, k]); + let c = s.concat(&[a, a]); + let d = s.concat_num(k, -1.5, true).expect("short"); + let n = s.alloc_num(1e21); + assert_eq!( + [a, b, c, d, n].map(|id| s.get(id)), + ["k12", "k12k", "k12k12", "-1.5k", "1e+21"] + ); + // A builder leaves the shared buffer for text of its own, and the strings after it keep theirs. + s.bufs[a as usize].builder = true; + s.push_in_place(a, k); + s.push_in_place(a, n); + assert_eq!( + [a, b, c].map(|id| s.get(id)), + ["k12k1e+21", "k12k", "k12k12"] + ); + let wide = s.alloc_units(&[0xd800]); + assert!(s.concat_num(wide, 1.0, false).is_none() && s.is_wtf(wide) && !s.is_wtf(b)); + } + + #[test] + fn external_marks_stay_one_code_point() { + let mut s = Strings::new(); + let id = s.alloc(external_text("\u{10ffff}".to_owned())); + assert_eq!(s.sref(id).utf16(), [0xdbff, 0xdfff]); + assert_eq!(host_text(s.get(id)), "\u{10ffff}"); + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/test262.rs b/packages/codemode-rust/crates/psychoscript/src/test262.rs new file mode 100644 index 0000000000000..e4311ef848e5a --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/test262.rs @@ -0,0 +1,446 @@ +//! The test262 harness globals, for the parity runner in `test262/` only. Mirrors the reference +//! `packages/codemode/test/test262/run.ts`: `$assert` with its checks, `compareArray`, `Test262Error`, `$DONE` and +//! `$DONOTEVALUATE` are host functions; `assert` itself is program code the runner prepends. + +use std::cell::RefCell; +use std::sync::Arc; + +use crate::builtins::arg; +use crate::object::{Closure, Kind, Obj}; +use crate::strings::Strings; +use crate::value::{Id, Value}; +use crate::vm::{NativeFn, Res, Vm}; +use crate::{Diagnostic, DiagnosticKind, Limits, compiler, convert}; + +const STACK_SIZE: usize = 256 << 20; +const STACK_BUDGET: usize = 64 << 20; + +/// How a test262 program ended. +pub struct Run { + pub result: Result<(), Diagnostic>, + /// `None` when `$DONE` was never called, `Some(None)` when it was called without an error, and + /// `Some(Some(error))` when it was called with one. + pub done: Option>, +} + +thread_local! { + static DONE: RefCell>> = const { RefCell::new(None) }; +} + +/// Runs an already assembled test262 source with the harness globals, on its own large-stack thread. +pub fn run(code: &str, timeout_ms: u64) -> Run { + std::thread::scope(|s| { + let spawned = std::thread::Builder::new() + .stack_size(STACK_SIZE) + .spawn_scoped(s, || run_here(code, timeout_ms)); + match spawned.map(|h| h.join()) { + Ok(Ok(run)) => run, + _ => Run { + result: Err(diagnostic( + DiagnosticKind::ExecutionFailure, + "Internal interpreter error.".into(), + )), + done: None, + }, + } + }) +} + +fn diagnostic(kind: DiagnosticKind, message: String) -> Diagnostic { + Diagnostic { + kind, + message: crate::HostString::from_run_text(&message), + location: None, + suggestions: Vec::new(), + } +} + +fn run_here(code: &str, timeout_ms: u64) -> Run { + let probe = 0u8; + DONE.with(|d| *d.borrow_mut() = None); + let mut atoms = Strings::new(); + let program = match compiler::compile(code, &mut atoms) { + Ok(p) => p, + Err(e) => { + return Run { + result: Err(diagnostic(e.kind, e.message)), + done: None, + }; + } + }; + let limits = Limits { + timeout_ms: Some(timeout_ms), + ..Limits::default() + }; + let mut vm = Vm::new(crate::host::RunHost::bare(), limits, atoms); + vm.stack_base = &probe as *const u8 as usize; + vm.stack_budget = STACK_BUDGET; + vm.setup(); + harness(&mut vm); + vm.load(program); + let proto = vm.protos[0].clone(); + let fp = vm.realm.function_proto; + let main = Value::Obj(vm.alloc(Obj::new( + Some(fp), + Kind::Closure(Box::new(Closure { + proto, + upvals: Arc::from(Vec::new()), + this: Value::Undef, + home: Value::Undef, + fields: Value::Undef, + })), + ))); + match vm.call(&main, Value::Undef, &[]) { + Ok(_) => { + let _ = vm.drive(); + } + Err(e) => { + if vm.outcome.is_none() { + vm.outcome = Some(Err(e)); + } + } + } + let result = match (vm.fatal.clone(), vm.outcome.take()) { + (Some((kind, message)), _) => Err(diagnostic(kind, message)), + (None, Some(Ok(v))) => match convert::to_json(&mut vm, &v) { + Ok(_) => Ok(()), + Err(e) => Err(failure(&mut vm, &e)), + }, + (None, Some(Err(e))) => Err(failure(&mut vm, &e)), + (None, None) => Err(diagnostic( + DiagnosticKind::ExecutionFailure, + "The program did not finish.".into(), + )), + }; + Run { + result, + done: DONE.with(|d| d.borrow_mut().take()), + } +} + +fn failure(vm: &mut Vm, e: &Value) -> Diagnostic { + if let Value::Obj(id) = e + && let Kind::Error(failure) = &vm.heap[*id as usize].kind + { + let id = *id; + let kind = failure + .as_ref() + .map_or(DiagnosticKind::ExecutionFailure, |f| f.kind.clone()); + return diagnostic(kind, convert::error_to_string(vm, id)); + } + let text = show(vm, e); + diagnostic( + DiagnosticKind::ExecutionFailure, + format!("Uncaught: {text}"), + ) +} + +fn global(vm: &mut Vm, name: &'static str, v: Value) { + let a = vm.atoms.intern_static(name); + vm.global_map.insert(a, v); +} + +fn harness(vm: &mut Vm) { + let object_proto = vm.realm.object_proto; + let proto = vm.alloc(Obj::new(Some(object_proto), Kind::Ordinary)); + let (nk, pk, ck) = (vm.names.name, vm.names.prototype, vm.names.constructor); + let name = vm.static_str("Test262Error"); + vm.define_hidden(proto, nk, name); + let name_atom = vm.atoms.intern_static("Test262Error"); + let fp = vm.realm.function_proto; + let ctor = vm.alloc(Obj::new( + Some(fp), + Kind::Native { + f: test262_error, + data: Value::Obj(proto), + name: name_atom, + length: 1, + ctor: true, + }, + )); + vm.heap[ctor as usize] + .props + .insert(pk, Value::Obj(proto), 0); + vm.define_hidden(proto, ck, Value::Obj(ctor)); + let thrower = vm.native_fn("thrower", 1, test262_thrower, Value::Obj(proto)); + let key = vm.atoms.intern_static("thrower"); + vm.define_hidden(ctor, key, thrower); + global(vm, "Test262Error", Value::Obj(ctor)); + + let compare = vm.native_fn("compareArray", 2, compare_array, Value::Obj(proto)); + if let Value::Obj(id) = compare { + vm.method(id, "format", 1, compare_format); + } + global(vm, "compareArray", compare); + + let assert = vm.native_fn("$assert", 2, assert_true, Value::Obj(proto)); + if let Value::Obj(id) = assert { + let checks: [(&'static str, u8, NativeFn); 5] = [ + ("sameValue", 3, assert_same_value), + ("notSameValue", 3, assert_not_same_value), + ("compareArray", 3, assert_compare_array), + ("notThrown", 2, assert_not_thrown), + ("thrown", 3, assert_thrown), + ]; + for (name, length, f) in checks { + let m = vm.native_fn(name, length, f, Value::Obj(proto)); + let key = vm.atoms.intern_static(name); + vm.define_hidden(id, key, m); + } + } + global(vm, "$assert", assert); + + let done = vm.native_fn("$DONE", 1, done, Value::Undef); + global(vm, "$DONE", done); + let not_evaluate = vm.native_fn("$DONOTEVALUATE", 0, do_not_evaluate, Value::Undef); + global(vm, "$DONOTEVALUATE", not_evaluate); +} + +/// The `Test262Error` prototype, which every harness function carries as its data. +fn error_proto(vm: &Vm, callee: Id) -> Id { + vm.native_data(callee) + .as_obj() + .unwrap_or(vm.realm.object_proto) +} + +fn fail(vm: &mut Vm, callee: Id, message: &str) -> Res { + let proto = error_proto(vm, callee); + Err(vm.make_error(proto, message)) +} + +fn test262_error(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let message = match arg(args, 0) { + Value::Undef => String::new(), + v => { + let s = vm.string_of(&v)?; + vm.text(s).to_owned() + } + }; + let proto = error_proto(vm, callee); + Ok(vm.make_error(proto, &message)) +} + +fn test262_thrower(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let s = vm.string_of(&arg(args, 0))?; + let message = vm.text(s).to_owned(); + fail(vm, callee, &message) +} + +fn same_value(vm: &Vm, a: &Value, b: &Value) -> bool { + match (a, b) { + (Value::Num(x), Value::Num(y)) => { + (x.is_nan() && y.is_nan()) || (x == y && x.is_sign_negative() == y.is_sign_negative()) + } + _ => vm.strict_eq(a, b), + } +} + +fn arrays_equal(vm: &Vm, a: &Value, b: &Value) -> bool { + let (Value::Obj(a), Value::Obj(b)) = (a, b) else { + return false; + }; + match (&vm.heap[*a as usize].kind, &vm.heap[*b as usize].kind) { + // Like the reference's host `every`: holes in the actual array are not compared, and a hole in the + // expected one reads as undefined. + (Kind::Array(x), Kind::Array(y)) => { + x.len() == y.len() + && x.iter().zip(y).all(|(x, y)| { + matches!(x, Value::Uninit) + || same_value( + vm, + x, + if let Value::Uninit = y { + &Value::Undef + } else { + y + }, + ) + }) + } + _ => false, + } +} + +fn prefix(vm: &mut Vm, message: &Value) -> Result { + if let Value::Undef = message { + return Ok(String::new()); + } + let s = vm.string_of(message)?; + Ok(format!("{} ", vm.text(s))) +} + +fn compare_array(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + Ok(Value::Bool(arrays_equal(vm, &arg(args, 0), &arg(args, 1)))) +} + +fn compare_format(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let text = show(vm, &arg(args, 0)); + Ok(vm.string_val(text)) +} + +fn assert_true(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let value = arg(args, 0); + if let Value::Bool(true) = value { + return Ok(Value::Undef); + } + let message = match arg(args, 1) { + Value::Undef => format!("Expected true but got {}", show(vm, &value)), + m => { + let s = vm.string_of(&m)?; + vm.text(s).to_owned() + } + }; + fail(vm, callee, &message) +} + +fn assert_same_value(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let (a, b) = (arg(args, 0), arg(args, 1)); + if same_value(vm, &a, &b) { + return Ok(Value::Undef); + } + let p = prefix(vm, &arg(args, 2))?; + let message = format!( + "{p}Expected SameValue(«{}», «{}») to be true", + show(vm, &a), + show(vm, &b) + ); + fail(vm, callee, &message) +} + +fn assert_not_same_value(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let (a, b) = (arg(args, 0), arg(args, 1)); + if !same_value(vm, &a, &b) { + return Ok(Value::Undef); + } + let p = prefix(vm, &arg(args, 2))?; + let message = format!( + "{p}Expected SameValue(«{}», «{}») to be false", + show(vm, &a), + show(vm, &b) + ); + fail(vm, callee, &message) +} + +fn assert_compare_array(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let (a, b) = (arg(args, 0), arg(args, 1)); + if arrays_equal(vm, &a, &b) { + return Ok(Value::Undef); + } + let p = prefix(vm, &arg(args, 2))?; + let message = format!( + "Actual {} and expected {} should have the same contents. {p}", + show(vm, &a), + show(vm, &b) + ); + fail(vm, callee, &message) +} + +fn expected_name(vm: &mut Vm, ctor: &Value) -> String { + if vm.is_callable(ctor) { + let nk = vm.names.name; + if let Ok(name) = vm.get(ctor, nk) { + return match name { + Value::Str(s) => vm.text(s).to_owned(), + other => show(vm, &other), + }; + } + } + show(vm, ctor) +} + +fn assert_not_thrown(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let p = prefix(vm, &arg(args, 1))?; + let name = expected_name(vm, &arg(args, 0)); + let message = format!("{p}Expected a {name} to be thrown but no exception was thrown at all"); + fail(vm, callee, &message) +} + +fn assert_thrown(vm: &mut Vm, _this: Value, args: &[Value], callee: Id) -> Res { + let (expected, thrown) = (arg(args, 0), arg(args, 2)); + let p = prefix(vm, &arg(args, 1))?; + if !matches!(thrown, Value::Obj(_)) { + return fail(vm, callee, &format!("{p}Thrown value was not an object!")); + } + let ck = vm.names.constructor; + let actual = vm.get(&thrown, ck)?; + if vm.strict_eq(&actual, &expected) { + return Ok(Value::Undef); + } + let name = expected_name(vm, &expected); + // The thrown error's own message is not in the reference's text; it only names the cause in reports. + let message = format!( + "{p}Expected a {name} but got a {} ({})", + show(vm, &actual), + vm.error_text(&thrown) + ); + fail(vm, callee, &message) +} + +fn done(vm: &mut Vm, _this: Value, args: &[Value], _: Id) -> Res { + let error = match arg(args, 0) { + Value::Undef => None, + e => Some(show(vm, &e)), + }; + DONE.with(|d| { + d.borrow_mut().get_or_insert(error); + }); + Ok(Value::Undef) +} + +fn do_not_evaluate(vm: &mut Vm, _this: Value, _args: &[Value], _: Id) -> Res { + Err(vm.static_str("Test262: This statement should not be evaluated.")) +} + +/// A value as the reference harness shows it in failure messages. +fn show(vm: &mut Vm, v: &Value) -> String { + match v { + Value::Str(s) => { + let mut out = String::new(); + convert::quote(&mut out, vm.text(*s)); + out + } + Value::Num(n) if *n == 0.0 && n.is_sign_negative() => "-0".into(), + Value::Obj(id) => { + let id = *id; + match &vm.heap[id as usize].kind { + Kind::Array(items) => { + let items = items.clone(); + let parts: Vec = items + .iter() + .map(|item| match item { + Value::Uninit => String::new(), + item => show(vm, item), + }) + .collect(); + format!("[{}]", parts.join(", ")) + } + Kind::Closure(_) => "program function".into(), + _ if vm.heap[id as usize].is_callable() => { + let nk = vm.names.name; + let name = vm.get_obj(id, nk); + vm.string_of(&name) + .map(|s| vm.text(s).to_owned()) + .unwrap_or_default() + } + _ => { + let (nk, mk) = (vm.names.name, vm.names.message); + match vm.get_obj(id, mk) { + Value::Str(m) => { + let message = vm.text(m).to_owned(); + let name = match vm.get_obj(id, nk) { + Value::Undef => "object".to_owned(), + n => vm + .string_of(&n) + .map(|s| vm.text(s).to_owned()) + .unwrap_or_default(), + }; + format!("{name}: {message}") + } + _ => "object".into(), + } + } + } + } + _ => convert::format_value(vm, v), + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/value.rs b/packages/codemode-rust/crates/psychoscript/src/value.rs new file mode 100644 index 0000000000000..2d396c517849b --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/value.rs @@ -0,0 +1,565 @@ +//! Program values, strings and number formatting. + +use std::fmt::Write as _; + +use crate::strings::StrId; + +/// Index of an object in the run's heap. +pub type Id = u32; + +/// A program value. `Uninit` marks a binding in its temporal dead zone and never escapes to programs. +#[derive(Clone, Copy, Debug, Default)] +#[repr(C, u64)] +pub enum Value { + #[default] + Undef, + Null, + Bool(bool), + Num(f64), + Str(StrId), + Obj(Id), + /// A well-known symbol; only `Symbol.iterator` exists. + Sym(u32), + Uninit, +} + +impl Value { + #[inline] + pub fn is_nullish(&self) -> bool { + matches!(self, Value::Undef | Value::Null) + } + + /// The number this holds, or NaN. + #[inline] + pub fn as_num(&self) -> f64 { + match self { + Value::Num(n) => *n, + _ => f64::NAN, + } + } + + pub fn as_obj(&self) -> Option { + match self { + Value::Obj(id) => Some(*id), + _ => None, + } + } +} + +/// The shortest decimal digits that round-trip a finite positive `x`, and the power of ten of the first. Of two +/// equally close candidates JavaScript takes the even one, where Rust's formatter may take the other. +pub fn shortest_digits(x: f64) -> (String, i32) { + let e = format!("{x:e}"); + let (mantissa, exp) = e.split_once('e').unwrap_or((&e, "0")); + let exp: i32 = exp.parse().unwrap_or(0); + let digits: String = mantissa.chars().filter(|c| *c != '.').collect(); + let last = digits.as_bytes()[digits.len() - 1] - b'0'; + if last.is_multiple_of(2) || digits.len() > 17 { + return (digits, exp); + } + // A tie means x is exactly halfway to a neighbour: equal to these digits followed by a 5, one way or the other. + let k = digits.len(); + let below = format!("{}{}5", &digits[..k - 1], last - 1); + let above = format!("{digits}5"); + let neighbour = if equals_decimal(x, &below, exp - k as i32) { + Some(last - 1) + } else if last < 9 && equals_decimal(x, &above, exp - k as i32) { + Some(last + 1) + } else { + None + }; + if let Some(d) = neighbour { + let candidate = format!("{}{}", &digits[..k - 1], d); + let text = format!("{}.{}e{}", &candidate[..1], &candidate[1..], exp); + if text.parse::().ok() == Some(x) { + return (candidate, exp); + } + } + (digits, exp) +} + +/// Whether the finite positive `x` is exactly the decimal `digits` × 10^`q`; false when that cannot be decided in +/// 128-bit integers, which only happens far from any tie a double can make. +fn equals_decimal(x: f64, digits: &str, q: i32) -> bool { + let Ok(d) = digits.parse::() else { + return false; + }; + let bits = x.to_bits(); + let raw = ((bits >> 52) & 0x7ff) as i32; + let (mut m, mut p) = if raw == 0 { + (bits & ((1 << 52) - 1), -1074) + } else { + ((bits & ((1 << 52) - 1)) | (1 << 52), raw - 1075) + }; + while m & 1 == 0 && m != 0 { + m >>= 1; + p += 1; + } + let (mut lhs, mut rhs) = (m as u128, d); + let shift = |v: u128, n: u32| v.checked_mul(1u128.checked_shl(n)?); + let scale = |v: u128, n: u32| v.checked_mul(10u128.checked_pow(n)?); + let r = (|| { + if p >= 0 { + lhs = shift(lhs, p as u32)?; + } else { + rhs = shift(rhs, (-p) as u32)?; + } + if q >= 0 { + rhs = scale(rhs, q as u32)?; + } else { + lhs = scale(lhs, (-q) as u32)?; + } + Some(lhs == rhs) + })(); + r.unwrap_or(false) +} + +/// An integer's decimal digits, without the formatting machinery a hot `"k" + i` would pay for. +#[inline] +pub fn write_int(out: &mut String, n: i64) { + let mut buf = [0u8; 20]; + let mut at = buf.len(); + let mut m = n.unsigned_abs(); + loop { + at -= 1; + buf[at] = b'0' + (m % 10) as u8; + m /= 10; + if m == 0 { + break; + } + } + if n < 0 { + out.push('-'); + } + for &b in &buf[at..] { + out.push(b as char); + } +} + +/// `Number.prototype.toString()` with radix 10. +pub fn num_to_string(x: f64) -> String { + let mut out = String::new(); + write_num(&mut out, x); + out +} + +pub fn write_num(out: &mut String, x: f64) { + if x.is_nan() { + out.push_str("NaN"); + return; + } + if x == 0.0 { + out.push('0'); + return; + } + if x.is_infinite() { + out.push_str(if x > 0.0 { "Infinity" } else { "-Infinity" }); + return; + } + if x.fract() == 0.0 && x.abs() < 9_007_199_254_740_992.0 { + write_int(out, x as i64); + return; + } + if x < 0.0 { + out.push('-'); + } + let (digits, exp) = shortest_digits(x.abs()); + let k = digits.len() as i32; + let n = exp + 1; + if k <= n && n <= 21 { + out.push_str(&digits); + for _ in 0..(n - k) { + out.push('0'); + } + } else if 0 < n && n <= 21 { + out.push_str(&digits[..n as usize]); + out.push('.'); + out.push_str(&digits[n as usize..]); + } else if -6 < n && n <= 0 { + out.push_str("0."); + for _ in 0..(-n) { + out.push('0'); + } + out.push_str(&digits); + } else { + let e = n - 1; + out.push_str(&digits[..1]); + if k > 1 { + out.push('.'); + out.push_str(&digits[1..]); + } + out.push('e'); + out.push(if e < 0 { '-' } else { '+' }); + let _ = write!(out, "{}", e.abs()); + } +} + +/// `Number.prototype.toFixed`, rounding the exact binary value half away from zero like JavaScript. +pub fn num_to_fixed(x: f64, digits: usize) -> String { + if !x.is_finite() { + return num_to_string(x); + } + let exact = format!("{:.1100}", x.abs()); + let (int, frac) = exact.split_once('.').unwrap_or((&exact, "")); + let mut buf: Vec = int.bytes().chain(frac.bytes().take(digits)).collect(); + let round_up = frac.as_bytes().get(digits).is_some_and(|d| *d >= b'5'); + if round_up { + let mut i = buf.len(); + loop { + if i == 0 { + buf.insert(0, b'1'); + break; + } + i -= 1; + if buf[i] == b'9' { + buf[i] = b'0'; + } else { + buf[i] += 1; + break; + } + } + } + let split = buf.len() - digits; + let mut out = String::new(); + let negative = x < 0.0 && buf.iter().any(|b| *b != b'0'); + if negative { + out.push('-'); + } + out.push_str(std::str::from_utf8(&buf[..split]).unwrap_or("0")); + if digits > 0 { + out.push('.'); + out.push_str(std::str::from_utf8(&buf[split..]).unwrap_or("")); + } + out +} + +pub fn is_js_whitespace(c: char) -> bool { + matches!( + c, + '\u{9}' | '\u{a}' | '\u{b}' | '\u{c}' | '\u{d}' | ' ' | '\u{a0}' | '\u{1680}' | '\u{2000}' + ..='\u{200a}' + | '\u{2028}' + | '\u{2029}' + | '\u{202f}' + | '\u{205f}' + | '\u{3000}' + | '\u{feff}' + ) +} + +/// ToNumber applied to a string. +pub fn str_to_num(s: &str) -> f64 { + let t = s.trim_matches(is_js_whitespace); + if t.is_empty() { + return 0.0; + } + let (sign, body) = match t.as_bytes()[0] { + b'+' => (1.0, &t[1..]), + b'-' => (-1.0, &t[1..]), + _ => (1.0, t), + }; + if body == "Infinity" { + return sign * f64::INFINITY; + } + if t.len() > 2 && body.len() == t.len() { + let radix = match t.get(..2) { + Some("0x" | "0X") => 16, + Some("0o" | "0O") => 8, + Some("0b" | "0B") => 2, + _ => 0, + }; + if radix != 0 { + let mut v = 0.0f64; + for c in t[2..].chars() { + match c.to_digit(radix) { + Some(d) => v = v * radix as f64 + d as f64, + None => return f64::NAN, + } + } + return v; + } + } + if !is_decimal_literal(body) { + return f64::NAN; + } + body.parse::().map(|v| sign * v).unwrap_or(f64::NAN) +} + +fn is_decimal_literal(s: &str) -> bool { + let b = s.as_bytes(); + let mut i = 0; + let int_start = i; + while i < b.len() && b[i].is_ascii_digit() { + i += 1; + } + let mut digits = i > int_start; + if i < b.len() && b[i] == b'.' { + i += 1; + let f = i; + while i < b.len() && b[i].is_ascii_digit() { + i += 1; + } + digits |= i > f; + } + if !digits { + return false; + } + if i < b.len() && (b[i] == b'e' || b[i] == b'E') { + i += 1; + if i < b.len() && (b[i] == b'+' || b[i] == b'-') { + i += 1; + } + let e = i; + while i < b.len() && b[i].is_ascii_digit() { + i += 1; + } + if i == e { + return false; + } + } + i == b.len() +} + +/// The longest decimal prefix `parseFloat` accepts. +pub fn parse_float_prefix(s: &str) -> f64 { + let t = s.trim_start_matches(is_js_whitespace); + let b = t.as_bytes(); + let mut i = 0; + if i < b.len() && (b[i] == b'+' || b[i] == b'-') { + i += 1; + } + if t[i..].starts_with("Infinity") { + return if b.first() == Some(&b'-') { + f64::NEG_INFINITY + } else { + f64::INFINITY + }; + } + let start = i; + while i < b.len() && b[i].is_ascii_digit() { + i += 1; + } + if i < b.len() && b[i] == b'.' { + i += 1; + while i < b.len() && b[i].is_ascii_digit() { + i += 1; + } + } + if i == start || &t[start..i] == "." { + return f64::NAN; + } + let mantissa_end = i; + if i < b.len() && (b[i] == b'e' || b[i] == b'E') { + let mut j = i + 1; + if j < b.len() && (b[j] == b'+' || b[j] == b'-') { + j += 1; + } + let d = j; + while j < b.len() && b[j].is_ascii_digit() { + j += 1; + } + if j > d { + i = j; + } + } + let end = if i > mantissa_end { i } else { mantissa_end }; + t[..end].parse::().unwrap_or(f64::NAN) +} + +pub fn to_int32(x: f64) -> i32 { + if x.is_finite() && x.abs() < 2147483648.0 { + return x as i32; + } + if !x.is_finite() { + return 0; + } + let m = x.trunc().rem_euclid(4294967296.0); + m as u32 as i32 +} + +pub fn to_uint32(x: f64) -> u32 { + to_int32(x) as u32 +} + +/// ToIntegerOrInfinity. +pub fn to_integer(x: f64) -> f64 { + if x.is_nan() { 0.0 } else { x.trunc() + 0.0 } +} + +/// If `s` is a canonical array index ("0", "17", not "01"), returns it. +pub fn index_of_key(s: &str) -> Option { + let b = s.as_bytes(); + if b.is_empty() || b.len() > 10 || (b.len() > 1 && b[0] == b'0') { + return None; + } + let mut v: u64 = 0; + for c in b { + if !c.is_ascii_digit() { + return None; + } + v = v * 10 + (c - b'0') as u64; + } + if v < u32::MAX as u64 { + Some(v as u32) + } else { + None + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn number_formatting() { + assert_eq!(num_to_string(0.1 + 0.2), "0.30000000000000004"); + assert_eq!(num_to_string(1e21), "1e+21"); + assert_eq!(num_to_string(1.5e-7), "1.5e-7"); + assert_eq!(num_to_string(123456789012.0), "123456789012"); + assert_eq!(num_to_string(-1e-7), "-1e-7"); + assert_eq!(num_to_string(0.000001), "0.000001"); + assert_eq!(num_to_fixed(1.23456, 2), "1.23"); + assert_eq!(num_to_fixed(2.5, 0), "3"); + assert_eq!(num_to_fixed(1.005, 2), "1.00"); + } + + #[test] + fn string_to_number() { + assert_eq!(str_to_num(" 3.5 "), 3.5); + assert!(str_to_num("x").is_nan()); + assert!(str_to_num("inf").is_nan()); + assert_eq!(str_to_num(""), 0.0); + assert_eq!(str_to_num("0x1f"), 31.0); + assert_eq!(parse_float_prefix("2.5e1x"), 25.0); + assert!(str_to_num("\u{180e}").is_nan()); + assert!(str_to_num("1\u{180e}").is_nan()); + } +} + +const QNAN: u64 = 0x7ff8_0000_0000_0000; +const TAGGED: u64 = 0xfff9_0000_0000_0000; +const T_UNDEF: u64 = 0xfff9; +const T_NULL: u64 = 0xfffa; +const T_BOOL: u64 = 0xfffb; +const T_STR: u64 = 0xfffc; +const T_OBJ: u64 = 0xfffd; +const T_SYM: u64 = 0xfffe; +const T_UNINIT: u64 = 0xffff; + +/// A value packed into one word (NaN-boxing), for the VM stack and closure cells. Numbers are their own bits, with +/// every NaN canonicalized; other values live in the negative quiet-NaN space with a 32-bit payload. +#[derive(Clone, Copy, PartialEq, Eq)] +pub struct Slot(pub u64); + +impl Default for Slot { + fn default() -> Self { + Slot::UNDEF + } +} + +impl Slot { + pub const UNDEF: Slot = Slot(T_UNDEF << 48); + pub const UNINIT: Slot = Slot(T_UNINIT << 48); + + #[inline(always)] + pub fn num(f: f64) -> Slot { + if f.is_nan() { + Slot(QNAN) + } else { + Slot(f.to_bits()) + } + } + + #[inline(always)] + pub fn is_num(self) -> bool { + self.0 < TAGGED + } + + #[inline(always)] + pub fn f(self) -> f64 { + f64::from_bits(self.0) + } + + #[inline(always)] + pub fn is_str(self) -> bool { + self.0 >> 48 == T_STR + } + + /// The object this holds. + #[inline(always)] + pub fn obj(self) -> Option { + (self.0 >> 48 == T_OBJ).then_some(self.0 as u32) + } + + /// A count or an index, which is never NaN. + #[inline(always)] + pub fn index(i: usize) -> Slot { + Slot((i as f64).to_bits()) + } + + #[inline(always)] + pub fn payload(self) -> u32 { + self.0 as u32 + } + + #[inline(always)] + pub fn pack(v: Value) -> Slot { + match v { + Value::Num(f) => Slot::num(f), + Value::Undef => Slot::UNDEF, + Value::Null => Slot(T_NULL << 48), + Value::Bool(b) => Slot(T_BOOL << 48 | b as u64), + Value::Str(s) => Slot(T_STR << 48 | s as u64), + Value::Obj(o) => Slot(T_OBJ << 48 | o as u64), + Value::Sym(s) => Slot(T_SYM << 48 | s as u64), + Value::Uninit => Slot::UNINIT, + } + } + + #[inline(always)] + pub fn get(self) -> Value { + if self.0 < TAGGED { + return Value::Num(f64::from_bits(self.0)); + } + let p = self.0 as u32; + match self.0 >> 48 { + T_UNDEF => Value::Undef, + T_NULL => Value::Null, + T_BOOL => Value::Bool(p != 0), + T_STR => Value::Str(p), + T_OBJ => Value::Obj(p), + T_SYM => Value::Sym(p), + _ => Value::Uninit, + } + } +} + +#[cfg(test)] +mod slot_tests { + use super::*; + + #[test] + fn packing_round_trips() { + for v in [ + Value::Num(-0.0), + Value::Num(f64::NEG_INFINITY), + Value::Num(1.5), + Value::Str(7), + Value::Obj(u32::MAX), + ] { + assert_eq!(format!("{:?}", Slot::pack(v).get()), format!("{v:?}")); + } + assert!(Slot::pack(Value::Num(f64::from_bits(0xffff_0000_0000_0001))).get_num_is_nan()); + assert!(matches!( + Slot::pack(Value::Bool(true)).get(), + Value::Bool(true) + )); + assert!(matches!(Slot::UNINIT.get(), Value::Uninit)); + } + + impl Slot { + fn get_num_is_nan(self) -> bool { + matches!(self.get(), Value::Num(n) if n.is_nan()) + } + } +} diff --git a/packages/codemode-rust/crates/psychoscript/src/vm.rs b/packages/codemode-rust/crates/psychoscript/src/vm.rs new file mode 100644 index 0000000000000..cca2568ef07d0 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/src/vm.rs @@ -0,0 +1,4478 @@ +//! The stack machine: frames, calls, exceptions, suspension and the run loop. + +use std::collections::VecDeque; +use std::sync::Arc; +use std::time::Instant; + +use rustc_hash::FxHashMap; + +use crate::accessors::Read; +use crate::bytecode::{Arith, Capture, FuncProto, Op, Program, TemplateSite}; +use crate::compiler::{DELEGATE_ASYNC, DELEGATE_NO_ARG}; +use crate::conversion::code; +use crate::object::*; +use crate::strings::{StrId, Strings}; +use crate::value::{Id, Slot, Value}; +use crate::{DiagnosticKind, Limits}; + +pub type Res = Result; + +pub use crate::collector::Heap; + +pub type NativeFn = fn(&mut Vm, Value, &[Value], Id) -> Res; + +pub const MAX_DEPTH: usize = 10_000; +pub(crate) const MAX_OBJECTS: usize = 2_000_000; +pub(crate) const MAX_STRINGS: usize = 4_000_000; +const MAX_NATIVE_DEPTH: usize = 400; +pub(crate) const FUEL: i32 = 20_000; +/// The reference's fuel: it starts the host calls a program queued whenever this runs out, so streaming responses +/// count it the same way. A loop back-edge, a function call or a job costs one, a call of a native function fifty. +pub(crate) const HANDOVER_FUEL: i32 = 10_000; +pub(crate) const NATIVE_FUEL: i32 = 50; + +#[derive(Clone, Copy)] +pub struct Handler { + pub(crate) pc: u32, + pub(crate) sp: u32, +} + +#[derive(Clone, Copy, PartialEq)] +pub enum FrameKind { + Normal, + Async(u32), + Generator(Id, Resume), + /// A built-in that calls back into the program (see `native.rs`), by its step function, and for a family's op + /// (`NativeOp::Arrays`, ...) which of the family's steps. + Native(crate::native::NativeOp, u16), +} + +/// How a generator resumed from bytecode hands its yields and its completion back to the frame below it. A +/// generator resumed from native code (`is_base`) returns an `Exit` from `run` instead. +#[derive(Clone, Copy, PartialEq)] +pub enum Resume { + /// To the iteration instruction the resumer stopped at: `IterNext` or `IterStep`. + Iter, + /// To a `DelegateCall`: the value, skipping the `DelegateResult` after it unless done. + Delegate, + /// Appends each yielded value to this array and keeps running, for spread and rest elements. + Collect(Id), + /// As an iterator result object, for a direct `next()` call. + Result, + /// To the native frame that resumed it (see `native.rs`): a yielded value as a call's result, the completion as + /// `Input::Finished`. + Native, +} + +pub struct Frame { + pub func: Arc, + pub pc: usize, + pub base: usize, + pub upvals: Arc<[u32]>, + /// Where this frame's exception handlers start in `Vm::handlers`. + pub hbase: u32, + /// Arguments beyond the declared parameters, kept for rest parameters and `arguments`. + pub extra: Box<[Value]>, + pub argc: u32, + pub kind: FrameKind, + pub is_base: bool, + /// Where a generator's frame last yielded, or `NO_YIELD` before its first `yield`. + pub yield_pc: u32, + /// The frames that count toward the call-stack limit up to this one, itself included: see `program_depth`. Set + /// when the frame is pushed (`push_frame`). + pub depth: u32, +} + +pub const NO_YIELD: u32 = u32::MAX; + +/// A `SavedFrame::splits` entry first: the parked frames start with an async generator's, run on its own stack. +const GENERATOR_FIRST: u32 = u32::MAX; + +/// Generator request kinds, as `DelegateCall` and async generator queues number them. +pub const REQ_NEXT: u8 = 0; +pub const REQ_THROW: u8 = 1; +pub const REQ_RETURN: u8 = 2; + +/// A suspended frame and its stack segment. The box is kept while the frame runs, so suspending again allocates +/// nothing. +pub struct SavedFrame { + pub frame: Option>, + pub stack: Vec, + pub handlers: Vec, + pub started: bool, + /// The frames above `frame` that wait with it, a host call's wait parked them (see `Vm::park_frames`): their `base` + /// and `hbase` are relative to `frame`'s. + // Boxed as the job stack holds them, so parking and restoring move the boxes instead of copying frames. + #[allow(clippy::vec_box)] + pub above: Vec>, + /// For each generator frame among `above` (by its index there), where in `stack` that generator's own stack + /// starts: a running generator runs on its own stack, so the frames a wait parked across one are kept as one + /// segment and split again when they are restored (see `park_frames`). + pub splits: Vec<(u32, u32)>, +} + +/// How `run` left its base frame. The value is packed: returning a two-word `Value` through memory stalls the +/// reload on store forwarding, measurably on short callbacks. +pub enum Exit { + Return(Slot), + Yield(Slot), + /// A suspend stopped the run at a loop back-edge; its frames stay on the job stack, so it can be saved there and + /// continued later. + Suspend, +} + +pub struct Coroutine { + pub saved: Option>, + pub promise: Option, +} + +pub enum Reaction { + Then { + on_ful: Value, + on_rej: Value, + derived: Id, + }, + Await(u32), + /// Settle the target the same way, if it is still pending. + Resolve(Id), + Comb { + comb: Id, + index: u32, + }, + Finally { + cleanup: Value, + derived: Id, + }, + Restore { + derived: Id, + outcome: Result, + }, + Program, + /// Resume the crossing to the host (`cross`) that awaited. + Cross(Id), + /// Resume the async generator suspended at an `await`. + AwaitGen(Id), + /// Answer an async generator's `return` request with how its value settled. + GenReturn(Id), + /// An async-from-sync step: answer `made` with an iterator result of the value; on a rejection, close `close`. + FromSync { + made: Id, + done: bool, + close: Option, + }, +} + +pub enum Job { + Reaction(Reaction, Result), + Thenable { + promise: Id, + thenable: Value, + then: Value, + }, +} + +pub struct Names { + pub length: Atom, + pub name: Atom, + pub prototype: Atom, + pub constructor: Atom, + pub message: Atom, + pub next: Atom, + pub done: Atom, + pub value: Atom, + pub then: Atom, + pub to_string: Atom, + pub value_of: Atom, + pub to_json: Atom, + pub size: Atom, + pub return_: Atom, + pub cause: Atom, + pub status: Atom, + pub reason: Atom, + pub errors: Atom, +} + +#[derive(Default)] +pub struct Realm { + pub object_proto: Id, + pub function_proto: Id, + pub array_proto: Id, + pub string_proto: Id, + pub number_proto: Id, + pub boolean_proto: Id, + pub symbol_proto: Id, + pub error_proto: Id, + pub type_error_proto: Id, + pub range_error_proto: Id, + pub syntax_error_proto: Id, + pub reference_error_proto: Id, + pub aggregate_error_proto: Id, + pub promise_proto: Id, + pub promise_then: Id, + pub map_proto: Id, + pub set_proto: Id, + pub generator_proto: Id, + /// Every arguments object's own `[Symbol.iterator]` (the reference's prelude `argumentsValues`). + pub arguments_values: Id, + pub async_generator_proto: Id, + /// What generator, async and async generator functions inherit from, below `Function.prototype`. + pub generator_function_proto: Id, + pub async_function_proto: Id, + pub async_generator_function_proto: Id, + pub async_from_sync_proto: Id, + /// The built-in `next` of generators, which calls from bytecode resume without a nested run. + pub generator_next: Id, + pub iter_proto: Id, + pub std: crate::builtins::StdProtos, +} + +pub struct Vm { + pub heap: Heap, + pub cells: Vec, + pub atoms: Strings, + pub stack: Vec, + /// Boxed, so suspending and resuming a generator moves a pointer rather than the frame; measured faster for + /// calls too, since pushing a recycled frame copies one word. + #[allow(clippy::vec_box)] + pub frames: Vec>, + #[allow(clippy::vec_box)] + spare_frames: Vec>, + /// The exception handlers of all frames, innermost last. + handlers: Vec, + pub realm: Realm, + pub names: Names, + pub globals: Vec, + pub global_names: Vec, + pub global_map: FxHashMap, + pub consts: Vec, + templates: Vec, + /// Each tagged template site's strings array, once made. + template_objs: Vec>, + pub protos: Vec>, + pub jobs: VecDeque, + pub inbox: VecDeque<(Id, crate::host::Settlement)>, + pub coroutines: Vec, + pub logs: Vec, + pub host: crate::host::RunHost, + pub limits: Limits, + pub start: Instant, + /// Steps left before `budget_out`: the nearer of the reference's fuel and this VM's own check of the clock and of + /// suspend requests, both kept in `host.meter`. + budget: i32, + pub fatal: Option<(DiagnosticKind, String)>, + pub outcome: Option>, + /// The program's result once it has crossed to the host. + pub result_json: Option, + /// A host call waiting for promises in its arguments parks its frames (see `park_frames`) with this coroutine. + pub(crate) park: bool, + pub(crate) park_coroutine: u32, + native_depth: usize, + /// Address near the bottom of the native stack this run started on, and how much of it calls may use. + pub stack_base: usize, + pub stack_budget: usize, + pub(crate) arg_pool: Vec>, + /// The parts of a `Concat` instruction, kept between them so joining allocates no list. + pub(crate) concat_parts: Vec, + pub char_strs: Vec, + pub rng: u64, + /// A suspend (or a round trip) asks the run to stop at its next safe point. + pub suspend_wanted: bool, + /// The run stopped for a suspend: at a job boundary, or with frames on the job stack. + pub suspended: bool, + /// For the round-trip test mode: back-edges between checkpoints, 0 when off. + pub roundtrip_every: u32, + run_depth: u32, + /// Set by a driver entry point before it runs bytecode that may stop at a back-edge and continue from its + /// frames later: the program's body, a resumed `await`. + pub resumable_run: bool, + /// What a fresh runtime makes before the program runs, which a snapshot saves only the changes to. + pub snapshot_base: crate::snapshot::Base, + /// Restored from a snapshot: the program's body already started. + pub resumed: bool, + /// The native `JSON.stringify` walk running now, which stamps the objects it visits (`Obj::visit`), or 0. One + /// nested in it keeps a set instead. + pub(crate) json_walk: u32, + json_walks: u32, + /// The code of every native frame (see `native.rs`). + pub(crate) native_proto: Arc, + no_upvals: Arc<[u32]>, + /// Set by a built-in that pushed a native frame instead of returning its result (`enter_native`). + pub(crate) entered: bool, + /// Set while a built-in called from bytecode or a convert frame's rerun runs: a conversion that calls the + /// program is then restarted instead of made inline (see `conversion.rs`). + pub(crate) convert_ok: bool, + /// The conversion a restartable run asked for. + pub(crate) convert_req: Option, + /// The answers a rerun takes in order, and what the meter was when it started. + pub(crate) replay: VecDeque, + pub(crate) replay_meter: Option, + /// Program getters built-ins read ahead (see `accessors.rs`). + pub(crate) reads: crate::accessors::Reads, + /// Set while an instruction reads a property: a program getter it meets is handed back (`getter_hit`) instead of + /// read, for the instruction to call. + pub(crate) op_access: bool, + pub(crate) getter_hit: Option, + /// The program setter a write met (`Vm::set_obj`), for the instruction to call. + pub(crate) setter_hit: Option, + /// The `next` an iterator opened from native code was read as, for its record (see `Vm::record_next_of`). + pub(crate) opened_next: Option<(Id, Value)>, + /// Set while `new` pushes a class constructor's frame, the one call a class constructor accepts. + pub(crate) constructing: bool, + /// A read reached `Function.prototype`'s restricted `caller` or `arguments` (see `accessor_error`). + pub(crate) restricted_hit: bool, + /// The new target of a built-in constructor `super(...)` calls: its instance's prototype is the target's. + pub(crate) new_target: Option, + pub(crate) gc: crate::collector::Gc, +} + +impl Vm { + pub fn new(host: crate::host::RunHost, limits: Limits, atoms: Strings) -> Self { + let mut atoms = atoms; + let names = Names { + length: atoms.intern_static("length"), + name: atoms.intern_static("name"), + prototype: atoms.intern_static("prototype"), + constructor: atoms.intern_static("constructor"), + message: atoms.intern_static("message"), + next: atoms.intern_static("next"), + done: atoms.intern_static("done"), + value: atoms.intern_static("value"), + then: atoms.intern_static("then"), + to_string: atoms.intern_static("toString"), + value_of: atoms.intern_static("valueOf"), + to_json: atoms.intern_static("toJSON"), + size: atoms.intern_static("size"), + return_: atoms.intern_static("return"), + cause: atoms.intern_static("cause"), + status: atoms.intern_static("status"), + reason: atoms.intern_static("reason"), + errors: atoms.intern_static("errors"), + }; + let char_strs = (0u8..128) + .map(|c| atoms.alloc((c as char).to_string())) + .collect(); + let seed = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .map(|d| d.as_nanos() as u64) + .unwrap_or(0x9e3779b97f4a7c15); + Vm { + heap: Heap::with_capacity(1024), + cells: Vec::new(), + atoms, + stack: Vec::with_capacity(1024), + frames: Vec::with_capacity(64), + spare_frames: Vec::new(), + handlers: Vec::new(), + realm: Realm::default(), + names, + globals: Vec::new(), + global_names: Vec::new(), + global_map: FxHashMap::default(), + consts: Vec::new(), + templates: Vec::new(), + template_objs: Vec::new(), + protos: Vec::new(), + jobs: VecDeque::new(), + inbox: VecDeque::new(), + coroutines: Vec::new(), + logs: Vec::new(), + host, + limits, + start: Instant::now(), + budget: HANDOVER_FUEL, + fatal: None, + outcome: None, + result_json: None, + park: false, + park_coroutine: 0, + native_depth: 0, + json_walk: 0, + json_walks: 0, + stack_base: 0, + stack_budget: usize::MAX, + arg_pool: Vec::new(), + concat_parts: Vec::new(), + char_strs, + rng: seed | 1, + suspend_wanted: false, + suspended: false, + roundtrip_every: 0, + run_depth: 0, + resumable_run: false, + snapshot_base: crate::snapshot::Base::default(), + resumed: false, + native_proto: Arc::new(crate::native::proto()), + no_upvals: Arc::from([]), + entered: false, + convert_ok: false, + convert_req: None, + replay: VecDeque::new(), + replay_meter: None, + reads: Default::default(), + op_access: false, + getter_hit: None, + setter_hit: None, + opened_next: None, + constructing: false, + restricted_hit: false, + new_target: None, + gc: crate::collector::Gc::new(), + } + } + + pub fn load(&mut self, program: Program) { + crate::builtins::ensure_globals(self, &program.globals); + self.template_objs = vec![None; program.templates.len()]; + self.templates = program.templates; + self.consts = program.consts; + self.protos = program.protos; + self.globals = program + .globals + .iter() + .map(|a| self.global_map.get(a).cloned().unwrap_or(Value::Uninit)) + .collect(); + self.global_names = program.globals; + let (gp, next) = (self.realm.generator_proto, self.names.next); + if let Value::Obj(f) = self.get_obj(gp, next) { + self.realm.generator_next = f; + } + } + + // ---------- allocation ---------- + + #[inline] + pub fn alloc(&mut self, obj: Obj) -> Id { + if self.heap.len() >= self.gc.obj_limit + && let Some(id) = self.gc_alloc() + { + self.heap.put(id as usize, obj); + return id; + } + self.heap.push(obj); + (self.heap.len() - 1) as Id + } + + #[inline(always)] + fn new_cell(&mut self) -> u64 { + if self.cells.len() >= self.gc.cell_limit { + return self.gc_new_cell(); + } + self.cells.push(Slot::UNINIT); + self.cells.len() as u64 - 1 + } + + /// Asks the run to stop at its next safe point. + #[inline(always)] + fn want_suspend(&mut self) { + self.suspend_wanted = true; + self.gc.disown_suspend(); + } + + /// A run whose objects or strings, freed slots reused first, reach their cap is stopped here: it ends at its next + /// fuel check. + #[cold] + pub fn out_of_memory(&mut self) { + if self.fatal.is_none() { + self.fatal = Some(( + DiagnosticKind::ExecutionFailure, + "Execution exceeded its memory limit.".into(), + )); + self.settle_budget(); + self.host.meter.fuel = 1; + self.rebudget(); + } + } + + // Kept out of the dispatch loop, which would otherwise inline it with `alloc`. + #[inline(never)] + pub fn new_object(&mut self) -> Id { + let proto = self.realm.object_proto; + self.alloc(Obj::new(Some(proto), Kind::Ordinary)) + } + + // Kept out of the dispatch loop, which would otherwise inline it with `alloc`. + #[inline(never)] + pub fn new_array(&mut self, items: Vec) -> Value { + let proto = self.realm.array_proto; + Value::Obj(self.alloc(Obj::new(Some(proto), Kind::Array(items)))) + } + + pub fn char_str(&mut self, c: u16) -> Value { + match self.char_strs.get(c as usize) { + Some(s) => Value::Str(*s), + None => self.string_val(crate::strings::from_units(&[c])), + } + } + + /// The concatenation of strings, appending in place to the first one's buffer when it can. + // Kept out of the dispatch loop, which would otherwise inline it with `alloc`. + #[inline(never)] + pub fn concat_strs(&mut self, parts: &[StrId]) -> Value { + if self.atoms.bufs.len() >= MAX_STRINGS { + self.out_of_memory(); + } + Value::Str(self.atoms.concat(parts)) + } + + #[inline] + pub fn str_val(&mut self, s: &str) -> Value { + self.string_val(s.to_owned()) + } + + #[inline] + pub fn string_val(&mut self, s: String) -> Value { + if self.atoms.bufs.len() >= MAX_STRINGS { + self.out_of_memory(); + } + Value::Str(self.atoms.alloc(s)) + } + + /// The interned string for a fixed text, without allocating a new one each time. + pub fn static_str(&mut self, s: &str) -> Value { + let a = self.atoms.intern(s); + Value::Str(self.atoms.atom_str(a)) + } + + pub fn strict_eq(&self, a: &Value, b: &Value) -> bool { + match (a, b) { + (Value::Num(x), Value::Num(y)) => x == y, + (Value::Str(x), Value::Str(y)) => x == y || self.atoms.get(*x) == self.atoms.get(*y), + (Value::Obj(x), Value::Obj(y)) => x == y, + (Value::Bool(x), Value::Bool(y)) => x == y, + (Value::Undef, Value::Undef) | (Value::Null, Value::Null) => true, + (Value::Sym(x), Value::Sym(y)) => x == y, + _ => false, + } + } + + /// SameValue (`Object.is`). + pub fn same_value(&self, a: &Value, b: &Value) -> bool { + match (a, b) { + (Value::Num(x), Value::Num(y)) => { + (x.is_nan() && y.is_nan()) + || (x == y && x.is_sign_negative() == y.is_sign_negative()) + } + _ => self.strict_eq(a, b), + } + } + + pub fn same_value_zero(&self, a: &Value, b: &Value) -> bool { + match (a, b) { + (Value::Num(x), Value::Num(y)) => x == y || (x.is_nan() && y.is_nan()), + _ => self.strict_eq(a, b), + } + } + + #[inline] + pub fn text(&self, id: StrId) -> &str { + self.atoms.get(id) + } + + #[inline] + pub fn atom_val(&self, a: Atom) -> Value { + Value::Str(self.atoms.atom_str(a)) + } + + pub fn make_error(&mut self, proto: Id, msg: &str) -> Value { + let id = self.alloc(Obj::new(Some(proto), Kind::Error(None))); + let m = self.names.message; + let text = self.str_val(msg); + self.heap[id as usize].props.push_new(m, text, HIDDEN); + Value::Obj(id) + } + + /// An interpreter failure: a program error that also remembers its diagnostic. + pub fn failure(&mut self, proto: Id, msg: &str, kind: DiagnosticKind) -> Value { + let e = self.make_error(proto, msg); + if let Value::Obj(id) = e { + self.heap[id as usize].kind = Kind::Error(Some(Box::new(Failure { + kind, + message: msg.to_owned(), + offset: None, + site: Default::default(), + }))); + } + e + } + + pub fn type_error(&mut self, msg: &str) -> Value { + let p = self.realm.type_error_proto; + self.failure(p, msg, DiagnosticKind::ExecutionFailure) + } + + /// A `TypeError` that reports an invalid data value. + pub fn invalid_data(&mut self, msg: &str) -> Value { + let p = self.realm.type_error_proto; + self.failure(p, msg, DiagnosticKind::InvalidDataValue) + } + + pub fn range_error(&mut self, msg: &str) -> Value { + let p = self.realm.range_error_proto; + self.failure(p, msg, DiagnosticKind::ExecutionFailure) + } + + pub fn reference_error(&mut self, msg: &str) -> Value { + let p = self.realm.reference_error_proto; + self.failure(p, msg, DiagnosticKind::ExecutionFailure) + } + + pub fn syntax_error(&mut self, msg: &str) -> Value { + let p = self.realm.syntax_error_proto; + self.failure(p, msg, DiagnosticKind::ExecutionFailure) + } + + /// The `SyntaxError` that syntax the language does not support throws when it runs, named by its ESTree node type. + #[cold] + fn unsupported_syntax(&mut self, kind: &str) -> Value { + let p = self.realm.syntax_error_proto; + let help = crate::compiler::SUPPORTED_SYNTAX; + // The reference's messages for the features that have one, and a message of its own after `!`. + let msg = match kind { + "PrivateIdentifier" => { + "Private class members (#name) are not supported. Use a regular property instead." + .to_owned() + } + "StaticBlock" => { + "Class static blocks are not supported. Assign static fields instead.".to_owned() + } + "MetaProperty" => "new.target is not supported.".to_owned(), + "Super" => "'super' is only supported in class methods.".to_owned(), + k if k.starts_with('!') => k[1..].to_owned(), + _ => format!("Syntax '{kind}' is not supported. {help}"), + }; + let e = self.failure(p, &msg, DiagnosticKind::UnsupportedSyntax); + if let Value::Obj(id) = e { + self.host.suggestions.insert(id, vec![help.into()]); + } + e + } + + // ---------- fuel and limits ---------- + + /// A back-edge, a function call or a job. + #[inline] + fn tick(&mut self) -> Result<(), Value> { + self.budget -= 1; + if self.budget <= 0 { + return self.budget_out(true); + } + Ok(()) + } + + /// The reference's fuel alone, spent where the clock is not checked: a native call costs this VM's own count + /// nothing. + #[inline] + fn spend(&mut self, n: i32) { + self.budget -= n; + self.host.meter.fuel += n; + if self.budget <= 0 { + let _ = self.budget_out(false); + } + } + + #[cold] + fn budget_out(&mut self, check: bool) -> Result<(), Value> { + self.settle_budget(); + // A replay's fuel is given back when it ends (see `conversion.rs`): it starts nothing meanwhile. + let replaying = self.replay_meter.is_some(); + if self.host.meter.handover <= 0 { + self.host.meter.handover = HANDOVER_FUEL; + if !replaying { + self.handover(); + } + } + if self.atoms.gc.wanted { + self.gc_poll(); + } + let mut r = Ok(()); + if check && !replaying && self.host.meter.fuel <= 0 { + self.host.meter.fuel = FUEL; + self.checkpoint(); + r = self.check_time(); + } + self.rebudget(); + r + } + + /// The step budget and the meter, as a replay saves them. + pub(crate) fn meter_state(&self) -> crate::conversion::Meter { + let m = &self.host.meter; + [self.budget, m.start, m.handover, m.fuel] + } + + pub(crate) fn set_meter_state(&mut self, s: crate::conversion::Meter) { + self.budget = s[0]; + self.host.meter.start = s[1]; + self.host.meter.handover = s[2]; + self.host.meter.fuel = s[3]; + } + + /// Charges what was spent since the budget was set to both counters. + fn settle_budget(&mut self) { + let used = self.host.meter.start - self.budget; + self.host.meter.handover -= used; + self.host.meter.fuel -= used; + self.host.meter.start = self.budget; + } + + fn rebudget(&mut self) { + let b = self.host.meter.handover.min(self.host.meter.fuel).max(1); + self.budget = b; + self.host.meter.start = b; + } + + /// A native call from bytecode costs fifty, unless the built-in is one the reference writes in its bytecode + /// prelude, which spent that bytecode's fuel itself (see `builtins/fuel.rs`). + #[inline] + fn native_spent(&mut self) { + if !std::mem::take(&mut self.host.meter.bytecode) { + self.spend(NATIVE_FUEL); + } + } + + /// A back-edge of a built-in's loop, which the reference's bytecode runs: it counts for this VM's own checks + /// too, as a back-edge of the program's does. + #[inline] + pub(crate) fn fuel_step(&mut self) { + self.budget -= 1; + if self.budget <= 0 { + let _ = self.budget_out(false); + } + } + + /// Fuel a built-in spends where the reference's bytecode for it would: see `builtins/fuel.rs`. + #[inline] + pub(crate) fn fuel(&mut self, n: i32) { + self.spend(n); + } + + /// `n` back-edges at once, as one at a time would spend them, where no program code runs between them. + pub(crate) fn fuel_steps(&mut self, n: usize) { + if n == 0 { + return; + } + self.settle_budget(); + let left = self.host.meter.handover as u64; + let n = n as u64; + if n < left { + self.host.meter.handover = (left - n) as i32; + } else { + let past = ((n - left) % HANDOVER_FUEL as u64) as i32; + self.host.meter.handover = HANDOVER_FUEL - past; + self.handover(); + } + self.rebudget(); + } + + /// Ends a built-in the reference writes in bytecode: its call costs no native call's fifty. + #[inline] + pub(crate) fn bytecode_builtin(&mut self) { + self.host.meter.bytecode = true; + } + + /// Calls `f` as the reference's bytecode calls a callback: a native costs fifty, unless it is itself written in + /// bytecode there. + #[inline(always)] + pub(crate) fn call_counted(&mut self, f: &Value, this: Value, args: &[Value]) -> Res { + if let Value::Obj(id) = *f + && !matches!(self.heap[id as usize].kind, Kind::Closure(_)) + { + return self.call_counted_other(f, this, args); + } + self.call(f, this, args) + } + + /// `call_counted` of anything but a closure, which costs its frame's unit itself. + #[inline(never)] + fn call_counted_other(&mut self, f: &Value, this: Value, args: &[Value]) -> Res { + if let Value::Obj(id) = *f { + match &self.heap[id as usize].kind { + Kind::Native { f, .. } => { + let f = *f; + if self.native_depth >= MAX_NATIVE_DEPTH { + return Err(self.range_error("Maximum call stack size exceeded")); + } + self.native_depth += 1; + self.host.meter.counted = true; + self.reads.fault = None; + let r = f(self, this, args, id); + let r = self.checked_native(r); + if self.entered { + let r = self.drive_entered(true); + self.native_depth -= 1; + return r; + } + self.native_depth -= 1; + let r = r?; + self.native_spent(); + return Ok(r); + } + Kind::Bound(b) => { + let (target, bthis, bargs) = (b.0, b.1, b.2.clone()); + let mut all = bargs; + all.extend_from_slice(args); + return self.call_counted(&target, bthis, &all); + } + _ => {} + } + } + self.call(f, this, args) + } + + /// What opening `v` costs the reference: nothing for a value it walks itself, else the call of its + /// `Symbol.iterator` method. `yield*` always calls it. + pub(crate) fn open_fuel(&mut self, v: &Value, ctx: u8) -> i32 { + let Value::Obj(id) = v else { return 0 }; + let walked = matches!( + self.heap[*id as usize].kind, + Kind::Array(_) + | Kind::Arguments(_) + | Kind::Map(_) + | Kind::Set(_) + | Kind::SearchParams(_) + | Kind::Headers(_) + | Kind::Bytes(_) + | Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } + | Kind::ExoticIter { .. } + ); + if walked && ctx != crate::bytecode::ITER_DELEGATE { + return 0; + } + // A program getter's method is not known until it runs; it is the program's own. + let method = self.peek(*id, SYM_ITERATOR); + if self.is_closure(&method) || self.has_program_getter(*id, SYM_ITERATOR) { + 0 + } else { + NATIVE_FUEL + } + } + + /// GetIterator for an iterator record, at what opening `v` costs: the iterator and the `next` the record keeps. + #[inline(never)] + fn open_record(&mut self, v: &Value, ctx: u8) -> Result<(Value, Value), Value> { + let it = self.get_iterator_in(v, ctx)?; + let cost = self.open_fuel(v, ctx); + self.spend(cost); + let next = self.record_next_of(v, &it)?; + Ok((it, next)) + } + + /// Starts a native `JSON.stringify` walk that stamps the objects it visits, unless one runs already: its stamp. + pub(crate) fn start_json_walk(&mut self) -> Option { + if self.json_walk != 0 { + return None; + } + if self.json_walks == u32::MAX { + self.json_walks = 0; + for i in 0..self.heap.len() { + self.heap[i].visit = 0; + } + } + self.json_walks += 1; + self.json_walk = self.json_walks; + Some(self.json_walk) + } + + /// Whether the reference iterates `v` itself, with no call of its `Symbol.iterator` method: a string, a + /// collection or a built-in iterator. + pub(crate) fn walks(&self, v: &Value) -> bool { + match v { + Value::Str(_) => true, + Value::Obj(id) => matches!( + self.heap[*id as usize].kind, + Kind::Array(_) + | Kind::Arguments(_) + | Kind::Map(_) + | Kind::Set(_) + | Kind::SearchParams(_) + | Kind::Headers(_) + | Kind::Bytes(_) + | Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } + | Kind::ExoticIter { .. } + ), + _ => false, + } + } + + /// The `next` an iterator record over `it`, opened from `source`, keeps (see `record_next`). The reference + /// steps a built-in iterator itself only when it opens the iterable directly; one that a `Symbol.iterator` method + /// returned has its `next` read and called each step, as bytecode calls it. + /// `record_next_of` once the caller read the iterator's `next` as `read`: a getter is not called again. + pub(crate) fn record_next_read(&mut self, source: &Value, it: &Value, read: Value) -> Res { + let reads = match it { + Value::Obj(id) => match self.heap[*id as usize].kind { + Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } + | Kind::ExoticIter { .. } => !self.walks(source), + Kind::Generator(_) | Kind::AsyncFromSync { .. } => false, + _ => true, + }, + _ => false, + }; + if reads { + Ok(read) + } else { + self.record_next_of(source, it) + } + } + + pub(crate) fn record_next_of(&mut self, source: &Value, it: &Value) -> Res { + if let (Some((opened, next)), Value::Obj(id)) = (self.opened_next.take(), it) + && opened == *id + { + return self.record_next_read(source, it, next); + } + if let Value::Obj(id) = it + && matches!( + self.heap[*id as usize].kind, + Kind::ArrayIter { .. } + | Kind::MapIter { .. } + | Kind::StrIter { .. } + | Kind::ListIter { .. } + | Kind::ExoticIter { .. } + ) + && !self.walks(source) + { + let nk = self.names.next; + return self.get_calling_value(it, nk); + } + self.record_next(it) + } + + /// What closing `it` early costs the reference: the call of a generator's or custom iterator's native `return`. + pub(crate) fn close_fuel(&mut self, it: &Value) -> i32 { + let Value::Obj(id) = it else { return 0 }; + match self.heap[*id as usize].kind { + Kind::Generator(_) | Kind::IterHelper(_) => NATIVE_FUEL, + Kind::Ordinary => { + let key = self.names.return_; + let method = self.peek(*id, key); + if matches!(&method, Value::Obj(m) if matches!(self.heap[*m as usize].kind, Kind::Native { .. })) + { + NATIVE_FUEL + } else { + 0 + } + } + _ => 0, + } + } + + pub(crate) fn is_closure(&self, v: &Value) -> bool { + matches!(v, Value::Obj(id) if matches!(self.heap[*id as usize].kind, Kind::Closure(_))) + } + + /// Fills the reference's fuel as a program starts; entering the program's own frame costs it nothing there. + pub fn start_handover_fuel(&mut self) { + self.settle_budget(); + self.host.meter.handover = HANDOVER_FUEL + 1; + self.rebudget(); + } + + pub fn handlers_ref(&self) -> &Vec { + &self.handlers + } + + pub fn handlers_mut(&mut self) -> &mut Vec { + &mut self.handlers + } + + pub fn template_objs_ref(&self) -> &Vec> { + &self.template_objs + } + + pub fn template_objs_mut(&mut self) -> &mut Vec> { + &mut self.template_objs + } + + /// Notes a suspend request, or a round trip that is due, every few steps. + #[cold] + fn checkpoint(&mut self) { + if self.roundtrip_every > 0 { + self.host.meter.fuel = self.roundtrip_every as i32; + self.want_suspend(); + } + // A long stretch of compute stops to move to a worker thread: see `offload`. + if let Some(o) = &mut self.host.offload + && o.at.is_some_and(|at| std::time::Instant::now() >= at) + { + o.at = None; + o.due = true; + self.want_suspend(); + } + if self.host.shared.requested() { + self.want_suspend(); + } + } + + /// Starts counting steps for the round-trip test mode. + pub fn start_roundtrip(&mut self, every: u32) { + self.roundtrip_every = every; + self.settle_budget(); + self.host.meter.fuel = every as i32; + self.rebudget(); + } + + pub fn check_time(&mut self) -> Result<(), Value> { + if self.fatal.is_some() { + return Err(Value::Undef); + } + if let Some(ms) = self.limits.timeout_ms + && self.start.elapsed().as_millis() as u64 >= ms + { + self.fatal = Some(( + DiagnosticKind::TimeoutExceeded, + format!("Execution timed out after {ms}ms."), + )); + return Err(Value::Undef); + } + Ok(()) + } + + // ---------- calls ---------- + + /// Calls any callable value from native code and runs it to completion (or its first suspension). + #[inline(always)] + pub fn call(&mut self, f: &Value, this: Value, args: &[Value]) -> Res { + match self.call_packed(f, this, args) { + Ok(v) => Ok(v.get()), + Err(e) => Err(e.get()), + } + } + + /// `call` with each outcome packed in one word, so it comes back in registers: a two-word `Value` returned + /// through memory stalls the caller's reload on store forwarding, measurably on short callbacks. + #[inline(never)] + fn call_packed(&mut self, f: &Value, this: Value, args: &[Value]) -> Result { + let probe = 0u8; + if let Value::Obj(id) = *f + && matches!(self.heap[id as usize].kind, Kind::Closure(_)) + && self.native_depth < MAX_NATIVE_DEPTH + && self.stack_base.abs_diff(&probe as *const u8 as usize) <= self.stack_budget + { + let fpos = self.stack.len(); + self.push(*f); + self.push(this); + self.stack.extend(args.iter().map(|v| Slot::pack(*v))); + self.push_closure_frame(id, fpos, args.len(), true) + .map_err(Slot::pack)?; + self.native_depth += 1; + let r = self.run_callback(); + self.native_depth -= 1; + return match r { + Ok(Exit::Return(v)) | Ok(Exit::Yield(v)) => Ok(v), + Ok(Exit::Suspend) => Ok(Slot::UNDEF), + Err(e) => Err(Slot::pack(e)), + }; + } + self.call_slow(f, this, args) + .map(Slot::pack) + .map_err(Slot::pack) + } + + fn call_slow(&mut self, f: &Value, this: Value, args: &[Value]) -> Res { + let probe = 0u8; + if self.stack_base.abs_diff(&probe as *const u8 as usize) > self.stack_budget { + return Err(self.range_error("Maximum call stack size exceeded")); + } + let Value::Obj(id) = f else { + return Err(self.type_error("The called value is not a function.")); + }; + let id = *id; + match &self.heap[id as usize].kind { + Kind::Closure(_) => { + if self.native_depth >= MAX_NATIVE_DEPTH { + return Err(self.range_error("Maximum call stack size exceeded")); + } + let fpos = self.stack.len(); + self.push(*f); + self.push(this); + self.stack.extend(args.iter().map(|v| Slot::pack(*v))); + self.push_closure_frame(id, fpos, args.len(), true)?; + self.native_depth += 1; + let r = self.run_callback(); + self.native_depth -= 1; + match r { + Ok(Exit::Return(v)) | Ok(Exit::Yield(v)) => Ok(v.get()), + Ok(Exit::Suspend) => Ok(Value::Undef), + Err(e) => Err(e), + } + } + Kind::Native { f, .. } => { + let f = *f; + if self.native_depth >= MAX_NATIVE_DEPTH { + return Err(self.range_error("Maximum call stack size exceeded")); + } + self.native_depth += 1; + self.host.meter.counted = false; + self.reads.fault = None; + let r = f(self, this, args, id); + let r = self.checked_native(r); + if self.entered { + let r = self.drive_entered(false); + self.native_depth -= 1; + return r; + } + self.native_depth -= 1; + // Only a call from bytecode stands for the reference's own call of the built-in. + self.host.meter.bytecode = false; + r + } + Kind::Bound(b) => { + let (target, bthis, bargs) = (b.0, b.1, b.2.clone()); + let mut all = bargs; + all.extend_from_slice(args); + self.call(&target, bthis, &all) + } + Kind::Namespace(ns) if ns.is_root() => { + let message = format!("{} is not a function.", self.atoms.text(ns.name)); + Err(self.type_error(&message)) + } + Kind::Namespace(_) => { + let r = crate::host::call_namespace(self, id, args, *f); + if self.entered { + return self.drive_entered(false); + } + r + } + _ => Err(self.type_error("The called value is not a function.")), + } + } + + /// The frames that count toward the call-stack limit: the reference runs its built-ins as internal code, which + /// does not count, so native frames do not either. + /// Only asked once more than `MAX_DEPTH` frames run, where `push_frame` keeps the count. + #[inline] + fn program_depth(&self) -> usize { + self.frames.last().map_or(0, |f| f.depth as usize) + } + + /// Pushes a frame. Above `MAX_DEPTH` frames, where the call-stack limit is checked, the frame also records how + /// many frames count toward it (all but native ones): counted once on crossing, then kept from the frame below. + #[inline] + pub(crate) fn push_frame(&mut self, mut f: Box) { + let len = self.frames.len(); + if len >= MAX_DEPTH { + let below = match len { + MAX_DEPTH => self.counted_frames(), + _ => self.frames[len - 1].depth, + }; + f.depth = below + u32::from(!matches!(f.kind, FrameKind::Native(..))); + } + self.frames.push(f); + } + + #[cold] + #[inline(never)] + fn counted_frames(&self) -> u32 { + self.frames + .iter() + .filter(|f| !matches!(f.kind, FrameKind::Native(..))) + .count() as u32 + } + + /// Counts every frame toward the call-stack limit again, after the frames were replaced at once. + pub(crate) fn recount_frames(&mut self) { + let mut depth = 0; + for f in &mut self.frames { + depth += u32::from(!matches!(f.kind, FrameKind::Native(..))); + f.depth = depth; + } + } + + /// Pushes a native frame for the built-in `callee` called on `this`, with `locals` as its first slots, and has + /// its caller run it: the frame starts at its step function's start (see `native.rs`). The built-in returns what + /// this returns. + pub(crate) fn enter_native( + &mut self, + op: crate::native::NativeOp, + callee: Id, + this: Value, + locals: &[Value], + ) -> Res { + self.enter_native_with(op, 0, Value::Obj(callee), this, locals) + } + + /// `enter_native` for one of a family's steps (see `native::NativeOp::Arrays`). + pub(crate) fn enter_native_sub( + &mut self, + op: crate::native::NativeOp, + sub: u16, + callee: Id, + this: Value, + locals: &[Value], + ) -> Res { + self.enter_native_with(op, sub, Value::Obj(callee), this, locals) + } + + /// `enter_native` for a frame no built-in's call made (a job's), or whose callee is not at hand. + pub(crate) fn enter_native_with( + &mut self, + op: crate::native::NativeOp, + sub: u16, + callee: Value, + this: Value, + locals: &[Value], + ) -> Res { + if self.frames.len() >= 3 * MAX_DEPTH { + return Err(self.range_error("Maximum call stack size exceeded")); + } + let base = self.stack.len() + 2; + self.stack.reserve(2 + locals.len()); + self.stack.push(Slot::pack(callee)); + self.stack.push(Slot::pack(this)); + self.stack.extend(locals.iter().map(|v| Slot::pack(*v))); + self.push_native_frame(op, sub, base); + Ok(Value::Undef) + } + + /// `enter_native_with` with the callee, the receiver and the slots already packed. + pub(crate) fn enter_native_slots( + &mut self, + op: crate::native::NativeOp, + sub: u16, + callee: Slot, + this: Slot, + locals: &[Slot], + ) -> Res { + if self.frames.len() >= 3 * MAX_DEPTH { + return Err(self.range_error("Maximum call stack size exceeded")); + } + let base = self.stack.len() + 2; + self.stack.reserve(2 + locals.len()); + self.stack.push(callee); + self.stack.push(this); + self.stack.extend_from_slice(locals); + self.push_native_frame(op, sub, base); + Ok(Value::Undef) + } + + /// Pushes the frame of a native frame whose slots start at `base`, and flags it entered. + #[inline(always)] + fn push_native_frame(&mut self, op: crate::native::NativeOp, sub: u16, base: usize) { + let hbase = self.handlers.len() as u32; + match self.spare_frames.pop() { + // Reuse a retired frame in place; one that ran a native frame keeps the shared code and no upvalues. + Some(mut f) => { + if !Arc::ptr_eq(&f.func, &self.native_proto) { + f.func = self.native_proto.clone(); + } + if !f.upvals.is_empty() { + f.upvals = self.no_upvals.clone(); + } + if !f.extra.is_empty() { + f.extra = Box::default(); + } + f.pc = crate::native::START; + f.base = base; + f.hbase = hbase; + f.argc = 0; + f.kind = FrameKind::Native(op, sub); + f.is_base = false; + f.yield_pc = NO_YIELD; + self.push_frame(f); + } + None => self.push_frame(Box::new(Frame { + func: self.native_proto.clone(), + pc: crate::native::START, + base, + upvals: self.no_upvals.clone(), + hbase, + extra: Box::default(), + argc: 0, + kind: FrameKind::Native(op, sub), + is_base: false, + yield_pc: NO_YIELD, + depth: 0, + })), + } + self.entered = true; + } + + /// Makes the native frame a job pushed the base of the run that runs it. + pub(crate) fn take_entered(&mut self) { + self.entered = false; + if let Some(f) = self.frames.last_mut() { + f.is_base = true; + } + } + + /// Runs the native frame a built-in called from native code pushed, to its result. + fn drive_entered(&mut self, counted: bool) -> Res { + self.entered = false; + self.host.meter.bytecode = false; + if let Some(f) = self.frames.last_mut() { + f.is_base = true; + f.argc = counted as u32; + } + match self.run_callback() { + Ok(Exit::Return(v)) | Ok(Exit::Yield(v)) => Ok(v.get()), + Ok(Exit::Suspend) => Ok(Value::Undef), + Err(e) => Err(e), + } + } + + /// Pushes a frame for the closure at `stack[fpos]`, with receiver and `argc` arguments above it. + fn push_closure_frame( + &mut self, + id: Id, + fpos: usize, + argc: usize, + is_base: bool, + ) -> Result<(), Value> { + // A class constructor runs only for `new` (see `classes.rs`). + if let Kind::Closure(c) = &self.heap[id as usize].kind + && c.proto.class != 0 + && !std::mem::take(&mut self.constructing) + { + self.stack.truncate(fpos); + return Err(self.class_call_error(id)); + } + // The reference counts the program's own frame and refuses a call once more than `MAX_DEPTH` are running: + // `MAX_DEPTH` frames may run above the program. + if self.frames.len() > MAX_DEPTH && self.program_depth() > MAX_DEPTH { + self.stack.truncate(fpos); + return Err(self.range_error("Maximum call stack size exceeded")); + } + self.tick()?; + let Kind::Closure(c) = &self.heap[id as usize].kind else { + return Ok(()); + }; + let proto = c.proto.clone(); + let upvals = c.upvals.clone(); + if proto.is_arrow { + self.stack[fpos + 1] = Slot::pack(c.this); + } + let base = fpos + 2; + let np = proto.nparams as usize; + let mut extra: Box<[Value]> = Box::default(); + if argc > np { + if proto.needs_extra { + extra = self.stack.drain(base + np..).map(Slot::get).collect(); + } else { + self.stack.truncate(base + np); + } + } + self.stack + .resize(base + proto.nlocals as usize, Slot::UNDEF); + let kind = if proto.is_async && !proto.is_generator { + let promise = if proto.is_program { + None + } else { + Some(self.new_promise()) + }; + self.coroutines.push(Coroutine { + saved: None, + promise, + }); + FrameKind::Async(self.coroutines.len() as u32 - 1) + } else { + FrameKind::Normal + }; + let hbase = self.handlers.len() as u32; + // Reuse a retired frame and write its fields in place: building a fresh one on the stack and copying it in + // stalls on store forwarding. + match self.spare_frames.pop() { + Some(spare) => { + self.push_frame(spare); + let f = self.frames.last_mut().expect("frame"); + f.func = proto; + f.pc = 0; + f.base = base; + f.upvals = upvals; + f.hbase = hbase; + f.extra = extra; + f.argc = argc as u32; + f.kind = kind; + f.is_base = is_base; + f.yield_pc = NO_YIELD; + } + None => self.push_frame(Box::new(Frame { + func: proto, + pc: 0, + base, + upvals, + hbase, + extra, + argc: argc as u32, + kind, + is_base, + yield_pc: NO_YIELD, + depth: 0, + })), + } + Ok(()) + } + + /// Pushes a closure's frame for a call whose callee, receiver and arguments are on the stack from `fpos`. + pub(crate) fn enter_closure(&mut self, id: Id, fpos: usize, argc: usize) -> Result<(), Value> { + self.push_closure_frame(id, fpos, argc, false) + } + + /// The `Call` instruction: returns whether a frame was pushed. + #[inline(never)] + pub(crate) fn call_op(&mut self, argc: usize) -> Result { + let fpos = self.stack.len() - argc - 2; + let callee = self.stack[fpos].get(); + let Value::Obj(id) = callee else { + self.stack.truncate(fpos); + return Err(self.not_a_function()); + }; + match &self.heap[id as usize].kind { + Kind::Closure(_) => { + self.push_closure_frame(id, fpos, argc, false)?; + Ok(true) + } + Kind::Native { f, .. } => { + let f = *f; + if id == self.realm.generator_next + && let Some(g) = self.suspended_generator(self.stack[fpos + 1]) + { + let sent = if argc > 0 { + self.stack[fpos + 2] + } else { + Slot::UNDEF + }; + self.stack.truncate(fpos); + self.spend(NATIVE_FUEL); + if self.enter_generator(g, Resume::Result, false) { + self.stack.push(sent); + } + return Ok(true); + } + let mut args = self.arg_pool.pop().unwrap_or_default(); + args.extend(self.stack.drain(fpos + 2..).map(Slot::get)); + let this = self.pop(); + self.stack.pop(); + self.host.meter.counted = true; + self.convert_ok = true; + self.reads.fault = None; + let r = f(self, this, &args, id); + let r = self.checked_native(r); + self.convert_ok = false; + if self.convert_req.is_some() { + let c = self.convert_native(id, this, &args, true, false); + args.clear(); + self.arg_pool.push(args); + c?; + return Ok(true); + } + args.clear(); + self.arg_pool.push(args); + if self.entered { + // The frame says how its call ends when it finishes; nothing set before that counts. + self.entered = false; + self.host.meter.bytecode = false; + if let Some(f) = self.frames.last_mut() { + f.argc = 1; + } + return Ok(true); + } + self.push(r?); + self.native_spent(); + Ok(false) + } + Kind::Bound(b) => { + let (target, bthis, bargs) = (b.0, b.1, b.2.clone()); + let n = bargs.len(); + self.stack[fpos] = Slot::pack(target); + self.stack[fpos + 1] = Slot::pack(bthis); + let tail = self.stack.split_off(fpos + 2); + self.stack.extend(bargs.into_iter().map(Slot::pack)); + self.stack.extend(tail); + self.call_op(argc + n) + } + // The namespace itself is not a function. + Kind::Namespace(ns) if ns.is_root() => { + self.stack.truncate(fpos); + let message = format!("{} is not a function.", self.atoms.text(ns.name)); + let e = self.type_error(&message); + Err(self.at_site(e, crate::bytecode::Site::Object)) + } + Kind::Namespace(_) => { + let callee = self.stack[fpos].get(); + let args: Vec = self.stack.drain(fpos + 2..).map(Slot::get).collect(); + self.stack.truncate(fpos); + // Program getters in the arguments are read ahead, then the call made again (see `conversion.rs`). + self.convert_ok = true; + let r = crate::host::call_namespace(self, id, &args, callee); + self.convert_ok = false; + if self.convert_req.is_some() { + self.convert_native(id, Value::Undef, &args, false, false)?; + return Ok(true); + } + let r = r?; + // A call that waits for promises in its arguments runs in a native frame (see `cross.rs`). + if std::mem::take(&mut self.entered) { + self.host.meter.bytecode = false; + if let Some(f) = self.frames.last_mut() { + f.argc = 1; + } + return Ok(true); + } + self.push(r); + Ok(false) + } + _ => { + self.stack.truncate(fpos); + Err(self.not_a_function()) + } + } + } + + /// How the running call or `new` instruction names its callee, as the reference does: `o.f`, or "The called + /// value" when it cannot be named. + fn callee_name(&self) -> String { + self.call_site().unwrap_or("The called value").to_owned() + } + + /// The name of the callee of the call or `new` the running code is in, natives included, when it has one. A + /// native frame makes its calls for the bytecode below it, as a built-in that called from Rust did. + pub(crate) fn call_site(&self) -> Option<&str> { + self.frames + .iter() + .rev() + .find(|f| !matches!(f.kind, FrameKind::Native(..))) + .and_then(|f| f.func.callee(f.pc.wrapping_sub(1))) + } + + /// The source offset of that call, where an error about what it returns points. + pub(crate) fn call_offset(&self) -> Option { + self.frames + .iter() + .rev() + .find(|f| !matches!(f.kind, FrameKind::Native(..))) + .and_then(|f| f.func.pos.get(f.pc.wrapping_sub(1)).copied()) + } + + #[cold] + #[inline(never)] + fn not_a_function(&mut self) -> Value { + let name = self.callee_name(); + let e = self.type_error(&format!("{name} is not a function.")); + self.at_site(e, crate::bytecode::Site::Object) + } + + #[inline(never)] + pub(crate) fn construct_op(&mut self, argc: usize) -> Result { + let fpos = self.stack.len() - argc - 2; + let callee = self.stack[fpos].get(); + if let Value::Obj(id) = callee + && self.class_of(&callee) != 0 + { + self.construct_class(id, id, fpos, argc)?; + return Ok(true); + } + let args: Vec = self.stack.drain(fpos + 2..).map(Slot::get).collect(); + self.stack.truncate(fpos); + if let Value::Obj(id) = callee + && let Kind::Native { f, ctor: true, .. } = &self.heap[id as usize].kind + { + let f = *f; + self.host.meter.counted = false; + self.convert_ok = true; + self.reads.fault = None; + let r = f(self, Value::Uninit, &args, id); + let r = self.checked_native(r); + self.convert_ok = false; + if self.convert_req.is_some() { + self.convert_native(id, Value::Uninit, &args, false, true)?; + return Ok(true); + } + if std::mem::take(&mut self.entered) { + return Ok(true); + } + self.host.meter.bytecode = false; + self.push(r?); + return Ok(false); + } + Err(self.not_a_constructor(callee)) + } + + #[cold] + #[inline(never)] + fn not_a_constructor(&mut self, callee: Value) -> Value { + let name = self.callee_name(); + let kind = callee.as_obj().map(|id| &self.heap[id as usize].kind); + let message = match kind { + Some(Kind::Closure(_)) => format!( + "{name} is not a constructor: only classes can be constructed with new. Use a class, or call it as a function that returns an object." + ), + Some(Kind::Native { .. }) => { + format!("new {name}(...) is not supported; call {name}(...) without new instead.") + } + _ => format!("{name} is not a constructor."), + }; + self.type_error(&message) + } + + /// A point where the reference's driver takes over: it starts the host calls queued so far. + #[inline] + pub(crate) fn handover(&mut self) { + self.host.next_epoch(); + if !self.host.queued.is_empty() { + self.launch_queued(); + } + } + + #[cold] + #[inline(never)] + fn launch_queued(&mut self) { + crate::host::launch(self); + } + + /// The names a `for...in` loop visits: a namespace's own, or the enumerable keys up the prototype chain. + #[inline(never)] + fn for_in_list(&mut self, v: &Value) -> Result, Value> { + match *v { + Value::Obj(id) if self.is_namespace(id) => { + let names = self.namespace_names(id)?; + Ok(names + .into_iter() + .map(|k| Value::Str(self.atoms.atom_str(k))) + .collect()) + } + _ => Ok(self.for_in_keys(v)), + } + } + + /// A namespace path as a value: a new reference each time the run reads one, as in the reference. + pub fn ns_ref(&mut self, path: crate::object::NsPath) -> Value { + let proto = self.realm.function_proto; + Value::Obj(self.alloc(Obj::new(Some(proto), Kind::Namespace(path)))) + } + + /// The namespace path the reference `id` names, spelled out from its global down. + pub(crate) fn ns_path(&self, id: Id) -> crate::object::NsRef { + let mut keys = Vec::new(); + let mut at = id; + let root = loop { + match &self.heap[at as usize].kind { + Kind::Namespace(ns) if ns.is_root() => break ns.name, + Kind::Namespace(ns) => { + keys.push(crate::HostString::from_run_text(self.atoms.text(ns.name))); + at = ns.parent; + } + _ => break 0, + } + }; + keys.reverse(); + crate::object::NsRef { root, keys } + } + + /// How the program names a namespace path in errors, as the reference's `member` writes it: `api.issues.list`, + /// `api["x-y"]`. + pub(crate) fn ns_label(&self, ns: &crate::object::NsRef) -> String { + let root = self.atoms.text(ns.root); + let mut out = String::with_capacity(root.len() + 8 * ns.keys.len()); + out.push_str(root); + for key in &ns.keys { + crate::object::push_member(&mut out, key); + } + out + } + + // ---------- exceptions ---------- + + /// Fills in the source location of a failure raised by the instruction before `pc`. + #[inline(never)] + fn locate(&mut self, e: &Value, func: &FuncProto, pc: usize) { + if let Value::Obj(id) = e + && let Kind::Error(Some(f)) = &mut self.heap[*id as usize].kind + && f.offset.is_none() + && matches!( + f.kind, + DiagnosticKind::ExecutionFailure + | DiagnosticKind::InvalidDataValue + | DiagnosticKind::UnsupportedSyntax + ) + { + let at = pc.saturating_sub(1); + f.offset = func.site(at, f.site).or_else(|| func.pos.get(at).copied()); + } + } + + /// Marks a failure as pointing at the part `site` of the member expression whose instruction raises it. + pub(crate) fn at_site(&mut self, e: Value, site: crate::bytecode::Site) -> Value { + if let Value::Obj(id) = e + && let Kind::Error(Some(f)) = &mut self.heap[id as usize].kind + { + f.site = site; + } + e + } + + /// Runs a step of the native frame `fi` (see `native.rs`): `Some` with the frame's result when it was this run's + /// base, else `None` once the loop can go on with the top frame. + #[inline(never)] + fn native_op( + &mut self, + fi: usize, + op: crate::native::NativeOp, + sub: u16, + base: usize, + mode: usize, + ) -> Result, Value> { + let input = match mode { + crate::native::RETURNED => { + let hbase = self.frames[fi].hbase as usize; + self.handlers.truncate(hbase); + crate::native::Input::Returned(self.stack.pop().unwrap_or_default()) + } + crate::native::THREW => { + // Handlers the frame pushed for the call that failed go with it. + let e = self.pop(); + let hbase = self.frames[fi].hbase as usize; + self.handlers.truncate(hbase); + crate::native::Input::Threw(e) + } + crate::native::FINISHED => { + let hbase = self.frames[fi].hbase as usize; + self.handlers.truncate(hbase); + crate::native::Input::Finished(self.stack.pop().unwrap_or_default()) + } + _ => crate::native::Input::Start, + }; + self.frames[fi].pc = crate::native::RETURNED; + self.reads.fault = None; + let stepped = crate::native::step(self, op, sub, base, input); + let stepped = match self.reads.fault.take() { + None => stepped, + Some(key) => Err(self.unreachable_accessor(key)), + }; + match stepped? { + crate::native::Step::Call(argc) => { + self.call_op(argc)?; + if self.park + && let Some(result) = self.parked() + { + return Ok(Some(Slot::pack(result))); + } + Ok(None) + } + crate::native::Step::Pushed => Ok(None), + crate::native::Step::DoneEmpty => { + let frame = self.frames.pop().expect("frame"); + self.stack.truncate(frame.base - 2); + self.handlers.truncate(frame.hbase as usize); + self.host.meter.bytecode = false; + let is_base = frame.is_base; + self.spare_frames.push(frame); + Ok(is_base.then_some(Slot::UNDEF)) + } + crate::native::Step::CallUncounted(argc) => { + self.call_op_uncounted(argc)?; + Ok(None) + } + crate::native::Step::CallSettling(argc) => { + self.call_op_settling(argc)?; + Ok(None) + } + crate::native::Step::Done(v) => { + let frame = self.frames.pop().expect("frame"); + self.stack.truncate(frame.base - 2); + self.handlers.truncate(frame.hbase as usize); + if frame.argc & 1 != 0 { + self.native_spent(); + } else { + self.host.meter.bytecode = false; + } + let is_base = frame.is_base; + self.spare_frames.push(frame); + if is_base { + return Ok(Some(Slot::pack(v))); + } + self.push(v); + Ok(None) + } + } + } + + /// Calls `f` from a native frame's step: a closure's frame is pushed here, anything else is called as a call + /// instruction calls it (`call_op`). + #[inline(always)] + pub(crate) fn native_call(&mut self, argc: usize) -> Result { + let fpos = self.stack.len() - argc - 2; + if let Some(id) = self.stack[fpos].obj() + && matches!(self.heap[id as usize].kind, Kind::Closure(_)) + { + self.push_closure_frame(id, fpos, argc, false)?; + return Ok(crate::native::Step::Pushed); + } + Ok(crate::native::Step::Call(argc)) + } + + /// The call a native frame asks for with `Step::CallUncounted`: as `call` makes it from native code, so a native + /// costs no fifty. + #[cold] + #[inline(never)] + fn call_op_uncounted(&mut self, argc: usize) -> Result { + let fpos = self.stack.len() - argc - 2; + let Some(id) = self.stack[fpos].obj() else { + return self.call_op(argc); + }; + match &self.heap[id as usize].kind { + Kind::Native { f, .. } => { + let f = *f; + let mut args = self.arg_pool.pop().unwrap_or_default(); + args.extend(self.stack.drain(fpos + 2..).map(Slot::get)); + let this = self.pop(); + self.stack.pop(); + self.host.meter.counted = false; + self.convert_ok = true; + self.reads.fault = None; + let r = f(self, this, &args, id); + let r = self.checked_native(r); + self.convert_ok = false; + if self.convert_req.is_some() { + let c = self.convert_native(id, this, &args, false, false); + args.clear(); + self.arg_pool.push(args); + c?; + return Ok(true); + } + args.clear(); + self.arg_pool.push(args); + if std::mem::take(&mut self.entered) { + return Ok(true); + } + self.host.meter.bytecode = false; + self.push(r?); + Ok(false) + } + Kind::Bound(b) => { + let (target, bthis, bargs) = (b.0, b.1, b.2.clone()); + let n = bargs.len(); + self.stack[fpos] = Slot::pack(target); + self.stack[fpos + 1] = Slot::pack(bthis); + let tail = self.stack.split_off(fpos + 2); + self.stack.extend(bargs.into_iter().map(Slot::pack)); + self.stack.extend(tail); + self.call_op_uncounted(argc + n) + } + _ => self.call_op(argc), + } + } + + /// The call a native frame asks for with `Step::CallSettling`, as the reference enters a promise handler + /// (`enterSettlingCall`): a plain function's frame and a promise's resolve function for nothing, an async or + /// generator function one unit, a native fifty. + #[cold] + #[inline(never)] + fn call_op_settling(&mut self, argc: usize) -> Result { + let fpos = self.stack.len() - argc - 2; + let Some(id) = self.stack[fpos].obj() else { + return self.call_op(argc); + }; + match &self.heap[id as usize].kind { + Kind::Bound(b) => { + let (target, bthis, bargs) = (b.0, b.1, b.2.clone()); + let n = bargs.len(); + self.stack[fpos] = Slot::pack(target); + self.stack[fpos + 1] = Slot::pack(bthis); + let tail = self.stack.split_off(fpos + 2); + self.stack.extend(bargs.into_iter().map(Slot::pack)); + self.stack.extend(tail); + self.call_op_settling(argc + n) + } + Kind::Closure(c) if !c.proto.is_async && !c.proto.is_generator => { + // Its frame's unit is not spent: credit the budget the call takes it from. + self.budget += 1; + self.call_op(argc) + } + Kind::Native { + data: Value::Obj(state), + .. + } if matches!(self.heap[*state as usize].kind, Kind::Resolvers { .. }) => { + self.call_op_uncounted(argc) + } + _ => self.call_op(argc), + } + } + + /// Fills in the location of a failure a native frame raised: the call of the built-in in the nearest bytecode + /// frame below, as a built-in that returned the failure would have it. + #[cold] + #[inline(never)] + fn locate_native(&mut self, e: &Value, fi: usize) { + let Some(caller) = self.frames[..fi] + .iter() + .rev() + .find(|f| !matches!(f.kind, FrameKind::Native(..))) + else { + return; + }; + let (func, pc) = (caller.func.clone(), caller.pc); + self.locate(e, &func, pc); + } + + /// Unwinds to the nearest handler. `Err` carries what `run` must return when the base frame is left. + #[inline(never)] + fn handle_throw(&mut self, e: Value) -> Result<(), Result> { + // The reference unwinds a throw in its driver loop, which starts the host calls queued so far. + self.handover(); + let fatal = self.fatal.is_some(); + loop { + let Some(f) = self.frames.last_mut() else { + return Err(Err(e)); + }; + if !fatal && self.handlers.len() > f.hbase as usize { + let h = self.handlers.pop().expect("handler"); + let sp = f.base + h.sp as usize; + f.pc = h.pc as usize; + self.stack.truncate(sp); + self.push(e); + return Ok(()); + } + let frame = self.frames.pop().expect("frame"); + self.handlers.truncate(frame.hbase as usize); + self.stack.truncate(frame.base - 2); + match frame.kind { + FrameKind::Async(c) if !fatal => { + let result = match self.coroutines[c as usize].promise { + Some(p) => { + self.reject(p, e); + Value::Obj(p) + } + None => { + self.outcome = Some(Err(e)); + Value::Undef + } + }; + if frame.is_base { + return Err(Ok(Exit::Return(Slot::pack(result)))); + } + self.push(result); + return Ok(()); + } + FrameKind::Generator(g, _) => { + self.leave_generator(g, None); + if self.is_async_generator(g) && !fatal { + self.async_generator_finish(g, Err(e)); + return Err(Ok(Exit::Return(Slot::pack(Value::Undef)))); + } + if frame.is_base { + return Err(Err(e)); + } + } + _ => { + if frame.is_base { + return Err(Err(e)); + } + } + } + } + } + + #[inline(never)] + fn save_top_frame( + &mut self, + pc: usize, + started: bool, + reuse: Option>, + ) -> (Box, bool) { + let mut frame = self.frames.pop().expect("frame"); + frame.pc = pc; + let mut saved = reuse.unwrap_or_else(|| { + Box::new(SavedFrame { + frame: None, + stack: Vec::new(), + handlers: Vec::new(), + started, + above: Vec::new(), + splits: Vec::new(), + }) + }); + saved.stack.clear(); + saved.stack.extend(self.stack.drain(frame.base - 2..)); + saved.handlers.clear(); + saved + .handlers + .extend(self.handlers.drain(frame.hbase as usize..)); + saved.started = started; + let is_base = frame.is_base; + saved.frame = Some(frame); + (saved, is_base) + } + + fn restore_frame(&mut self, saved: &mut SavedFrame) -> bool { + if !saved.splits.is_empty() { + return self.restore_split(saved); + } + let Some(mut frame) = saved.frame.take() else { + return false; + }; + let (base, hbase) = (self.stack.len() + 2, self.handlers.len() as u32); + frame.base = base; + frame.is_base = true; + frame.hbase = hbase; + self.stack.append(&mut saved.stack); + self.handlers.append(&mut saved.handlers); + self.push_frame(frame); + if !saved.above.is_empty() { + self.restore_above(saved, base, hbase); + } + true + } + + /// `restore_frame` for frames a wait parked across running generators: the segment is split again, each + /// generator getting its resumer's stack back and the VM switching to the generator's own, as `enter_generator` + /// does. + #[cold] + #[inline(never)] + fn restore_split(&mut self, saved: &mut SavedFrame) -> bool { + let Some(mut first) = saved.frame.take() else { + return false; + }; + let flat = std::mem::take(&mut saved.stack); + let mut splits = std::mem::take(&mut saved.splits); + if splits.first().is_some_and(|s| s.0 == GENERATOR_FIRST) { + splits.remove(0); + // The generator gets the stack it is resumed from as its resumer's, and runs on its own. + let resumer = std::mem::take(&mut self.stack); + if let FrameKind::Generator(g, _) = first.kind + && let Some(s) = self.running_saved(g) + { + s.stack = resumer; + } + } + let below = self.stack.len(); + let hbase = self.handlers.len() as u32; + first.base = below + 2; + first.is_base = true; + first.hbase = hbase; + self.handlers.append(&mut saved.handlers); + let end = |r: usize| splits.get(r).map_or(flat.len(), |s| s.1 as usize); + self.stack.extend_from_slice(&flat[..end(0)]); + self.push_frame(first); + // The region of the segment the frames being restored are in: 0 below the first generator. + let mut region = 0; + for (j, mut f) in saved.above.drain(..).enumerate() { + if region < splits.len() && splits[region].0 as usize == j { + let start = splits[region].1 as usize; + let own = flat[start..end(region + 1)].to_vec(); + let resumer = std::mem::replace(&mut self.stack, own); + if let FrameKind::Generator(g, _) = f.kind + && let Kind::Generator(GenState::Running(s)) = &mut self.heap[g as usize].kind + { + s.stack = resumer; + } + region += 1; + } + // A base kept relative to the first frame's: its index in the segment, less two. + f.base = match region { + 0 => f.base + below + 2, + r => f.base + 2 - splits[r - 1].1 as usize, + }; + f.hbase += hbase; + self.push_frame(f); + } + true + } + + /// The frames a host call's wait parked above a restored frame, at its `base` and `hbase`. + #[cold] + #[inline(never)] + fn restore_above(&mut self, saved: &mut SavedFrame, base: usize, hbase: u32) { + for mut f in saved.above.drain(..) { + f.base += base; + f.hbase += hbase; + self.push_frame(f); + } + } + + /// The coroutine a host call made now from bytecode would park its frames with while it waits for promises in its + /// arguments, as the reference parks every frame above its nearest async one, or the frames of a promise job or of + /// the program result's crossing when there is none: `None` when a native call or a generator stands in between, which cannot wait. + pub(crate) fn parkable(&mut self) -> Option { + for (i, f) in self.frames.iter().enumerate().rev() { + match f.kind { + FrameKind::Async(c) => return Some(c), + // A generator resumed from bytecode parks with the frames that resumed it. + FrameKind::Generator(g, _) if !f.is_base && !self.is_async_generator(g) => {} + // An async generator, which runs from native code, parks as its `await` does. + FrameKind::Generator(g, _) if f.is_base && self.is_async_generator(g) => { + self.coroutines.push(Coroutine { + saved: None, + promise: None, + }); + return Some(self.coroutines.len() as u32 - 1); + } + FrameKind::Generator(..) => return None, + // A promise job's, or the program result's crossing, run as the base of a resumable run. + FrameKind::Native(..) if f.is_base && i == 0 => { + self.coroutines.push(Coroutine { + saved: None, + promise: None, + }); + return Some(self.coroutines.len() as u32 - 1); + } + FrameKind::Normal | FrameKind::Native(..) if f.is_base => return None, + FrameKind::Normal | FrameKind::Native(..) => {} + } + } + None + } + + /// Parks the frames from the nearest async function (or the promise job's) up to the waiting host call with the + /// coroutine `c`, as an `await` there would; returns that function's promise and whether its frame was this run's + /// base. + fn park_frames(&mut self, c: u32) -> (Value, bool) { + let k = self + .frames + .iter() + .rposition(|f| matches!(f.kind, FrameKind::Async(a) if a == c)) + .or_else(|| { + self.frames.iter().rposition(|f| { + f.is_base && matches!(f.kind, FrameKind::Generator(g, _) if self.is_async_generator(g)) + }) + }) + .unwrap_or(0); + if self.frames[k..] + .iter() + .any(|f| matches!(f.kind, FrameKind::Generator(..))) + { + return self.park_split(c, k); + } + let mut parked: Vec> = self.frames.drain(k..).collect(); + let first = parked.remove(0); + let (base, hbase) = (first.base, first.hbase); + let mut saved = self.coroutines[c as usize].saved.take().unwrap_or_else(|| { + Box::new(SavedFrame { + frame: None, + stack: Vec::new(), + handlers: Vec::new(), + started: true, + above: Vec::new(), + splits: Vec::new(), + }) + }); + saved.stack.clear(); + saved.stack.extend(self.stack.drain(base - 2..)); + saved.handlers.clear(); + saved.handlers.extend(self.handlers.drain(hbase as usize..)); + saved.started = true; + saved.above = parked + .into_iter() + .map(|mut f| { + f.base -= base; + f.hbase -= hbase; + f + }) + .collect(); + let is_base = first.is_base; + saved.frame = Some(first); + self.coroutines[c as usize].saved = Some(saved); + let result = match self.coroutines[c as usize].promise { + Some(p) => Value::Obj(p), + None => Value::Undef, + }; + (result, is_base) + } + + /// What a running generator keeps while its frame runs: its resumer's stack. + fn running_saved(&mut self, g: Id) -> Option<&mut SavedFrame> { + match &mut self.heap[g as usize].kind { + Kind::Generator(GenState::Running(s)) => Some(s), + Kind::AsyncGenerator(a) => match &mut a.state { + GenState::Running(s) => Some(s), + _ => None, + }, + _ => None, + } + } + + /// `park_frames` across running generators, whose frames run on stacks of their own: the parked frames' slots + /// are kept as one segment, the regions below each generator (each in that generator's keeping as its resumer's + /// stack) followed by the generators' own, with where each generator's starts (`SavedFrame::splits`). A parked + /// frame's base is kept as its index in the segment less two. + #[cold] + #[inline(never)] + fn park_split(&mut self, c: u32, k: usize) -> (Value, bool) { + let mut parked: Vec> = self.frames.drain(k..).collect(); + let first = parked.remove(0); + let (base, hbase) = (first.base, first.hbase); + // The stacks of the regions, bottom up: each generator keeps the one below it, the VM the topmost. + let gens: Vec<(usize, Id)> = parked + .iter() + .enumerate() + .filter_map(|(j, f)| match f.kind { + FrameKind::Generator(g, _) => Some((j, g)), + _ => None, + }) + .collect(); + let mut regions: Vec> = gens + .iter() + .map(|(_, g)| match &mut self.heap[*g as usize].kind { + Kind::Generator(GenState::Running(s)) => std::mem::take(&mut s.stack), + _ => Vec::new(), + }) + .collect(); + regions.push(std::mem::take(&mut self.stack)); + let mut flat: Vec = regions[0].drain(base - 2..).collect(); + self.stack = std::mem::take(&mut regions[0]); + let mut splits = Vec::with_capacity(gens.len() + 1); + // An async generator parked from its own frame: the VM goes back to its resumer's stack, as its `await` does, + // and `GENERATOR_FIRST` marks it, ahead of the splits once they are made. + let generator_first = match first.kind { + FrameKind::Generator(g, _) => match self.running_saved(g) { + Some(s) => { + self.stack = std::mem::take(&mut s.stack); + true + } + None => false, + }, + _ => false, + }; + let mut region = 0; + for (j, f) in parked.iter_mut().enumerate() { + if region < gens.len() && gens[region].0 == j { + splits.push((j as u32, flat.len() as u32)); + flat.append(&mut regions[region + 1]); + region += 1; + } + f.base = match region { + 0 => f.base - base, + r => splits[r - 1].1 as usize + f.base - 2, + }; + f.hbase -= hbase; + } + if generator_first { + splits.insert(0, (GENERATOR_FIRST, 0)); + } + let mut saved = self.coroutines[c as usize].saved.take().unwrap_or_else(|| { + Box::new(SavedFrame { + frame: None, + stack: Vec::new(), + handlers: Vec::new(), + started: true, + above: Vec::new(), + splits: Vec::new(), + }) + }); + saved.stack = flat; + saved.handlers.clear(); + saved.handlers.extend(self.handlers.drain(hbase as usize..)); + saved.started = true; + saved.above = parked; + saved.splits = splits; + let is_base = first.is_base; + saved.frame = Some(first); + self.coroutines[c as usize].saved = Some(saved); + let result = match self.coroutines[c as usize].promise { + Some(p) => Value::Obj(p), + None => Value::Undef, + }; + (result, is_base) + } + + /// After a call that parked its frames (a host call's wait): the promise the call answers, pushed for the frame below, or + /// returned when the parked function was this run's base. + #[cold] + #[inline(never)] + fn parked(&mut self) -> Option { + self.park = false; + let c = std::mem::replace(&mut self.park_coroutine, 0); + let (result, is_base) = self.park_frames(c); + if is_base { + return Some(result); + } + self.push(result); + None + } + + /// Resumes a suspended async function with the settled value of what it awaited. + pub fn resume_coroutine(&mut self, c: u32, outcome: Result) -> Result<(), Value> { + let Some(mut saved) = self.coroutines[c as usize].saved.take() else { + return Ok(()); + }; + let restored = self.restore_frame(&mut saved); + self.coroutines[c as usize].saved = Some(saved); + if !restored { + return Ok(()); + } + match outcome { + Ok(v) => self.push(v), + Err(e) => { + if let Err(r) = self.handle_throw(e) { + return r.map(|_| ()); + } + } + } + self.run().map(|_| ()) + } + + /// Whether `v` is a generator that can be resumed now. + #[inline] + fn suspended_generator(&self, v: Slot) -> Option { + match v.get() { + Value::Obj(id) => match &self.heap[id as usize].kind { + Kind::Generator(GenState::Suspended(_)) => Some(id), + _ => None, + }, + _ => None, + } + } + + pub fn is_async_generator(&self, g: Id) -> bool { + matches!(self.heap[g as usize].kind, Kind::AsyncGenerator(_)) + } + + /// Pushes a suspended generator's frame and switches to its stack, which holds that frame's slots; the + /// resumer's stack waits in the generator until it yields or finishes. Nothing is copied. Returns whether a + /// `next(v)` request must push `v`: the generator waits at a `yield` whose result is used. + fn enter_generator(&mut self, g: Id, resume: Resume, is_base: bool) -> bool { + self.enter_generator_at(g, resume, is_base, true) + } + + /// `enter_generator`, resuming the generator at its last `yield` (`from_yield`) or after an `await`. + fn enter_generator_at( + &mut self, + g: Id, + resume: Resume, + is_base: bool, + from_yield: bool, + ) -> bool { + let state = match &mut self.heap[g as usize].kind { + Kind::Generator(s) => s, + Kind::AsyncGenerator(a) => &mut a.state, + _ => return false, + }; + let GenState::Suspended(mut saved) = std::mem::replace(state, GenState::Done) else { + return false; + }; + let Some(frame) = saved.frame.take() else { + return false; + }; + std::mem::swap(&mut self.stack, &mut saved.stack); + let hbase = self.handlers.len() as u32; + if !saved.handlers.is_empty() { + self.handlers.append(&mut saved.handlers); + } + *state = GenState::Running(saved); + // Move the frame unchanged and adjust it in place: narrow writes to a moved value stall its copy. + self.push_frame(frame); + let f = self.frames.last_mut().expect("frame"); + f.kind = FrameKind::Generator(g, resume); + f.is_base = is_base; + f.hbase = hbase; + let at = f.func.code.get(f.yield_pc as usize); + let pushes = f.yield_pc != NO_YIELD && !matches!(at, Some(Op::YieldDrop(_))); + // The reference's `yield*` loops back through a back-edge each time it is resumed there. + if from_yield && matches!(at, Some(Op::YieldStar(_))) { + self.spend(1); + } + pushes + } + + /// Switches back to the resumer's stack after the generator's frame was popped: suspended again with `frame`, + /// or finished without it. + fn leave_generator(&mut self, g: Id, frame: Option>) { + let state = match &mut self.heap[g as usize].kind { + Kind::Generator(s) => s, + Kind::AsyncGenerator(a) => &mut a.state, + _ => return, + }; + let GenState::Running(mut saved) = std::mem::replace(state, GenState::Done) else { + return; + }; + std::mem::swap(&mut self.stack, &mut saved.stack); + if let Some(f) = frame { + if self.handlers.len() > f.hbase as usize { + saved + .handlers + .extend(self.handlers.drain(f.hbase as usize..)); + } + saved.frame = Some(f); + *state = GenState::Suspended(saved); + } + } + + /// Hands a `throw` (1) or `return` (2) request to the generator frame just entered, which has yielded before. + /// `return(v)` runs the return path after its `yield`; `throw(e)` throws there, or at a `yield*` forwards it. + fn deliver_abrupt(&mut self, kind: u8, v: Value) -> Result<(), Result> { + let f = self.frames.last_mut().expect("frame"); + let at = f.yield_pc as usize; + if kind == REQ_RETURN { + f.pc = at + 1; + } else if matches!(f.func.code.get(at), Some(Op::YieldStar(_))) { + f.pc = at + 2; + } else { + return self.handle_throw(v); + } + self.push(v); + Ok(()) + } + + /// Delivers a finished generator's completion value to the frame that resumed it from bytecode. + fn generator_done(&mut self, resume: Resume, v: Value) { + match resume { + Resume::Collect(_) => {} + Resume::Native => { + if let Some(f) = self.frames.last_mut() { + f.pc = crate::native::FINISHED; + } + self.push(v); + } + Resume::Result => { + let r = self.iter_result(v, true); + self.push(r); + } + Resume::Delegate => { + let Some(f) = self.frames.last_mut() else { + return; + }; + if let Some(Op::DelegateResult(exit, _)) = f.func.code.get(f.pc) { + f.pc = *exit as usize; + } + self.push(v); + } + Resume::Iter => { + let Some(f) = self.frames.last_mut() else { + return; + }; + let base = f.base; + match f.func.code.get(f.pc.wrapping_sub(1)) { + Some(Op::IterNext(slot, exit)) => { + f.pc = *exit as usize; + self.stack[base + *slot as usize] = Slot::UNDEF; + } + Some(Op::IterStep(slot)) => { + self.stack[base + *slot as usize] = Slot::UNDEF; + self.stack.push(Slot::UNDEF); + } + _ => self.push(v), + } + } + } + } + + /// Resumes a generator for the native frame on top, as `resume_generator` does (`mode` 0 for `next`, 1 for + /// `return`, 2 for `throw`; for these two the frame must have pushed a handler, as a throw delivered now unwinds at once + /// and must come back to it as `Input::Threw` rather than pass it while its step runs): `Some` with its value and whether it is done when it does not run, `None` once its frame + /// is pushed, which hands the frame below its next yield as + /// a call's result or its completion as `Input::Finished`. + pub(crate) fn native_resume( + &mut self, + g: Id, + mode: u8, + v: Value, + ) -> Result, Value> { + let started = match &self.heap[g as usize].kind { + Kind::Generator(GenState::Suspended(s)) => { + s.frame.as_ref().is_some_and(|f| f.yield_pc != NO_YIELD) + } + Kind::Generator(GenState::Running(_)) => { + return Err(self.type_error("Generator is already running")); + } + _ => { + return match mode { + 0 => Ok(Some((Value::Undef, true))), + 1 => Ok(Some((v, true))), + _ => Err(v), + }; + } + }; + if !started && mode != 0 { + self.heap[g as usize].kind = Kind::Generator(GenState::Done); + return if mode == 1 { + Ok(Some((v, true))) + } else { + Err(v) + }; + } + // A generator method called as bytecode calls it costs the reference its fifty once the generator is to run, + // before its body does, even when the body then throws: not when the method's frame finishes. + if let Some(f) = self.frames.last_mut() + && f.argc & 1 != 0 + && f.kind + == FrameKind::Native( + crate::native::NativeOp::Collections, + crate::builtins::sets::GEN_RESUME, + ) + { + f.argc &= !1; + self.spend(NATIVE_FUEL); + } + let wants = self.enter_generator(g, Resume::Native, false); + if mode == 0 { + if wants { + self.push(v); + } + return Ok(None); + } + // A throw the generator does not catch unwinds from its frame into the frames below, as a throw there does. + let kind = if mode == 1 { REQ_RETURN } else { REQ_THROW }; + match self.deliver_abrupt(kind, v) { + Ok(()) => Ok(None), + Err(Err(e)) => Err(e), + Err(Ok(_)) => Ok(None), + } + } + + /// Resumes a generator from native code and runs it to its next yield or its end. `mode` is 0 for `next`, 1 + /// for `return` and 2 for `throw`. + pub fn resume_generator(&mut self, g: Id, mode: u8, v: Value) -> Result<(Value, bool), Value> { + let started = match &self.heap[g as usize].kind { + Kind::Generator(GenState::Suspended(s)) => { + s.frame.as_ref().is_some_and(|f| f.yield_pc != NO_YIELD) + } + Kind::Generator(GenState::Running(_)) => { + return Err(self.type_error("Generator is already running")); + } + _ => { + return match mode { + 0 => Ok((Value::Undef, true)), + 1 => Ok((v, true)), + _ => Err(v), + }; + } + }; + if !started && mode != 0 { + self.heap[g as usize].kind = Kind::Generator(GenState::Done); + return if mode == 1 { Ok((v, true)) } else { Err(v) }; + } + let wants = self.enter_generator(g, Resume::Iter, true); + let r = match mode { + 0 => { + if wants { + self.push(v); + } + self.run() + } + _ => { + let kind = if mode == 1 { REQ_RETURN } else { REQ_THROW }; + match self.deliver_abrupt(kind, v) { + Ok(()) => self.run(), + Err(r) => r, + } + } + }; + match r { + Ok(Exit::Yield(y)) => Ok((y.get(), false)), + Ok(Exit::Suspend) => Ok((Value::Undef, false)), + Ok(Exit::Return(v)) => Ok((v.get(), true)), + Err(e) => Err(e), + } + } + + /// Runs a generator from native code until it finishes, collecting what it yields. + pub fn collect_generator(&mut self, g: Id) -> Result, Value> { + let arr = self.new_array(Vec::new()); + let Value::Obj(arr) = arr else { + return Ok(Vec::new()); + }; + if self.enter_generator(g, Resume::Collect(arr), true) { + self.push(Value::Undef); + } + self.run()?; + Ok(match &mut self.heap[arr as usize].kind { + Kind::Array(items) => std::mem::take(items), + _ => Vec::new(), + }) + } + + /// Runs an async generator's body from native code, for a request (`awaited` false) or with the outcome of + /// what it awaited. What the body produces settles its request promises, so only a fatal failure comes back. + pub fn run_async_generator( + &mut self, + g: Id, + kind: u8, + outcome: Result, + awaited: bool, + ) -> Result<(), Value> { + let wants = self.enter_generator_at(g, Resume::Iter, true, !awaited); + let r = match (outcome, awaited) { + (Ok(v), true) => { + self.push(v); + self.run() + } + (Err(e), true) => match self.handle_throw(e) { + Ok(()) => self.run(), + Err(r) => r, + }, + (Ok(v), false) | (Err(v), false) => { + if kind == REQ_NEXT { + if wants { + self.push(v); + } + self.run() + } else { + match self.deliver_abrupt(kind, v) { + Ok(()) => self.run(), + Err(r) => r, + } + } + } + }; + r.map(|_| ()) + } + + // ---------- the run loop ---------- + + #[inline(always)] + pub(crate) fn pop(&mut self) -> Value { + self.stack.pop().unwrap_or_default().get() + } + + #[inline(always)] + pub(crate) fn push(&mut self, v: Value) { + self.stack.push(Slot::pack(v)); + } + + #[inline(always)] + pub(crate) fn top(&self) -> Value { + self.stack.last().copied().unwrap_or_default().get() + } + + /// A template site's strings array, with its read-only `raw` array of the source text. + #[inline(never)] + fn template_object(&mut self, i: usize) -> Value { + if let Some(Some(id)) = self.template_objs.get(i) { + return Value::Obj(*id); + } + let Some(site) = self.templates.get(i) else { + return Value::Undef; + }; + let cooked: Vec = site.cooked.iter().map(|c| c.unwrap_or_default()).collect(); + let raw = site.raw.clone(); + let raw = self.new_array(raw); + let strings = self.new_array(cooked); + if let Value::Obj(id) = strings { + let rk = self.atoms.intern_static("raw"); + self.heap[id as usize].props.push_new(rk, raw, FIXED); + if let Some(slot) = self.template_objs.get_mut(i) { + *slot = Some(id); + } + } + strings + } + + #[inline(never)] + fn make_closure(&mut self, idx: u32) -> Value { + let proto = self.protos[idx as usize].clone(); + let f = self.frames.last().expect("frame"); + let upvals: Arc<[u32]> = proto + .captures + .iter() + .map(|c| match c { + Capture::Cell(i) => self.stack[f.base + *i as usize].0 as u32, + Capture::Upval(i) => f.upvals[*i as usize], + }) + .collect(); + let this = if proto.is_arrow { + self.stack[f.base - 1].get() + } else { + Value::Undef + }; + // An arrow that uses `super` takes its method's home object. + let home = if proto.home { + self.home_of(self.stack[f.base - 2].get()) + } else { + Value::Undef + }; + let fp = match (proto.is_generator, proto.is_async) { + (true, true) => self.realm.async_generator_function_proto, + (true, false) => self.realm.generator_function_proto, + (false, true) => self.realm.async_function_proto, + (false, false) => self.realm.function_proto, + }; + let generator = proto.is_generator.then_some(proto.is_async); + let id = self.alloc(Obj::new( + Some(fp), + Kind::Closure(Box::new(Closure { + proto, + upvals, + this, + home, + fields: Value::Undef, + })), + )); + // A generator function has its own `prototype`, which its generators inherit from. + if let Some(is_async) = generator { + let parent = if is_async { + self.realm.async_generator_proto + } else { + self.realm.generator_proto + }; + let p = self.alloc(Obj::new(Some(parent), Kind::Ordinary)); + let pk = self.names.prototype; + self.heap[id as usize] + .props + .push_new(pk, Value::Obj(p), WRITABLE); + } + Value::Obj(id) + } + + pub fn run(&mut self) -> Result { + let resumable = std::mem::take(&mut self.resumable_run) && self.run_depth == 0; + self.run_depth += 1; + let r = self.run_frames(resumable); + self.run_depth -= 1; + r + } + + /// `run` for a function a built-in calls back: only a driver's run, flagged `resumable_run`, can stop for a + /// suspend, so every other call skips that bookkeeping, which callbacks pay on each call. + #[inline(always)] + fn run_callback(&mut self) -> Result { + if self.resumable_run { + return self.run(); + } + self.run_depth += 1; + let r = self.run_frames(false); + self.run_depth -= 1; + r + } + + /// Continues frames a suspend left on the job stack, as the entry point that started them would have. + pub fn continue_frames(&mut self) -> Result<(), Value> { + if self.frames.is_empty() { + return Ok(()); + } + self.resumable_run = true; + let r = self.run(); + self.resumable_run = false; + r.map(|_| ()) + } + + /// The dispatch loop. `resumable` lets a suspend stop it at a back-edge, leaving its frames for later. + fn run_frames(&mut self, resumable: bool) -> Result { + 'outer: loop { + let fi = self.frames.len() - 1; + if let FrameKind::Native(op, sub) = self.frames[fi].kind { + // A native frame runs its step function, not code: where it is to continue is its `pc`. + let (base, mode) = (self.frames[fi].base, self.frames[fi].pc); + match self.native_op(fi, op, sub, base, mode) { + Ok(None) => continue 'outer, + Ok(Some(v)) => return Ok(Exit::Return(v)), + Err(e) => { + self.locate_native(&e, fi); + match self.handle_throw(e) { + Ok(()) => continue 'outer, + Err(r) => return r, + } + } + } + } + let func = self.frames[fi].func.clone(); + let code: &[Op] = &func.code; + let base = self.frames[fi].base; + let mut pc = self.frames[fi].pc; + + macro_rules! throw { + ($e:expr) => {{ + let e = $e; + self.frames[fi].pc = pc; + self.locate(&e, &func, pc); + match self.handle_throw(e) { + Ok(()) => continue 'outer, + Err(r) => return r, + } + }}; + } + macro_rules! tri { + ($e:expr) => { + match $e { + Ok(v) => v, + Err(e) => throw!(e), + } + }; + } + // An iterator whose step failed is not closed afterwards, so forget it before throwing. + macro_rules! step { + ($slot:expr, $e:expr) => { + match $e { + Ok(v) => v, + Err(e) => { + self.stack[base + $slot as usize] = Slot::UNDEF; + throw!(e) + } + } + }; + } + // An operation whose operand converts by calling the program runs in a convert frame (see + // `conversion.rs`), which hands its result back as the instruction would. + macro_rules! conv_op { + ($code:expr, $a:expr, $b:expr, $c:expr, $x:expr, $y:expr) => {{ + self.frames[fi].pc = pc; + tri!(self.convert_op($code, $a, $b, $c, $x, $y)); + continue 'outer; + }}; + } + // An operation's slow path, out of line (`Vm::slow_op`): its result, or the convert frame it pushed. + macro_rules! slow { + ($code:expr, $a:expr, $b:expr, $x:expr, $y:expr) => {{ + self.frames[fi].pc = pc; + match self.slow_op($code, $a, $b, $x, $y) { + Ok(Some(v)) => v, + Ok(None) => continue 'outer, + Err(e) => throw!(e), + } + }}; + } + macro_rules! num_op { + ($code:expr, $f:expr) => {{ + let f: fn(f64, f64) -> f64 = $f; + let n = self.stack.len(); + let (a, b) = (self.stack[n - 2], self.stack[n - 1]); + if a.is_num() && b.is_num() { + self.stack[n - 2] = Slot::num(f(a.f(), b.f())); + self.stack.pop(); + } else { + let b = self.pop(); + let a = self.pop(); + let r = slow!($code, a, b, 0, 0); + self.push(r); + } + }}; + } + macro_rules! int_op { + ($code:expr) => {{ + let b = self.pop(); + let a = self.pop(); + let r = slow!($code, a, b, 0, 0); + self.push(r); + }}; + } + macro_rules! cmp_op { + ($code:expr, $op:tt) => {{ + let n = self.stack.len(); + let (a, b) = (self.stack[n - 2], self.stack[n - 1]); + if a.is_num() && b.is_num() { + let r = a.f() $op b.f(); + self.stack.pop(); + self.stack[n - 2] = Slot::pack(Value::Bool(r)); + continue; + } + let b = self.pop(); + let a = self.pop(); + let r = slow!($code, a, b, 0, 0); + self.push(r); + }}; + } + + loop { + let op = code[pc]; + pc += 1; + match op { + Op::Nop => {} + Op::Pop => { + self.stack.pop(); + } + Op::Dup => { + let v = self.stack.last().copied().unwrap_or_default(); + if v.is_str() { + self.atoms.bufs[v.payload() as usize].builder = false; + } + self.stack.push(v); + } + Op::Dup2 => { + let n = self.stack.len(); + let (a, b) = (self.stack[n - 2], self.stack[n - 1]); + self.stack.push(a); + self.stack.push(b); + } + Op::Swap => { + let n = self.stack.len(); + self.stack.swap(n - 1, n - 2); + } + Op::Rot3 => { + let c = self.stack.pop().unwrap_or_default(); + let n = self.stack.len(); + self.stack.insert(n - 2, c); + } + Op::Rot3Back => { + let n = self.stack.len(); + let a = self.stack.remove(n - 3); + self.stack.push(a); + } + Op::Undef => self.stack.push(Slot::UNDEF), + Op::Null => self.push(Value::Null), + Op::True => self.push(Value::Bool(true)), + Op::False => self.push(Value::Bool(false)), + Op::Uninit => self.stack.push(Slot::UNINIT), + Op::Int(i) => self.stack.push(Slot::num(i as f64)), + Op::Const(i) => { + let v = self.consts[i as usize]; + self.push(v); + } + Op::GetLocal(i) => { + let v = self.stack[base + i as usize]; + if v.is_str() { + self.atoms.bufs[v.payload() as usize].builder = false; + } + self.stack.push(v); + } + Op::GetLocal2(a, b) => { + for i in [a, b] { + let v = self.stack[base + i as usize]; + if v.is_str() { + self.atoms.bufs[v.payload() as usize].builder = false; + } + self.stack.push(v); + } + } + Op::ArithI(op, k) => { + let n = self.stack.len(); + let a = self.stack[n - 1]; + let y = k as f64; + if a.is_num() { + let x = a.f(); + self.stack[n - 1] = match op { + Arith::Add => Slot::num(x + y), + Arith::Sub => Slot::num(x - y), + Arith::Mul => Slot::num(x * y), + Arith::Div => Slot::num(x / y), + Arith::Mod => Slot::num(js_rem(x, y)), + Arith::Lt => Slot::pack(Value::Bool(x < y)), + Arith::Le => Slot::pack(Value::Bool(x <= y)), + Arith::Gt => Slot::pack(Value::Bool(x > y)), + Arith::Ge => Slot::pack(Value::Bool(x >= y)), + Arith::StrictEq => Slot::pack(Value::Bool(x == y)), + Arith::StrictNe => Slot::pack(Value::Bool(x != y)), + }; + } else { + self.stack.pop(); + let ac = crate::conversion::arith_code(op); + let r = slow!(code::ARITH, a.get(), Value::Num(y), ac, 0); + self.push(r); + } + } + Op::SetLocal(i) => { + let v = self.stack.pop().unwrap_or_default(); + self.stack[base + i as usize] = v; + } + Op::GetLocalChk(i, name) => { + let v = self.stack[base + i as usize]; + if v == Slot::UNINIT { + throw!(self.tdz_error(name)); + } + if v.is_str() { + self.atoms.bufs[v.payload() as usize].builder = false; + } + self.stack.push(v); + } + Op::NewCell(i) => { + let c = self.new_cell(); + self.stack[base + i as usize] = Slot(c); + } + Op::GetCell(i) => { + let c = self.stack[base + i as usize].0 as usize; + let v = self.cells.get(c).copied().unwrap_or(Slot::UNINIT); + self.stack.push(v); + } + Op::GetCellChk(i, name) => { + let c = self.stack[base + i as usize].0 as usize; + let v = self.cells.get(c).copied().unwrap_or(Slot::UNINIT); + if v == Slot::UNINIT { + throw!(self.tdz_error(name)); + } + self.stack.push(v); + } + Op::SetCell(i) => { + let v = self.stack.pop().unwrap_or_default(); + let c = self.stack[base + i as usize].0 as usize; + if self.heap.marking { + self.gc_cell_write(c); + } + if let Some(cell) = self.cells.get_mut(c) { + *cell = v; + } + } + Op::GetUpval(i) => { + let c = self.frames[fi].upvals[i as usize]; + let v = self.cells[c as usize]; + self.stack.push(v); + } + Op::GetUpvalChk(i, name) => { + let c = self.frames[fi].upvals[i as usize]; + let v = self.cells[c as usize]; + if v == Slot::UNINIT { + throw!(self.tdz_error(name)); + } + self.stack.push(v); + } + Op::SetUpval(i) => { + let v = self.stack.pop().unwrap_or_default(); + let c = self.frames[fi].upvals[i as usize]; + if self.heap.marking { + self.gc_cell_write(c as usize); + } + self.cells[c as usize] = v; + } + Op::GetGlobal(g) => { + let v = self.globals[g as usize]; + if let Value::Uninit = v { + let name = self.protos_global_name(g); + throw!(self.reference_error(&format!("Unknown identifier '{name}'."))); + } + self.push(v); + } + Op::TypeofGlobal(g) => { + let v = self.globals[g as usize]; + let t = if let Value::Uninit = v { + "undefined" + } else { + self.type_of(&v) + }; + let t = self.static_str(t); + self.push(t); + } + Op::ThrowConst(name) => { + let n = self.atoms.text(name).to_owned(); + throw!(self.type_error(&format!("Cannot assign to constant '{n}'."))); + } + Op::ThrowRef(name) => { + let n = self.atoms.text(name).to_owned(); + throw!(self.reference_error(&format!("Unknown identifier '{n}'."))); + } + Op::ThrowType(msg) => { + let m = match self.consts[msg as usize] { + Value::Str(s) => self.text(s).to_owned(), + _ => String::new(), + }; + throw!(self.type_error(&m)); + } + Op::ThrowReference(msg) => { + let m = match self.consts[msg as usize] { + Value::Str(s) => self.text(s).to_owned(), + _ => String::new(), + }; + throw!(self.reference_error(&m)); + } + Op::ThrowUnsupported(kind) => { + let kind = match self.consts[kind as usize] { + Value::Str(s) => self.text(s).to_owned(), + _ => String::new(), + }; + throw!(self.unsupported_syntax(&kind)); + } + Op::ThrowSyntax(msg) => { + let m = match self.consts[msg as usize] { + Value::Str(s) => self.text(s).to_owned(), + _ => String::new(), + }; + throw!(self.syntax_error(&m)); + } + Op::This => { + let v = self.stack[base - 1].get(); + self.push(v); + } + Op::Callee => { + let v = self.stack[base - 2].get(); + self.push(v); + } + Op::Arguments => { + let f = &self.frames[fi]; + let n = (f.argc as usize).min(func.nparams as usize); + let mut items: Vec = + self.stack[base..base + n].iter().map(|s| s.get()).collect(); + for v in &items { + if let Value::Str(id) = v { + self.atoms.bufs[*id as usize].builder = false; + } + } + items.extend(f.extra.iter().cloned()); + let proto = self.realm.object_proto; + let len = Value::Num(items.len() as f64); + let id = self.alloc(Obj::new(Some(proto), Kind::Arguments(items))); + let lk = self.names.length; + self.define_hidden(id, lk, len); + let values = Value::Obj(self.realm.arguments_values); + self.define_hidden(id, SYM_ITERATOR, values); + self.push(Value::Obj(id)); + } + Op::Rest(_) => { + let extra = self.frames[fi].extra.to_vec(); + let a = self.new_array(extra); + self.push(a); + } + + Op::GetProp(a) => { + let o = self.pop(); + match tri!(self.op_read(&o, a)) { + Read::Value(v) => self.push(v), + Read::Getter(g) => { + self.frames[fi].pc = pc; + if tri!(self.enter_getter(g, o)) { + continue 'outer; + } + } + } + } + Op::GetPropW(a) => { + let o = self.pop(); + if self.write_checked(&o) { + tri!(self.check_writable(&o, a)); + } + match tri!(self.op_read(&o, a)) { + Read::Value(v) => self.push(v), + Read::Getter(g) => { + self.frames[fi].pc = pc; + if tri!(self.enter_getter(g, o)) { + continue 'outer; + } + } + } + } + Op::WriteKey => { + let n = self.stack.len(); + let (o, k) = (self.stack[n - 2].get(), self.stack[n - 1].get()); + if self.write_checked(&o) + || !matches!(k, Value::Num(_) | Value::Str(_) | Value::Sym(_)) + { + self.frames[fi].pc = pc; + if !o.is_nullish() + && matches!(k, Value::Obj(_)) + && self.operand_calls(&k) + { + self.stack.pop(); + conv_op!(code::WRITE_KEY, k, o, Value::Undef, 0, 0); + } + let key = tri!(self.write_key(&o, &k)); + self.stack.pop(); + self.push(key); + } + } + Op::DestructProp(a) => { + let o = self.pop(); + self.op_access = true; + let r = self.get_destructured(&o, a); + self.op_access = false; + let v = tri!(r); + match self.getter_hit.take() { + None => self.push(v), + Some(g) => { + self.frames[fi].pc = pc; + if tri!(self.enter_getter(g, o)) { + continue 'outer; + } + } + } + } + Op::DestructElem => { + let k = self.pop(); + let o = self.pop(); + self.op_access = true; + let r = self.get_elem_destructured(&o, &k); + self.op_access = false; + let v = tri!(r); + match self.getter_hit.take() { + None => self.push(v), + Some(g) => { + self.frames[fi].pc = pc; + if tri!(self.enter_getter(g, o)) { + continue 'outer; + } + } + } + } + Op::SetProp(a) => { + let v = self.pop(); + let o = self.pop(); + tri!(self.check_assignment_at(&o, a, &v)); + if let Some(s) = tri!(self.op_write(&o, a, v)) { + self.frames[fi].pc = pc; + tri!(self.enter_setter(s, o, v)); + continue 'outer; + } + self.push(v); + } + Op::GetElem => { + let k = self.pop(); + let o = self.pop(); + if matches!(k, Value::Obj(_)) && self.operand_calls(&k) { + conv_op!(code::GET_ELEM, o, k, Value::Undef, 0, 0); + } + match tri!(self.op_read_elem(&o, &k)) { + Read::Value(v) => self.push(v), + Read::Getter(g) => { + self.frames[fi].pc = pc; + if tri!(self.enter_getter(g, o)) { + continue 'outer; + } + } + } + } + Op::SetElem => { + let v = self.pop(); + let k = self.pop(); + let o = self.pop(); + if matches!(k, Value::Obj(_)) && self.operand_calls(&k) { + conv_op!(code::SET_ELEM, o, k, v, 0, 0); + } + if matches!(v, Value::Obj(_)) && matches!(o, Value::Obj(_)) { + let a = tri!(self.key_of(&k)); + tri!(self.check_assignment_at(&o, a, &v)); + } + if let Some(s) = tri!(self.op_write_elem(&o, &k, v)) { + self.frames[fi].pc = pc; + tri!(self.enter_setter(s, o, v)); + continue 'outer; + } + self.push(v); + } + Op::GetMethod(a) => { + let o = self.pop(); + match tri!(self.op_read(&o, a)) { + Read::Value(f) => { + self.push(f); + self.push(o); + } + Read::Getter(g) => { + self.frames[fi].pc = pc; + tri!(self.enter_getter_method(g, o)); + continue 'outer; + } + } + } + Op::DelProp(a) => { + let o = self.pop(); + let r = tri!(self.delete(&o, a)); + self.push(Value::Bool(r)); + } + Op::DelElem => { + let k = self.pop(); + let o = self.pop(); + if matches!(k, Value::Obj(_)) && self.operand_calls(&k) { + conv_op!(code::DEL_ELEM, o, k, Value::Undef, 0, 0); + } + // A namespace path takes only string names, as when it is read. + if !matches!(k, Value::Str(_)) + && matches!(o, Value::Obj(id) if matches!(self.heap[id as usize].kind, Kind::Namespace(_))) + { + throw!(self.namespace_key_error(o.as_obj().unwrap_or(0))); + } + let a = tri!(self.key_of(&k)); + let r = tri!(self.delete(&o, a)); + self.push(Value::Bool(r)); + } + Op::In => { + let o = self.pop(); + let k = self.pop(); + if matches!(k, Value::Obj(_)) && self.in_key_calls(&o, &k) { + conv_op!(code::IN, o, k, Value::Undef, 0, 0); + } + let r = tri!(self.has_property(&o, &k)); + self.push(Value::Bool(r)); + } + Op::InstanceOf => { + let c = self.pop(); + let v = self.pop(); + let r = tri!(self.instance_of(&v, &c)); + self.push(Value::Bool(r)); + } + Op::DefineAccessor(a, setter) => { + let f = self.pop(); + if let Value::Obj(id) = self.top() { + self.define_accessor_half(id, a, setter, f, true); + } + } + Op::DefineAccessorElem(setter) => { + let f = self.pop(); + let k = self.pop(); + let a = tri!(self.key_of(&k)); + // A computed key names the function when the literal runs: `get x`, `set [Symbol.iterator]`. + if let Value::Obj(fid) = f { + let shown = match a { + SYM_ITERATOR => "[Symbol.iterator]".to_owned(), + SYM_ASYNC_ITERATOR => "[Symbol.asyncIterator]".to_owned(), + _ => self.key_text(a), + }; + let name = format!("{} {shown}", if setter { "set" } else { "get" }); + let nv = self.str_val(&name); + let nk = self.names.name; + self.heap[fid as usize].props.insert(nk, nv, 0); + } + if let Value::Obj(id) = self.top() { + self.define_accessor_half(id, a, setter, f, true); + } + } + Op::NameByKey(mode) => tri!(self.name_by_key(mode)), + Op::Class(derived) => tri!(self.class_op(derived)), + Op::DefineMethod(a, flags) => tri!(self.define_method(a, flags)), + Op::SetFields => self.set_fields(), + Op::InitFields => { + self.frames[fi].pc = pc; + let callee = self.stack[base - 2].get(); + if tri!(self.init_fields(callee)) { + continue 'outer; + } + } + Op::InitStatic => { + self.frames[fi].pc = pc; + if tri!(self.init_static()) { + continue 'outer; + } + } + Op::SuperCall(argc, nt) => { + self.frames[fi].pc = pc; + if tri!(self.super_call(base, argc, nt)) { + continue 'outer; + } + } + Op::SuperBind => tri!(self.super_bind()), + Op::GetSuper(a, flags) => { + if let Some((g, this)) = tri!(self.get_super(a, flags)) { + self.frames[fi].pc = pc; + if flags & 1 != 0 { + tri!(self.enter_getter_method(g, this)); + continue 'outer; + } + if tri!(self.enter_getter(g, this)) { + continue 'outer; + } + } + } + Op::PutSuper(a, flags) => { + if let Some((s, this, v)) = tri!(self.put_super(a, flags)) { + self.frames[fi].pc = pc; + tri!(self.enter_setter(s, this, v)); + continue 'outer; + } + } + Op::SetHome(depth) => { + let n = self.stack.len(); + let (f, home) = ( + self.stack[n - 1].get(), + self.stack[n - 1 - depth as usize].get(), + ); + if let Value::Obj(fid) = f + && let Kind::Closure(c) = &mut self.heap[fid as usize].kind + { + c.home = home; + } + } + Op::Home => { + let h = self.home_of(self.stack[base - 2].get()); + self.push(h); + } + Op::CtorReturn(derived) => tri!(self.ctor_return(derived)), + Op::DefineClassField(a, computed) => tri!(self.define_class_field(a, computed)), + Op::DefineField(a) => { + let v = self.pop(); + if let Value::Obj(id) = self.top() { + self.define(id, a, v); + } + } + Op::DefineElem => { + let v = self.pop(); + let k = self.pop(); + if matches!(k, Value::Obj(_)) && self.operand_calls(&k) { + conv_op!(code::DEFINE_ELEM, k, v, Value::Undef, 0, 0); + } + let a = tri!(self.key_of(&k)); + if let Value::Obj(id) = self.top() { + self.define(id, a, v); + } + } + Op::NewObject => { + let id = self.new_object(); + self.push(Value::Obj(id)); + } + Op::NewArray(n) => { + let items = self + .stack + .drain(self.stack.len() - n as usize..) + .map(Slot::get) + .collect(); + let a = self.new_array(items); + self.push(a); + } + Op::ArrayPush => { + let v = self.pop(); + if let Value::Obj(id) = self.top() + && let Kind::Array(items) = &mut self.heap[id as usize].kind + { + items.push(v); + } + } + Op::ArraySpread => { + let top = self.stack.last().copied().unwrap_or_default(); + if let Some(g) = self.suspended_generator(top) { + self.stack.pop(); + self.frames[fi].pc = pc; + let arr = self.top().as_obj().unwrap_or(0); + // The reference opens a generator with a call of its `Symbol.iterator`. + self.spend(NATIVE_FUEL); + if self.enter_generator(g, Resume::Collect(arr), false) { + self.stack.push(Slot::UNDEF); + } + continue 'outer; + } + let src = self.pop(); + if !self.is_iterable(&src) { + throw!(self.not_iterable(&src, crate::bytecode::ITER_SPREAD)); + } + let open = self.open_fuel(&src, crate::bytecode::ITER_SPREAD); + self.spend(open); + if let Some(r) = self.spread_by_call(src) { + self.frames[fi].pc = pc; + tri!(r); + self.entered = false; + continue 'outer; + } + let items = tri!(self.iterate_to_vec(&src)); + if let Value::Obj(id) = self.top() + && let Kind::Array(arr) = &mut self.heap[id as usize].kind + { + arr.extend(items); + } + } + Op::ObjectSpread => { + let src = self.pop(); + if let Value::Obj(id) = self.top() { + tri!(self.spread_props(id, &src)); + } + } + Op::ObjRest(n) => { + let keys: Vec = self + .stack + .drain(self.stack.len() - n as usize..) + .map(Slot::get) + .collect(); + let src = self.pop(); + let mut excluded = Vec::with_capacity(keys.len()); + for k in &keys { + excluded.push(tri!(self.key_of(k))); + } + let id = self.new_object(); + tri!(self.rest_props(id, &src, &excluded)); + self.push(Value::Obj(id)); + } + Op::ToKey => { + let k = self.top(); + if !matches!(k, Value::Num(_) | Value::Str(_) | Value::Sym(_)) { + self.frames[fi].pc = pc; + if self.operand_calls(&k) { + self.stack.pop(); + conv_op!(code::TO_KEY, k, Value::Undef, Value::Undef, 0, 0); + } + let a = tri!(self.key_of(&k)); + self.stack.pop(); + let v = if a <= SYM_ASYNC_ITERATOR { + Value::Sym(a) + } else { + self.atom_val(a) + }; + self.push(v); + } + } + Op::RequireCoercible => { + let v = self.top(); + if v.is_nullish() { + let t = if let Value::Null = v { + "null" + } else { + "undefined" + }; + throw!( + self.type_error(&format!("Cannot destructure {t} as it is {t}.")) + ); + } + } + + Op::Add => { + let n = self.stack.len(); + let (a, b) = (self.stack[n - 2], self.stack[n - 1]); + if a.is_num() && b.is_num() { + self.stack[n - 2] = Slot::num(a.f() + b.f()); + self.stack.pop(); + continue; + } + let b = self.pop(); + let a = self.pop(); + let r = match (&a, &b) { + (Value::Num(x), Value::Num(y)) => Value::Num(x + y), + (Value::Obj(_), _) | (_, Value::Obj(_)) => slow!(code::ADD, a, b, 0, 0), + _ => tri!(self.add(a, b)), + }; + self.push(r); + } + Op::Sub => num_op!(code::SUB, |x, y| x - y), + Op::Mul => num_op!(code::MUL, |x, y| x * y), + Op::Div => num_op!(code::DIV, |x, y| x / y), + Op::Mod => num_op!(code::MOD, js_rem), + Op::Pow => num_op!(code::POW, js_pow), + Op::BitAnd => int_op!(code::BIT_AND), + Op::BitOr => int_op!(code::BIT_OR), + Op::BitXor => int_op!(code::BIT_XOR), + Op::Shl => int_op!(code::SHL), + Op::Shr => int_op!(code::SHR), + Op::UShr => int_op!(code::USHR), + Op::Eq => { + let b = self.pop(); + let a = self.pop(); + let r = slow!(code::EQ, a, b, 0, 0); + self.push(r); + } + Op::Ne => { + let b = self.pop(); + let a = self.pop(); + let r = slow!(code::NE, a, b, 0, 0); + self.push(r); + } + Op::StrictEq => { + let b = self.pop(); + let a = self.pop(); + let r = self.strict_eq(&a, &b); + self.push(Value::Bool(r)); + } + Op::StrictNe => { + let b = self.pop(); + let a = self.pop(); + let r = !self.strict_eq(&a, &b); + self.push(Value::Bool(r)); + } + Op::Lt => cmp_op!(code::LT, <), + Op::Gt => cmp_op!(code::GT, >), + Op::Le => cmp_op!(code::LE, <=), + Op::Ge => cmp_op!(code::GE, >=), + Op::Neg => { + let a = self.pop(); + if self.operand_calls(&a) { + conv_op!(code::NEG, a, Value::Undef, Value::Undef, 0, 0); + } + tri!(self.data_operand(&a, "Unary operators require data values.")); + let x = match a { + Value::Num(x) => x, + _ => tri!(self.number_of(&a)), + }; + self.push(Value::Num(-x)); + } + Op::ToNumber | Op::ToNumeric => { + let a = self.pop(); + if self.operand_calls(&a) { + let which = match (op, code.get(pc..pc + 3)) { + (Op::ToNumeric, Some(next)) if next.contains(&Op::Dec) => 1, + (Op::ToNumeric, _) => 0, + _ => 2, + }; + conv_op!(code::TO_NUMBER, a, Value::Undef, Value::Undef, which, 0); + } + if self.is_opaque_operand(&a) { + let msg = match (op, code.get(pc..pc + 3)) { + (Op::ToNumeric, Some(next)) if next.contains(&Op::Dec) => { + "'--' requires a data value." + } + (Op::ToNumeric, _) => "'++' requires a data value.", + _ => "Unary operators require data values.", + }; + throw!(self.invalid_data(msg)); + } + let x = match a { + Value::Num(x) => x, + _ => tri!(self.number_of(&a)), + }; + self.push(Value::Num(x)); + } + Op::Not => { + let a = self.pop(); + self.push(Value::Bool(!self.truthy(&a))); + } + Op::BitNot => { + let a = self.pop(); + if self.operand_calls(&a) { + conv_op!(code::BIT_NOT, a, Value::Undef, Value::Undef, 0, 0); + } + tri!(self.data_operand(&a, "Unary operators require data values.")); + let x = tri!(self.number_of(&a)); + self.push(Value::Num(!to_i32(x) as f64)); + } + Op::RegExp => { + let flags = self.pop(); + let pattern = self.pop(); + let (Value::Str(p), Value::Str(f)) = (pattern, flags) else { + continue; + }; + let (p, f) = (self.text(p).to_owned(), self.text(f).to_owned()); + let r = tri!(crate::builtins::regexp::new_regexp(self, &p, &f)); + self.push(r); + } + Op::Typeof => { + let a = self.pop(); + let t = self.type_of(&a); + let t = self.static_str(t); + self.push(t); + } + Op::Inc | Op::Dec => { + let a = self.pop(); + if self.operand_calls(&a) { + let c = if matches!(op, Op::Inc) { + code::INC + } else { + code::DEC + }; + conv_op!(c, a, Value::Undef, Value::Undef, 0, 0); + } + let msg = if matches!(op, Op::Inc) { + "'++' requires a data value." + } else { + "'--' requires a data value." + }; + tri!(self.data_operand(&a, msg)); + let x = match a { + Value::Num(x) => x, + _ => tri!(self.number_of(&a)), + }; + self.push(Value::Num(if matches!(op, Op::Inc) { + x + 1.0 + } else { + x - 1.0 + })); + } + Op::ToStr => { + let a = self.pop(); + if self.operand_calls(&a) { + conv_op!(code::TO_STR, a, Value::Undef, Value::Undef, 0, 0); + } + let s = match a { + Value::Str(_) => a, + _ => Value::Str(tri!(self.string_of(&a))), + }; + self.push(s); + } + Op::Concat(n) => { + let start = self.stack.len() - n as usize; + let mut parts = std::mem::take(&mut self.concat_parts); + parts.extend( + self.stack[start..] + .iter() + .filter(|p| p.is_str()) + .map(|p| p.payload()), + ); + self.stack.truncate(start); + let len: usize = parts.iter().map(|p| self.atoms.get(*p).len()).sum(); + let v = + (len <= crate::ops::MAX_STRING_LEN).then(|| self.concat_strs(&parts)); + parts.clear(); + self.concat_parts = parts; + let Some(v) = v else { + throw!(self.range_error("Invalid string length")); + }; + self.push(v); + } + Op::Template(i) => { + let t = self.template_object(i as usize); + self.push(t); + } + Op::AddLocal(i) => { + let b = self.pop(); + let slot = base + i as usize; + let a = self.stack[slot].get(); + let r = match (a, b) { + (Value::Num(x), Value::Num(y)) => Value::Num(x + y), + (Value::Str(sa), Value::Str(sb)) + if sa != sb && self.atoms.bufs[sa as usize].builder => + { + let added = self.atoms.get(sb).len(); + if self.atoms.get(sa).len() + added > crate::ops::MAX_STRING_LEN { + throw!(self.range_error("Invalid string length")); + } + self.atoms.push_in_place(sa, sb); + a + } + (a, b) => { + let r = slow!(code::ADD_LOCAL, a, b, i, 0); + if let Value::Str(id) = r { + self.atoms.bufs[id as usize].builder = true; + } + r + } + }; + self.stack[slot] = Slot::pack(r); + } + Op::IncLocal(i) => { + let slot = base + i as usize; + let v = self.stack[slot]; + if v.is_num() { + self.stack[slot] = Slot::num(v.f() + 1.0); + } else { + let r = slow!(code::INC_LOCAL, v.get(), Value::Undef, i, 0); + self.stack[slot] = Slot::pack(r); + } + } + + Op::Jump(t) => { + if (t as usize) < pc { + tri!(self.tick()); + if self.suspend_wanted && resumable && !self.gc_point() { + self.frames[fi].pc = t as usize; + self.suspended = true; + return Ok(Exit::Suspend); + } + } + pc = t as usize; + } + Op::JumpIfFalse(t) => { + let v = self.pop(); + let jump = match v { + Value::Bool(b) => !b, + v => !self.truthy(&v), + }; + if jump { + pc = t as usize; + } + } + Op::JumpUnless(cmp, t) => { + let n = self.stack.len(); + let (a, b) = (self.stack[n - 2], self.stack[n - 1]); + self.stack.truncate(n - 2); + let r = if a.is_num() && b.is_num() { + compare(cmp, a.f(), b.f()) + } else { + let ac = crate::conversion::arith_code(cmp); + let r = slow!(code::JUMP_UNLESS, a.get(), b.get(), ac, t); + self.truthy(&r) + }; + if !r { + pc = t as usize; + } + } + Op::JumpUnlessI(cmp, k, t) => { + let a = self.stack.pop().unwrap_or_default(); + let r = if a.is_num() { + compare(cmp, a.f(), k as f64) + } else { + let ac = crate::conversion::arith_code(cmp); + let r = slow!(code::JUMP_UNLESS, a.get(), Value::Num(k as f64), ac, t); + self.truthy(&r) + }; + if !r { + pc = t as usize; + } + } + Op::JumpIfTrue(t) => { + let v = self.pop(); + if self.truthy(&v) { + if (t as usize) < pc { + tri!(self.tick()); + if self.suspend_wanted && resumable && !self.gc_point() { + self.frames[fi].pc = t as usize; + self.suspended = true; + return Ok(Exit::Suspend); + } + } + pc = t as usize; + } + } + Op::JumpIfFalseKeep(t) => { + let v = self.top(); + if !self.truthy(&v) { + pc = t as usize; + } else { + self.stack.pop(); + } + } + Op::JumpIfTrueKeep(t) => { + let v = self.top(); + if self.truthy(&v) { + pc = t as usize; + } else { + self.stack.pop(); + } + } + Op::JumpIfNotNullishKeep(t) => { + if !self.top().is_nullish() { + pc = t as usize; + } else { + self.stack.pop(); + } + } + Op::JumpIfNotUndef(t) => { + if self.stack.last() != Some(&Slot::UNDEF) { + pc = t as usize; + } + } + Op::OptChain(t) => { + if self.top().is_nullish() { + self.stack.pop(); + self.push(Value::Undef); + pc = t as usize; + } + } + Op::OptCall(t) => { + let n = self.stack.len(); + if self.stack[n - 2].get().is_nullish() { + self.stack.truncate(n - 2); + self.push(Value::Undef); + pc = t as usize; + } + } + + Op::Closure(idx) => { + let c = self.make_closure(idx); + self.push(c); + } + Op::Call(argc) => { + self.frames[fi].pc = pc; + if tri!(self.call_op(argc as usize)) { + if self.park + && let Some(result) = self.parked() + { + return Ok(Exit::Return(Slot::pack(result))); + } + continue 'outer; + } + } + Op::CallSpread => { + self.frames[fi].pc = pc; + let arr = self.pop(); + let args = match &arr { + Value::Obj(id) => match &self.heap[*id as usize].kind { + Kind::Array(items) => crate::ops::without_holes(items), + _ => Vec::new(), + }, + _ => Vec::new(), + }; + let argc = args.len(); + self.stack.extend(args.into_iter().map(Slot::pack)); + if tri!(self.call_op(argc)) { + if self.park + && let Some(result) = self.parked() + { + return Ok(Exit::Return(Slot::pack(result))); + } + continue 'outer; + } + } + Op::New(argc) => { + self.frames[fi].pc = pc; + if tri!(self.construct_op(argc as usize)) { + continue 'outer; + } + } + Op::NewSpread => { + self.frames[fi].pc = pc; + let arr = self.pop(); + let args = match &arr { + Value::Obj(id) => match &self.heap[*id as usize].kind { + Kind::Array(items) => crate::ops::without_holes(items), + _ => Vec::new(), + }, + _ => Vec::new(), + }; + let argc = args.len(); + self.stack.extend(args.into_iter().map(Slot::pack)); + if tri!(self.construct_op(argc)) { + continue 'outer; + } + } + Op::Return => { + let v = self.pop(); + let frame = self.frames.pop().expect("frame"); + self.stack.truncate(frame.base - 2); + self.handlers.truncate(frame.hbase as usize); + let result = match frame.kind { + FrameKind::Normal | FrameKind::Native(..) => v, + FrameKind::Async(c) => match self.coroutines[c as usize].promise { + Some(p) => { + self.resolve_promise(p, v); + Value::Obj(p) + } + None => { + crate::cross::program_result(self, v)?; + if std::mem::take(&mut self.entered) { + // The result's crossing runs in a native frame, as the run's base in + // place of the program's frame. + self.host.meter.bytecode = false; + let is_base = frame.is_base; + self.spare_frames.push(frame); + if let Some(f) = self.frames.last_mut() { + f.is_base = is_base; + } + continue 'outer; + } + Value::Undef + } + }, + FrameKind::Generator(g, resume) => { + self.leave_generator(g, None); + let is_base = frame.is_base; + self.spare_frames.push(frame); + if self.is_async_generator(g) { + self.async_generator_finish(g, Ok(v)); + return Ok(Exit::Return(Slot::pack(Value::Undef))); + } + if is_base { + return Ok(Exit::Return(Slot::pack(v))); + } + self.generator_done(resume, v); + continue 'outer; + } + }; + let is_base = frame.is_base; + self.spare_frames.push(frame); + if is_base { + return Ok(Exit::Return(Slot::pack(result))); + } + self.push(result); + continue 'outer; + } + Op::GeneratorStart => { + let is_async = func.is_async; + let (pk, callee) = (self.names.prototype, self.stack[base - 2].get()); + let proto = match callee { + Value::Obj(c) => self.get_obj(c, pk).as_obj(), + _ => None, + }; + let proto = proto.unwrap_or(if is_async { + self.realm.async_generator_proto + } else { + self.realm.generator_proto + }); + let g = self.alloc(Obj::new(Some(proto), Kind::Generator(GenState::Done))); + self.frames[fi].pc = pc; + let mut frame = self.frames.pop().expect("frame"); + frame.kind = FrameKind::Generator(g, Resume::Iter); + frame.yield_pc = NO_YIELD; + let start = frame.base - 2; + let mut stack = Vec::with_capacity((self.stack.len() - start).max(16)); + stack.extend(self.stack.drain(start..)); + frame.base = 2; + let is_base = frame.is_base; + let state = GenState::Suspended(Box::new(SavedFrame { + frame: Some(frame), + stack, + handlers: Vec::new(), + started: false, + above: Vec::new(), + splits: Vec::new(), + })); + self.heap[g as usize].kind = if is_async { + Kind::AsyncGenerator(Box::new(AsyncGen { + state, + phase: AsyncPhase::Start, + queue: VecDeque::new(), + })) + } else { + Kind::Generator(state) + }; + if is_base { + return Ok(Exit::Return(Slot::pack(Value::Obj(g)))); + } + self.push(Value::Obj(g)); + continue 'outer; + } + Op::Await => { + let v = self.pop(); + let c = match self.frames[fi].kind { + FrameKind::Async(c) => c, + FrameKind::Generator(g, _) if self.is_async_generator(g) => { + // An async generator is always resumed from native code, so `run` returns here. + self.frames[fi].pc = pc; + let frame = self.frames.pop().expect("frame"); + self.leave_generator(g, Some(frame)); + let p = self.promise_resolve(v); + self.perform_then(p, Reaction::AwaitGen(g)); + return Ok(Exit::Return(Slot::pack(Value::Undef))); + } + _ => { + throw!(self.syntax_error("await is only valid in async functions")) + } + }; + let reuse = self.coroutines[c as usize].saved.take(); + let (saved, is_base) = self.save_top_frame(pc, true, reuse); + self.coroutines[c as usize].saved = Some(saved); + self.await_value(v, c); + let result = match self.coroutines[c as usize].promise { + Some(p) => Value::Obj(p), + None => Value::Undef, + }; + if is_base { + return Ok(Exit::Return(Slot::pack(result))); + } + self.push(result); + continue 'outer; + } + Op::Yield(after) | Op::YieldDrop(after) | Op::YieldStar(after) => { + let v = self.pop(); + let FrameKind::Generator(g, resume) = self.frames[fi].kind else { + throw!(self.syntax_error("yield is only valid in generators")); + }; + let pushes = !matches!(op, Op::YieldDrop(_)); + if let Resume::Collect(arr) = resume { + if let Kind::Array(items) = &mut self.heap[arr as usize].kind { + if items.len() >= crate::ops::MAX_ARRAY_LEN { + throw!(self.range_error("Invalid array length.")); + } + items.push(v); + } + if pushes { + self.stack.push(Slot::UNDEF); + } + pc = after as usize; + continue; + } + let at = pc - 1; + self.frames[fi].pc = after as usize; + self.frames[fi].yield_pc = at as u32; + if self.is_async_generator(g) { + // Answer the oldest request, then take the next queued one at once if there is one. + match self.async_generator_yielded(g, v) { + Some((REQ_NEXT, rv)) => { + if pushes { + self.push(rv); + } + pc = after as usize; + } + Some((REQ_RETURN, rv)) => { + self.push(rv); + pc = at + 1; + } + Some((_, rv)) => { + if !matches!(op, Op::YieldStar(_)) { + throw!(rv); + } + self.push(rv); + pc = at + 2; + } + None => { + let frame = self.frames.pop().expect("frame"); + self.leave_generator(g, Some(frame)); + return Ok(Exit::Yield(Slot::pack(v))); + } + } + continue; + } + let frame = self.frames.pop().expect("frame"); + let is_base = frame.is_base; + self.leave_generator(g, Some(frame)); + if is_base { + return Ok(Exit::Yield(Slot::pack(v))); + } + match resume { + Resume::Result => { + let r = self.iter_result(v, false); + self.push(r); + } + Resume::Delegate => { + self.push(v); + if let Some(f) = self.frames.last_mut() { + f.pc += 1; + } + } + _ => self.push(v), + } + continue 'outer; + } + + Op::Throw => { + let v = self.pop(); + throw!(v); + } + Op::PushCatch(t) | Op::PushFinally(t) => { + let sp = (self.stack.len() - base) as u32; + self.handlers.push(Handler { pc: t, sp }); + } + Op::PopTry => { + if self.handlers.len() > self.frames[fi].hbase as usize { + self.handlers.pop(); + } + } + + Op::GetIter(slot, ctx) => { + self.frames[fi].pc = pc; + let v = self.pop(); + if let Some(r) = self.open_by_call(&v, slot, ctx) { + tri!(r); + self.entered = false; + continue 'outer; + } + let (it, next) = tri!(self.open_record(&v, ctx)); + self.stack[base + slot as usize] = Slot::pack(it); + self.stack[base + slot as usize + 1] = Slot::pack(next); + } + Op::IterNext(slot, exit) => { + self.frames[fi].pc = pc; + let it = self.stack[base + slot as usize]; + if let Some(g) = self.suspended_generator(it) { + if self.enter_generator(g, Resume::Iter, false) { + self.stack.push(Slot::UNDEF); + } + continue 'outer; + } + let next = self.stack[base + slot as usize + 1]; + if self.steps_by_call(it, next) { + tri!(self.step_by_call(it, next, slot, Some(exit), false)); + self.entered = false; + continue 'outer; + } + let it = it.get(); + match step!( + slot, + self.iter_step_with(&it, self.stack[base + slot as usize + 1].get()) + ) { + Some(v) => self.push(v), + None => { + self.stack[base + slot as usize] = Slot::UNDEF; + pc = exit as usize; + } + } + } + Op::DelegateCall(slot, flags, missing) => { + self.frames[fi].pc = pc; + let kind = flags & 3; + let received = self.stack.pop().unwrap_or_default(); + let it = self.stack[base + slot as usize]; + // The reference calls the delegated iterator's method each step, a native one for fifty: the + // record's `next` here, a `throw` or `return` where it is found (`sync_delegate_step`, + // `delegate_call`), and nothing when it is missing. + if kind == REQ_NEXT + && !self.calls_closure(&self.stack[base + slot as usize + 1].get()) + { + self.spend(NATIVE_FUEL); + } + if flags & DELEGATE_ASYNC == 0 { + if kind == REQ_NEXT + && let Some(g) = self.suspended_generator(it) + { + if self.enter_generator(g, Resume::Delegate, false) { + self.stack.push(received); + } + continue 'outer; + } + // Iterators the VM runs itself answer with a value and a done flag, not a result object. + if let Some(step) = + tri!(self.sync_delegate_step(it.get(), kind, received.get())) + { + // A generator resumed in a frame hands its answer over itself. + if std::mem::take(&mut self.entered) { + continue 'outer; + } + match step { + Some((v, done)) => { + self.push(v); + pc = match code.get(pc) { + Some(Op::DelegateResult(exit, _)) if done => { + *exit as usize + } + _ => delegate_continue(code, pc + 1), + }; + } + None => { + self.stack.push(received); + pc = missing as usize; + } + } + continue; + } + } + let arg = (flags & DELEGATE_NO_ARG == 0).then(|| received.get()); + let next = self.stack[base + slot as usize + 1].get(); + let r = tri!(self.delegate_call(it.get(), kind, arg, next)); + // A method of the program's runs in a frame, which pushes its result itself. + if std::mem::take(&mut self.entered) { + continue 'outer; + } + match r { + Some(r) => self.push(r), + None => { + self.stack.push(received); + pc = missing as usize; + } + } + } + Op::DelegateResult(exit, kind) => { + let r = self.pop(); + let (v, done) = tri!(self.iter_result_parts(&r, kind)); + self.push(v); + pc = if done { + exit as usize + } else { + delegate_continue(code, pc) + }; + } + Op::GetAsyncIter(slot, ctx) => { + self.frames[fi].pc = pc; + let v = self.pop(); + let it = tri!(self.get_async_iterator(&v, ctx, slot)); + // A method of the program's runs in a frame, which writes the record itself. + if std::mem::take(&mut self.entered) { + continue 'outer; + } + let next = tri!(self.record_next(&it)); + self.stack[base + slot as usize] = Slot::pack(it); + self.stack[base + slot as usize + 1] = Slot::pack(next); + } + Op::AsyncClose(slot, skip) => { + self.frames[fi].pc = pc; + let it = std::mem::take(&mut self.stack[base + slot as usize]).get(); + let r = tri!(self.async_close(it)); + if std::mem::take(&mut self.entered) { + continue 'outer; + } + match r { + Some(r) => self.push(r), + None => pc = skip as usize, + } + } + Op::CheckObject => { + let v = self.top(); + if !matches!(v, Value::Obj(_)) { + throw!(self.type_error("Iterator return() result must be an object.")); + } + } + Op::IterStep(slot) => { + self.frames[fi].pc = pc; + let it = self.stack[base + slot as usize]; + if let Some(g) = self.suspended_generator(it) { + if self.enter_generator(g, Resume::Iter, false) { + self.stack.push(Slot::UNDEF); + } + continue 'outer; + } + let next = self.stack[base + slot as usize + 1]; + if self.steps_by_call(it, next) { + tri!(self.step_by_call(it, next, slot, None, false)); + self.entered = false; + continue 'outer; + } + let it = it.get(); + match step!( + slot, + self.iter_step_with(&it, self.stack[base + slot as usize + 1].get()) + ) { + Some(v) => self.push(v), + None => { + self.stack[base + slot as usize] = Slot::UNDEF; + self.push(Value::Undef); + } + } + } + Op::IterRest(slot) => { + self.frames[fi].pc = pc; + let it = self.stack[base + slot as usize]; + if let Some(g) = self.suspended_generator(it) { + let a = self.new_array(Vec::new()); + self.push(a); + if self.enter_generator( + g, + Resume::Collect(a.as_obj().unwrap_or(0)), + false, + ) { + self.stack.push(Slot::UNDEF); + } + continue 'outer; + } + let next = self.stack[base + slot as usize + 1]; + if self.steps_by_call(it, next) { + tri!(self.step_by_call(it, next, slot, None, true)); + self.entered = false; + continue 'outer; + } + let it = it.get(); + let mut items = Vec::new(); + while let Some(v) = step!( + slot, + self.iter_step_with(&it, self.stack[base + slot as usize + 1].get()) + ) { + items.push(v); + } + self.stack[base + slot as usize] = Slot::UNDEF; + let a = self.new_array(items); + self.push(a); + } + Op::IterClose(slot) | Op::IterCloseQuiet(slot) => { + self.frames[fi].pc = pc; + let it = std::mem::take(&mut self.stack[base + slot as usize]).get(); + if let Some(r) = + self.close_by_call(&it, matches!(op, Op::IterCloseQuiet(_))) + { + tri!(r); + self.entered = false; + continue 'outer; + } + let cost = self.close_fuel(&it); + let r = self.iter_close(&it); + self.spend(cost); + if matches!(op, Op::IterClose(_)) || self.fatal.is_some() { + tri!(r); + } + } + Op::ForIn(slot) => { + let v = self.pop(); + tri!(self.for_in_source(&v)); + let keys = tri!(self.for_in_list(&v)); + let proto = self.realm.iter_proto; + let id = self.alloc(Obj::new( + Some(proto), + Kind::ListIter { + items: keys.into(), + pos: 0, + }, + )); + self.stack[base + slot as usize] = Slot::pack(Value::Obj(id)); + } + } + } + } + } + + fn protos_global_name(&self, g: u32) -> String { + self.global_names + .get(g as usize) + .map(|a| self.atoms.text(*a).to_owned()) + .unwrap_or_default() + } + + #[inline(never)] + fn tdz_error(&mut self, name: Atom) -> Value { + let n = self.atoms.text(name).to_owned(); + // A derived constructor's `this` before `super()` (see `classes.rs`). + if n == "this" { + return self.this_before_super(); + } + self.reference_error(&format!("Cannot access '{n}' before initialization.")) + } + + // ---------- driver ---------- + + /// Runs queued jobs and delivers host results until the program has an outcome. + pub fn drive(&mut self) -> Result<(), Value> { + loop { + if self.outcome.is_some() { + return Ok(()); + } + if self.suspended { + return Ok(()); + } + if (self.suspend_wanted && !self.gc_point()) || self.host.shared.requested() { + self.suspended = true; + return Ok(()); + } + if self.fatal.is_some() { + return Err(Value::Undef); + } + if let Some(job) = self.jobs.pop_front() { + self.tick()?; + self.handover(); + self.run_job(job)?; + continue; + } + if let Some((p, outcome)) = self.inbox.pop_front() { + self.check_time()?; + crate::host::settle(self, p, outcome); + continue; + } + // Nothing left to run: the reference's driver stops, starting the host calls queued so far. + if !self.host.queued.is_empty() { + self.handover(); + continue; + } + if self.host.waiting() { + return Ok(()); + } + let e = self.make_error( + self.realm.error_proto, + "The program is waiting on a promise that can never settle: nothing else is running, so nothing can resolve it.", + ); + self.outcome = Some(Err(e)); + return Ok(()); + } + } +} + +#[inline(always)] +fn compare(op: Arith, x: f64, y: f64) -> bool { + match op { + Arith::Lt => x < y, + Arith::Le => x <= y, + Arith::Gt => x > y, + Arith::Ge => x >= y, + Arith::StrictEq => x == y, + Arith::StrictNe => x != y, + _ => false, + } +} + +#[inline] +fn to_i32(x: f64) -> i32 { + crate::value::to_int32(x) +} + +pub fn js_rem(x: f64, y: f64) -> f64 { + const EXACT: u64 = 1 << 53; + // Integers below 2^53 convert exactly both ways (NaN converts to 0 and fails the check), and their remainder is + // the integer one. + let (a, b) = (x as i64, y as i64); + if a as f64 == x + && b as f64 == y + && b != 0 + && a.unsigned_abs() < EXACT + && b.unsigned_abs() < EXACT + { + let r = (a % b) as f64; + return if r == 0.0 && x.is_sign_negative() { + -0.0 + } else { + r + }; + } + if y == 0.0 || x.is_infinite() || x.is_nan() || y.is_nan() { + return f64::NAN; + } + if y.is_infinite() { + return x; + } + x % y +} + +/// `**` and `Math.pow` as JavaScriptCore computes them: square roots for ±0.5, square-and-multiply for small +/// non-negative integer exponents, and libm otherwise, so results match the reference to the last bit. +pub fn js_pow(x: f64, y: f64) -> f64 { + if y.is_nan() || ((x == 1.0 || x == -1.0) && y.is_infinite()) { + return f64::NAN; + } + let abs = x.abs(); + if y == 0.5 { + return if abs == 0.0 { + 0.0 + } else if abs == f64::INFINITY { + f64::INFINITY + } else { + x.sqrt() + }; + } + if y == -0.5 { + return if abs == 0.0 { + f64::INFINITY + } else if abs == f64::INFINITY { + 0.0 + } else { + 1.0 / x.sqrt() + }; + } + if y.fract() == 0.0 && (0.0..=1000.0).contains(&y) { + let (mut n, mut result, mut base) = (y as u32, 1.0, x); + while n != 0 { + if n & 1 == 1 { + result *= base; + } + base *= base; + n >>= 1; + } + return result; + } + x.powf(y) +} + +/// Where a `yield*` goes on once its iterator answered a `throw` or `return` request without finishing: the jump at +/// `at` back to the `YieldStar`, taken here without the back-edge a backward jump costs, as the reference's `yield*` +/// yields the answer straight away. Any other instruction is where it goes on. +#[inline] +pub(crate) fn delegate_continue(code: &[Op], at: usize) -> usize { + match code.get(at) { + Some(Op::Jump(t)) if matches!(code.get(*t as usize), Some(Op::YieldStar(_))) => *t as usize, + _ => at, + } +} diff --git a/packages/codemode-rust/crates/psychoscript/tests/api.rs b/packages/codemode-rust/crates/psychoscript/tests/api.rs new file mode 100644 index 0000000000000..ad95b42ea5700 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/tests/api.rs @@ -0,0 +1,315 @@ +//! Host-facing behavior the conformance cases do not cover: limits, diagnostics and the data boundary. + +use std::sync::{Arc, Mutex}; + +use psychoscript::{ + DiagnosticKind, HostFunction, HostString, HostValue, Json, Limits, ProgramOptions, Runtime, + Translate, TranslateFunctions, +}; +use serde_json::json; + +fn run(rt: &Runtime, code: &str) -> psychoscript::Outcome { + rt.execute(code) +} + +/// A runtime whose `echo(value)` gives its argument back and keeps what it received; functions in arguments are +/// left out, as `JSON.stringify` does. +fn echo() -> (Runtime, Arc>>) { + let seen = Arc::new(Mutex::new(Vec::new())); + let kept = seen.clone(); + let rt = Runtime::make() + .translate(Translate { + functions: TranslateFunctions::Drop, + ..Translate::default() + }) + .globals(move |_| { + let kept = kept.clone(); + [( + "echo", + HostFunction::new(move |args, _| { + let v = args.into_iter().next().unwrap_or_default(); + kept.lock().unwrap().push(v.clone()); + v + }), + )] + }); + (rt, seen) +} + +#[test] +fn timeout_interrupts_busy_loops() { + let rt = Runtime::make().limits(Limits { + timeout_ms: Some(50), + ..Limits::default() + }); + let outcome = run(&rt, "try { while (true) {} } catch (e) { return 'caught' }"); + assert_eq!( + outcome.result.unwrap_err().kind, + DiagnosticKind::TimeoutExceeded + ); +} + +#[test] +fn output_limit_truncates_result_and_logs() { + let rt = Runtime::make().limits(Limits { + max_output_bytes: Some(40), + ..Limits::default() + }); + let outcome = run( + &rt, + "for (let i = 0; i < 10; i++) console.log('line ' + i); return 'x'.repeat(100)", + ); + assert!(outcome.truncated); + let value = outcome.result.unwrap(); + assert!( + value + .as_string() + .and_then(|s| s.as_str()) + .unwrap() + .contains("[result truncated: 102 bytes") + ); + assert_eq!( + outcome.logs, + vec!["[logs truncated: showing 0 of 10 lines]"] + ); +} + +#[test] +fn host_arguments_and_results_are_copies() { + let (rt, seen) = echo(); + let outcome = run( + &rt, + "const o = { a: 1, f() {}, u: undefined, n: [NaN] }; const r = echo(o); r.a = 2; return [o.a, r, 'u' in r]", + ); + assert_eq!( + outcome.result.unwrap(), + json!([1, { "a": 2, "n": [null] }, true]) + ); + let seen = seen.lock().unwrap()[0].clone(); + assert!(matches!(seen.get("u"), Some(HostValue::Undefined))); + assert!(seen.get("f").is_none()); + assert!( + matches!(seen.get("n"), Some(HostValue::Array(n)) if matches!(n[..], [Some(HostValue::Number(x))] if x.is_nan())) + ); +} + +#[test] +fn unsupported_syntax_has_a_location() { + let d = run( + &Runtime::make(), + "const a = 1\nconst B = class { static {} }", + ) + .result + .unwrap_err(); + assert_eq!(d.kind, DiagnosticKind::UnsupportedSyntax); + assert_eq!(d.location, Some((2, 19))); + // As the reference reports it, with the orientation it also suggests (the streaming recording checks the + // message, not the suggestions). + assert_eq!(d.suggestions.len(), 1); + assert_eq!( + d.message, + "SyntaxError: Class static blocks are not supported. Assign static fields instead. (line 2, col 19)" + ); + // Rethrown, it keeps them. + let again = run( + &Runtime::make(), + "let e; try { class A { static {} } } catch (x) { e = x }\nthrow e", + ) + .result + .unwrap_err(); + assert_eq!(again.kind, DiagnosticKind::UnsupportedSyntax); + assert_eq!(again.location, Some((1, 24))); + assert_eq!(again.suggestions, d.suggestions); +} + +#[test] +fn runtime_errors_report_their_location() { + let d = run(&Runtime::make(), "const x = null\nreturn x.y") + .result + .unwrap_err(); + assert_eq!(d.kind, DiagnosticKind::ExecutionFailure); + assert_eq!(d.location, Some((2, 8))); + assert!( + d.message_lossy() + .starts_with("TypeError: Cannot read properties of null (reading 'y')") + ); +} + +#[test] +fn deep_input_does_not_overflow() { + let rt = Runtime::make(); + let nested = format!("return {}1{}", "(".repeat(1_000), ")".repeat(1_000)); + assert!(run(&rt, &nested).result.is_ok()); + let chain = format!("return {}1", "1+".repeat(100_000)); + assert_eq!( + run(&rt, &chain).result.unwrap_err().kind, + DiagnosticKind::ParseError + ); + let recursion = run(&rt, "const f = (n) => [n].map((x) => f(x + 1)); f(0)") + .result + .unwrap_err(); + assert!( + recursion + .message_lossy() + .contains("Maximum call stack size exceeded") + ); +} + +#[test] +fn every_deep_form_compiles_without_overflow() { + let rt = Runtime::make(); + let forms = [ + ("return ", "!", "1"), + ("return ", "`${", "1}`"), + ("return ", "() => ", "1"), + ("let a = 1; ", "if (a) a = 1; else ", "a = 2; return a"), + ("let a = 1;\n", "if (a)\n", "a = 2; return a"), + ]; + for (head, form, tail) in forms { + let code = format!("{head}{}{tail}", form.repeat(900)); + let code = code.replace("1}`", &format!("1{}", "}`".repeat(900))); + assert!(run(&rt, &code).result.is_ok(), "{form:?}"); + } +} + +#[test] +fn deep_programs_compile_off_a_small_caller_stack() { + let code = format!("return {}1", "!".repeat(1_500)); + let result = std::thread::Builder::new() + .stack_size(1 << 20) + .spawn(move || { + let rt = Runtime::make(); + let program = rt.program(&code, &ProgramOptions::new()); + program.run().unwrap().json() + }) + .unwrap() + .join() + .unwrap(); + assert_eq!(result.unwrap(), json!(true)); +} + +/// Programs nested far past the limit, some disguised from a cheap scan by `/`s that may be regexes or divisions, end +/// with a diagnostic or an outcome. A native stack overflow would abort this test process instead. +#[test] +fn deliberately_deep_programs_end_cleanly() { + let n = 20_000; + let parens = format!("{}1{}", "(".repeat(n), ")".repeat(n)); + let programs = [ + format!("return {parens}"), + format!("return {}1", "!".repeat(n)), + format!("return {}1", "typeof ".repeat(n)), + format!("return {}1{}", "[".repeat(n), "]".repeat(n)), + format!("return {}1{}", "`${".repeat(n), "}`".repeat(n)), + format!("return {}1", "() => ".repeat(n)), + format!("{}{}return 1", "{".repeat(n), "}".repeat(n)), + format!("let a = 1; {}a = 2", "if (a) a = 1; else ".repeat(n / 2)), + format!("let a = 1, g = 1; a++ / {parens} / g"), + format!("let await = 1, g = 1; await / {parens} / g"), + format!("function f(s) {{ if (s) {{}} /}}/.test(s); return {parens} }}"), + format!("// note\u{2028}{parens}"), + format!("return typeof\u{a0}{}1", "typeof\u{a0}".repeat(n)), + ]; + std::thread::Builder::new() + .stack_size(1 << 20) + .spawn(move || { + let rt = Runtime::make(); + for code in &programs { + let outcome = run(&rt, code); + let ended = match &outcome.result { + Ok(_) => true, + Err(d) => d.kind == DiagnosticKind::ParseError, + }; + assert!(ended, "{}: {:?}", &code[..40], outcome.result); + } + }) + .unwrap() + .join() + .unwrap(); +} + +#[test] +fn bindings_are_globals_programs_can_shadow() { + let mut bindings = serde_json::Map::new(); + bindings.insert("n".into(), Json::from(4)); + let outcome = Runtime::make().execute_with( + "const m = n * 2; { const n = 1; return [m, n] }", + &ProgramOptions::new().bindings(bindings), + ); + assert_eq!(outcome.result.unwrap(), json!([8, 1])); +} + +#[test] +fn string_building_does_not_alias() { + let code = "let s = ''; const parts = []; for (let i = 0; i < 3; i++) { s += i; parts.push(s) } return parts"; + assert_eq!( + run(&Runtime::make(), code).result.unwrap(), + json!(["0", "01", "012"]) + ); +} + +/// Rust text can't hold a lone surrogate, so where the reference hands the host and the outcome the surrogate +/// itself, these get U+FFFD; inside the program it stays a surrogate. +#[test] +fn lone_surrogates_reach_the_host_unchanged() { + let (rt, seen) = echo(); + let outcome = run( + &rt, + r#"const h = "\ud83d" + const back = echo({ [h]: h + "x" }) + return [Object.keys(back)[0] === h, back[h] === h + "x", back[h].length, (h + "\ude00").isWellFormed()]"#, + ); + assert_eq!(outcome.result.unwrap(), json!([true, true, 2, true])); + let seen = seen.lock().unwrap()[0].clone(); + let HostValue::Object(fields) = seen else { + panic!("not an object"); + }; + assert_eq!(fields[0].0, HostString::from_utf16(&[0xd83d])); + assert!(!fields[0].0.is_well_formed()); + assert_eq!(fields[0].0.to_string_lossy(), "\u{fffd}"); + assert!( + matches!(&fields[0].1, HostValue::String(s) if s.to_utf16().as_ref() == [0xd83d, u16::from(b'x')]) + ); +} + +#[test] +fn host_text_keeps_the_last_code_point() { + let rt = Runtime::make().globals(|_| { + [( + "max", + HostFunction::new_async(|_, _| async { Ok(HostValue::from("a\u{10ffff}b")) }), + )] + }); + let outcome = run( + &rt, + r#"const s = await max() + return [s, s.length, s.codePointAt(1), s.isWellFormed(), s === "a\u{10ffff}b", JSON.stringify(s).length]"#, + ); + assert_eq!( + outcome.result.unwrap(), + json!(["a\u{10ffff}b", 4, 0x10ffff, true, true, 6]) + ); +} + +#[test] +fn uncaught_lone_surrogates_are_kept_in_diagnostics() { + let outcome = run(&Runtime::make(), r#"throw new TypeError("bad \udc00")"#); + let d = outcome.result.unwrap_err(); + let expected: Vec = "TypeError: bad ".encode_utf16().chain([0xdc00]).collect(); + assert_eq!(d.message, HostString::from_utf16(&expected)); + assert_eq!(d.message_lossy(), "TypeError: bad \u{fffd}"); +} + +#[test] +fn sparse_arrays_visit_only_their_elements() { + // The reference gives these results after walking all 30 million indexes, too slowly for a conformance case. + let outcome = run( + &Runtime::make(), + r#"const a = []; a[30000000] = 2; a[1] = 1 + const b = []; b[30000000] = "z"; b[0] = "a" + return [a.reduce((s, x) => s + x, 0), a.reduceRight((s, x, i) => s + "," + i, ""), a.some((x) => x === 2), a.every((x) => x > 0), [b].flat(), [0].flatMap(() => b)]"#, + ); + assert_eq!( + outcome.result.unwrap(), + json!([3, ",30000000,1", true, true, ["a", "z"], ["a", "z"]]) + ); +} diff --git a/packages/codemode-rust/crates/psychoscript/tests/boundary.rs b/packages/codemode-rust/crates/psychoscript/tests/boundary.rs new file mode 100644 index 0000000000000..2dfb75ad29f6f --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/tests/boundary.rs @@ -0,0 +1,535 @@ +//! Host values crossing into programs and program values crossing out, and runtimes made with different host globals +//! and module names, against the reference's behaviour recorded in `conformance/boundary.json` by +//! `bun conformance/boundary.ts`. The globals are the generator's. + +use std::sync::{Arc, Mutex}; + +use psychoscript::{ + Data, HostError, HostFunction, HostString, HostValue, Json, Limits, Returned, Runtime, + Translate, TranslateFunctions, TranslatePromises, +}; +use serde_json::json; + +#[path = "../../../conformance/reference.rs"] +mod reference; + +use reference::{describe, same}; + +type Log = Arc>>; + +fn fixture() -> Json { + let path = concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../conformance/boundary.json" + ); + serde_json::from_str(&std::fs::read_to_string(path).unwrap()).unwrap() +} + +fn outcome(o: &psychoscript::Outcome) -> Json { + match &o.result { + Ok(value) => json!({ "ok": true, "value": value.to_json() }), + Err(d) => json!({ "ok": false, "kind": d.kind.name(), "message": d.message_lossy() }), + } +} + +fn number(j: &Json) -> f64 { + match j { + Json::String(s) if s == "NaN" => f64::NAN, + Json::String(s) if s == "Infinity" => f64::INFINITY, + Json::String(s) if s == "-Infinity" => f64::NEG_INFINITY, + j => j.as_f64().unwrap_or(f64::NAN), + } +} + +fn pairs(j: &Json) -> Vec<(String, String)> { + j.as_array() + .unwrap() + .iter() + .map(|p| { + ( + p[0].as_str().unwrap().to_owned(), + p[1].as_str().unwrap().to_owned(), + ) + }) + .collect() +} + +fn bytes(j: &Json) -> Vec { + j.as_array() + .unwrap() + .iter() + .map(|b| b.as_u64().unwrap() as u8) + .collect() +} + +/// A string as `describe` writes it: itself, or `{ string: [code units] }`. +fn text_of(j: &Json) -> HostString { + match j { + Json::String(s) => s.into(), + j => HostString::from_utf16( + &j["string"] + .as_array() + .unwrap() + .iter() + .map(|u| u.as_u64().unwrap() as u16) + .collect::>(), + ), + } +} + +/// A host value from the data `describe` writes: the generator's samples, as the host gives them. +fn undescribe(j: &Json) -> HostValue { + let Json::Object(map) = j else { + return HostValue::from_json(j); + }; + let (tag, v) = map.iter().next().unwrap(); + match tag.as_str() { + "undefined" => HostValue::Undefined, + "number" => HostValue::Number(number(v)), + "date" => HostValue::Date(number(v)), + "regexp" => HostValue::RegExp { + source: text_of(&v[0]), + flags: v[1].as_str().unwrap().to_owned(), + }, + "url" => HostValue::Url(v.as_str().unwrap().to_owned()), + "string" => HostValue::String(text_of(j)), + "params" => HostValue::SearchParams(pairs(v)), + "headers" => HostValue::Headers(pairs(v)), + "bytes" | "arrayBuffer" => HostValue::Bytes(bytes(v)), + "buffer" => HostValue::Buffer(bytes(v)), + "map" => HostValue::Map( + v.as_array() + .unwrap() + .iter() + .map(|e| (undescribe(&e[0]), undescribe(&e[1]))) + .collect(), + ), + "set" => HostValue::Set(v.as_array().unwrap().iter().map(undescribe).collect()), + "array" => HostValue::Array( + v.as_array() + .unwrap() + .iter() + .map(|i| (i.get("hole").is_none()).then(|| undescribe(i))) + .collect(), + ), + "error" => { + let mut e = HostError::named(v["name"].as_str().unwrap(), text_of(&v["message"])); + if let Some(cause) = v.get("cause") { + e = e.with_cause(undescribe(cause)); + } + for f in v["fields"].as_array().unwrap() { + e = e.with_field(text_of(&f[0]), undescribe(&f[1])); + } + e.into() + } + "object" => HostValue::Object( + v.as_array() + .unwrap() + .iter() + .map(|f| (text_of(&f[0]), undescribe(&f[1]))) + .collect(), + ), + other => panic!("unknown sample tag {other}"), + } +} + +/// `value.constructor.name` as the host sees it. +fn constructor(v: &HostValue) -> &'static str { + match v { + HostValue::Undefined | HostValue::Null | HostValue::Interrupt => "undefined", + HostValue::Bool(_) => "Boolean", + HostValue::Number(_) => "Number", + HostValue::String(_) => "String", + HostValue::Array(_) => "Array", + HostValue::Object(_) => "Object", + HostValue::Map(_) => "Map", + HostValue::Set(_) => "Set", + HostValue::Function(_) | HostValue::Durable(_) | HostValue::Namespace(_) => "Function", + HostValue::Error(_) | HostValue::Failure(_) => "Error", + HostValue::Date(_) => "Date", + HostValue::RegExp { .. } => "RegExp", + HostValue::Url(_) => "URL", + HostValue::SearchParams(_) => "URLSearchParams", + HostValue::Headers(_) => "Headers", + HostValue::Bytes(_) => "Uint8Array", + HostValue::Buffer(_) => "Buffer", + HostValue::Response(_) => "StreamingResponse", + } +} + +/// The probe runtime: `tools`, `keep`, `make` and `kind`, with functions dropped and promises awaited. +fn probe(samples: &Json, kept: &Log) -> Runtime { + let (samples, kept) = (samples.clone(), kept.clone()); + Runtime::make() + .translate(Translate { + functions: TranslateFunctions::Drop, + promises: TranslatePromises::Await, + }) + .globals(move |_| { + let (samples, kept) = (samples.clone(), kept.clone()); + [ + ("tools", HostValue::from(reference::tools())), + ( + "keep", + HostFunction::new(move |args, _| { + let value = args.into_iter().next().unwrap_or_default(); + kept.lock().unwrap().push(describe(&value)); + value + }) + .takes_functions() + .length(1) + .into(), + ), + ( + "make", + HostFunction::new(move |args, _| { + undescribe(&samples[args[0].as_str().unwrap_or_default()]) + }) + .takes_functions() + .length(1) + .into(), + ), + ( + "kind", + HostFunction::new(|args, _| { + HostValue::from(constructor(args.first().unwrap_or(&HostValue::Undefined))) + }) + .takes_functions() + .length(1) + .into(), + ), + ] + }) +} + +#[test] +fn the_samples_cross_back_as_the_reference_describes_them() { + let fixture = fixture(); + for (name, described) in fixture["boundary"]["samples"].as_object().unwrap() { + let mut expected = described.clone(); + // An `ArrayBuffer` crosses as a `Uint8Array`. + if let Some(b) = expected.get("arrayBuffer").cloned() { + expected = json!({ "bytes": b }); + } + assert!(same(&describe(&undescribe(described)), &expected), "{name}"); + } +} + +#[test] +fn values_crossing_the_boundary_match_the_reference() { + let fixture = fixture(); + let samples = &fixture["boundary"]["samples"]; + let programs = fixture["boundary"]["programs"].as_array().unwrap(); + assert!(programs.len() >= 30); + let mut failures = Vec::new(); + for program in programs { + let kept: Log = Arc::default(); + let rt = probe(samples, &kept); + let code = program["code"].as_str().unwrap(); + let o = rt.execute(code); + let actual = json!({ "outcome": outcome(&o), "kept": *kept.lock().unwrap() }); + let expected = json!({ "outcome": program["outcome"], "kept": program["kept"] }); + if !same(&actual, &expected) { + failures.push(format!( + "{code}\n expected {expected}\n actual {actual}" + )); + } + } + assert!( + failures.is_empty(), + "{} mismatches:\n{}", + failures.len(), + failures.join("\n") + ); +} + +/// A set of globals the configuration cases pick from, with its module names. +type Set = (Vec<(String, HostValue)>, Vec<(String, String)>); + +fn library(name: &str, seen: &Log) -> Set { + let saw = |name: &'static str, seen: &Log| { + let seen = seen.clone(); + move |args: &[HostValue]| { + seen.lock() + .unwrap() + .push(json!([name, args.iter().map(describe).collect::>()])); + } + }; + let global = |name: &str, v: HostValue| vec![(name.to_owned(), v)]; + let modules = |pairs: &[(&str, &str)]| { + pairs + .iter() + .map(|(k, v)| ((*k).to_owned(), (*v).to_owned())) + .collect::>() + }; + match name { + "later" => { + let saw = saw("later", seen); + let f = HostFunction::new_async(move |args, _| { + let saw = saw.clone(); + async move { + saw(&args[..1]); + Ok(HostValue::Number( + args[0].as_f64().unwrap_or(f64::NAN) + 1.0, + )) + } + }) + .length(1); + (global("later", f.into()), Vec::new()) + } + "files" => { + let saw = saw("read", seen); + let f = HostFunction::new(move |_, _| { + saw(&[]); + HostValue::from("text") + }); + (global("read", f.into()), Vec::new()) + } + "glob" => { + let saw = saw("Glob", seen); + let f = HostFunction::new(move |args, _| { + saw(&args[..1]); + let pattern = args[0].as_str().unwrap_or_default().to_owned(); + let matcher = HostFunction::new(move |args, _| { + HostValue::Bool(args[0].as_str().unwrap_or_default().ends_with(&pattern)) + }) + .named("match") + .length(1) + .takes_functions(); + HostValue::object([("match", matcher.into())]) + }) + .constructible() + .length(1); + (global("Glob", f.into()), Vec::new()) + } + "sum" => { + let saw = saw("Sum", seen); + let f = HostFunction::new(move |args, _| { + saw(&args); + let total: f64 = args.iter().map(|a| a.as_f64().unwrap_or(f64::NAN)).sum(); + Returned::Block(Box::pin(async move { + Ok(HostValue::object([("total", HostValue::Number(total))])) + })) + }) + .constructible(); + (global("Sum", f.into()), Vec::new()) + } + "plain" => ( + global( + "plain", + HostFunction::new(|_, _| HostValue::Number(1.0)).into(), + ), + Vec::new(), + ), + "bun" => { + let file = HostFunction::new(|args, _| { + HostValue::object([("name", args.into_iter().next().unwrap_or_default())]) + }) + .length(1); + ( + global("Bun", HostValue::object([("file", file.into())])), + modules(&[("bun", "Bun")]), + ) + } + "one" | "two" => { + let (name, id) = if name == "one" { + ("A", "a") + } else { + ("B", "b") + }; + let f = HostFunction::new(move |_, _| HostValue::from(id)); + ( + global(name, HostValue::object([("id", f.into())])), + modules(&[("shared", name)]), + ) + } + "fs" => { + let read = HostFunction::new(|args, _| { + HostValue::from(format!("text of {}", args[0].as_str().unwrap_or_default())) + }) + .length(1); + let promised = + HostFunction::new_async(|args, _| async move { Ok(args[0].clone()) }).length(1); + ( + global( + "fs", + HostValue::object([ + ("readFile", read.into()), + ( + "promises", + HostValue::object([("readFile", promised.into())]), + ), + ]), + ), + Vec::new(), + ) + } + other => panic!("unknown set {other}"), + } +} + +fn names(j: &Json) -> Vec { + j.as_array() + .unwrap() + .iter() + .map(|n| n.as_str().unwrap().to_owned()) + .collect() +} + +#[test] +fn runtimes_made_with_different_globals_and_module_names_match_the_reference() { + let fixture = fixture(); + let cases = fixture["configuration"].as_array().unwrap(); + assert!(cases.len() >= 30); + let mut failures = Vec::new(); + for case in cases { + let seen: Log = Arc::default(); + let picked = names(&case["globals"]); + let named = match &case["modules"] { + Json::Null => picked.clone(), + m => names(m), + }; + // A later set's module name wins. + let mut modules: Vec<(String, String)> = Vec::new(); + for set in &named { + for (k, v) in library(set, &seen).1 { + match modules.iter_mut().find(|(m, _)| *m == k) { + Some(entry) => entry.1 = v, + None => modules.push((k, v)), + } + } + } + let translate = Translate { + functions: match case["translate"]["functions"].as_str() { + Some("drop") => TranslateFunctions::Drop, + _ => TranslateFunctions::Error, + }, + promises: match case["translate"]["promises"].as_str() { + Some("await") => TranslatePromises::Await, + _ => TranslatePromises::Error, + }, + }; + let globals_seen = seen.clone(); + let rt = Runtime::make() + .modules(modules) + .translate(translate) + .globals(move |_| { + picked + .iter() + .flat_map(|set| library(set, &globals_seen).0) + .collect::>() + }); + let code = case["code"].as_str().unwrap(); + let o = rt.execute(code); + let actual = json!({ "outcome": outcome(&o), "seen": *seen.lock().unwrap() }); + let expected = json!({ "outcome": case["outcome"], "seen": case["seen"] }); + if !same(&actual, &expected) { + failures.push(format!( + "{code}\n expected {expected}\n actual {actual}" + )); + } + } + assert!( + failures.is_empty(), + "{} mismatches:\n{}", + failures.len(), + failures.join("\n") + ); +} + +/// A host value as data, for bindings. +fn data_of(v: &HostValue) -> Data { + match v { + HostValue::Null | HostValue::Undefined => Data::Null, + HostValue::Bool(b) => Data::Bool(*b), + HostValue::Number(n) => Data::from(json!(n)), + HostValue::String(s) => Data::String(s.clone()), + HostValue::Array(items) => Data::Array( + items + .iter() + .map(|i| i.as_ref().map_or(Data::Null, data_of)) + .collect(), + ), + HostValue::Object(fields) => Data::Object( + fields + .iter() + .map(|(k, v)| (k.clone(), data_of(v))) + .collect(), + ), + other => panic!("not data: {other:?}"), + } +} + +/// A diagnostic as the generator records it: its kind, and its message and suggestions as `describe` writes a string. +fn described_diagnostic(d: &psychoscript::Diagnostic) -> Json { + let mut out = json!({ "kind": d.kind.name(), "message": reference::text(&d.message) }); + if !d.suggestions.is_empty() { + out["suggestions"] = Json::Array(d.suggestions.iter().map(reference::text).collect()); + } + out +} + +/// A result's value as `describe` writes it. +fn described_data(d: &Data) -> Json { + match d { + Data::Null => Json::Null, + Data::Bool(b) => json!(b), + Data::Number(n) => Json::Number(n.clone()), + Data::String(s) => reference::text(s), + Data::Array(items) => { + json!({ "array": items.iter().map(described_data).collect::>() }) + } + Data::Object(fields) => json!({ + "object": fields + .iter() + .map(|(k, v)| json!([reference::text(k), described_data(v)])) + .collect::>() + }), + } +} + +#[test] +fn results_and_logs_keep_unpaired_surrogates_as_the_reference_does() { + let fixture = fixture(); + let cases = fixture["results"].as_array().unwrap(); + assert!(cases.len() >= 4); + let mut failures = Vec::new(); + for case in cases { + let rt = Runtime::make().limits(Limits { + timeout_ms: None, + max_output_bytes: case["limits"]["maxOutputBytes"] + .as_u64() + .map(|n| n as usize), + }); + let code = case["code"].as_str().unwrap(); + let mut options = psychoscript::ProgramOptions::new(); + if let Some(HostValue::Object(fields)) = case.get("bindings").map(undescribe) { + options = options.bindings(fields.into_iter().map(|(k, v)| (k, data_of(&v)))); + } + let o = rt.execute_with(code, &options); + let mut actual = match &o.result { + Ok(value) => json!({ "value": described_data(value) }), + Err(d) => json!({ "error": described_diagnostic(d) }), + }; + actual["warnings"] = Json::Array(o.warnings.iter().map(described_diagnostic).collect()); + actual["logs"] = Json::Array(o.logs.iter().map(reference::text).collect()); + actual["truncated"] = json!(o.truncated); + let mut expected = json!({}); + for key in ["value", "error", "warnings", "logs", "truncated"] { + if let Some(v) = case.get(key) { + expected[key] = v.clone(); + } + } + if !same(&actual, &expected) { + failures.push(format!( + "{code}\n expected {expected}\n actual {actual}" + )); + } + } + assert!( + failures.is_empty(), + "{} mismatches:\n{}", + failures.len(), + failures.join("\n") + ); +} diff --git a/packages/codemode-rust/crates/psychoscript/tests/gc.rs b/packages/codemode-rust/crates/psychoscript/tests/gc.rs new file mode 100644 index 0000000000000..5a4958b987ef5 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/tests/gc.rs @@ -0,0 +1,138 @@ +//! What the collector must keep that the conformance cases do not reach. + +use psychoscript::Runtime; + +/// A closure only the heap holds swaps the value out of its cell while a cycle marks, so the cell no longer refers to +/// it when the collector gets there: the value it returned must survive anyway. Cycles overlap the swap reliably only +/// with `PSYCHOSCRIPT_GC_STRESS=1`. The padding closure keeps `x` off cell 0, which any zero on the stack keeps. +#[test] +fn a_value_swapped_out_of_a_cell_survives_the_cycle() { + let code = r#" + function make() { + let pad = 0 + const g = () => pad + let x = { v: g() } + return (y) => { + const old = x + x = y + return old + } + } + const holder = { f: make() } + let bad = 0 + for (let i = 1; i < 2000; i++) { + const old = holder.f({ v: i }) + for (let j = 0; j < 300; j++) [j, { j }] + if (old.v !== i - 1) bad++ + } + return bad + "#; + let outcome = Runtime::make().execute(code); + assert_eq!(outcome.json().unwrap(), serde_json::json!(0)); +} + +/// Map keys and property names made and dropped all the time: their atoms are freed and their ids reused, so the +/// atom table stays near what is live (about 2,000 keys) instead of growing by one per key ever used (about 200,000 +/// here). The run stops for the host every round, where it reports its heap. +#[cfg(feature = "gc-stats")] +#[test] +fn atoms_of_dropped_keys_are_freed() { + use std::sync::{Arc, Mutex}; + + use psychoscript::{HostFunction, HostValue}; + + let code = r#" + const m = new Map() + let n = 0 + for (let round = 0; round < 200; round++) { + for (let j = 0; j < 500; j++, n++) { + m.set("key" + n, n) + if (n >= 1000) m.delete("key" + (n - 1000)) + const o = { [`dyn${n}`]: n } + o[`dyn${n + 1}`] = n + delete o[`dyn${n}`] + } + await tick() + } + let sum = 0 + for (const [k, v] of m) if (k === "key" + v) sum += 1 + return [m.size, sum, m.get("key" + (n - 1))] + "#; + let peak = Arc::new(Mutex::new(0u64)); + let seen = peak.clone(); + let rt = Runtime::make().globals(move |run| { + let (run, seen) = (run.clone(), seen.clone()); + [( + "tick", + HostFunction::new_async(move |_, _| { + let atoms = run.heap_stats().atoms; + let mut p = seen.lock().unwrap(); + *p = (*p).max(atoms); + async { Ok(HostValue::Undefined) } + }), + )] + }); + let outcome = rt.execute(code); + assert_eq!( + outcome.json().unwrap(), + serde_json::json!([1000, 1000, 99999]) + ); + let peak = *peak.lock().unwrap(); + assert!(peak > 0 && peak < 40_000, "{peak} atoms at most"); +} + +/// `JSON.stringify` keeps an object's keys while a replacer runs, and the replacer may delete the properties and +/// allocate enough for cycles to run: the keys still left to write, held by nothing but the walk, must keep their +/// atoms, or they would print under another key's name. Cycles overlap the walk reliably only with +/// `PSYCHOSCRIPT_GC_STRESS=1`. +#[test] +fn keys_only_json_stringify_holds_survive() { + let code = r#" + function churn() { + const a = [] + for (let i = 0; i < 200; i++) a.push({ i }) + return a.length + } + let bad = 0 + for (let r = 0; r < 40; r++) { + const o = {} + for (let k = 0; k < 10; k++) o["p" + r + "_" + k] = k + const first = "p" + r + "_0" + const got = JSON.stringify(o, function (key, v) { + churn() + if (key === first) for (const k of Object.keys(this)) if (k !== first) delete this[k] + return v === undefined ? "gone" : v + }) + let want = '{"' + first + '":0' + for (let k = 1; k < 10; k++) want += ',"p' + r + "_" + k + '":"gone"' + if (got !== want + "}") bad++ + } + return bad + "#; + let outcome = Runtime::make().execute(code); + assert_eq!(outcome.json().unwrap(), serde_json::json!(0)); +} + +/// Accessor halves only an accessor holds: a getter and setter defined and replaced on a long-lived object while cycles +/// run (a write of a pair into an object already traced must reach the collector), and an accessor's pair copied by +/// `defineProperty` from a descriptor that is then dropped. Cycles overlap the writes reliably only with +/// `PSYCHOSCRIPT_GC_STRESS=1`. +#[test] +fn accessor_halves_survive_the_cycle() { + let code = r#" + const holder = { n: 0 } + let bad = 0 + for (let i = 1; i < 1500; i++) { + const v = { i } + Object.defineProperty(holder, "x", { get() { return v }, set(w) { v.i = w }, configurable: true }) + const lit = { get y() { return [i] } } + holder.lit = lit + for (let j = 0; j < 200; j++) [j, { j }] + holder.x = holder.x.i + 1 + if (holder.x.i !== i + 1 || holder.lit.y[0] !== i) bad++ + } + return bad + "#; + let outcome = Runtime::make().execute(code); + assert_eq!(outcome.json().unwrap(), serde_json::json!(0)); +} diff --git a/packages/codemode-rust/crates/psychoscript/tests/globals.rs b/packages/codemode-rust/crates/psychoscript/tests/globals.rs new file mode 100644 index 0000000000000..918ac293f5dbb --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/tests/globals.rs @@ -0,0 +1,598 @@ +//! Host globals, the copying boundary, host errors, module names and imports. The values crossing in either +//! direction and the runtime configurations the reference records are replayed from `conformance/boundary.json`; +//! these cover the rest. + +use std::sync::{Arc, Mutex}; + +use psychoscript::{ + HostError, HostFunction, HostValue, Json, Limits, ProgramOptions, Runtime, Translate, + TranslateFunctions, TranslatePromises, +}; +use serde_json::json; + +type Held = Arc>>; + +/// Functions in arguments are left out and promises awaited, as `JSON.stringify` and `await` would. +const LENIENT: Translate = Translate { + functions: TranslateFunctions::Drop, + promises: TranslatePromises::Await, +}; + +/// What `fetch(url)` gives: data, and functions inside it. +fn response(url: &str) -> HostValue { + let body = format!(r#"{{"url":"{url}"}}"#); + let text = body.clone(); + HostValue::object([ + ("status", HostValue::Number(200.0)), + ("ok", HostValue::Bool(true)), + ( + "headers", + HostValue::object([( + "get", + HostFunction::new(|args, _| match args.first().and_then(HostValue::as_str) { + Some("content-type") => HostValue::from("application/json"), + _ => HostValue::Null, + }) + .named("get") + .length(1) + .into(), + )]), + ), + ( + "text", + HostFunction::new(move |_, _| HostValue::from(text.clone())) + .named("text") + .into(), + ), + ( + "json", + HostFunction::new(move |_, _| { + HostValue::from_json(&serde_json::from_str(&body).unwrap()) + }) + .named("json") + .into(), + ), + ( + "handlers", + HostValue::array([HostFunction::new(|args, _| { + HostValue::Number(args[0].as_f64().unwrap_or(0.0) + 1.0) + }) + .named("step") + .length(1) + .into()]), + ), + ]) +} + +/// The globals of a small web host; `keep` records what it gets in `held`. +fn web(held: &Held, translate: Translate, limits: Limits) -> Runtime { + let held = held.clone(); + Runtime::make() + .translate(translate) + .limits(limits) + .globals(move |_| { + let keep = held.clone(); + [ + ( + "keep", + HostFunction::new(move |args, _| { + let v = args.into_iter().next().unwrap_or_default(); + keep.lock().unwrap().push(v.clone()); + v + }) + .length(1), + ), + ( + "settings", + HostFunction::new(|_, _| { + HostValue::from_json(&json!({ "retries": 3, "nested": { "deep": true } })) + }), + ), + ( + "later", + HostFunction::new_async(|args, _| async move { + Ok(HostValue::Number(args[0].as_f64().unwrap_or(0.0) + 1.0)) + }) + .length(1), + ), + ( + "first", + HostFunction::new(|args, _| match args.into_iter().next() { + Some(HostValue::Map(entries)) => entries + .into_iter() + .find(|(k, _)| k.as_str() == Some("k")) + .map(|(_, v)| v) + .unwrap_or_default(), + _ => HostValue::Undefined, + }) + .length(1), + ), + ( + "fetch", + HostFunction::new_async(|args, _| async move { + Ok(response( + args.first().and_then(HostValue::as_str).unwrap_or_default(), + )) + }) + .length(2), + ), + ( + "never", + HostFunction::new_async(|_, _| std::future::pending()), + ), + ( + "echo", + HostFunction::new(|args, _| args[0].get("v").cloned().unwrap_or_default()) + .length(1), + ), + ] + }) +} + +fn lenient(held: &Held) -> Runtime { + web(held, LENIENT, Limits::default()) +} + +fn value(rt: &Runtime, code: &str) -> Json { + match rt.execute(code).result { + Ok(v) => v.to_json(), + Err(d) => panic!("expected success, got {:?}: {}", d.kind, d.message), + } +} + +fn failure(rt: &Runtime, code: &str) -> String { + match rt.execute(code).result { + Ok(v) => panic!("expected failure, got {v}"), + Err(d) => d.message_lossy(), + } +} + +#[test] +fn a_global_is_callable_awaitable_and_named() { + let held = Held::default(); + let rt = lenient(&held); + assert_eq!(value(&rt, "return await later(1)"), json!(2)); + assert_eq!( + value(&rt, "return [typeof later, later.name, later.length]"), + json!(["function", "later", 1]) + ); + assert_eq!( + failure(&rt, "new later()"), + "TypeError: new later(...) is not supported; call later(...) without new instead. (line 1, col 1)" + ); +} + +#[test] +fn a_function_inside_a_result_is_callable_and_crosses_the_same_way() { + let held = Held::default(); + let rt = lenient(&held); + assert_eq!( + value( + &rt, + r#"const res = await fetch("https://a.test/", { method: "GET" }) + return [res.status, res.ok, res.headers.get("content-type"), res.text(), res.json(), typeof res.json, res.json.name, res.handlers[0](1)]"# + ), + json!([200, true, "application/json", r#"{"url":"https://a.test/"}"#, { "url": "https://a.test/" }, "function", "json", 2]) + ); + assert_eq!( + failure( + &rt, + r#"const res = await fetch("https://a.test/"); res.handlers[0]([1].keys())"# + ), + "TypeError: Argument 1 to fetch.handlers[0] contains an iterator, which cannot be passed to the host. (line 1, col 45)" + ); + for rt in [rt, web(&held, Translate::default(), Limits::default())] { + assert_eq!( + value(&rt, r#"return await fetch("https://a.test/")"#), + json!({ "status": 200, "ok": true, "headers": {}, "handlers": [null] }) + ); + } +} + +#[test] +fn values_are_copies_both_ways() { + let held = Held::default(); + let rt = lenient(&held); + value( + &rt, + "const o = { n: 1, list: [1] }; keep(o); o.n = 2; o.list.push(2)", + ); + assert_eq!( + held.lock().unwrap()[0].to_json(), + Some(json!({ "n": 1, "list": [1] })) + ); + assert_eq!( + value( + &rt, + "const s = settings(); s.retries = 0; s.nested.deep = false; return [s, settings()]" + ), + json!([{ "retries": 0, "nested": { "deep": false } }, { "retries": 3, "nested": { "deep": true } }]) + ); + assert_eq!(value(&rt, "return settings() === settings()"), json!(false)); + assert_eq!( + value(&rt, r#"return first(new Map([["k", { z: 1 }]]))"#), + json!({ "z": 1 }) + ); + held.lock().unwrap().clear(); + value(&rt, "keep({ __proto__: { polluted: true }, a: 1 })"); + assert_eq!(held.lock().unwrap()[0].to_json(), Some(json!({ "a": 1 }))); +} + +#[test] +fn a_program_error_crosses_with_its_name_message_cause_and_data() { + let held = Held::default(); + let rt = lenient(&held); + value( + &rt, + r#"const e = new Error("m", { cause: new RangeError("root") }) + e.code = "ENOENT"; e.detail = { path: "x" }; e.fn = () => 1 + keep(e)"#, + ); + let HostValue::Error(e) = &held.lock().unwrap()[0] else { + panic!("not an error"); + }; + assert_eq!( + (e.name.as_str(), e.message.as_str()), + (Some("Error"), Some("m")) + ); + let Some(HostValue::Error(cause)) = e.cause.as_deref() else { + panic!("no cause"); + }; + assert_eq!( + (cause.name.as_str(), cause.message.as_str()), + (Some("RangeError"), Some("root")) + ); + let keys: Vec<&str> = e.fields.iter().filter_map(|(k, _)| k.as_str()).collect(); + assert_eq!(keys, ["code", "detail"]); +} + +#[test] +fn functions_are_left_out_and_promises_awaited_iterators_and_symbols_cannot_be_passed_in() { + let held = Held::default(); + let rt = lenient(&held); + value( + &rt, + "keep({ f: () => 1, n: later(1) }); keep([() => 1, later(2)]); keep(() => 1); keep(later(3))", + ); + let kept: Vec> = held + .lock() + .unwrap() + .iter() + .map(HostValue::to_json) + .collect(); + assert_eq!( + kept, + [ + Some(json!({ "n": 2 })), + Some(json!([null, 3])), + None, + Some(json!(4)) + ] + ); + assert_eq!( + failure(&rt, "keep([1].keys())"), + "TypeError: Argument 1 to keep contains an iterator, which cannot be passed to the host. (line 1, col 1)" + ); + assert_eq!( + failure(&rt, "keep(Symbol.iterator)"), + "TypeError: Argument 1 to keep contains a symbol, which cannot be passed to the host. (line 1, col 1)" + ); +} + +#[test] +fn host_errors_become_program_errors() { + let rt = Runtime::make().globals(|_| { + [ + ( + "fail", + HostFunction::new(|_, _| -> psychoscript::HostResult { + Err(HostError::named("RangeError", "boom").into()) + }), + ), + ( + "open", + HostFunction::new(|_, _| -> psychoscript::HostResult { + let cause = HostError::new("ENOENT: no such file or directory, open 'x'") + .with_field("code", "ENOENT") + .with_field("errno", -2.0) + .with_field("path", "x") + .with_field("detail", HostValue::from_json(&json!({ "retried": true }))) + .with_field( + "retry", + HostFunction::new(|_, _| HostValue::Number(1.0)).named("retry"), + ); + Err(HostError::new("open failed").with_cause(cause).into()) + }), + ), + ( + "reject", + HostFunction::new_async(|args, _| async move { + Err(args.into_iter().next().unwrap_or_default()) + }), + ), + ( + "boom", + HostFunction::new(|_, _| -> psychoscript::HostResult { + Err(HostValue::from_json( + &json!({ "status": 404, "nested": { "a": 1 } }), + )) + }), + ), + ] + }); + assert_eq!( + value( + &rt, + "try { fail() } catch (e) { return [e instanceof RangeError, e.message] }" + ), + json!([true, "boom"]) + ); + assert_eq!( + value( + &rt, + r#"try { open() } catch (e) { + const c = e.cause + return [e.message, Object.keys(e), c instanceof Error, c.code, c.errno, c.path, c.detail, Object.keys(c), "stack" in c] + }"# + ), + json!(["open failed", [], true, "ENOENT", -2, "x", { "retried": true }, ["code", "errno", "path", "detail"], false]) + ); + assert_eq!( + value( + &rt, + r#"try { await reject(new TypeError("bad")) } catch (e) { return [e instanceof TypeError, e.message] }"# + ), + json!([true, "bad"]) + ); + assert_eq!( + value( + &rt, + r#"try { await reject("plain") } catch (e) { return e }"# + ), + json!("plain") + ); + assert_eq!( + value(&rt, "try { boom() } catch (e) { return e.status }"), + json!(404) + ); + assert_eq!( + failure(&rt, "boom()"), + r#"Uncaught: {"status":404,"nested":{"a":1}}"# + ); +} + +#[test] +fn a_host_function_passed_back_arrives_as_itself_wherever_it_sits() { + // Each file's `text` is named after the file, so the host can tell which function it got back. + let rt = Runtime::make().globals(|_| { + [ + ( + "file", + HostFunction::new(|args, _| { + let name = args[0].as_str().unwrap_or_default().to_owned(); + let text = HostFunction::new(|_, _| HostValue::from("text")) + .named(format!("text:{name}")); + HostValue::object([("name", HostValue::from(name)), ("text", text.into())]) + }), + ), + ( + "copy", + HostFunction::new_async(|args, _| async move { + let name = match args[1].get("text") { + Some(HostValue::Function(f)) => f.name().to_owned(), + _ => "no function".to_owned(), + }; + Ok(HostValue::array([args[0].clone(), HostValue::from(name)])) + }) + .takes_functions(), + ), + ] + }); + assert_eq!( + value(&rt, r#"return await copy("b", file("a"))"#), + json!(["b", "text:a"]) + ); + assert_eq!( + value( + &rt, + r#"const f = file("a"); return await copy("b", { text: f.text })"# + ), + json!(["b", "text:a"]) + ); +} + +#[test] +fn a_program_function_or_a_global_passed_to_the_host_is_left_out() { + let taken = Held::default(); + let into = taken.clone(); + let rt = Runtime::make() + .translate(Translate { + functions: TranslateFunctions::Drop, + ..Translate::default() + }) + .globals(move |_| { + let into = into.clone(); + [ + ( + "fs", + HostValue::object([( + "rm", + HostFunction::new(|_, _| HostValue::Undefined).into(), + )]), + ), + ( + "take", + HostFunction::new(move |args, _| { + into.lock() + .unwrap() + .push(args.into_iter().next().unwrap_or_default()); + HostValue::Undefined + }) + .into(), + ), + ] + }); + value( + &rt, + r#"take({ text: async () => "x" }); take({ text: take }); take(fs.rm); take({ a: fs.rm }); take(fs)"#, + ); + let taken: Vec> = taken + .lock() + .unwrap() + .iter() + .map(HostValue::to_json) + .collect(); + assert_eq!( + taken, + [ + Some(json!({})), + Some(json!({})), + None, + Some(json!({})), + Some(json!({})) + ] + ); +} + +#[test] +fn a_promise_in_the_arguments_that_never_settles_waits_until_the_timeout() { + let held = Held::default(); + let rt = web( + &held, + Translate { + promises: TranslatePromises::Await, + ..Translate::default() + }, + Limits { + timeout_ms: Some(50), + ..Limits::default() + }, + ); + let d = rt.execute("keep({ n: never() })").result.unwrap_err(); + assert_eq!( + (d.kind.name(), d.message.as_str()), + ("TimeoutExceeded", Some("Execution timed out after 50ms.")) + ); + assert!(held.lock().unwrap().is_empty()); +} + +#[test] +fn a_result_with_functions_is_handed_to_another_host_function_as_its_data() { + let held = Held::default(); + assert_eq!( + value( + &lenient(&held), + r#"return echo({ v: await fetch("https://a.test/") })"# + ), + json!({ "status": 200, "ok": true, "headers": {}, "handlers": [null] }) + ); +} + +#[test] +fn a_host_global_wins_over_a_built_in_and_a_binding_of_the_same_name() { + let rt = Runtime::make().globals(|_| { + [ + ("URL", HostFunction::new(|_, _| HostValue::Number(1.0))), + ("n", HostFunction::new(|_, _| HostValue::Number(2.0))), + ] + }); + let mut bindings = serde_json::Map::new(); + bindings.insert("n".into(), Json::from(4)); + let outcome = rt.execute_with( + "return [URL(), typeof URL.canParse, n()]", + &ProgramOptions::new().bindings(bindings), + ); + assert_eq!(outcome.result.unwrap(), json!([1, "undefined", 2])); +} + +fn files() -> Runtime { + Runtime::make().globals(|_| { + [( + "fs", + HostValue::object([ + ( + "readFile", + HostFunction::new(|args, _| { + HostValue::from(format!("text of {}", args[0].as_str().unwrap_or_default())) + }) + .into(), + ), + ( + "promises", + HostValue::object([( + "readFile", + HostFunction::new_async(|args, _| async move { + Ok(args.into_iter().next().unwrap_or_default()) + }) + .into(), + )]), + ), + ]), + )] + }) +} + +#[test] +fn import_require_and_dynamic_import_load_globals() { + assert_eq!( + value( + &files(), + r#"import fs, { readFile } from "node:fs" + import * as ns from "fs" + import { readFile as readAsync } from "fs/promises" + const dynamic = await import("fs") + return [readFile("a"), fs === require("fs"), ns.default === fs, dynamic === ns, await readAsync("b")]"# + ), + json!(["text of a", true, true, true, "b"]) + ); +} + +#[test] +fn a_module_that_is_not_provided_or_a_missing_export_fails_at_the_import() { + let rt = files(); + assert_eq!( + failure(&rt, r#"import yaml from "yaml""#), + r#"Error: Cannot import "yaml": packages can't be installed here. (line 1, col 8)"# + ); + assert_eq!( + value( + &rt, + r#"try { await import("child_process") } catch (e) { return e.message }"# + ), + json!(r#"Cannot import "child_process": this runtime doesn't provide it."#) + ); + assert_eq!( + failure(&rt, r#"import { writeFile } from "fs""#), + r#"SyntaxError: "fs" has no export named "writeFile". (line 1, col 10)"# + ); + assert_eq!( + failure(&Runtime::make(), r#"require("fs")"#), + r#"Error: Cannot import "fs": this runtime doesn't provide it. (line 1, col 1)"# + ); +} + +#[test] +fn a_module_name_loads_its_global() { + let rt = Runtime::make() + .globals(|_| { + [( + "Bun", + HostValue::object([( + "file", + HostFunction::new(|args, _| { + HostValue::object([("name", args.into_iter().next().unwrap_or_default())]) + }) + .into(), + )]), + )] + }) + .modules([("bun", "Bun")]); + assert_eq!( + value( + &rt, + r#"import Loaded, { file } from "bun" + return [file("a").name, Loaded === Bun, typeof require("bun").file, typeof (await import("bun")).file]"# + ), + json!(["a", true, "function", "function"]) + ); +} diff --git a/packages/codemode-rust/crates/psychoscript/tests/host.rs b/packages/codemode-rust/crates/psychoscript/tests/host.rs new file mode 100644 index 0000000000000..04f629a987c8a --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/tests/host.rs @@ -0,0 +1,1014 @@ +//! The language layer on its own: host functions, namespaces, failures, per-run state and translation, mirroring the +//! reference's `test/language.test.ts`. + +use std::future::Future; +use std::pin::Pin; +use std::sync::{Arc, Condvar, Mutex}; +use std::task::{Context, Poll, Waker}; +use std::time::Duration; + +use psychoscript::{ + DurableFunction, Failure, HostFunction, HostString, HostValue, Json, Limits, Namespace, + Outcome, ProgramOptions, Returned, RunOutcome, Runtime, Translate, TranslateFunctions, + TranslatePromises, to_bytes, +}; +use serde_json::json; + +fn value(rt: &Runtime, code: &str) -> Json { + match rt.execute(code).result { + Ok(v) => v.to_json(), + Err(e) => panic!("expected success, got {}: {}", e.kind, e.message), + } +} + +fn error(rt: &Runtime, code: &str) -> psychoscript::Diagnostic { + match rt.execute(code).result { + Ok(v) => panic!("expected a failure, got {v}"), + Err(e) => e, + } +} + +fn num(v: &HostValue) -> f64 { + v.as_f64().unwrap_or(f64::NAN) +} + +/// A latch the test opens by hand: a future that waits for it, and a way to wait until a call reached it. +#[derive(Clone, Default)] +struct Latch(Arc<(Mutex, Condvar)>); + +#[derive(Default)] +struct LatchState { + value: Option, + reached: usize, + wakers: Vec, +} + +impl Latch { + /// Marks that a call reached the latch, and waits for it to open. + fn wait(&self) -> LatchFuture { + let (m, c) = &*self.0; + m.lock().unwrap().reached += 1; + c.notify_all(); + LatchFuture(self.clone()) + } + + fn open(&self, v: HostValue) { + let (m, c) = &*self.0; + let mut s = m.lock().unwrap(); + s.value = Some(v); + for w in s.wakers.drain(..) { + w.wake(); + } + c.notify_all(); + } + + /// Waits until a call reached the latch. + fn reached(&self) { + let (m, c) = &*self.0; + let mut s = m.lock().unwrap(); + while s.reached == 0 { + s = c.wait_timeout(s, Duration::from_millis(10)).unwrap().0; + } + } +} + +struct LatchFuture(Latch); + +impl Future for LatchFuture { + type Output = HostValue; + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + let mut s = (self.0).0.0.lock().unwrap(); + match &s.value { + Some(v) => Poll::Ready(v.clone()), + None => { + s.wakers.push(cx.waker().clone()); + Poll::Pending + } + } + } +} + +/// A future that never completes. +fn never() -> std::future::Pending { + std::future::pending() +} + +/// Runs `code` on another thread, waits until `reached` was reached, and suspends it: the suspend's answer, and what +/// the run returned. When the suspend fails, `after` lets the run go on to its end. +fn suspend_at<'c>( + rt: &Runtime, + code: impl Into>, + options: &ProgramOptions, + reached: &Latch, + after: impl FnOnce(), +) -> (Result, RunOutcome) { + let code = code.into(); + std::thread::scope(|s| { + let (tx, rx) = std::sync::mpsc::channel(); + let running = s.spawn(move || { + let program = rt.program(code, options); + tx.send(program.suspender()).unwrap(); + program.run_resumable().unwrap() + }); + let suspender = rx.recv().unwrap(); + reached.reached(); + let answer = suspender.suspend(None); + if answer.is_err() { + after(); + } + (answer, running.join().unwrap()) + }) +} + +fn suspended(o: RunOutcome) -> psychoscript::Suspended { + match o { + RunOutcome::Suspended(s) => s, + RunOutcome::Done(o) => panic!("expected a suspended run, got {:?}", o.result), + } +} + +fn done(o: RunOutcome) -> Outcome { + match o { + RunOutcome::Done(o) => o, + RunOutcome::Suspended(_) => panic!("expected the run to end"), + } +} + +// ---------- Host.fn ---------- + +#[test] +fn a_sync_function_returns_its_value_or_its_pending_work_as_a_promise() { + let rt = Runtime::make().globals(|_| { + [ + ( + "double", + HostFunction::new(|args, _| HostValue::Number(num(&args[0]) * 2.0)), + ), + ( + "later", + HostFunction::new(|args, _| { + let n = num(&args[0]); + Returned::Pending(Box::pin(async move { Ok(HostValue::Number(n + 1.0)) })) + }), + ), + ] + }); + assert_eq!( + value( + &rt, + "const a = double(2); const b = later(a); return [a, b instanceof Promise, await b, typeof double]" + ), + json!([4, true, 5, "function"]) + ); +} + +#[test] +fn an_async_function_hands_the_program_a_promise() { + let rt = Runtime::make().globals(|_| { + [( + "load", + HostFunction::new_async(|args, _| async move { Ok(args[0].clone()) }), + )] + }); + assert_eq!( + value( + &rt, + "const p = load(1); return [p instanceof Promise, await p]" + ), + json!([true, 1]) + ); +} + +#[test] +fn a_sync_thenable_result_can_be_used_directly_awaited_or_chained() { + let rt = Runtime::make().globals(|_| { + [( + "find", + HostFunction::new(|_, _| { + HostValue::object([("items", HostValue::array([1.0.into(), 2.0.into()]))]) + }) + .thenable(), + )] + }); + assert_eq!( + value( + &rt, + "return [find().items.length, (await find()).items.length, await find().then((r) => r.items[1]), Object.keys(find())]" + ), + json!([2, 2, 2, ["items"]]) + ); +} + +#[test] +fn every_call_gets_its_key() { + let keys = Arc::new(Mutex::new(Vec::new())); + let seen = keys.clone(); + let rt = Runtime::make().globals(move |_| { + let seen = seen.clone(); + [( + "note", + HostFunction::new(move |_, call| { + seen.lock().unwrap().push(call.key()); + HostValue::Undefined + }), + )] + }); + rt.program("note(); note()", &ProgramOptions::new().run_id("r")) + .run() + .unwrap(); + assert_eq!(*keys.lock().unwrap(), ["r:0", "r:1"]); +} + +#[test] +fn arguments_and_results_cross_as_structured_copies() { + let seen = Arc::new(Mutex::new(None)); + let kept = seen.clone(); + let rt = Runtime::make().globals(move |_| { + let kept = kept.clone(); + [( + "keep", + HostFunction::new(move |args, _| { + *kept.lock().unwrap() = Some(args[0].clone()); + HostValue::object([ + ("when", HostValue::Date(0.0)), + ("tags", HostValue::Set(vec!["a".into()])), + ( + "read", + HostFunction::new(|_, _| HostValue::from("called")).into(), + ), + ]) + }), + )] + }); + assert_eq!( + value( + &rt, + r#"const r = keep({ at: new Date(5), m: new Map([["k", 1]]) }); return [r.when.getTime(), r.tags.has("a"), r.read()]"# + ), + json!([0, true, "called"]) + ); + let seen = seen.lock().unwrap().clone().unwrap(); + assert!(matches!(seen.get("at"), Some(HostValue::Date(t)) if *t == 5.0)); + assert!( + matches!(seen.get("m"), Some(HostValue::Map(m)) if m.len() == 1 && m[0].0.as_str() == Some("k") && m[0].1.as_f64() == Some(1.0)) + ); +} + +#[test] +fn a_function_inside_a_result_crosses_back_as_itself_only_to_a_function_that_takes_functions() { + let rt = Runtime::make().globals(|_| { + [ + ( + "open", + HostFunction::new(|_, _| { + HostValue::object([( + "read", + HostFunction::new(|_, _| HostValue::from("called")) + .named("read") + .into(), + )]) + }), + ), + ( + "takes", + HostFunction::new(|args, _| { + let read = args[0].get("read"); + HostValue::Bool( + matches!(read, Some(HostValue::Function(f)) if f.name() == "read"), + ) + }) + .takes_functions(), + ), + ("refuses", HostFunction::new(|_, _| HostValue::Bool(true))), + ] + }); + assert_eq!( + value(&rt, "return takes({ read: open().read })"), + json!(true) + ); + for code in ["refuses(open().read)", "takes(takes)", "takes(() => 1)"] { + let e = error(&rt, code); + assert!( + e.message_lossy() + .contains("contains a function, which cannot be passed to the host"), + "{code}: {}", + e.message + ); + } +} + +#[test] +fn a_constructible_function_is_called_by_new_and_gives_what_it_returns() { + let rt = Runtime::make().globals(|_| { + [ + ( + "Box", + HostFunction::new(|args, _| HostValue::object([("item", args[0].clone())])) + .constructible(), + ), + ( + "Later", + HostFunction::new(|args, _| { + let item = args[0].clone(); + Returned::Pending(Box::pin( + async move { Ok(HostValue::object([("item", item)])) }, + )) + }) + .constructible(), + ), + ("plain", HostFunction::new(|_, _| HostValue::Number(1.0))), + ] + }); + assert_eq!( + value( + &rt, + "return [new Box(1).item, (await new Later(2)).item, (await new Later(...[3])).item]" + ), + json!([1, 2, 3]) + ); + assert!(rt.execute("new plain()").result.is_err()); +} + +#[test] +#[should_panic(expected = "idempotent applies only to async functions")] +fn idempotent_applies_only_to_async_functions() { + assert!( + HostFunction::new_async(|_, _| async { Ok(HostValue::Undefined) }) + .idempotent() + .is_idempotent() + ); + let _ = HostFunction::new(|_, _| HostValue::Undefined).idempotent(); +} + +// ---------- Host.namespace and Host.fail ---------- + +fn api_runtime() -> Runtime { + Runtime::make().globals(|_| { + [ + ( + "api", + HostValue::from(Namespace::new( + |path| { + Ok(match path.len() { + 0 => vec!["issues".into()], + _ => vec!["list".into()], + }) + }, + |path| -> psychoscript::Resolved { + if path + .iter() + .map(|k| k.to_string()) + .collect::>() + .join(".") + == "issues.list" + { + return HostFunction::new_async(|_, _| async { + Ok(HostValue::array(["#1".into()])) + }) + .into(); + } + Failure::missing(format!( + "No api.{}", + path.iter() + .map(|k| k.to_string()) + .collect::>() + .join(".") + )) + .suggestions(["Try api.issues.list."]) + .kind("NotFound") + .into() + }, + )), + ), + ( + "refuse", + HostFunction::new(|_, _| -> psychoscript::HostResult { + Err(Failure::new("Refused", "Not today") + .suggestions(["Ask again."]) + .into()) + }) + .into(), + ), + ] + }) +} + +#[test] +fn a_namespace_is_a_lazy_path_addressed_object_of_functions() { + assert_eq!( + value( + &api_runtime(), + "return [await api.issues.list(), Object.keys(api), Object.keys(api.issues), typeof api.x]" + ), + json!([["#1"], ["issues"], ["list"], "function"]) + ); +} + +#[test] +fn a_missing_function_and_a_host_failure_keep_their_kind_and_suggestions() { + let rt = api_runtime(); + let e = error(&rt, "return api.issues.nope()"); + assert_eq!( + (e.kind.name(), e.message_lossy(), e.suggestions_lossy()), + ( + "NotFound", + "No api.issues.nope".to_owned(), + vec!["Try api.issues.list.".to_owned()] + ) + ); + let e = error(&rt, "refuse()"); + assert_eq!( + (e.kind.name(), e.message_lossy(), e.suggestions_lossy()), + ( + "Refused", + "Not today".to_owned(), + vec!["Ask again.".to_owned()] + ) + ); +} + +// ---------- per-run state ---------- + +#[test] +fn run_metadata_is_the_results_and_a_resumed_run_gets_it_back_with_fresh_globals() { + let gate = Latch::default(); + let made = Arc::new(Mutex::new(0)); + let (g, m) = (gate.clone(), made.clone()); + let rt = Runtime::make().globals(move |run| { + *m.lock().unwrap() += 1; + if run.metadata().is_null() { + run.set_metadata(json!({ "count": 0 })); + } + let (counting, g) = (run.clone(), g.clone()); + [ + ( + "count", + HostFunction::new(move |_, _| { + counting.update_metadata(|m| { + let mut j = m.to_json(); + let n = j["count"].as_f64().unwrap_or(0.0) + 1.0; + j["count"] = json!(n as i64); + *m = j.into(); + HostValue::Number(n) + }) + }), + ), + ( + "wait", + HostFunction::new_async(move |_, _| { + let wait = g.wait(); + async move { Ok(wait.await) } + }) + .idempotent(), + ), + ] + }); + let (answer, ran) = suspend_at( + &rt, + "count(); count(); await wait(); return count()", + &ProgramOptions::new().run_id("m"), + &gate, + || {}, + ); + let suspended = suspended(ran); + assert_eq!(self::suspended(answer.unwrap()).state, suspended.state); + assert_eq!( + suspended.state.0["header"]["metadata"], + json!({ "count": 2 }) + ); + gate.open(HostValue::Undefined); + let outcome = done( + rt.resume_bytes(&to_bytes(&suspended.state)) + .unwrap() + .run_resumable() + .unwrap(), + ); + assert_eq!(outcome.result.unwrap(), json!(3)); + assert_eq!(outcome.metadata, json!({ "count": 3 })); + // Made at the start and at the resume (and at every step in the round-trip test mode). + assert!(*made.lock().unwrap() >= 2); +} + +#[test] +fn a_suspend_fails_while_a_call_that_isnt_idempotent_runs() { + let called = Latch::default(); + let c = called.clone(); + let rt = Runtime::make().globals(move |_| { + let c = c.clone(); + [( + "slow", + HostFunction::new_async(move |_, _| { + let wait = c.wait(); + async move { Ok(wait.await) } + }), + )] + }); + let (answer, ran) = suspend_at(&rt, "await slow()", &ProgramOptions::new(), &called, || { + called.open(HostValue::Undefined) + }); + let error = answer.unwrap_err(); + assert_eq!( + error + .running + .iter() + .map(|c| c.path.as_str()) + .collect::>(), + ["slow"] + ); + assert!(done(ran).result.is_ok()); +} + +#[test] +fn a_suspend_fails_while_a_call_holds_a_host_function_even_an_idempotent_one() { + let called = Latch::default(); + let c = called.clone(); + let rt = Runtime::make().globals(move |_| { + let c = c.clone(); + [ + ( + "open", + HostFunction::new(|_, _| { + HostValue::object([( + "read", + HostFunction::new(|_, _| HostValue::from("called")).into(), + )]) + }), + ), + ( + "slow", + HostFunction::new_async(move |_, _| { + let wait = c.wait(); + async move { Ok(wait.await) } + }) + .idempotent() + .takes_functions(), + ), + ] + }); + let (answer, ran) = suspend_at( + &rt, + "await slow(open().read)", + &ProgramOptions::new(), + &called, + || called.open(HostValue::Undefined), + ); + let error = answer.unwrap_err(); + assert_eq!( + error + .running + .iter() + .map(|c| c.path.as_str()) + .collect::>(), + ["slow"] + ); + assert!(done(ran).result.is_ok()); +} + +#[test] +fn a_durable_function_keeps_running_across_a_suspend_and_is_waited_on_again() { + let jobs: Arc>> = Arc::default(); + let waiting = Latch::default(); + let (j, w) = (jobs.clone(), waiting.clone()); + let rt = Runtime::make().globals(move |_| { + let (started, waited, w) = (j.clone(), j.clone(), w.clone()); + [( + "job", + DurableFunction::new( + move |_, call| { + let key = call.key(); + started + .lock() + .unwrap() + .push((key.clone(), Latch::default())); + async move { Ok(key.into()) } + }, + move |key, _| { + let latch = waited + .lock() + .unwrap() + .iter() + .find(|(k, _)| key.as_string().is_some_and(|s| s == k)) + .map(|(_, l)| l.clone()) + .unwrap(); + let reached = w.wait(); + async move { + drop(reached); + Ok(latch.wait().await) + } + }, + |_, _| async {}, + ), + )] + }); + // Suspended in `wait`, so the call is started and its data saved. + let (answer, ran) = suspend_at( + &rt, + "return (await job()) + 1", + &ProgramOptions::new().run_id("d"), + &waiting, + || {}, + ); + answer.unwrap(); + let suspended = suspended(ran); + let latch = jobs.lock().unwrap()[0].1.clone(); + assert_eq!(jobs.lock().unwrap()[0].0, "d:0"); + latch.open(HostValue::Number(41.0)); + let outcome = done( + rt.resume(&suspended.state) + .unwrap() + .run_resumable() + .unwrap(), + ); + assert_eq!(outcome.result.unwrap(), json!(42)); +} + +// ---------- translate ---------- + +type Calls = Arc>>>; + +fn translating(translate: Translate, limits: Limits) -> (Runtime, Calls) { + let calls: Calls = Arc::default(); + let kept = calls.clone(); + let rt = Runtime::make() + .translate(translate) + .limits(limits) + .globals(move |_| { + let (keep, send) = (kept.clone(), kept.clone()); + [ + ( + "keep", + HostFunction::new(move |args, _| { + keep.lock().unwrap().push(args); + HostValue::Undefined + }), + ), + ( + "send", + HostFunction::new_async(move |args, _| { + send.lock().unwrap().push(args); + async { Ok(HostValue::Undefined) } + }), + ), + ( + "later", + HostFunction::new_async(|args, _| async move { Ok(args[0].clone()) }), + ), + ("never", HostFunction::new_async(|_, _| never())), + ] + }); + (rt, calls) +} + +fn json_of(calls: &Calls) -> Json { + Json::Array( + calls + .lock() + .unwrap() + .iter() + .map(|args| { + Json::Array( + args.iter() + .map(|a| a.to_json().unwrap_or(json!("undefined"))) + .collect(), + ) + }) + .collect(), + ) +} + +#[test] +fn by_default_a_function_or_a_promise_inside_an_argument_fails_the_call() { + let (strict, _) = translating(Translate::default(), Limits::default()); + for (code, message) in [ + ( + "keep({ f() {} })", + "Argument 1 to keep contains a function, which cannot be passed to the host.", + ), + ( + "keep([Promise.resolve(1)])", + "Argument 1 to keep contains an un-awaited Promise, which cannot be passed", + ), + ( + "await send(() => 1)", + "Argument 1 to send contains a function", + ), + ] { + let e = error(&strict, code); + assert!(e.message_lossy().contains(message), "{code}: {}", e.message); + } +} + +#[test] +fn functions_drop_leaves_functions_out_as_json_stringify_does() { + let (rt, calls) = translating( + Translate { + functions: TranslateFunctions::Drop, + ..Translate::default() + }, + Limits::default(), + ); + value( + &rt, + r#"keep({ q: "x", format(v) { return v }, nested: { f: Math.max } }, [1, () => 2, keep], () => 3, new Map([["k", () => 1]]))"#, + ); + let args = calls.lock().unwrap()[0].clone(); + assert_eq!(args[0].to_json(), Some(json!({ "q": "x", "nested": {} }))); + assert_eq!(args[1].to_json(), Some(json!([1, null, null]))); + assert!(matches!(args[2], HostValue::Undefined)); + assert!( + matches!(&args[3], HostValue::Map(m) if m.len() == 1 && matches!(m[0].1, HostValue::Undefined)) + ); + let e = error(&rt, "keep({ p: Promise.resolve(1) })"); + assert!( + e.message_lossy().contains("un-awaited Promise"), + "{}", + e.message + ); +} + +#[test] +fn promises_await_waits_for_every_promise_inside_the_arguments_and_uses_its_value() { + let (rt, calls) = translating( + Translate { + promises: TranslatePromises::Await, + ..Translate::default() + }, + Limits::default(), + ); + assert_eq!( + value( + &rt, + r#" + const slow = (async () => { await null; await null; return "slow" })() + const a = keep({ n: Promise.resolve(5), list: [later(1), slow] }, later({ deep: later(2) })) + const b = await send(slow, new Promise((resolve) => resolve(later(3)))) + return [a, b] + "# + ), + json!([null, null]) + ); + assert_eq!( + json_of(&calls), + json!([[{ "n": 5, "list": [1, "slow"] }, { "deep": 2 }], ["slow", 3]]) + ); + let e = error(&rt, "keep({ f() {} })"); + assert!( + e.message_lossy().contains("contains a function"), + "{}", + e.message + ); +} + +#[test] +fn promises_await_fails_the_call_with_a_rejections_reason() { + let (rt, calls) = translating( + Translate { + promises: TranslatePromises::Await, + ..Translate::default() + }, + Limits::default(), + ); + assert_eq!( + value( + &rt, + r#" + const failing = () => Promise.reject(new RangeError("nope")) + let thrown + try { keep({ n: failing() }) } catch (error) { thrown = error } + const sent = send([later(1), failing()]) + return [thrown instanceof RangeError, thrown.message, sent instanceof Promise, await sent.catch((e) => e.message)] + "# + ), + json!([true, "nope", true, "nope"]) + ); + assert!(calls.lock().unwrap().is_empty()); +} + +#[test] +fn promises_await_waits_on_a_promise_that_never_settles_until_the_timeout() { + let (rt, _) = translating( + Translate { + promises: TranslatePromises::Await, + ..Translate::default() + }, + Limits { + timeout_ms: Some(50), + ..Limits::default() + }, + ); + assert_eq!( + error(&rt, "keep({ n: never() })").kind.name(), + "TimeoutExceeded" + ); +} + +#[test] +fn promises_await_keeps_waiting_across_a_suspend() { + let gate = Latch::default(); + let calls: Calls = Arc::default(); + let (g, kept) = (gate.clone(), calls.clone()); + let rt = Runtime::make() + .translate(Translate { + promises: TranslatePromises::Await, + ..Translate::default() + }) + .globals(move |_| { + let (g, kept) = (g.clone(), kept.clone()); + [ + ( + "keep", + HostFunction::new(move |args, _| { + kept.lock().unwrap().push(args); + HostValue::from("kept") + }), + ), + ( + "slow", + HostFunction::new_async(move |_, _| { + let wait = g.wait(); + async move { Ok(wait.await) } + }) + .idempotent(), + ), + ] + }); + let (answer, ran) = suspend_at( + &rt, + "return [keep({ n: slow() }), await slow()]", + &ProgramOptions::new(), + &gate, + || {}, + ); + answer.unwrap(); + let suspended = suspended(ran); + assert!(calls.lock().unwrap().is_empty()); + gate.open(HostValue::Number(7.0)); + let outcome = done( + rt.resume(&suspended.state) + .unwrap() + .run_resumable() + .unwrap(), + ); + assert_eq!(outcome.result.unwrap(), json!(["kept", 7])); + assert_eq!(json_of(&calls), json!([[{ "n": 7 }]])); +} + +#[test] +fn metadata_and_durable_data_keep_unpaired_surrogates_across_a_suspend() { + let lone = HostString::from_utf16(&[u16::from(b'a'), 0xd800]); + let waiting = Latch::default(); + let (w, kept) = (waiting.clone(), lone.clone()); + let seen: Arc>> = Arc::default(); + let saw = seen.clone(); + let rt = Runtime::make().globals(move |run| { + let (run, w, kept, saw) = (run.clone(), w.clone(), kept.clone(), saw.clone()); + [ + ( + "remember", + HostValue::from(HostFunction::new(move |args, _| { + run.set_metadata(psychoscript::Data::String( + args[0].as_host_string().unwrap(), + )); + HostValue::Undefined + })), + ), + ( + "job", + DurableFunction::new( + move |_, _| { + let data = psychoscript::Data::String(kept.clone()); + async move { Ok(data) } + }, + move |data, _| { + saw.lock().unwrap().push(data.clone()); + let wait = w.wait(); + async move { Ok(wait.await) } + }, + |_, _| async {}, + ) + .into(), + ), + ] + }); + let (answer, ran) = suspend_at( + &rt, + r#"remember("a\ud800"); return await job()"#, + &ProgramOptions::new(), + &waiting, + || {}, + ); + answer.unwrap(); + let state = suspended(ran).state; + waiting.open(HostValue::Number(1.0)); + let outcome = done( + rt.resume_bytes(&to_bytes(&state)) + .unwrap() + .run_resumable() + .unwrap(), + ); + assert_eq!(outcome.metadata, psychoscript::Data::String(lone.clone())); + assert_eq!( + *seen.lock().unwrap(), + vec![psychoscript::Data::String(lone.clone()); 2] + ); +} + +fn compiled(rt: &Runtime, code: &str) -> psychoscript::Compiled { + rt.compile(code) + .unwrap_or_else(|d| panic!("expected a compiled program, got {}", d.message)) +} + +fn twice_runtime() -> Runtime { + Runtime::make().globals(|_| { + [( + "twice", + HostFunction::new(|args, _| HostValue::Number(num(&args[0]) * 2.0)), + )] + }) +} + +/// A run's result and logs, to compare two runs. +fn shown(o: &Outcome) -> String { + format!("{:?} {:?}", o.result, o.logs) +} + +#[test] +fn a_compiled_program_runs_as_its_source_does_again_and_at_once_with_each_runs_bindings() { + let rt = twice_runtime(); + let code = "let n = 0; for (const x of xs) n += twice(x); return [n, typeof seen]"; + let program = compiled(&rt, code); + let with = |xs: Json| ProgramOptions::new().bindings([("xs", xs)]); + let results: Vec = std::thread::scope(|s| { + let runs: Vec<_> = [json!([1]), json!([2, 3]), json!([4, 5, 6])] + .into_iter() + .map(|xs| { + let (rt, program, options) = (&rt, program.clone(), with(xs)); + s.spawn(move || rt.execute_with(&program, &options).json().unwrap()) + }) + .collect(); + runs.into_iter().map(|r| r.join().unwrap()).collect() + }); + assert_eq!( + results, + vec![ + json!([2, "undefined"]), + json!([10, "undefined"]), + json!([30, "undefined"]) + ] + ); + let options = with(json!([7])); + assert_eq!( + shown(&rt.execute_with(&program, &options)), + shown(&rt.execute_with(code, &options)) + ); +} + +#[test] +fn compiling_gives_the_diagnostic_a_run_would_fail_with_first_unsupported_syntax_still_fails_where_it_runs() + { + let rt = twice_runtime(); + for code in [" ", "return (", "export const x = 1"] { + let d = rt.compile(code).expect_err(code); + assert_eq!( + format!("{:?}", Err::<(), _>(d)), + format!("{:?}", rt.execute(code).result) + ); + } + let unsupported = "const a = 1; class A {}"; + assert_eq!( + shown(&rt.execute(&compiled(&rt, unsupported))), + shown(&rt.execute(unsupported)) + ); +} + +#[test] +fn a_state_saved_from_a_compiled_program_is_its_sources_and_resumes_like_it() { + let gate = Latch::default(); + let g = gate.clone(); + let rt = Runtime::make().globals(move |_| { + let g = g.clone(); + [( + "wait", + HostFunction::new_async(move |_, _| { + let wait = g.wait(); + async move { Ok(wait.await) } + }) + .idempotent(), + )] + }); + let code = "const a = 20; await wait(); return a + 22"; + let program = compiled(&rt, code); + let options = ProgramOptions::new().run_id("c"); + let (answer, ran) = suspend_at(&rt, &program, &options, &gate, || {}); + answer.unwrap(); + let state = suspended(ran).state; + assert_eq!(state.0["header"]["source"]["code"], json!(code)); + gate.open(HostValue::Undefined); + let outcome = done( + rt.resume_bytes(&to_bytes(&state)) + .unwrap() + .run_resumable() + .unwrap(), + ); + assert_eq!(outcome.result.unwrap(), json!(42)); +} diff --git a/packages/codemode-rust/crates/psychoscript/tests/host_recording.rs b/packages/codemode-rust/crates/psychoscript/tests/host_recording.rs new file mode 100644 index 0000000000000..44704b36a804d --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/tests/host_recording.rs @@ -0,0 +1,531 @@ +//! Host functions against the reference's behaviour recorded in `conformance/host.json` by `bun conformance/host.ts`: +//! call keys, sync, async and sync-thenable functions, constructible ones, functions that take functions, idempotent +//! and durable calls across a suspend, failures, namespaces, run metadata, translation, limits and compiled programs. +//! The globals are the generator's. + +use std::future::Future; +use std::pin::Pin; +use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; +use std::sync::{Arc, Mutex}; +use std::task::{Context, Poll, Wake, Waker}; +use std::time::Duration; + +use psychoscript::{ + Diagnostic, DurableFunction, Failure, HostFunction, HostValue, Json, Limits, Namespace, + Outcome, ProgramOptions, Resolved, Returned, RunOutcome, Runtime, Translate, + TranslateFunctions, TranslatePromises, to_bytes, +}; +use serde_json::json; + +#[path = "../../../conformance/reference.rs"] +mod reference; + +use reference::describe; + +type Log = Arc>>; + +/// What an entry's globals share: the log, whether the entry resumed, how often the globals were made, and whether a +/// call reached a point that never settles before the resume. +#[derive(Clone, Default)] +struct State { + log: Log, + resumed: Arc, + made: Arc, + started: Arc, + wakers: Arc>>, +} + +impl State { + fn push(&self, entry: Json) { + self.log.lock().unwrap().push(entry); + } + + /// Settles with `value` once the entry resumed; until then it never settles, and says a call reached it. + fn pending(&self, value: f64) -> Pending { + if !self.resumed.load(Ordering::SeqCst) { + self.started.store(true, Ordering::SeqCst); + } + Pending { + state: self.clone(), + value, + } + } +} + +struct Pending { + state: State, + value: f64, +} + +impl Future for Pending { + type Output = psychoscript::HostResult; + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + if self.state.resumed.load(Ordering::SeqCst) { + return Poll::Ready(Ok(HostValue::Number(self.value))); + } + self.state.wakers.lock().unwrap().push(cx.waker().clone()); + Poll::Pending + } +} + +fn described(args: &[HostValue]) -> Json { + Json::Array(args.iter().map(describe).collect()) +} + +fn num(v: Option<&HostValue>) -> f64 { + v.and_then(HostValue::as_f64).unwrap_or(f64::NAN) +} + +/// The generator's globals for a run. +fn globals(state: &State, run: &psychoscript::Run) -> Vec<(String, HostValue)> { + state.made.fetch_add(1, Ordering::SeqCst); + let s = state.clone(); + let one = |f: HostFunction| HostValue::from(f.length(1)); + let read = || { + HostFunction::new(|_, _| HostValue::from("called")) + .named("read") + .takes_functions() + }; + let (note, post, never, grab, wait) = (s.clone(), s.clone(), s.clone(), s.clone(), s.clone()); + let (start, waited, cancel) = (s.clone(), s.clone(), s.clone()); + let counting = run.clone(); + vec![ + ( + "double".into(), + one(HostFunction::new(|args, _| { + HostValue::Number(num(args.first()) * 2.0) + })), + ), + ( + "inc".into(), + one(HostFunction::new(|args, _| { + HostValue::Number(num(args.first()) + 1.0) + })), + ), + ( + "promised".into(), + one(HostFunction::new(|args, _| { + let n = args.first().cloned().unwrap_or_default(); + Returned::Pending(Box::pin(async move { Ok(n) })) + })), + ), + ( + "load".into(), + one(HostFunction::new_async(|args, _| async move { + Ok(args.into_iter().next().unwrap_or_default()) + })), + ), + ( + "find".into(), + one(HostFunction::new(|_, _| { + HostValue::object([("items", HostValue::array([1.0.into(), 2.0.into()]))]) + }) + .thenable()), + ), + ( + "note".into(), + HostFunction::new(move |args, call| { + note.push(json!(["note", call.key(), described(&args)])); + HostValue::Undefined + }) + .length(2) + .into(), + ), + ( + "post".into(), + HostFunction::new_async(move |args, call| { + let post = post.clone(); + async move { + post.push(json!(["post", call.key(), described(&args)])); + Ok(HostValue::Undefined) + } + }) + .length(2) + .into(), + ), + ( + "never".into(), + HostFunction::new_async(move |_, call| { + never.push(json!(["never", call.key()])); + let pending = never.pending(f64::NAN); + async move { + let _ = pending.await; + std::future::pending().await + } + }) + .length(2) + .into(), + ), + ( + "open".into(), + one(HostFunction::new(move |_, _| { + HostValue::object([("read", read().into())]) + })), + ), + ( + "takes".into(), + one(HostFunction::new(|args, _| { + let read = args.first().and_then(|a| a.get("read")); + HostValue::Bool(matches!(read, Some(HostValue::Function(f)) if f.name() == "read")) + }) + .takes_functions()), + ), + ( + "refuses".into(), + one(HostFunction::new(|_, _| HostValue::Bool(true))), + ), + ( + "grab".into(), + HostFunction::new_async(move |_, call| { + grab.push(json!(["grab", call.key()])); + grab.pending(3.0) + }) + .idempotent() + .takes_functions() + .length(2) + .into(), + ), + ( + "Box".into(), + one(HostFunction::new(|args, _| { + HostValue::object([("item", args.into_iter().next().unwrap_or_default())]) + }) + .constructible()), + ), + ( + "Later".into(), + one(HostFunction::new(|args, _| { + HostValue::object([("item", args.into_iter().next().unwrap_or_default())]) + }) + .constructible()), + ), + ( + "refuse".into(), + one(HostFunction::new(|_, _| -> psychoscript::HostResult { + Err(Failure::new("Refused", "Not today") + .suggestions(["Ask again."]) + .into()) + })), + ), + ( + "api".into(), + Namespace::new( + |path| { + Ok(match path.len() { + 0 => vec!["issues".into()], + _ => vec!["list".into()], + }) + }, + |path| -> Resolved { + if reference::joined(path) == "issues.list" { + return HostFunction::new_async(|_, _| async { + Ok(HostValue::array(["#1".into()])) + }) + .length(1) + .into(); + } + Failure::missing(format!("No api.{}", reference::joined(path))) + .suggestions(["Try api.issues.list."]) + .kind("NotFound") + .into() + }, + ) + .into(), + ), + ( + "count".into(), + one(HostFunction::new(move |_, _| { + counting.update_metadata(|m| { + let mut j = m.to_json(); + if j.is_null() { + j = json!({ "count": 0 }); + } + let n = j["count"].as_i64().unwrap_or(0) + 1; + j["count"] = json!(n); + *m = j.into(); + HostValue::Number(n as f64) + }) + })), + ), + ( + "wait".into(), + HostFunction::new_async(move |_, call| { + wait.push(json!(["wait", call.key()])); + wait.pending(7.0) + }) + .idempotent() + .length(2) + .into(), + ), + ( + "job".into(), + DurableFunction::new( + move |args, call| { + start.push(json!(["job.start", call.key(), described(&args)])); + let key = call.key(); + async move { Ok(key.into()) } + }, + move |data, call| { + waited.push(json!([ + "job.wait", + data.to_json(), + call.key(), + described(&call.args) + ])); + waited.pending(41.0) + }, + move |data, call| { + cancel.push(json!(["job.cancel", data.to_json(), call.key()])); + async {} + }, + ) + .into(), + ), + ] +} + +fn runtime(entry: &Json, state: &State) -> Runtime { + let translate = Translate { + functions: match entry["translate"]["functions"].as_str() { + Some("drop") => TranslateFunctions::Drop, + _ => TranslateFunctions::Error, + }, + promises: match entry["translate"]["promises"].as_str() { + Some("await") => TranslatePromises::Await, + _ => TranslatePromises::Error, + }, + }; + let limits = Limits { + timeout_ms: entry["limits"]["timeoutMs"].as_u64(), + max_output_bytes: entry["limits"]["maxOutputBytes"] + .as_u64() + .map(|n| n as usize), + }; + let state = state.clone(); + Runtime::make() + .translate(translate) + .limits(limits) + .globals(move |run| globals(&state, run)) +} + +fn diagnostic(d: &Diagnostic) -> Json { + let mut out = json!({ "kind": d.kind.name(), "message": d.message_lossy() }); + if let Some((line, column)) = d.location { + out["location"] = json!({ "line": line, "column": column }); + } + if !d.suggestions.is_empty() { + out["suggestions"] = json!(d.suggestions_lossy()); + } + out +} + +/// The run's `Result` as the reference gives it. +fn result(o: &Outcome) -> Json { + let mut out = match &o.result { + Ok(value) => json!({ "ok": true, "value": value.to_json() }), + Err(d) => json!({ "ok": false, "error": diagnostic(d) }), + }; + if !o.warnings.is_empty() { + out["warnings"] = Json::Array(o.warnings.iter().map(diagnostic).collect()); + } + if !o.logs.is_empty() { + out["logs"] = json!(o.log_lines()); + } + if o.truncated { + out["truncated"] = json!(true); + } + out["metadata"] = o.metadata.to_json(); + out +} + +/// JSON equality where numbers compare by value and object keys in any order. +fn same(a: &Json, b: &Json) -> bool { + match (a, b) { + (Json::Number(x), Json::Number(y)) => x.as_f64() == y.as_f64(), + (Json::Array(x), Json::Array(y)) => { + x.len() == y.len() && x.iter().zip(y).all(|(x, y)| same(x, y)) + } + (Json::Object(x), Json::Object(y)) => { + x.len() == y.len() && x.iter().all(|(k, v)| y.get(k).is_some_and(|w| same(v, w))) + } + _ => a == b, + } +} + +fn fixture() -> Json { + let path = concat!(env!("CARGO_MANIFEST_DIR"), "/../../conformance/host.json"); + serde_json::from_str(&std::fs::read_to_string(path).unwrap()).unwrap() +} + +fn roundtrip() -> bool { + std::env::var_os("PSYCHOSCRIPT_ROUNDTRIP").is_some_and(|v| v == "1") +} + +#[test] +fn host_functions_match_the_reference() { + let fixture = fixture(); + let executes = fixture["executes"].as_array().unwrap(); + assert!(executes.len() >= 50); + let mut failures = Vec::new(); + for entry in executes { + let state = State::default(); + let rt = runtime(entry, &state); + let code = entry["code"].as_str().unwrap(); + let options = ProgramOptions::new().run_id(entry["runId"].as_str().unwrap()); + let mut actual = json!({}); + if entry["compiled"] == json!(true) { + match rt.compile(code) { + Ok(compiled) => { + actual["compile"] = json!({ "ok": true }); + actual["outcome"] = result(&rt.execute_with(&compiled, &options)); + actual["again"] = result(&rt.execute_with(&compiled, &options)); + } + Err(d) => { + actual["compile"] = json!({ "ok": false, "error": diagnostic(&d) }); + actual["outcome"] = result(&rt.execute_with(code, &options)); + } + } + } else { + actual["outcome"] = result(&rt.execute_with(code, &options)); + } + actual["log"] = json!(*state.log.lock().unwrap()); + let mut expected = json!({}); + for key in ["compile", "outcome", "again", "log"] { + if let Some(v) = entry.get(key) { + expected[key] = v.clone(); + } + } + if !same(&actual, &expected) { + failures.push(format!( + "{code}\n expected {expected}\n actual {actual}" + )); + } + } + assert!( + failures.is_empty(), + "{} mismatches:\n{}", + failures.len(), + failures.join("\n") + ); +} + +/// Wakes the thread that drives a run. +struct Unpark(std::thread::Thread); + +impl Wake for Unpark { + fn wake(self: Arc) { + self.0.unpark(); + } +} + +#[test] +fn suspending_runs_that_call_host_functions_matches_the_reference() { + let fixture = fixture(); + let suspensions = fixture["suspensions"].as_array().unwrap(); + assert!(suspensions.len() >= 10); + let mut failures = Vec::new(); + for entry in suspensions { + let state = State::default(); + let rt = runtime(entry, &state); + let code = entry["code"].as_str().unwrap(); + let options = ProgramOptions::new().run_id(entry["runId"].as_str().unwrap()); + let compiled = (entry["compiled"] == json!(true)).then(|| rt.compile(code).unwrap()); + let program = match &compiled { + Some(c) => rt.program(c, &options), + None => rt.program(code, &options), + }; + let suspender = program.suspender(); + // This thread drives the run, as the reference's fiber; another suspends it once a call reached a point that + // never settles before the resume. A failed suspend interrupts the run, which drops it. + let (suspend, ran) = std::thread::scope(|s| { + let started = state.started.clone(); + let asking = s.spawn(move || { + while !started.load(Ordering::SeqCst) { + std::thread::sleep(Duration::from_millis(1)); + } + suspender.suspend(None) + }); + let waker = Waker::from(Arc::new(Unpark(std::thread::current()))); + let mut cx = Context::from_waker(&waker); + let mut run = Box::pin(program.run_resumable_async()); + loop { + if let Poll::Ready(ran) = run.as_mut().poll(&mut cx) { + break (asking.join().unwrap(), Some(ran.unwrap())); + } + if asking.is_finished() { + let answer = asking.join().unwrap(); + if answer.is_err() { + drop(run); + break (answer, None); + } + let ran = loop { + if let Poll::Ready(ran) = run.as_mut().poll(&mut cx) { + break ran.unwrap(); + } + std::thread::park_timeout(Duration::from_millis(1)); + }; + break (answer, Some(ran)); + } + std::thread::park_timeout(Duration::from_millis(1)); + } + }); + let mut actual = json!({}); + match (&suspend, ran) { + (Err(e), _) => { + actual["suspend"] = json!({ + "ok": false, + "message": e.message, + "running": e.running.iter().map(|c| json!({ "key": c.key, "path": c.path })).collect::>(), + }); + } + (Ok(RunOutcome::Done(o)), _) => { + actual["suspend"] = json!({ "ok": false, "outcome": result(o) }); + } + (Ok(RunOutcome::Suspended(answer)), Some(RunOutcome::Suspended(saved))) => { + actual["suspend"] = json!({ + "ok": true, + "metadata": answer.state.0["header"]["metadata"], + "same": answer.state == saved.state, + }); + state.resumed.store(true, Ordering::SeqCst); + for w in state.wakers.lock().unwrap().drain(..) { + w.wake(); + } + let resumed = rt + .resume_bytes(&to_bytes(&answer.state)) + .unwrap() + .run_resumable() + .unwrap(); + actual["resume"] = match resumed { + RunOutcome::Done(o) => result(&o), + RunOutcome::Suspended(_) => json!("suspended again"), + }; + } + (Ok(_), _) => actual["suspend"] = json!("suspended, but the run went on"), + } + // The reference's round-trip mode makes the globals more often. + if !roundtrip() { + actual["made"] = json!(state.made.load(Ordering::SeqCst)); + } + actual["log"] = Json::Array(state.log.lock().unwrap().clone()); + let mut expected = json!({ "suspend": entry["suspend"] }); + if let Some(resume) = entry.get("resume") { + expected["resume"] = resume.clone(); + } + if !roundtrip() { + expected["made"] = entry["made"].clone(); + } + expected["log"] = entry["log"].clone(); + if !same(&actual, &expected) { + failures.push(format!( + "{code}\n expected {expected}\n actual {actual}" + )); + } + } + assert!( + failures.is_empty(), + "{} mismatches:\n{}", + failures.len(), + failures.join("\n") + ); +} diff --git a/packages/codemode-rust/crates/psychoscript/tests/map_compaction.rs b/packages/codemode-rust/crates/psychoscript/tests/map_compaction.rs new file mode 100644 index 0000000000000..206e039872eda --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/tests/map_compaction.rs @@ -0,0 +1,367 @@ +//! Map and Set iteration while deleted entries are compacted away: iterators, `forEach` and the Set methods continue +//! past deletes and inserts, skip what was deleted before they reached it, see what was added, and continue after +//! `clear()`, also across a suspend in the middle of a walk. The expected values are what JavaScript engines give. + +use std::sync::{Arc, Condvar, Mutex}; +use std::thread; +use std::time::Duration; + +use psychoscript::{HostFunction, HostValue, Json, ProgramOptions, RunOutcome, Runtime}; +use serde_json::json; + +fn value(code: &str) -> Json { + match Runtime::make().execute(code).result { + Ok(v) => v.to_json(), + Err(e) => panic!("expected success, got {}: {}", e.kind, e.message), + } +} + +#[test] +fn for_of_over_a_map_continues_across_compaction() { + let code = r#" + const m = new Map() + for (let i = 0; i < 100; i++) m.set(i, i) + const seen = [] + for (const [k, v] of m) { + seen.push([k, v]) + if (k === 10) { + for (let i = 0; i < 10; i++) m.delete(i) + for (let i = 20; i < 100; i++) if (i % 10 !== 0) m.delete(i) + m.set(5, "again") + m.set(200, 200) + } + if (k === 200) { + m.clear() + m.set(300, 300) + m.set(301, 301) + } + if (k === 300) m.delete(301) + } + return seen"#; + let mut expected: Vec = (0..20).map(|i| json!([i, i])).collect(); + expected.extend((20..100).step_by(10).map(|i| json!([i, i]))); + expected.extend([json!([5, "again"]), json!([200, 200]), json!([300, 300])]); + assert_eq!(value(code), Json::Array(expected)); +} + +#[test] +fn for_of_over_a_set_continues_across_compaction() { + let code = r#" + const s = new Set() + for (let i = 0; i < 100; i++) s.add(i) + const seen = [] + for (const v of s) { + seen.push(v) + if (v === 3) for (let i = 0; i < 90; i++) if (i !== 50) s.delete(i) + if (v === 50) { s.add(1); s.add(1000) } + } + return seen"#; + assert_eq!( + value(code), + json!([ + 0, 1, 2, 3, 50, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 1, 1000 + ]) + ); +} + +#[test] +fn keys_values_and_entries_iterators_continue_across_compaction_and_clear() { + let code = r#" + const m = new Map() + for (let i = 0; i < 50; i++) m.set("k" + i, i) + const keys = m.keys(), values = m.values(), entries = m.entries() + const out = [keys.next().value, values.next().value, entries.next().value] + for (let i = 0; i < 45; i++) m.delete("k" + i) + m.set("new", -1) + out.push(keys.next().value, values.next().value, entries.next().value) + for (let i = 46; i < 50; i++) m.delete("k" + i) + out.push(keys.next().value, values.next().value, entries.next().value) + m.clear() + m.set("after", 1) + out.push(keys.next().value, values.next().value, entries.next().value) + out.push(keys.next().done, values.next().done, entries.next().done) + m.set("late", 2) + out.push(keys.next().done, values.next().done, entries.next().done) + return out"#; + assert_eq!( + value(code), + json!([ + "k0", + 0, + ["k0", 0], + "k45", + 45, + ["k45", 45], + "new", + -1, + ["new", -1], + "after", + 1, + ["after", 1], + true, + true, + true, + true, + true, + true + ]) + ); + let code = r#" + const s = new Set() + for (let i = 0; i < 80; i++) s.add(i) + const it = s.values(), en = s.entries() + const out = [it.next().value, en.next().value] + s.add(-1) + for (let i = 1; i < 79; i++) s.delete(i) + out.push(it.next().value, en.next().value, it.next().value, en.next().value) + s.delete(-1) + s.add(5) + out.push(it.next().value, en.next().value, it.next().done, en.next().done) + return out"#; + assert_eq!( + value(code), + json!([0, [0, 0], 79, [79, 79], -1, [-1, -1], 5, [5, 5], true, true]) + ); +} + +#[test] +fn for_each_continues_across_compaction_and_clear() { + let code = r#" + const m = new Map() + for (let i = 0; i < 100; i++) m.set(i, "v" + i) + const seen = [] + m.forEach((v, k, map) => { + seen.push(k + ":" + v) + if (k === 2) for (let i = 0; i < 2; i++) map.delete(i) + if (k === 4) for (let i = 5; i < 98; i++) if (i % 30 !== 0) map.delete(i) + if (k === 30) { map.set(0, "back"); map.delete(60) } + if (v === "back") { map.clear(); map.set("x", 1) } + }) + const s = new Set() + for (let i = 0; i < 100; i++) s.add(i) + s.add("last") + s.forEach(v => { + seen.push(v) + if (v === 0) for (let i = 1; i < 99; i++) s.delete(i) + if (v === 99) s.add("tail") + }) + return seen"#; + assert_eq!( + value(code), + json!([ + "0:v0", "1:v1", "2:v2", "3:v3", "4:v4", "30:v30", "90:v90", "98:v98", "99:v99", + "0:back", "x:1", 0, 99, "last", "tail" + ]) + ); +} + +#[test] +fn set_methods_continue_when_their_walk_is_compacted() { + let code = r#" + const range = (a, b) => Array.from({ length: b - a }, (_, i) => a + i) + const out = {} + // A built-in has: difference deletes from the Set it builds while walking it. + out.differenceBuiltin = [...new Set(range(0, 100)).difference(new Set([...range(0, 97), 500, 501, 502, 503]))] + // A has the program wrote, asked from a native frame. + out.difference = [...new Set(range(0, 100)).difference({ size: 1000, has: x => x < 97, keys: () => [].values() })] + const a = new Set(range(0, 100)) + out.intersection = [...a.intersection({ + size: 1000, + has(x) { + if (x === 5) for (let i = 6; i < 90; i++) a.delete(i) + return x % 2 === 0 + }, + keys: () => [].values(), + })] + const b = new Set(range(0, 100)) + const asked = [] + out.isSubsetOf = b.isSubsetOf({ + size: 1000, + has(x) { + asked.push(x) + if (x === 0) for (let i = 1; i < 99; i++) b.delete(i) + return true + }, + keys: () => [].values(), + }) + out.asked = asked + const c = new Set(range(0, 100)) + out.isDisjointFrom = c.isDisjointFrom({ + size: 1000, + has(x) { + if (x === 1) { for (let i = 2; i < 99; i++) c.delete(i); c.add(-5) } + return x === -5 + }, + keys: () => [].values(), + }) + const d = new Set(range(0, 100)) + out.union = [...new Set(["a"]).union({ + size: 100, + has: () => false, + keys() { + const it = d.keys() + return { + next() { + const r = it.next() + if (r.value === 3) for (let i = 4; i < 95; i++) d.delete(i) + return r + }, + } + }, + })] + return out"#; + assert_eq!( + value(code), + json!({ + "differenceBuiltin": [97, 98, 99], + "difference": [97, 98, 99], + "intersection": [0, 2, 4, 90, 92, 94, 96, 98], + "isSubsetOf": true, + "asked": [0, 99], + "isDisjointFrom": false, + "union": ["a", 0, 1, 2, 3, 95, 96, 97, 98, 99] + }) + ); +} + +/// Marks that the program called `reached()`, after which it busy-waits so a suspend lands mid-walk. +#[derive(Clone, Default)] +struct Reached(Arc<(Mutex, Condvar)>); + +impl Reached { + fn mark(&self) { + let (m, c) = &*self.0; + *m.lock().unwrap() = true; + c.notify_all(); + } + + fn wait(&self) { + let (m, c) = &*self.0; + let mut r = m.lock().unwrap(); + while !*r { + r = c.wait_timeout(r, Duration::from_millis(10)).unwrap().0; + } + } +} + +fn reaching(reached: Reached) -> Runtime { + Runtime::make().globals(move |_| { + let reached = reached.clone(); + [( + "reached", + HostFunction::new(move |_, _| { + reached.mark(); + HostValue::Undefined + }), + )] + }) +} + +/// Suspends `code` while it busy-waits after `reached()`, resumes it from bytes in a fresh runtime, and gives its +/// result. +fn suspended_mid_walk(code: &str) -> Json { + let reached = Reached::default(); + let rt = reaching(reached.clone()); + let program = rt.program(code, &ProgramOptions::new()); + let suspender = program.suspender(); + let (outcome, answer) = thread::scope(|s| { + let h = s.spawn(move || { + reached.wait(); + // The suspend is refused while `reached()` itself runs. + for _ in 0..1000 { + match suspender.suspend(None) { + Err(e) if !e.running.is_empty() => thread::sleep(Duration::from_millis(1)), + other => return other, + } + } + suspender.suspend(None) + }); + (program.run_resumable().unwrap(), h.join().unwrap()) + }); + let RunOutcome::Suspended(state) = outcome else { + panic!("expected a suspended run, got {answer:?}"); + }; + let fresh = reaching(Reached::default()); + let resumed = fresh + .resume_bytes(&psychoscript::to_bytes(&state.state)) + .unwrap() + .run_resumable() + .unwrap(); + match resumed { + RunOutcome::Done(o) => o.result.unwrap().to_json(), + RunOutcome::Suspended(_) => panic!("expected the resumed run to end"), + } +} + +#[test] +fn a_for_of_suspended_after_compaction_resumes_where_it_was() { + let code = r#" + const m = new Map() + for (let i = 0; i < 100; i++) m.set(i, i) + const seen = [] + for (const [k] of m) { + seen.push(k) + if (k === 10) { + for (let i = 0; i < 10; i++) m.delete(i) + for (let i = 20; i < 100; i++) if (i % 10 !== 0) m.delete(i) + reached() + const t = Date.now(); while (Date.now() - t < 300) {} + m.delete(30) + m.set(1, "again") + } + } + return seen"#; + let mut expected: Vec = (0..21).map(|i| json!(i)).collect(); + expected.extend([40, 50, 60, 70, 80, 90, 1].map(|i| json!(i))); + assert_eq!(suspended_mid_walk(code), Json::Array(expected)); +} + +#[test] +fn a_for_each_suspended_after_compaction_resumes_where_it_was() { + let code = r#" + const s = new Set() + for (let i = 0; i < 100; i++) s.add(i) + const seen = [] + s.forEach(v => { + seen.push(v) + if (v === 10) { + for (let i = 0; i < 95; i++) if (i % 20 !== 0) s.delete(i) + reached() + const t = Date.now(); while (Date.now() - t < 300) {} + s.delete(40) + s.add(7) + } + }) + return seen"#; + assert_eq!( + suspended_mid_walk(code), + json!([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 60, 80, 95, 96, 97, 98, 99, 7 + ]) + ); +} + +#[test] +fn a_set_method_suspended_after_compaction_resumes_where_it_was() { + let code = r#" + const a = new Set() + for (let i = 0; i < 100; i++) a.add(i) + return [...a.intersection({ + size: 1000, + has(x) { + if (x === 5) { + for (let i = 6; i < 90; i++) a.delete(i) + reached() + const t = Date.now(); while (Date.now() - t < 300) {} + a.delete(92) + a.add(200) + } + return x % 2 === 0 + }, + keys: () => [].values(), + })]"#; + assert_eq!( + suspended_mid_walk(code), + json!([0, 2, 4, 90, 94, 96, 98, 200]) + ); +} diff --git a/packages/codemode-rust/crates/psychoscript/tests/offload.rs b/packages/codemode-rust/crates/psychoscript/tests/offload.rs new file mode 100644 index 0000000000000..8c48933dc201d --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/tests/offload.rs @@ -0,0 +1,351 @@ +//! A run driven as a future moves long stretches of compute to a worker thread; host code never runs there. + +use std::future::Future; +use std::pin::Pin; +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::sync::{Arc, Mutex}; +use std::task::{Context, Poll, Waker}; +use std::thread::{self, ThreadId}; +use std::time::{Duration, Instant}; + +use psychoscript::{ + Data, DurableFunction, HostFunction, HostString, HostValue, HttpBody, Namespace, + ProgramOptions, Returned, RunOutcome, Runtime, StreamingResponse, +}; +use serde_json::json; + +/// Counts the host code that ran, and how much of it ran off the thread that drives the run. +#[derive(Clone)] +struct Witness { + driver: ThreadId, + ran: Arc, + strays: Arc, +} + +impl Witness { + fn new() -> Self { + Self { + driver: thread::current().id(), + ran: Arc::default(), + strays: Arc::default(), + } + } + + fn check(&self) { + self.ran.fetch_add(1, Ordering::SeqCst); + if thread::current().id() != self.driver { + self.strays.fetch_add(1, Ordering::SeqCst); + } + } +} + +fn first(args: Vec) -> HostValue { + args.into_iter().next().unwrap_or_default() +} + +/// Every kind of host code a program can reach, each noting where it runs: synchronous functions, one blocking the +/// program on work and one leaving work pending, an asynchronous function, a durable one, and a namespace. +fn runtime(w: &Witness) -> Runtime { + let w = w.clone(); + Runtime::make().globals(move |_| { + let (a, b, c, d, e, f) = ( + w.clone(), + w.clone(), + w.clone(), + w.clone(), + w.clone(), + w.clone(), + ); + let (start, wait) = (w.clone(), w.clone()); + let (keys, resolve) = (w.clone(), w.clone()); + vec![ + ( + "sync", + HostValue::from(HostFunction::new(move |args, _| { + a.check(); + Ok::<_, HostValue>(first(args)) + })), + ), + ( + "slow", + HostFunction::new_async(move |args, _| { + let b = b.clone(); + async move { + b.check(); + Ok(later(5, first(args)).await) + } + }) + .into(), + ), + ( + "block", + HostFunction::new(move |args, _| { + c.check(); + let c = c.clone(); + Returned::Block(Box::pin(async move { + c.check(); + Ok(later(5, first(args)).await) + })) + }) + .into(), + ), + ( + "pending", + HostFunction::new(move |args, _| { + d.check(); + let d = d.clone(); + Returned::Pending(Box::pin(async move { + d.check(); + Ok(first(args)) + })) + }) + .into(), + ), + ( + "durable", + DurableFunction::new( + move |_, _| { + let start = start.clone(); + async move { + start.check(); + Ok(Data::Null) + } + }, + move |_, _| { + let wait = wait.clone(); + async move { + wait.check(); + Ok(HostValue::Number(7.0)) + } + }, + |_, _| async {}, + ) + .into(), + ), + ( + "ns", + Namespace::new( + move |_| { + keys.check(); + Ok(vec![HostString::from("f")]) + }, + move |_| { + resolve.check(); + let e = e.clone(); + HostFunction::new(move |args, _| { + e.check(); + Ok::<_, HostValue>(first(args)) + }) + }, + ) + .into(), + ), + ( + "spare", + HostFunction::new(move |_, _| { + f.check(); + Ok::<_, HostValue>(HostValue::Undefined) + }) + .into(), + ), + ] + }) +} + +/// Each host call follows a stretch of compute long enough to move to the worker. +const BUSY_THEN_HOST: &str = " + const spin = (k) => { let n = 0; for (let i = 0; i < k; i++) n += i % 7; return n > 0 } + const a = spin(2e6) && sync(1) + const b = spin(2e6) && await slow(2) + const c = spin(2e6) && block(3) + const d = spin(2e6) && await pending(4) + const e = spin(2e6) && await durable() + const f = spin(2e6) && ns.f(5) + const g = spin(2e6) && Object.keys(ns).length + const h = spin(2e6) && await Promise.all([slow(6), sync(7)]) + return [a, b, c, d, e, f, g, h, spin(1e6)]"; + +#[test] +fn long_compute_leaves_the_executor_while_host_code_stays_on_it() { + let w = Witness::new(); + let rt = runtime(&w); + let options = ProgramOptions::new(); + let expected = json!([1, 2, 3, 4, 7, 5, 1, [6, 7], true]); + let started = Instant::now(); + let blocking = rt.execute(BUSY_THEN_HOST); + let whole = started.elapsed(); + assert_eq!(blocking.json().unwrap(), expected); + let ran_blocking = w.ran.swap(0, Ordering::SeqCst); + + let mut run = Box::pin(rt.execute_async(BUSY_THEN_HOST, &options)); + let started = Instant::now(); + assert!( + run.as_mut() + .poll(&mut Context::from_waker(Waker::noop())) + .is_pending() + ); + assert!( + started.elapsed() < whole / 4, + "the first poll held the executor for {:?} of {whole:?}", + started.elapsed() + ); + let outcome = drive(run).unwrap(); + assert_eq!(outcome.json().unwrap(), expected); + assert_eq!(w.ran.load(Ordering::SeqCst), ran_blocking); + assert_eq!(w.strays.load(Ordering::SeqCst), 0); +} + +/// A future that never ends and notes the thread it is dropped on. +struct Forever(Arc>>); + +impl Future for Forever { + type Output = Result; + + fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll { + Poll::Pending + } +} + +impl Drop for Forever { + fn drop(&mut self) { + *self.0.lock().unwrap() = Some(thread::current().id()); + } +} + +#[test] +fn dropping_a_run_away_on_its_worker_ends_it_here() { + let dropped = Arc::new(Mutex::new(None)); + let seen = dropped.clone(); + let rt = Runtime::make().globals(move |_| { + let seen = seen.clone(); + [( + "never", + HostFunction::new_async(move |_, _| Forever(seen.clone())), + )] + }); + let options = ProgramOptions::new(); + let mut run = Box::pin(rt.execute_async("never(); while (true) {}", &options)); + let waker = Waker::noop(); + assert!( + run.as_mut() + .poll(&mut Context::from_waker(waker)) + .is_pending() + ); + thread::sleep(Duration::from_millis(10)); + assert!( + run.as_mut() + .poll(&mut Context::from_waker(waker)) + .is_pending() + ); + drop(run); + assert_eq!(*dropped.lock().unwrap(), Some(thread::current().id())); +} + +#[test] +fn a_run_away_on_its_worker_suspends_and_resumes() { + let rt = Runtime::make(); + let code = "let n = 0; for (let i = 0; i < 2e9; i++) n++; return n > 0"; + let program = rt.program(code, &ProgramOptions::new()); + let suspender = program.suspender(); + let mut run = Box::pin(program.run_resumable_async()); + assert!( + run.as_mut() + .poll(&mut Context::from_waker(Waker::noop())) + .is_pending() + ); + let asked = thread::spawn(move || suspender.suspend(None)); + let outcome = drive(run).unwrap(); + let answer = asked.join().unwrap().unwrap(); + let (RunOutcome::Suspended(state), RunOutcome::Suspended(_)) = (outcome, answer) else { + panic!("expected a suspended run"); + }; + assert!(rt.resume(&state.state).is_ok()); +} + +/// A body whose `cancel` notes where it ran. +struct Cancelled(Witness); + +impl HttpBody for Cancelled { + fn poll_chunk(&mut self, _: &mut Context<'_>) -> Poll, HostValue>>> { + Poll::Ready(None) + } + + fn cancel(&mut self, _: HostValue) { + self.0.check(); + } +} + +#[test] +fn a_body_cancelled_while_its_run_is_on_a_worker_cancels_on_the_executor() { + let w = Witness::new(); + let body = w.clone(); + let rt = Runtime::make().globals(move |_| { + let body = body.clone(); + [( + "fetch", + HostFunction::new_async(move |_, _| { + let body = Cancelled(body.clone()); + async move { + Ok(HostValue::Response(StreamingResponse::new( + 200, + Some(Box::new(body) as Box), + ))) + } + }), + )] + }); + // A loop long enough to move to the worker, then a cancel queued there, which starts when the program next looks + // at the body after the run has handed calls over: at the `bodyUsed` getter, still on the worker. + let code = "const r = await fetch(); let n = 0 + for (let i = 0; i < 3e6; i++) n += i % 3 + r.body.cancel('stop') + for (let i = 0; i < 1e5; i++) n += i % 3 + return r.bodyUsed && n > 0"; + let outcome = drive(rt.execute_async(code, &ProgramOptions::new())).unwrap(); + assert_eq!(outcome.json().unwrap(), json!(true)); + assert_eq!(w.ran.load(Ordering::SeqCst), 1); + assert_eq!(w.strays.load(Ordering::SeqCst), 0); +} + +/// A value that arrives after `ms` from another thread: an asynchronous host operation without an executor. +fn later(ms: u64, value: T) -> impl Future { + let state = Arc::new(Mutex::new((None, None::))); + let shared = state.clone(); + thread::spawn(move || { + thread::sleep(Duration::from_millis(ms)); + let mut s = shared.lock().unwrap(); + s.0 = Some(value); + if let Some(w) = s.1.take() { + w.wake(); + } + }); + std::future::poll_fn(move |cx| { + let mut s = state.lock().unwrap(); + match s.0.take() { + Some(v) => Poll::Ready(v), + None => { + s.1 = Some(cx.waker().clone()); + Poll::Pending + } + } + }) +} + +/// Polls a future to its end on this thread, parking until it is woken. +fn drive(future: F) -> F::Output { + struct Unpark(thread::Thread); + impl std::task::Wake for Unpark { + fn wake(self: Arc) { + self.0.unpark(); + } + } + let waker = Waker::from(Arc::new(Unpark(thread::current()))); + let mut cx = Context::from_waker(&waker); + let mut future = std::pin::pin!(future); + loop { + if let Poll::Ready(v) = future.as_mut().poll(&mut cx) { + return v; + } + thread::park(); + } +} diff --git a/packages/codemode-rust/crates/psychoscript/tests/snapshot.rs b/packages/codemode-rust/crates/psychoscript/tests/snapshot.rs new file mode 100644 index 0000000000000..88d34423828d6 --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/tests/snapshot.rs @@ -0,0 +1,891 @@ +//! Suspending a run, saving its state, and resuming it in a brand-new runtime, mirroring the reference's +//! `suspend.test.ts` on the language layer: host functions instead of tools. + +use std::future::Future; +use std::pin::Pin; +use std::sync::{Arc, Condvar, Mutex}; +use std::task::{Context, Poll, Waker}; +use std::thread; +use std::time::Duration; + +use psychoscript::{ + DurableFunction, HostError, HostFunction, HostValue, Json, Limits, Namespace, Program, + ProgramOptions, RunOutcome, Runtime, Snapshot, Suspended, Suspender, +}; +use serde_json::json; + +/// A future the test finishes by hand, and a flag that says it was entered. +#[derive(Clone, Default)] +struct Gate { + inner: Arc<(Mutex, Condvar)>, +} + +#[derive(Default)] +struct GateState { + value: Option, + entered: usize, + dropped: usize, + waker: Option, +} + +impl Gate { + fn wait(&self) -> GateFuture { + self.mark(); + GateFuture { + gate: self.clone(), + done: false, + } + } + + /// Counts an entry without waiting. + fn mark(&self) { + let (m, c) = &*self.inner; + m.lock().unwrap().entered += 1; + c.notify_all(); + } + + fn open(&self, v: Json) { + let (m, c) = &*self.inner; + let mut s = m.lock().unwrap(); + s.value = Some(v); + if let Some(w) = s.waker.take() { + w.wake(); + } + c.notify_all(); + } + + /// Waits until the gate was entered `n` times. + fn entered(&self, n: usize) { + let (m, c) = &*self.inner; + let mut s = m.lock().unwrap(); + while s.entered < n { + s = c.wait_timeout(s, Duration::from_millis(10)).unwrap().0; + } + } + + fn dropped(&self) -> usize { + self.inner.0.lock().unwrap().dropped + } + + fn reset(&self) { + let mut s = self.inner.0.lock().unwrap(); + s.value = None; + s.entered = 0; + } + + /// Blocks the calling thread until the gate opens, as a synchronous host function would. + fn block(&self) -> Json { + self.mark(); + let (m, c) = &*self.inner; + let mut s = m.lock().unwrap(); + loop { + if let Some(v) = s.value.take() { + return v; + } + s = c.wait_timeout(s, Duration::from_millis(5)).unwrap().0; + } + } +} + +struct GateFuture { + gate: Gate, + done: bool, +} + +impl Future for GateFuture { + type Output = Json; + fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + let mut s = self.gate.inner.0.lock().unwrap(); + if let Some(v) = s.value.take() { + drop(s); + self.done = true; + return Poll::Ready(v); + } + s.waker = Some(cx.waker().clone()); + Poll::Pending + } +} + +impl Drop for GateFuture { + fn drop(&mut self) { + if !self.done { + self.gate.inner.0.lock().unwrap().dropped += 1; + } + } +} + +/// `step(n)`: an async host function that doubles `n` at once, marking `gate` on every call so a test can suspend +/// right after it. +fn step(gate: Option<&Gate>) -> HostFunction { + let gate = gate.cloned(); + HostFunction::new_async(move |args, _| { + if let Some(g) = &gate { + g.mark(); + } + let n = args[0].as_f64().unwrap_or(0.0); + async move { Ok(HostValue::Number(n * 2.0)) } + }) + .length(1) +} + +/// A runtime whose only global is `step`, marking `gate`. +fn stepping(gate: &Gate) -> Runtime { + let gate = gate.clone(); + Runtime::make().globals(move |_| [("step", step(Some(&gate)))]) +} + +/// A runtime whose only global is `step`, marking nothing: the same host globals as [`stepping`]. +fn fresh() -> Runtime { + Runtime::make().globals(|_| [("step", step(None))]) +} + +fn options(run_id: &str) -> ProgramOptions { + ProgramOptions::new().run_id(run_id) +} + +/// Runs `program` on this thread while `during` runs on another with its suspender. +fn background<'a, T: Send>( + program: Program<'a>, + during: impl FnOnce(Suspender) -> T + Send, +) -> (RunOutcome, T) { + let suspender = program.suspender(); + thread::scope(|s| { + let handle = s.spawn(move || during(suspender)); + let outcome = program.run_resumable().expect("not interrupted"); + (outcome, handle.join().unwrap()) + }) +} + +/// Suspends, trying again while a synchronous host call is running: a suspend that lands inside one is refused. +fn suspend_soon( + s: &Suspender, + max_bytes: Option, +) -> Result { + for _ in 0..1000 { + match s.suspend(max_bytes) { + Err(e) if !e.running.is_empty() => thread::sleep(Duration::from_millis(1)), + other => return other, + } + } + s.suspend(max_bytes) +} + +fn suspended(o: RunOutcome) -> Suspended { + match o { + RunOutcome::Suspended(s) => s, + RunOutcome::Done(o) => panic!("expected a suspended run, got {:?}", o.result), + } +} + +fn done(o: RunOutcome) -> psychoscript::Outcome { + match o { + RunOutcome::Done(o) => o, + RunOutcome::Suspended(_) => panic!("expected an ended run"), + } +} + +fn header(state: &Snapshot) -> &Json { + &state.0["header"] +} + +/// Busy-waits in the program after its first host call, so a suspend lands mid-loop. +const BUSY: &str = "const t = Date.now(); while (Date.now() - t < 300) {}"; + +/// The message a runtime with other host globals refuses a state with. +const OTHER_GLOBALS: &str = + "This state was saved by a runtime with other host globals; resume it with the same ones."; + +#[test] +fn a_run_suspended_between_calls_resumes_from_state_and_from_bytes() { + let code = format!( + r#"const log = ["before"] + const a = await step(20) + {BUSY} + const b = await step(1) + log.push("after " + (a + b)) + console.log("resumed") + return {{ log, total: a + b }}"# + ); + let gate = Gate::default(); + let rt = stepping(&gate); + let (outcome, from_suspend) = background(rt.program(&code, &ProgramOptions::new()), |s| { + gate.entered(1); + suspend_soon(&s, None) + }); + let state = suspended(outcome).state; + assert_eq!(suspended(from_suspend.unwrap()).state, state); + let fresh = fresh(); + for program in [ + fresh.resume(&state).unwrap(), + fresh.resume_bytes(&psychoscript::to_bytes(&state)).unwrap(), + ] { + let o = done(program.run_resumable().unwrap()); + assert_eq!( + o.result.unwrap(), + json!({ "log": ["before", "after 42"], "total": 42 }) + ); + assert_eq!(o.logs, ["resumed"]); + } +} + +#[test] +fn a_suspend_fails_while_a_call_is_running_and_the_run_goes_on() { + let gate = Gate::default(); + let g = gate.clone(); + let rt = Runtime::make().globals(move |_| { + let g = g.clone(); + [( + "tools", + Namespace::new( + |_| Ok(vec!["slow".into()]), + move |_| { + let g = g.clone(); + HostFunction::new_async(move |_, _| { + let f = g.wait(); + async move { Ok(HostValue::from_json(&f.await)) } + }) + }, + ), + )] + }); + let (outcome, error) = background( + rt.program("return await tools.slow(1)", &options("b")), + |s| { + gate.entered(1); + let error = s.suspend(None).unwrap_err(); + gate.open(json!(5)); + error + }, + ); + assert_eq!(error.running.len(), 1); + assert_eq!(error.running[0].key, "b:0"); + assert_eq!(error.running[0].path, "tools.slow"); + assert_eq!( + error.message, + "The run can't be suspended while tools.slow is running." + ); + assert_eq!(done(outcome).result.unwrap(), json!(5)); +} + +#[test] +fn a_suspend_fails_while_a_synchronous_call_runs() { + let gate = Gate::default(); + let g = gate.clone(); + let rt = Runtime::make().globals(move |_| { + let g = g.clone(); + [( + "now", + HostFunction::new(move |_, _| HostValue::Number(g.block().as_f64().unwrap_or(0.0))), + )] + }); + let (outcome, error) = background(rt.program("return now() + 1", &options("s")), |s| { + gate.entered(1); + let error = s.suspend(None).unwrap_err(); + gate.open(json!(7)); + error + }); + assert_eq!(error.running[0].path, "now"); + assert_eq!( + error.message, + "The run can't be suspended while now is running." + ); + assert_eq!(done(outcome).result.unwrap(), json!(8)); +} + +#[test] +fn a_loop_of_synchronous_calls_can_be_suspended_and_resumed() { + let gate = Gate::default(); + let draw = |gate: Gate| { + Runtime::make().globals(move |_| { + let gate = gate.clone(); + [( + "draw", + HostFunction::new(move |args, _| { + gate.mark(); + args[0].clone() + }), + )] + }) + }; + let rt = draw(gate.clone()); + let code = "let n = 0\nwhile (n < 200000) draw(n++)\nreturn n"; + let (outcome, _) = background(rt.program(code, &ProgramOptions::new()), |s| { + gate.entered(500); + suspend_soon(&s, None) + }); + let state = suspended(outcome).state; + assert!(gate.inner.0.lock().unwrap().entered < 200000); + let o = done( + draw(Gate::default()) + .resume_bytes(&psychoscript::to_bytes(&state)) + .unwrap() + .run_resumable() + .unwrap(), + ); + assert_eq!(o.result.unwrap(), json!(200000)); +} + +#[test] +fn a_suspend_after_the_run_ended_gives_its_result() { + let rt = Runtime::make(); + let program = rt.program("return 1 + 1", &ProgramOptions::new()); + let suspender = program.suspender(); + let o = done(program.run_resumable().unwrap()); + assert_eq!(o.result.unwrap(), json!(2)); + let again = done(suspender.suspend(None).unwrap()); + assert_eq!(again.result.unwrap(), json!(2)); +} + +#[test] +fn a_suspend_issued_before_the_run_starts_stops_a_busy_loop() { + let code = "let n = 0; for (let i = 0; i < 2000000; i++) n = (n + i) % 1000003; return n"; + let rt = Runtime::make(); + let expected = rt.execute(code).result.unwrap(); + let program = rt.program(code, &ProgramOptions::new()); + let suspender = program.suspender(); + let (outcome, answer) = thread::scope(|s| { + let h = s.spawn(move || suspender.suspend(None)); + thread::sleep(Duration::from_millis(5)); + (program.run_resumable().unwrap(), h.join().unwrap()) + }); + let state = suspended(outcome).state; + assert_eq!(suspended(answer.unwrap()).state, state); + let o = done( + Runtime::make() + .resume_bytes(&psychoscript::to_bytes(&state)) + .unwrap() + .run_resumable() + .unwrap(), + ); + assert_eq!(o.result.unwrap(), expected); +} + +#[test] +fn a_state_over_the_byte_budget_fails_the_suspend_and_the_run_goes_on() { + let code = format!(r#"const big = "x".repeat(1000); await step(1); {BUSY} return big.length"#); + let gate = Gate::default(); + let rt = stepping(&gate); + let (outcome, error) = background(rt.program(&code, &ProgramOptions::new()), |s| { + gate.entered(1); + suspend_soon(&s, Some(100)) + }); + let error = error.unwrap_err(); + assert!(error.running.is_empty()); + assert!( + error.message.starts_with("The run's state takes ") + && error + .message + .ends_with(" bytes, more than the 100-byte limit, so it couldn't be suspended."), + "{}", + error.message + ); + assert_eq!(done(outcome).result.unwrap(), json!(1000)); +} + +/// Suspends `code` in the busy loop after its first `step` call; `rt` marks `gate` there. +fn suspend_mid_loop(rt: &Runtime, gate: &Gate, code: &str) -> Snapshot { + let (outcome, _) = background(rt.program(code, &ProgramOptions::new()), |s| { + gate.entered(1); + suspend_soon(&s, None) + }); + suspended(outcome).state +} + +#[test] +fn a_resumed_run_keeps_its_limits_and_counts_time_across_resumes() { + let code = format!(r#"await step(1); {BUSY} return "x".repeat(100)"#); + let gate = Gate::default(); + let g = gate.clone(); + let rt = Runtime::make() + .globals(move |_| [("step", step(Some(&g)))]) + .limits(Limits { + max_output_bytes: Some(10), + timeout_ms: None, + }); + let state = suspend_mid_loop(&rt, &gate, &code); + assert_eq!( + header(&state)["limits"], + json!({ "timeoutMs": null, "maxOutputBytes": 10 }) + ); + // A runtime without limits resumes it with the ones it was saved with. + let o = done(fresh().resume(&state).unwrap().run_resumable().unwrap()); + assert!(o.truncated); + assert_eq!( + o.result.unwrap(), + json!( + "\"xxxxxxxxx [result truncated: 102 bytes exceeds the 10-byte output limit; return a smaller value]" + ) + ); + + let gate = Gate::default(); + let g = gate.clone(); + let timed = Runtime::make() + .globals(move |_| [("step", step(Some(&g)))]) + .limits(Limits { + timeout_ms: Some(400), + ..Limits::default() + }); + let code = "await step(1); const a = Date.now(); while (Date.now() - a < 250) {} const b = Date.now(); while (Date.now() - b < 250) {} return 1"; + let (outcome, _) = background(timed.program(code, &ProgramOptions::new()), |s| { + gate.entered(1); + thread::sleep(Duration::from_millis(200)); + suspend_soon(&s, None) + }); + let state = suspended(outcome).state; + assert!(header(&state)["budget"]["activeMs"].as_u64().unwrap() >= 150); + let o = done(timed.resume(&state).unwrap().run_resumable().unwrap()); + assert_eq!( + o.result.unwrap_err().kind, + psychoscript::DiagnosticKind::TimeoutExceeded + ); +} + +#[test] +fn a_state_is_refused_by_another_build_other_host_globals_or_a_changed_source() { + let gate = Gate::default(); + let rt = stepping(&gate); + let state = suspend_mid_loop(&rt, &gate, &format!("await step(1); {BUSY} return 1")); + let mut other = state.clone(); + other.0["header"]["build"] = json!("0.0.0+0"); + let e = rt.resume(&other).err().unwrap(); + // The reference names itself "Code Mode" where this build names itself "PsychoScript". + assert!( + e.message.starts_with("This state was saved by another ") + && e.message.contains(" build (0.0.0+0); this runtime is ") + && e.message.ends_with(", so it can't resume it."), + "{}", + e.message + ); + let others = Runtime::make().globals(|_| { + [ + ("step", step(None)), + ("f", HostFunction::new(|_, _| HostValue::Number(1.0))), + ] + }); + assert_eq!(others.resume(&state).err().unwrap().message, OTHER_GLOBALS); + let mut changed = state.clone(); + let code = changed.0["header"]["source"]["code"] + .as_str() + .unwrap() + .to_owned(); + changed.0["header"]["source"]["code"] = json!(format!("{code} ")); + assert_eq!( + rt.resume(&changed).err().unwrap().message, + "Source main does not match its hash." + ); + assert!(rt.resume_bytes(b"{").is_err()); + let mut broken = state.clone(); + broken.0["state"]["heap"] = json!([{ "t": "Nope" }]); + assert!( + rt.resume(&broken) + .err() + .unwrap() + .message + .contains("Invalid snapshot") + ); + for bad in ["é", "abc", "zz"] { + let mut bytes = state.clone(); + bytes.0["state"]["buffers"] = json!([bad]); + assert!(rt.resume(&bytes).is_err(), "{bad}"); + } +} + +#[test] +fn a_run_resumes_with_the_globals_made_for_it_in_the_same_order() { + let number = |n: f64| HostFunction::new(move |_, _| HostValue::Number(n)); + let gate = Gate::default(); + let g = gate.clone(); + // Each run gets its own choice of globals: `later` only for the run named "both". + let rt = Runtime::make().globals(move |run| { + let mut globals = vec![("step", step(Some(&g))), ("now", number(7.0))]; + if run.id() == "both" { + globals.push(("later", number(8.0))); + } + globals + }); + let code = format!("await step(1); {BUSY} return [now(), later(), typeof unused]"); + let (outcome, _) = background(rt.program(&code, &options("both")), |s| { + gate.entered(1); + suspend_soon(&s, None) + }); + let state = suspended(outcome).state; + let fewer = Runtime::make().globals(move |_| [("step", step(None)), ("now", number(7.0))]); + let reordered = Runtime::make().globals(move |_| { + [ + ("step", step(None)), + ("later", number(8.0)), + ("now", number(7.0)), + ] + }); + for refused in [fewer.resume(&state).err(), reordered.resume(&state).err()] { + assert_eq!(refused.expect("refused").message, OTHER_GLOBALS); + } + let o = done(rt.resume(&state).unwrap().run_resumable().unwrap()); + assert_eq!(o.result.unwrap(), json!([7, 8, "undefined"])); +} + +#[test] +fn a_function_a_host_function_returned_is_lost_on_resume() { + let globals = |gate: Option| { + move |_: &psychoscript::Run| { + [ + ("step", step(gate.as_ref())), + ( + "make", + HostFunction::new(|_, _| { + HostValue::Function( + HostFunction::new(|args, _| { + HostValue::Number(args[0].as_f64().unwrap_or(0.0) + 1.0) + }) + .named("inc"), + ) + }), + ), + ] + } + }; + let gate = Gate::default(); + let rt = Runtime::make().globals(globals(Some(gate.clone()))); + let code = format!( + "const inc = make(); const before = inc(1); await step(0); {BUSY} try {{ return {{ before, after: inc(1) }} }} catch (error) {{ return {{ before, error: String(error) }} }}" + ); + let state = suspend_mid_loop(&rt, &gate, &code); + let fresh = Runtime::make().globals(globals(None)); + let o = done(fresh.resume(&state).unwrap().run_resumable().unwrap()); + assert_eq!( + o.result.unwrap(), + json!({ "before": 2, "error": "TypeError: The function inc came from the host and was lost when the run was suspended; get it again after resuming." }) + ); +} + +#[test] +fn program_state_of_every_kind_survives_a_suspend() { + let code = format!( + r#"const shared = {{ n: 1 }} + const map = new Map([[shared, "a"], ["k", shared]]) + const set = new Set([1, shared]) + const it = map.keys() + it.next() + const url = new URL("https://example.com/a?x=1") + const params = url.searchParams + const bytes = new Uint8Array([1, 2, 3, 4]) + const view = bytes.subarray(1, 3) + const re = /a(b)/g + re.test("abab") + const date = new Date(0) + const weak = new WeakMap([[shared, 5]]) + function* counter() {{ let i = 0; while (true) yield i++ }} + const gen = counter() + gen.next() + const bound = ((a, b) => a + b).bind(null, 10) + const sparse = [] + sparse[5000] = "far" + const pending = new Promise((resolve) => (globalResolve = resolve)) + var globalResolve + Array.prototype.extra = "patched" + await step(1) + {BUSY} + params.append("y", "2") + view[0] = 9 + globalResolve("later") + return {{ + same: map.get("k") === shared && set.has(shared) && weak.get(shared) === 5, + next: it.next().value, + url: url.href, + bytes: [...bytes], + lastIndex: re.lastIndex, + date: date.getTime(), + gen: [gen.next().value, gen.next().value], + bound: bound(5), + sparse: [sparse.length, sparse[5000]], + pending: await pending, + extra: [].extra, + negative: Object.is(-0, -0 * 1), + }}"# + ); + let gate = Gate::default(); + let state = suspend_mid_loop(&stepping(&gate), &gate, &code); + let o = done( + fresh() + .resume_bytes(&psychoscript::to_bytes(&state)) + .unwrap() + .run_resumable() + .unwrap(), + ); + assert_eq!( + o.result.unwrap(), + json!({ + "same": true, + "next": "k", + "url": "https://example.com/a?x=1&y=2", + "bytes": [1, 9, 3, 4], + "lastIndex": 2, + "date": 0, + "gen": [1, 2], + "bound": 15, + "sparse": [5001, "far"], + "pending": "later", + "extra": "patched", + "negative": true, + }) + ); +} + +#[test] +fn changes_to_built_ins_survive_a_second_suspend() { + let code = format!( + r#"Array.prototype.extra = "patched" + delete Math.max + Object.freeze(JSON) + Object.seal(Number.prototype) + Object.preventExtensions(Date.prototype) + await step(1) + {BUSY} + await step(2) + const t2 = Date.now() + while (Date.now() - t2 < 300) {{}} + return {{ + extra: [].extra, + max: typeof Math.max, + frozen: Object.isFrozen(JSON), + sealed: Object.isSealed(Number.prototype) && !Object.isFrozen(Number.prototype), + extensible: Object.isExtensible(Date.prototype), + untouched: Object.isExtensible(Map.prototype) && typeof Math.min, + }}"# + ); + let gate = Gate::default(); + let rt = stepping(&gate); + let first = suspend_mid_loop(&rt, &gate, &code); + let (outcome, _) = background(rt.resume(&first).unwrap(), |s| { + gate.entered(2); + suspend_soon(&s, None) + }); + let second = suspended(outcome).state; + let o = done(rt.resume(&second).unwrap().run_resumable().unwrap()); + assert_eq!( + o.result.unwrap(), + json!({ + "extra": "patched", + "max": "undefined", + "frozen": true, + "sealed": true, + "extensible": false, + "untouched": "function", + }) + ); +} + +#[test] +fn an_idempotent_call_in_flight_suspends_and_reruns_on_resume_with_the_same_key() { + let gate = Gate::default(); + let keys = Arc::new(Mutex::new(Vec::new())); + let (g, k) = (gate.clone(), keys.clone()); + let rt = Runtime::make().globals(move |_| { + let (g, k) = (g.clone(), k.clone()); + [( + "read", + HostFunction::new_async(move |_, call| { + k.lock().unwrap().push(call.key()); + let f = g.wait(); + async move { Ok(HostValue::from_json(&f.await)) } + }) + .idempotent(), + )] + }); + let code = "const a = await read(20); const b = await read(22); return a + b"; + let (outcome, _) = background(rt.program(code, &options("rr")), |s| { + gate.entered(1); + suspend_soon(&s, None) + }); + let state = suspended(outcome).state; + assert_eq!(gate.dropped(), 1); + assert_eq!(*keys.lock().unwrap(), ["rr:0"]); + gate.reset(); + let (outcome, _) = background(rt.resume(&state).unwrap(), |_| { + gate.entered(1); + gate.open(json!(20)); + gate.entered(2); + gate.open(json!(22)); + }); + assert_eq!(done(outcome).result.unwrap(), json!(42)); + assert_eq!(*keys.lock().unwrap(), ["rr:0", "rr:0", "rr:1"]); +} + +/// A durable function over a job table that outlives any one run. +#[derive(Clone, Default)] +struct Jobs { + log: Arc>>, + cancelled: Arc>>, + start_gate: Gate, + result: Gate, +} + +impl Jobs { + fn function(&self, gated: bool) -> DurableFunction { + let (start_log, wait_log, cancelled) = + (self.log.clone(), self.log.clone(), self.cancelled.clone()); + let (start_gate, result) = (self.start_gate.clone(), self.result.clone()); + DurableFunction::new( + move |args, call| { + let key = call.key(); + start_log.lock().unwrap().push(format!("start {key}")); + let wait = gated.then(|| start_gate.wait()); + let input = args + .first() + .and_then(HostValue::to_json) + .unwrap_or_default(); + async move { + if let Some(w) = wait { + w.await; + } + Ok(json!({ "job": key, "input": input }).into()) + } + }, + move |data, call| { + wait_log.lock().unwrap().push(format!( + "wait {} {}", + call.key(), + data.to_json()["job"].as_str().unwrap_or("") + )); + let f = result.wait(); + async move { Ok(HostValue::from_json(&f.await)) } + }, + move |data, _| { + cancelled + .lock() + .unwrap() + .push(data.to_json()["job"].as_str().unwrap_or("").to_owned()); + async {} + }, + ) + } + + fn runtime(&self, gated: bool) -> Runtime { + let jobs = self.clone(); + Runtime::make().globals(move |_| [("job", jobs.function(gated))]) + } +} + +#[test] +fn a_durable_function_refuses_suspend_during_start_and_waits_on_its_data_on_resume() { + let jobs = Jobs::default(); + let rt = jobs.runtime(true); + let code = "const a = await job(41); return a + 1"; + let (outcome, during_start) = background(rt.program(code, &options("rec")), |s| { + jobs.start_gate.entered(1); + let refused = s.suspend(None).unwrap_err(); + jobs.start_gate.open(Json::Null); + jobs.result.entered(1); + let _ = s.suspend(None); + refused + }); + assert_eq!(during_start.running[0].key, "rec:0"); + assert_eq!(during_start.running[0].path, "job"); + let state = suspended(outcome).state; + assert!(jobs.cancelled.lock().unwrap().is_empty()); + jobs.result.reset(); + let resumed = rt.resume_bytes(&psychoscript::to_bytes(&state)).unwrap(); + let (outcome, _) = background(resumed, |_| { + jobs.result.entered(1); + jobs.result.open(json!(41)); + }); + assert_eq!( + *jobs.log.lock().unwrap(), + ["start rec:0", "wait rec:0 rec:0", "wait rec:0 rec:0"] + ); + assert_eq!(done(outcome).result.unwrap(), json!(42)); + assert!(jobs.cancelled.lock().unwrap().is_empty()); +} + +#[test] +fn a_durable_function_is_cancelled_when_the_run_ends_with_it_running_not_on_suspend() { + let jobs = Jobs::default(); + let o = jobs + .runtime(false) + .execute_with(r#"job(1); return "left""#, &options("c")); + assert_eq!(o.result.unwrap(), json!("left")); + assert_eq!(*jobs.cancelled.lock().unwrap(), ["c:0"]); +} + +fn response(url: &str) -> HostValue { + let body = format!("body of {url}"); + HostValue::object([ + ("url", HostValue::from(url)), + ( + "text", + HostFunction::new(move |_, _| HostValue::from(body.clone())) + .named("text") + .into(), + ), + ]) +} + +#[test] +fn methods_on_a_returned_value_survive_with_snapshot_hooks() { + let fetch = || { + HostFunction::new(|args, _| response(args[0].as_str().unwrap_or(""))) + .length(1) + .snapshot( + |v| { + Ok(HostValue::from( + v.get("url").and_then(HostValue::as_str).unwrap_or(""), + )) + }, + |data| response(data.as_str().unwrap_or("")), + ) + }; + let gate = Gate::default(); + let g = gate.clone(); + let rt = Runtime::make().globals(move |_| [("step", step(Some(&g))), ("fetch", fetch())]); + let code = format!( + r#"const res = fetch("https://a.test/"); await step(1); {BUSY} return [res.url, res.text()]"# + ); + let state = suspend_mid_loop(&rt, &gate, &code); + let fresh = Runtime::make().globals(move |_| [("step", step(None)), ("fetch", fetch())]); + let o = done(fresh.resume(&state).unwrap().run_resumable().unwrap()); + assert_eq!( + o.result.unwrap(), + json!(["https://a.test/", "body of https://a.test/"]) + ); + // Without the function's hooks the state is refused. + let bare = Runtime::make().globals(|_| { + [ + ("step", step(None)), + ("fetch", HostFunction::new(|_, _| HostValue::Null)), + ] + }); + assert_eq!(bare.resume(&state).err().unwrap().message, OTHER_GLOBALS); +} + +#[test] +fn a_suspend_fails_when_an_encode_hook_fails_and_the_run_goes_on() { + let gate = Gate::default(); + let g = gate.clone(); + let rt = Runtime::make().globals(move |_| { + [ + ("step", step(Some(&g))), + ( + "make", + HostFunction::new(|_, _| { + HostValue::object([( + "f", + HostFunction::new(|_, _| HostValue::Number(1.0)).into(), + )]) + }) + .snapshot(|_| Err(HostError::new("no")), |v| v), + ), + ] + }); + let code = format!("const v = make(); await step(1); {BUSY} return v.f()"); + let (outcome, error) = background(rt.program(&code, &ProgramOptions::new()), |s| { + gate.entered(1); + suspend_soon(&s, None) + }); + let error = error.unwrap_err(); + assert!(error.running.is_empty()); + assert_eq!( + error.message, + "The run's state couldn't be saved: The host function make couldn't save a value it returned: no" + ); + assert_eq!(done(outcome).result.unwrap(), json!(1)); +} diff --git a/packages/codemode-rust/crates/psychoscript/tests/streaming.rs b/packages/codemode-rust/crates/psychoscript/tests/streaming.rs new file mode 100644 index 0000000000000..32f2cbf4b92cf --- /dev/null +++ b/packages/codemode-rust/crates/psychoscript/tests/streaming.rs @@ -0,0 +1,379 @@ +//! Streaming HTTP responses through a host function, how host-call arguments cross, and suspending a run that holds a +//! response or waits in a crossing, against the reference's behaviour recorded in `conformance/streaming.json` by +//! `bun conformance/streaming.ts` (the reference has no tests of its own for them). The globals are the generator's. + +use std::collections::VecDeque; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::{Arc, Condvar, Mutex}; +use std::task::{Context, Poll}; +use std::thread; +use std::time::Duration; + +use psychoscript::{ + Failure, HostError, HostFunction, HostValue, HttpBody, Json, Program, ProgramOptions, + RunOutcome, Runtime, StreamingResponse, Suspender, Translate, TranslateFunctions, + TranslatePromises, +}; +use serde_json::json; + +#[path = "../../../conformance/reference.rs"] +mod reference; + +use reference::{describe, same}; + +type Log = Arc>>; + +/// The fake body of `conformance/streaming.ts`: `chunks` one per read, `fail` erroring the read at that index with +/// `new Error("boom")`, `delay` holding each read back for that many milliseconds. +struct Fake { + chunks: VecDeque>, + index: usize, + fail: Option, + delay: Option, + waiting: Option>, + log: Log, +} + +impl HttpBody for Fake { + fn poll_chunk(&mut self, cx: &mut Context<'_>) -> Poll, HostValue>>> { + if let Some(ms) = self.delay { + match &self.waiting { + None => { + let done = Arc::new(AtomicBool::new(false)); + self.waiting = Some(done.clone()); + let waker = cx.waker().clone(); + thread::spawn(move || { + thread::sleep(Duration::from_millis(ms)); + done.store(true, Ordering::SeqCst); + waker.wake(); + }); + return Poll::Pending; + } + Some(done) if !done.load(Ordering::SeqCst) => return Poll::Pending, + Some(_) => self.waiting = None, + } + } + if self.fail == Some(self.index) { + return Poll::Ready(Some(Err(HostValue::Error(Box::new(HostError::new( + "boom", + )))))); + } + self.index += 1; + Poll::Ready(self.chunks.pop_front().map(Ok)) + } + + fn cancel(&mut self, reason: HostValue) { + self.log + .lock() + .unwrap() + .push(json!(["cancel", reason.to_json().unwrap_or(Json::Null)])); + } +} + +fn respond(spec: &HostValue, log: &Log) -> HostValue { + let get = |k: &str| spec.get(k).cloned().unwrap_or_default(); + let body = match get("chunks") { + HostValue::Array(chunks) => Some(Box::new(Fake { + chunks: chunks + .into_iter() + .flatten() + .map(|c| match c { + HostValue::String(s) => s.to_string_lossy().into_owned().into_bytes(), + HostValue::Array(bytes) => bytes + .into_iter() + .flatten() + .map(|b| b.as_f64().unwrap() as u8) + .collect(), + other => panic!("unexpected chunk {other:?}"), + }) + .collect(), + index: 0, + fail: get("fail").as_f64().map(|n| n as usize), + delay: get("delay").as_f64().map(|n| n as u64), + waiting: None, + log: log.clone(), + }) as Box), + _ => None, + }; + let mut response = StreamingResponse::new(get("status").as_f64().unwrap_or(200.0) as u16, body) + .with_redirected(matches!(get("redirected"), HostValue::Bool(true))); + if let Some(text) = get("statusText").as_str() { + response = response.with_status_text(text); + } + if let HostValue::Object(headers) = get("headers") { + for (k, v) in headers { + response = response.with_header(k.to_string_lossy(), v.as_str().unwrap()); + } + } + HostValue::Response(response) +} + +/// The generator's runtime: its globals, with functions dropped and promises awaited in host-call arguments. +/// `fetched`, when given, is told each time `fetch` answered. +fn runtime(log: &Log, waiting: &Waiting, fetched: Option) -> Runtime { + let (log, waiting) = (log.clone(), waiting.clone()); + Runtime::make() + .translate(Translate { + functions: TranslateFunctions::Drop, + promises: TranslatePromises::Await, + }) + .globals(move |_| { + let (fetch_log, send_log, refuse_log) = (log.clone(), log.clone(), log.clone()); + let fetched = fetched.clone(); + [ + ("tools", HostValue::from(reference::tools())), + ( + "fetch", + HostFunction::new_async(move |args, _| { + let response = respond(&args[0], &fetch_log); + if let Some(w) = &fetched { + w.enter(); + } + async move { Ok(response) } + }) + .takes_functions() + .length(1) + .into(), + ), + ( + "echo", + HostFunction::new(|args, _| args.into_iter().next().unwrap_or_default()) + .takes_functions() + .length(1) + .into(), + ), + ( + "send", + HostFunction::new_async(move |args, _| { + let log = send_log.clone(); + async move { + log.lock().unwrap().push(json!(["send", described(&args)])); + Ok(args.into_iter().next().unwrap_or_default()) + } + }) + .length(1) + .into(), + ), + ( + "refuse", + HostFunction::new_async(move |args, _| { + let log = refuse_log.clone(); + async move { + log.lock() + .unwrap() + .push(json!(["refuse", described(&args)])); + Err(Failure::new("HostFailure", "boom").into()) + } + }) + .length(1) + .into(), + ), + ( + "hold", + HostFunction::new(|args, _| { + HostValue::object([("items", HostValue::array(args))]) + }) + .thenable() + .length(1) + .into(), + ), + ("wait", waiting.function().into()), + ] + }) +} + +fn described(args: &[HostValue]) -> Json { + Json::Array(args.iter().map(describe).collect()) +} + +fn fixture() -> Json { + let path = concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../conformance/streaming.json" + ); + serde_json::from_str(&std::fs::read_to_string(path).unwrap()).unwrap() +} + +/// The host's side of the log the reference recorded: what the program cancelled with. How often the host runtime +/// pulls ahead is its own buffering. +fn cancels(log: &Json) -> Json { + Json::Array( + log.as_array() + .unwrap() + .iter() + .filter(|e| e[0] != "pull") + .cloned() + .collect(), + ) +} + +fn outcome(o: &psychoscript::Outcome) -> Json { + match &o.result { + Ok(value) if o.logs.is_empty() => json!({ "ok": true, "value": value.to_json() }), + Ok(value) => json!({ "ok": true, "value": value.to_json(), "logs": o.log_lines() }), + Err(d) => json!({ "ok": false, "kind": d.kind.name(), "message": d.message_lossy() }), + } +} + +/// A finished run's outcome as the reference's result object writes it. +fn ended(o: &psychoscript::Outcome) -> Json { + let mut out = match &o.result { + Ok(value) => json!({ "ok": true, "value": value.to_json() }), + Err(d) => { + let mut error = json!({ "kind": d.kind.name(), "message": d.message_lossy() }); + if !d.suggestions.is_empty() { + error["suggestions"] = json!(d.suggestions_lossy()); + } + json!({ "ok": false, "error": error }) + } + }; + if !o.logs.is_empty() { + out["logs"] = json!(o.log_lines()); + } + out["metadata"] = o.metadata.to_json(); + out +} + +#[test] +fn streaming_responses_match_the_reference() { + let fixture = fixture(); + let programs = fixture["programs"].as_array().unwrap(); + assert!(programs.len() >= 60); + let mut failures = Vec::new(); + for program in programs { + let log: Log = Arc::default(); + let rt = runtime(&log, &Waiting::default(), None); + let code = program["code"].as_str().unwrap(); + let o = rt.execute(code); + let actual = json!({ "outcome": outcome(&o), "log": *log.lock().unwrap() }); + let expected = json!({ "outcome": program["outcome"], "log": cancels(&program["log"]) }); + if !same(&actual, &expected) { + failures.push(format!( + "{code}\n expected {expected}\n actual {actual}" + )); + } + } + assert!( + failures.is_empty(), + "{} mismatches:\n{}", + failures.len(), + failures.join("\n") + ); +} + +/// Set once the program called `wait`, which answers only after the run resumed. +#[derive(Clone, Default)] +struct Waiting(Arc<(Mutex, Condvar, AtomicBool)>); + +impl Waiting { + /// The generator's `wait`: async and idempotent, settling with `1` only once called after the resume. + fn function(&self) -> HostFunction { + let this = self.clone(); + HostFunction::new_async(move |_, _| { + let resumed = this.0.2.load(Ordering::SeqCst); + if !resumed { + this.enter(); + } + async move { + if !resumed { + std::future::pending::<()>().await; + } + Ok(HostValue::Number(1.0)) + } + }) + .idempotent() + .length(1) + } + + fn enter(&self) { + *self.0.0.lock().unwrap() = true; + self.0.1.notify_all(); + } + + fn entered(&self) { + let mut entered = self.0.0.lock().unwrap(); + while !*entered { + entered = self + .0 + .1 + .wait_timeout(entered, Duration::from_millis(10)) + .unwrap() + .0; + } + } +} + +/// Runs `program` on this thread while `during` runs on another with its suspender. +fn background( + program: Program<'_>, + during: impl FnOnce(Suspender) -> T + Send, +) -> (RunOutcome, T) { + let suspender = program.suspender(); + thread::scope(|s| { + let handle = s.spawn(move || during(suspender)); + let outcome = program.run_resumable().expect("not interrupted"); + (outcome, handle.join().unwrap()) + }) +} + +#[test] +fn suspending_a_run_that_holds_a_streaming_response_matches_the_reference() { + let fixture = fixture(); + let suspensions = fixture["suspensions"].as_array().unwrap(); + assert!(suspensions.len() >= 9); + let mut failures = Vec::new(); + for case in suspensions { + let log: Log = Arc::default(); + let waiting = Waiting::default(); + let code = case["code"].as_str().unwrap(); + // Without `wait`, the suspend comes once the response has arrived, while a busy loop holds the run. + let busy = !code.contains("wait("); + let rt = runtime(&log, &waiting, busy.then(|| waiting.clone())); + let (run, suspend) = background(rt.program(code, &ProgramOptions::new()), |s| { + waiting.entered(); + if busy { + thread::sleep(Duration::from_millis(20)); + } + loop { + match s.suspend(None) { + Err(e) if !e.running.is_empty() => thread::sleep(Duration::from_millis(1)), + other => return other.map_err(|e| e.message), + } + } + }); + let mut actual = match &suspend { + // The run ended before the suspend came: the suspend gives its outcome. + Ok(RunOutcome::Done(o)) => json!({ "suspend": { "ok": false, "outcome": ended(o) } }), + Ok(_) => json!({ "suspend": { "ok": true } }), + Err(message) => json!({ "suspend": { "ok": false, "message": message } }), + }; + if let RunOutcome::Suspended(s) = run { + waiting.0.2.store(true, Ordering::SeqCst); + let bytes = psychoscript::to_bytes(&s.state); + actual["resume"] = match rt.resume_bytes(&bytes) { + Err(e) => json!({ "ok": false, "message": e.to_string() }), + Ok(program) => match program.run_resumable().expect("not interrupted") { + RunOutcome::Done(o) => outcome(&o), + RunOutcome::Suspended(_) => json!("suspended again"), + }, + }; + } + actual["log"] = Json::Array(log.lock().unwrap().clone()); + let mut expected = json!({ "suspend": case["suspend"] }); + if let Some(resume) = case.get("resume") { + expected["resume"] = resume.clone(); + } + expected["log"] = cancels(&case["log"]); + if !same(&actual, &expected) { + failures.push(format!( + "{code}\n expected {expected}\n actual {actual}" + )); + } + } + assert!( + failures.is_empty(), + "{} mismatches:\n{}", + failures.len(), + failures.join("\n") + ); +} diff --git a/packages/codemode-rust/rust-toolchain.toml b/packages/codemode-rust/rust-toolchain.toml new file mode 100644 index 0000000000000..63202c6f2e9c5 --- /dev/null +++ b/packages/codemode-rust/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "1.100.0" +profile = "minimal" +components = ["rustfmt", "clippy"] diff --git a/packages/codemode-rust/test262/Cargo.toml b/packages/codemode-rust/test262/Cargo.toml new file mode 100644 index 0000000000000..2a840afab8c03 --- /dev/null +++ b/packages/codemode-rust/test262/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "psychoscript-test262" +version = "0.0.0" +edition.workspace = true +publish = false + +[dependencies] +psychoscript = { path = "../crates/psychoscript", features = ["test262"] } diff --git a/packages/codemode-rust/test262/README.md b/packages/codemode-rust/test262/README.md new file mode 100644 index 0000000000000..59597b2332ee1 --- /dev/null +++ b/packages/codemode-rust/test262/README.md @@ -0,0 +1,28 @@ +# test262 parity + +Runs the reference's pinned test262 file set (`../codemode/test/test262`) with the reference's semantics and +checks the failures against `rust-skipped.txt`. + +```sh +bash test262/run.sh # what CI runs +bash test262/run.sh built-ins/Array # one directory, by path prefix +bash test262/run.sh --write # regenerate both gap lists from the current outcomes +``` + +- `run.sh` clones tc39/test262 at the reference manifest's revision into a cache directory (`TEST262_CHECKOUT`), + then runs the reference's own `script/sync-test262.ts` into `target/test262` (`TEST262_FILES`). The file set and + its filters are the reference's, unchanged. +- `src/main.rs` runs each file like the reference's `run.ts`: `"use strict"` and the one-line `assert` prelude + prepended on the same line, the host harness (`$assert` checks, `Test262Error`, `compareArray`, `$DONE`, + `$DONOTEVALUATE`) from the crate's `test262` feature, a 5 s timeout, negative tests judged by phase, and async + tests drained and judged by `$DONE`. +- Parity runs both ways, with one list per direction. Both may only shrink. + - `rust-skipped.txt` lists the files that fail here but pass in the reference, each with a reason category. CI + fails when an unlisted file fails, and when a listed file passes. + - `reference-gaps.txt` lists the files in the reference's `skipped.txt` that pass here: gaps on the TypeScript + side. Each category starts with `real` (Rust has the behaviour, TypeScript lacks it) or `accident` (Rust passes + through a looser check where the reference is deliberately strict; Rust should match the reference). CI fails + when an unlisted file passes, when a listed file fails here or leaves the reference's `skipped.txt`, and when + `reference.ts`, which runs the listed files through the reference's own `run.ts`, sees one pass. +- `--write` regenerates both lists. It keeps the categories already in `reference-gaps.txt` and marks new entries + `uncategorised`, with the reference's reason, for a person to judge. diff --git a/packages/codemode-rust/test262/reference-gaps.txt b/packages/codemode-rust/test262/reference-gaps.txt new file mode 100644 index 0000000000000..9bb41010eb408 --- /dev/null +++ b/packages/codemode-rust/test262/reference-gaps.txt @@ -0,0 +1,4 @@ +# test262 files the reference skips (its skipped.txt) that pass here: gaps on the TypeScript side. Categories start +# with "real" (Rust has the behaviour and TypeScript lacks it) or "accident" (Rust passes through a looser check, +# where the reference is deliberately strict). Generated by `bash test262/run.sh --write`, which keeps the categories; +# CI fails when an unlisted file passes, a listed file fails here, or the reference passes a listed file. diff --git a/packages/codemode-rust/test262/reference.ts b/packages/codemode-rust/test262/reference.ts new file mode 100644 index 0000000000000..93f0b34861867 --- /dev/null +++ b/packages/codemode-rust/test262/reference.ts @@ -0,0 +1,35 @@ +#!/usr/bin/env bun + +// Runs test262 files through the reference's own runner, `test/test262/run.ts` of the reference package, over the +// synced tree. The runner reads files next to itself, so a copy goes into the tree with its imports pointed back at +// the reference package; its harness and semantics are unchanged. +// Usage: bun test262/reference.ts [prefix] +// Prints `pass\t` or `fail\t\t` for every `path # ...` line of the list under the prefix. +import path from "node:path" + +const [pkg, tree, list, prefix = ""] = process.argv.slice(2).map((arg, i) => (i < 3 ? path.resolve(arg) : arg)) +if (pkg === undefined || tree === undefined || list === undefined) { + console.error("usage: bun test262/reference.ts [prefix]") + process.exit(1) +} + +const runner = await Bun.file(path.join(pkg, "test/test262/run.ts")).text() +const effect = Bun.resolveSync("effect", path.join(pkg, "src")) +await Bun.write( + path.join(tree, "reference-run.ts"), + runner + .replaceAll('from "../../src/', `from "${path.join(pkg, "src")}/`) + .replaceAll('from "effect"', `from "${effect}"`), +) +await Bun.write(path.join(tree, "skipped.txt"), Bun.file(path.join(pkg, "test/test262/skipped.txt"))) +const { run } = await import(path.join(tree, "reference-run.ts")) + +const files = (await Bun.file(list).text()) + .split("\n") + .filter((line) => !line.startsWith("#") && line.includes("#")) + .map((line) => line.slice(0, line.indexOf("#")).trim()) + .filter((file) => file.startsWith(prefix)) +for (const file of files) { + const outcome = await run(file).catch((error: unknown) => ({ status: "fail", reason: `runner error: ${error}` })) + console.log(outcome.status === "pass" ? `pass\t${file}` : `fail\t${file}\t${outcome.reason.replace(/\s+/g, " ")}`) +} diff --git a/packages/codemode-rust/test262/run.sh b/packages/codemode-rust/test262/run.sh new file mode 100644 index 0000000000000..d88216d70c461 --- /dev/null +++ b/packages/codemode-rust/test262/run.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +# Runs the reference's pinned test262 file set through PsychoScript and checks both gap lists: +# test262/rust-skipped.txt (fails here, passes in the reference) and test262/reference-gaps.txt (passes here, skipped by +# the reference, and still failing when the reference runs it). +# Usage: bash test262/run.sh [--write] [prefix]. Extra arguments go to the runner; see test262/src/main.rs. +# +# - Clones tc39/test262 at the reference manifest's revision into TEST262_CHECKOUT (default: a cache directory). +# - Runs the reference's own sync script into TEST262_FILES (default: target/test262), so the file set and its +# filters are exactly the reference's. +# - The reference CodeMode package is ../codemode relative to this workspace; set CODEMODE_REF to override it. +# Needs git, bun, cargo, and the reference package's dependencies installed (bun install). +set -euo pipefail +[ -n "${CODEMODE_REF:-}" ] && CODEMODE_REF=$(cd "$CODEMODE_REF" && pwd) +cd "$(dirname "$0")/.." +REF_PKG=${CODEMODE_REF:-../codemode} +MANIFEST=$REF_PKG/test/test262/manifest.json +[ -f "$MANIFEST" ] || { echo "reference test262 manifest not found at $MANIFEST" >&2; exit 1; } +REVISION=$(sed -nE 's/^ *"revision": *"([0-9a-f]+)".*/\1/p' "$MANIFEST") +CHECKOUT=${TEST262_CHECKOUT:-${XDG_CACHE_HOME:-$HOME/.cache}/test262-$REVISION} +FILES=${TEST262_FILES:-target/test262} + +# A shallow, sparse checkout of the pinned revision: the sync reads only test/built-ins and test/language. +if [ "$(git -C "$CHECKOUT" rev-parse HEAD 2>/dev/null)" != "$REVISION" ]; then + echo "fetching tc39/test262 at $REVISION into $CHECKOUT" >&2 + rm -rf "$CHECKOUT" + git init -q "$CHECKOUT" + git -C "$CHECKOUT" remote add origin https://github.com/tc39/test262.git + git -C "$CHECKOUT" sparse-checkout set test/built-ins test/language + git -C "$CHECKOUT" fetch -q --depth 1 --filter=blob:none origin "$REVISION" + git -C "$CHECKOUT" checkout -q FETCH_HEAD +fi + +# The sync script writes next to the manifest it reads, so give it a private copy of both. +SYNCED="$FILES/test/test262" +if [ "$(cat "$FILES/stamp" 2>/dev/null)" != "$REVISION $(cksum <"$MANIFEST") $(cksum <"$REF_PKG/script/sync-test262.ts")" ]; then + echo "syncing the reference's file set into $FILES" >&2 + rm -rf "$FILES" + mkdir -p "$FILES/script" "$SYNCED" + cp "$REF_PKG/script/sync-test262.ts" "$FILES/script/" + cp "$MANIFEST" "$SYNCED/" + bun run "$FILES/script/sync-test262.ts" "$CHECKOUT" >&2 + echo "$REVISION $(cksum <"$MANIFEST") $(cksum <"$REF_PKG/script/sync-test262.ts")" >"$FILES/stamp" +fi + +cargo build --release --locked -p psychoscript-test262 >&2 +status=0 +target/release/psychoscript-test262 \ + --root "$SYNCED" \ + --reference-skipped "$REF_PKG/test/test262/skipped.txt" \ + --skipped test262/rust-skipped.txt \ + --reference-gaps test262/reference-gaps.txt \ + "$@" || status=$? + +# The other direction: every listed reference gap must still fail in the reference itself. +WRITE="" PREFIX="" SKIP="" +for arg in "$@"; do + if [ -n "$SKIP" ]; then SKIP=""; continue; fi + case $arg in + --write) WRITE=1 ;; + --jobs) SKIP=1 ;; + --*) ;; + *) PREFIX=$arg ;; + esac +done +if [ -z "$WRITE" ]; then + bun test262/reference.ts "$REF_PKG" "$SYNCED" test262/reference-gaps.txt "$PREFIX" >"$FILES/reference.txt" || status=1 + passing=$(grep -c '^pass' "$FILES/reference.txt" || true) + sed -n 's/^pass\t/PASSES IN THE REFERENCE NOW, remove it from reference-gaps.txt /p' "$FILES/reference.txt" + echo "the reference fails $(grep -c '^fail' "$FILES/reference.txt" || true) of the listed reference gaps and passes $passing" + [ "$passing" = 0 ] || status=1 +fi +exit "$status" diff --git a/packages/codemode-rust/test262/rust-skipped.txt b/packages/codemode-rust/test262/rust-skipped.txt new file mode 100644 index 0000000000000..07fa2450172c8 --- /dev/null +++ b/packages/codemode-rust/test262/rust-skipped.txt @@ -0,0 +1,3 @@ +# test262 files that fail here but pass in the reference: the parity gap list. Generated by +# `bash test262/run.sh --write`; CI fails when an unlisted file fails or a listed file passes. +# Fix gaps to shrink it; do not add entries. diff --git a/packages/codemode-rust/test262/src/main.rs b/packages/codemode-rust/test262/src/main.rs new file mode 100644 index 0000000000000..846bcf8c586aa --- /dev/null +++ b/packages/codemode-rust/test262/src/main.rs @@ -0,0 +1,663 @@ +//! Runs the reference's pinned test262 file set through PsychoScript with the reference harness semantics +//! (`packages/codemode/test/test262/run.ts`) and checks the outcome in both directions: against +//! `test262/rust-skipped.txt` (gaps here) and `test262/reference-gaps.txt` (gaps in the reference). +//! +//! Usage: psychoscript-test262 --root DIR --reference-skipped FILE --skipped FILE --reference-gaps FILE +//! [--write] [--jobs N] [prefix] +//! +//! - `--root` is the synced tree holding `built-ins/` and `language/`; see `test262/run.sh`. +//! - A file outside the reference's `skipped.txt` must pass unless `--skipped` lists it, and every listed file must +//! still fail. +//! - A file in the reference's `skipped.txt` must fail unless `--reference-gaps` lists it, and every listed file must +//! still pass and still be in the reference's `skipped.txt`. `test262/reference.ts` checks that the reference +//! still fails them. +//! - `--write` rewrites both lists from the current outcomes instead of checking them. Entries already in +//! `--reference-gaps` keep their category; new ones are marked uncategorised, with the reference's reason. +//! +//! Each file runs in a worker process, so an abort or a hang in one file is reported as that file's failure. + +use std::collections::{BTreeMap, BTreeSet, VecDeque}; +use std::io::{BufRead, BufReader, Write}; +use std::path::{Path, PathBuf}; +use std::process::{Child, ChildStdin, ChildStdout, Command, ExitCode, Stdio}; +use std::sync::{Arc, Mutex}; +use std::time::{Duration, Instant}; + +use psychoscript::DiagnosticKind; + +/// The reference's per-file limit. +const TIMEOUT_MS: u64 = 5000; +/// A file still running this long after its own timeout is a hang the interpreter cannot interrupt. +const HANG: Duration = Duration::from_secs(30); + +const HEADER: &str = "\ +test262 files that fail here but pass in the reference: the parity gap list. Generated by +`bash test262/run.sh --write`; CI fails when an unlisted file fails or a listed file passes. +Fix gaps to shrink it; do not add entries. +"; + +const REFERENCE_HEADER: &str = "\ +test262 files the reference skips (its skipped.txt) that pass here: gaps on the TypeScript side. Categories start +with \"real\" (Rust has the behaviour and TypeScript lacks it) or \"accident\" (Rust passes through a looser check, +where the reference is deliberately strict). Generated by `bash test262/run.sh --write`, which keeps the categories; +CI fails when an unlisted file passes, a listed file fails here, or the reference passes a listed file. +"; + +const PRELUDE: &str = concat!( + "function assert(mustBeTrue, message) { $assert(mustBeTrue, message) } ", + "assert.sameValue = $assert.sameValue; assert.notSameValue = $assert.notSameValue; ", + "assert.compareArray = $assert.compareArray; ", + "assert.throws = function (expected, func, message) { ", + "try { func() } catch (thrown) { $assert.thrown(expected, message, thrown); return } ", + "$assert.notThrown(expected, message) };", +); + +fn main() -> ExitCode { + let args: Vec = std::env::args().skip(1).collect(); + if args.first().map(String::as_str) == Some("--worker") { + return worker(Path::new(args.get(1).map_or(".", String::as_str))); + } + let mut root = None; + let mut reference_skipped = None; + let mut skipped = None; + let mut gaps_path = None; + let mut write = false; + let mut jobs = std::thread::available_parallelism().map_or(4, |n| n.get()); + let mut prefix = String::new(); + let mut it = args.into_iter(); + while let Some(arg) = it.next() { + match arg.as_str() { + "--root" => root = it.next().map(PathBuf::from), + "--reference-skipped" => reference_skipped = it.next().map(PathBuf::from), + "--skipped" => skipped = it.next().map(PathBuf::from), + "--reference-gaps" => gaps_path = it.next().map(PathBuf::from), + "--write" => write = true, + "--jobs" => jobs = it.next().and_then(|n| n.parse().ok()).unwrap_or(jobs), + p if !p.starts_with("--") => prefix = p.to_owned(), + other => return usage(&format!("unknown argument {other}")), + } + } + let (Some(root), Some(reference_skipped), Some(skipped), Some(gaps_path)) = + (root, reference_skipped, skipped, gaps_path) + else { + return usage("--root, --reference-skipped, --skipped and --reference-gaps are required"); + }; + if write && !prefix.is_empty() { + return usage("--write rewrites the whole list, so it takes no prefix"); + } + + let reference = read_list(&reference_skipped); + let listed = read_list(&skipped); + let listed_gaps = read_list(&gaps_path); + let mut files = Vec::new(); + for dir in ["built-ins", "language"] { + collect(&root, &root.join(dir), &mut files); + } + files.sort(); + if files.is_empty() { + eprintln!( + "no test262 files under {}; run test262/run.sh", + root.display() + ); + return ExitCode::FAILURE; + } + let in_scope: BTreeSet = files + .iter() + .filter(|f| !reference.contains_key(*f)) + .cloned() + .collect(); + let queue: VecDeque = files + .iter() + .filter(|f| f.starts_with(&prefix)) + .cloned() + .collect(); + let started = Instant::now(); + let mut results = run_all(&root, queue, jobs.max(1)); + // The reference's own skipped files, checked against `--reference-gaps`. + let reference_results: BTreeMap> = results + .keys() + .filter(|f| !in_scope.contains(*f)) + .cloned() + .collect::>() + .into_iter() + .filter_map(|f| results.remove(&f).map(|r| (f, r))) + .collect(); + let reference_passes: Vec<&String> = reference_results + .iter() + .filter(|(_, r)| r.is_ok()) + .map(|(f, _)| f) + .collect(); + let total = results.len(); + + let failures: BTreeMap<&String, &String> = results + .iter() + .filter_map(|(f, r)| r.as_ref().err().map(|reason| (f, reason))) + .collect(); + println!( + "{} pass, {} fail of {total} files in {:.1} s", + total - failures.len(), + failures.len(), + started.elapsed().as_secs_f64(), + ); + println!( + "{} of the {} files in the reference's skipped.txt pass here: gaps on the reference side", + reference_passes.len(), + reference_results.len() + ); + let mut counts: BTreeMap = BTreeMap::new(); + for reason in failures.values() { + *counts.entry(category(reason)).or_default() += 1; + } + let mut counts: Vec<_> = counts.into_iter().collect(); + counts.sort_by(|a, b| b.1.cmp(&a.1).then_with(|| a.0.cmp(&b.0))); + for (category, count) in &counts { + println!("{count:>6} {category}"); + } + + if write { + let lines: String = HEADER + .lines() + .map(|line| format!("# {line}\n").replace("# \n", "#\n")) + .chain( + failures + .iter() + .map(|(file, reason)| format!("{file} # {}\n", category(reason))), + ) + .collect(); + if let Err(e) = std::fs::write(&skipped, lines) { + eprintln!("{}: {e}", skipped.display()); + return ExitCode::FAILURE; + } + println!("wrote {} entries to {}", failures.len(), skipped.display()); + let lines: String = REFERENCE_HEADER + .lines() + .map(|line| format!("# {line}\n")) + .chain(reference_passes.iter().map(|file| { + let category = listed_gaps.get(*file).cloned().unwrap_or_else(|| { + let reason = reference.get(*file).map_or("", String::as_str); + format!("uncategorised: the reference says {reason}") + }); + format!("{file} # {category}\n") + })) + .collect(); + if let Err(e) = std::fs::write(&gaps_path, lines) { + eprintln!("{}: {e}", gaps_path.display()); + return ExitCode::FAILURE; + } + println!( + "wrote {} entries to {}", + reference_passes.len(), + gaps_path.display() + ); + return ExitCode::SUCCESS; + } + + let new: Vec<_> = failures + .iter() + .filter(|(file, _)| !listed.contains_key(**file)) + .collect(); + let fixed: Vec<_> = results + .iter() + .filter(|(file, r)| r.is_ok() && listed.contains_key(*file)) + .map(|(file, _)| file) + .collect(); + let gone: Vec<_> = if prefix.is_empty() { + listed.keys().filter(|f| !in_scope.contains(*f)).collect() + } else { + Vec::new() + }; + let unlisted_gaps: Vec<_> = reference_passes + .iter() + .filter(|f| !listed_gaps.contains_key(**f)) + .collect(); + let failing_gaps: Vec<_> = reference_results + .iter() + .filter_map(|(f, r)| match r { + Err(reason) if listed_gaps.contains_key(f) => Some((f, reason)), + _ => None, + }) + .collect(); + let not_skipped: Vec<_> = listed_gaps + .keys() + .filter(|f| { + f.starts_with(&prefix) + && (!reference.contains_key(*f) || files.binary_search(f).is_err()) + }) + .collect(); + for (file, reason) in &new { + println!("FAIL {file} # {reason}"); + } + for file in &fixed { + println!("PASSES NOW, remove it from rust-skipped.txt {file}"); + } + for file in &gone { + println!("NOT IN THE FILE SET, remove it from rust-skipped.txt {file}"); + } + for file in &unlisted_gaps { + println!("PASSES BUT THE REFERENCE SKIPS IT, add it to reference-gaps.txt {file}"); + } + for (file, reason) in &failing_gaps { + println!("FAILS NOW, remove it from reference-gaps.txt {file} # {reason}"); + } + for file in ¬_skipped { + println!("NOT A SKIPPED FILE OF THE REFERENCE, remove it from reference-gaps.txt {file}"); + } + let problems = new.len() + + fixed.len() + + gone.len() + + unlisted_gaps.len() + + failing_gaps.len() + + not_skipped.len(); + if problems == 0 { + println!( + "every failure is listed in {}, and every pass the reference skips in {}", + skipped.display(), + gaps_path.display() + ); + return ExitCode::SUCCESS; + } + println!( + "rust-skipped.txt: {} unlisted failures, {} listed files that pass, {} listed files not in the set", + new.len(), + fixed.len(), + gone.len() + ); + println!( + "reference-gaps.txt: {} unlisted passes, {} listed files that fail, {} listed files the reference no longer skips or no longer has", + unlisted_gaps.len(), + failing_gaps.len(), + not_skipped.len() + ); + ExitCode::FAILURE +} + +fn usage(problem: &str) -> ExitCode { + eprintln!("{problem}"); + eprintln!( + "usage: psychoscript-test262 --root DIR --reference-skipped FILE --skipped FILE --reference-gaps FILE [--write] [--jobs N] [prefix]" + ); + ExitCode::FAILURE +} + +/// A `path # reason` list; lines without `#` are ignored, as in the reference. +fn read_list(path: &Path) -> BTreeMap { + std::fs::read_to_string(path) + .unwrap_or_default() + .lines() + .filter(|line| !line.starts_with('#')) + .filter_map(|line| { + let (file, reason) = line.split_once('#')?; + Some((file.trim().to_owned(), reason.trim().to_owned())) + }) + .collect() +} + +fn collect(root: &Path, dir: &Path, out: &mut Vec) { + let Ok(entries) = std::fs::read_dir(dir) else { + return; + }; + for entry in entries.flatten() { + let path = entry.path(); + if path.is_dir() { + collect(root, &path, out); + } else if path.extension().is_some_and(|e| e == "js") + && let Ok(rel) = path.strip_prefix(root) + { + out.push(rel.to_string_lossy().replace('\\', "/")); + } + } +} + +// ---------- parent: worker pool ---------- + +type Results = BTreeMap>; + +struct Worker { + child: Child, + stdin: ChildStdin, + stdout: BufReader, +} + +fn spawn(root: &Path) -> Option { + let exe = std::env::current_exe().ok()?; + let mut child = Command::new(exe) + .arg("--worker") + .arg(root) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::null()) + .spawn() + .ok()?; + let stdin = child.stdin.take()?; + let stdout = BufReader::new(child.stdout.take()?); + Some(Worker { + child, + stdin, + stdout, + }) +} + +fn run_all(root: &Path, queue: VecDeque, jobs: usize) -> Results { + let queue = Arc::new(Mutex::new(queue)); + let results = Arc::new(Mutex::new(Results::new())); + std::thread::scope(|s| { + for _ in 0..jobs { + let (queue, results) = (queue.clone(), results.clone()); + s.spawn(move || { + let mut worker: Option = None; + // A function call, so the queue lock is released before the file runs. + let next = || queue.lock().ok().and_then(|mut q| q.pop_front()); + while let Some(file) = next() { + let outcome = run_in_worker(root, &mut worker, &file); + if let Ok(mut r) = results.lock() { + r.insert(file, outcome); + } + } + if let Some(mut w) = worker { + drop(w.stdin); + let _ = w.child.wait(); + } + }); + } + }); + Arc::try_unwrap(results) + .ok() + .and_then(|m| m.into_inner().ok()) + .unwrap_or_default() +} + +fn run_in_worker(root: &Path, slot: &mut Option, file: &str) -> Result<(), String> { + for _ in 0..2 { + if slot.is_none() { + *slot = spawn(root); + } + let Some(w) = slot.as_mut() else { + return Err("crash: cannot start a worker".into()); + }; + if writeln!(w.stdin, "{file}") + .and_then(|_| w.stdin.flush()) + .is_err() + { + if let Some(mut w) = slot.take() { + let _ = w.child.wait(); + } + continue; + } + let mut line = String::new(); + let read = w.stdout.read_line(&mut line); + if matches!(read, Ok(n) if n > 0) { + let line = line.trim_end(); + let (status, reason) = line.split_once('\t').unwrap_or((line, "")); + if status == "hang" + && let Some(mut w) = slot.take() + { + let _ = w.child.wait(); + } + return if status == "pass" { + Ok(()) + } else { + Err(reason.to_owned()) + }; + } + let status = slot.take().and_then(|mut w| w.child.wait().ok()); + let how = status.map_or("unknown status".to_owned(), |s| s.to_string()); + return Err(format!("crash: the worker process died ({how})")); + } + Err("crash: cannot reach a worker".into()) +} + +// ---------- worker ---------- + +fn worker(root: &Path) -> ExitCode { + let current: Arc>> = Arc::new(Mutex::new(None)); + let watched = current.clone(); + std::thread::spawn(move || { + loop { + std::thread::sleep(Duration::from_millis(500)); + let started = watched.lock().ok().and_then(|c| *c); + if started.is_some_and(|t| t.elapsed() > HANG + Duration::from_millis(TIMEOUT_MS)) { + let mut out = std::io::stdout().lock(); + let _ = writeln!(out, "hang\thang: no result after {} s", HANG.as_secs()); + let _ = out.flush(); + std::process::exit(3); + } + } + }); + let stdin = std::io::stdin(); + for line in stdin.lock().lines() { + let Ok(file) = line else { break }; + if let Ok(mut c) = current.lock() { + *c = Some(Instant::now()); + } + let outcome = run_file(&root.join(&file)); + let mut out = std::io::stdout().lock(); + if let Ok(mut c) = current.lock() { + *c = None; + } + let written = match outcome { + Ok(()) => writeln!(out, "pass"), + Err(reason) => writeln!(out, "fail\t{}", printable(&reason)), + }; + if written.and_then(|_| out.flush()).is_err() { + break; + } + } + ExitCode::SUCCESS +} + +/// A reason on one line of printable text. +fn printable(reason: &str) -> String { + reason + .chars() + .map(|c| match c { + '\n' | '\r' | '\t' => " ".to_owned(), + c if c.is_control() => c.escape_unicode().to_string(), + c => c.to_string(), + }) + .collect() +} + +#[derive(Default)] +struct Frontmatter { + flags: Vec, + negative: Option<(String, String)>, +} + +/// The `flags` and `negative` keys of a test262 YAML frontmatter, in the shapes test262 writes them. +fn frontmatter(source: &str) -> Frontmatter { + let mut meta = Frontmatter::default(); + let Some(start) = source.find("/*---") else { + return meta; + }; + let body = &source[start + 5..]; + let body = &body[..body.find("---*/").unwrap_or(body.len())]; + let mut key = ""; + let (mut phase, mut kind) = (None, None); + for line in body.lines() { + let indented = line.starts_with([' ', '\t']); + let line = line.trim(); + if line.is_empty() || line.starts_with('#') { + continue; + } + if !indented { + let (k, v) = line.split_once(':').unwrap_or((line, "")); + key = k.trim(); + let v = v.trim(); + if key == "flags" + && let Some(list) = v.strip_prefix('[').and_then(|v| v.strip_suffix(']')) + { + meta.flags + .extend(list.split(',').map(|f| f.trim().to_owned())); + } + continue; + } + match key { + "flags" => { + if let Some(f) = line.strip_prefix('-') { + meta.flags.push(f.trim().to_owned()); + } + } + "negative" => { + if let Some((k, v)) = line.split_once(':') { + match k.trim() { + "phase" => phase = Some(v.trim().to_owned()), + "type" => kind = Some(v.trim().to_owned()), + _ => {} + } + } + } + _ => {} + } + } + if let (Some(phase), Some(kind)) = (phase, kind) { + meta.negative = Some((phase, kind)); + } + meta +} + +fn kind_name(kind: &DiagnosticKind) -> &str { + kind.name() +} + +/// One file, with the reference's semantics: strict mode, the prelude on the directive's line, the job queue +/// drained for async tests, and negative tests judged by phase. +fn run_file(path: &Path) -> Result<(), String> { + let source = std::fs::read_to_string(path).map_err(|e| format!("read: {e}"))?; + let meta = frontmatter(&source); + let is_async = meta.flags.iter().any(|f| f == "async"); + let drain = if is_async { + "\nfor (let i = 0; i < 100; i++) await null" + } else { + "" + }; + let code = format!("\"use strict\"; {PRELUDE}\n{source}{drain}"); + let run = psychoscript::test262::run(&code, TIMEOUT_MS); + if let Some((phase, kind)) = &meta.negative { + return match &run.result { + Ok(()) => Err(format!("expected {kind} but completed")), + Err(_) if phase == "runtime" => Ok(()), + Err(d) if d.kind == DiagnosticKind::ParseError => Ok(()), + Err(d) => Err(format!( + "expected {kind} but got {}: {}", + kind_name(&d.kind), + d.message + )), + }; + } + if let Err(d) = &run.result { + return Err(format!("{}: {}", kind_name(&d.kind), d.message)); + } + if !is_async { + return Ok(()); + } + match run.done { + None => Err("$DONE was never called".into()), + Some(Some(error)) => Err(format!("$DONE: {error}")), + Some(None) => Ok(()), + } +} + +/// A short, stable reason category for the gap list, from a failure message. +fn category(reason: &str) -> String { + let unsupported = |r: &str| { + let r = r.split_once("UnsupportedSyntax: ")?.1; + Some(format!( + "unsupported syntax: {}", + r.split(" is not supported").next()?.to_lowercase() + )) + }; + if let Some(c) = unsupported(reason) { + return c; + } + if let Some(rest) = reason.split("Unknown identifier '").nth(1) { + return format!("missing global: {}", rest.split('\'').next().unwrap_or("")); + } + if reason.starts_with("crash:") || reason.starts_with("hang:") { + return reason.split(" (").next().unwrap_or(reason).to_owned(); + } + if reason.contains("Internal interpreter error") { + return "interpreter panic".into(); + } + if let Some(rest) = reason.strip_prefix("expected ") { + let kind = rest.split(' ').next().unwrap_or(""); + if rest.ends_with("but completed") { + return format!("negative test completed: no {kind}"); + } + let got = rest.split(" but got ").nth(1).unwrap_or(""); + return format!( + "negative test: {} instead of a parse error", + got.split(':').next().unwrap_or(got) + ); + } + if reason == "$DONE was never called" { + return "async: $DONE never called".into(); + } + let (asynchronous, body) = match reason.strip_prefix("$DONE: ") { + Some(body) => (true, body), + None => (false, reason), + }; + let body = body + .trim_start_matches("ExecutionFailure: ") + .trim_start_matches("Uncaught: "); + let category = if let Some((_, rest)) = body.split_once("Expected a ") + && let Some((expected, rest)) = rest.split_once(" but got a ") + { + let actual = rest.split(' ').next().unwrap_or(rest); + format!("wrong error type: {actual} instead of {expected}") + } else if let Some((_, rest)) = body.split_once("Expected a ") + && rest.contains("to be thrown but no exception was thrown") + { + format!( + "error not thrown: {}", + rest.split(' ').next().unwrap_or(rest) + ) + } else if body.starts_with("Test262Error") || body.starts_with('"') { + "wrong result".into() + } else if let Some(message) = body.strip_prefix("ParseError: ") { + format!("spurious parse error: {}", normalize(message)) + } else if body.starts_with("TimeoutExceeded") { + "timeout".into() + } else if body.contains(" is not a function") { + "call of a missing method".into() + } else { + format!("uncaught {}", normalize(body)) + }; + if asynchronous { + format!("async: {category}") + } else { + category + } +} + +/// Drops what identifies the test rather than the cause: quoted names, numbers and locations. +fn normalize(message: &str) -> String { + let message = message.trim_start_matches("SyntaxError: "); + let message = message.split(" (line ").next().unwrap_or(message); + let mut out = String::new(); + let mut quote = None; + for c in message.chars() { + match quote { + Some(q) if c == q => { + out.push('…'); + out.push(c); + quote = None; + } + Some(_) => {} + None if matches!(c, '\'' | '`' | '"') => { + out.push(c); + quote = Some(c); + } + None if c.is_ascii_digit() => { + if !out.ends_with('N') { + out.push('N'); + } + } + None => out.push(c), + } + } + let out = out.trim_end_matches('.').to_owned(); + match out.char_indices().nth(80) { + Some((i, _)) => format!("{}…", &out[..i]), + None => out, + } +} diff --git a/packages/codemode/AGENTS.md b/packages/codemode/AGENTS.md index 75f76b24bf9e1..e1385f763290d 100644 --- a/packages/codemode/AGENTS.md +++ b/packages/codemode/AGENTS.md @@ -5,3 +5,4 @@ - Program values are `Value` (`src/language/runtime/objects.ts`). Host values are `unknown` and enter only through `fromHost` and `fromJson`; do not widen program-facing signatures to `unknown`. - Each built-in object kind is one `Obj` subclass (`Wrapper` or `Opaque`) that overrides the hooks it needs. Ask the object instead of adding `instanceof` ladders. - The core VM, compiler, prelude, snapshot, and stdlib modules must not import `effect`; in `src/language/`, Effect lives only in the host boundary and driver (`runtime.ts`, `host-function.ts`, `runtime/driver.ts`, `runtime/execute.ts`, `runtime/extensions.ts`). `src/codemode/` uses Effect freely. +- `packages/codemode-rust` runs and embeds the same language from Rust. The two packages must stay equally capable: a feature lands in both or neither. Its conformance expectations are generated from this package, so a behavior change here fails its CI until the Rust side matches. diff --git a/packages/codemode/interpreter-support.md b/packages/codemode/interpreter-support.md index 7a0189d6decfb..2d05ed704b3d7 100644 --- a/packages/codemode/interpreter-support.md +++ b/packages/codemode/interpreter-support.md @@ -92,7 +92,7 @@ the ultimate source of truth. Upstream test262 files run verbatim from `test/tes - [x] Object and array destructuring in declarations, parameters, assignment expressions, and `for...of` bindings. - [x] Nested patterns, defaults, elisions, and rest elements. - [x] Assignment to identifiers, plain-object fields, non-negative integer array indexes, and writable URL - fields. + fields. `o.x = v` evaluates `v` before checking `o`, so `null.x = f()` calls `f` and then throws. - [x] Direct function declarations are hoisted in program and block statement lists. - [x] Parameter defaults observe a temporal dead zone for later parameters. - [x] `var` is function-scoped and hoisted: names declared anywhere in a function or program body, including loop @@ -195,8 +195,10 @@ Math.floor)` is `"3"`). A detached method loses its receiver, as in JS: `values. - [x] Redeclaring a function in the same scope, or alongside a `var`, is allowed: the last declaration wins. - [x] Generator functions have their own `prototype` (inheriting the shared generator prototype), so `g() instanceof g` holds. Plain functions have none, since they cannot construct. -- [ ] `GeneratorFunction.prototype`: every function, generator or not, inherits directly from `Function.prototype`, - and a generator whose `prototype` was replaced by a non-object still creates from the shared generator prototype. +- [x] `GeneratorFunction.prototype`, `AsyncGeneratorFunction.prototype`, and `AsyncFunction.prototype`: generator, + async generator, and async functions (arrows included) inherit from these non-callable objects, which inherit + `Function.prototype`; the generator ones link to the shared generator prototypes through `prototype` and + `constructor`. A generator whose `prototype` was replaced by a non-object creates from the shared one. - [x] Generator and async generator functions bind parameters (defaults, destructuring) at the call and defer only the body to the first `next()`, so a bad argument throws synchronously from the call site, as in JS. - [x] Synchronous and async generator declarations/expressions, `yield`, and `yield*`, including lazy bodies, @@ -248,8 +250,11 @@ Math.floor)` is `"3"`). A detached method loses its receiver, as in JS: `values. creates a hole without changing its length. Deleting a non-configurable property (`length`) or assigning a read-only one (`Math.PI`, `fn.name`) throws a `TypeError`, as in strict mode. `delete` of a non-reference (`delete 0`, `delete f()`) evaluates the operand and is `true`; `delete x` on a variable throws. + A primitive base deletes from its wrapper: `delete "abc"[5]` and `delete (1).x` are `true`, while a string's + own index or `length` throws. - [x] Coercion helpers and template interpolation accept functions and namespaces: `String(fn)` and `${fn}` give - `"[object Function]"` rather than the source text, `isNaN(fn)` is `true`. + `"[object Function]"` rather than the source text (unless the function has its own `toString` or `valueOf`), + `isNaN(fn)` is `true`. - [x] `==` and `!=` follow IsLooselyEqual: objects (including functions and tool references) compare by identity, a nullish operand never coerces the other side, and a data object facing a primitive converts through its own `valueOf`/`toString` (default hint) (`fn == null` is `false`, `fn == fn` is `true`, `[1] == 1` and `[1, 2] == "1,2"` are `true`). @@ -257,9 +262,11 @@ Math.floor)` is `"3"`). A detached method loses its receiver, as in JS: `values. values. Operators inspect only their direct operands, so `rows == null` on a large array costs the same as `rows === null`, and an object merely holding a function inside (`[fn] + ""`, `-[fn]`) coerces like any other data object (`"[object Function]"`, `NaN`). -- [ ] Coercing a function, promise, generator, or tool reference itself: `fn + ""`, `-fn`, `fn++`, and `fn == 1` - throw `TypeError: Binary operators require data values.` (or the unary/update form) where JavaScript would use - the source text or `NaN`. +- [x] Functions, generators, and iterators convert through ToPrimitive like any other object, in operators and in + built-in arguments: `fn + ""` is `"[object Function]"` (not the source text), `-fn` and `fn++` give `NaN`, + `fn == 1` is `false`, and an own `valueOf` or `toString` is used. A promise or tool reference is never + converted, so a missing `await` cannot hide: `promise + 1`, `-promise`, and `promise == 1` throw + `TypeError: Binary operators require data values.` (or the unary/update form). - [x] ToPrimitive on program objects: `+ - * / % **`, the relational and bitwise operators, unary `+ - ~`, `++`/`--`, compound assignment, `${x}`, `Number`/`String`/`isNaN`/`isFinite`, `parseInt`/`parseFloat` (text and radix), `Math.*` arguments, `Error(message)`, and `Array.prototype.join`/`toString` elements call the object's own @@ -272,14 +279,20 @@ Math.floor)` is `"3"`). A detached method loses its receiver, as in JS: `values. hint (`"abc".indexOf({ toString() { return "b" } })` is `1`, `(255).toString({ valueOf() { return 16 } })` is `"ff"`, `String.prototype.trim.call({ toString() { return " a " } })` is `"a"`). Only consumed positions convert; a RegExp pattern is used as is, and `includes`/`startsWith`/`endsWith` reject one before converting. -- [ ] ToPrimitive elsewhere: `Error.prototype.toString` on an object `message` and numeric arguments of the Array and +- [x] Array methods, lengths, and elements convert through ToPrimitive: the integer arguments of `at`, `indexOf`, + `lastIndexOf`, `includes`, `slice`, `splice`, `toSpliced`, `fill`, `copyWithin`, `with`, and `flat` (in order, + before the array is read, and not at all for an empty array's `indexOf`/`lastIndexOf`/`includes`), + `length = object` (number hint), and the elements a default `sort` compares (one ToString each). So do + `String.fromCharCode`/`fromCodePoint` arguments, `JSON.parse(text)`, and a `String.prototype[Symbol.iterator]` + receiver; `repeat(NaN)` is `""`. +- [ ] ToPrimitive elsewhere: `Error.prototype.toString` on an object `message` and numeric arguments of the Uint8Array methods (`at`, `indexOf` start, `slice`) still use the built-in form (`NaN`, `"[object Object]"`) and ignore own methods. - [x] Property keys follow ToPropertyKey: `x[null]` and `x[true]` become string keys, and a data object key converts through its own `toString`/`valueOf` (string hint) exactly once per access, in reads, writes, compound assignment, `++`, `delete`, `in`, object literals, and destructuring: `o[{ toString() { return "id" } }] += 1` updates `o.id`. A nullish base throws before the key converts, as - in JS. Opaque values (functions, promises, tool references) keep their built-in string form. + in JS. Promises and tool references keep their built-in string form. ## Promises and tools @@ -319,7 +332,7 @@ Math.floor)` is `"3"`). A detached method loses its receiver, as in JS: `values. accepted, including `.then`/`.catch` handlers and collection callbacks, and vanish at the data boundary like any function. - [x] `Promise.withResolvers()`: the same promise and resolver callables as the constructor, as a `{ promise, resolve, -reject }` object. +reject }` object. The resolvers are anonymous (`name` is `""`) with `length` 1, as every resolving function is. - [x] `Promise.try(fn, ...args)`: calls `fn` synchronously; a throw rejects, a return fulfils, and a returned promise or thenable is adopted. - [x] Recursive assimilation of objects with an own callable `then` field across `Promise.resolve`, combinators, @@ -339,7 +352,8 @@ reject }` object. - [x] Own-field reads and writes on plain data objects. - [x] `new` dispatches on the evaluated constructor value, so aliases (`const D = Date; new D()`), constructors held in objects, and constructors passed as arguments work, while a shadowed name (`const Date = 5; new Date()`) does - not construct. + not construct. The arguments are evaluated before the callee is checked, so `new x(x = Date)` with `x = 1` + throws its `TypeError` after the assignment. - [x] `Object()` and `new Object()` return `{}` for nullish arguments and pass objects through unchanged; primitive wrapper objects (`Object(1)`) are rejected explicitly. - [x] Computed property names and object spread. Any value works as a key (ToPropertyKey): strings, numbers, and the @@ -394,7 +408,8 @@ reject }` object. - [x] The `Array` constructor with or without `new`: `Array(a, b)` collects arguments and `Array(n)` creates a sparse array of that length; invalid lengths throw `RangeError`. Iteration, spread, join, `flatMap`, and JSON handle - holes like JavaScript, and host results normalize holes to `null`. + holes like JavaScript, and host results normalize holes to `null`. A hole reads, and `in` finds, an index + inherited from `Array.prototype`, so the callback methods visit it. - [x] Static methods: `Array.isArray`, `Array.of`, and `Array.from`, including the `Array.from` mapper form with `(value, index)` arguments and stepwise synchronous iterator consumption. - [x] Iteration/transformation: `map`, `filter`, `flatMap`, and `forEach`. @@ -410,7 +425,8 @@ reject }` object. with `next()` and `[Symbol.iterator]`, as in JS. Iterator objects are opaque references: they print as `[opaque reference]`, serialize to `{}`, and cannot be passed to extensions. Every built-in collection iterator shares one prototype, where JavaScript gives each collection its own; `Object.getPrototypeOf` shows the - difference. + difference. `Object.prototype.toString` still reports each one's kind: `[object Array Iterator]`, + `[object Map Iterator]`, `[object String Iterator]`, and so on. - [x] `length`, numeric indexing, index assignment, spread, and `for...of`. - [x] `Array.prototype.toSpliced`. - [x] Canonical array/string index parsing: keys such as `"01"` are ordinary properties rather than aliases of index @@ -425,8 +441,8 @@ reject }` object. `String.fromCharCode("65")`, and the Uint8Array equivalents. `join(sep)` and `JSON.parse(text)` apply ToString (`join(null)` is `"1null2"`, `JSON.parse(123)` is `123`). `Array.from({ length: "2" })` applies ToLength; a promise source still throws with an `await` hint rather than JS's silent `[]`. `join`, `Math.*`, `parseInt`, - and the String and Number methods consult a program object's own `valueOf`/`toString`; the array methods do not - yet (see ToPrimitive above). + and the String, Number, and Array methods consult a program object's own `valueOf`/`toString`; the Uint8Array + methods do not yet (see ToPrimitive above). ## Strings @@ -444,7 +460,7 @@ reject }` object. - [x] Native argument coercion for supported String methods; for example, `includes(1)` and `slice("1")` coerce like native JS, `split(undefined)` returns the whole string, and `includes`/`startsWith`/`endsWith` reject regular expressions with a native-style `TypeError`. Data objects convert through their own `toString`/`valueOf` (see - ToPrimitive above). Opaque runtime references still reject as data errors, and `repeat` still requires a finite + ToPrimitive above). Promises and tool references still reject as data errors, and `repeat` still requires a finite non-negative count. - [x] Native no-argument parity for `match()`, `matchAll()`, and `search()`; all behave as an empty pattern. - [x] `String.raw`, on a template object or any `{ raw }` object; raw strings and substitutions coerce through their own @@ -471,7 +487,7 @@ reject }` object. - [x] Native zero-argument behavior for `Number()` and `String()`: they produce `0` and `""`, while `Number(undefined)` stays `NaN` and `String(undefined)` stays `"undefined"`. - [x] `++` and `--` use CodeMode numeric coercion (numeric strings increment, plain data objects become `NaN`, Dates - use their epoch time) and reject opaque runtime references as data errors. + use their epoch time, functions become `NaN`) and reject promises and tool references as data errors. - [x] Unknown static members on global namespaces and on `Number`/`String`/the coercion functions read as `undefined` for feature detection. Calling any undefined value reports a native-style `TypeError` naming the callee, for example `Math.sum is not a function.` or `search(...).catch is not a function.` Unknown `Promise` statics keep @@ -557,7 +573,7 @@ reject }` object. - [x] `new Set()` from synchronous iterables. - [x] Set `add`, `has`, `delete`, `clear`, `size`, and `forEach`. - [x] Live `keys`, `values`, `entries`, and `[Symbol.iterator]` iterators for Map and Set; a Set-like operand's `keys()` - may return any iterator or an array. + may return any iterator or an array. `Set.prototype.keys` is the same function as `values`. - [x] Spread, `for...of`, `Array.from`, and `Object.fromEntries` integration. - [x] Map and Set values serialize to `{}` at host/JSON boundaries. - [x] Set composition and relation methods: `union`, `intersection`, `difference`, `symmetricDifference`, `isSubsetOf`, @@ -683,7 +699,8 @@ Nothing is exposed unless a host provides it; extension calls are not tool calls - [x] `Error`, `TypeError`, `RangeError`, `SyntaxError`, `ReferenceError`, `EvalError`, and `URIError`, callable with or without `new`. - [x] `AggregateError` with the `(errors, message?)` signature and an own `errors` array, constructed directly or by - an all-rejected `Promise.any`; direct construction accepts custom synchronous iterators and generators. + an all-rejected `Promise.any`; direct construction accepts custom synchronous iterators and generators. Without + a message it has no own `message`, as in JS, and inherits `""`. - [x] Error `name`/`message`, error inheritance through `instanceof`, and plain-data serialization. `message` is an own non-enumerable property and `name` is inherited, as in JS, so `Object.keys(err)` is `[]` for a plain error. The result boundary still emits `{ name, message, ...own enumerable }`, so a field such as `code` crosses. `cause` is diff --git a/packages/codemode/package.json b/packages/codemode/package.json index 7f256b2a3aeb1..a4977f054ccca 100644 --- a/packages/codemode/package.json +++ b/packages/codemode/package.json @@ -28,7 +28,7 @@ "test:roundtrip": "CODEMODE_ROUNDTRIP=1 bun test" }, "dependencies": { - "acorn": "8.15.0", + "acorn": "8.16.0", "effect": "catalog:" }, "devDependencies": { diff --git a/packages/codemode/script/disasm.ts b/packages/codemode/script/disasm.ts index f61c1b7b7ba8f..c08434e6bb9a6 100644 --- a/packages/codemode/script/disasm.ts +++ b/packages/codemode/script/disasm.ts @@ -142,9 +142,8 @@ const formatOperand = (c: Code, op: number, a: number, bx: number, sbx: number): case Op.PICK: case Op.ROT: case Op.CALL: - return String(a) case Op.NEW: - return a === 255 ? "check" : String(a) + return String(a) case Op.GET_LOCAL: case Op.HOLE_LOCAL: case Op.COPY_CELL: @@ -195,7 +194,9 @@ const formatOperand = (c: Code, op: number, a: number, bx: number, sbx: number): ? `.writeProp ${JSON.stringify(c.consts[bx])}` : a === CheckBaseKind.WRITE_ELEM ? ".writeElem" - : ".destructure" + : a === CheckBaseKind.ASSIGN_PROP + ? `.assignProp ${JSON.stringify(c.consts[bx])}` + : ".destructure" case Op.BINOP: return BinOpSymbols[a] ?? String(a) case Op.UNARY: diff --git a/packages/codemode/src/language/compiler/compile.ts b/packages/codemode/src/language/compiler/compile.ts index 570f08bbb357d..3ddb3f320c86a 100644 --- a/packages/codemode/src/language/compiler/compile.ts +++ b/packages/codemode/src/language/compiler/compile.ts @@ -1431,6 +1431,12 @@ const compileFunctionBody = ( if (left.computed) { compileExpression(left.property as Expression) emitWritableKey(left) + } else if (op === "=") { + // PutValue checks the base, so the right side is evaluated first: `null.x = f()` calls `f`. + compileExpression(node.right) + builder.emit(Op.CHECK_BASE, CheckBaseKind.ASSIGN_PROP, k, idx(left), 0) + put() + return } else builder.emit(Op.CHECK_BASE, CheckBaseKind.WRITE_PROP, k, idx(left), 0) if (op === "=") { compileExpression(node.right) @@ -1552,9 +1558,8 @@ const compileFunctionBody = ( [...analysis.classConstructors].some(([c, fn]) => fn === ctor && analysis.classFieldInits.get(c)?.instance) const compileNewExpression = (node: NewExpression): void => { + // The callee, then the arguments, and only then the constructibility check, as in EvaluateNew. compileExpression(node.callee as Expression) - // Check constructibility before evaluating arguments - builder.emit(Op.NEW, 255, 0, idx(node), 0) const args = node.arguments if (emitArguments(args, node)) builder.emit(Op.NEW_SPREAD, 0, 0, idx(node), -1) else builder.emit(Op.NEW, args.length, 0, idx(node), -args.length) diff --git a/packages/codemode/src/language/internal-prelude.ts b/packages/codemode/src/language/internal-prelude.ts index 970d7aec840f4..5835dca764f6d 100644 --- a/packages/codemode/src/language/internal-prelude.ts +++ b/packages/codemode/src/language/internal-prelude.ts @@ -48,8 +48,9 @@ export class VmIntrinsic { } export const INTERNAL_SOURCE = String.raw` +// A promise stays as it is, so that the operator or built-in it reaches rejects it as an un-awaited value. function $vmToPrimitive(v, hint) { - if (!$IsDataObj(v)) return v + if (!$IsObj(v) || $IsPromise(v)) return v const first = hint === "string" || (hint === "default" && $IsDate(v)) ? "toString" : "valueOf" const second = first === "toString" ? "valueOf" : "toString" const m1 = v[first] @@ -99,6 +100,11 @@ function $vmBinary(op, lhs, rhs) { return $ApplyBinary(op, l, r) } +function $vmSetLength(o, v) { + o.length = $vmToPrimitive(v, "number") + return v +} + // A write that reached a program setter: the assignment's value is what was assigned, not what the setter returns. function $vmSet(setter, receiver, value) { $Call(setter, receiver, value) @@ -324,7 +330,6 @@ export const registerVmIntrinsics = (map: Map, vm: Vm): void => } add("$IsObj", ([v]) => v instanceof Obj) - add("$IsDataObj", ([v]) => v instanceof Obj && !isOpaque(v)) add("$IsDate", ([v]) => v instanceof DateObj) add("$IsPromise", ([v]) => v instanceof PromiseObj) add("$IsArray", ([v]) => v instanceof Arr) diff --git a/packages/codemode/src/language/opcodes.ts b/packages/codemode/src/language/opcodes.ts index bdecb1987f3bb..ffaac005d0d9c 100644 --- a/packages/codemode/src/language/opcodes.ts +++ b/packages/codemode/src/language/opcodes.ts @@ -247,6 +247,8 @@ export const CheckBaseKind = { WRITE_ELEM: 2, /** Destructuring target check: throws if top is null or undefined (`[v] -> [v]`). */ DESTRUCTURE: 3, + /** `o.x = v`: the `WRITE_PROP` check, made once the right side is evaluated (`[o, v] -> [o, v]`, `bx = k`). */ + ASSIGN_PROP: 4, } as const /** Sub-ops for `Op.ITER_OPEN` and `Op.ITER_INIT` (`a` operand). */ diff --git a/packages/codemode/src/language/prelude/bytecode.json b/packages/codemode/src/language/prelude/bytecode.json index d2547cd67d26b..7b1b1794d7798 100644 --- a/packages/codemode/src/language/prelude/bytecode.json +++ b/packages/codemode/src/language/prelude/bytecode.json @@ -1 +1 @@ -{"@prelude":{"text":"2bbe9d5bd76f2b01","codes":[{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":0,"name":"","flags":202,"length":0,"params":0,"locals":0,"maxStack":1,"code":[0,87],"consts":[],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,0],"localNames":[],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":1,"name":"arrayFromIterable","flags":72,"length":3,"params":3,"locals":8,"maxStack":8,"code":[36,196875,3,262411,327692,10,2228298,2228283,393483,3147340,2424891,327692,327947,0,20,196618,262154,65546,0,50,1507389,327690,1835067,131082,65546,327690,262154,582,838,5,262154,56,262155,589884,70,75,524347,70,3147341,720955,459019,2885198,70,5,458762,64,5,2883643,196618,67],"consts":["$ArraySet"],"captures":[],"handlers":[11,34,40,0,41,44,46,0],"finallies":[],"finallyOffsets":[],"sites":[0,10,1,8,2,14,3,12,5,19,6,15,12,16,13,22,14,23,15,24,16,25,17,28,18,29,19,27,20,26,21,30,22,26,23,34,24,33,25,35,26,36,27,31,28,22,30,39,31,38,32,39,33,15,48,41,49,40],"localNames":["items","mapper","thisArg","result","index","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":2,"name":"arrayFromLike","flags":72,"length":4,"params":4,"locals":6,"maxStack":8,"code":[20,65352,65546,328,262411,3,327947,327690,65546,46,1835069,0,65556,262154,327690,196618,131082,10,327690,26,327690,582,838,5,327690,56,327691,458812,262154,67],"consts":["Array","$ArraySet"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,53,1,52,2,54,3,52,4,50,5,58,6,56,7,61,8,62,9,60,10,59,11,65,12,66,13,67,14,68,15,72,16,71,17,74,18,75,19,73,20,76,21,69,22,65,24,79,25,78,26,79,27,59,28,81,29,80],"localNames":["source","length","mapper","thisArg","result","index"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":3,"name":"Array$prototype$map","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,1094,67],"consts":["mapItems","$Receiver","Array","Array.prototype.map","Array.map"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,82,2,84,4,85,6,87,7,85,8,90,9,91,10,92,11,93,12,94,13,95,14,96,15,92,16,97,17,98,18,99,19,90,20,89],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":4,"name":"Uint8Array$prototype$map","flags":592,"length":1,"params":2,"locals":4,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,10,65540,131076,838,196875,0,196628,0,262164,196618,65546,131082,327684,1094,65556,393241,3,838,67],"consts":["$Receiver","Uint8Array","Uint8Array.prototype.map","$Bytes","mapItems","Uint8Array.map","prototype"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,100,2,102,4,103,6,105,7,103,8,110,9,111,10,112,11,113,12,114,13,110,14,108,15,116,16,117,17,118,18,119,19,120,20,121,21,122,22,123,23,118,24,125,25,124,26,127,27,116,28,115],"localNames":["this","callback","thisArg","bytes"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":5,"name":"mapItems","flags":72,"length":4,"params":4,"locals":7,"maxStack":9,"code":[0,20,65546,196618,582,5,10,65561,262411,131092,65352,262154,328,327947,3,393483,393226,262154,46,2752573,393226,10,33,2490429,0,196628,327690,393226,131082,65546,10,393226,26,393226,10,838,838,5,393226,56,393227,1048636,327690,67],"consts":["$Callback","length","Array","$ArraySet"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,136,1,137,2,138,3,139,4,136,6,144,7,143,8,141,9,150,10,149,11,151,12,149,13,147,14,155,15,153,16,158,17,159,18,157,19,156,20,163,21,164,22,162,23,161,24,166,25,167,26,168,27,169,28,173,29,172,30,175,31,176,32,174,33,177,34,178,35,170,36,166,38,181,39,180,40,181,41,156,42,183,43,182],"localNames":["array","callback","thisArg","label","length","result","index"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":6,"name":"Array$prototype$filter","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,1094,67],"consts":["filterItems","$Receiver","Array","Array.prototype.filter","Array.filter"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,184,2,186,4,187,6,189,7,187,8,192,9,193,10,194,11,195,12,196,13,197,14,198,15,194,16,199,17,200,18,201,19,192,20,191],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":7,"name":"Uint8Array$prototype$filter","flags":592,"length":1,"params":2,"locals":4,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,10,65540,131076,838,196875,0,196628,0,262164,196618,65546,131082,327684,1094,65556,393241,3,838,67],"consts":["$Receiver","Uint8Array","Uint8Array.prototype.filter","$Bytes","filterItems","Uint8Array.filter","prototype"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,202,2,204,4,205,6,207,7,205,8,212,9,213,10,214,11,215,12,216,13,212,14,210,15,218,16,219,17,220,18,221,19,222,20,223,21,224,22,225,23,220,24,227,25,226,26,229,27,218,28,217],"localNames":["this","callback","thisArg","bytes"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":8,"name":"filterItems","flags":72,"length":4,"params":4,"locals":9,"maxStack":5,"code":[0,20,65546,196618,582,5,10,65561,262411,36,327947,3,393483,3,459019,0,524555,458762,262154,46,3407933,458762,10,33,3145789,10,458762,26,524299,131082,65546,524298,458762,10,838,3145789,327690,393226,55,7,56,393227,31,32,543,524298,28,5,458762,56,458763,1114172,327690,67],"consts":["$Callback","length"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,238,1,239,2,240,3,241,4,238,6,246,7,245,8,243,9,251,10,249,11,255,12,253,13,259,14,257,15,261,17,265,18,266,19,264,20,263,21,270,22,271,23,269,24,268,25,277,26,278,27,276,28,275,29,283,30,282,31,284,32,285,33,286,34,280,35,279,36,290,37,292,39,291,41,292,42,289,43,291,44,289,45,293,46,289,47,288,48,296,49,295,50,296,51,263,52,298,53,297],"localNames":["array","callback","thisArg","label","length","result","count","index","item"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":9,"name":"Array$prototype$forEach","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,1094,5,0,67],"consts":["forEachItem","$Receiver","Array","Array.prototype.forEach","Array.forEach"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,299,2,301,4,302,6,304,7,302,8,307,9,308,10,309,11,310,12,311,13,312,14,313,15,309,16,314,17,315,18,316,19,307,21,305],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":10,"name":"Uint8Array$prototype$forEach","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,1094,5,0,67],"consts":["forEachItem","$Receiver","Uint8Array","Uint8Array.prototype.forEach","Uint8Array.forEach"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,317,2,319,4,320,6,322,7,320,8,325,9,326,10,327,11,328,12,329,13,330,14,331,15,327,16,332,17,333,18,334,19,325,21,323],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":11,"name":"forEachItem","flags":72,"length":4,"params":4,"locals":6,"maxStack":5,"code":[0,20,65546,196618,582,5,10,65561,262411,3,327947,327690,262154,46,2097213,327690,10,33,1835069,131082,65546,10,327690,26,327690,10,838,5,327690,56,327691,720956,0,67],"consts":["$Callback","length"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,343,1,344,2,345,3,346,4,343,6,351,7,350,8,348,9,356,10,354,11,359,12,360,13,358,14,357,15,364,16,365,17,363,18,362,19,370,20,369,21,372,22,373,23,371,24,374,25,375,26,367,28,378,29,377,30,378,31,357,32,341],"localNames":["array","callback","thisArg","label","length","index"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":12,"name":"Array$prototype$some","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,2,1350,67],"consts":["testItems","$Receiver","Array","Array.prototype.some","Array.some"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,379,2,381,4,382,6,384,7,382,8,387,9,388,10,389,11,390,12,391,13,392,14,393,15,389,16,394,17,395,18,396,19,397,20,387,21,386],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":13,"name":"Uint8Array$prototype$some","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,2,1350,67],"consts":["testItems","$Receiver","Uint8Array","Uint8Array.prototype.some","Uint8Array.some"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,398,2,400,4,401,6,403,7,401,8,406,9,407,10,408,11,409,12,410,13,411,14,412,15,408,16,413,17,414,18,415,19,416,20,406,21,405],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":14,"name":"Array$prototype$every","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,258,1350,67],"consts":["testItems","$Receiver","Array","Array.prototype.every","Array.every"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,417,2,419,4,420,6,422,7,420,8,425,9,426,10,427,11,428,12,429,13,430,14,431,15,427,16,432,17,433,18,434,19,435,20,425,21,424],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":15,"name":"Uint8Array$prototype$every","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,258,1350,67],"consts":["testItems","$Receiver","Uint8Array","Uint8Array.prototype.every","Uint8Array.every"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,436,2,438,4,439,6,441,7,439,8,444,9,445,10,446,11,447,12,448,13,449,14,450,15,446,16,451,17,452,18,453,19,454,20,444,21,443],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":16,"name":"testItems","flags":72,"length":5,"params":5,"locals":7,"maxStack":5,"code":[0,20,65546,196618,582,5,10,65561,327947,3,393483,393226,327690,46,2490429,393226,10,33,1966399,131082,65546,10,393226,26,393226,10,838,54,262154,50,2228285,262154,54,67,393226,56,393227,720956,262154,67],"consts":["$Callback","length"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,464,1,465,2,466,3,467,4,464,6,472,7,471,8,469,9,477,10,475,11,480,12,481,13,479,14,478,15,486,16,487,17,485,18,484,19,493,20,492,21,495,22,496,23,494,24,497,25,498,26,490,27,489,28,499,29,488,30,483,31,502,32,501,33,500,34,505,35,504,36,505,37,478,38,507,39,506],"localNames":["array","callback","thisArg","label","every","length","index"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":17,"name":"Array$prototype$find","flags":592,"length":1,"params":2,"locals":3,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,2,2,1606,67],"consts":["findItem","$Receiver","Array","Array.prototype.find","Array.find"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,508,2,510,4,511,6,513,7,511,8,516,9,517,10,518,11,519,12,520,13,521,14,522,15,518,16,523,17,524,18,525,19,526,20,527,21,516,22,515],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":18,"name":"Uint8Array$prototype$find","flags":592,"length":1,"params":2,"locals":3,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,2,2,1606,67],"consts":["findItem","$Receiver","Uint8Array","Uint8Array.prototype.find","Uint8Array.find"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,528,2,530,4,531,6,533,7,531,8,536,9,537,10,538,11,539,12,540,13,541,14,542,15,538,16,543,17,544,18,545,19,546,20,547,21,536,22,535],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":19,"name":"Array$prototype$findIndex","flags":592,"length":1,"params":2,"locals":3,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,2,258,1606,67],"consts":["findItem","$Receiver","Array","Array.prototype.findIndex","Array.findIndex"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,548,2,550,4,551,6,553,7,551,8,556,9,557,10,558,11,559,12,560,13,561,14,562,15,558,16,563,17,564,18,565,19,566,20,567,21,556,22,555],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":20,"name":"Uint8Array$prototype$findIndex","flags":592,"length":1,"params":2,"locals":3,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,2,258,1606,67],"consts":["findItem","$Receiver","Uint8Array","Uint8Array.prototype.findIndex","Uint8Array.findIndex"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,568,2,570,4,571,6,573,7,571,8,576,9,577,10,578,11,579,12,580,13,581,14,582,15,578,16,583,17,584,18,585,19,586,20,587,21,576,22,575],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":21,"name":"Array$prototype$findLast","flags":592,"length":1,"params":2,"locals":3,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,258,2,1606,67],"consts":["findItem","$Receiver","Array","Array.prototype.findLast","Array.findLast"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,588,2,590,4,591,6,593,7,591,8,596,9,597,10,598,11,599,12,600,13,601,14,602,15,598,16,603,17,604,18,605,19,606,20,607,21,596,22,595],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":22,"name":"Uint8Array$prototype$findLast","flags":592,"length":1,"params":2,"locals":3,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,258,2,1606,67],"consts":["findItem","$Receiver","Uint8Array","Uint8Array.prototype.findLast","Uint8Array.findLast"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,608,2,610,4,611,6,613,7,611,8,616,9,617,10,618,11,619,12,620,13,621,14,622,15,618,16,623,17,624,18,625,19,626,20,627,21,616,22,615],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":23,"name":"Array$prototype$findLastIndex","flags":592,"length":1,"params":2,"locals":3,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,258,258,1606,67],"consts":["findItem","$Receiver","Array","Array.prototype.findLastIndex","Array.findLastIndex"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,628,2,630,4,631,6,633,7,631,8,636,9,637,10,638,11,639,12,640,13,641,14,642,15,638,16,643,17,644,18,645,19,646,20,647,21,636,22,635],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":24,"name":"Uint8Array$prototype$findLastIndex","flags":592,"length":1,"params":2,"locals":3,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,258,258,1606,67],"consts":["findItem","$Receiver","Uint8Array","Uint8Array.prototype.findLastIndex","Uint8Array.findLastIndex"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,648,2,650,4,651,6,653,7,651,8,656,9,657,10,658,11,659,12,660,13,661,14,662,15,658,16,663,17,664,18,665,19,666,20,667,21,656,22,655],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":25,"name":"findItem","flags":72,"length":6,"params":6,"locals":10,"maxStack":5,"code":[0,20,65546,196618,582,5,10,65561,393483,262154,917565,65539,53,983099,65539,459019,262154,1441853,393226,65539,44,1507387,3,524555,0,590091,524298,3,49,2163007,524298,393226,46,3670077,10,524298,26,589835,131082,65546,589834,524298,10,838,3342397,327690,3211325,524298,3276859,589834,67,524298,458762,43,524299,1703996,327690,3997757,65539,53,4063291,0,67],"consts":["$Callback","length"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,678,1,679,2,680,3,681,4,678,6,686,7,685,8,683,9,692,10,691,11,694,12,693,13,691,14,695,15,689,16,700,17,699,18,702,19,703,20,701,21,699,22,704,23,697,24,706,26,711,27,712,28,710,29,709,30,714,31,715,32,713,33,708,34,721,35,722,36,720,37,719,38,727,39,726,40,728,41,729,42,730,43,724,44,723,45,733,46,732,47,734,48,732,49,735,50,731,51,738,52,739,53,737,54,738,55,708,56,742,57,741,58,744,59,743,60,741,61,745,62,740],"localNames":["array","callback","thisArg","label","last","wantIndex","length","step","index","item"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":26,"name":"Array$prototype$reduce","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,65813,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,2,1350,67],"consts":["reduceItems","$Receiver","Array","Array.prototype.reduce","Array.reduce"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,746,2,748,4,749,6,753,7,754,8,755,9,756,10,757,11,758,12,759,13,755,14,760,15,761,16,762,17,763,18,753,19,752],"localNames":["this","callback","initial"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":27,"name":"Uint8Array$prototype$reduce","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,65813,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,2,1350,67],"consts":["reduceItems","$Receiver","Uint8Array","Uint8Array.prototype.reduce","Uint8Array.reduce"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,764,2,766,4,767,6,771,7,772,8,773,9,774,10,775,11,776,12,777,13,773,14,778,15,779,16,780,17,781,18,771,19,770],"localNames":["this","callback","initial"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":28,"name":"Array$prototype$reduceRight","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,65813,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,258,1350,67],"consts":["reduceItems","$Receiver","Array","Array.prototype.reduceRight","Array.reduceRight"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,782,2,784,4,785,6,789,7,790,8,791,9,792,10,793,11,794,12,795,13,791,14,796,15,797,16,798,17,799,18,789,19,788],"localNames":["this","callback","initial"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":29,"name":"Uint8Array$prototype$reduceRight","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,65813,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,258,1350,67],"consts":["reduceItems","$Receiver","Uint8Array","Uint8Array.prototype.reduceRight","Uint8Array.reduceRight"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,800,2,802,4,803,6,807,7,808,8,809,9,810,10,811,11,812,12,813,13,809,14,814,15,815,16,816,17,817,18,807,19,806],"localNames":["this","callback","initial"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":30,"name":"reduceItems","flags":72,"length":5,"params":5,"locals":9,"maxStack":6,"code":[0,20,65546,196618,582,5,10,65561,327947,262154,917565,65539,53,983099,65539,393483,262154,1441853,327690,65539,44,1507387,3,459019,0,524555,131082,65561,3,48,2359357,131082,3,26,524299,5111867,458762,3,49,2818367,458762,327690,46,3146047,458762,10,33,54,3539005,458762,393226,43,458763,2359356,458762,3,46,3997759,458762,327690,49,4587581,0,131092,196612,196618,262148,43,582,5,10,458762,26,524299,458762,393226,43,458763,458762,3,49,5570879,458762,327690,46,6881341,458762,10,33,6553661,0,65546,524298,10,458762,26,458762,10,1094,524299,458762,393226,43,458763,5111868,524298,67],"consts":["$Callback","length","$Throw","TypeError"," of an empty array with no initial value."],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,827,1,828,2,829,3,830,4,827,6,835,7,834,8,832,9,841,10,840,11,843,12,842,13,840,14,844,15,838,16,849,17,848,18,851,19,852,20,850,21,848,22,853,23,846,24,855,26,860,27,859,28,862,29,858,30,857,31,867,32,868,33,866,34,865,35,857,36,874,37,875,38,873,39,872,40,877,41,878,42,876,43,871,44,881,45,882,46,880,47,879,48,870,49,885,50,886,51,884,52,885,53,870,54,890,55,891,56,889,57,888,58,893,59,894,60,892,61,887,62,896,63,897,64,898,65,900,66,901,67,899,68,896,70,906,71,907,72,905,73,904,74,910,75,911,76,909,77,910,78,915,79,916,80,914,81,913,82,918,83,919,84,917,85,912,86,923,87,924,88,922,89,921,90,931,91,930,92,932,93,934,94,935,95,933,96,936,97,937,98,928,99,927,100,940,101,941,102,939,103,940,104,912,105,943,106,942],"localNames":["array","callback","initial","label","right","length","step","index","accumulator"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":31,"name":"Array$prototype$flatMap","flags":592,"length":1,"params":2,"locals":10,"maxStack":5,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,10,65540,131076,838,196875,0,196628,65546,262148,582,5,196618,327705,262411,36,327947,3,393483,3,459019,0,524555,0,590091,458762,262154,46,6684733,458762,196618,33,6422589,131082,65546,196618,458762,26,458762,196618,838,524299,0,393236,524298,326,5636157,3,589835,589834,524298,327705,46,5570621,589834,524298,33,5308477,327690,393226,55,7,56,393227,31,32,543,524298,589834,26,28,5,589834,56,589835,3801148,6422587,327690,393226,55,7,56,393227,31,32,543,524298,28,5,458762,56,458763,2228284,327690,67],"consts":["$Receiver","Array","Array.prototype.flatMap","$Callback","Array.flatMap","length","$IsArray"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,944,2,946,4,947,6,949,7,947,8,954,9,955,10,956,11,957,12,958,13,954,14,952,15,960,16,961,17,962,18,963,19,960,21,968,22,967,23,965,24,973,25,971,26,977,27,975,28,981,29,979,30,983,32,986,34,990,35,991,36,989,37,988,38,995,39,996,40,994,41,993,42,1004,43,1003,44,1006,45,1007,46,1005,47,1008,48,1009,49,1001,50,1000,51,1011,52,1012,53,1013,54,1011,55,1010,56,1018,57,1017,58,1021,59,1023,60,1022,61,1020,62,1019,63,1028,64,1029,65,1027,66,1026,67,1033,68,1035,70,1034,72,1035,73,1032,74,1034,75,1032,76,1037,77,1038,78,1036,79,1032,80,1031,81,1041,82,1040,83,1041,84,1019,85,1010,86,1045,87,1047,89,1046,91,1047,92,1044,93,1046,94,1044,95,1048,96,1044,97,1043,98,1051,99,1050,100,1051,101,988,102,1053,103,1052],"localNames":["this","callback","thisArg","array","length","result","count","index","inner","at"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":32,"name":"sortWith","flags":72,"length":7,"params":7,"locals":15,"maxStack":11,"code":[36,459019,3,524555,0,590091,0,655627,0,721163,0,786699,0,852235,0,917771,524298,393226,25,46,7602237,393226,524298,26,720907,393226,524298,65539,43,26,589835,393226,524298,131075,43,26,655371,589834,786443,3,851979,720906,589834,46,3146047,786442,655370,46,6357053,0,196618,262154,720906,26,262154,786442,26,582,309,917515,917514,3,47,4390975,917514,917514,51,5308477,0,65556,458762,851978,262154,720906,26,838,5,720906,56,720907,6094907,0,65556,458762,851978,262154,786442,26,838,5,786442,56,786443,851978,56,851979,2687036,0,131092,262154,458762,851978,720906,589834,786442,655370,393226,524298,26,2118,5,524298,196611,43,524299,1048636,0,196628,10,65546,131082,262154,327690,1350,67],"consts":["length","$ArraySet","$MergeRest","$Sorted"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1067,1,1065,2,1071,3,1069,4,1073,6,1076,8,1079,10,1082,12,1085,14,1088,16,1092,17,1094,18,1093,19,1091,20,1090,21,1101,22,1102,23,1100,24,1099,25,1107,26,1109,27,1110,28,1108,29,1106,30,1105,31,1115,32,1117,33,1118,34,1116,35,1114,36,1113,37,1122,38,1121,39,1126,40,1125,41,1130,42,1131,43,1129,44,1128,45,1133,46,1134,47,1132,48,1127,49,1143,50,1142,51,1145,52,1146,53,1144,54,1148,55,1149,56,1147,57,1140,58,1139,59,1138,60,1153,61,1154,62,1152,63,1151,64,1156,65,1157,66,1155,67,1150,68,1160,69,1161,70,1162,71,1163,72,1165,73,1166,74,1164,75,1160,77,1169,78,1168,79,1169,80,1150,81,1172,82,1173,83,1174,84,1175,85,1177,86,1178,87,1176,88,1172,90,1181,91,1180,92,1181,93,1184,94,1183,95,1184,96,1127,97,1186,98,1187,99,1188,100,1189,101,1190,102,1191,103,1192,104,1193,105,1194,106,1196,107,1197,108,1195,109,1186,111,1200,112,1201,113,1199,114,1200,115,1090,116,1203,117,1204,118,1205,119,1206,120,1207,121,1208,122,1209,123,1203,124,1202],"localNames":["target","into","holes","comparator","work","undefs","merges","merged","merge","middle","high","left","right","count","order"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":33,"name":"sortDefault","flags":72,"length":5,"params":5,"locals":6,"maxStack":9,"code":[0,20,196618,326,327947,0,65556,327690,326,720957,327740,0,131092,10,65546,131082,0,196628,327690,196618,582,262154,1350,67],"consts":["$SortState","$SortStep","$Sorted","$SortResult"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1221,1,1222,2,1223,3,1221,4,1219,5,1225,6,1226,7,1227,8,1225,9,1224,11,1230,12,1231,13,1232,14,1233,15,1234,16,1235,17,1236,18,1237,19,1238,20,1235,21,1239,22,1230,23,1229],"localNames":["target","into","holes","values","undefs","state"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":34,"name":"Array$prototype$toLocaleString","flags":88,"length":0,"params":0,"locals":5,"maxStack":5,"code":[789,267,0,20,10,65540,131076,838,65803,196612,131339,3,196875,0,262411,196618,65546,262169,46,3473469,196618,3,48,1835069,131082,327684,43,131083,65546,196618,26,262155,262154,1,51,2556223,262154,0,51,3211325,131082,0,393236,262154,459033,70,326,43,131083,196618,56,196619,983100,131082,67],"consts":["$Receiver","Array","Array.prototype.toLocaleString","","length",",","String","toLocaleString"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1240,2,1246,3,1247,4,1248,5,1249,6,1250,7,1246,8,1244,9,1254,10,1252,11,1258,12,1256,13,1260,15,1264,16,1266,17,1265,18,1263,19,1262,20,1271,21,1272,22,1270,23,1269,24,1275,25,1276,26,1274,27,1275,28,1281,29,1282,30,1280,31,1279,32,1286,33,1287,34,1285,35,1284,36,1289,37,1290,38,1288,39,1283,40,1293,41,1294,42,1295,43,1298,44,1297,45,1296,46,1294,47,1292,48,1293,49,1302,50,1301,51,1302,52,1262,53,1304,54,1303],"localNames":["this","array","result","index","item"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":35,"name":"fillCollection","flags":72,"length":3,"params":3,"locals":7,"maxStack":7,"code":[131082,4,50,458815,131082,65540,50,196875,262156,65546,3801162,3801147,327947,4719948,3997755,262156,262411,196618,54,1835069,0,131092,196612,10,262154,838,5,3735611,0,262164,262154,326,54,2949181,0,327700,393220,458756,131082,43,524292,43,582,5,3735611,0,131092,196612,10,262154,3,26,262154,65539,26,1094,5,852028,70,75,786491,70,4719949,983099,393483,4457806,70,5,393226,64,5,4456507,10,67],"consts":["Map","WeakMap","$Table","add","$IsObject","$Throw","TypeError","new ","(...) expects [key, value] pairs as entry objects."],"captures":[],"handlers":[15,58,64,0,65,68,70,0],"finallies":[],"finallyOffsets":[],"sites":[0,1316,1,1317,2,1315,3,1314,4,1319,5,1320,6,1318,7,1312,9,1325,10,1321,16,1322,17,1329,18,1328,19,1327,20,1331,21,1332,22,1333,23,1334,24,1335,25,1331,27,1327,28,1338,29,1339,30,1340,31,1338,32,1337,33,1336,34,1342,35,1343,36,1344,37,1347,38,1348,39,1346,40,1349,41,1345,42,1342,44,1336,45,1351,46,1352,47,1353,48,1354,49,1356,50,1357,51,1355,52,1359,53,1360,54,1358,55,1351,57,1321,72,1362,73,1361],"localNames":["target","items","kind","pairs","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":36,"name":"Map$groupBy","flags":72,"length":2,"params":2,"locals":2,"maxStack":5,"code":[0,20,10,65546,65540,838,67],"consts":["groupBy","Map"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1369,1,1370,2,1371,3,1372,4,1373,5,1369,6,1368],"localNames":["items","callback"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":37,"name":"Object$groupBy","flags":72,"length":2,"params":2,"locals":2,"maxStack":5,"code":[0,20,10,65546,65540,838,67],"consts":["groupBy","Object"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1380,1,1381,2,1382,3,1383,4,1384,5,1380,6,1379],"localNames":["items","callback"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":38,"name":"groupBy","flags":72,"length":3,"params":3,"locals":9,"maxStack":6,"code":[10,1,50,458815,10,0,50,1048637,0,20,65540,131082,131076,43,582,5,0,196628,65546,131082,262148,43,582,5,0,327700,393220,131082,582,196875,3,262411,0,327947,393228,10,4915274,4915259,459019,5834572,5111867,393228,393483,0,65546,393226,262154,55,7,56,262155,582,327691,131082,458756,50,4325437,0,524308,0,327700,589828,327690,582,326,327691,0,327700,655364,196618,327690,393226,1094,5,2555964,70,75,2490427,70,5834573,2687035,524555,5572430,70,5,524298,64,5,5570619,196618,67],"consts":["$Throw","TypeError",".groupBy expects an iterable collection.","$Callback",".groupBy","$Table","groups","Object","String","groupKey","group"],"captures":[],"handlers":[41,75,81,0,82,85,87,0],"finallies":[],"finallyOffsets":[],"sites":[0,1394,1,1395,2,1393,3,1392,4,1397,5,1398,6,1396,7,1391,8,1400,9,1401,10,1402,11,1404,12,1405,13,1403,14,1400,16,1407,17,1408,18,1409,19,1411,20,1412,21,1410,22,1407,24,1416,25,1417,26,1418,27,1419,28,1416,29,1414,30,1423,31,1421,32,1425,35,1431,36,1427,42,1428,43,1436,44,1437,45,1438,46,1440,48,1439,50,1440,51,1436,52,1435,53,1443,54,1444,55,1442,56,1441,57,1448,58,1449,59,1450,60,1451,61,1452,62,1453,63,1450,64,1448,65,1447,66,1455,67,1456,68,1457,69,1458,70,1459,71,1460,72,1455,74,1427,89,1462,90,1461],"localNames":["items","callback","kind","groups","index","key","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":39,"name":"insertComputed","flags":72,"length":3,"params":3,"locals":4,"maxStack":6,"code":[0,131082,65546,326,196875,0,20,65540,10,65546,196618,1094,5,196618,67],"consts":["$Table","add"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1472,1,1473,2,1474,3,1472,4,1470,5,1476,6,1477,7,1478,8,1479,9,1480,10,1481,11,1476,13,1483,14,1482],"localNames":["target","key","callback","value"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":40,"name":"Map$prototype$forEach","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,1094,5,0,67],"consts":["collectionForEach","$Receiver","Map","Map.prototype.forEach","Map.forEach"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1484,2,1486,4,1487,6,1489,7,1487,8,1492,9,1493,10,1494,11,1495,12,1496,13,1497,14,1498,15,1494,16,1499,17,1500,18,1501,19,1492,21,1490],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":41,"name":"Set$prototype$forEach","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,1094,5,0,67],"consts":["collectionForEach","$Receiver","Set","Set.prototype.forEach","Set.forEach"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1502,2,1504,4,1505,6,1507,7,1505,8,1510,9,1511,10,1512,11,1513,12,1514,13,1515,14,1516,15,1512,16,1517,17,1518,18,1519,19,1510,21,1508],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":42,"name":"collectionForEach","flags":72,"length":4,"params":4,"locals":7,"maxStack":5,"code":[0,20,65546,196618,582,5,262156,0,65556,131076,10,582,2031690,2031675,327947,2950476,2228283,262156,262411,131082,65546,262154,65539,26,262154,3,26,10,838,5,983100,70,75,917563,70,2950477,1114171,393483,2688334,70,5,393226,64,5,2687035,0,67],"consts":["$Callback","$Table","entries"],"captures":[],"handlers":[17,31,37,0,38,41,43,0],"finallies":[],"finallyOffsets":[],"sites":[0,1528,1,1529,2,1530,3,1531,4,1528,7,1536,8,1537,9,1538,10,1539,11,1536,12,1532,18,1533,19,1544,20,1543,21,1546,22,1547,23,1545,24,1549,25,1550,26,1548,27,1551,28,1541,30,1532,45,1526],"localNames":["target","callback","thisArg","label","entry","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":43,"name":"Set$prototype$union","flags":88,"length":1,"params":1,"locals":2,"maxStack":7,"code":[789,65803,0,20,0,65556,65546,131076,196612,838,10,262148,838,67],"consts":["setMethod","$Receiver","Set","Set.prototype.union","union"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1552,2,1557,3,1558,4,1559,5,1560,6,1561,7,1562,8,1563,9,1559,10,1564,11,1565,12,1557,13,1556],"localNames":["other","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":44,"name":"Set$prototype$intersection","flags":88,"length":1,"params":1,"locals":2,"maxStack":7,"code":[789,65803,0,20,0,65556,65546,131076,196612,838,10,262148,838,67],"consts":["setMethod","$Receiver","Set","Set.prototype.intersection","intersection"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1566,2,1571,3,1572,4,1573,5,1574,6,1575,7,1576,8,1577,9,1573,10,1578,11,1579,12,1571,13,1570],"localNames":["other","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":45,"name":"Set$prototype$difference","flags":88,"length":1,"params":1,"locals":2,"maxStack":7,"code":[789,65803,0,20,0,65556,65546,131076,196612,838,10,262148,838,67],"consts":["setMethod","$Receiver","Set","Set.prototype.difference","difference"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1580,2,1585,3,1586,4,1587,5,1588,6,1589,7,1590,8,1591,9,1587,10,1592,11,1593,12,1585,13,1584],"localNames":["other","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":46,"name":"Set$prototype$symmetricDifference","flags":88,"length":1,"params":1,"locals":2,"maxStack":7,"code":[789,65803,0,20,0,65556,65546,131076,196612,838,10,262148,838,67],"consts":["setMethod","$Receiver","Set","Set.prototype.symmetricDifference","symmetricDifference"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1594,2,1599,3,1600,4,1601,5,1602,6,1603,7,1604,8,1605,9,1601,10,1606,11,1607,12,1599,13,1598],"localNames":["other","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":47,"name":"Set$prototype$isSubsetOf","flags":88,"length":1,"params":1,"locals":2,"maxStack":7,"code":[789,65803,0,20,0,65556,65546,131076,196612,838,10,262148,838,67],"consts":["setMethod","$Receiver","Set","Set.prototype.isSubsetOf","isSubsetOf"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1608,2,1613,3,1614,4,1615,5,1616,6,1617,7,1618,8,1619,9,1615,10,1620,11,1621,12,1613,13,1612],"localNames":["other","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":48,"name":"Set$prototype$isSupersetOf","flags":88,"length":1,"params":1,"locals":2,"maxStack":7,"code":[789,65803,0,20,0,65556,65546,131076,196612,838,10,262148,838,67],"consts":["setMethod","$Receiver","Set","Set.prototype.isSupersetOf","isSupersetOf"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1622,2,1627,3,1628,4,1629,5,1630,6,1631,7,1632,8,1633,9,1629,10,1634,11,1635,12,1627,13,1626],"localNames":["other","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":49,"name":"Set$prototype$isDisjointFrom","flags":88,"length":1,"params":1,"locals":2,"maxStack":7,"code":[789,65803,0,20,0,65556,65546,131076,196612,838,10,262148,838,67],"consts":["setMethod","$Receiver","Set","Set.prototype.isDisjointFrom","isDisjointFrom"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1636,2,1641,3,1642,4,1643,5,1644,6,1645,7,1646,8,1647,9,1643,10,1648,11,1649,12,1641,13,1640],"localNames":["other","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":50,"name":"setMethod","flags":72,"length":3,"params":3,"locals":18,"maxStack":5,"code":[0,20,65546,326,54,1048637,0,65556,131076,196612,131082,43,262148,43,582,5,65546,327705,309,196875,196618,196618,51,2228285,0,65556,131076,196612,131082,43,393220,43,582,5,196618,3,46,3145789,0,65556,458756,196612,131082,43,524292,43,582,5,65546,589849,262411,65546,655385,327947,0,720916,262154,326,54,4259903,0,720916,327690,326,54,4980797,0,65556,131076,196612,131082,43,786436,43,582,5,0,851988,327684,10,582,393483,131082,917508,50,5833023,393226,196618,48,6029373,2,67,131082,983044,50,6488383,393226,196618,46,6684733,2,67,131082,1048580,50,7209021,1114132,65352,72,8454203,131082,1179652,50,7667775,131082,1245188,50,7929919,131082,1310724,50,8388669,0,851988,1376260,10,582,8454203,0,459019,131082,917508,50,9764927,131082,1048580,50,9240639,131082,1245188,50,9502783,131082,1441796,50,9765183,393226,196618,47,524555,0,590091,524298,16056381,720908,0,851988,1507332,131082,1245188,50,10747965,458762,10813499,10,582,14614602,14614587,852235,15535436,14811195,720908,721163,65546,262154,720906,326,54,54,589835,131082,1048580,50,12714045,589834,12648509,0,851988,1572868,458762,720906,838,5,14549051,131082,1245188,50,13631549,589834,13566013,0,851988,1638404,458762,720906,838,5,14549051,589834,131082,1441796,50,50,14549053,2,983307,14421326,70,1611,5,983050,67,11075644,70,75,11010107,70,15535437,11206715,917771,15273294,70,5,917514,64,5,15269947,458762,0,50,15925309,258,15990843,458762,67,65546,327690,70,655627,0,20,655370,326,54,17367101,0,65556,131076,196612,131082,43,1703940,43,582,5,786444,0,1769492,655370,258,582,23199818,23199803,1048843,24121420,23396411,786444,786699,0,851988,589828,10,786442,838,589835,131082,1179652,50,19464253,0,851988,1572868,458762,786442,838,5,23134267,131082,1048580,50,20381757,589834,20316221,0,851988,1572868,458762,786442,838,5,23134267,131082,1245188,50,21168189,0,851988,1638404,458762,786442,838,5,23134267,131082,1310724,50,22216765,0,851988,589834,21823549,1638404,21889083,1572868,458762,786442,838,5,23134267,589834,131082,1441796,50,50,23134269,2,983307,23007310,70,1611,5,983050,67,17956924,70,75,17891387,70,24121421,18087995,1114379,23859278,70,5,1114122,64,5,23855163,458762,0,50,24510525,258,24576059,458762,67],"consts":["$IsObject","$Throw","TypeError","Set."," expects a Set-like object.","size"," received a Set-like object with an invalid size.","RangeError"," received a Set-like object with a negative size.","has","keys","$IsCallable"," expects callable 'has' and 'keys' methods.","$Table","isSubsetOf","isSupersetOf","intersection","Set","union","difference","symmetricDifference","copy","isDisjointFrom","values","add","delete"," expects 'keys' to return an iterator object.","$Direct"],"captures":[],"handlers":[171,223,229,0,230,233,235,0,276,354,360,0,361,364,366,0],"finallies":[],"finallyOffsets":[],"sites":[0,1658,1,1659,2,1660,3,1658,4,1657,5,1656,6,1662,7,1663,8,1664,9,1667,10,1668,11,1666,12,1669,13,1665,14,1662,16,1675,17,1674,18,1673,19,1671,20,1679,21,1680,22,1678,23,1677,24,1682,25,1683,26,1684,27,1687,28,1688,29,1686,30,1689,31,1685,32,1682,34,1692,35,1693,36,1691,37,1690,38,1695,39,1696,40,1697,41,1700,42,1701,43,1699,44,1702,45,1698,46,1695,48,1707,49,1706,50,1704,51,1713,52,1712,53,1710,54,1718,55,1719,56,1720,57,1718,58,1717,59,1716,60,1722,61,1723,62,1724,63,1722,64,1721,65,1715,66,1726,67,1727,68,1728,69,1731,70,1732,71,1730,72,1733,73,1729,74,1726,76,1737,77,1738,78,1739,79,1740,80,1737,81,1735,82,1744,83,1745,84,1743,85,1742,86,1747,87,1748,88,1746,89,1741,90,1750,91,1749,92,1754,93,1755,94,1753,95,1752,96,1757,97,1758,98,1756,99,1751,100,1760,101,1759,102,1766,103,1767,104,1765,105,1764,106,1769,107,1768,109,1764,110,1774,111,1775,112,1773,113,1772,114,1777,115,1778,116,1776,117,1771,118,1780,119,1781,120,1779,121,1770,122,1782,123,1783,124,1784,125,1785,126,1782,127,1770,128,1786,129,1762,130,1792,131,1793,132,1791,133,1790,134,1798,135,1799,136,1797,137,1796,138,1801,139,1802,140,1800,141,1795,142,1804,143,1805,144,1803,145,1794,146,1807,147,1808,148,1806,149,1788,150,1810,152,1813,153,1812,155,1819,156,1820,157,1821,158,1824,159,1825,160,1823,161,1822,162,1826,163,1822,164,1827,165,1819,166,1815,172,1816,173,1837,174,1836,175,1838,176,1834,177,1833,178,1832,179,1831,180,1841,181,1842,182,1840,183,1839,184,1845,185,1844,186,1847,187,1848,188,1849,189,1850,190,1851,191,1847,193,1839,194,1854,195,1855,196,1853,197,1852,198,1858,199,1857,200,1860,201,1861,202,1862,203,1863,204,1864,205,1860,207,1852,208,1867,209,1869,210,1870,211,1868,212,1866,213,1865,214,1872,215,1871,222,1815,237,1876,238,1877,239,1875,240,1874,241,1878,242,1874,243,1879,244,1873,245,1886,246,1885,247,1883,248,1881,249,1889,250,1890,251,1891,252,1889,253,1888,254,1887,255,1893,256,1894,257,1895,258,1898,259,1899,260,1897,261,1900,262,1896,263,1893,266,1905,267,1906,268,1907,269,1908,270,1905,271,1901,277,1902,278,1913,279,1914,280,1915,281,1916,282,1917,283,1913,284,1912,285,1920,286,1921,287,1919,288,1918,289,1923,290,1924,291,1925,292,1926,293,1927,294,1923,296,1918,297,1930,298,1931,299,1929,300,1928,301,1934,302,1933,303,1936,304,1937,305,1938,306,1939,307,1940,308,1936,310,1928,311,1943,312,1944,313,1942,314,1941,315,1946,316,1947,317,1948,318,1949,319,1950,320,1946,322,1941,323,1953,324,1954,325,1952,326,1951,327,1956,328,1957,329,1959,330,1958,331,1960,332,1958,333,1961,334,1962,335,1963,336,1956,338,1951,339,1966,340,1968,341,1969,342,1967,343,1965,344,1964,345,1971,346,1970,353,1901,368,1975,369,1976,370,1974,371,1973,372,1977,373,1973,374,1978,375,1972],"localNames":["target","other","name","size","has","keys","own","result","asks","found","iterator","item","item","%it","%e","%ret","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":51,"name":"Object$fromEntries","flags":72,"length":1,"params":1,"locals":5,"maxStack":7,"code":[35,65803,131084,10,2621514,2621499,196875,3539788,2818107,131084,131339,0,20,131082,258,582,54,1572925,0,65556,131076,196612,582,5,0,262164,65546,0,327700,131082,3,26,326,131082,65539,26,258,1094,5,458812,70,75,393275,70,3539789,589883,262411,3277646,70,5,262154,64,5,3276859,65546,67],"consts":["$IsObject","$Throw","TypeError","Object.fromEntries expects [key, value] entry objects.","$Define","String"],"captures":[],"handlers":[9,40,46,0,47,50,52,0],"finallies":[],"finallyOffsets":[],"sites":[0,1986,1,1984,3,1991,4,1987,10,1988,11,1995,12,1996,13,1997,14,1998,15,1995,16,1994,17,1993,18,2000,19,2001,20,2002,21,2003,22,2000,24,2005,25,2006,26,2007,27,2008,28,2009,29,2011,30,2012,31,2010,32,2008,33,2014,34,2015,35,2013,36,2016,37,2005,39,1987,54,2018,55,2017],"localNames":["entries","result","entry","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":52,"name":"Math$sumPrecise","flags":72,"length":1,"params":1,"locals":5,"maxStack":5,"code":[36,65803,131084,10,2031690,2031675,196875,2949964,2228283,131084,131339,131082,821,4,51,1441853,0,65556,131076,196612,582,5,0,262164,65546,65546,327705,131082,838,5,458812,70,75,393275,70,2949965,589883,262411,2687822,70,5,262154,64,5,2687035,0,393236,65546,326,67],"consts":["number","$Throw","TypeError","Math.sumPrecise expects an iterable of numbers.","$ArraySet","length","$SumPrecise"],"captures":[],"handlers":[9,31,37,0,38,41,43,0],"finallies":[],"finallyOffsets":[],"sites":[0,2026,1,2024,3,2031,4,2027,10,2028,11,2036,12,2035,13,2037,14,2034,15,2033,16,2039,17,2040,18,2041,19,2042,20,2039,22,2044,23,2045,24,2046,25,2048,26,2047,27,2050,28,2044,30,2027,45,2052,46,2053,47,2054,48,2052,49,2051],"localNames":["items","numbers","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":53,"name":"aggregateError","flags":72,"length":2,"params":2,"locals":6,"maxStack":6,"code":[36,131339,196620,65546,1310794,1310779,262411,2229324,1507387,196620,196875,0,20,131082,131082,65561,196618,838,5,458812,70,75,393275,70,2229325,589883,327947,1967182,70,5,327690,64,5,1966139,0,131092,10,196612,131082,2,1094,67],"consts":["$ArraySet","length","$Define","errors"],"captures":[],"handlers":[9,20,26,0,27,30,32,0],"finallies":[],"finallyOffsets":[],"sites":[0,2063,1,2061,3,2068,4,2064,10,2065,11,2070,12,2071,13,2072,14,2074,15,2073,16,2076,17,2070,19,2064,34,2078,35,2079,36,2080,37,2081,38,2082,39,2083,40,2078,41,2077],"localNames":["error","errors","list","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":54,"name":"collectBytes","flags":72,"length":6,"params":6,"locals":11,"maxStack":7,"code":[0,20,10,326,54,1376317,0,65556,131076,65546,196612,43,0,262164,10,326,43,327684,43,582,5,36,393483,524300,10,2687050,2687035,590091,3606860,2883643,524300,524555,0,393236,393226,393226,458777,524298,838,5,1835068,70,75,1769531,70,3606861,1966139,655627,3344718,70,5,655370,64,5,3342395,3,459019,131082,0,51,5505085,458762,393226,458777,46,5505085,393226,458762,31,32,543,196618,131082,393226,458762,26,458762,582,28,5,458762,56,458763,3997756,0,524308,393226,262154,327690,838,67],"consts":["$IsIterable","$Throw","TypeError"," expects a Uint8Array, an array, or an iterable of numbers, received ","$Describe",".","$ArraySet","length","$Bytes"],"captures":[],"handlers":[30,41,47,0,48,51,53,0],"finallies":[],"finallyOffsets":[],"sites":[0,2095,1,2096,2,2097,3,2095,4,2094,5,2093,6,2099,7,2100,8,2101,9,2105,10,2106,11,2104,12,2107,13,2108,14,2109,15,2107,16,2103,17,2110,18,2102,19,2099,21,2114,22,2112,24,2119,25,2115,31,2116,32,2121,33,2122,34,2123,35,2125,36,2124,37,2127,38,2121,40,2115,55,2131,56,2129,57,2134,58,2135,59,2133,60,2132,61,2139,62,2141,63,2140,64,2138,65,2137,66,2147,67,2148,68,2146,69,2148,70,2146,71,2152,72,2151,73,2154,74,2155,75,2153,76,2156,77,2149,78,2146,79,2145,80,2159,81,2158,82,2159,83,2137,84,2161,85,2162,86,2163,87,2164,88,2165,89,2161,90,2160],"localNames":["source","name","mapper","thisArg","into","offset","values","index","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":55,"name":"argumentsValues","flags":92,"length":0,"params":0,"locals":2,"maxStack":2,"code":[789,267,81,3,65803,65546,10,25,46,1376317,10,65546,26,82,1048659,67,5,65546,56,65547,327740,0,67],"consts":["length"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2166,3,2172,4,2170,5,2175,6,2177,7,2176,8,2174,9,2173,10,2183,11,2184,12,2182,13,2181,17,2187,18,2186,19,2187,20,2173,21,2168],"localNames":["this","index"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":56,"name":"objectEntries","flags":72,"length":2,"params":2,"locals":6,"maxStack":7,"code":[0,20,10,258,0,838,131339,36,196875,3,262411,262154,131082,65561,46,3211325,327692,131082,262154,26,327947,0,131092,10,327690,582,2949181,0,196628,196618,196618,65561,65546,2490429,10,327690,26,2818107,327690,10,327690,26,131108,838,5,262154,56,262155,720956,196618,67],"consts":["$OwnKeys","length","$IsEnumerableOwn","$ArraySet"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2196,1,2197,2,2198,3,2199,4,2200,5,2196,6,2194,7,2204,8,2202,9,2208,10,2206,11,2211,12,2213,13,2212,14,2210,15,2209,17,2220,18,2221,19,2219,20,2217,21,2223,22,2224,23,2225,24,2226,25,2223,26,2222,27,2228,28,2229,29,2230,30,2232,31,2231,32,2235,33,2234,34,2237,35,2238,36,2236,37,2234,38,2240,39,2242,40,2243,41,2241,42,2239,43,2228,45,2246,46,2245,47,2246,48,2209,49,2248,50,2247],"localNames":["source","values","keys","result","index","key"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":57,"name":"objectAssign","flags":72,"length":2,"params":2,"locals":7,"maxStack":5,"code":[3,131339,131082,65546,25,46,3735613,196620,262156,327692,65546,131082,26,196875,0,65556,196618,2,0,838,262411,3,327947,327690,262154,25,46,3473469,393228,262154,327690,26,393483,0,131092,196618,393226,582,3211325,10,393226,31,32,543,196618,393226,26,28,5,327690,56,327691,1507388,131082,56,131083,131132,10,67],"consts":["length","$OwnKeys","$IsEnumerableOwn"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2257,1,2255,2,2260,3,2262,4,2261,5,2259,6,2258,10,2269,11,2270,12,2268,13,2266,14,2274,15,2275,16,2276,17,2277,18,2278,19,2274,20,2272,21,2282,22,2280,23,2285,24,2287,25,2286,26,2284,27,2283,29,2294,30,2295,31,2293,32,2291,33,2297,34,2298,35,2299,36,2300,37,2297,38,2296,39,2304,40,2305,41,2303,42,2305,43,2303,44,2307,45,2308,46,2306,47,2303,48,2302,49,2311,50,2310,51,2311,52,2283,53,2314,54,2313,55,2314,56,2258,57,2316,58,2315],"localNames":["target","sources","at","source","keys","index","key"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":58,"name":"readPairs","flags":72,"length":4,"params":4,"locals":12,"maxStack":7,"code":[0,20,10,326,54,917565,0,65556,131082,196618,10,65546,1094,67,36,262411,0,327947,393228,10,5701706,5701691,524555,6621260,5898299,393228,393483,0,20,393226,326,54,2687037,0,131092,196612,65546,262148,43,582,5,36,327691,458764,393226,4194378,4194363,655627,5114444,4390971,458764,459019,0,327700,327690,327690,393241,0,458772,458762,326,838,5,3145788,70,75,3080251,70,5114445,3276859,721163,4852302,70,5,720906,64,5,4849723,0,327700,262154,262154,393241,327690,838,5,1507388,70,75,1441851,70,6621261,1638459,590091,6359118,70,5,589834,64,5,6357051,0,65556,131082,196618,262154,65546,1094,67],"consts":["$IsIterable","$Pairs","$Throw","TypeError"," expects iterable [name, value] pairs.","$ArraySet","length","String"],"captures":[],"handlers":[50,64,70,0,71,74,76,0,25,87,93,0,94,97,99,0],"finallies":[],"finallyOffsets":[],"sites":[0,2326,1,2327,2,2328,3,2326,4,2325,5,2324,6,2330,7,2331,8,2332,9,2333,10,2334,11,2335,12,2330,13,2329,14,2339,15,2337,16,2341,19,2347,20,2343,26,2344,27,2351,28,2352,29,2353,30,2351,31,2350,32,2349,33,2355,34,2356,35,2357,36,2359,37,2360,38,2358,39,2355,41,2364,42,2363,44,2369,45,2365,51,2366,52,2371,53,2372,54,2373,55,2375,56,2374,57,2377,58,2378,59,2379,60,2377,61,2371,63,2365,78,2381,79,2382,80,2383,81,2385,82,2384,83,2387,84,2381,86,2343,101,2389,102,2390,103,2391,104,2392,105,2393,106,2394,107,2389,108,2388],"localNames":["init","label","kind","proto","pairs","strings","pair","item","%it","%e","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":59,"name":"pairsForEach","flags":72,"length":4,"params":4,"locals":5,"maxStack":5,"code":[3,262411,262154,65546,25,46,1703997,196618,131082,65546,262154,26,65539,26,65546,262154,26,3,26,10,838,5,262154,56,262155,131132,0,67],"consts":["length"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2405,1,2403,2,2408,3,2410,4,2409,5,2407,6,2406,7,2417,8,2416,9,2420,10,2421,11,2419,12,2422,13,2418,14,2425,15,2426,16,2424,17,2427,18,2423,19,2428,20,2414,22,2431,23,2430,24,2431,25,2406,26,2401],"localNames":["target","pairs","callback","thisArg","index"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":60,"name":"Iterator$from","flags":72,"length":1,"params":1,"locals":1,"maxStack":10,"code":[0,20,10,326,721215,0,65556,10,131092,196633,582,917565,10,67,0,262164,0,327700,10,0,393236,10,258,458756,838,582,326,67],"consts":["$IsObject","$Inherits","Iterator","prototype","prime","wrapHelper","flattenable","Iterator.from"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2438,1,2439,2,2440,3,2438,4,2437,5,2441,6,2442,7,2443,8,2445,9,2444,10,2441,11,2436,12,2448,13,2447,14,2450,15,2451,16,2452,17,2453,18,2454,19,2455,20,2456,21,2457,22,2458,23,2459,24,2455,25,2452,26,2450,27,2449],"localNames":["value"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":61,"name":"wrapHelper","flags":76,"length":2,"params":2,"locals":9,"maxStack":3,"code":[81,2,131339,0,82,786515,393483,393226,327947,131075,262411,3866683,5,258,131083,196620,65546,2555978,2555963,459019,3475276,2752571,196620,196875,196618,82,2424915,393483,2099022,70,1611,5,393226,327947,131075,262411,3866683,5,1310780,70,75,1245243,70,3475277,1441851,524555,3213134,70,5,524298,64,5,3211323,3,262411,3866683,327947,65539,262411,131082,54,4390973,0,20,10,326,5,66,327690,67,0,67],"consts":["closeIterator"],"captures":[],"handlers":[22,39,45,0,46,49,51,0,3,53,56,0],"finallies":[4,5,0,3,70,-1,68],"finallyOffsets":[0],"sites":[0,2460,1,2468,2,2466,3,2472,13,2476,14,2475,16,2481,17,2477,23,2478,24,2484,25,2483,38,2477,53,2469,59,2488,60,2487,61,2486,62,2490,63,2491,64,2492,65,2490,67,2469,70,2464],"localNames":["source","iterator","started","item","%ftag0","%fval0","%ret","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":62,"name":"Iterator$prototype$map","flags":88,"length":1,"params":1,"locals":3,"maxStack":7,"code":[789,65803,0,20,65546,2,582,131339,0,65556,10,131076,582,5,0,196628,0,262164,65546,131082,10,838,326,67],"consts":["$Direct","$Callback","Iterator.prototype.map","prime","mapHelper"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2493,2,2500,3,2501,4,2502,5,2503,6,2500,7,2498,8,2505,9,2506,10,2507,11,2508,12,2505,14,2510,15,2511,16,2512,17,2513,18,2514,19,2515,20,2516,21,2512,22,2510,23,2509],"localNames":["mapper","this","iterator"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":63,"name":"mapHelper","flags":76,"length":3,"params":3,"locals":11,"maxStack":5,"code":[81,2,196875,262156,0,82,852051,524555,524298,459019,131075,393483,4587579,5,258,196619,3,262411,327692,65546,3276874,3276859,590091,4196684,3473467,327692,327947,0,131082,327690,262154,55,7,56,262155,582,82,3145811,524555,2820430,70,1611,5,524298,459019,131075,393483,4587579,5,1507388,70,75,1441851,70,4196685,1638459,655627,3934542,70,5,655370,64,5,3932219,3,393483,4587579,459019,65539,393483,196618,54,5111869,0,20,10,326,5,66,458762,67,0,67],"consts":["closeIterator"],"captures":[],"handlers":[25,50,56,0,57,60,62,0,3,64,67,0],"finallies":[6,7,0,3,81,-1,79],"finallyOffsets":[0],"sites":[0,2517,1,2526,2,2524,4,2530,14,2534,15,2533,16,2538,17,2536,19,2543,20,2539,26,2540,27,2546,28,2547,29,2548,30,2550,32,2549,34,2550,35,2546,36,2545,49,2539,64,2527,70,2554,71,2553,72,2552,73,2556,74,2557,75,2558,76,2556,78,2527,81,2522],"localNames":["source","iterator","mapper","started","counter","item","%ftag0","%fval0","%ret","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":64,"name":"Iterator$prototype$filter","flags":88,"length":1,"params":1,"locals":3,"maxStack":7,"code":[789,65803,0,20,65546,2,582,131339,0,65556,10,131076,582,5,0,196628,0,262164,65546,131082,10,838,326,67],"consts":["$Direct","$Callback","Iterator.prototype.filter","prime","filterHelper"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2559,2,2566,3,2567,4,2568,5,2569,6,2566,7,2564,8,2571,9,2572,10,2573,11,2574,12,2571,14,2576,15,2577,16,2578,17,2579,18,2580,19,2581,20,2582,21,2578,22,2576,23,2575],"localNames":["predicate","this","iterator"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":65,"name":"filterHelper","flags":76,"length":3,"params":3,"locals":11,"maxStack":5,"code":[81,2,196875,262156,0,82,852051,524555,524298,459019,131075,393483,4718651,5,258,196619,3,262411,327692,65546,3407946,3407931,590091,4327756,3604539,327692,327947,0,131082,327690,262154,55,7,56,262155,582,3342397,327690,82,3276883,524555,2951502,70,1611,5,524298,459019,131075,393483,4718651,5,1507388,70,75,1441851,70,4327757,1638459,655627,4065614,70,5,655370,64,5,4063291,3,393483,4718651,459019,65539,393483,196618,54,5242941,0,20,10,326,5,66,458762,67,0,67],"consts":["closeIterator"],"captures":[],"handlers":[25,52,58,0,59,62,64,0,3,66,69,0],"finallies":[6,7,0,3,83,-1,81],"finallyOffsets":[0],"sites":[0,2583,1,2592,2,2590,4,2596,14,2600,15,2599,16,2604,17,2602,19,2609,20,2605,26,2606,27,2611,28,2612,29,2613,30,2615,32,2614,34,2615,35,2611,36,2610,37,2618,38,2617,51,2605,66,2593,72,2622,73,2621,74,2620,75,2624,76,2625,77,2626,78,2624,80,2593,83,2588],"localNames":["source","iterator","predicate","started","counter","item","%ftag0","%fval0","%ret","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":66,"name":"Iterator$prototype$take","flags":88,"length":1,"params":1,"locals":3,"maxStack":10,"code":[789,65803,0,20,65546,2,582,131339,0,65556,0,131092,65546,131082,0,196628,10,262148,582,838,326,67],"consts":["$Direct","prime","takeHelper","count","take"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2627,2,2634,3,2635,4,2636,5,2637,6,2634,7,2632,8,2639,9,2640,10,2641,11,2642,12,2643,13,2644,14,2645,15,2646,16,2647,17,2648,18,2645,19,2641,20,2639,21,2638],"localNames":["limit","this","iterator"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":67,"name":"takeHelper","flags":76,"length":3,"params":3,"locals":10,"maxStack":3,"code":[81,2,196875,0,82,786515,459019,458762,393483,131075,327947,5570619,5,258,196619,131082,3,50,1900605,0,20,10,326,459019,458762,393483,131075,327947,5570619,262156,65546,4259914,4259899,524555,5179468,4456507,262156,262411,131082,312,131083,262154,82,3539027,459019,3213390,70,1611,5,458762,393483,131075,327947,5570619,5,131082,3,50,4194365,4130894,70,1611,5,5177403,2228284,70,75,2162747,70,5179469,2359355,590091,4917326,70,5,589834,64,5,4915259,3,327947,5570619,393483,65539,327947,196618,54,6094909,0,20,10,326,5,66,393226,67,0,67],"consts":["closeIterator"],"captures":[],"handlers":[36,65,71,0,72,75,77,0,3,79,82,0],"finallies":[5,6,0,3,96,-1,94],"finallyOffsets":[0],"sites":[0,2649,1,2658,2,2656,3,2662,13,2666,14,2665,15,2669,16,2670,17,2668,18,2667,19,2672,20,2673,21,2674,22,2672,23,2671,30,2679,31,2675,37,2676,38,2683,39,2682,40,2683,41,2686,42,2685,55,2689,56,2690,57,2688,58,2687,59,2691,64,2675,79,2659,85,2695,86,2694,87,2693,88,2697,89,2698,90,2699,91,2697,93,2659,96,2654],"localNames":["source","iterator","remaining","started","item","%ftag0","%fval0","%ret","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":68,"name":"Iterator$prototype$drop","flags":88,"length":1,"params":1,"locals":3,"maxStack":10,"code":[789,65803,0,20,65546,2,582,131339,0,65556,0,131092,65546,131082,0,196628,10,262148,582,838,326,67],"consts":["$Direct","prime","dropHelper","count","drop"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2700,2,2707,3,2708,4,2709,5,2710,6,2707,7,2705,8,2712,9,2713,10,2714,11,2715,12,2716,13,2717,14,2718,15,2719,16,2720,17,2721,18,2718,19,2714,20,2712,21,2711],"localNames":["limit","this","iterator"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":69,"name":"dropHelper","flags":76,"length":3,"params":3,"locals":10,"maxStack":3,"code":[81,2,196875,0,82,786515,459019,458762,393483,131075,327947,4390971,5,258,196619,262156,65546,3080266,3080251,524555,3999820,3276859,262156,262411,131082,3,48,2097213,131082,312,131083,3014715,262154,82,2949203,459019,2623566,70,1611,5,458762,393483,131075,327947,4390971,5,1310780,70,75,1245243,70,3999821,1441851,590091,3737678,70,5,589834,64,5,3735611,3,327947,4390971,393483,65539,327947,196618,54,4915261,0,20,10,326,5,66,393226,67,0,67],"consts":["closeIterator"],"captures":[],"handlers":[22,47,53,0,54,57,59,0,3,61,64,0],"finallies":[5,6,0,3,78,-1,76],"finallyOffsets":[0],"sites":[0,2722,1,2731,2,2729,3,2735,13,2739,14,2738,16,2744,17,2740,23,2741,24,2748,25,2749,26,2747,27,2746,28,2752,29,2751,30,2752,31,2746,32,2755,33,2754,46,2740,61,2732,67,2759,68,2758,69,2757,70,2761,71,2762,72,2763,73,2761,75,2732,78,2727],"localNames":["source","iterator","remaining","started","item","%ftag0","%fval0","%ret","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":70,"name":"Iterator$prototype$flatMap","flags":88,"length":1,"params":1,"locals":3,"maxStack":7,"code":[789,65803,0,20,65546,2,582,131339,0,65556,10,131076,582,5,0,196628,0,262164,65546,131082,10,838,326,67],"consts":["$Direct","$Callback","Iterator.prototype.flatMap","prime","flatMapHelper"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2764,2,2771,3,2772,4,2773,5,2774,6,2771,7,2769,8,2776,9,2777,10,2778,11,2779,12,2776,14,2781,15,2782,16,2783,17,2784,18,2785,19,2786,20,2787,21,2783,22,2781,23,2780],"localNames":["mapper","this","iterator"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":71,"name":"flatMapHelper","flags":76,"length":3,"params":3,"locals":14,"maxStack":7,"code":[81,2,196875,262156,0,82,852051,590091,589834,524555,131075,459019,6750267,5,258,196619,3,262411,327692,65546,5439562,5439547,655627,6359628,5636155,327692,327947,393228,0,20,0,131082,327690,262154,55,7,56,262155,582,2,65540,838,4456522,4456507,786699,5377100,4653115,393228,393483,393226,82,4325459,590091,3738702,70,1611,5,4000334,70,1611,5,589834,524555,131075,459019,6750267,5,2949180,70,75,2883643,70,5377101,3080251,852235,5114958,70,5,851978,64,5,5111867,1507388,70,75,1441851,70,6359629,1638459,721163,6097486,70,5,720906,64,5,6094907,3,459019,6750267,524555,65539,459019,196618,54,7274557,0,131092,10,326,5,66,524298,67,0,67],"consts":["flattenable","Iterator.prototype.flatMap","closeIterator"],"captures":[],"handlers":[47,68,74,0,75,78,80,0,25,83,89,0,90,93,95,0,3,97,100,0],"finallies":[7,8,0,3,114,-1,112],"finallyOffsets":[0],"sites":[0,2788,1,2797,2,2795,4,2801,14,2805,15,2804,16,2809,17,2807,19,2814,20,2810,26,2811,28,2820,29,2821,30,2822,31,2823,32,2824,33,2826,35,2825,37,2826,38,2822,39,2827,40,2828,41,2820,42,2816,48,2817,49,2831,50,2830,67,2816,82,2810,97,2798,103,2835,104,2834,105,2833,106,2837,107,2838,108,2839,109,2837,111,2798,114,2793],"localNames":["source","iterator","mapper","started","counter","item","inner","%ftag0","%fval0","%ret","%it","%e","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":72,"name":"prime","flags":72,"length":1,"params":1,"locals":1,"maxStack":2,"code":[10,281,70,5,10,67],"consts":["next"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2847,1,2846,2,2845,4,2850,5,2849],"localNames":["helper"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":73,"name":"count","flags":72,"length":2,"params":2,"locals":4,"maxStack":5,"code":[10,309,131339,131082,20,50,720959,131082,20,53,50,917565,131082,1245243,131082,131082,65539,308,44,196875,131082,131082,51,1769535,196618,3,46,2752573,0,65556,131076,196612,65546,43,262148,43,131082,43,327684,43,582,5,196618,67],"consts":["Infinity","$Throw","RangeError","Iterator.prototype."," expects a non-negative count, received ","."],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2860,1,2859,2,2857,3,2867,4,2868,5,2866,6,2865,7,2870,8,2872,9,2871,10,2869,11,2864,12,2873,13,2864,14,2875,15,2877,16,2878,17,2876,18,2874,19,2862,20,2882,21,2883,22,2881,23,2880,24,2885,25,2886,26,2884,27,2879,28,2888,29,2889,30,2890,31,2895,32,2896,33,2894,34,2897,35,2893,36,2898,37,2892,38,2899,39,2891,40,2888,42,2901,43,2900],"localNames":["limit","name","number","integer"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":74,"name":"flattenable","flags":72,"length":3,"params":3,"locals":4,"maxStack":7,"code":[10,821,4,50,524349,65546,54,852027,0,65556,10,326,54,1900605,0,131092,196612,131082,262148,43,0,327700,10,326,43,393220,43,582,5,10,458772,524313,26,196875,0,589844,196618,0,50,2818111,196618,1,50,3014717,10,3211323,10,196618,70,2,582,67],"consts":["string","$IsObject","$Throw","TypeError"," expects an iterable or iterator, received ","$Describe",".","Symbol","iterator","$Direct"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2912,1,2911,2,2913,3,2910,4,2909,5,2915,6,2914,7,2909,8,2917,9,2918,10,2919,11,2917,12,2916,13,2908,14,2921,15,2922,16,2923,17,2927,18,2928,19,2926,20,2929,21,2930,22,2931,23,2929,24,2925,25,2932,26,2924,27,2921,29,2937,30,2939,31,2938,32,2936,33,2934,34,2942,35,2943,36,2947,37,2948,38,2946,39,2945,40,2950,41,2951,42,2949,43,2944,44,2952,45,2944,46,2956,47,2955,48,2953,49,2957,50,2942,51,2941],"localNames":["value","strings","name","method"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":75,"name":"closeIterator","flags":72,"length":1,"params":1,"locals":2,"maxStack":4,"code":[10,25,65803,65546,0,51,655679,65546,1,51,1179967,0,65556,10,65546,70,326,54,1638461,0,131092,196612,262148,582,5,0,67],"consts":["return","$IsObject","$Throw","TypeError","Iterator return() must return an object."],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2966,1,2965,2,2963,3,2972,4,2973,5,2971,6,2970,7,2975,8,2976,9,2974,10,2969,11,2978,12,2979,13,2983,14,2982,15,2980,16,2978,17,2977,18,2968,19,2985,20,2986,21,2987,22,2988,23,2985,25,2961],"localNames":["iterator","method"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":76,"name":"Iterator$prototype$toArray","flags":88,"length":0,"params":0,"locals":5,"maxStack":5,"code":[789,267,36,65803,131084,0,20,10,2,582,1704010,1703995,196875,2622284,1900603,131084,131339,0,65556,65546,65546,131097,131082,838,5,852028,70,75,786491,70,2622285,983099,262411,2360142,70,5,262154,64,5,2359355,65546,67],"consts":["$Direct","$ArraySet","length"],"captures":[],"handlers":[15,26,32,0,33,36,38,0],"finallies":[],"finallyOffsets":[],"sites":[0,2989,2,2995,3,2993,5,3000,6,3001,7,3002,8,3003,9,3000,10,2996,16,2997,17,3005,18,3006,19,3007,20,3009,21,3008,22,3011,23,3005,25,2996,40,3013,41,3012],"localNames":["this","result","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":77,"name":"Iterator$prototype$reduce","flags":592,"length":1,"params":2,"locals":10,"maxStack":5,"code":[789,267,1045,65803,65813,131339,0,20,10,2,582,196875,0,65556,65546,131076,582,5,131082,3,26,262411,131082,196633,3,48,327947,3,393483,458764,196618,3670090,3670075,524555,4589644,3866683,458764,459019,327690,3145789,0,65546,262154,458762,393226,838,262155,3276859,458762,262155,258,327691,393226,56,393227,2228284,70,75,2162747,70,4589645,2359355,590091,4327502,70,5,589834,64,5,4325435,327690,54,5177405,0,262164,327684,393220,582,5,262154,67],"consts":["$Direct","$Callback","Iterator.prototype.reduce","length","$Throw","TypeError","Iterator.prototype.reduce of an empty iterator with no initial value."],"captures":[],"handlers":[36,56,62,0,63,66,68,0],"finallies":[],"finallyOffsets":[],"sites":[0,3014,2,3016,4,3017,6,3023,7,3024,8,3025,9,3026,10,3023,11,3021,12,3028,13,3029,14,3030,15,3031,16,3028,18,3036,19,3037,20,3035,21,3033,22,3043,23,3042,24,3045,25,3041,26,3039,27,3049,28,3047,30,3054,31,3050,37,3051,38,3057,39,3056,40,3061,41,3062,42,3063,43,3064,44,3065,45,3061,46,3060,47,3056,48,3069,49,3068,50,3073,51,3072,52,3076,53,3075,54,3076,55,3050,70,3079,71,3078,72,3077,73,3081,74,3082,75,3083,76,3084,77,3081,79,3086,80,3085],"localNames":["this","callback","initial","iterator","accumulator","started","index","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":78,"name":"Iterator$prototype$forEach","flags":88,"length":1,"params":1,"locals":2,"maxStack":5,"code":[789,65803,0,20,65546,10,65540,838,5,0,67],"consts":["iteratorTest","forEach"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,3087,2,3092,3,3093,4,3094,5,3095,6,3096,7,3092,9,3090],"localNames":["callback","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":79,"name":"Iterator$prototype$some","flags":88,"length":1,"params":1,"locals":2,"maxStack":5,"code":[789,65803,0,20,65546,10,65540,838,67],"consts":["iteratorTest","some"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,3097,2,3102,3,3103,4,3104,5,3105,6,3106,7,3102,8,3101],"localNames":["callback","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":80,"name":"Iterator$prototype$every","flags":88,"length":1,"params":1,"locals":2,"maxStack":5,"code":[789,65803,0,20,65546,10,65540,838,67],"consts":["iteratorTest","every"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,3107,2,3112,3,3113,4,3114,5,3115,6,3116,7,3112,8,3111],"localNames":["callback","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":81,"name":"Iterator$prototype$find","flags":88,"length":1,"params":1,"locals":2,"maxStack":5,"code":[789,65803,0,20,65546,10,65540,838,67],"consts":["iteratorTest","find"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,3117,2,3122,3,3123,4,3124,5,3125,6,3126,7,3122,8,3121],"localNames":["callback","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":82,"name":"iteratorTest","flags":72,"length":3,"params":3,"locals":10,"maxStack":5,"code":[0,20,10,2,582,196875,0,65556,65546,131076,131082,43,582,5,3,262411,0,327947,393228,196618,5308490,5308475,459019,6227788,5505083,393228,393483,0,65546,393226,262154,55,7,56,262155,582,327691,131082,196612,50,2752831,327690,3342397,258,590091,3213134,70,1611,5,589834,67,131082,262148,50,3735871,327690,54,4325437,2,590091,4196174,70,1611,5,589834,67,131082,327684,50,4653375,327690,5242941,393226,590091,5113678,70,1611,5,589834,67,1507388,70,75,1441851,70,6227789,1638459,524555,5965646,70,5,524298,64,5,5963835,131082,262148,50,6619197,258,7077947,131082,196612,50,7012413,2,7077947,0,67],"consts":["$Direct","$Callback","Iterator.prototype.","some","every","find"],"captures":[],"handlers":[25,81,87,0,88,91,93,0],"finallies":[],"finallyOffsets":[],"sites":[0,3136,1,3137,2,3138,3,3139,4,3136,5,3134,6,3141,7,3142,8,3143,9,3145,10,3146,11,3144,12,3141,14,3150,15,3148,16,3152,19,3158,20,3154,26,3155,27,3163,28,3164,29,3165,30,3167,32,3166,34,3167,35,3163,36,3162,37,3171,38,3172,39,3170,40,3169,41,3173,42,3168,43,3175,44,3174,51,3179,52,3180,53,3178,54,3177,55,3182,56,3181,57,3176,58,3184,59,3183,66,3188,67,3189,68,3187,69,3186,70,3190,71,3185,72,3192,73,3191,80,3154,95,3196,96,3197,97,3195,98,3194,99,3198,100,3194,101,3201,102,3202,103,3200,104,3199,105,3203,106,3199,107,3204,108,3193],"localNames":["self","callback","name","iterator","index","result","item","%it","%e","%ret"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":83,"name":"revive","flags":72,"length":3,"params":3,"locals":7,"maxStack":5,"code":[10,65546,26,196875,0,20,196618,326,3932221,262156,327692,393228,0,65556,196618,326,262411,3,327947,0,393483,327690,262154,131097,46,3932221,0,196628,196618,262154,327690,26,131082,838,393227,393226,0,50,3014717,196618,262154,327690,26,30,5,3670075,196618,262154,327690,26,31,32,543,393226,28,5,327690,56,327691,1376316,10,131082,65546,196618,582,67],"consts":["$IsObject","$Keys","length","revive"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,3215,1,3216,2,3214,3,3212,4,3218,5,3219,6,3220,7,3218,8,3217,12,3225,13,3226,14,3227,15,3225,16,3223,17,3231,18,3229,19,3233,21,3237,22,3239,23,3238,24,3236,25,3235,26,3245,27,3246,28,3247,29,3249,30,3250,31,3248,32,3251,33,3245,34,3244,35,3254,36,3255,37,3253,38,3252,39,3259,40,3261,41,3262,42,3260,43,3258,44,3257,45,3252,46,3266,47,3268,48,3269,49,3267,50,3265,51,3267,52,3265,53,3270,54,3265,55,3264,56,3273,57,3272,58,3273,59,3235,60,3278,61,3277,62,3279,63,3280,64,3275,65,3274],"localNames":["holder","key","reviver","value","names","index","revived"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"17668fa61c6e90d6"},"index":84,"name":"replaceWith","flags":72,"length":3,"params":3,"locals":6,"maxStack":9,"code":[4,196875,3,262411,262154,10,65561,46,3211325,196618,10,262154,26,3,26,0,131092,0,131082,36,10,262154,26,65539,26,2228810,2228283,327947,1967439,2621499,2622796,2424891,37,1966139,70,587,1769531,70,2622797,2097211,71,326,43,43,196619,262154,56,262155,262204,196618,65546,43,67],"consts":["","length","String"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,3290,1,3288,2,3294,3,3292,4,3297,5,3299,6,3298,7,3296,8,3295,9,3304,10,3308,11,3309,12,3307,13,3310,14,3306,15,3311,16,3312,17,3313,18,3314,19,3313,20,3318,21,3319,22,3317,23,3320,24,3316,25,3315,40,3313,41,3311,42,3305,43,3303,44,3304,45,3323,46,3322,47,3323,48,3295,49,3326,50,3327,51,3325,52,3324],"localNames":["matches","rest","callback","result","index","%it"],"upvalNames":[]}]},"@vm-internal":{"text":"44830039edee7f3c","codes":[{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":0,"name":"","flags":202,"length":0,"params":0,"locals":0,"maxStack":1,"code":[0,87],"consts":[],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,0],"localNames":[],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":1,"name":"$vmToPrimitive","flags":72,"length":2,"params":2,"locals":8,"maxStack":4,"code":[0,20,10,326,54,524349,10,67,65546,65540,50,1310783,65546,131076,50,1311039,0,196628,10,326,1507389,262148,1572923,327684,131339,131082,262148,50,2031677,327684,2097211,262148,196875,10,131082,26,262411,0,393236,262154,326,3604541,393228,10,262154,70,393483,0,458772,393226,326,54,3604541,393226,67,10,196618,26,327947,0,393236,327690,326,5046333,458764,10,327690,70,459019,0,458772,458762,326,54,5046333,458762,67,0,524308,589828,655364,582,5,0,67],"consts":["$IsDataObj","string","default","$IsDate","toString","valueOf","$IsCallableAny","$IsObj","$Throw","TypeError","Cannot convert object to primitive value."],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,8,1,9,2,10,3,8,4,7,5,6,6,12,7,11,8,19,9,20,10,18,11,17,12,23,13,24,14,22,15,21,16,25,17,26,18,27,19,25,20,16,21,28,22,16,23,29,24,14,25,35,26,36,27,34,28,33,29,37,30,33,31,38,32,31,33,43,34,44,35,42,36,40,37,46,38,47,39,48,40,46,41,45,43,56,44,55,45,53,46,51,47,59,48,60,49,61,50,59,51,58,52,57,53,63,54,62,55,68,56,69,57,67,58,65,59,71,60,72,61,73,62,71,63,70,65,81,66,80,67,78,68,76,69,84,70,85,71,86,72,84,73,83,74,82,75,88,76,87,77,90,78,91,79,92,80,93,81,90,83,5],"localNames":["v","hint","first","second","m1","m2","r1","r2"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":2,"name":"$vmToKey","flags":72,"length":1,"params":1,"locals":1,"maxStack":6,"code":[0,20,0,65556,10,131076,582,326,67],"consts":["$PropKey","$vmToPrimitive","string"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,99,1,100,2,101,3,102,4,103,5,104,6,101,7,99,8,98],"localNames":["v"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":3,"name":"$vmToString","flags":72,"length":1,"params":1,"locals":1,"maxStack":6,"code":[0,20,0,65556,10,131076,582,326,67],"consts":["$CoerceToString","$vmToPrimitive","string"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,110,1,111,2,112,3,113,4,114,5,115,6,112,7,110,8,109],"localNames":["v"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":4,"name":"$vmToNumeric","flags":72,"length":2,"params":2,"locals":2,"maxStack":7,"code":[0,20,10,0,65556,65546,131076,582,582,67],"consts":["$ApplyToNumeric","$vmToPrimitive","number"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,122,1,123,2,124,3,125,4,126,5,127,6,128,7,125,8,122,9,121],"localNames":["incFlag","v"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":5,"name":"$vmInc","flags":72,"length":2,"params":2,"locals":3,"maxStack":7,"code":[0,20,10,0,65556,65546,131076,582,582,131339,10,3,50,1179709,131082,65539,43,1376315,131082,65539,44,67],"consts":["$ApplyToNumeric","$vmToPrimitive","number"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,137,1,138,2,139,3,140,4,141,5,142,6,143,7,140,8,137,9,135,10,147,11,148,12,146,13,145,14,150,15,151,16,149,17,145,18,153,19,154,20,152,21,144],"localNames":["incFlag","v","n"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":6,"name":"$vmUnary","flags":72,"length":2,"params":2,"locals":2,"maxStack":7,"code":[0,20,10,0,65556,65546,131076,582,582,67],"consts":["$ApplyUnary","$vmToPrimitive","number"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,161,1,162,2,163,3,164,4,165,5,166,6,167,7,164,8,161,9,160],"localNames":["sub","v"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":7,"name":"$vmBinary","flags":72,"length":3,"params":3,"locals":8,"maxStack":5,"code":[0,20,10,65546,131082,838,196875,196618,3,50,1179709,0,65556,10,65546,131082,838,67,196618,65539,50,2359357,458764,0,131092,65546,196612,582,459019,0,65556,10,458762,131082,838,67,196618,131075,50,2752573,262148,2818107,327684,262411,0,131092,65546,262154,582,327947,0,131092,131082,262154,582,393483,0,65556,10,327690,393226,838,67],"consts":["$OpConvKind","$ApplyBinary","$vmToPrimitive","string","default","number"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,177,1,178,2,179,3,180,4,181,5,177,6,175,7,184,8,185,9,183,10,182,11,187,12,188,13,189,14,190,15,191,16,187,17,186,18,194,19,195,20,193,21,192,23,200,24,201,25,202,26,203,27,200,28,198,29,205,30,206,31,207,32,208,33,209,34,205,35,204,36,215,37,216,38,214,39,213,40,217,41,213,42,218,43,211,44,222,45,223,46,224,47,225,48,222,49,220,50,229,51,230,52,231,53,232,54,229,55,227,56,234,57,235,58,236,59,237,60,238,61,234,62,233],"localNames":["op","lhs","rhs","kind","hint","l","r","key"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":8,"name":"$vmSet","flags":72,"length":3,"params":3,"locals":3,"maxStack":3,"code":[65546,10,131082,326,5,131082,67],"consts":[],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,249,1,248,2,250,3,246,5,252,6,251],"localNames":["setter","receiver","value"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":9,"name":"$vmInstanceof","flags":72,"length":2,"params":2,"locals":2,"maxStack":4,"code":[0,20,10,65546,65561,582,67],"consts":["$HasInstance","prototype"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,259,1,260,2,261,3,263,4,262,5,259,6,258],"localNames":["lhs","rhs"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":10,"name":"$vmRedo","flags":72,"length":2,"params":2,"locals":2,"maxStack":2,"code":[65546,10,70,67],"consts":[],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,274,1,273,2,271,3,270],"localNames":["getter","receiver"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":11,"name":"$vmThenableGet","flags":72,"length":3,"params":3,"locals":4,"maxStack":4,"code":[10,25,196875,0,65556,196618,326,983101,10,196618,65546,131082,582,5,1310779,0,131092,10,326,5,0,67],"consts":["then","$IsFunction","$FulfillWith"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,285,1,284,2,282,3,288,4,289,5,290,6,288,7,287,8,295,9,294,10,296,11,297,12,292,14,287,15,299,16,300,17,301,18,299,20,280],"localNames":["thenable","resolve","reject","then"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":12,"name":"$vmCopyDataProps","flags":72,"length":3,"params":3,"locals":6,"maxStack":6,"code":[0,20,65546,2,131082,838,196875,3,262411,262154,196618,65561,46,2555965,327692,196618,262154,26,327947,0,131092,65546,327690,582,2293821,0,196628,10,327690,65546,327690,26,258,1094,5,262154,56,262155,589884,10,67],"consts":["$OwnKeys","length","$IsEnumerableOwn","$Define"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,311,1,312,2,313,3,314,4,315,5,311,6,309,7,319,8,317,9,322,10,324,11,323,12,321,13,320,15,331,16,332,17,330,18,328,19,334,20,335,21,336,22,337,23,334,24,333,25,339,26,340,27,341,28,342,29,344,30,345,31,343,32,346,33,339,35,349,36,348,37,349,38,320,39,351,40,350],"localNames":["target","source","excluded","keys","index","key"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":13,"name":"$vmGetElem","flags":72,"length":2,"params":2,"locals":2,"maxStack":4,"code":[10,0,20,65546,326,26,67],"consts":["$vmToKey"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,359,1,360,2,361,3,362,4,360,5,358,6,357],"localNames":["o","k"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":14,"name":"$vmDeleteElem","flags":72,"length":2,"params":2,"locals":2,"maxStack":4,"code":[10,0,20,65546,326,30,67],"consts":["$vmToKey"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,371,1,372,2,373,3,374,4,372,5,370,6,368],"localNames":["o","k"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":15,"name":"$vmReplay","flags":72,"length":7,"params":7,"locals":21,"maxStack":8,"code":[258,11993149,458764,0,20,393226,326,4325437,524300,589836,0,65556,393226,326,524555,3,590091,589834,524298,131097,46,4259901,655372,720908,524298,589834,26,655627,524298,589834,65539,43,26,721163,0,196628,327690,327690,131097,655370,838,5,0,196628,327690,327690,131097,720906,838,5,0,196628,327690,327690,131097,655370,720906,26,838,5,589834,131075,43,589835,1114172,10223675,393226,0,51,10223677,786444,851980,917516,983052,1048588,1114124,0,262164,393226,326,786699,0,327700,393226,3,582,852235,0,327700,393226,65539,582,917771,786442,131097,983307,36,1048843,3,1114379,1114122,983050,46,9764925,1179660,1245196,1310732,786442,1114122,26,1179915,0,393236,393226,1114122,582,1245451,0,458772,1179658,326,8388669,0,524308,1179658,1245194,582,8454203,1179658,1310987,0,196628,1048586,1114122,851978,9306173,0,589844,1245194,1310730,582,9371707,1310730,838,5,1114122,56,1114123,6553660,0,196628,262154,917514,1048586,838,5,0,655380,10,65546,131082,196618,262154,327690,1606,459019,0,720916,458762,326,54,11600191,0,20,458762,326,54,11796541,458762,67,458762,393227,60,0,67],"consts":["$IsPrefetch","$PrefetchReads","length","$ArraySet","$ConvValues","$ConvFlag","$ConvHint","$IsObj","$vmToPrimitive","$ConvCoerce","$Replay","$IsConvert"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,386,1,385,3,389,4,390,5,391,6,389,7,388,10,396,11,397,12,398,13,396,14,394,15,402,16,400,17,405,18,407,19,406,20,404,21,403,24,414,25,415,26,413,27,411,28,420,29,422,30,423,31,421,32,419,33,417,34,425,35,426,36,427,37,429,38,428,39,431,40,425,42,433,43,434,44,435,45,437,46,436,47,439,48,433,50,441,51,442,52,443,53,445,54,444,55,448,56,449,57,447,58,441,60,452,61,453,62,451,63,452,64,403,65,388,66,456,67,457,68,455,69,454,76,462,77,463,78,464,79,462,80,460,81,468,82,469,83,470,84,471,85,468,86,466,87,475,88,476,89,477,90,478,91,475,92,473,93,483,94,482,95,480,96,488,97,486,98,492,99,490,100,495,101,496,102,494,103,493,107,502,108,503,109,501,110,499,111,507,112,508,113,509,114,510,115,507,116,505,117,515,118,516,119,517,120,515,121,514,122,518,123,519,124,520,125,521,126,518,127,514,128,522,129,512,130,524,131,525,132,526,133,527,134,529,135,528,136,530,137,531,138,532,139,533,140,530,141,528,142,534,143,524,145,537,146,536,147,537,148,493,149,539,150,540,151,541,152,542,153,543,154,539,156,547,157,548,158,549,159,550,160,551,161,552,162,553,163,554,164,547,165,545,166,558,167,559,168,560,169,558,170,557,171,556,172,562,173,563,174,564,175,562,176,561,177,555,178,566,179,565,180,570,181,569,182,385,183,384],"localNames":["callable","target","args","constructing","replay","read","req","res","pairs","at","receiver","key","values","coerce","ordinal","len","converted","i","val","hint","prim"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":16,"name":"$vmJsonVisitor","flags":72,"length":3,"params":3,"locals":5,"maxStack":1,"code":[269,65805,131341,196621,262157,1114134,262416,36,196880,262159,67],"consts":[],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,571,5,581,7,580,8,578,9,828,10,827],"localNames":["boundary","replacer","properties","ancestors","visit"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":17,"name":"visit","flags":76,"length":3,"params":3,"locals":19,"maxStack":6,"code":[81,131082,6553603,48,720957,0,20,65540,131076,582,5,10,65546,26,196875,0,196628,196618,326,2228285,17,54,1900605,0,20,262148,327684,582,5,196618,82,2162771,67,196619,0,393236,196618,326,3473469,458764,196618,458777,459019,0,524308,458762,326,3473469,196618,458762,65546,326,196619,65553,0,51,4128829,10,65553,65546,196618,582,196619,0,589844,196618,17,131089,838,262411,262154,3,50,4980797,0,67,262154,65539,50,5374013,196618,67,262154,131075,50,5767229,1,67,262154,196611,50,6422589,0,655380,196618,17,582,67,262154,262147,50,7012413,0,720916,196618,326,7077947,196618,327947,0,786452,131089,131089,851993,327690,838,5,0,393483,0,917524,327690,326,13041725,524300,589836,36,393227,327690,851993,524555,3,590091,589834,524298,46,12976189,655372,0,196625,327690,0,983060,589834,326,131082,65539,43,838,11273034,11272251,983307,0,3,7,1048843,11013973,1048586,131075,50,10616893,67,5,10948430,70,1611,5,1048641,326,11472982,82,10092604,70,843,9895995,1048586,131075,50,11796541,67,655627,0,786452,393226,589834,655370,0,50,12517437,1,12582971,655370,838,5,589834,56,589835,8716348,18415675,720908,786444,0,1114132,70,393227,0,1179668,327690,17,262161,838,721163,3,786699,786442,720906,851993,46,18415677,851980,917516,720906,786442,26,852235,0,196625,327690,851978,131082,65539,43,838,16778058,16777275,1114379,0,3,7,1179915,16519509,1179658,131075,50,16121917,67,5,16453966,70,1611,5,1245249,326,16978518,82,15597628,70,843,15401019,1179658,131075,50,17301565,67,917771,917514,0,51,18153533,0,1310740,393226,851978,917514,258,1094,5,786442,56,786443,14024764,0,1376276,131089,326,5,393226,67],"consts":["$Throw","RangeError","Value exceeds the maximum depth of 100.","$IsPromise","InvalidData","JSON.stringify received an un-awaited Promise; await it first - e.g. `const result = await load(...)`.","$IsObj","toJSON","$IsCallableAny","$JsonClassify","$JsonSpecial","$SetToArray","$ArraySet","length","$IsArray","String",{"type":"TypeError","message":"The delegated iterator does not provide a throw() method."},"$NewNullProtoObj","$JsonNames",{"type":"TypeError","message":"The delegated iterator does not provide a throw() method."},"$Define","$ArrayPop"],"captures":[0,0,0,1,0,3,0,4,0,2],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,581,1,589,2,590,3,588,4,587,5,592,6,593,7,594,8,595,9,592,11,600,12,601,13,599,14,597,15,603,16,604,17,605,18,603,19,602,20,609,21,608,22,607,23,612,24,613,25,614,26,615,27,612,29,620,30,619,33,618,34,622,35,623,36,624,37,622,38,621,40,630,41,629,42,627,43,633,44,634,45,635,46,633,47,632,48,642,49,641,50,643,51,639,52,638,53,646,54,647,55,645,56,644,57,654,58,653,59,655,60,656,61,651,62,650,63,660,64,661,65,662,66,663,67,664,68,660,69,658,70,667,71,668,72,666,73,665,74,670,75,669,76,673,77,674,78,672,79,671,80,676,81,675,82,679,83,680,84,678,85,677,86,682,87,681,88,685,89,686,90,684,91,683,92,688,93,689,94,690,95,691,96,688,97,687,98,697,99,698,100,696,101,695,102,699,103,700,104,701,105,699,106,695,107,702,108,693,109,704,110,705,111,706,112,708,113,707,114,710,115,704,117,712,119,715,120,716,121,717,122,715,123,714,126,722,127,721,128,727,129,726,130,724,131,732,132,730,133,735,134,736,135,734,136,733,138,742,139,743,140,744,141,745,142,746,143,747,144,745,145,749,146,750,147,748,148,742,149,741,180,739,181,752,182,753,183,754,184,755,185,758,186,759,187,757,188,756,189,760,190,756,191,761,192,752,194,764,195,763,196,764,197,733,198,714,201,769,202,770,203,769,204,768,205,774,206,775,207,776,208,777,209,778,210,774,211,772,212,782,213,780,214,785,215,787,216,786,217,784,218,783,221,794,222,795,223,793,224,791,225,800,226,801,227,802,228,803,229,805,230,806,231,804,232,800,233,799,264,797,265,809,266,810,267,808,268,807,269,812,270,813,271,814,272,815,273,816,274,817,275,812,277,820,278,819,279,820,280,783,281,822,282,823,283,824,284,822,286,826,287,825],"localNames":["holder","key","depth","val","kind","target","out","toJSON","len","i","elem","names","i","k","propVal","%it","%kind","%it","%kind"],"upvalNames":["boundary","replacer","ancestors","visit","properties"]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":18,"name":"$vmJsonWalk","flags":72,"length":4,"params":4,"locals":5,"maxStack":6,"code":[0,0,20,2,10,131082,838,35,65546,65574,65540,3,838,131353,70,196633,262411,0,262164,2,262154,131082,196618,1094,67],"consts":["$vmJsonVisitor","","next","value","$JsonFinish"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,842,1,843,2,844,3,845,4,846,5,847,6,843,7,848,8,851,9,849,10,852,11,853,12,842,13,841,14,840,15,839,16,837,17,857,18,858,19,859,20,860,21,861,22,862,23,857,24,856],"localNames":["replacer","value","properties","indent","json"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":19,"name":"$vmSettleCall","flags":72,"length":3,"params":3,"locals":3,"maxStack":5,"code":[0,20,10,65546,131082,838,67],"consts":["$Apply"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,870,1,871,2,872,3,873,4,874,5,870,6,869],"localNames":["callable","thisVal","args"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":20,"name":"$vmCombine","flags":72,"length":2,"params":2,"locals":6,"maxStack":4,"code":[0,20,10,65546,582,131339,196620,65546,1441866,1441851,262411,2360396,1638459,196620,196875,0,65556,131082,196618,582,5,720956,70,75,655419,70,2360397,852027,327947,2098254,70,5,327690,64,5,2097211,0,131092,131082,326,5,0,67],"consts":["$CombineStart","$CombineAdd","$CombineEnd"],"captures":[],"handlers":[13,22,28,0,29,32,34,0],"finallies":[],"finallyOffsets":[],"sites":[0,883,1,884,2,885,3,886,4,883,5,881,7,891,8,887,14,888,15,894,16,895,17,896,18,897,19,894,21,887,36,899,37,900,38,901,39,899,41,879],"localNames":["name","items","c","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":21,"name":"$vmOpenSyncForAsync","flags":72,"length":2,"params":2,"locals":3,"maxStack":4,"code":[0,20,10,65546,70,326,131339,0,65556,131082,131082,131097,582,67],"consts":["$AfsRequireObj","$WrapAsyncFromSync","next"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,910,1,911,2,915,3,914,4,912,5,910,6,908,7,917,8,918,9,919,10,921,11,920,12,917,13,916],"localNames":["v","method","it"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":22,"name":"$vmAsyncFromSync","flags":72,"length":4,"params":4,"locals":10,"maxStack":7,"code":[0,20,10,326,262411,65546,65540,50,917565,0,131092,10,326,1441851,0,196628,10,262154,65546,26,65546,838,327947,327690,0,50,1966143,327690,1,50,4915261,589836,65546,262148,50,2818109,0,327700,196618,326,5,0,67,0,196628,10,262154,262169,262148,838,590091,589834,0,51,3801407,589834,1,51,4456509,0,393236,10,262154,589834,70,262148,838,5,0,458772,10,326,5,0,67,131082,5374013,262154,327690,196618,326,5570619,262154,327690,70,393483,0,393236,10,393226,65546,838,5,393226,524313,54,54,459019,393226,589849,524555,0,655380,10,524298,458762,65546,262148,51,1094,5,0,67],"consts":["$AfsGetIter","next","$AfsGetNext","$AfsMethod","return","$AfsResolveDone","$AfsCheckObj","$AfsRejectNoThrow","done","value","$AfsSettle"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,933,1,934,2,935,3,933,4,931,5,941,6,942,7,940,8,939,9,943,10,944,11,945,12,943,13,939,14,946,15,947,16,948,17,950,18,951,19,949,20,952,21,946,22,937,23,956,24,957,25,955,26,954,27,959,28,960,29,958,30,953,32,964,33,965,34,963,35,962,36,968,37,969,38,970,39,968,41,971,43,975,44,976,45,977,46,979,47,978,48,981,49,975,50,973,51,985,52,986,53,984,54,983,55,988,56,989,57,987,58,982,59,992,60,993,61,994,62,998,63,997,64,995,65,999,66,992,68,1001,69,1002,70,1003,71,1001,73,1004,75,1009,76,1008,77,1013,78,1012,79,1014,80,1010,81,1008,82,1018,83,1017,84,1015,85,1006,86,1020,87,1021,88,1022,89,1023,90,1024,91,1020,93,1031,94,1030,95,1029,96,1028,97,1026,98,1037,99,1036,100,1034,101,1040,102,1041,103,1042,104,1043,105,1044,106,1046,107,1047,108,1045,109,1040,111,929],"localNames":["adapter","kind","hasArg","val","iter","method","res","done","value","ret"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":23,"name":"$vmAsyncFromSyncClose","flags":72,"length":1,"params":1,"locals":2,"maxStack":2,"code":[10,25,65803,65546,0,51,655679,65546,1,51,983101,10,65546,70,5,0,67],"consts":["return"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1056,1,1055,2,1053,3,1061,4,1062,5,1060,6,1059,7,1064,8,1065,9,1063,10,1058,11,1070,12,1069,13,1067,15,1051],"localNames":["iter","ret"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":24,"name":"$vmHostWait","flags":74,"length":4,"params":4,"locals":5,"maxStack":9,"code":[3,262411,262154,10,25,46,1048637,10,262154,26,340,5,262154,56,262155,131132,0,65556,65546,0,131082,2,36,196618,0,1862,67],"consts":["length","$vmReplay"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1081,1,1079,2,1084,3,1086,4,1085,5,1083,6,1082,7,1092,8,1093,9,1091,10,1090,12,1096,13,1095,14,1096,15,1082,16,1098,17,1099,18,1100,19,1101,20,1102,21,1103,22,1104,23,1105,24,1106,25,1098,26,1097],"localNames":["promises","callee","args","read","i"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"2fa81019ca46a87e"},"index":25,"name":"$vmResult","flags":74,"length":1,"params":1,"locals":4,"maxStack":6,"code":[0,20,10,326,524349,10,340,589883,10,65803,0,0,65556,258,0,1,838,35,65546,131110,131076,3,838,131339,131082,196889,70,196875,196618,262169,54,2621501,131082,196889,196618,327705,340,326,196619,1835068,0,393236,258,196618,327705,1,0,1094,67],"consts":["$IsThenable","$vmJsonVisitor","","next","done","value","$JsonFinish"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1115,1,1116,2,1117,3,1115,4,1114,5,1119,6,1118,7,1114,8,1120,9,1112,10,1124,11,1125,12,1126,13,1127,14,1128,15,1129,16,1125,17,1130,18,1133,19,1131,20,1134,21,1135,22,1124,23,1122,24,1141,25,1140,26,1139,27,1137,28,1146,29,1145,30,1144,31,1143,32,1153,33,1152,34,1157,35,1156,36,1155,37,1151,38,1150,39,1143,40,1160,41,1161,42,1162,43,1164,44,1163,45,1166,46,1167,47,1160,48,1159],"localNames":["value","root","walk","step"],"upvalNames":[]}]}} +{"@prelude":{"text":"07ec7529e58b0b37","codes":[{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":0,"name":"","flags":202,"length":0,"params":0,"locals":0,"maxStack":1,"code":[0,87],"consts":[],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,0],"localNames":[],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":1,"name":"arrayFromIterable","flags":72,"length":3,"params":3,"locals":8,"maxStack":8,"code":[36,196875,3,262411,327692,10,2228298,2228283,393483,3147340,2424891,327692,327947,0,20,196618,262154,65546,0,50,1507389,327690,1835067,131082,65546,327690,262154,582,838,5,262154,56,262155,589884,70,75,524347,70,3147341,720955,459019,2885198,70,5,458762,64,5,2883643,196618,67],"consts":["$ArraySet"],"captures":[],"handlers":[11,34,40,0,41,44,46,0],"finallies":[],"finallyOffsets":[],"sites":[0,10,1,8,2,14,3,12,5,19,6,15,12,16,13,22,14,23,15,24,16,25,17,28,18,29,19,27,20,26,21,30,22,26,23,34,24,33,25,35,26,36,27,31,28,22,30,39,31,38,32,39,33,15,48,41,49,40],"localNames":["items","mapper","thisArg","result","index","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":2,"name":"arrayFromLike","flags":72,"length":4,"params":4,"locals":6,"maxStack":8,"code":[20,65546,328,262411,3,327947,327690,65546,46,1769533,0,65556,262154,327690,196618,131082,10,327690,26,327690,582,838,5,327690,56,327691,393276,262154,67],"consts":["Array","$ArraySet"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,53,1,54,2,52,3,50,4,58,5,56,6,61,7,62,8,60,9,59,10,65,11,66,12,67,13,68,14,72,15,71,16,74,17,75,18,73,19,76,20,69,21,65,23,79,24,78,25,79,26,59,27,81,28,80],"localNames":["source","length","mapper","thisArg","result","index"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":3,"name":"Array$prototype$map","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,1094,67],"consts":["mapItems","$Receiver","Array","Array.prototype.map","Array.map"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,82,2,84,4,85,6,87,7,85,8,90,9,91,10,92,11,93,12,94,13,95,14,96,15,92,16,97,17,98,18,99,19,90,20,89],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":4,"name":"Uint8Array$prototype$map","flags":592,"length":1,"params":2,"locals":4,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,10,65540,131076,838,196875,0,196628,0,262164,196618,65546,131082,327684,1094,65556,393241,3,838,67],"consts":["$Receiver","Uint8Array","Uint8Array.prototype.map","$Bytes","mapItems","Uint8Array.map","prototype"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,100,2,102,4,103,6,105,7,103,8,110,9,111,10,112,11,113,12,114,13,110,14,108,15,116,16,117,17,118,18,119,19,120,20,121,21,122,22,123,23,118,24,125,25,124,26,127,27,116,28,115],"localNames":["this","callback","thisArg","bytes"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":5,"name":"mapItems","flags":72,"length":4,"params":4,"locals":7,"maxStack":9,"code":[0,20,65546,196618,582,5,10,65561,262411,131092,262154,328,327947,3,393483,393226,262154,46,2687037,393226,10,33,2424893,0,196628,327690,393226,131082,65546,10,393226,26,393226,10,838,838,5,393226,56,393227,983100,327690,67],"consts":["$Callback","length","Array","$ArraySet"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,136,1,137,2,138,3,139,4,136,6,144,7,143,8,141,9,150,10,151,11,149,12,147,13,155,14,153,15,158,16,159,17,157,18,156,19,163,20,164,21,162,22,161,23,166,24,167,25,168,26,169,27,173,28,172,29,175,30,176,31,174,32,177,33,178,34,170,35,166,37,181,38,180,39,181,40,156,41,183,42,182],"localNames":["array","callback","thisArg","label","length","result","index"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":6,"name":"Array$prototype$filter","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,1094,67],"consts":["filterItems","$Receiver","Array","Array.prototype.filter","Array.filter"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,184,2,186,4,187,6,189,7,187,8,192,9,193,10,194,11,195,12,196,13,197,14,198,15,194,16,199,17,200,18,201,19,192,20,191],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":7,"name":"Uint8Array$prototype$filter","flags":592,"length":1,"params":2,"locals":4,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,10,65540,131076,838,196875,0,196628,0,262164,196618,65546,131082,327684,1094,65556,393241,3,838,67],"consts":["$Receiver","Uint8Array","Uint8Array.prototype.filter","$Bytes","filterItems","Uint8Array.filter","prototype"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,202,2,204,4,205,6,207,7,205,8,212,9,213,10,214,11,215,12,216,13,212,14,210,15,218,16,219,17,220,18,221,19,222,20,223,21,224,22,225,23,220,24,227,25,226,26,229,27,218,28,217],"localNames":["this","callback","thisArg","bytes"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":8,"name":"filterItems","flags":72,"length":4,"params":4,"locals":9,"maxStack":5,"code":[0,20,65546,196618,582,5,10,65561,262411,36,327947,3,393483,3,459019,0,524555,458762,262154,46,3407933,458762,10,33,3145789,10,458762,26,524299,131082,65546,524298,458762,10,838,3145789,327690,393226,55,7,56,393227,31,32,543,524298,28,5,458762,56,458763,1114172,327690,67],"consts":["$Callback","length"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,238,1,239,2,240,3,241,4,238,6,246,7,245,8,243,9,251,10,249,11,255,12,253,13,259,14,257,15,261,17,265,18,266,19,264,20,263,21,270,22,271,23,269,24,268,25,277,26,278,27,276,28,275,29,283,30,282,31,284,32,285,33,286,34,280,35,279,36,290,37,292,39,291,41,292,42,289,43,291,44,289,45,293,46,289,47,288,48,296,49,295,50,296,51,263,52,298,53,297],"localNames":["array","callback","thisArg","label","length","result","count","index","item"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":9,"name":"Array$prototype$forEach","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,1094,5,0,67],"consts":["forEachItem","$Receiver","Array","Array.prototype.forEach","Array.forEach"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,299,2,301,4,302,6,304,7,302,8,307,9,308,10,309,11,310,12,311,13,312,14,313,15,309,16,314,17,315,18,316,19,307,21,305],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":10,"name":"Uint8Array$prototype$forEach","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,1094,5,0,67],"consts":["forEachItem","$Receiver","Uint8Array","Uint8Array.prototype.forEach","Uint8Array.forEach"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,317,2,319,4,320,6,322,7,320,8,325,9,326,10,327,11,328,12,329,13,330,14,331,15,327,16,332,17,333,18,334,19,325,21,323],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":11,"name":"forEachItem","flags":72,"length":4,"params":4,"locals":6,"maxStack":5,"code":[0,20,65546,196618,582,5,10,65561,262411,3,327947,327690,262154,46,2097213,327690,10,33,1835069,131082,65546,10,327690,26,327690,10,838,5,327690,56,327691,720956,0,67],"consts":["$Callback","length"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,343,1,344,2,345,3,346,4,343,6,351,7,350,8,348,9,356,10,354,11,359,12,360,13,358,14,357,15,364,16,365,17,363,18,362,19,370,20,369,21,372,22,373,23,371,24,374,25,375,26,367,28,378,29,377,30,378,31,357,32,341],"localNames":["array","callback","thisArg","label","length","index"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":12,"name":"Array$prototype$some","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,2,1350,67],"consts":["testItems","$Receiver","Array","Array.prototype.some","Array.some"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,379,2,381,4,382,6,384,7,382,8,387,9,388,10,389,11,390,12,391,13,392,14,393,15,389,16,394,17,395,18,396,19,397,20,387,21,386],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":13,"name":"Uint8Array$prototype$some","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,2,1350,67],"consts":["testItems","$Receiver","Uint8Array","Uint8Array.prototype.some","Uint8Array.some"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,398,2,400,4,401,6,403,7,401,8,406,9,407,10,408,11,409,12,410,13,411,14,412,15,408,16,413,17,414,18,415,19,416,20,406,21,405],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":14,"name":"Array$prototype$every","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,258,1350,67],"consts":["testItems","$Receiver","Array","Array.prototype.every","Array.every"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,417,2,419,4,420,6,422,7,420,8,425,9,426,10,427,11,428,12,429,13,430,14,431,15,427,16,432,17,433,18,434,19,435,20,425,21,424],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":15,"name":"Uint8Array$prototype$every","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,258,1350,67],"consts":["testItems","$Receiver","Uint8Array","Uint8Array.prototype.every","Uint8Array.every"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,436,2,438,4,439,6,441,7,439,8,444,9,445,10,446,11,447,12,448,13,449,14,450,15,446,16,451,17,452,18,453,19,454,20,444,21,443],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":16,"name":"testItems","flags":72,"length":5,"params":5,"locals":7,"maxStack":5,"code":[0,20,65546,196618,582,5,10,65561,327947,3,393483,393226,327690,46,2490429,393226,10,33,1966399,131082,65546,10,393226,26,393226,10,838,54,262154,50,2228285,262154,54,67,393226,56,393227,720956,262154,67],"consts":["$Callback","length"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,464,1,465,2,466,3,467,4,464,6,472,7,471,8,469,9,477,10,475,11,480,12,481,13,479,14,478,15,486,16,487,17,485,18,484,19,493,20,492,21,495,22,496,23,494,24,497,25,498,26,490,27,489,28,499,29,488,30,483,31,502,32,501,33,500,34,505,35,504,36,505,37,478,38,507,39,506],"localNames":["array","callback","thisArg","label","every","length","index"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":17,"name":"Array$prototype$find","flags":592,"length":1,"params":2,"locals":3,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,2,2,1606,67],"consts":["findItem","$Receiver","Array","Array.prototype.find","Array.find"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,508,2,510,4,511,6,513,7,511,8,516,9,517,10,518,11,519,12,520,13,521,14,522,15,518,16,523,17,524,18,525,19,526,20,527,21,516,22,515],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":18,"name":"Uint8Array$prototype$find","flags":592,"length":1,"params":2,"locals":3,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,2,2,1606,67],"consts":["findItem","$Receiver","Uint8Array","Uint8Array.prototype.find","Uint8Array.find"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,528,2,530,4,531,6,533,7,531,8,536,9,537,10,538,11,539,12,540,13,541,14,542,15,538,16,543,17,544,18,545,19,546,20,547,21,536,22,535],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":19,"name":"Array$prototype$findIndex","flags":592,"length":1,"params":2,"locals":3,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,2,258,1606,67],"consts":["findItem","$Receiver","Array","Array.prototype.findIndex","Array.findIndex"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,548,2,550,4,551,6,553,7,551,8,556,9,557,10,558,11,559,12,560,13,561,14,562,15,558,16,563,17,564,18,565,19,566,20,567,21,556,22,555],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":20,"name":"Uint8Array$prototype$findIndex","flags":592,"length":1,"params":2,"locals":3,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,2,258,1606,67],"consts":["findItem","$Receiver","Uint8Array","Uint8Array.prototype.findIndex","Uint8Array.findIndex"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,568,2,570,4,571,6,573,7,571,8,576,9,577,10,578,11,579,12,580,13,581,14,582,15,578,16,583,17,584,18,585,19,586,20,587,21,576,22,575],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":21,"name":"Array$prototype$findLast","flags":592,"length":1,"params":2,"locals":3,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,258,2,1606,67],"consts":["findItem","$Receiver","Array","Array.prototype.findLast","Array.findLast"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,588,2,590,4,591,6,593,7,591,8,596,9,597,10,598,11,599,12,600,13,601,14,602,15,598,16,603,17,604,18,605,19,606,20,607,21,596,22,595],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":22,"name":"Uint8Array$prototype$findLast","flags":592,"length":1,"params":2,"locals":3,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,258,2,1606,67],"consts":["findItem","$Receiver","Uint8Array","Uint8Array.prototype.findLast","Uint8Array.findLast"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,608,2,610,4,611,6,613,7,611,8,616,9,617,10,618,11,619,12,620,13,621,14,622,15,618,16,623,17,624,18,625,19,626,20,627,21,616,22,615],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":23,"name":"Array$prototype$findLastIndex","flags":592,"length":1,"params":2,"locals":3,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,258,258,1606,67],"consts":["findItem","$Receiver","Array","Array.prototype.findLastIndex","Array.findLastIndex"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,628,2,630,4,631,6,633,7,631,8,636,9,637,10,638,11,639,12,640,13,641,14,642,15,638,16,643,17,644,18,645,19,646,20,647,21,636,22,635],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":24,"name":"Uint8Array$prototype$findLastIndex","flags":592,"length":1,"params":2,"locals":3,"maxStack":8,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,258,258,1606,67],"consts":["findItem","$Receiver","Uint8Array","Uint8Array.prototype.findLastIndex","Uint8Array.findLastIndex"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,648,2,650,4,651,6,653,7,651,8,656,9,657,10,658,11,659,12,660,13,661,14,662,15,658,16,663,17,664,18,665,19,666,20,667,21,656,22,655],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":25,"name":"findItem","flags":72,"length":6,"params":6,"locals":10,"maxStack":5,"code":[0,20,65546,196618,582,5,10,65561,393483,262154,917565,65539,53,983099,65539,459019,262154,1441853,393226,65539,44,1507387,3,524555,0,590091,524298,3,49,2163007,524298,393226,46,3670077,10,524298,26,589835,131082,65546,589834,524298,10,838,3342397,327690,3211325,524298,3276859,589834,67,524298,458762,43,524299,1703996,327690,3997757,65539,53,4063291,0,67],"consts":["$Callback","length"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,678,1,679,2,680,3,681,4,678,6,686,7,685,8,683,9,692,10,691,11,694,12,693,13,691,14,695,15,689,16,700,17,699,18,702,19,703,20,701,21,699,22,704,23,697,24,706,26,711,27,712,28,710,29,709,30,714,31,715,32,713,33,708,34,721,35,722,36,720,37,719,38,727,39,726,40,728,41,729,42,730,43,724,44,723,45,733,46,732,47,734,48,732,49,735,50,731,51,738,52,739,53,737,54,738,55,708,56,742,57,741,58,744,59,743,60,741,61,745,62,740],"localNames":["array","callback","thisArg","label","last","wantIndex","length","step","index","item"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":26,"name":"Array$prototype$reduce","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,65813,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,2,1350,67],"consts":["reduceItems","$Receiver","Array","Array.prototype.reduce","Array.reduce"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,746,2,748,4,749,6,753,7,754,8,755,9,756,10,757,11,758,12,759,13,755,14,760,15,761,16,762,17,763,18,753,19,752],"localNames":["this","callback","initial"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":27,"name":"Uint8Array$prototype$reduce","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,65813,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,2,1350,67],"consts":["reduceItems","$Receiver","Uint8Array","Uint8Array.prototype.reduce","Uint8Array.reduce"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,764,2,766,4,767,6,771,7,772,8,773,9,774,10,775,11,776,12,777,13,773,14,778,15,779,16,780,17,781,18,771,19,770],"localNames":["this","callback","initial"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":28,"name":"Array$prototype$reduceRight","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,65813,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,258,1350,67],"consts":["reduceItems","$Receiver","Array","Array.prototype.reduceRight","Array.reduceRight"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,782,2,784,4,785,6,789,7,790,8,791,9,792,10,793,11,794,12,795,13,791,14,796,15,797,16,798,17,799,18,789,19,788],"localNames":["this","callback","initial"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":29,"name":"Uint8Array$prototype$reduceRight","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,65813,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,258,1350,67],"consts":["reduceItems","$Receiver","Uint8Array","Uint8Array.prototype.reduceRight","Uint8Array.reduceRight"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,800,2,802,4,803,6,807,7,808,8,809,9,810,10,811,11,812,12,813,13,809,14,814,15,815,16,816,17,817,18,807,19,806],"localNames":["this","callback","initial"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":30,"name":"reduceItems","flags":72,"length":5,"params":5,"locals":9,"maxStack":6,"code":[0,20,65546,196618,582,5,10,65561,327947,262154,917565,65539,53,983099,65539,393483,262154,1441853,327690,65539,44,1507387,3,459019,0,524555,131082,65561,3,48,2359357,131082,3,26,524299,5111867,458762,3,49,2818367,458762,327690,46,3146047,458762,10,33,54,3539005,458762,393226,43,458763,2359356,458762,3,46,3997759,458762,327690,49,4587581,0,131092,196612,196618,262148,43,582,5,10,458762,26,524299,458762,393226,43,458763,458762,3,49,5570879,458762,327690,46,6881341,458762,10,33,6553661,0,65546,524298,10,458762,26,458762,10,1094,524299,458762,393226,43,458763,5111868,524298,67],"consts":["$Callback","length","$Throw","TypeError"," of an empty array with no initial value."],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,827,1,828,2,829,3,830,4,827,6,835,7,834,8,832,9,841,10,840,11,843,12,842,13,840,14,844,15,838,16,849,17,848,18,851,19,852,20,850,21,848,22,853,23,846,24,855,26,860,27,859,28,862,29,858,30,857,31,867,32,868,33,866,34,865,35,857,36,874,37,875,38,873,39,872,40,877,41,878,42,876,43,871,44,881,45,882,46,880,47,879,48,870,49,885,50,886,51,884,52,885,53,870,54,890,55,891,56,889,57,888,58,893,59,894,60,892,61,887,62,896,63,897,64,898,65,900,66,901,67,899,68,896,70,906,71,907,72,905,73,904,74,910,75,911,76,909,77,910,78,915,79,916,80,914,81,913,82,918,83,919,84,917,85,912,86,923,87,924,88,922,89,921,90,931,91,930,92,932,93,934,94,935,95,933,96,936,97,937,98,928,99,927,100,940,101,941,102,939,103,940,104,912,105,943,106,942],"localNames":["array","callback","initial","label","right","length","step","index","accumulator"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":31,"name":"Array$prototype$flatMap","flags":592,"length":1,"params":2,"locals":10,"maxStack":5,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,10,65540,131076,838,196875,0,196628,65546,262148,582,5,196618,327705,262411,36,327947,3,393483,3,459019,0,524555,0,590091,458762,262154,46,6684733,458762,196618,33,6422589,131082,65546,196618,458762,26,458762,196618,838,524299,0,393236,524298,326,5636157,3,589835,589834,524298,327705,46,5570621,589834,524298,33,5308477,327690,393226,55,7,56,393227,31,32,543,524298,589834,26,28,5,589834,56,589835,3801148,6422587,327690,393226,55,7,56,393227,31,32,543,524298,28,5,458762,56,458763,2228284,327690,67],"consts":["$Receiver","Array","Array.prototype.flatMap","$Callback","Array.flatMap","length","$IsArray"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,944,2,946,4,947,6,949,7,947,8,954,9,955,10,956,11,957,12,958,13,954,14,952,15,960,16,961,17,962,18,963,19,960,21,968,22,967,23,965,24,973,25,971,26,977,27,975,28,981,29,979,30,983,32,986,34,990,35,991,36,989,37,988,38,995,39,996,40,994,41,993,42,1004,43,1003,44,1006,45,1007,46,1005,47,1008,48,1009,49,1001,50,1000,51,1011,52,1012,53,1013,54,1011,55,1010,56,1018,57,1017,58,1021,59,1023,60,1022,61,1020,62,1019,63,1028,64,1029,65,1027,66,1026,67,1033,68,1035,70,1034,72,1035,73,1032,74,1034,75,1032,76,1037,77,1038,78,1036,79,1032,80,1031,81,1041,82,1040,83,1041,84,1019,85,1010,86,1045,87,1047,89,1046,91,1047,92,1044,93,1046,94,1044,95,1048,96,1044,97,1043,98,1051,99,1050,100,1051,101,988,102,1053,103,1052],"localNames":["this","callback","thisArg","array","length","result","count","index","inner","at"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":32,"name":"sortWith","flags":72,"length":7,"params":7,"locals":15,"maxStack":11,"code":[36,459019,3,524555,0,590091,0,655627,0,721163,0,786699,0,852235,0,917771,524298,393226,25,46,7602237,393226,524298,26,720907,393226,524298,65539,43,26,589835,393226,524298,131075,43,26,655371,589834,786443,3,851979,720906,589834,46,3146047,786442,655370,46,6357053,0,196618,262154,720906,26,262154,786442,26,582,309,917515,917514,3,47,4390975,917514,917514,51,5308477,0,65556,458762,851978,262154,720906,26,838,5,720906,56,720907,6094907,0,65556,458762,851978,262154,786442,26,838,5,786442,56,786443,851978,56,851979,2687036,0,131092,262154,458762,851978,720906,589834,786442,655370,393226,524298,26,2118,5,524298,196611,43,524299,1048636,0,196628,10,65546,131082,262154,327690,1350,67],"consts":["length","$ArraySet","$MergeRest","$Sorted"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1067,1,1065,2,1071,3,1069,4,1073,6,1076,8,1079,10,1082,12,1085,14,1088,16,1092,17,1094,18,1093,19,1091,20,1090,21,1101,22,1102,23,1100,24,1099,25,1107,26,1109,27,1110,28,1108,29,1106,30,1105,31,1115,32,1117,33,1118,34,1116,35,1114,36,1113,37,1122,38,1121,39,1126,40,1125,41,1130,42,1131,43,1129,44,1128,45,1133,46,1134,47,1132,48,1127,49,1143,50,1142,51,1145,52,1146,53,1144,54,1148,55,1149,56,1147,57,1140,58,1139,59,1138,60,1153,61,1154,62,1152,63,1151,64,1156,65,1157,66,1155,67,1150,68,1160,69,1161,70,1162,71,1163,72,1165,73,1166,74,1164,75,1160,77,1169,78,1168,79,1169,80,1150,81,1172,82,1173,83,1174,84,1175,85,1177,86,1178,87,1176,88,1172,90,1181,91,1180,92,1181,93,1184,94,1183,95,1184,96,1127,97,1186,98,1187,99,1188,100,1189,101,1190,102,1191,103,1192,104,1193,105,1194,106,1196,107,1197,108,1195,109,1186,111,1200,112,1201,113,1199,114,1200,115,1090,116,1203,117,1204,118,1205,119,1206,120,1207,121,1208,122,1209,123,1203,124,1202],"localNames":["target","into","holes","comparator","work","undefs","merges","merged","merge","middle","high","left","right","count","order"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":33,"name":"sortDefault","flags":72,"length":6,"params":6,"locals":7,"maxStack":9,"code":[0,20,327690,326,393483,0,65556,393226,326,720957,327740,0,131092,10,65546,131082,0,196628,393226,196618,582,262154,1350,67],"consts":["$SortState","$SortStep","$Sorted","$SortResult"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1222,1,1223,2,1224,3,1222,4,1220,5,1226,6,1227,7,1228,8,1226,9,1225,11,1231,12,1232,13,1233,14,1234,15,1235,16,1236,17,1237,18,1238,19,1239,20,1236,21,1240,22,1231,23,1230],"localNames":["target","into","holes","values","undefs","keys","state"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":34,"name":"Array$prototype$toLocaleString","flags":88,"length":0,"params":0,"locals":5,"maxStack":5,"code":[789,267,0,20,10,65540,131076,838,65803,196612,131339,3,196875,0,262411,196618,65546,262169,46,3473469,196618,3,48,1835069,131082,327684,43,131083,65546,196618,26,262155,262154,1,51,2556223,262154,0,51,3211325,131082,0,393236,262154,459033,70,326,43,131083,196618,56,196619,983100,131082,67],"consts":["$Receiver","Array","Array.prototype.toLocaleString","","length",",","String","toLocaleString"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1241,2,1247,3,1248,4,1249,5,1250,6,1251,7,1247,8,1245,9,1255,10,1253,11,1259,12,1257,13,1261,15,1265,16,1267,17,1266,18,1264,19,1263,20,1272,21,1273,22,1271,23,1270,24,1276,25,1277,26,1275,27,1276,28,1282,29,1283,30,1281,31,1280,32,1287,33,1288,34,1286,35,1285,36,1290,37,1291,38,1289,39,1284,40,1294,41,1295,42,1296,43,1299,44,1298,45,1297,46,1295,47,1293,48,1294,49,1303,50,1302,51,1303,52,1263,53,1305,54,1304],"localNames":["this","array","result","index","item"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":35,"name":"fillCollection","flags":72,"length":3,"params":3,"locals":7,"maxStack":7,"code":[131082,4,50,458815,131082,65540,50,196875,262156,65546,3801162,3801147,327947,4719948,3997755,262156,262411,196618,54,1835069,0,131092,196612,10,262154,838,5,3735611,0,262164,262154,326,54,2949181,0,327700,393220,458756,131082,43,524292,43,582,5,3735611,0,131092,196612,10,262154,3,26,262154,65539,26,1094,5,852028,70,75,786491,70,4719949,983099,393483,4457806,70,5,393226,64,5,4456507,10,67],"consts":["Map","WeakMap","$Table","add","$IsObject","$Throw","TypeError","new ","(...) expects [key, value] pairs as entry objects."],"captures":[],"handlers":[15,58,64,0,65,68,70,0],"finallies":[],"finallyOffsets":[],"sites":[0,1317,1,1318,2,1316,3,1315,4,1320,5,1321,6,1319,7,1313,9,1326,10,1322,16,1323,17,1330,18,1329,19,1328,20,1332,21,1333,22,1334,23,1335,24,1336,25,1332,27,1328,28,1339,29,1340,30,1341,31,1339,32,1338,33,1337,34,1343,35,1344,36,1345,37,1348,38,1349,39,1347,40,1350,41,1346,42,1343,44,1337,45,1352,46,1353,47,1354,48,1355,49,1357,50,1358,51,1356,52,1360,53,1361,54,1359,55,1352,57,1322,72,1363,73,1362],"localNames":["target","items","kind","pairs","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":36,"name":"Map$groupBy","flags":72,"length":2,"params":2,"locals":2,"maxStack":5,"code":[0,20,10,65546,65540,838,67],"consts":["groupBy","Map"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1370,1,1371,2,1372,3,1373,4,1374,5,1370,6,1369],"localNames":["items","callback"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":37,"name":"Object$groupBy","flags":72,"length":2,"params":2,"locals":2,"maxStack":5,"code":[0,20,10,65546,65540,838,67],"consts":["groupBy","Object"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1381,1,1382,2,1383,3,1384,4,1385,5,1381,6,1380],"localNames":["items","callback"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":38,"name":"groupBy","flags":72,"length":3,"params":3,"locals":9,"maxStack":6,"code":[10,1,50,458815,10,0,50,1048637,0,20,65540,131082,131076,43,582,5,0,196628,65546,131082,262148,43,582,5,0,327700,393220,131082,582,196875,3,262411,0,327947,393228,10,4915274,4915259,459019,5834572,5111867,393228,393483,0,65546,393226,262154,55,7,56,262155,582,327691,131082,458756,50,4325437,0,524308,0,327700,589828,327690,582,326,327691,0,327700,655364,196618,327690,393226,1094,5,2555964,70,75,2490427,70,5834573,2687035,524555,5572430,70,5,524298,64,5,5570619,196618,67],"consts":["$Throw","TypeError",".groupBy expects an iterable collection.","$Callback",".groupBy","$Table","groups","Object","String","groupKey","group"],"captures":[],"handlers":[41,75,81,0,82,85,87,0],"finallies":[],"finallyOffsets":[],"sites":[0,1395,1,1396,2,1394,3,1393,4,1398,5,1399,6,1397,7,1392,8,1401,9,1402,10,1403,11,1405,12,1406,13,1404,14,1401,16,1408,17,1409,18,1410,19,1412,20,1413,21,1411,22,1408,24,1417,25,1418,26,1419,27,1420,28,1417,29,1415,30,1424,31,1422,32,1426,35,1432,36,1428,42,1429,43,1437,44,1438,45,1439,46,1441,48,1440,50,1441,51,1437,52,1436,53,1444,54,1445,55,1443,56,1442,57,1449,58,1450,59,1451,60,1452,61,1453,62,1454,63,1451,64,1449,65,1448,66,1456,67,1457,68,1458,69,1459,70,1460,71,1461,72,1456,74,1428,89,1463,90,1462],"localNames":["items","callback","kind","groups","index","key","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":39,"name":"insertComputed","flags":72,"length":3,"params":3,"locals":4,"maxStack":6,"code":[0,131082,65546,326,196875,0,20,65540,10,65546,196618,1094,5,196618,67],"consts":["$Table","add"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1473,1,1474,2,1475,3,1473,4,1471,5,1477,6,1478,7,1479,8,1480,9,1481,10,1482,11,1477,13,1484,14,1483],"localNames":["target","key","callback","value"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":40,"name":"Map$prototype$forEach","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,1094,5,0,67],"consts":["collectionForEach","$Receiver","Map","Map.prototype.forEach","Map.forEach"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1485,2,1487,4,1488,6,1490,7,1488,8,1493,9,1494,10,1495,11,1496,12,1497,13,1498,14,1499,15,1495,16,1500,17,1501,18,1502,19,1493,21,1491],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":41,"name":"Set$prototype$forEach","flags":592,"length":1,"params":2,"locals":3,"maxStack":7,"code":[789,267,1045,65803,66581,459583,0,131339,0,20,0,65556,10,131076,196612,838,65546,131082,262148,1094,5,0,67],"consts":["collectionForEach","$Receiver","Set","Set.prototype.forEach","Set.forEach"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1503,2,1505,4,1506,6,1508,7,1506,8,1511,9,1512,10,1513,11,1514,12,1515,13,1516,14,1517,15,1513,16,1518,17,1519,18,1520,19,1511,21,1509],"localNames":["this","callback","thisArg"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":42,"name":"collectionForEach","flags":72,"length":4,"params":4,"locals":7,"maxStack":5,"code":[0,20,65546,196618,582,5,262156,0,65556,131076,10,582,2031690,2031675,327947,2950476,2228283,262156,262411,131082,65546,262154,65539,26,262154,3,26,10,838,5,983100,70,75,917563,70,2950477,1114171,393483,2688334,70,5,393226,64,5,2687035,0,67],"consts":["$Callback","$Table","entries"],"captures":[],"handlers":[17,31,37,0,38,41,43,0],"finallies":[],"finallyOffsets":[],"sites":[0,1529,1,1530,2,1531,3,1532,4,1529,7,1537,8,1538,9,1539,10,1540,11,1537,12,1533,18,1534,19,1545,20,1544,21,1547,22,1548,23,1546,24,1550,25,1551,26,1549,27,1552,28,1542,30,1533,45,1527],"localNames":["target","callback","thisArg","label","entry","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":43,"name":"Set$prototype$union","flags":88,"length":1,"params":1,"locals":2,"maxStack":7,"code":[789,65803,0,20,0,65556,65546,131076,196612,838,10,262148,838,67],"consts":["setMethod","$Receiver","Set","Set.prototype.union","union"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1553,2,1558,3,1559,4,1560,5,1561,6,1562,7,1563,8,1564,9,1560,10,1565,11,1566,12,1558,13,1557],"localNames":["other","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":44,"name":"Set$prototype$intersection","flags":88,"length":1,"params":1,"locals":2,"maxStack":7,"code":[789,65803,0,20,0,65556,65546,131076,196612,838,10,262148,838,67],"consts":["setMethod","$Receiver","Set","Set.prototype.intersection","intersection"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1567,2,1572,3,1573,4,1574,5,1575,6,1576,7,1577,8,1578,9,1574,10,1579,11,1580,12,1572,13,1571],"localNames":["other","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":45,"name":"Set$prototype$difference","flags":88,"length":1,"params":1,"locals":2,"maxStack":7,"code":[789,65803,0,20,0,65556,65546,131076,196612,838,10,262148,838,67],"consts":["setMethod","$Receiver","Set","Set.prototype.difference","difference"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1581,2,1586,3,1587,4,1588,5,1589,6,1590,7,1591,8,1592,9,1588,10,1593,11,1594,12,1586,13,1585],"localNames":["other","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":46,"name":"Set$prototype$symmetricDifference","flags":88,"length":1,"params":1,"locals":2,"maxStack":7,"code":[789,65803,0,20,0,65556,65546,131076,196612,838,10,262148,838,67],"consts":["setMethod","$Receiver","Set","Set.prototype.symmetricDifference","symmetricDifference"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1595,2,1600,3,1601,4,1602,5,1603,6,1604,7,1605,8,1606,9,1602,10,1607,11,1608,12,1600,13,1599],"localNames":["other","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":47,"name":"Set$prototype$isSubsetOf","flags":88,"length":1,"params":1,"locals":2,"maxStack":7,"code":[789,65803,0,20,0,65556,65546,131076,196612,838,10,262148,838,67],"consts":["setMethod","$Receiver","Set","Set.prototype.isSubsetOf","isSubsetOf"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1609,2,1614,3,1615,4,1616,5,1617,6,1618,7,1619,8,1620,9,1616,10,1621,11,1622,12,1614,13,1613],"localNames":["other","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":48,"name":"Set$prototype$isSupersetOf","flags":88,"length":1,"params":1,"locals":2,"maxStack":7,"code":[789,65803,0,20,0,65556,65546,131076,196612,838,10,262148,838,67],"consts":["setMethod","$Receiver","Set","Set.prototype.isSupersetOf","isSupersetOf"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1623,2,1628,3,1629,4,1630,5,1631,6,1632,7,1633,8,1634,9,1630,10,1635,11,1636,12,1628,13,1627],"localNames":["other","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":49,"name":"Set$prototype$isDisjointFrom","flags":88,"length":1,"params":1,"locals":2,"maxStack":7,"code":[789,65803,0,20,0,65556,65546,131076,196612,838,10,262148,838,67],"consts":["setMethod","$Receiver","Set","Set.prototype.isDisjointFrom","isDisjointFrom"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1637,2,1642,3,1643,4,1644,5,1645,6,1646,7,1647,8,1648,9,1644,10,1649,11,1650,12,1642,13,1641],"localNames":["other","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":50,"name":"setMethod","flags":72,"length":3,"params":3,"locals":18,"maxStack":5,"code":[0,20,65546,326,54,1048637,0,65556,131076,196612,131082,43,262148,43,582,5,65546,327705,309,196875,196618,196618,51,2228285,0,65556,131076,196612,131082,43,393220,43,582,5,196618,3,46,3145789,0,65556,458756,196612,131082,43,524292,43,582,5,65546,589849,262411,65546,655385,327947,0,720916,262154,326,54,4259903,0,720916,327690,326,54,4980797,0,65556,131076,196612,131082,43,786436,43,582,5,0,851988,327684,10,582,393483,131082,917508,50,5833023,393226,196618,48,6029373,2,67,131082,983044,50,6488383,393226,196618,46,6684733,2,67,131082,1048580,50,7143485,1114132,72,8388667,131082,1179652,50,7602239,131082,1245188,50,7864383,131082,1310724,50,8323133,0,851988,1376260,10,582,8388667,0,459019,131082,917508,50,9699391,131082,1048580,50,9175103,131082,1245188,50,9437247,131082,1441796,50,9699647,393226,196618,47,524555,0,590091,524298,15990845,720908,0,851988,1507332,131082,1245188,50,10682429,458762,10747963,10,582,14549066,14549051,852235,15469900,14745659,720908,721163,65546,262154,720906,326,54,54,589835,131082,1048580,50,12648509,589834,12582973,0,851988,1572868,458762,720906,838,5,14483515,131082,1245188,50,13566013,589834,13500477,0,851988,1638404,458762,720906,838,5,14483515,589834,131082,1441796,50,50,14483517,2,983307,14355790,70,1611,5,983050,67,11010108,70,75,10944571,70,15469901,11141179,917771,15207758,70,5,917514,64,5,15204411,458762,0,50,15859773,258,15925307,458762,67,65546,327690,70,655627,0,20,655370,326,54,17301565,0,65556,131076,196612,131082,43,1703940,43,582,5,786444,0,1769492,655370,258,582,23134282,23134267,1048843,24055884,23330875,786444,786699,0,851988,589828,10,786442,838,589835,131082,1179652,50,19398717,0,851988,1572868,458762,786442,838,5,23068731,131082,1048580,50,20316221,589834,20250685,0,851988,1572868,458762,786442,838,5,23068731,131082,1245188,50,21102653,0,851988,1638404,458762,786442,838,5,23068731,131082,1310724,50,22151229,0,851988,589834,21758013,1638404,21823547,1572868,458762,786442,838,5,23068731,589834,131082,1441796,50,50,23068733,2,983307,22941774,70,1611,5,983050,67,17891388,70,75,17825851,70,24055885,18022459,1114379,23793742,70,5,1114122,64,5,23789627,458762,0,50,24444989,258,24510523,458762,67],"consts":["$IsObject","$Throw","TypeError","Set."," expects a Set-like object.","size"," received a Set-like object with an invalid size.","RangeError"," received a Set-like object with a negative size.","has","keys","$IsCallable"," expects callable 'has' and 'keys' methods.","$Table","isSubsetOf","isSupersetOf","intersection","Set","union","difference","symmetricDifference","copy","isDisjointFrom","values","add","delete"," expects 'keys' to return an iterator object.","$Direct"],"captures":[],"handlers":[170,222,228,0,229,232,234,0,275,353,359,0,360,363,365,0],"finallies":[],"finallyOffsets":[],"sites":[0,1659,1,1660,2,1661,3,1659,4,1658,5,1657,6,1663,7,1664,8,1665,9,1668,10,1669,11,1667,12,1670,13,1666,14,1663,16,1676,17,1675,18,1674,19,1672,20,1680,21,1681,22,1679,23,1678,24,1683,25,1684,26,1685,27,1688,28,1689,29,1687,30,1690,31,1686,32,1683,34,1693,35,1694,36,1692,37,1691,38,1696,39,1697,40,1698,41,1701,42,1702,43,1700,44,1703,45,1699,46,1696,48,1708,49,1707,50,1705,51,1714,52,1713,53,1711,54,1719,55,1720,56,1721,57,1719,58,1718,59,1717,60,1723,61,1724,62,1725,63,1723,64,1722,65,1716,66,1727,67,1728,68,1729,69,1732,70,1733,71,1731,72,1734,73,1730,74,1727,76,1738,77,1739,78,1740,79,1741,80,1738,81,1736,82,1745,83,1746,84,1744,85,1743,86,1748,87,1749,88,1747,89,1742,90,1751,91,1750,92,1755,93,1756,94,1754,95,1753,96,1758,97,1759,98,1757,99,1752,100,1761,101,1760,102,1767,103,1768,104,1766,105,1765,106,1770,107,1769,108,1765,109,1775,110,1776,111,1774,112,1773,113,1778,114,1779,115,1777,116,1772,117,1781,118,1782,119,1780,120,1771,121,1783,122,1784,123,1785,124,1786,125,1783,126,1771,127,1787,128,1763,129,1793,130,1794,131,1792,132,1791,133,1799,134,1800,135,1798,136,1797,137,1802,138,1803,139,1801,140,1796,141,1805,142,1806,143,1804,144,1795,145,1808,146,1809,147,1807,148,1789,149,1811,151,1814,152,1813,154,1820,155,1821,156,1822,157,1825,158,1826,159,1824,160,1823,161,1827,162,1823,163,1828,164,1820,165,1816,171,1817,172,1838,173,1837,174,1839,175,1835,176,1834,177,1833,178,1832,179,1842,180,1843,181,1841,182,1840,183,1846,184,1845,185,1848,186,1849,187,1850,188,1851,189,1852,190,1848,192,1840,193,1855,194,1856,195,1854,196,1853,197,1859,198,1858,199,1861,200,1862,201,1863,202,1864,203,1865,204,1861,206,1853,207,1868,208,1870,209,1871,210,1869,211,1867,212,1866,213,1873,214,1872,221,1816,236,1877,237,1878,238,1876,239,1875,240,1879,241,1875,242,1880,243,1874,244,1887,245,1886,246,1884,247,1882,248,1890,249,1891,250,1892,251,1890,252,1889,253,1888,254,1894,255,1895,256,1896,257,1899,258,1900,259,1898,260,1901,261,1897,262,1894,265,1906,266,1907,267,1908,268,1909,269,1906,270,1902,276,1903,277,1914,278,1915,279,1916,280,1917,281,1918,282,1914,283,1913,284,1921,285,1922,286,1920,287,1919,288,1924,289,1925,290,1926,291,1927,292,1928,293,1924,295,1919,296,1931,297,1932,298,1930,299,1929,300,1935,301,1934,302,1937,303,1938,304,1939,305,1940,306,1941,307,1937,309,1929,310,1944,311,1945,312,1943,313,1942,314,1947,315,1948,316,1949,317,1950,318,1951,319,1947,321,1942,322,1954,323,1955,324,1953,325,1952,326,1957,327,1958,328,1960,329,1959,330,1961,331,1959,332,1962,333,1963,334,1964,335,1957,337,1952,338,1967,339,1969,340,1970,341,1968,342,1966,343,1965,344,1972,345,1971,352,1902,367,1976,368,1977,369,1975,370,1974,371,1978,372,1974,373,1979,374,1973],"localNames":["target","other","name","size","has","keys","own","result","asks","found","iterator","item","item","%it","%e","%ret","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":51,"name":"Object$fromEntries","flags":72,"length":1,"params":1,"locals":5,"maxStack":7,"code":[35,65803,131084,10,2621514,2621499,196875,3539788,2818107,131084,131339,0,20,131082,258,582,54,1572925,0,65556,131076,196612,582,5,0,262164,65546,0,327700,131082,3,26,326,131082,65539,26,258,1094,5,458812,70,75,393275,70,3539789,589883,262411,3277646,70,5,262154,64,5,3276859,65546,67],"consts":["$IsObject","$Throw","TypeError","Object.fromEntries expects [key, value] entry objects.","$Define","String"],"captures":[],"handlers":[9,40,46,0,47,50,52,0],"finallies":[],"finallyOffsets":[],"sites":[0,1987,1,1985,3,1992,4,1988,10,1989,11,1996,12,1997,13,1998,14,1999,15,1996,16,1995,17,1994,18,2001,19,2002,20,2003,21,2004,22,2001,24,2006,25,2007,26,2008,27,2009,28,2010,29,2012,30,2013,31,2011,32,2009,33,2015,34,2016,35,2014,36,2017,37,2006,39,1988,54,2019,55,2018],"localNames":["entries","result","entry","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":52,"name":"Math$sumPrecise","flags":72,"length":1,"params":1,"locals":5,"maxStack":5,"code":[36,65803,131084,10,2031690,2031675,196875,2949964,2228283,131084,131339,131082,821,4,51,1441853,0,65556,131076,196612,582,5,0,262164,65546,65546,327705,131082,838,5,458812,70,75,393275,70,2949965,589883,262411,2687822,70,5,262154,64,5,2687035,0,393236,65546,326,67],"consts":["number","$Throw","TypeError","Math.sumPrecise expects an iterable of numbers.","$ArraySet","length","$SumPrecise"],"captures":[],"handlers":[9,31,37,0,38,41,43,0],"finallies":[],"finallyOffsets":[],"sites":[0,2027,1,2025,3,2032,4,2028,10,2029,11,2037,12,2036,13,2038,14,2035,15,2034,16,2040,17,2041,18,2042,19,2043,20,2040,22,2045,23,2046,24,2047,25,2049,26,2048,27,2051,28,2045,30,2028,45,2053,46,2054,47,2055,48,2053,49,2052],"localNames":["items","numbers","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":53,"name":"aggregateError","flags":72,"length":2,"params":2,"locals":6,"maxStack":6,"code":[36,131339,196620,65546,1310794,1310779,262411,2229324,1507387,196620,196875,0,20,131082,131082,65561,196618,838,5,458812,70,75,393275,70,2229325,589883,327947,1967182,70,5,327690,64,5,1966139,0,131092,10,196612,131082,2,1094,67],"consts":["$ArraySet","length","$Define","errors"],"captures":[],"handlers":[9,20,26,0,27,30,32,0],"finallies":[],"finallyOffsets":[],"sites":[0,2064,1,2062,3,2069,4,2065,10,2066,11,2071,12,2072,13,2073,14,2075,15,2074,16,2077,17,2071,19,2065,34,2079,35,2080,36,2081,37,2082,38,2083,39,2084,40,2079,41,2078],"localNames":["error","errors","list","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":54,"name":"collectBytes","flags":72,"length":6,"params":6,"locals":11,"maxStack":7,"code":[0,20,10,326,54,1376317,0,65556,131076,65546,196612,43,0,262164,10,326,43,327684,43,582,5,36,393483,524300,10,2687050,2687035,590091,3606860,2883643,524300,524555,0,393236,393226,393226,458777,524298,838,5,1835068,70,75,1769531,70,3606861,1966139,655627,3344718,70,5,655370,64,5,3342395,3,459019,131082,0,51,5505085,458762,393226,458777,46,5505085,393226,458762,31,32,543,196618,131082,393226,458762,26,458762,582,28,5,458762,56,458763,3997756,0,524308,393226,262154,327690,838,67],"consts":["$IsIterable","$Throw","TypeError"," expects a Uint8Array, an array, or an iterable of numbers, received ","$Describe",".","$ArraySet","length","$Bytes"],"captures":[],"handlers":[30,41,47,0,48,51,53,0],"finallies":[],"finallyOffsets":[],"sites":[0,2096,1,2097,2,2098,3,2096,4,2095,5,2094,6,2100,7,2101,8,2102,9,2106,10,2107,11,2105,12,2108,13,2109,14,2110,15,2108,16,2104,17,2111,18,2103,19,2100,21,2115,22,2113,24,2120,25,2116,31,2117,32,2122,33,2123,34,2124,35,2126,36,2125,37,2128,38,2122,40,2116,55,2132,56,2130,57,2135,58,2136,59,2134,60,2133,61,2140,62,2142,63,2141,64,2139,65,2138,66,2148,67,2149,68,2147,69,2149,70,2147,71,2153,72,2152,73,2155,74,2156,75,2154,76,2157,77,2150,78,2147,79,2146,80,2160,81,2159,82,2160,83,2138,84,2162,85,2163,86,2164,87,2165,88,2166,89,2162,90,2161],"localNames":["source","name","mapper","thisArg","into","offset","values","index","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":55,"name":"argumentsValues","flags":92,"length":0,"params":0,"locals":2,"maxStack":2,"code":[789,267,81,3,65803,65546,10,25,46,1376317,10,65546,26,82,1048659,67,5,65546,56,65547,327740,0,67],"consts":["length"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2167,3,2173,4,2171,5,2176,6,2178,7,2177,8,2175,9,2174,10,2184,11,2185,12,2183,13,2182,17,2188,18,2187,19,2188,20,2174,21,2169],"localNames":["this","index"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":56,"name":"objectEntries","flags":72,"length":2,"params":2,"locals":6,"maxStack":7,"code":[0,20,10,258,0,838,131339,36,196875,3,262411,262154,131082,65561,46,3211325,327692,131082,262154,26,327947,0,131092,10,327690,582,2949181,0,196628,196618,196618,65561,65546,2490429,10,327690,26,2818107,327690,10,327690,26,131108,838,5,262154,56,262155,720956,196618,67],"consts":["$OwnKeys","length","$IsEnumerableOwn","$ArraySet"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2197,1,2198,2,2199,3,2200,4,2201,5,2197,6,2195,7,2205,8,2203,9,2209,10,2207,11,2212,12,2214,13,2213,14,2211,15,2210,17,2221,18,2222,19,2220,20,2218,21,2224,22,2225,23,2226,24,2227,25,2224,26,2223,27,2229,28,2230,29,2231,30,2233,31,2232,32,2236,33,2235,34,2238,35,2239,36,2237,37,2235,38,2241,39,2243,40,2244,41,2242,42,2240,43,2229,45,2247,46,2246,47,2247,48,2210,49,2249,50,2248],"localNames":["source","values","keys","result","index","key"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":57,"name":"objectAssign","flags":72,"length":2,"params":2,"locals":7,"maxStack":5,"code":[3,131339,131082,65546,25,46,3735613,196620,262156,327692,65546,131082,26,196875,0,65556,196618,2,0,838,262411,3,327947,327690,262154,25,46,3473469,393228,262154,327690,26,393483,0,131092,196618,393226,582,3211325,10,393226,31,32,543,196618,393226,26,28,5,327690,56,327691,1507388,131082,56,131083,131132,10,67],"consts":["length","$OwnKeys","$IsEnumerableOwn"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2258,1,2256,2,2261,3,2263,4,2262,5,2260,6,2259,10,2270,11,2271,12,2269,13,2267,14,2275,15,2276,16,2277,17,2278,18,2279,19,2275,20,2273,21,2283,22,2281,23,2286,24,2288,25,2287,26,2285,27,2284,29,2295,30,2296,31,2294,32,2292,33,2298,34,2299,35,2300,36,2301,37,2298,38,2297,39,2305,40,2306,41,2304,42,2306,43,2304,44,2308,45,2309,46,2307,47,2304,48,2303,49,2312,50,2311,51,2312,52,2284,53,2315,54,2314,55,2315,56,2259,57,2317,58,2316],"localNames":["target","sources","at","source","keys","index","key"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":58,"name":"readPairs","flags":72,"length":4,"params":4,"locals":12,"maxStack":7,"code":[0,20,10,326,54,917565,0,65556,131082,196618,10,65546,1094,67,36,262411,0,327947,393228,10,5701706,5701691,524555,6621260,5898299,393228,393483,0,20,393226,326,54,2687037,0,131092,196612,65546,262148,43,582,5,36,327691,458764,393226,4194378,4194363,655627,5114444,4390971,458764,459019,0,327700,327690,327690,393241,0,458772,458762,326,838,5,3145788,70,75,3080251,70,5114445,3276859,721163,4852302,70,5,720906,64,5,4849723,0,327700,262154,262154,393241,327690,838,5,1507388,70,75,1441851,70,6621261,1638459,590091,6359118,70,5,589834,64,5,6357051,0,65556,131082,196618,262154,65546,1094,67],"consts":["$IsIterable","$Pairs","$Throw","TypeError"," expects iterable [name, value] pairs.","$ArraySet","length","String"],"captures":[],"handlers":[50,64,70,0,71,74,76,0,25,87,93,0,94,97,99,0],"finallies":[],"finallyOffsets":[],"sites":[0,2327,1,2328,2,2329,3,2327,4,2326,5,2325,6,2331,7,2332,8,2333,9,2334,10,2335,11,2336,12,2331,13,2330,14,2340,15,2338,16,2342,19,2348,20,2344,26,2345,27,2352,28,2353,29,2354,30,2352,31,2351,32,2350,33,2356,34,2357,35,2358,36,2360,37,2361,38,2359,39,2356,41,2365,42,2364,44,2370,45,2366,51,2367,52,2372,53,2373,54,2374,55,2376,56,2375,57,2378,58,2379,59,2380,60,2378,61,2372,63,2366,78,2382,79,2383,80,2384,81,2386,82,2385,83,2388,84,2382,86,2344,101,2390,102,2391,103,2392,104,2393,105,2394,106,2395,107,2390,108,2389],"localNames":["init","label","kind","proto","pairs","strings","pair","item","%it","%e","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":59,"name":"pairsForEach","flags":72,"length":4,"params":4,"locals":5,"maxStack":5,"code":[3,262411,262154,65546,25,46,1703997,196618,131082,65546,262154,26,65539,26,65546,262154,26,3,26,10,838,5,262154,56,262155,131132,0,67],"consts":["length"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2406,1,2404,2,2409,3,2411,4,2410,5,2408,6,2407,7,2418,8,2417,9,2421,10,2422,11,2420,12,2423,13,2419,14,2426,15,2427,16,2425,17,2428,18,2424,19,2429,20,2415,22,2432,23,2431,24,2432,25,2407,26,2402],"localNames":["target","pairs","callback","thisArg","index"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":60,"name":"Iterator$from","flags":72,"length":1,"params":1,"locals":1,"maxStack":10,"code":[0,20,10,326,721215,0,65556,10,131092,196633,582,917565,10,67,0,262164,0,327700,10,0,393236,10,258,458756,838,582,326,67],"consts":["$IsObject","$Inherits","Iterator","prototype","prime","wrapHelper","flattenable","Iterator.from"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2439,1,2440,2,2441,3,2439,4,2438,5,2442,6,2443,7,2444,8,2446,9,2445,10,2442,11,2437,12,2449,13,2448,14,2451,15,2452,16,2453,17,2454,18,2455,19,2456,20,2457,21,2458,22,2459,23,2460,24,2456,25,2453,26,2451,27,2450],"localNames":["value"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":61,"name":"wrapHelper","flags":76,"length":2,"params":2,"locals":9,"maxStack":3,"code":[81,2,131339,0,82,786515,393483,393226,327947,131075,262411,3866683,5,258,131083,196620,65546,2555978,2555963,459019,3475276,2752571,196620,196875,196618,82,2424915,393483,2099022,70,1611,5,393226,327947,131075,262411,3866683,5,1310780,70,75,1245243,70,3475277,1441851,524555,3213134,70,5,524298,64,5,3211323,3,262411,3866683,327947,65539,262411,131082,54,4390973,0,20,10,326,5,66,327690,67,0,67],"consts":["closeIterator"],"captures":[],"handlers":[22,39,45,0,46,49,51,0,3,53,56,0],"finallies":[4,5,0,3,70,-1,68],"finallyOffsets":[0],"sites":[0,2461,1,2469,2,2467,3,2473,13,2477,14,2476,16,2482,17,2478,23,2479,24,2485,25,2484,38,2478,53,2470,59,2489,60,2488,61,2487,62,2491,63,2492,64,2493,65,2491,67,2470,70,2465],"localNames":["source","iterator","started","item","%ftag0","%fval0","%ret","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":62,"name":"Iterator$prototype$map","flags":88,"length":1,"params":1,"locals":3,"maxStack":7,"code":[789,65803,0,20,65546,2,582,131339,0,65556,10,131076,582,5,0,196628,0,262164,65546,131082,10,838,326,67],"consts":["$Direct","$Callback","Iterator.prototype.map","prime","mapHelper"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2494,2,2501,3,2502,4,2503,5,2504,6,2501,7,2499,8,2506,9,2507,10,2508,11,2509,12,2506,14,2511,15,2512,16,2513,17,2514,18,2515,19,2516,20,2517,21,2513,22,2511,23,2510],"localNames":["mapper","this","iterator"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":63,"name":"mapHelper","flags":76,"length":3,"params":3,"locals":11,"maxStack":5,"code":[81,2,196875,262156,0,82,852051,524555,524298,459019,131075,393483,4587579,5,258,196619,3,262411,327692,65546,3276874,3276859,590091,4196684,3473467,327692,327947,0,131082,327690,262154,55,7,56,262155,582,82,3145811,524555,2820430,70,1611,5,524298,459019,131075,393483,4587579,5,1507388,70,75,1441851,70,4196685,1638459,655627,3934542,70,5,655370,64,5,3932219,3,393483,4587579,459019,65539,393483,196618,54,5111869,0,20,10,326,5,66,458762,67,0,67],"consts":["closeIterator"],"captures":[],"handlers":[25,50,56,0,57,60,62,0,3,64,67,0],"finallies":[6,7,0,3,81,-1,79],"finallyOffsets":[0],"sites":[0,2518,1,2527,2,2525,4,2531,14,2535,15,2534,16,2539,17,2537,19,2544,20,2540,26,2541,27,2547,28,2548,29,2549,30,2551,32,2550,34,2551,35,2547,36,2546,49,2540,64,2528,70,2555,71,2554,72,2553,73,2557,74,2558,75,2559,76,2557,78,2528,81,2523],"localNames":["source","iterator","mapper","started","counter","item","%ftag0","%fval0","%ret","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":64,"name":"Iterator$prototype$filter","flags":88,"length":1,"params":1,"locals":3,"maxStack":7,"code":[789,65803,0,20,65546,2,582,131339,0,65556,10,131076,582,5,0,196628,0,262164,65546,131082,10,838,326,67],"consts":["$Direct","$Callback","Iterator.prototype.filter","prime","filterHelper"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2560,2,2567,3,2568,4,2569,5,2570,6,2567,7,2565,8,2572,9,2573,10,2574,11,2575,12,2572,14,2577,15,2578,16,2579,17,2580,18,2581,19,2582,20,2583,21,2579,22,2577,23,2576],"localNames":["predicate","this","iterator"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":65,"name":"filterHelper","flags":76,"length":3,"params":3,"locals":11,"maxStack":5,"code":[81,2,196875,262156,0,82,852051,524555,524298,459019,131075,393483,4718651,5,258,196619,3,262411,327692,65546,3407946,3407931,590091,4327756,3604539,327692,327947,0,131082,327690,262154,55,7,56,262155,582,3342397,327690,82,3276883,524555,2951502,70,1611,5,524298,459019,131075,393483,4718651,5,1507388,70,75,1441851,70,4327757,1638459,655627,4065614,70,5,655370,64,5,4063291,3,393483,4718651,459019,65539,393483,196618,54,5242941,0,20,10,326,5,66,458762,67,0,67],"consts":["closeIterator"],"captures":[],"handlers":[25,52,58,0,59,62,64,0,3,66,69,0],"finallies":[6,7,0,3,83,-1,81],"finallyOffsets":[0],"sites":[0,2584,1,2593,2,2591,4,2597,14,2601,15,2600,16,2605,17,2603,19,2610,20,2606,26,2607,27,2612,28,2613,29,2614,30,2616,32,2615,34,2616,35,2612,36,2611,37,2619,38,2618,51,2606,66,2594,72,2623,73,2622,74,2621,75,2625,76,2626,77,2627,78,2625,80,2594,83,2589],"localNames":["source","iterator","predicate","started","counter","item","%ftag0","%fval0","%ret","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":66,"name":"Iterator$prototype$take","flags":88,"length":1,"params":1,"locals":3,"maxStack":10,"code":[789,65803,0,20,65546,2,582,131339,0,65556,0,131092,65546,131082,0,196628,10,262148,582,838,326,67],"consts":["$Direct","prime","takeHelper","count","take"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2628,2,2635,3,2636,4,2637,5,2638,6,2635,7,2633,8,2640,9,2641,10,2642,11,2643,12,2644,13,2645,14,2646,15,2647,16,2648,17,2649,18,2646,19,2642,20,2640,21,2639],"localNames":["limit","this","iterator"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":67,"name":"takeHelper","flags":76,"length":3,"params":3,"locals":10,"maxStack":3,"code":[81,2,196875,0,82,786515,459019,458762,393483,131075,327947,5570619,5,258,196619,131082,3,50,1900605,0,20,10,326,459019,458762,393483,131075,327947,5570619,262156,65546,4259914,4259899,524555,5179468,4456507,262156,262411,131082,312,131083,262154,82,3539027,459019,3213390,70,1611,5,458762,393483,131075,327947,5570619,5,131082,3,50,4194365,4130894,70,1611,5,5177403,2228284,70,75,2162747,70,5179469,2359355,590091,4917326,70,5,589834,64,5,4915259,3,327947,5570619,393483,65539,327947,196618,54,6094909,0,20,10,326,5,66,393226,67,0,67],"consts":["closeIterator"],"captures":[],"handlers":[36,65,71,0,72,75,77,0,3,79,82,0],"finallies":[5,6,0,3,96,-1,94],"finallyOffsets":[0],"sites":[0,2650,1,2659,2,2657,3,2663,13,2667,14,2666,15,2670,16,2671,17,2669,18,2668,19,2673,20,2674,21,2675,22,2673,23,2672,30,2680,31,2676,37,2677,38,2684,39,2683,40,2684,41,2687,42,2686,55,2690,56,2691,57,2689,58,2688,59,2692,64,2676,79,2660,85,2696,86,2695,87,2694,88,2698,89,2699,90,2700,91,2698,93,2660,96,2655],"localNames":["source","iterator","remaining","started","item","%ftag0","%fval0","%ret","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":68,"name":"Iterator$prototype$drop","flags":88,"length":1,"params":1,"locals":3,"maxStack":10,"code":[789,65803,0,20,65546,2,582,131339,0,65556,0,131092,65546,131082,0,196628,10,262148,582,838,326,67],"consts":["$Direct","prime","dropHelper","count","drop"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2701,2,2708,3,2709,4,2710,5,2711,6,2708,7,2706,8,2713,9,2714,10,2715,11,2716,12,2717,13,2718,14,2719,15,2720,16,2721,17,2722,18,2719,19,2715,20,2713,21,2712],"localNames":["limit","this","iterator"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":69,"name":"dropHelper","flags":76,"length":3,"params":3,"locals":10,"maxStack":3,"code":[81,2,196875,0,82,786515,459019,458762,393483,131075,327947,4390971,5,258,196619,262156,65546,3080266,3080251,524555,3999820,3276859,262156,262411,131082,3,48,2097213,131082,312,131083,3014715,262154,82,2949203,459019,2623566,70,1611,5,458762,393483,131075,327947,4390971,5,1310780,70,75,1245243,70,3999821,1441851,590091,3737678,70,5,589834,64,5,3735611,3,327947,4390971,393483,65539,327947,196618,54,4915261,0,20,10,326,5,66,393226,67,0,67],"consts":["closeIterator"],"captures":[],"handlers":[22,47,53,0,54,57,59,0,3,61,64,0],"finallies":[5,6,0,3,78,-1,76],"finallyOffsets":[0],"sites":[0,2723,1,2732,2,2730,3,2736,13,2740,14,2739,16,2745,17,2741,23,2742,24,2749,25,2750,26,2748,27,2747,28,2753,29,2752,30,2753,31,2747,32,2756,33,2755,46,2741,61,2733,67,2760,68,2759,69,2758,70,2762,71,2763,72,2764,73,2762,75,2733,78,2728],"localNames":["source","iterator","remaining","started","item","%ftag0","%fval0","%ret","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":70,"name":"Iterator$prototype$flatMap","flags":88,"length":1,"params":1,"locals":3,"maxStack":7,"code":[789,65803,0,20,65546,2,582,131339,0,65556,10,131076,582,5,0,196628,0,262164,65546,131082,10,838,326,67],"consts":["$Direct","$Callback","Iterator.prototype.flatMap","prime","flatMapHelper"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2765,2,2772,3,2773,4,2774,5,2775,6,2772,7,2770,8,2777,9,2778,10,2779,11,2780,12,2777,14,2782,15,2783,16,2784,17,2785,18,2786,19,2787,20,2788,21,2784,22,2782,23,2781],"localNames":["mapper","this","iterator"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":71,"name":"flatMapHelper","flags":76,"length":3,"params":3,"locals":14,"maxStack":7,"code":[81,2,196875,262156,0,82,852051,590091,589834,524555,131075,459019,6750267,5,258,196619,3,262411,327692,65546,5439562,5439547,655627,6359628,5636155,327692,327947,393228,0,20,0,131082,327690,262154,55,7,56,262155,582,2,65540,838,4456522,4456507,786699,5377100,4653115,393228,393483,393226,82,4325459,590091,3738702,70,1611,5,4000334,70,1611,5,589834,524555,131075,459019,6750267,5,2949180,70,75,2883643,70,5377101,3080251,852235,5114958,70,5,851978,64,5,5111867,1507388,70,75,1441851,70,6359629,1638459,721163,6097486,70,5,720906,64,5,6094907,3,459019,6750267,524555,65539,459019,196618,54,7274557,0,131092,10,326,5,66,524298,67,0,67],"consts":["flattenable","Iterator.prototype.flatMap","closeIterator"],"captures":[],"handlers":[47,68,74,0,75,78,80,0,25,83,89,0,90,93,95,0,3,97,100,0],"finallies":[7,8,0,3,114,-1,112],"finallyOffsets":[0],"sites":[0,2789,1,2798,2,2796,4,2802,14,2806,15,2805,16,2810,17,2808,19,2815,20,2811,26,2812,28,2821,29,2822,30,2823,31,2824,32,2825,33,2827,35,2826,37,2827,38,2823,39,2828,40,2829,41,2821,42,2817,48,2818,49,2832,50,2831,67,2817,82,2811,97,2799,103,2836,104,2835,105,2834,106,2838,107,2839,108,2840,109,2838,111,2799,114,2794],"localNames":["source","iterator","mapper","started","counter","item","inner","%ftag0","%fval0","%ret","%it","%e","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":72,"name":"prime","flags":72,"length":1,"params":1,"locals":1,"maxStack":2,"code":[10,281,70,5,10,67],"consts":["next"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2848,1,2847,2,2846,4,2851,5,2850],"localNames":["helper"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":73,"name":"count","flags":72,"length":2,"params":2,"locals":4,"maxStack":5,"code":[10,309,131339,131082,20,50,720959,131082,20,53,50,917565,131082,1245243,131082,131082,65539,308,44,196875,131082,131082,51,1769535,196618,3,46,2752573,0,65556,131076,196612,65546,43,262148,43,131082,43,327684,43,582,5,196618,67],"consts":["Infinity","$Throw","RangeError","Iterator.prototype."," expects a non-negative count, received ","."],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2861,1,2860,2,2858,3,2868,4,2869,5,2867,6,2866,7,2871,8,2873,9,2872,10,2870,11,2865,12,2874,13,2865,14,2876,15,2878,16,2879,17,2877,18,2875,19,2863,20,2883,21,2884,22,2882,23,2881,24,2886,25,2887,26,2885,27,2880,28,2889,29,2890,30,2891,31,2896,32,2897,33,2895,34,2898,35,2894,36,2899,37,2893,38,2900,39,2892,40,2889,42,2902,43,2901],"localNames":["limit","name","number","integer"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":74,"name":"flattenable","flags":72,"length":3,"params":3,"locals":4,"maxStack":7,"code":[10,821,4,50,524349,65546,54,852027,0,65556,10,326,54,1900605,0,131092,196612,131082,262148,43,0,327700,10,326,43,393220,43,582,5,10,458772,524313,26,196875,0,589844,196618,0,50,2818111,196618,1,50,3014717,10,3211323,10,196618,70,2,582,67],"consts":["string","$IsObject","$Throw","TypeError"," expects an iterable or iterator, received ","$Describe",".","Symbol","iterator","$Direct"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2913,1,2912,2,2914,3,2911,4,2910,5,2916,6,2915,7,2910,8,2918,9,2919,10,2920,11,2918,12,2917,13,2909,14,2922,15,2923,16,2924,17,2928,18,2929,19,2927,20,2930,21,2931,22,2932,23,2930,24,2926,25,2933,26,2925,27,2922,29,2938,30,2940,31,2939,32,2937,33,2935,34,2943,35,2944,36,2948,37,2949,38,2947,39,2946,40,2951,41,2952,42,2950,43,2945,44,2953,45,2945,46,2957,47,2956,48,2954,49,2958,50,2943,51,2942],"localNames":["value","strings","name","method"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":75,"name":"closeIterator","flags":72,"length":1,"params":1,"locals":2,"maxStack":4,"code":[10,25,65803,65546,0,51,655679,65546,1,51,1179967,0,65556,10,65546,70,326,54,1638461,0,131092,196612,262148,582,5,0,67],"consts":["return","$IsObject","$Throw","TypeError","Iterator return() must return an object."],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,2967,1,2966,2,2964,3,2973,4,2974,5,2972,6,2971,7,2976,8,2977,9,2975,10,2970,11,2979,12,2980,13,2984,14,2983,15,2981,16,2979,17,2978,18,2969,19,2986,20,2987,21,2988,22,2989,23,2986,25,2962],"localNames":["iterator","method"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":76,"name":"Iterator$prototype$toArray","flags":88,"length":0,"params":0,"locals":5,"maxStack":5,"code":[789,267,36,65803,131084,0,20,10,2,582,1704010,1703995,196875,2622284,1900603,131084,131339,0,65556,65546,65546,131097,131082,838,5,852028,70,75,786491,70,2622285,983099,262411,2360142,70,5,262154,64,5,2359355,65546,67],"consts":["$Direct","$ArraySet","length"],"captures":[],"handlers":[15,26,32,0,33,36,38,0],"finallies":[],"finallyOffsets":[],"sites":[0,2990,2,2996,3,2994,5,3001,6,3002,7,3003,8,3004,9,3001,10,2997,16,2998,17,3006,18,3007,19,3008,20,3010,21,3009,22,3012,23,3006,25,2997,40,3014,41,3013],"localNames":["this","result","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":77,"name":"Iterator$prototype$reduce","flags":592,"length":1,"params":2,"locals":10,"maxStack":5,"code":[789,267,1045,65803,65813,131339,0,20,10,2,582,196875,0,65556,65546,131076,582,5,131082,3,26,262411,131082,196633,3,48,327947,3,393483,458764,196618,3670090,3670075,524555,4589644,3866683,458764,459019,327690,3145789,0,65546,262154,458762,393226,838,262155,3276859,458762,262155,258,327691,393226,56,393227,2228284,70,75,2162747,70,4589645,2359355,590091,4327502,70,5,589834,64,5,4325435,327690,54,5177405,0,262164,327684,393220,582,5,262154,67],"consts":["$Direct","$Callback","Iterator.prototype.reduce","length","$Throw","TypeError","Iterator.prototype.reduce of an empty iterator with no initial value."],"captures":[],"handlers":[36,56,62,0,63,66,68,0],"finallies":[],"finallyOffsets":[],"sites":[0,3015,2,3017,4,3018,6,3024,7,3025,8,3026,9,3027,10,3024,11,3022,12,3029,13,3030,14,3031,15,3032,16,3029,18,3037,19,3038,20,3036,21,3034,22,3044,23,3043,24,3046,25,3042,26,3040,27,3050,28,3048,30,3055,31,3051,37,3052,38,3058,39,3057,40,3062,41,3063,42,3064,43,3065,44,3066,45,3062,46,3061,47,3057,48,3070,49,3069,50,3074,51,3073,52,3077,53,3076,54,3077,55,3051,70,3080,71,3079,72,3078,73,3082,74,3083,75,3084,76,3085,77,3082,79,3087,80,3086],"localNames":["this","callback","initial","iterator","accumulator","started","index","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":78,"name":"Iterator$prototype$forEach","flags":88,"length":1,"params":1,"locals":2,"maxStack":5,"code":[789,65803,0,20,65546,10,65540,838,5,0,67],"consts":["iteratorTest","forEach"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,3088,2,3093,3,3094,4,3095,5,3096,6,3097,7,3093,9,3091],"localNames":["callback","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":79,"name":"Iterator$prototype$some","flags":88,"length":1,"params":1,"locals":2,"maxStack":5,"code":[789,65803,0,20,65546,10,65540,838,67],"consts":["iteratorTest","some"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,3098,2,3103,3,3104,4,3105,5,3106,6,3107,7,3103,8,3102],"localNames":["callback","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":80,"name":"Iterator$prototype$every","flags":88,"length":1,"params":1,"locals":2,"maxStack":5,"code":[789,65803,0,20,65546,10,65540,838,67],"consts":["iteratorTest","every"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,3108,2,3113,3,3114,4,3115,5,3116,6,3117,7,3113,8,3112],"localNames":["callback","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":81,"name":"Iterator$prototype$find","flags":88,"length":1,"params":1,"locals":2,"maxStack":5,"code":[789,65803,0,20,65546,10,65540,838,67],"consts":["iteratorTest","find"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,3118,2,3123,3,3124,4,3125,5,3126,6,3127,7,3123,8,3122],"localNames":["callback","this"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":82,"name":"iteratorTest","flags":72,"length":3,"params":3,"locals":10,"maxStack":5,"code":[0,20,10,2,582,196875,0,65556,65546,131076,131082,43,582,5,3,262411,0,327947,393228,196618,5308490,5308475,459019,6227788,5505083,393228,393483,0,65546,393226,262154,55,7,56,262155,582,327691,131082,196612,50,2752831,327690,3342397,258,590091,3213134,70,1611,5,589834,67,131082,262148,50,3735871,327690,54,4325437,2,590091,4196174,70,1611,5,589834,67,131082,327684,50,4653375,327690,5242941,393226,590091,5113678,70,1611,5,589834,67,1507388,70,75,1441851,70,6227789,1638459,524555,5965646,70,5,524298,64,5,5963835,131082,262148,50,6619197,258,7077947,131082,196612,50,7012413,2,7077947,0,67],"consts":["$Direct","$Callback","Iterator.prototype.","some","every","find"],"captures":[],"handlers":[25,81,87,0,88,91,93,0],"finallies":[],"finallyOffsets":[],"sites":[0,3137,1,3138,2,3139,3,3140,4,3137,5,3135,6,3142,7,3143,8,3144,9,3146,10,3147,11,3145,12,3142,14,3151,15,3149,16,3153,19,3159,20,3155,26,3156,27,3164,28,3165,29,3166,30,3168,32,3167,34,3168,35,3164,36,3163,37,3172,38,3173,39,3171,40,3170,41,3174,42,3169,43,3176,44,3175,51,3180,52,3181,53,3179,54,3178,55,3183,56,3182,57,3177,58,3185,59,3184,66,3189,67,3190,68,3188,69,3187,70,3191,71,3186,72,3193,73,3192,80,3155,95,3197,96,3198,97,3196,98,3195,99,3199,100,3195,101,3202,102,3203,103,3201,104,3200,105,3204,106,3200,107,3205,108,3194],"localNames":["self","callback","name","iterator","index","result","item","%it","%e","%ret"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":83,"name":"revive","flags":72,"length":3,"params":3,"locals":7,"maxStack":5,"code":[10,65546,26,196875,0,20,196618,326,3932221,262156,327692,393228,0,65556,196618,326,262411,3,327947,0,393483,327690,262154,131097,46,3932221,0,196628,196618,262154,327690,26,131082,838,393227,393226,0,50,3014717,196618,262154,327690,26,30,5,3670075,196618,262154,327690,26,31,32,543,393226,28,5,327690,56,327691,1376316,10,131082,65546,196618,582,67],"consts":["$IsObject","$Keys","length","revive"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,3216,1,3217,2,3215,3,3213,4,3219,5,3220,6,3221,7,3219,8,3218,12,3226,13,3227,14,3228,15,3226,16,3224,17,3232,18,3230,19,3234,21,3238,22,3240,23,3239,24,3237,25,3236,26,3246,27,3247,28,3248,29,3250,30,3251,31,3249,32,3252,33,3246,34,3245,35,3255,36,3256,37,3254,38,3253,39,3260,40,3262,41,3263,42,3261,43,3259,44,3258,45,3253,46,3267,47,3269,48,3270,49,3268,50,3266,51,3268,52,3266,53,3271,54,3266,55,3265,56,3274,57,3273,58,3274,59,3236,60,3279,61,3278,62,3280,63,3281,64,3276,65,3275],"localNames":["holder","key","reviver","value","names","index","revived"],"upvalNames":[]},{"source":{"id":"@prelude","hash":"02ef4b7e114f37b9"},"index":84,"name":"replaceWith","flags":72,"length":3,"params":3,"locals":6,"maxStack":9,"code":[4,196875,3,262411,262154,10,65561,46,3211325,196618,10,262154,26,3,26,0,131092,0,131082,36,10,262154,26,65539,26,2228810,2228283,327947,1967439,2621499,2622796,2424891,37,1966139,70,587,1769531,70,2622797,2097211,71,326,43,43,196619,262154,56,262155,262204,196618,65546,43,67],"consts":["","length","String"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,3291,1,3289,2,3295,3,3293,4,3298,5,3300,6,3299,7,3297,8,3296,9,3305,10,3309,11,3310,12,3308,13,3311,14,3307,15,3312,16,3313,17,3314,18,3315,19,3314,20,3319,21,3320,22,3318,23,3321,24,3317,25,3316,40,3314,41,3312,42,3306,43,3304,44,3305,45,3324,46,3323,47,3324,48,3296,49,3327,50,3328,51,3326,52,3325],"localNames":["matches","rest","callback","result","index","%it"],"upvalNames":[]}]},"@vm-internal":{"text":"360c44dd4ea05744","codes":[{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":0,"name":"","flags":202,"length":0,"params":0,"locals":0,"maxStack":1,"code":[0,87],"consts":[],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,0],"localNames":[],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":1,"name":"$vmToPrimitive","flags":72,"length":2,"params":2,"locals":8,"maxStack":4,"code":[0,20,10,326,54,655423,0,65556,10,326,852029,10,67,65546,131076,50,1638463,65546,196612,50,1638719,0,262164,10,326,1835069,327684,1900603,393220,131339,131082,327684,50,2359357,393220,2424891,327684,196875,10,131082,26,262411,0,458772,262154,326,3932221,393228,10,262154,70,393483,0,20,393226,326,54,3932221,393226,67,10,196618,26,327947,0,458772,327690,326,5374013,458764,10,327690,70,459019,0,20,458762,326,54,5374013,458762,67,0,524308,589828,655364,582,5,0,67],"consts":["$IsObj","$IsPromise","string","default","$IsDate","toString","valueOf","$IsCallableAny","$Throw","TypeError","Cannot convert object to primitive value."],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,9,1,10,2,11,3,9,4,8,5,7,6,12,7,13,8,14,9,12,10,6,11,16,12,15,13,23,14,24,15,22,16,21,17,27,18,28,19,26,20,25,21,29,22,30,23,31,24,29,25,20,26,32,27,20,28,33,29,18,30,39,31,40,32,38,33,37,34,41,35,37,36,42,37,35,38,47,39,48,40,46,41,44,42,50,43,51,44,52,45,50,46,49,48,60,49,59,50,57,51,55,52,63,53,64,54,65,55,63,56,62,57,61,58,67,59,66,60,72,61,73,62,71,63,69,64,75,65,76,66,77,67,75,68,74,70,85,71,84,72,82,73,80,74,88,75,89,76,90,77,88,78,87,79,86,80,92,81,91,82,94,83,95,84,96,85,97,86,94,88,5],"localNames":["v","hint","first","second","m1","m2","r1","r2"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":2,"name":"$vmToKey","flags":72,"length":1,"params":1,"locals":1,"maxStack":6,"code":[0,20,0,65556,10,131076,582,326,67],"consts":["$PropKey","$vmToPrimitive","string"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,103,1,104,2,105,3,106,4,107,5,108,6,105,7,103,8,102],"localNames":["v"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":3,"name":"$vmToString","flags":72,"length":1,"params":1,"locals":1,"maxStack":6,"code":[0,20,0,65556,10,131076,582,326,67],"consts":["$CoerceToString","$vmToPrimitive","string"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,114,1,115,2,116,3,117,4,118,5,119,6,116,7,114,8,113],"localNames":["v"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":4,"name":"$vmToNumeric","flags":72,"length":2,"params":2,"locals":2,"maxStack":7,"code":[0,20,10,0,65556,65546,131076,582,582,67],"consts":["$ApplyToNumeric","$vmToPrimitive","number"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,126,1,127,2,128,3,129,4,130,5,131,6,132,7,129,8,126,9,125],"localNames":["incFlag","v"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":5,"name":"$vmInc","flags":72,"length":2,"params":2,"locals":3,"maxStack":7,"code":[0,20,10,0,65556,65546,131076,582,582,131339,10,3,50,1179709,131082,65539,43,1376315,131082,65539,44,67],"consts":["$ApplyToNumeric","$vmToPrimitive","number"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,141,1,142,2,143,3,144,4,145,5,146,6,147,7,144,8,141,9,139,10,151,11,152,12,150,13,149,14,154,15,155,16,153,17,149,18,157,19,158,20,156,21,148],"localNames":["incFlag","v","n"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":6,"name":"$vmUnary","flags":72,"length":2,"params":2,"locals":2,"maxStack":7,"code":[0,20,10,0,65556,65546,131076,582,582,67],"consts":["$ApplyUnary","$vmToPrimitive","number"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,165,1,166,2,167,3,168,4,169,5,170,6,171,7,168,8,165,9,164],"localNames":["sub","v"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":7,"name":"$vmBinary","flags":72,"length":3,"params":3,"locals":8,"maxStack":5,"code":[0,20,10,65546,131082,838,196875,196618,3,50,1179709,0,65556,10,65546,131082,838,67,196618,65539,50,2359357,458764,0,131092,65546,196612,582,459019,0,65556,10,458762,131082,838,67,196618,131075,50,2752573,262148,2818107,327684,262411,0,131092,65546,262154,582,327947,0,131092,131082,262154,582,393483,0,65556,10,327690,393226,838,67],"consts":["$OpConvKind","$ApplyBinary","$vmToPrimitive","string","default","number"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,181,1,182,2,183,3,184,4,185,5,181,6,179,7,188,8,189,9,187,10,186,11,191,12,192,13,193,14,194,15,195,16,191,17,190,18,198,19,199,20,197,21,196,23,204,24,205,25,206,26,207,27,204,28,202,29,209,30,210,31,211,32,212,33,213,34,209,35,208,36,219,37,220,38,218,39,217,40,221,41,217,42,222,43,215,44,226,45,227,46,228,47,229,48,226,49,224,50,233,51,234,52,235,53,236,54,233,55,231,56,238,57,239,58,240,59,241,60,242,61,238,62,237],"localNames":["op","lhs","rhs","kind","hint","l","r","key"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":8,"name":"$vmSetLength","flags":72,"length":2,"params":2,"locals":2,"maxStack":5,"code":[10,0,65556,65546,131076,582,1055,27,5,65546,67],"consts":["length","$vmToPrimitive","number"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,251,1,253,2,254,3,255,4,256,5,253,6,250,8,249,9,258,10,257],"localNames":["o","v"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":9,"name":"$vmSet","flags":72,"length":3,"params":3,"locals":3,"maxStack":3,"code":[65546,10,131082,326,5,131082,67],"consts":[],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,269,1,268,2,270,3,266,5,272,6,271],"localNames":["setter","receiver","value"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":10,"name":"$vmInstanceof","flags":72,"length":2,"params":2,"locals":2,"maxStack":4,"code":[0,20,10,65546,65561,582,67],"consts":["$HasInstance","prototype"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,279,1,280,2,281,3,283,4,282,5,279,6,278],"localNames":["lhs","rhs"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":11,"name":"$vmRedo","flags":72,"length":2,"params":2,"locals":2,"maxStack":2,"code":[65546,10,70,67],"consts":[],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,294,1,293,2,291,3,290],"localNames":["getter","receiver"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":12,"name":"$vmThenableGet","flags":72,"length":3,"params":3,"locals":4,"maxStack":4,"code":[10,25,196875,0,65556,196618,326,983101,10,196618,65546,131082,582,5,1310779,0,131092,10,326,5,0,67],"consts":["then","$IsFunction","$FulfillWith"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,305,1,304,2,302,3,308,4,309,5,310,6,308,7,307,8,315,9,314,10,316,11,317,12,312,14,307,15,319,16,320,17,321,18,319,20,300],"localNames":["thenable","resolve","reject","then"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":13,"name":"$vmCopyDataProps","flags":72,"length":3,"params":3,"locals":6,"maxStack":6,"code":[0,20,65546,2,131082,838,196875,3,262411,262154,196618,65561,46,2555965,327692,196618,262154,26,327947,0,131092,65546,327690,582,2293821,0,196628,10,327690,65546,327690,26,258,1094,5,262154,56,262155,589884,10,67],"consts":["$OwnKeys","length","$IsEnumerableOwn","$Define"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,331,1,332,2,333,3,334,4,335,5,331,6,329,7,339,8,337,9,342,10,344,11,343,12,341,13,340,15,351,16,352,17,350,18,348,19,354,20,355,21,356,22,357,23,354,24,353,25,359,26,360,27,361,28,362,29,364,30,365,31,363,32,366,33,359,35,369,36,368,37,369,38,340,39,371,40,370],"localNames":["target","source","excluded","keys","index","key"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":14,"name":"$vmGetElem","flags":72,"length":2,"params":2,"locals":2,"maxStack":4,"code":[10,0,20,65546,326,26,67],"consts":["$vmToKey"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,379,1,380,2,381,3,382,4,380,5,378,6,377],"localNames":["o","k"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":15,"name":"$vmDeleteElem","flags":72,"length":2,"params":2,"locals":2,"maxStack":4,"code":[10,0,20,65546,326,30,67],"consts":["$vmToKey"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,391,1,392,2,393,3,394,4,392,5,390,6,388],"localNames":["o","k"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":16,"name":"$vmReplay","flags":72,"length":7,"params":7,"locals":21,"maxStack":8,"code":[258,11993149,458764,0,20,393226,326,4325437,524300,589836,0,65556,393226,326,524555,3,590091,589834,524298,131097,46,4259901,655372,720908,524298,589834,26,655627,524298,589834,65539,43,26,721163,0,196628,327690,327690,131097,655370,838,5,0,196628,327690,327690,131097,720906,838,5,0,196628,327690,327690,131097,655370,720906,26,838,5,589834,131075,43,589835,1114172,10223675,393226,0,51,10223677,786444,851980,917516,983052,1048588,1114124,0,262164,393226,326,786699,0,327700,393226,3,582,852235,0,327700,393226,65539,582,917771,786442,131097,983307,36,1048843,3,1114379,1114122,983050,46,9764925,1179660,1245196,1310732,786442,1114122,26,1179915,0,393236,393226,1114122,582,1245451,0,458772,1179658,326,8388669,0,524308,1179658,1245194,582,8454203,1179658,1310987,0,196628,1048586,1114122,851978,9306173,0,589844,1245194,1310730,582,9371707,1310730,838,5,1114122,56,1114123,6553660,0,196628,262154,917514,1048586,838,5,0,655380,10,65546,131082,196618,262154,327690,1606,459019,0,720916,458762,326,54,11600191,0,20,458762,326,54,11796541,458762,67,458762,393227,60,0,67],"consts":["$IsPrefetch","$PrefetchReads","length","$ArraySet","$ConvValues","$ConvFlag","$ConvHint","$IsObj","$vmToPrimitive","$ConvCoerce","$Replay","$IsConvert"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,406,1,405,3,409,4,410,5,411,6,409,7,408,10,416,11,417,12,418,13,416,14,414,15,422,16,420,17,425,18,427,19,426,20,424,21,423,24,434,25,435,26,433,27,431,28,440,29,442,30,443,31,441,32,439,33,437,34,445,35,446,36,447,37,449,38,448,39,451,40,445,42,453,43,454,44,455,45,457,46,456,47,459,48,453,50,461,51,462,52,463,53,465,54,464,55,468,56,469,57,467,58,461,60,472,61,473,62,471,63,472,64,423,65,408,66,476,67,477,68,475,69,474,76,482,77,483,78,484,79,482,80,480,81,488,82,489,83,490,84,491,85,488,86,486,87,495,88,496,89,497,90,498,91,495,92,493,93,503,94,502,95,500,96,508,97,506,98,512,99,510,100,515,101,516,102,514,103,513,107,522,108,523,109,521,110,519,111,527,112,528,113,529,114,530,115,527,116,525,117,535,118,536,119,537,120,535,121,534,122,538,123,539,124,540,125,541,126,538,127,534,128,542,129,532,130,544,131,545,132,546,133,547,134,549,135,548,136,550,137,551,138,552,139,553,140,550,141,548,142,554,143,544,145,557,146,556,147,557,148,513,149,559,150,560,151,561,152,562,153,563,154,559,156,567,157,568,158,569,159,570,160,571,161,572,162,573,163,574,164,567,165,565,166,578,167,579,168,580,169,578,170,577,171,576,172,582,173,583,174,584,175,582,176,581,177,575,178,586,179,585,180,590,181,589,182,405,183,404],"localNames":["callable","target","args","constructing","replay","read","req","res","pairs","at","receiver","key","values","coerce","ordinal","len","converted","i","val","hint","prim"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":17,"name":"$vmJsonVisitor","flags":72,"length":3,"params":3,"locals":5,"maxStack":1,"code":[269,65805,131341,196621,262157,1179670,262416,36,196880,262159,67],"consts":[],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,591,5,601,7,600,8,598,9,848,10,847],"localNames":["boundary","replacer","properties","ancestors","visit"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":18,"name":"visit","flags":76,"length":3,"params":3,"locals":19,"maxStack":6,"code":[81,131082,6553603,48,720957,0,20,65540,131076,582,5,10,65546,26,196875,0,196628,196618,326,2228285,17,54,1900605,0,20,262148,327684,582,5,196618,82,2162771,67,196619,0,393236,196618,326,3473469,458764,196618,458777,459019,0,524308,458762,326,3473469,196618,458762,65546,326,196619,65553,0,51,4128829,10,65553,65546,196618,582,196619,0,589844,196618,17,131089,838,262411,262154,3,50,4980797,0,67,262154,65539,50,5374013,196618,67,262154,131075,50,5767229,1,67,262154,196611,50,6422589,0,655380,196618,17,582,67,262154,262147,50,7012413,0,720916,196618,326,7077947,196618,327947,0,786452,131089,131089,851993,327690,838,5,0,393483,0,917524,327690,326,13041725,524300,589836,36,393227,327690,851993,524555,3,590091,589834,524298,46,12976189,655372,0,196625,327690,0,983060,589834,326,131082,65539,43,838,11273034,11272251,983307,0,3,7,1048843,11013973,1048586,131075,50,10616893,67,5,10948430,70,1611,5,1048641,326,11472982,82,10092604,70,843,9895995,1048586,131075,50,11796541,67,655627,0,786452,393226,589834,655370,0,50,12517437,1,12582971,655370,838,5,589834,56,589835,8716348,18415675,720908,786444,0,1114132,70,393227,0,1179668,327690,17,262161,838,721163,3,786699,786442,720906,851993,46,18415677,851980,917516,720906,786442,26,852235,0,196625,327690,851978,131082,65539,43,838,16778058,16777275,1114379,0,3,7,1179915,16519509,1179658,131075,50,16121917,67,5,16453966,70,1611,5,1245249,326,16978518,82,15597628,70,843,15401019,1179658,131075,50,17301565,67,917771,917514,0,51,18153533,0,1310740,393226,851978,917514,258,1094,5,786442,56,786443,14024764,0,1376276,131089,326,5,393226,67],"consts":["$Throw","RangeError","Value exceeds the maximum depth of 100.","$IsPromise","InvalidData","JSON.stringify received an un-awaited Promise; await it first - e.g. `const result = await load(...)`.","$IsObj","toJSON","$IsCallableAny","$JsonClassify","$JsonSpecial","$SetToArray","$ArraySet","length","$IsArray","String",{"type":"TypeError","message":"The delegated iterator does not provide a throw() method."},"$NewNullProtoObj","$JsonNames",{"type":"TypeError","message":"The delegated iterator does not provide a throw() method."},"$Define","$ArrayPop"],"captures":[0,0,0,1,0,3,0,4,0,2],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,601,1,609,2,610,3,608,4,607,5,612,6,613,7,614,8,615,9,612,11,620,12,621,13,619,14,617,15,623,16,624,17,625,18,623,19,622,20,629,21,628,22,627,23,632,24,633,25,634,26,635,27,632,29,640,30,639,33,638,34,642,35,643,36,644,37,642,38,641,40,650,41,649,42,647,43,653,44,654,45,655,46,653,47,652,48,662,49,661,50,663,51,659,52,658,53,666,54,667,55,665,56,664,57,674,58,673,59,675,60,676,61,671,62,670,63,680,64,681,65,682,66,683,67,684,68,680,69,678,70,687,71,688,72,686,73,685,74,690,75,689,76,693,77,694,78,692,79,691,80,696,81,695,82,699,83,700,84,698,85,697,86,702,87,701,88,705,89,706,90,704,91,703,92,708,93,709,94,710,95,711,96,708,97,707,98,717,99,718,100,716,101,715,102,719,103,720,104,721,105,719,106,715,107,722,108,713,109,724,110,725,111,726,112,728,113,727,114,730,115,724,117,732,119,735,120,736,121,737,122,735,123,734,126,742,127,741,128,747,129,746,130,744,131,752,132,750,133,755,134,756,135,754,136,753,138,762,139,763,140,764,141,765,142,766,143,767,144,765,145,769,146,770,147,768,148,762,149,761,180,759,181,772,182,773,183,774,184,775,185,778,186,779,187,777,188,776,189,780,190,776,191,781,192,772,194,784,195,783,196,784,197,753,198,734,201,789,202,790,203,789,204,788,205,794,206,795,207,796,208,797,209,798,210,794,211,792,212,802,213,800,214,805,215,807,216,806,217,804,218,803,221,814,222,815,223,813,224,811,225,820,226,821,227,822,228,823,229,825,230,826,231,824,232,820,233,819,264,817,265,829,266,830,267,828,268,827,269,832,270,833,271,834,272,835,273,836,274,837,275,832,277,840,278,839,279,840,280,803,281,842,282,843,283,844,284,842,286,846,287,845],"localNames":["holder","key","depth","val","kind","target","out","toJSON","len","i","elem","names","i","k","propVal","%it","%kind","%it","%kind"],"upvalNames":["boundary","replacer","ancestors","visit","properties"]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":19,"name":"$vmJsonWalk","flags":72,"length":4,"params":4,"locals":5,"maxStack":6,"code":[0,0,20,2,10,131082,838,35,65546,65574,65540,3,838,131353,70,196633,262411,0,262164,2,262154,131082,196618,1094,67],"consts":["$vmJsonVisitor","","next","value","$JsonFinish"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,862,1,863,2,864,3,865,4,866,5,867,6,863,7,868,8,871,9,869,10,872,11,873,12,862,13,861,14,860,15,859,16,857,17,877,18,878,19,879,20,880,21,881,22,882,23,877,24,876],"localNames":["replacer","value","properties","indent","json"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":20,"name":"$vmSettleCall","flags":72,"length":3,"params":3,"locals":3,"maxStack":5,"code":[0,20,10,65546,131082,838,67],"consts":["$Apply"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,890,1,891,2,892,3,893,4,894,5,890,6,889],"localNames":["callable","thisVal","args"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":21,"name":"$vmCombine","flags":72,"length":2,"params":2,"locals":6,"maxStack":4,"code":[0,20,10,65546,582,131339,196620,65546,1441866,1441851,262411,2360396,1638459,196620,196875,0,65556,131082,196618,582,5,720956,70,75,655419,70,2360397,852027,327947,2098254,70,5,327690,64,5,2097211,0,131092,131082,326,5,0,67],"consts":["$CombineStart","$CombineAdd","$CombineEnd"],"captures":[],"handlers":[13,22,28,0,29,32,34,0],"finallies":[],"finallyOffsets":[],"sites":[0,903,1,904,2,905,3,906,4,903,5,901,7,911,8,907,14,908,15,914,16,915,17,916,18,917,19,914,21,907,36,919,37,920,38,921,39,919,41,899],"localNames":["name","items","c","item","%it","%e"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":22,"name":"$vmOpenSyncForAsync","flags":72,"length":2,"params":2,"locals":3,"maxStack":4,"code":[0,20,10,65546,70,326,131339,0,65556,131082,131082,131097,582,67],"consts":["$AfsRequireObj","$WrapAsyncFromSync","next"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,930,1,931,2,935,3,934,4,932,5,930,6,928,7,937,8,938,9,939,10,941,11,940,12,937,13,936],"localNames":["v","method","it"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":23,"name":"$vmAsyncFromSync","flags":72,"length":4,"params":4,"locals":10,"maxStack":7,"code":[0,20,10,326,262411,65546,65540,50,917565,0,131092,10,326,1441851,0,196628,10,262154,65546,26,65546,838,327947,327690,0,50,1966143,327690,1,50,4915261,589836,65546,262148,50,2818109,0,327700,196618,326,5,0,67,0,196628,10,262154,262169,262148,838,590091,589834,0,51,3801407,589834,1,51,4456509,0,393236,10,262154,589834,70,262148,838,5,0,458772,10,326,5,0,67,131082,5374013,262154,327690,196618,326,5570619,262154,327690,70,393483,0,393236,10,393226,65546,838,5,393226,524313,54,54,459019,393226,589849,524555,0,655380,10,524298,458762,65546,262148,51,1094,5,0,67],"consts":["$AfsGetIter","next","$AfsGetNext","$AfsMethod","return","$AfsResolveDone","$AfsCheckObj","$AfsRejectNoThrow","done","value","$AfsSettle"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,953,1,954,2,955,3,953,4,951,5,961,6,962,7,960,8,959,9,963,10,964,11,965,12,963,13,959,14,966,15,967,16,968,17,970,18,971,19,969,20,972,21,966,22,957,23,976,24,977,25,975,26,974,27,979,28,980,29,978,30,973,32,984,33,985,34,983,35,982,36,988,37,989,38,990,39,988,41,991,43,995,44,996,45,997,46,999,47,998,48,1001,49,995,50,993,51,1005,52,1006,53,1004,54,1003,55,1008,56,1009,57,1007,58,1002,59,1012,60,1013,61,1014,62,1018,63,1017,64,1015,65,1019,66,1012,68,1021,69,1022,70,1023,71,1021,73,1024,75,1029,76,1028,77,1033,78,1032,79,1034,80,1030,81,1028,82,1038,83,1037,84,1035,85,1026,86,1040,87,1041,88,1042,89,1043,90,1044,91,1040,93,1051,94,1050,95,1049,96,1048,97,1046,98,1057,99,1056,100,1054,101,1060,102,1061,103,1062,104,1063,105,1064,106,1066,107,1067,108,1065,109,1060,111,949],"localNames":["adapter","kind","hasArg","val","iter","method","res","done","value","ret"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":24,"name":"$vmAsyncFromSyncClose","flags":72,"length":1,"params":1,"locals":2,"maxStack":2,"code":[10,25,65803,65546,0,51,655679,65546,1,51,983101,10,65546,70,5,0,67],"consts":["return"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1076,1,1075,2,1073,3,1081,4,1082,5,1080,6,1079,7,1084,8,1085,9,1083,10,1078,11,1090,12,1089,13,1087,15,1071],"localNames":["iter","ret"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":25,"name":"$vmHostWait","flags":74,"length":4,"params":4,"locals":5,"maxStack":9,"code":[3,262411,262154,10,25,46,1048637,10,262154,26,340,5,262154,56,262155,131132,0,65556,65546,0,131082,2,36,196618,0,1862,67],"consts":["length","$vmReplay"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1101,1,1099,2,1104,3,1106,4,1105,5,1103,6,1102,7,1112,8,1113,9,1111,10,1110,12,1116,13,1115,14,1116,15,1102,16,1118,17,1119,18,1120,19,1121,20,1122,21,1123,22,1124,23,1125,24,1126,25,1118,26,1117],"localNames":["promises","callee","args","read","i"],"upvalNames":[]},{"source":{"id":"@vm-internal","hash":"614646bcd33f0ad8"},"index":26,"name":"$vmResult","flags":74,"length":1,"params":1,"locals":4,"maxStack":6,"code":[0,20,10,326,524349,10,340,589883,10,65803,0,0,65556,258,0,1,838,35,65546,131110,131076,3,838,131339,131082,196889,70,196875,196618,262169,54,2621501,131082,196889,196618,327705,340,326,196619,1835068,0,393236,258,196618,327705,1,0,1094,67],"consts":["$IsThenable","$vmJsonVisitor","","next","done","value","$JsonFinish"],"captures":[],"handlers":[],"finallies":[],"finallyOffsets":[],"sites":[0,1135,1,1136,2,1137,3,1135,4,1134,5,1139,6,1138,7,1134,8,1140,9,1132,10,1144,11,1145,12,1146,13,1147,14,1148,15,1149,16,1145,17,1150,18,1153,19,1151,20,1154,21,1155,22,1144,23,1142,24,1161,25,1160,26,1159,27,1157,28,1166,29,1165,30,1164,31,1163,32,1173,33,1172,34,1177,35,1176,36,1175,37,1171,38,1170,39,1163,40,1180,41,1181,42,1182,43,1184,44,1183,45,1186,46,1187,47,1180,48,1179],"localNames":["value","root","walk","step"],"upvalNames":[]}]}} diff --git a/packages/codemode/src/language/prelude/helpers.ts b/packages/codemode/src/language/prelude/helpers.ts index 695fccffefa82..263085e18c8af 100644 --- a/packages/codemode/src/language/prelude/helpers.ts +++ b/packages/codemode/src/language/prelude/helpers.ts @@ -183,7 +183,7 @@ export const helpers = (ctx: Interpreter): Array sortState(builtins, values as Arr)], + $SortState: [1, ([keys]) => sortState(builtins, keys as Arr)], $SortStep: [1, ([state]) => sortStep(state as Arr)], $SortResult: [ 2, @@ -259,8 +259,8 @@ const MERGE_STEP = 65_536 * the next run to sort, and the merge pass's run width, output position, and positions in its two runs. Runs of * SORT_RUN are sorted first, then merged in passes of doubling width from the order into the buffer, which swap. */ -const sortState = (builtins: Builtins, values: Arr): Arr => { - const keys = values.items.map(coerceToString) +const sortState = (builtins: Builtins, strings: Arr): Arr => { + const keys = strings.items as Array const order = keys.map((_, at) => at) return new Arr(builtins.Array, [ new Arr(builtins.Array, keys), diff --git a/packages/codemode/src/language/prelude/source.ts b/packages/codemode/src/language/prelude/source.ts index b28850d7369b3..dc6282b37f029 100644 --- a/packages/codemode/src/language/prelude/source.ts +++ b/packages/codemode/src/language/prelude/source.ts @@ -243,8 +243,8 @@ function sortWith(target, into, holes, comparator, work, undefs, merges) { // The default sort over more values than one native sort may take at once: native steps of bounded size (see // $SortStep), so the run can pause between them like any loop. -function sortDefault(target, into, holes, values, undefs) { - const state = $SortState(values) +function sortDefault(target, into, holes, values, undefs, keys) { + const state = $SortState(keys) while ($SortStep(state)) {} return $Sorted(target, into, holes, $SortResult(state, values), undefs) } diff --git a/packages/codemode/src/language/runtime.ts b/packages/codemode/src/language/runtime.ts index 4320d5e83a795..9ff9c92739170 100644 --- a/packages/codemode/src/language/runtime.ts +++ b/packages/codemode/src/language/runtime.ts @@ -3,7 +3,10 @@ export * as Runtime from "./runtime.js" import { Deferred, Effect, Exit } from "effect" import type { Json } from "./data.js" import type { DurableFn, Fn, Namespace } from "./host-function.js" +import type { Diagnostic } from "./runtime/model.js" import { + Compiled, + compileProgram, finishExecution, type Outcome, type Result, @@ -17,7 +20,7 @@ import { } from "./runtime/execute.js" import type { SnapshotError } from "./snapshot/snapshot.js" -export { SuspendError } +export { Compiled, SuspendError } export type { Outcome, Result, Run, Suspended } /** Budgets enforced on each run. Time counts active time only, across every resume of a run. */ @@ -79,10 +82,17 @@ export type SuspendOptions = { /** A reusable confined runtime over host globals. */ export type Runtime = { - /** Runs a program to its end. */ - readonly execute: (code: string, options?: ProgramOptions) => Effect.Effect - /** A program ready to run once; nothing runs until `program.run()`. */ - readonly program: (code: string, options?: ProgramOptions) => Program + /** Runs a program, from its source or compiled, to its end. */ + readonly execute: (code: string | Compiled, options?: ProgramOptions) => Effect.Effect + /** A program, from its source or compiled, ready to run once; nothing runs until `program.run()`. */ + readonly program: (code: string | Compiled, options?: ProgramOptions) => Program + /** + * Parses and compiles a program once, for `program` and `execute` to run many times without doing it again; or the + * diagnostic a run of it would fail with first (an empty program, a syntax error). + */ + readonly compile: ( + code: string, + ) => { readonly ok: true; readonly compiled: Compiled } | { readonly ok: false; readonly error: Diagnostic } /** * A suspended run (its `state`, or that state as bytes) as a program to continue in this runtime, which must be the * same build with the same host globals. The state is checked when it runs: `run()` fails with a `SnapshotError` @@ -132,11 +142,12 @@ export const make = (options: Options = {}): Ru promises: options.translate?.promises ?? "error", }, } - const program = (code: string, programOptions?: ProgramOptions) => + const program = (code: string | Compiled, programOptions?: ProgramOptions) => makeProgram(() => Effect.succeed(startProgram(setup, code, programOptions?.bindings, programOptions?.runId))) return { execute: (code, programOptions) => Effect.suspend(() => finishExecution(program(code, programOptions).run())), program, + compile: compileProgram, resume: (state) => makeProgram(() => resumeProgram(setup, state)), } } diff --git a/packages/codemode/src/language/runtime/errors.ts b/packages/codemode/src/language/runtime/errors.ts index 7d001635ba4a9..b0459e827338b 100644 --- a/packages/codemode/src/language/runtime/errors.ts +++ b/packages/codemode/src/language/runtime/errors.ts @@ -179,7 +179,7 @@ export const errorGlobal = (type: ErrorType, ctx: Interpreter) => { ([text]) => { return withReads(() => { const created = withCause( - createErrorValue(proto, message === undefined ? "" : coerceToString(text)), + createErrorValue(proto, message === undefined ? undefined : coerceToString(text)), args[2], ) return new Invoke(ctx.prelude.fn("aggregateError"), undefined, [created, args[0]], undefined) diff --git a/packages/codemode/src/language/runtime/execute.ts b/packages/codemode/src/language/runtime/execute.ts index 1f151cfd8ff4c..dda91a93dc492 100644 --- a/packages/codemode/src/language/runtime/execute.ts +++ b/packages/codemode/src/language/runtime/execute.ts @@ -12,7 +12,8 @@ import { type Diagnostic, formatLocation, sourceLocation } from "./model.js" import { Driver, SUSPENDED } from "./driver.js" import { Interruption } from "./signals.js" import { Source } from "./source.js" -import type { Vm } from "../vm.js" +import { compileCodes, type Vm } from "../vm.js" +import type { Code } from "../code.js" import type { Translate } from "../runtime.js" /** @@ -91,23 +92,49 @@ export const finishExecution = (outcome: Effect.Effect): Ef } }) +/** + * A program compiled once to run many times, in any runtime: its parse and its bytecode, which no run changes. A run + * of it is the same as a run of its source, and so is a state saved from one. + */ +export class Compiled { + /** @internal */ + constructor( + /** The program's source. */ + readonly code: string, + /** @internal */ + readonly source: Source, + /** @internal */ + readonly codes: ReadonlyArray | RangeError, + ) {} +} + +/** + * Parses and compiles a program, or gives the diagnostic its run would fail with before running anything: an empty + * program or a syntax error. Unsupported syntax still fails where it runs, as from source. + */ +export const compileProgram = ( + code: string, +): { readonly ok: true; readonly compiled: Compiled } | { readonly ok: false; readonly error: Diagnostic } => { + if (code.trim().length === 0) return { ok: false, error: { kind: "ParseError", message: "Code cannot be empty." } } + const parsed = parseProgram(code) + if (!parsed.ok) return parsed + return { ok: true, compiled: new Compiled(code, parsed.source, compileCodes(parsed.source)) } +} + /** A program ready to run on the VM: nothing runs until `run`. */ export const startProgram = ( setup: Setup, - code: string, + code: string | Compiled, bindings?: Readonly>, runId: string = crypto.randomUUID(), ): Running => new Running(setup, 0, () => { - if (code.trim().length === 0) { - return { ok: false, error: { kind: "ParseError", message: "Code cannot be empty." }, metadata: null } - } - const parsed = parseProgram(code) - if (!parsed.ok) return { ok: false, error: parsed.error, metadata: null } + const compiled = typeof code === "string" ? compileProgram(code) : { ok: true as const, compiled: code } + if (!compiled.ok) return { ok: false, error: compiled.error, metadata: null } const run: Run = { id: runId, metadata: null } const runtime = instantiate(setup, run, bindings) runtime.vm.hosts.runId = runId - runtime.vm.start(parsed.source) + runtime.vm.start(compiled.compiled.source, compiled.compiled.codes) return [runtime, run] as const }) diff --git a/packages/codemode/src/language/runtime/intrinsics.ts b/packages/codemode/src/language/runtime/intrinsics.ts index 89b80d75735e6..6540241569d1c 100644 --- a/packages/codemode/src/language/runtime/intrinsics.ts +++ b/packages/codemode/src/language/runtime/intrinsics.ts @@ -1,4 +1,4 @@ -import { define, hidden, Native, Arr, ErrorObj, Obj, type Value } from "./objects.js" +import { define, hidden, Native, Arr, ErrorObj, Obj, readonly, type Value } from "./objects.js" export const errorTypes = [ "Error", @@ -43,6 +43,9 @@ const builtins = [ "Generator", "AsyncGenerator", "AsyncFromSyncIterator", + "GeneratorFunction", + "AsyncGeneratorFunction", + "AsyncFunction", ] as const /** @@ -82,6 +85,16 @@ export const createBuiltins = (): Builtins => { const iterator = plain() const asyncIterator = plain() const uint8Array = plain() + const generator = new Obj(iterator) + const asyncGenerator = new Obj(asyncIterator) + // What generator and async functions inherit: plain objects, not callable, linked to the prototype of what they make. + const functionKind = (made?: Obj) => { + const proto = new Obj(fn) + if (made === undefined) return proto + define(proto, "prototype", made, readonly) + define(made, "constructor", proto, readonly) + return proto + } return { Object: object, Function: fn, @@ -109,10 +122,13 @@ export const createBuiltins = (): Builtins => { Iterator: iterator, IteratorHelper: new Obj(iterator), AsyncIterator: asyncIterator, - Generator: new Obj(iterator), - AsyncGenerator: new Obj(asyncIterator), + Generator: generator, + AsyncGenerator: asyncGenerator, /** CreateAsyncFromSyncIterator's objects; programs never see them. */ AsyncFromSyncIterator: new Obj(asyncIterator), + GeneratorFunction: functionKind(generator), + AsyncGeneratorFunction: functionKind(asyncGenerator), + AsyncFunction: functionKind(), Error: error, TypeError: derived("TypeError"), RangeError: derived("RangeError"), diff --git a/packages/codemode/src/language/runtime/objects.ts b/packages/codemode/src/language/runtime/objects.ts index b61f4af16e6bd..0685adcd5ab2b 100644 --- a/packages/codemode/src/language/runtime/objects.ts +++ b/packages/codemode/src/language/runtime/objects.ts @@ -600,18 +600,29 @@ export class Position implements TableCursor { /** A built-in iterator: a live cursor over a host collection or an iterator helper, yielding program values. */ export class IteratorObj extends Opaque { - override readonly tag = "Iterator" + /** The `@@toStringTag` of what it walks: `[object Array Iterator]`, or `[object Iterator]` for a helper. */ + override readonly tag: string constructor( proto: Obj, readonly cursor: Cursor, ) { super(proto) + this.tag = cursor instanceof Position ? `${iteratedKind(cursor.source)} Iterator` : "Iterator" } override get describe() { return "an iterator" } } +const iteratedKind = (source: PositionSource): string => { + if (typeof source === "string") return "String" + if (source instanceof MapObj) return "Map" + if (source instanceof SetObj) return "Set" + if (source instanceof HeadersObj) return "Headers" + if (source instanceof URLSearchParamsObj) return "URLSearchParams" + return "Array" +} + /** A built-in iterator over a collection, e.g. `array.values()`. */ export const positionIterator = (builtins: Builtins, source: PositionSource, kind: IterationKind): IteratorObj => new IteratorObj(builtins.Iterator, new Position(source, kind, builtins.Array)) diff --git a/packages/codemode/src/language/runtime/operations.ts b/packages/codemode/src/language/runtime/operations.ts index 8c6ee95233736..7b378f6613fec 100644 --- a/packages/codemode/src/language/runtime/operations.ts +++ b/packages/codemode/src/language/runtime/operations.ts @@ -127,7 +127,7 @@ export const applyBinaryOperator = (operator: string, lhs: Value, rhs: Value, no if (operator === "!==") return lhs !== rhs if (operator === "==") return looselyEqual(lhs, rhs, node) if (operator === "!=") return !looselyEqual(lhs, rhs, node) - if (operator === "in" && rhs instanceof Obj && !isOpaque(lhs)) return has(rhs, propertyKey(lhs)) + if (operator === "in" && rhs instanceof Obj && !(lhs instanceof HostNamespace)) return has(rhs, propertyKey(lhs)) if (isOpaque(lhs) || isOpaque(rhs)) { throw invalidData("Binary operators require data values.", node) } @@ -197,7 +197,7 @@ export const operatorConversion = ( rhs: Value, ): { readonly kind: "key" } | { readonly kind: "primitive"; readonly hint: "default" | "number" } | undefined => { // `in` checks the right operand before ToPropertyKey on the left, so a bad right side wins over a bad key. - if (operator === "in" && lhs instanceof Obj && !isOpaque(lhs) && rhs instanceof Obj) return { kind: "key" } + if (operator === "in" && lhs instanceof Obj && rhs instanceof Obj) return { kind: "key" } // IsLooselyEqual converts only an object facing a non-nullish primitive; two objects (including namespace // references, which are not Obj) compare by identity. const equality = operator === "==" || operator === "!=" diff --git a/packages/codemode/src/language/runtime/promises.ts b/packages/codemode/src/language/runtime/promises.ts index 40bb2942ff04d..f326d2f2bebe0 100644 --- a/packages/codemode/src/language/runtime/promises.ts +++ b/packages/codemode/src/language/runtime/promises.ts @@ -11,8 +11,8 @@ import { finishAwaitReturn } from "../generators.js" // A `resolve`/`reject` handed to an executor or thenable: calling it settles the capability. const resolvingFunctions = (ctx: Interpreter, resolving: Resolving) => ({ - resolve: new Resolver(ctx.builtins.Function, "resolve", resolving, "resolve"), - reject: new Resolver(ctx.builtins.Function, "reject", resolving, "reject"), + resolve: new Resolver(ctx.builtins.Function, "", resolving, "resolve"), + reject: new Resolver(ctx.builtins.Function, "", resolving, "reject"), }) /** diff --git a/packages/codemode/src/language/snapshot/codec.ts b/packages/codemode/src/language/snapshot/codec.ts index a3ad7c866c4a1..9b50cf37086fa 100644 --- a/packages/codemode/src/language/snapshot/codec.ts +++ b/packages/codemode/src/language/snapshot/codec.ts @@ -238,7 +238,7 @@ const builtinSpecs = (): ReadonlyArray => [ obj: true, constants: { tag: "Generator" }, }, - { name: "IteratorObj", ctor: IteratorObj, fields: ["cursor"], obj: true, constants: { tag: "Iterator" } }, + { name: "IteratorObj", ctor: IteratorObj, fields: ["cursor", "tag"], obj: true }, { name: "DateObj", ctor: DateObj, fields: ["time"], obj: true, constants: { tag: "Date" } }, { name: "RegExpObj", diff --git a/packages/codemode/src/language/stdlib/array.ts b/packages/codemode/src/language/stdlib/array.ts index a4a0952bc9f51..5b28ddf707e42 100644 --- a/packages/codemode/src/language/stdlib/array.ts +++ b/packages/codemode/src/language/stdlib/array.ts @@ -18,6 +18,7 @@ import { coerceToNumber, coerceToString, rejectAddition, + type NativeResult, type Value, } from "../runtime/objects.js" import { describeValue, rejectCircularInsertion } from "../runtime/references.js" @@ -86,29 +87,30 @@ export const sortArray = ( target: Arr | Bytes, comparator: Value, into: SortInto, -): Value | Invoke => { +): NativeResult => { const builtins = ctx.builtins const items = target instanceof Arr ? [...target.items] : [...target.bytes] // Counted before any comparator runs; a comparator that changes the array does not change where holes go. let holes = 0 if (target instanceof Arr) for (let index = 0; index < items.length; index++) if (!(index in target.items)) holes++ const callback = comparator === undefined ? undefined : requireCallback(comparator, into) - if (callback === undefined && items.length <= SORT_RUN) { - return sorted( - builtins, - target, - into, - holes, - items.sort((a, b) => compareText(coerceToString(a), coerceToString(b))), - ) - } const defined = new Arr( builtins.Array, items.filter((item) => item !== undefined), ) const undefs = items.length - defined.items.length if (callback === undefined) { - return new Invoke(ctx.prelude.fn("sortDefault"), undefined, [target, into, holes, defined, undefs], undefined) + // Each value's ToString, through its own toString or valueOf, once; equal keys keep their order. + return withPrimitives("string", defined.items, (primitives) => { + const keys = primitives.map(coerceToString) + if (keys.length > SORT_RUN) { + const args = [target, into, holes, defined, undefs, new Arr(builtins.Array, keys)] + return new Invoke(ctx.prelude.fn("sortDefault"), undefined, args, undefined) + } + const order = keys.map((_, at) => at).sort((left, right) => compareText(keys[left]!, keys[right]!)) + const result = [...order.map((at) => defined.items[at]), ...Array.from({ length: undefs }, () => undefined)] + return sorted(builtins, target, into, holes, result) + }) } const merges: Array = [] const plan = (low: number, high: number) => { @@ -189,6 +191,19 @@ export const arrayGlobal = (ctx: Interpreter) => { return target } const optNumber = (value: Value): number | undefined => (value === undefined ? undefined : coerceToInteger(value)) + // ToIntegerOrInfinity's ToPrimitive step for the arguments at `positions`, in order, before `body` reads them. + const integers = (args: Array, positions: ReadonlyArray, body: (args: Array) => NativeResult) => + withPrimitives( + "number", + positions.map((at) => args[at]), + (primitives) => { + const converted = [...args] + positions.forEach((at, index) => { + if (at < args.length) converted[at] = primitives[index] + }) + return body(converted) + }, + ) methods(builtins, proto, [ [ @@ -218,24 +233,48 @@ export const arrayGlobal = (ctx: Interpreter) => { "includes", 1, (thisValue, args) => { - return self(thisValue, "includes").items.includes(args[0], optNumber(args[1])) + const target = self(thisValue, "includes").items + // An empty array answers before fromIndex converts. + if (target.length === 0) return false + return integers(args, [1], (args) => target.includes(args[0], optNumber(args[1]))) + }, + ], + [ + "indexOf", + 1, + (thisValue, args) => { + const target = self(thisValue, "indexOf").items + if (target.length === 0) return -1 + return integers(args, [1], (args) => target.indexOf(args[0], optNumber(args[1]))) }, ], - ["indexOf", 1, (thisValue, args) => self(thisValue, "indexOf").items.indexOf(args[0], optNumber(args[1]))], [ "lastIndexOf", 1, (thisValue, args) => { const target = self(thisValue, "lastIndexOf").items + if (target.length === 0) return -1 // An explicit undefined is a fromIndex of 0, unlike omitting it. - return args.length < 2 ? target.lastIndexOf(args[0]) : target.lastIndexOf(args[0], optNumber(args[1])) + return integers(args, [1], (args) => + args.length < 2 ? target.lastIndexOf(args[0]) : target.lastIndexOf(args[0], optNumber(args[1])), + ) + }, + ], + [ + "at", + 1, + (thisValue, args) => { + const target = self(thisValue, "at").items + return integers(args, [0], (args) => target.at(optNumber(args[0]) ?? 0)) }, ], - ["at", 1, (thisValue, args) => self(thisValue, "at").items.at(optNumber(args[0]) ?? 0)], [ "slice", 2, - (thisValue, args) => wrap(self(thisValue, "slice").items.slice(optNumber(args[0]), optNumber(args[1]))), + (thisValue, args) => { + const target = self(thisValue, "slice").items + return integers(args, [0, 1], (args) => wrap(target.slice(optNumber(args[0]), optNumber(args[1])))) + }, ], [ "concat", @@ -254,9 +293,12 @@ export const arrayGlobal = (ctx: Interpreter) => { (thisValue, args) => { const flatten = (items: Array, depth: number): Array => items.flatMap((item) => (item instanceof Arr && depth > 0 ? flatten(item.items, depth - 1) : [item])) - const flattened = flatten(self(thisValue, "flat").items, optNumber(args[0]) ?? 1) - checkArrayLength(flattened.length) - return wrap(flattened) + const target = self(thisValue, "flat").items + return integers(args, [0], (args) => { + const flattened = flatten(target, optNumber(args[0]) ?? 1) + checkArrayLength(flattened.length) + return wrap(flattened) + }) }, ], [ @@ -278,12 +320,14 @@ export const arrayGlobal = (ctx: Interpreter) => { 2, (thisValue, args) => { const target = self(thisValue, "with").items - const index = optNumber(args[0]) ?? 0 - const resolved = index < 0 ? target.length + index : index - if (resolved < 0 || resolved >= target.length) throw rangeError("Array.with index is out of range.") - const copied = [...target] - copied[resolved] = args[1] - return wrap(copied) + return integers(args, [0], (args) => { + const index = optNumber(args[0]) ?? 0 + const resolved = index < 0 ? target.length + index : index + if (resolved < 0 || resolved >= target.length) throw rangeError("Array.with index is out of range.") + const copied = [...target] + copied[resolved] = args[1] + return wrap(copied) + }) }, ], [ @@ -312,46 +356,57 @@ export const arrayGlobal = (ctx: Interpreter) => { 2, (thisValue, args) => { const target = self(thisValue, "splice") - const length = target.items.length - const start = optNumber(args[0]) ?? 0 - const from = start < 0 ? Math.max(length + start, 0) : Math.min(start, length) - const deleteCount = - args.length === 1 ? length - from : Math.min(Math.max(optNumber(args[1]) ?? 0, 0), length - from) - const inserted = args.slice(2) - for (const item of inserted) rejectCircularInsertion(target, item, "Array.splice result") - mutable(target, inserted.length - deleteCount) - return wrap(target.items.splice(from, deleteCount, ...inserted)) + return integers(args, [0, 1], (args) => { + const length = target.items.length + const start = optNumber(args[0]) ?? 0 + const from = start < 0 ? Math.max(length + start, 0) : Math.min(start, length) + const deleteCount = + args.length === 1 ? length - from : Math.min(Math.max(optNumber(args[1]) ?? 0, 0), length - from) + const inserted = args.slice(2) + for (const item of inserted) rejectCircularInsertion(target, item, "Array.splice result") + mutable(target, inserted.length - deleteCount) + return wrap(target.items.splice(from, deleteCount, ...inserted)) + }) }, ], [ "toSpliced", 2, (thisValue, args) => { - const copied = [...self(thisValue, "toSpliced").items] - if (args.length === 0) return wrap(copied) - const start = optNumber(args[0]) ?? 0 - if (args.length === 1) copied.splice(start) - else copied.splice(start, optNumber(args[1]) ?? 0, ...args.slice(2)) - return wrap(copied) + const target = self(thisValue, "toSpliced").items + return integers(args, [0, 1], (args) => { + const copied = [...target] + if (args.length === 0) return wrap(copied) + const start = optNumber(args[0]) ?? 0 + if (args.length === 1) copied.splice(start) + else copied.splice(start, optNumber(args[1]) ?? 0, ...args.slice(2)) + return wrap(copied) + }) }, ], [ "fill", 1, (thisValue, args) => { - const target = mutable(self(thisValue, "fill")) - rejectCircularInsertion(target, args[0], "Array.fill result") - target.items.fill(args[0], optNumber(args[1]), optNumber(args[2])) - return target + const target = self(thisValue, "fill") + return integers(args, [1, 2], (args) => { + mutable(target) + rejectCircularInsertion(target, args[0], "Array.fill result") + target.items.fill(args[0], optNumber(args[1]), optNumber(args[2])) + return target + }) }, ], [ "copyWithin", 2, (thisValue, args) => { - const target = mutable(self(thisValue, "copyWithin")) - target.items.copyWithin(optNumber(args[0]) ?? 0, optNumber(args[1]) ?? 0, optNumber(args[2])) - return target + const target = self(thisValue, "copyWithin") + return integers(args, [0, 1, 2], (args) => { + mutable(target) + target.items.copyWithin(optNumber(args[0]) ?? 0, optNumber(args[1]) ?? 0, optNumber(args[2])) + return target + }) }, ], ...iteratorMethods(builtins, self), diff --git a/packages/codemode/src/language/stdlib/collections.ts b/packages/codemode/src/language/stdlib/collections.ts index f9803e6e0e3aa..e191e904e1f78 100644 --- a/packages/codemode/src/language/stdlib/collections.ts +++ b/packages/codemode/src/language/stdlib/collections.ts @@ -120,8 +120,10 @@ export const setGlobal = (ctx: Interpreter) => { return undefined }, ], - ...iteratorMethods(builtins, self), + // Set.prototype.keys is the same function as values. + ...iteratorMethods(builtins, self).filter(([name]) => name !== "keys"), ]) + define(proto, "keys", get(proto, "values"), hidden) define(proto, IteratorSymbol, get(proto, "values"), hidden) return set } diff --git a/packages/codemode/src/language/stdlib/json.ts b/packages/codemode/src/language/stdlib/json.ts index e6c9c286eb07f..091f4727fc2df 100644 --- a/packages/codemode/src/language/stdlib/json.ts +++ b/packages/codemode/src/language/stdlib/json.ts @@ -1,5 +1,5 @@ import { methods } from "../runtime/native.js" -import { requireCallback } from "../runtime/callback.js" +import { requireCallback, withPrimitives } from "../runtime/callback.js" import type { Interpreter } from "../runtime/interpreter.js" import { syntaxError } from "../runtime/model.js" import { typeofValue } from "../runtime/references.js" @@ -16,9 +16,11 @@ export const jsonGlobal = (ctx: Interpreter) => { return json } -const parse = (ctx: Interpreter, args: Array) => { - const text = coerceToString(args[0]) +// The text converts through its own toString first, as ToString does. +const parse = (ctx: Interpreter, args: Array) => + withPrimitives("string", [args[0]], ([text]) => parseText(ctx, coerceToString(text), args[1])) +const parseText = (ctx: Interpreter, text: string, reviverArg: Value) => { const parsed = (() => { try { return fromJson(ctx, JSON.parse(text)) @@ -26,8 +28,8 @@ const parse = (ctx: Interpreter, args: Array) => { throw syntaxError(`JSON.parse received invalid JSON: ${error instanceof Error ? error.message : String(error)}`) } })() - if (typeofValue(args[1]) !== "function") return parsed - const reviver = requireCallback(args[1], "JSON.parse") + if (typeofValue(reviverArg) !== "function") return parsed + const reviver = requireCallback(reviverArg, "JSON.parse") return new Invoke( ctx.prelude.fn("revive"), undefined, diff --git a/packages/codemode/src/language/stdlib/string.ts b/packages/codemode/src/language/stdlib/string.ts index fe2bb631740d3..3a531daa88d3e 100644 --- a/packages/codemode/src/language/stdlib/string.ts +++ b/packages/codemode/src/language/stdlib/string.ts @@ -105,7 +105,8 @@ export const stringGlobal = (ctx: Interpreter) => { const codeUnits = (name: string, op: (...codes: Array) => string): Method => [ name, 1, - (_, args) => op(...args.map(coerceToNumber)), + // Each argument's ToNumber, through its own valueOf or toString, in order. + (_, args) => withPrimitives("number", args, (numbers) => op(...numbers.map(coerceToNumber)), true), ] methods(builtins, string, [ codeUnits("fromCharCode", String.fromCharCode), @@ -327,7 +328,8 @@ export const stringGlobal = (ctx: Interpreter) => { "repeat", 1, (value, args) => { - const count = num("repeat", args, 0) + // ToIntegerOrInfinity: NaN counts as 0. + const count = coerceToInteger(requireDataArgument("repeat", 0, args[0])) if (!Number.isFinite(count) || count < 0) { throw rangeError("String.repeat expects a finite non-negative count.") } @@ -383,9 +385,12 @@ export const stringGlobal = (ctx: Interpreter) => { define( builtins.String, IteratorSymbol, - fn(builtins, "[Symbol.iterator]", 0, (thisValue) => - positionIterator(builtins, self(thisValue, "[Symbol.iterator]"), "values"), - ), + fn(builtins, "[Symbol.iterator]", 0, (thisValue) => { + if (thisValue === null || thisValue === undefined) self(thisValue, "[Symbol.iterator]") + return withPrimitives("string", [thisValue], ([value]) => + positionIterator(builtins, self(value, "[Symbol.iterator]"), "values"), + ) + }), hidden, ) return string diff --git a/packages/codemode/src/language/vm.ts b/packages/codemode/src/language/vm.ts index 5490574565030..90928cbe832c1 100644 --- a/packages/codemode/src/language/vm.ts +++ b/packages/codemode/src/language/vm.ts @@ -44,6 +44,7 @@ import { Native, type NativeResult, Obj, + parseArrayIndex, Position, PromiseObj, readonly, @@ -212,6 +213,16 @@ const allocRegs = (size: number): Array => { return regs } +/** A program's bytecode, or the RangeError of one nested deeper than the compiler's host stack. */ +export const compileCodes = (source: Source): ReadonlyArray | RangeError => { + try { + return compileSource(source) + } catch (error) { + if (!(error instanceof RangeError)) throw error + return error + } +} + /** Internal closure wrapper that does not touch `builtins.Function` or `nativeRule.sealed`. */ export class VmInternalFn { constructor( @@ -296,17 +307,14 @@ export class Vm { return this.intrinsics.get(name) } - /** Queues the program's body as the root frame. */ - start(source: Source): void { + /** Queues the program's body as the root frame, from its bytecode (`compileCodes`) when it is compiled already. */ + start(source: Source, compiled?: ReadonlyArray | RangeError): void { if (!warmed) warmupVm(this) this.ctx.sources.set(source.id, source) - let codes: ReadonlyArray - try { - codes = compileSource(source) - } catch (error) { - // A program nested deeper than the compiler's host stack fails the run, as running it would. - if (!(error instanceof RangeError)) throw error - this.outcome = abrupt(error) + const codes = compiled ?? compileCodes(source) + // A program nested deeper than the compiler's host stack fails the run, as running it would. + if (codes instanceof RangeError) { + this.outcome = abrupt(codes) return } this.sourceCodes.set(source.id, codes) @@ -764,9 +772,11 @@ export class Vm { // Op.PUT_PROP const v = regs[--sp] as Value const o = regs[sp - 1] as Value + const key = consts[w >>> 16] as string frame.pc = pc frame.sp = sp - if (this.execPutProp(frame, o, consts[w >>> 16] as string, v, pc, sp)) continue outer + if (key === "length" && this.execSetLength(frame, o, v, pc, sp)) continue outer + if (this.execPutProp(frame, o, key, v, pc, sp)) continue outer regs[sp - 1] = v pc++ continue @@ -803,6 +813,7 @@ export class Vm { } frame.pc = pc frame.sp = sp + if (keyVal === "length" && this.execSetLength(frame, o, v, pc, sp)) continue outer if (this.execPutProp(frame, o, propertyKey(keyVal), v, pc, sp)) continue outer regs[sp - 1] = v pc++ @@ -846,8 +857,15 @@ export class Vm { // Op.IN const rhs = regs[--sp] as Value const lhs = regs[sp - 1] as Value - if (typeof lhs === "number" && lhs >= 0 && (lhs | 0) === lhs && rhs instanceof ArrCtor) { - regs[sp - 1] = lhs in rhs.items + // A present element; a hole or an index past the end may still be inherited. + if ( + typeof lhs === "number" && + lhs >= 0 && + (lhs | 0) === lhs && + rhs instanceof ArrCtor && + lhs in rhs.items + ) { + regs[sp - 1] = true pc++ continue } @@ -1594,7 +1612,7 @@ export class Vm { } private execToKey(frame: Frame, v: Value, pc: number, sp: number): boolean { - if (!(v instanceof Obj) || isOpaque(v)) { + if (!(v instanceof Obj)) { frame.regs[sp - 1] = coerceToString(v) return false } @@ -1713,7 +1731,10 @@ export class Vm { return this.execConstruct(frame, parent, args, callSiteOf(frame, pc), regs[bx] as Fn) } if (!(parent instanceof Fn) || parent.klass === undefined) { - throw typeError(`Super constructor ${describeValue(parent)} of anonymous class is not a constructor`, frame.code.siteAt(pc)) + throw typeError( + `Super constructor ${describeValue(parent)} of anonymous class is not a constructor`, + frame.code.siteAt(pc), + ) } return this.constructClass(frame, parent, args, callSiteOf(frame, pc), regs[bx] as Fn) } @@ -1915,7 +1936,7 @@ export class Vm { const fcode = frame.code frame.pc = pc frame.sp = sp - if (v instanceof Obj && !isOpaque(v)) { + if (v instanceof Obj) { frame.sp = sp - 1 this.pushInternalCall(helper, [flag, v], fcode.siteAt(pc) ?? frame.origin) return true @@ -1935,7 +1956,7 @@ export class Vm { } private execToStringSlow(frame: Frame, flag: number, v: Value, pc: number, sp: number): boolean { - if (flag === 1 || !(v instanceof Obj) || isOpaque(v)) { + if (flag === 1 || !(v instanceof Obj)) { frame.regs[sp - 1] = coerceToString(v) return false } @@ -2066,7 +2087,7 @@ export class Vm { } frame.pc = pc const base = sp - n - const callee = regs[base - 1] as Builtin | Fn + const callee = this.constructible(frame, regs[base - 1] as Value, pc, sp) const args = regs.slice(base, sp) as Array frame.sp = base - 1 if (callee instanceof Fn) return this.constructClass(frame, callee, args, callSiteOf(frame, pc)) @@ -2075,14 +2096,22 @@ export class Vm { private execNewSpread(frame: Frame, pc: number, sp: number): number { const regs = frame.regs - const argsArr = regs[--sp] as Arr - const callee = regs[--sp] as Builtin | Fn frame.pc = pc - frame.sp = sp + const callee = this.constructible(frame, regs[sp - 2] as Value, pc, sp) + const argsArr = regs[--sp] as Arr + frame.sp = --sp if (callee instanceof Fn) return this.constructClass(frame, callee, [...argsArr.items], callSiteOf(frame, pc)) return this.execConstruct(frame, callee, [...argsArr.items], callSiteOf(frame, pc)) } + // IsConstructor, checked once the arguments are evaluated: a class, or a built-in that constructs. + private constructible(frame: Frame, callee: Value, pc: number, sp: number): Builtin | Fn { + if (callee instanceof Fn && callee.klass !== undefined) return callee + if (callee instanceof Builtin && callee.construct !== undefined) return callee + frame.sp = sp + throw notConstructible(callee, frame.code.siteAt(pc) as NewExpression) + } + // `new C(...)`, or `super(...)` for `newTarget`, runs C's constructor (`Mode.CONSTRUCT`): a base class's on a new // instance of `newTarget.prototype`; a derived class's with `newTarget` as its `this` until `super()` binds one. private constructClass( @@ -2096,7 +2125,14 @@ export class Vm { const proto = get(newTarget, "prototype") const self = ctor.klass!.derived ? newTarget : new Obj(proto instanceof Obj ? proto : this.ctx.builtins.Object) // A derived constructor's frame holds its new target until `super()` binds `this`. - this.pushFn(ctor, self, args, site ?? callerFrame.origin, Mode.CONSTRUCT, ctor.klass!.derived ? newTarget : undefined) + this.pushFn( + ctor, + self, + args, + site ?? callerFrame.origin, + Mode.CONSTRUCT, + ctor.klass!.derived ? newTarget : undefined, + ) this.fuel-- return 1 } @@ -2362,11 +2398,13 @@ export class Vm { } childCells = arr } - const fn = new Fn(this.ctx.builtins.Function, childCode, childCells) - if ((childCode.flags & CodeFlags.GENERATOR) !== 0) { - const isAsync = (childCode.flags & CodeFlags.ASYNC) !== 0 - define(fn, "prototype", new Obj(isAsync ? this.ctx.builtins.AsyncGenerator : this.ctx.builtins.Generator), hidden) + const builtins = this.ctx.builtins + const isAsync = (childCode.flags & CodeFlags.ASYNC) !== 0 + if ((childCode.flags & CodeFlags.GENERATOR) === 0) { + return new Fn(isAsync ? builtins.AsyncFunction : builtins.Function, childCode, childCells) } + const fn = new Fn(isAsync ? builtins.AsyncGeneratorFunction : builtins.GeneratorFunction, childCode, childCells) + define(fn, "prototype", new Obj(isAsync ? builtins.AsyncGenerator : builtins.Generator), hidden) return fn } @@ -2473,7 +2511,7 @@ export class Vm { const site = frame.code.siteAt(pc)! const memberNode = site as MemberExpression if (mode !== 2) requireMemberBase(memberNode, o, keyVal) - if (keyVal instanceof Obj && !isOpaque(keyVal)) { + if (keyVal instanceof Obj) { frame.sp = sp - 2 this.pushInternalCall("$vmGetElem", [o, keyVal], memberNode.property ?? site) return GETTER_ENTERED @@ -2515,6 +2553,14 @@ export class Vm { return true } + // ArraySetLength converts an object through its own valueOf/toString: `[o, v] -> [v]` once the prelude has set it. + private execSetLength(frame: Frame, o: Value, v: Value, pc: number, sp: number): boolean { + if (!(o instanceof Arr) || !(v instanceof Obj)) return false + frame.sp = sp - 1 + this.pushInternalCall("$vmSetLength", [o, v], frame.code.siteAt(pc) ?? frame.origin) + return true + } + // A write to a primitive's property: only an inherited setter can take it (with the primitive as `this`). private primitiveSetter(fcode: Code, o: Value, key: PropertyKey, v: Value, pc: number): Callable | undefined { const site = fcode.siteAt(pc)! @@ -2540,6 +2586,13 @@ export class Vm { private execDeleteProp(fcode: Code, o: Value, key: PropertyKey, pc: number): boolean { const site = fcode.siteAt(pc)! const ref = this.resolveMember(o, key, site) + // A primitive base deletes from its wrapper, whose only own properties are a string's indexes and length. + if (!(ref instanceof HostNamespace) && !(o instanceof Obj)) { + const index = typeof key === "symbol" ? undefined : parseArrayIndex(key) + const own = typeof o === "string" && (key === "length" || (index !== undefined && index < o.length)) + if (own) throw typeError(`Cannot delete property '${String(key)}' of ${JSON.stringify(o)}.`, site) + return true + } if (ref instanceof HostNamespace || "value" in ref || ref.receiver !== ref.target) { throw invalidData("Only data fields may be deleted.", site) } @@ -2550,7 +2603,7 @@ export class Vm { private execDeleteElem(frame: Frame, o: Value, keyVal: Value, pc: number, sp: number): boolean { const site = frame.code.siteAt(pc)! requireMemberBase(site as MemberExpression, o, keyVal) - if (keyVal instanceof Obj && !isOpaque(keyVal)) { + if (keyVal instanceof Obj) { frame.sp = sp - 1 this.pushInternalCall("$vmDeleteElem", [o, keyVal], site) return true @@ -2561,7 +2614,11 @@ export class Vm { } private execCheckBase(fcode: Code, kind: number, bx: number, regs: Array, sp: number, pc: number): void { - const base = regs[kind === CheckBaseKind.READ || kind === CheckBaseKind.WRITE_ELEM ? sp - 2 : sp - 1] as Value + const base = regs[ + kind === CheckBaseKind.READ || kind === CheckBaseKind.WRITE_ELEM || kind === CheckBaseKind.ASSIGN_PROP + ? sp - 2 + : sp - 1 + ] as Value if (base instanceof Obj && !(base instanceof PromiseObj)) return const site = fcode.siteAt(pc)! if (kind === CheckBaseKind.DESTRUCTURE) { @@ -2575,7 +2632,7 @@ export class Vm { requireMemberBase(memberNode, base, regs[sp - 1] as Value) return } - const key = kind === CheckBaseKind.WRITE_PROP ? (fcode.consts[bx] as string) : propertyKey(regs[sp - 1] as Value) + const key = kind === CheckBaseKind.WRITE_ELEM ? propertyKey(regs[sp - 1] as Value) : (fcode.consts[bx] as string) const ref = this.resolveMember(base, key, site) // A primitive's inherited accessor takes the write (see `primitiveSetter`); the base is all that's checked here. if (!(ref instanceof HostNamespace) && !("value" in ref) && ref.receiver !== ref.target) { @@ -2611,7 +2668,7 @@ export class Vm { } const fcode = frame.code const site = fcode.siteAt(pc) ?? frame.origin - if (v instanceof Obj && !isOpaque(v)) { + if (v instanceof Obj) { frame.sp = sp - 1 this.pushInternalCall("$vmUnary", [sub, v], site) return true @@ -3185,6 +3242,7 @@ export class Vm { case Op.PUT_PROP: { const v = regs[--sp] as Value frame.sp = sp + if (consts[bx] === "length" && this.execSetLength(frame, regs[sp - 1] as Value, v, pc, sp)) return -1 if (this.execPutProp(frame, regs[sp - 1] as Value, consts[bx] as string, v, pc, sp)) return -1 regs[sp - 1] = v return pc + 1 @@ -3193,6 +3251,7 @@ export class Vm { const v = regs[--sp] as Value const keyVal = regs[--sp] as Value frame.sp = sp + if (keyVal === "length" && this.execSetLength(frame, regs[sp - 1] as Value, v, pc, sp)) return -1 if (this.execPutProp(frame, regs[sp - 1] as Value, propertyKey(keyVal), v, pc, sp)) return -1 regs[sp - 1] = v return pc + 1 diff --git a/packages/codemode/test/array-callbacks-test262.test.ts b/packages/codemode/test/array-callbacks-test262.test.ts index 4dd980095165d..1a4effed8f7e3 100644 --- a/packages/codemode/test/array-callbacks-test262.test.ts +++ b/packages/codemode/test/array-callbacks-test262.test.ts @@ -380,6 +380,23 @@ describe("Array callback regressions", () => { ).toEqual(["TypeError", "TypeError"]) }) + test("a hole reads an index inherited from Array.prototype", async () => { + expect( + await value(` + Array.prototype[1] = "inherited" + try { + const holes = [0, , 2] + const seen = [] + holes.forEach((item) => seen.push(item)) + const index = 1 + return [seen, index in holes, 1 in holes, [, ,].reduce((a, b) => a + b), Object.hasOwn(holes, 1)] + } finally { + delete Array.prototype[1] + } + `), + ).toEqual([[0, "inherited", 2], true, true, "inherited", false]) + }) + test("findLast returns the value observed before predicate mutation", async () => { expect( await value(` diff --git a/packages/codemode/test/errors.test.ts b/packages/codemode/test/errors.test.ts index f854da48c6535..66a7fc86ce9ea 100644 --- a/packages/codemode/test/errors.test.ts +++ b/packages/codemode/test/errors.test.ts @@ -98,9 +98,20 @@ describe("error identity", () => { }) }) +describe("AggregateError", () => { + test("has an own message only when one is given", async () => { + expect( + await value(` + const own = (error) => Object.hasOwn(error, "message") + return [own(new AggregateError([])), own(new AggregateError([], undefined)), own(new AggregateError([], "m")), new AggregateError([]).message] + `), + ).toEqual([false, false, true, ""]) + }) +}) + describe("rethrown interpreter failures", () => { test("keep their diagnostic kind and source location", async () => { - const failure = await error(`try { Symbol + 1 } catch (e) { throw e }`) + const failure = await error(`try { Promise.resolve(1) + 1 } catch (e) { throw e }`) expect(failure.kind).toBe("InvalidDataValue") expect(failure.message).toStartWith("TypeError: Binary operators require data values. (line ") expect(failure.location).toBeDefined() diff --git a/packages/codemode/test/language.test.ts b/packages/codemode/test/language.test.ts index c5d12d0edf9e3..f34d1f91e4703 100644 --- a/packages/codemode/test/language.test.ts +++ b/packages/codemode/test/language.test.ts @@ -363,3 +363,62 @@ describe("translate", () => { expect(calls).toEqual([[{ n: 7 }]]) }) }) + +describe("runtime.compile", () => { + const runtime = Runtime.make({ globals: () => ({ twice: Host.fn((args) => Number(args[0]) * 2) }) }) + const compiled = (code: string) => { + const result = runtime.compile(code) + if (!result.ok) throw new Error(`expected a compiled program, got ${result.error.message}`) + return result.compiled + } + + test("a compiled program runs as its source does, again and at once, with each run's bindings", async () => { + const code = `let n = 0; for (const x of xs) n += twice(x); return [n, typeof seen]` + const program = compiled(code) + const runs = [[1], [2, 3], [4, 5, 6]].map((xs) => runtime.execute(program, { bindings: { xs } })) + const results = await Promise.all(runs.map((run) => Effect.runPromise(run))) + expect(results.map((result) => (result.ok ? result.value : result.error))).toEqual([ + [2, "undefined"], + [10, "undefined"], + [30, "undefined"], + ]) + expect(await Effect.runPromise(runtime.execute(program, { bindings: { xs: [7] } }))).toEqual( + await Effect.runPromise(runtime.execute(code, { bindings: { xs: [7] } })), + ) + }) + + test("compiling gives the diagnostic a run would fail with first; unsupported syntax still fails where it runs", async () => { + for (const code of [" ", "return (", "export const x = 1"]) { + const result = runtime.compile(code) + if (result.ok) throw new Error(`expected ${JSON.stringify(code)} not to compile`) + expect(await run(runtime, code)).toEqual({ ok: false, error: result.error, metadata: null }) + } + const unsupported = `const a = 1; class A {}` + expect(await Effect.runPromise(runtime.execute(compiled(unsupported)))).toEqual(await run(runtime, unsupported)) + }) + + test("a state saved from a compiled program is its source's, and resumes like it", async () => { + const gate = latch() + const waiting = latch() + const durable = Runtime.make({ + globals: () => ({ + wait: Host.fn( + () => Effect.andThen(Effect.sync(waiting.resolve), Effect.promise(() => gate.promise)), + { type: "async", idempotent: true }, + ), + }), + }) + const code = `const a = 20; await wait(); return a + 22` + const result = durable.compile(code) + if (!result.ok) throw new Error(result.error.message) + const program = durable.program(result.compiled, { runId: "c" }) + const fiber = Effect.runFork(program.run()) + await waiting.promise + const suspended = await Effect.runPromise(program.suspend()) + if (suspended.ok !== "suspended") throw new Error("expected a suspended run") + await Effect.runPromise(Fiber.join(fiber)) + expect(suspended.state.header.sources.map((source) => source.code)).toEqual([code]) + gate.resolve() + expect(await Effect.runPromise(durable.resume(toBytes(suspended.state)).run())).toMatchObject({ ok: true, value: 42 }) + }) +}) diff --git a/packages/codemode/test/new-expression.test.ts b/packages/codemode/test/new-expression.test.ts index 87f5a27a2cffc..d8213ab4cb6ae 100644 --- a/packages/codemode/test/new-expression.test.ts +++ b/packages/codemode/test/new-expression.test.ts @@ -58,6 +58,18 @@ describe("new on a non-constructible callee", () => { ) }) + test("the arguments are evaluated before the callee is checked", async () => { + expect( + await value(` + let x = 1 + const seen = [] + try { new x(x = Date, seen.push("argument")) } catch (error) { seen.push(error.name) } + try { new Number(...missing) } catch (error) { seen.push(error.name) } + return [seen, x === Date] + `), + ).toEqual([["argument", "TypeError", "ReferenceError"], true]) + }) + test("the failure is a catchable TypeError", async () => { expect( await value(` diff --git a/packages/codemode/test/parity.test.ts b/packages/codemode/test/parity.test.ts index 9bb86ace48790..dfa7f0b3ed44c 100644 --- a/packages/codemode/test/parity.test.ts +++ b/packages/codemode/test/parity.test.ts @@ -231,6 +231,18 @@ describe("property deletion", () => { ).toEqual([[true, true, true, true, true], true, "TypeError"]) }) + test("a primitive base deletes from its wrapper: only a string's indexes and length are own", async () => { + expect( + await value(` + const failures = [] + for (const remove of [() => delete "abc"[0], () => delete "abc".length]) { + try { remove() } catch (error) { failures.push(error.name) } + } + return [delete "abc"[3], delete "abc".foo, delete (1).x, delete true.y, delete void typeof 0, failures] + `), + ).toEqual([true, true, true, true, true, ["TypeError", "TypeError"]]) + }) + test("evaluates computed object and key expressions once", async () => { expect( await value(` @@ -919,11 +931,12 @@ describe("coercion parity: String method arguments coerce like native JS", () => expect(await value(`try { "abc".endsWith(/a/) } catch (e) { return e.name }`)).toBe("TypeError") }) - test("opaque runtime references still reject as data errors", async () => { - const err = await error(`const f = () => 1; return "abc".includes(f)`) - expect(err.message).toContain("data value") - const replacerErr = await error(`const f = () => 1; return "a".replace(f, () => "x")`) - expect(replacerErr.message).toContain("data value") + test("functions convert like other objects, while promises and tool references still reject", async () => { + expect( + await value(`const f = () => 1; f.toString = () => "b"; return ["abc".includes(f), "a".replace(f, "x")]`), + ).toEqual([true, "a"]) + expect((await error(`return "abc".includes(Promise.resolve("b"))`)).message).toContain("data value") + expect((await error(`return "a".replace(tools.nowhere, () => "x")`)).message).toContain("data value") }) }) @@ -953,8 +966,9 @@ describe("coercion parity: ++ and -- use CodeMode numeric coercion", () => { expect(await value(`const o = { a: {} }; o.a++; return Number.isNaN(o.a)`)).toBe(true) }) - test("opaque runtime references reject with a clear error", async () => { - const err = await error(`let f = () => 1; f++`) + test("functions become NaN, and promises reject with a clear error", async () => { + expect(await value(`let f = () => 1; f++; return Number.isNaN(f)`)).toBe(true) + const err = await error(`let p = Promise.resolve(1); p++`) expect(err.message).toContain("data value") }) }) @@ -1199,15 +1213,23 @@ describe("loose equality and operator gates on opaque references", () => { ).toEqual([false, true, false, true, false, false, false, false, false, true]) }) - test("coercing an opaque reference against a non-nullish primitive still rejects", async () => { - expect((await error(`const fn = () => 1; return fn == 1`)).message).toContain( - "Binary operators require data values", - ) - expect((await error(`const fn = () => 1; return fn + ""`)).message).toContain( + test("a function facing a primitive converts; a promise or tool reference still rejects", async () => { + expect( + await value(` + const fn = () => 1 + const one = () => 2 + one.valueOf = () => 1 + let inc = fn + inc++ + return [fn == 1, fn + "", -fn, Number.isNaN(inc), one == 1, fn == "[object Function]"] + `), + ).toEqual([false, "[object Function]", null, true, true, true]) + expect((await error(`const p = Promise.resolve(1); return p == 1`)).message).toContain( "Binary operators require data values", ) - expect((await error(`const fn = () => 1; return -fn`)).message).toContain("Unary operators require data values") - expect((await error(`let fn = () => 1; fn++`)).message).toContain("'++' requires a data value") + expect((await error(`return tools.nowhere + ""`)).message).toContain("Binary operators require data values") + expect((await error(`return -Promise.resolve(1)`)).message).toContain("Unary operators require data values") + expect((await error(`let p = Promise.resolve(1); p++`)).message).toContain("'++' requires a data value") }) test("switch and Object.is match opaque references by identity", async () => { @@ -1571,15 +1593,15 @@ describe("this, arguments, and Function.prototype.call/apply/bind", () => { }) describe("ToPrimitive: operators and conversions honor program valueOf and toString", () => { - test("program-installed valueOf and toString on opaque values are ignored at every site", async () => { + test("program-installed valueOf and toString on functions are honored at every site", async () => { expect( await value(` const f = () => 1 f.toString = () => "custom" f.valueOf = () => 5 - return [String(f), \`\${f}\`, [f].join(), new Error(f).message, isNaN(Number(f)), isNaN(Math.abs(f))] + return [String(f), \`\${f}\`, [f].join(), new Error(f).message, Number(f), Math.abs(f), f + 1, ({ custom: 2 })[f]] `), - ).toEqual(["[object Function]", "[object Function]", "[object Function]", "[object Function]", true, true]) + ).toEqual(["custom", "custom", "custom", "custom", 5, 5, 6, 2]) }) test("== converts an object facing a non-nullish primitive through its own valueOf", async () => { @@ -1589,7 +1611,7 @@ describe("ToPrimitive: operators and conversions honor program valueOf and toStr return [one == 1, 1 == one, one == true, one == "1", one == null, one == one, one == { valueOf() { return 1 } }, [1] == 1] `), ).toEqual([true, true, true, true, false, true, false, true]) - expect((await error(`(() => 1) == 1`)).message).toContain("Binary operators require data values") + expect((await error(`Promise.resolve(1) == 1`)).message).toContain("Binary operators require data values") }) test("operators, unary, template literals, and conversion functions use the object's own methods", async () => { @@ -1679,9 +1701,10 @@ describe("ToPrimitive: operators and conversions honor program valueOf and toStr ).toEqual([5, 6, 6, 6]) }) - test("functions and other opaque values still reject arithmetic, and an object without a primitive form throws", async () => { - expect((await error(`const f = () => 1; return f + 1`)).message).toContain("Binary operators require data values") - expect((await error(`return -(() => 1)`)).message).toContain("Unary operators require data values") + test("promises and tool references still reject arithmetic, and an object without a primitive form throws", async () => { + expect(await value(`const f = () => 1; return [f + 1, -(() => 1)]`)).toEqual(["[object Function]1", null]) + expect((await error(`return Promise.resolve(1) + 1`)).message).toContain("Binary operators require data values") + expect((await error(`return -tools.nowhere`)).message).toContain("Unary operators require data values") const failure = await error(`return { valueOf() { return {} }, toString() { return [] } } + 1`) expect(failure.message).toContain("Cannot convert object to primitive value") }) @@ -1823,6 +1846,17 @@ describe("computed property keys convert through the object's own toString", () ) }) + test("a nullish base in o.x = v throws once the right side is evaluated, as PutValue checks it", async () => { + expect( + await value(` + let count = 0 + let failure + try { const base = null; base.prop = count += 1 } catch (error) { failure = error.name } + return [count, failure] + `), + ).toEqual([1, "TypeError"]) + }) + test("a nullish base throws before the key converts, as ToObject precedes ToPropertyKey", async () => { const failure = await error(`const base = null; base[{ toString() { throw new RangeError("key evaluated") } }]`) expect(failure.message).toContain("Cannot read properties of null") @@ -1841,6 +1875,45 @@ describe("computed property keys convert through the object's own toString", () }) }) +describe("Array method arguments, lengths, and elements convert through ToPrimitive", () => { + test("integer arguments use the object's own valueOf, in order, before the method reads the array", async () => { + expect( + await value(` + const n = (value) => ({ valueOf() { return value } }) + const log = [] + const at = (value) => ({ valueOf() { log.push(value); return value } }) + const items = [0, 1, 2, 3, 4] + const live = [1, 2, 3] + const removed = { valueOf() { live.length = 1; return 0 } } + return [items.at(n(1)), items.indexOf(3, n(2)), items.lastIndexOf(1, n(0)), items.includes(0, n(1)), + items.slice(n(1), n(3)), [0, 0, 0].fill(7, n(1), n(2)), [...items].splice(at(1), at(2)), log, + items.with(n(0), "x")[0], items.flat(n(0)).length, live.indexOf(2, removed)] + `), + ).toEqual([1, 3, -1, false, [1, 2], [0, 7, 0], [1, 2], [1, 2], "x", 5, -1]) + }) + + test("conversion failures surface, and an empty array answers before fromIndex converts", async () => { + expect((await error(`[1].at({ valueOf() { throw new RangeError("at") } })`)).message).toContain("at") + expect((await error(`[1].fill(0, { valueOf() { return {} }, toString() { return {} } })`)).message).toContain( + "Cannot convert object to primitive value", + ) + expect(await value(`return [].indexOf(1, { valueOf() { throw new Error("never") } })`)).toBe(-1) + }) + + test("length = object converts through valueOf, and a default sort converts each element through toString", async () => { + expect( + await value(` + const resized = [1, 2, 3] + resized.length = { valueOf() { return 1 } } + let calls = 0 + const named = (name) => ({ name, toString() { calls++; return name } }) + const sorted = [named("c"), named("a"), 2, undefined, named("b")].sort() + return [resized, sorted.map((item) => item?.name ?? item), calls] + `), + ).toEqual([[1], [2, "a", "b", "c", null], 3]) + }) +}) + describe("String and Number method arguments convert through ToPrimitive", () => { test("string positions use the string hint and numeric positions the number hint", async () => { expect( @@ -1920,6 +1993,17 @@ describe("String and Number method arguments convert through ToPrimitive", () => ]) }) + test("fromCharCode, fromCodePoint, JSON.parse, and the string iterator convert objects; repeat counts NaN as 0", async () => { + expect( + await value(` + const n = (value) => ({ valueOf() { return value } }) + const text = (value) => ({ toString() { return value } }) + return [String.fromCharCode(n(65), "66"), String.fromCodePoint(n(31)), JSON.parse(text("[1]")), + [...String.prototype[Symbol.iterator].call(text("xy"))], "ab".repeat(NaN), "ab".repeat(0.9)] + `), + ).toEqual(["AB", "\x1f", [1], ["x", "y"], "", ""]) + }) + test("conversion failures surface and opaque arguments still reject", async () => { expect((await error(`"abc".indexOf({ toString() { throw new RangeError("intostr") } })`)).message).toContain( "intostr", diff --git a/packages/codemode/test/promise.test.ts b/packages/codemode/test/promise.test.ts index f0a1740edb6bf..22eb1cf0f5ede 100644 --- a/packages/codemode/test/promise.test.ts +++ b/packages/codemode/test/promise.test.ts @@ -1169,6 +1169,14 @@ describe("Promise.withResolvers", () => { `), ).toEqual([["promise", "resolve", "reject"], true, "adopted", "no"]) }) + + test("its resolving functions are anonymous, with length 1", async () => { + expect( + await value( + `const { resolve, reject } = Promise.withResolvers(); return [resolve.name, resolve.length, reject.name]`, + ), + ).toEqual(["", 1, ""]) + }) }) describe("Promise.any", () => { diff --git a/packages/codemode/test/resumable.test.ts b/packages/codemode/test/resumable.test.ts index f24e32fd1b1ac..bf738c6e999e5 100644 --- a/packages/codemode/test/resumable.test.ts +++ b/packages/codemode/test/resumable.test.ts @@ -171,9 +171,9 @@ describe("natives only at intrinsic creation", () => { "function", [1, 2, 3, 4], "bound bound add", - "resolve", + "", 1, - "reject", + "", "function", 5, ["", 1, "function"], diff --git a/packages/codemode/test/search-generators.test.ts b/packages/codemode/test/search-generators.test.ts new file mode 100644 index 0000000000000..f4b71582dfbbb --- /dev/null +++ b/packages/codemode/test/search-generators.test.ts @@ -0,0 +1,127 @@ +import { describe, expect, test } from "bun:test" +import { Effect, Fiber, Schema } from "effect" +import { CodeMode, Tool } from "../src/index.js" + +// `search(...)` blocks: when its input has to be awaited first, the run parks until it crossed, and the program goes +// on as if search had answered synchronously. Inside a running sync generator that park takes the generator and the +// frames that drive it, up to the nearest async function or the program. + +const echo = Tool.make({ + description: "Echoes an id", + input: Schema.Struct({ id: Schema.Number }), + output: Schema.Number, + execute: ({ id }) => Effect.succeed(id), +}) + +/** Runs `body` with `S()` searching through an awaited input, and again with a plain one, which never parks. */ +const both = async (body: string) => { + const runtime = CodeMode.make({ tools: { echo } }) + const run = (query: string) => + Effect.runPromise(runtime.execute(`const S = () => search({ query: ${query} }).items.length\n${body}`)) + const [parked, plain] = await Promise.all([run(`Promise.resolve("echo")`), run(`"echo"`)]) + expect(parked).toEqual(plain) + return parked +} + +describe("search inside a running sync generator", () => { + test("a direct next() gets the generator's step, and the generator goes on", async () => { + const outcome = await both(` + function* g() { const a = S(); yield a; yield a + 1 } + const it = g() + return [it.next(), it.next(), it.next()]`) + expect(outcome).toMatchObject({ + ok: true, + value: [ + { value: 1, done: false }, + { value: 2, done: false }, + { done: true }, + ], + }) + }) + + test("for...of", async () => { + const outcome = await both(` + function* g() { yield S(); yield S() + 1; return 9 } + const out = [] + for (const x of g()) out.push(x) + return out`) + expect(outcome).toMatchObject({ ok: true, value: [1, 2] }) + }) + + test("spread", async () => { + const outcome = await both(`function* g() { yield S(); yield 5; yield S() } return [...g()]`) + expect(outcome).toMatchObject({ ok: true, value: [1, 5, 1] }) + }) + + test("nested generators and a sync function between them", async () => { + const outcome = await both(` + function* inner() { yield S(); yield S() * 10 } + const first = () => inner().next().value + function* outer() { yield* inner(); yield first() + 100; for (const x of inner()) yield x + 1000 } + return [...outer()]`) + expect(outcome).toMatchObject({ ok: true, value: [1, 10, 101, 1001, 1010] }) + }) + + test("inside an async function", async () => { + const outcome = await both(` + function* g() { yield S(); yield S() + 1 } + async function f() { const it = g(); const a = it.next().value; await null; return [a, it.next().value, [...g()]] } + return await f()`) + expect(outcome).toMatchObject({ ok: true, value: [1, 2, [1, 2]] }) + }) + + test("at top level, queued jobs wait for the search, as they do around a search outside a generator", async () => { + const runtime = CodeMode.make({ tools: { echo } }) + const outcome = await Effect.runPromise( + runtime.execute(` + const log = [] + Promise.resolve().then(() => log.push("job")) + function* g() { log.push("before"); yield search({ query: Promise.resolve("echo") }).items.length; log.push("after") } + const it = g() + log.push(it.next().value) + it.next() + log.push("sync") + return log`), + ) + expect(outcome).toMatchObject({ ok: true, value: ["before", 1, "after", "sync"] }) + }) + + test("a throw from the search's input reaches the generator, then its caller", async () => { + const runtime = CodeMode.make({ tools: { echo } }) + const outcome = await Effect.runPromise( + runtime.execute(` + function* g() { try { yield search({ query: Promise.reject(new Error("no")) }) } finally { yield "cleanup" } } + const it = g() + const out = [] + try { out.push(it.next().value); out.push(it.next().value) } catch (e) { out.push(e.message) } + out.push(it.next().done) + return out`), + ) + expect(outcome).toMatchObject({ ok: true, value: ["cleanup", "no", true] }) + }) + + test("a run suspended while a generator is parked resumes where it was", async () => { + let resumed = false + let started!: () => void + const waiting = new Promise((done) => (started = done)) + const wait = Tool.make({ + description: "Answers once the run resumed", + input: Schema.Struct({}), + output: Schema.Number, + execute: Tool.idempotent(() => (resumed ? Effect.succeed(1) : Effect.callback(() => started()))), + }) + const runtime = CodeMode.make({ tools: { echo, wait } }) + const program = runtime.program(` + function* g() { yield search({ query: tools.wait({}).then(() => "echo") }).items.length; yield 7 } + const caller = (it) => [it.next().value, it.next().value, it.next().done] + return caller(g())`) + const fiber = Effect.runFork(program.run()) + await waiting + const suspended = await Effect.runPromise(program.suspend()) + await Effect.runPromise(Fiber.join(fiber)) + if (suspended.ok !== "suspended") throw new Error("expected a suspended run") + resumed = true + const outcome = await Effect.runPromise(runtime.resume(CodeMode.toBytes(suspended.state)).run()) + expect(outcome).toMatchObject({ ok: true, value: [1, 7, true] }) + }) +}) diff --git a/packages/codemode/test/stdlib.test.ts b/packages/codemode/test/stdlib.test.ts index 43db658dda970..641dd95b774b5 100644 --- a/packages/codemode/test/stdlib.test.ts +++ b/packages/codemode/test/stdlib.test.ts @@ -969,6 +969,13 @@ describe("Map", () => { }) describe("Set", () => { + test("keys is the same function as values", async () => { + expect(await value(`return [Set.prototype.keys === Set.prototype.values, Set.prototype.keys.name]`)).toEqual([ + true, + "values", + ]) + }) + test("forEach is live on Map and Set: deleted entries are skipped and added ones visited", async () => { expect( await value(` @@ -1562,7 +1569,18 @@ describe("built-in iterators", () => { ]) const logged = await run(`console.log([1].keys()); return null`) expect(logged.logs?.[0]).toBe("[opaque reference]") - expect((await error(`return [1].keys() + ""`)).message).toContain("Binary operators require data values") + expect( + await value( + `return [[1].keys(), "a"[Symbol.iterator](), new Map().entries(), new Set().values(), new Headers().keys(), new URLSearchParams().keys()].map(String)`, + ), + ).toEqual([ + "[object Array Iterator]", + "[object String Iterator]", + "[object Map Iterator]", + "[object Set Iterator]", + "[object Headers Iterator]", + "[object URLSearchParams Iterator]", + ]) expect((await error(`return [1].keys().next.call({})`)).message).toContain( "Iterator.prototype.next called on incompatible receiver a data object", ) @@ -1587,7 +1605,7 @@ describe("Object.prototype.toString", () => { "[object Set]", "[object Headers]", "[object Promise]", - "[object Iterator]", + "[object Array Iterator]", "[object Object]", "[object Map]", "[object Promise]", diff --git a/packages/codemode/test/test262/skipped.txt b/packages/codemode/test/test262/skipped.txt index c88f580d829ff..25b33a0e99076 100644 --- a/packages/codemode/test/test262/skipped.txt +++ b/packages/codemode/test/test262/skipped.txt @@ -1,4 +1,3 @@ -built-ins/AggregateError/message-undefined-no-prop.js # explicit Expected SameValue(«true», «false») to be true built-ins/Array/S15.4.5.2_A3_T3.js # RangeError: Invalid array length built-ins/Array/from/Array.from_forwards-length-for-array-likes.js # TypeError: Cannot read properties of undefined (reading '…'). built-ins/Array/from/elements-deleted-after.js # TypeError: Cannot read properties of undefined (reading '…'). @@ -13,7 +12,6 @@ built-ins/Array/isArray/15.4.3.2-2-1.js # TypeError: Con is not a constructor: built-ins/Array/isArray/15.4.3.2-2-2.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call built-ins/Array/length/15.4.5.1-3.d-3.js # RangeError: Invalid array length built-ins/Array/length/S15.4.2.2_A2.1_T1.js # RangeError: Invalid array length. -built-ins/Array/length/S15.4.5.1_A1.3_T2.js # RangeError: Invalid array length built-ins/Array/length/define-own-prop-length-error.js # Expected a RangeError but got a TypeError built-ins/Array/length/define-own-prop-length-overflow-order.js # Object.defineProperty([], "length", {value: -1, configurable: true}) throws a RangeError exception E built-ins/Array/of/construct-this-with-the-number-of-arguments.js # The value of len is expected to be 0 Expected SameValue(«undefined», «0») to be true @@ -23,7 +21,6 @@ built-ins/Array/of/return-abrupt-from-contructor.js # Array.of.call(T) throws a built-ins/Array/of/return-abrupt-from-data-property.js # Array.of.call(T1, "Bob") throws a TypeError exception Expected a TypeError to be thrown but no excep built-ins/Array/of/return-abrupt-from-setting-length.js # Array.of.call(T) throws a Test262Error exception Expected a Test262Error to be thrown but no excepti built-ins/Array/of/sets-length.js # The value of hits is expected to be 1 Expected SameValue(«0», «1») to be true -built-ins/Array/prototype/at/index-argument-tointeger.js # a.at({valueOf() {valueOfCallCount++; return 1;}}) must return 1 Expected SameValue(«0», «1») to be t built-ins/Array/prototype/concat/Array.prototype.concat_non-array.js # TypeError: Array.prototype.concat called on incompatible receiver a data object. built-ins/Array/prototype/concat/S15.4.4.4_A2_T1.js # TypeError: Array.prototype.concat called on incompatible receiver a data object. built-ins/Array/prototype/concat/S15.4.4.4_A2_T2.js # TypeError: Array.prototype.concat called on incompatible receiver a data object. @@ -35,13 +32,10 @@ built-ins/Array/prototype/concat/create-ctor-non-object.js # a.concat() throws built-ins/Array/prototype/concat/create-ctor-poisoned.js # a.concat() throws a Test262Error exception Expected a Test262Error to be thrown but no exception was built-ins/Array/prototype/concat/create-non-array.js # TypeError: Array.prototype.concat called on incompatible receiver a data object. built-ins/Array/prototype/copyWithin/call-with-boolean.js # TypeError: Array.prototype.copyWithin called on incompatible receiver a boolean. -built-ins/Array/prototype/copyWithin/coerced-values-start-change-target.js # Actual [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 +built-ins/Array/prototype/copyWithin/coerced-values-start-change-target.js # Actual [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] and expected [0, 1, 2, built-ins/Array/prototype/copyWithin/length-near-integer-limit.js # TypeError: Array.prototype.copyWithin called on incompatible receiver a data object. -built-ins/Array/prototype/copyWithin/return-abrupt-from-end.js # Expected a Test262Error to be thrown but no exception was thrown at all built-ins/Array/prototype/copyWithin/return-abrupt-from-get-start-value.js # Expected a Test262Error but got a TypeError built-ins/Array/prototype/copyWithin/return-abrupt-from-set-target-value.js # Expected a Test262Error but got a TypeError -built-ins/Array/prototype/copyWithin/return-abrupt-from-start.js # Expected a Test262Error to be thrown but no exception was thrown at all -built-ins/Array/prototype/copyWithin/return-abrupt-from-target.js # Expected a Test262Error to be thrown but no exception was thrown at all built-ins/Array/prototype/copyWithin/return-abrupt-from-this-length.js # Expected a Test262Error but got a TypeError built-ins/Array/prototype/copyWithin/return-this.js # TypeError: Array.prototype.copyWithin called on incompatible receiver a data object. built-ins/Array/prototype/entries/returns-iterator-from-object.js # TypeError: Array.prototype.entries called on incompatible receiver a data object. @@ -101,7 +95,6 @@ built-ins/Array/prototype/every/15.4.4.16-4-8.js # accessed !== true built-ins/Array/prototype/every/15.4.4.16-4-9.js # accessed !== true built-ins/Array/prototype/every/15.4.4.16-5-4.js # TypeError: Cannot read properties of undefined (reading '…'). built-ins/Array/prototype/every/15.4.4.16-5-5.js # TypeError: foo is not a constructor: only classes can be constructed with new. Use a class, or call -built-ins/Array/prototype/every/15.4.4.16-7-6.js # res Expected SameValue(«true», «false») to be true built-ins/Array/prototype/every/15.4.4.16-7-8.js # TypeError: Array.prototype.every called on incompatible receiver a data object. built-ins/Array/prototype/every/15.4.4.16-7-9.js # TypeError: Array.prototype.every called on incompatible receiver a data object. built-ins/Array/prototype/every/15.4.4.16-7-b-10.js # TypeError: Array.prototype.every called on incompatible receiver a data object. @@ -143,7 +136,6 @@ built-ins/Array/prototype/every/15.4.4.16-7-c-i-31.js # TypeError: Accessor pro built-ins/Array/prototype/every/15.4.4.16-7-c-i-5.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call built-ins/Array/prototype/every/15.4.4.16-7-c-i-6.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/every/15.4.4.16-7-c-i-7.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call -built-ins/Array/prototype/every/15.4.4.16-7-c-i-8.js # [, , , ].every(callbackfn) Expected SameValue(«true», «false») to be true built-ins/Array/prototype/every/15.4.4.16-7-c-i-9.js # TypeError: Array.prototype.every called on incompatible receiver a data object. built-ins/Array/prototype/every/15.4.4.16-7-c-ii-16.js # TypeError: Array.prototype.every called on incompatible receiver a data object. built-ins/Array/prototype/every/15.4.4.16-7-c-ii-17.js # TypeError: Array.prototype.every called on incompatible receiver a data object. @@ -173,9 +165,7 @@ built-ins/Array/prototype/every/15.4.4.16-8-8.js # TypeError: foo is not a cons built-ins/Array/prototype/every/call-with-boolean.js # TypeError: Array.prototype.every called on incompatible receiver a boolean. built-ins/Array/prototype/fill/call-with-boolean.js # TypeError: Array.prototype.fill called on incompatible receiver a boolean. built-ins/Array/prototype/fill/length-near-integer-limit.js # TypeError: Array.prototype.fill called on incompatible receiver a data object. -built-ins/Array/prototype/fill/return-abrupt-from-end.js # Expected a Test262Error to be thrown but no exception was thrown at all built-ins/Array/prototype/fill/return-abrupt-from-setting-property-value.js # Expected a Test262Error but got a TypeError -built-ins/Array/prototype/fill/return-abrupt-from-start.js # Expected a Test262Error to be thrown but no exception was thrown at all built-ins/Array/prototype/fill/return-abrupt-from-this-length.js # Expected a Test262Error but got a TypeError built-ins/Array/prototype/fill/return-this.js # TypeError: Array.prototype.fill called on incompatible receiver a data object. built-ins/Array/prototype/filter/15.4.4.20-1-10.js # TypeError: Array.prototype.filter called on incompatible receiver a data object. @@ -240,7 +230,6 @@ built-ins/Array/prototype/filter/15.4.4.20-6-5.js # TypeError: foo is not a con built-ins/Array/prototype/filter/15.4.4.20-6-6.js # TypeError: foo is not a constructor: only classes can be constructed with new. Use a class, or call built-ins/Array/prototype/filter/15.4.4.20-6-7.js # TypeError: foo is not a constructor: only classes can be constructed with new. Use a class, or call built-ins/Array/prototype/filter/15.4.4.20-6-8.js # TypeError: foo is not a constructor: only classes can be constructed with new. Use a class, or call -built-ins/Array/prototype/filter/15.4.4.20-9-6.js # resArr.length Expected SameValue(«3», «4») to be true built-ins/Array/prototype/filter/15.4.4.20-9-8.js # TypeError: Array.prototype.filter called on incompatible receiver a data object. built-ins/Array/prototype/filter/15.4.4.20-9-9.js # TypeError: Array.prototype.filter called on incompatible receiver a data object. built-ins/Array/prototype/filter/15.4.4.20-9-b-10.js # TypeError: Array.prototype.filter called on incompatible receiver a data object. @@ -282,7 +271,6 @@ built-ins/Array/prototype/filter/15.4.4.20-9-c-i-31.js # TypeError: Accessor pr built-ins/Array/prototype/filter/15.4.4.20-9-c-i-5.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call built-ins/Array/prototype/filter/15.4.4.20-9-c-i-6.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/filter/15.4.4.20-9-c-i-7.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call -built-ins/Array/prototype/filter/15.4.4.20-9-c-i-8.js # newArr.length Expected SameValue(«0», «1») to be true built-ins/Array/prototype/filter/15.4.4.20-9-c-i-9.js # TypeError: Array.prototype.filter called on incompatible receiver a data object. built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-16.js # TypeError: Array.prototype.filter called on incompatible receiver a data object. built-ins/Array/prototype/filter/15.4.4.20-9-c-ii-17.js # TypeError: Array.prototype.filter called on incompatible receiver a data object. @@ -381,7 +369,6 @@ built-ins/Array/prototype/forEach/15.4.4.18-4-8.js # accessed !== true built-ins/Array/prototype/forEach/15.4.4.18-4-9.js # accessed !== true built-ins/Array/prototype/forEach/15.4.4.18-5-4.js # TypeError: Cannot read properties of undefined (reading '…'). built-ins/Array/prototype/forEach/15.4.4.18-5-5.js # TypeError: foo is not a constructor: only classes can be constructed with new. Use a class, or call -built-ins/Array/prototype/forEach/15.4.4.18-7-5.js # callCnt Expected SameValue(«4», «5») to be true built-ins/Array/prototype/forEach/15.4.4.18-7-8.js # TypeError: Array.prototype.forEach called on incompatible receiver a data object. built-ins/Array/prototype/forEach/15.4.4.18-7-9.js # TypeError: Array.prototype.forEach called on incompatible receiver a data object. built-ins/Array/prototype/forEach/15.4.4.18-7-b-10.js # TypeError: Array.prototype.forEach called on incompatible receiver a data object. @@ -423,7 +410,6 @@ built-ins/Array/prototype/forEach/15.4.4.18-7-c-i-31.js # TypeError: Accessor p built-ins/Array/prototype/forEach/15.4.4.18-7-c-i-5.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call built-ins/Array/prototype/forEach/15.4.4.18-7-c-i-6.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/forEach/15.4.4.18-7-c-i-7.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call -built-ins/Array/prototype/forEach/15.4.4.18-7-c-i-8.js # testResult !== true built-ins/Array/prototype/forEach/15.4.4.18-7-c-i-9.js # TypeError: Array.prototype.forEach called on incompatible receiver a data object. built-ins/Array/prototype/forEach/15.4.4.18-7-c-ii-16.js # TypeError: Array.prototype.forEach called on incompatible receiver a data object. built-ins/Array/prototype/forEach/15.4.4.18-7-c-ii-17.js # TypeError: Array.prototype.forEach called on incompatible receiver a data object. @@ -450,9 +436,7 @@ built-ins/Array/prototype/includes/call-with-boolean.js # TypeError: Array.prot built-ins/Array/prototype/includes/length-boundaries.js # TypeError: Array.prototype.includes called on incompatible receiver a data object. built-ins/Array/prototype/includes/return-abrupt-get-length.js # Expected a Test262Error but got a TypeError built-ins/Array/prototype/includes/return-abrupt-get-prop.js # Expected a Test262Error but got a TypeError -built-ins/Array/prototype/includes/return-abrupt-tointeger-fromindex.js # Expected a Test262Error to be thrown but no exception was thrown at all built-ins/Array/prototype/includes/return-abrupt-tonumber-length.js # valueOf Expected a Test262Error but got a TypeError -built-ins/Array/prototype/includes/tointeger-fromindex.js # object [0] Expected SameValue(«true», «false») to be true built-ins/Array/prototype/includes/tolength-length.js # TypeError: Array.prototype.includes called on incompatible receiver a data object. built-ins/Array/prototype/includes/values-are-not-cached.js # TypeError: Array.prototype.includes called on incompatible receiver a data object. built-ins/Array/prototype/indexOf/15.4.4.14-1-10.js # TypeError: Array.prototype.indexOf called on incompatible receiver a data object. @@ -517,8 +501,6 @@ built-ins/Array/prototype/indexOf/15.4.4.14-4-6.js # TypeError: Array.prototype built-ins/Array/prototype/indexOf/15.4.4.14-4-7.js # TypeError: Array.prototype.indexOf called on incompatible receiver a data object. built-ins/Array/prototype/indexOf/15.4.4.14-4-8.js # TypeError: Array.prototype.indexOf called on incompatible receiver a data object. built-ins/Array/prototype/indexOf/15.4.4.14-4-9.js # TypeError: Array.prototype.indexOf called on incompatible receiver a data object. -built-ins/Array/prototype/indexOf/15.4.4.14-5-23.js # toStringAccessed !== true -built-ins/Array/prototype/indexOf/15.4.4.14-5-24.js # Expected a TypeError to be thrown but no exception was thrown at all built-ins/Array/prototype/indexOf/15.4.4.14-5-25.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call built-ins/Array/prototype/indexOf/15.4.4.14-5-26.js # TypeError: Array.prototype.indexOf called on incompatible receiver a data object. built-ins/Array/prototype/indexOf/15.4.4.14-5-27.js # TypeError: Array.prototype.indexOf called on incompatible receiver a data object. @@ -536,10 +518,8 @@ built-ins/Array/prototype/indexOf/15.4.4.14-9-a-16.js # TypeError: Accessor pro built-ins/Array/prototype/indexOf/15.4.4.14-9-a-17.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/indexOf/15.4.4.14-9-a-18.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/indexOf/15.4.4.14-9-a-2.js # TypeError: Array.prototype.indexOf called on incompatible receiver a data object. -built-ins/Array/prototype/indexOf/15.4.4.14-9-a-3.js # arr.indexOf(targetObj, fromIndex) Expected SameValue(«-1», «4») to be true built-ins/Array/prototype/indexOf/15.4.4.14-9-a-4.js # TypeError: Array.prototype.indexOf called on incompatible receiver a data object. built-ins/Array/prototype/indexOf/15.4.4.14-9-a-5.js # TypeError: Array.prototype.indexOf called on incompatible receiver a data object. -built-ins/Array/prototype/indexOf/15.4.4.14-9-a-6.js # arr.indexOf("10", fromIndex) Expected SameValue(«10», «-1») to be true built-ins/Array/prototype/indexOf/15.4.4.14-9-a-7.js # TypeError: Array.prototype.indexOf called on incompatible receiver a data object. built-ins/Array/prototype/indexOf/15.4.4.14-9-a-8.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/indexOf/15.4.4.14-9-a-9.js # TypeError: Array.prototype.indexOf called on incompatible receiver a data object. @@ -635,10 +615,6 @@ built-ins/Array/prototype/lastIndexOf/15.4.4.15-4-6.js # TypeError: Array.proto built-ins/Array/prototype/lastIndexOf/15.4.4.15-4-7.js # TypeError: foo is not a constructor: only classes can be constructed with new. Use a class, or call built-ins/Array/prototype/lastIndexOf/15.4.4.15-4-8.js # TypeError: Array.prototype.lastIndexOf called on incompatible receiver a data object. built-ins/Array/prototype/lastIndexOf/15.4.4.15-4-9.js # TypeError: Array.prototype.lastIndexOf called on incompatible receiver a data object. -built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-21.js # [0, true, targetObj, 3, false].lastIndexOf(targetObj, fromIndex) Expected SameValue(«-1», «2») to be -built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-22.js # [0, true, targetObj, 3, false].lastIndexOf(targetObj, fromIndex) Expected SameValue(«-1», «2») to be -built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-23.js # [0, true].lastIndexOf(true, fromIndex) Expected SameValue(«-1», «1») to be true -built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-24.js # Expected a TypeError to be thrown but no exception was thrown at all built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-25.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-26.js # TypeError: Array.prototype.lastIndexOf called on incompatible receiver a data object. built-ins/Array/prototype/lastIndexOf/15.4.4.15-5-27.js # TypeError: Array.prototype.lastIndexOf called on incompatible receiver a data object. @@ -656,7 +632,6 @@ built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-a-16.js # TypeError: Accessor built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-a-17.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-a-18.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-a-2.js # TypeError: Array.prototype.lastIndexOf called on incompatible receiver a data object. -built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-a-3.js # arr.lastIndexOf(targetObj, fromIndex) Expected SameValue(«-1», «4») to be true built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-a-4.js # TypeError: Array.prototype.lastIndexOf called on incompatible receiver a data object. built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-a-5.js # TypeError: Array.prototype.lastIndexOf called on incompatible receiver a data object. built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-a-7.js # TypeError: Array.prototype.lastIndexOf called on incompatible receiver a data object. @@ -748,7 +723,6 @@ built-ins/Array/prototype/map/15.4.4.19-4-8.js # accessed !== true built-ins/Array/prototype/map/15.4.4.19-4-9.js # accessed !== true built-ins/Array/prototype/map/15.4.4.19-5-4.js # TypeError: Cannot read properties of undefined (reading '…'). built-ins/Array/prototype/map/15.4.4.19-5-5.js # TypeError: foo is not a constructor: only classes can be constructed with new. Use a class, or call -built-ins/Array/prototype/map/15.4.4.19-8-6.js # resArr[4] Expected SameValue(«undefined», «1») to be true built-ins/Array/prototype/map/15.4.4.19-8-8.js # TypeError: Array.prototype.map called on incompatible receiver a data object. built-ins/Array/prototype/map/15.4.4.19-8-9.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/map/15.4.4.19-8-b-10.js # TypeError: Array.prototype.map called on incompatible receiver a data object. @@ -790,7 +764,6 @@ built-ins/Array/prototype/map/15.4.4.19-8-c-i-31.js # TypeError: Accessor prope built-ins/Array/prototype/map/15.4.4.19-8-c-i-5.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call built-ins/Array/prototype/map/15.4.4.19-8-c-i-6.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/map/15.4.4.19-8-c-i-7.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call -built-ins/Array/prototype/map/15.4.4.19-8-c-i-8.js # newArr[1] Expected SameValue(«13», «true») to be true built-ins/Array/prototype/map/15.4.4.19-8-c-i-9.js # TypeError: Array.prototype.map called on incompatible receiver a data object. built-ins/Array/prototype/map/15.4.4.19-8-c-ii-16.js # TypeError: Array.prototype.map called on incompatible receiver a data object. built-ins/Array/prototype/map/15.4.4.19-8-c-ii-17.js # TypeError: Array.prototype.map called on incompatible receiver a data object. @@ -953,14 +926,11 @@ built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-33.js # TypeError: Accesso built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-5.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-6.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-7.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call -built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-8.js # TypeError: Array.reduce of an empty array with no initial value. built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-9.js # TypeError: Array.prototype.reduce called on incompatible receiver a data object. -built-ins/Array/prototype/reduce/15.4.4.21-8-c-4.js # TypeError: Array.reduce of an empty array with no initial value. built-ins/Array/prototype/reduce/15.4.4.21-8-c-5.js # accessed !== true built-ins/Array/prototype/reduce/15.4.4.21-8-c-6.js # accessed !== true built-ins/Array/prototype/reduce/15.4.4.21-8-c-7.js # Expected a Test262Error but got a TypeError built-ins/Array/prototype/reduce/15.4.4.21-8-c-8.js # Expected a Test262Error but got a TypeError -built-ins/Array/prototype/reduce/15.4.4.21-9-6.js # res Expected SameValue(«"123"», «"1235"») to be true built-ins/Array/prototype/reduce/15.4.4.21-9-8.js # TypeError: Array.prototype.reduce called on incompatible receiver a data object. built-ins/Array/prototype/reduce/15.4.4.21-9-9.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/reduce/15.4.4.21-9-b-10.js # TypeError: Array.prototype.reduce called on incompatible receiver a data object. @@ -1015,7 +985,6 @@ built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-33.js # TypeError: Accessor pr built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-5.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-6.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-7.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call -built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-8.js # testResult !== true built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-9.js # TypeError: Array.prototype.reduce called on incompatible receiver a data object. built-ins/Array/prototype/reduce/15.4.4.21-9-c-ii-16.js # TypeError: Array.prototype.reduce called on incompatible receiver a data object. built-ins/Array/prototype/reduce/15.4.4.21-9-c-ii-18.js # TypeError: Array.prototype.reduce called on incompatible receiver a data object. @@ -1141,14 +1110,11 @@ built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-33.js # TypeError: Ac built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-5.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-6.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-7.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call -built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-8.js # TypeError: Array.reduceRight of an empty array with no initial value. built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-9.js # TypeError: Array.prototype.reduceRight called on incompatible receiver a data object. -built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-4.js # TypeError: Array.reduceRight of an empty array with no initial value. built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-5.js # accessed !== true built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-6.js # accessed !== true built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-7.js # Expected a Test262Error but got a TypeError built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-8.js # Expected a Test262Error but got a TypeError -built-ins/Array/prototype/reduceRight/15.4.4.22-9-6.js # res Expected SameValue(«"91"», «"151"») to be true built-ins/Array/prototype/reduceRight/15.4.4.22-9-8.js # TypeError: Array.prototype.reduceRight called on incompatible receiver a data object. built-ins/Array/prototype/reduceRight/15.4.4.22-9-9.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-10.js # TypeError: Array.prototype.reduceRight called on incompatible receiver a data object. @@ -1203,7 +1169,6 @@ built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-33.js # TypeError: Access built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-5.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-6.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-7.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call -built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-8.js # testResult !== true built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-9.js # TypeError: Array.prototype.reduceRight called on incompatible receiver a data object. built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-16.js # TypeError: Array.prototype.reduceRight called on incompatible receiver a data object. built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-20.js # TypeError: Array.prototype.reduceRight called on incompatible receiver a data object. @@ -1242,7 +1207,6 @@ built-ins/Array/prototype/shift/set-length-array-is-frozen.js # TypeError: Acce built-ins/Array/prototype/shift/set-length-array-length-is-non-writable.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/shift/set-length-zero-array-length-is-non-writable.js # TypeError: Making an array's length read-only is not supported; use Object.freeze. built-ins/Array/prototype/slice/15.4.4.10-10-c-ii-1.js # TypeError: Array elements share their attributes; only writable, enumerable and configurable equal t -built-ins/Array/prototype/slice/S15.4.4.10_A2.2_T5.js # #2: var x = [0,1,2,3,4]; var arr = x.slice(0,{valueOf: function() {return 3}, toString: function() { built-ins/Array/prototype/slice/S15.4.4.10_A2_T1.js # TypeError: Array.prototype.slice called on incompatible receiver a data object. built-ins/Array/prototype/slice/S15.4.4.10_A2_T2.js # TypeError: Array.prototype.slice called on incompatible receiver a data object. built-ins/Array/prototype/slice/S15.4.4.10_A2_T3.js # TypeError: Array.prototype.slice called on incompatible receiver a data object. @@ -1316,7 +1280,6 @@ built-ins/Array/prototype/some/15.4.4.17-4-8.js # accessed !== true built-ins/Array/prototype/some/15.4.4.17-4-9.js # accessed !== true built-ins/Array/prototype/some/15.4.4.17-5-4.js # TypeError: Cannot read properties of undefined (reading '…'). built-ins/Array/prototype/some/15.4.4.17-5-5.js # TypeError: foo is not a constructor: only classes can be constructed with new. Use a class, or call -built-ins/Array/prototype/some/15.4.4.17-7-6.js # res Expected SameValue(«false», «true») to be true built-ins/Array/prototype/some/15.4.4.17-7-8.js # TypeError: Array.prototype.some called on incompatible receiver a data object. built-ins/Array/prototype/some/15.4.4.17-7-9.js # TypeError: Array.prototype.some called on incompatible receiver a data object. built-ins/Array/prototype/some/15.4.4.17-7-b-10.js # TypeError: Array.prototype.some called on incompatible receiver a data object. @@ -1358,7 +1321,6 @@ built-ins/Array/prototype/some/15.4.4.17-7-c-i-31.js # TypeError: Accessor prop built-ins/Array/prototype/some/15.4.4.17-7-c-i-5.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call built-ins/Array/prototype/some/15.4.4.17-7-c-i-6.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/some/15.4.4.17-7-c-i-7.js # TypeError: Con is not a constructor: only classes can be constructed with new. Use a class, or call -built-ins/Array/prototype/some/15.4.4.17-7-c-i-8.js # [, ].some(callbackfn) !== true built-ins/Array/prototype/some/15.4.4.17-7-c-i-9.js # TypeError: Array.prototype.some called on incompatible receiver a data object. built-ins/Array/prototype/some/15.4.4.17-7-c-ii-16.js # TypeError: Array.prototype.some called on incompatible receiver a data object. built-ins/Array/prototype/some/15.4.4.17-7-c-ii-17.js # TypeError: Array.prototype.some called on incompatible receiver a data object. @@ -1386,12 +1348,10 @@ built-ins/Array/prototype/some/15.4.4.17-8-6.js # TypeError: foo is not a const built-ins/Array/prototype/some/15.4.4.17-8-7.js # TypeError: foo is not a constructor: only classes can be constructed with new. Use a class, or call built-ins/Array/prototype/some/15.4.4.17-8-8.js # TypeError: foo is not a constructor: only classes can be constructed with new. Use a class, or call built-ins/Array/prototype/some/call-with-boolean.js # TypeError: Array.prototype.some called on incompatible receiver a boolean. -built-ins/Array/prototype/sort/S15.4.4.11_A2.1_T3.js # #1: Check ToString operator built-ins/Array/prototype/sort/S15.4.4.11_A3_T1.js # TypeError: Array.prototype.sort called on incompatible receiver a data object. built-ins/Array/prototype/sort/S15.4.4.11_A3_T2.js # TypeError: Array.prototype.sort called on incompatible receiver a data object. built-ins/Array/prototype/sort/S15.4.4.11_A4_T3.js # TypeError: Array.prototype.sort called on incompatible receiver a data object. built-ins/Array/prototype/sort/S15.4.4.11_A6_T2.js # TypeError: Array.prototype.sort called on incompatible receiver a data object. -built-ins/Array/prototype/sort/bug_596_1.js # #1: [object, object].sort(); counter < 2. Actual: 0 built-ins/Array/prototype/sort/precise-comparefn-throws.js # Expected SameValue(«undefined», «"get"») to be true built-ins/Array/prototype/sort/precise-getter-appends-elements.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/sort/precise-getter-decreases-length.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o @@ -1411,7 +1371,6 @@ built-ins/Array/prototype/sort/precise-setter-increases-length.js # TypeError: built-ins/Array/prototype/sort/precise-setter-pops-elements.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/sort/precise-setter-sets-predecessor.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o built-ins/Array/prototype/sort/precise-setter-sets-successor.js # TypeError: Accessor properties are not supported on array elements; store the value or use a plain o -built-ins/Array/prototype/splice/S15.4.4.12_A2.2_T5.js # #2: var x = [0,1,2,3]; var arr = x.splice(0,{valueOf: function() {return 3}, toString: function() {r built-ins/Array/prototype/splice/S15.4.4.12_A2_T1.js # TypeError: Array.prototype.splice called on incompatible receiver a data object. built-ins/Array/prototype/splice/S15.4.4.12_A2_T2.js # TypeError: Array.prototype.splice called on incompatible receiver a data object. built-ins/Array/prototype/splice/S15.4.4.12_A2_T3.js # TypeError: Array.prototype.splice called on incompatible receiver a data object. @@ -1481,9 +1440,7 @@ built-ins/Array/prototype/values/returns-iterator-from-object.js # TypeError: A built-ins/Array/prototype/with/length-exceeding-array-length-limit.js # Expected a RangeError but got a TypeError built-ins/Array/prototype/with/length-tolength.js # TypeError: Array.prototype.with called on incompatible receiver a data object. built-ins/Array/prototype/with/this-value-boolean.js # TypeError: Array.prototype.with called on incompatible receiver a boolean. -built-ins/ArrayIteratorPrototype/Symbol.toStringTag/value-from-to-string.js # Expected SameValue(«"[object Array Iterator]"», «"[object Iterator]"») to be true built-ins/AsyncFunction/AsyncFunction-construct.js # TypeError: The Function constructor is not supported; write the function inline. -built-ins/AsyncFunction/AsyncFunctionPrototype-is-not-callable.js # Expected SameValue(«"function"», «"object"») to be true built-ins/AsyncFunction/instance-construct-throws.js # TypeError: The Function constructor is not supported; write the function inline. built-ins/AsyncGeneratorFunction/has-instance.js # TypeError: The Function constructor is not supported; write the function inline. built-ins/AsyncGeneratorFunction/instance-await-expr-in-param.js # TypeError: The Function constructor is not supported; write the function inline. @@ -1493,13 +1450,9 @@ built-ins/AsyncGeneratorFunction/invoked-as-constructor-no-arguments.js # TypeE built-ins/AsyncGeneratorFunction/invoked-as-function-multiple-arguments.js # TypeError: The Function constructor is not supported; write the function inline. built-ins/AsyncGeneratorFunction/invoked-as-function-no-arguments.js # TypeError: The Function constructor is not supported; write the function inline. built-ins/AsyncGeneratorFunction/invoked-as-function-single-argument.js # TypeError: The Function constructor is not supported; write the function inline. -built-ins/AsyncGeneratorFunction/prototype/not-callable.js # Expected SameValue(«"function"», «"object"») to be true -built-ins/AsyncGeneratorPrototype/next/this-val-not-async-generator.js # TypeError: Cannot read properties of undefined (reading '…'). built-ins/AsyncGeneratorPrototype/return/return-state-completed-broken-promise.js # Expected rejection built-ins/AsyncGeneratorPrototype/return/return-suspendedStart-broken-promise.js # Expected rejection built-ins/AsyncGeneratorPrototype/return/return-suspendedYield-broken-promise-try-catch.js # TypeError: Cannot read properties of undefined (reading '…'). -built-ins/AsyncGeneratorPrototype/return/this-val-not-async-generator.js # TypeError: Cannot read properties of undefined (reading '…'). -built-ins/AsyncGeneratorPrototype/throw/this-val-not-async-generator.js # TypeError: Cannot read properties of undefined (reading '…'). built-ins/Boolean/prototype/S15.6.3.1_A1.js # TypeError: Boolean.prototype.valueOf requires that '…' be a Boolean. built-ins/Date/S15.9.3.1_A4_T0.js # `new Date(new PoisonedValueOf(1))` throws a Test262Error exception Expected a Test262Error but got a built-ins/Date/S15.9.3.1_A4_T1.js # `new Date(new PoisonedValueOf(1), new PoisonedValueOf(2))` throws a Test262Error exception Expected @@ -1530,7 +1483,6 @@ built-ins/GeneratorFunction/invoked-as-constructor-no-arguments.js # TypeError: built-ins/GeneratorFunction/invoked-as-function-multiple-arguments.js # TypeError: The Function constructor is not supported; write the function inline. built-ins/GeneratorFunction/invoked-as-function-no-arguments.js # TypeError: The Function constructor is not supported; write the function inline. built-ins/GeneratorFunction/invoked-as-function-single-argument.js # TypeError: The Function constructor is not supported; write the function inline. -built-ins/GeneratorFunction/prototype/not-callable.js # Expected SameValue(«"function"», «"object"») to be true built-ins/GeneratorPrototype/throw/from-state-completed.js # Expected a E but got a TypeError built-ins/GeneratorPrototype/throw/from-state-suspended-start.js # Expected a E but got a TypeError built-ins/Infinity/15.1.1.2-0.js # TypeError: Object.getOwnPropertyDescriptor cannot convert undefined to an object. @@ -1690,8 +1642,6 @@ built-ins/JSON/parse/reviver-forward-modifies-object.js # TypeError: Cannot des built-ins/JSON/parse/reviver-get-name-err.js # Expected a Test262Error but got a TypeError built-ins/JSON/parse/reviver-object-non-configurable-prop-create.js # Expected SameValue(«22», «2») to be true built-ins/JSON/parse/reviver-object-non-configurable-prop-delete.js # TypeError: Cannot delete property '…'. -built-ins/JSON/parse/text-object-abrupt.js # Expected a Test262Error but got a SyntaxError -built-ins/JSON/parse/text-object.js # SyntaxError: JSON.parse received invalid JSON: JSON Parse error: Unexpected identifier "object" built-ins/JSON/rawJSON/basic.js # TypeError: JSON.rawJSON is not a function. built-ins/JSON/rawJSON/illegal-empty-and-start-end-chars.js # Expected a SyntaxError but got a TypeError built-ins/JSON/rawJSON/returns-expected-object.js # TypeError: JSON.rawJSON is not a function. @@ -2234,7 +2184,6 @@ built-ins/Promise/resolve/resolve-self.js # $DONE was never called built-ins/Promise/try/ctx-ctor-throws.js # Expected a Test262Error to be thrown but no exception was thrown at all built-ins/Promise/try/ctx-ctor.js # TypeError: Extending the built-in Promise is not supported. Only classes and Error types can be exte built-ins/Promise/withResolvers/ctx-ctor.js # TypeError: Extending the built-in Promise is not supported. Only classes and Error types can be exte -built-ins/Promise/withResolvers/resolvers.js # Expected SameValue(«"resolve"», «""») to be true built-ins/RegExp/S15.10.3.1_A1_T1.js # The value of __instance.indicator is expected to be 1 Expected SameValue(«undefined», «1») to be tru built-ins/RegExp/S15.10.3.1_A1_T2.js # The value of __instance.indicator is expected to be 1 Expected SameValue(«undefined», «1») to be tru built-ins/RegExp/S15.10.3.1_A1_T3.js # The value of __instance.indicator is expected to be 1 Expected SameValue(«undefined», «1») to be tru @@ -2292,7 +2241,6 @@ built-ins/Set/prototype/isSubsetOf/size-is-a-number.js # TypeError: BigInt lite built-ins/Set/prototype/isSubsetOf/subclass-receiver-methods.js # TypeError: Extending the built-in Set is not supported. Only classes and Error types can be extended built-ins/Set/prototype/isSupersetOf/size-is-a-number.js # TypeError: BigInt literals are not supported. built-ins/Set/prototype/isSupersetOf/subclass-receiver-methods.js # TypeError: Extending the built-in Set is not supported. Only classes and Error types can be extended -built-ins/Set/prototype/keys/keys.js # The value of `Set.prototype.keys` is `Set.prototype.values` Expected SameValue(«keys», «values») to built-ins/Set/prototype/symmetricDifference/size-is-a-number.js # TypeError: BigInt literals are not supported. built-ins/Set/prototype/symmetricDifference/subclass-receiver-methods.js # TypeError: Extending the built-in Set is not supported. Only classes and Error types can be extended built-ins/Set/prototype/symmetricDifference/subclass.js # TypeError: Extending the built-in Set is not supported. Only classes and Error types can be extended @@ -2306,19 +2254,12 @@ built-ins/Set/set-iterator-close-after-add-failure.js # TimeoutExceeded: Execut built-ins/Set/set-iterator-next-failure.js # Expected a MyError but got a TypeError built-ins/Set/set-iterator-value-failure.js # Expected a MyError but got a TypeError built-ins/String/S15.5.1.1_A1_T9.js # #2: toString=function(){return "__THIS__";}; __str = String(this); __str === "__THIS__". Actual: __s -built-ins/String/fromCharCode/S9.7_A3.1_T4.js # #1: var object = {valueOf: function() {return 1}}; String.fromCharCode(object).charCodeAt(0) === 1. -built-ins/String/fromCharCode/touint16-tonumber-throws-valueof.js # ToNumber throws when its argument's ToPrimitive step calls a throwing valueOf, and String.fromCharCo -built-ins/String/fromCodePoint/argument-not-coercible.js # Expected a Test262Error but got a RangeError -built-ins/String/fromCodePoint/to-number-conversions.js # RangeError: Arguments contain a value that is out of range of code points built-ins/String/prototype/S15.5.4_A1.js # #1: delete String.prototype.toString; String.prototype.toString() === "[object "+"String"+"]". Actua built-ins/String/prototype/S15.5.4_A2.js # TimeoutExceeded: Execution timed out after 5000ms. built-ins/String/prototype/S15.5.4_A3.js # #2: delete String.prototype.toString; String.prototype.toString() == "[object "+"String"+"]". Actual -built-ins/String/prototype/Symbol.iterator/this-val-to-str-err.js # Expected a Test262Error to be thrown but no exception was thrown at all -built-ins/String/prototype/at/index-non-numeric-argument-tointeger.js # TypeError: String.at expects argument 1 to be a data value. built-ins/String/prototype/charAt/S15.5.4.4_A2.js # TypeError: Cannot read properties of undefined (reading '…'). built-ins/String/prototype/charCodeAt/S15.5.4.5_A2.js # TypeError: Cannot read properties of undefined (reading '…'). built-ins/String/prototype/constructor/S15.5.4.1_A1_T2.js # TypeError: new __constr(...) is not supported; call __constr(...) without new instead. -built-ins/String/prototype/repeat/count-coerced-to-zero-returns-empty-string.js # RangeError: String.repeat expects a finite non-negative count. built-ins/String/prototype/slice/S15.5.4.13_A3_T4.js # TypeError: Cannot read properties of undefined (reading '…'). built-ins/String/prototype/split/instance-is-math.js # The value of __split[0] is "[object Math]" Expected SameValue(«"[object Object]"», «"[object Math]"» built-ins/String/prototype/split/separator-tostring-error.js # TypeError: Cannot read properties of undefined (reading '…'). @@ -2366,8 +2307,6 @@ language/arguments-object/10.6-2gs.js # Expected a TypeError to be thrown but n language/arguments-object/S10.6_A3_T1.js # #1: arguments object doesn't exists language/comments/S7.4_A1_T1.js # TypeError: Cannot read properties of undefined (reading '…'). language/comments/S7.4_A2_T1.js # TypeError: Cannot read properties of undefined (reading '…'). -language/expressions/addition/S11.6.1_A2.2_T3.js # TypeError: Binary operators require data values. -language/expressions/addition/S11.6.1_A3.2_T1.2.js # TypeError: Binary operators require data values. language/expressions/array/11.1.4_4-5-1.js # TypeError: Array elements share their attributes; only writable, enumerable and configurable equal t language/expressions/array/11.1.4_5-6-1.js # TypeError: Array elements share their attributes; only writable, enumerable and configurable equal t language/expressions/arrow-function/dstr/ary-init-iter-get-err-array-prototype.js # Expected a TypeError to be thrown but no exception was thrown at all @@ -2401,8 +2340,6 @@ language/expressions/assignment/dstr/array-rest-lref-err.js # Expected SameValu language/expressions/assignment/target-member-computed-reference-null.js # Expected a DummyError but got a TypeError language/expressions/assignment/target-member-computed-reference-undefined.js # Expected a DummyError but got a TypeError language/expressions/assignment/target-member-computed-reference.js # Expected a DummyError but got a TypeError -language/expressions/assignment/target-member-identifier-reference-null.js # Expected SameValue(«0», «1») to be true -language/expressions/assignment/target-member-identifier-reference-undefined.js # Expected SameValue(«0», «1») to be true language/expressions/assignment/target-super-computed-reference.js # Expected a DummyError but got a TypeError language/expressions/assignmenttargettype/simple-basic-identifierreference-await.js # SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. language/expressions/async-generator/dstr/ary-init-iter-get-err-array-prototype.js # Expected a TypeError to be thrown but no exception was thrown at all @@ -2416,10 +2353,6 @@ language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-val-a language/expressions/await/await-in-global.js # SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. language/expressions/await/await-in-nested-function.js # SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. language/expressions/await/await-in-nested-generator.js # SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. -language/expressions/bitwise-and/S11.10.1_A3_T1.5.js # TypeError: Binary operators require data values. -language/expressions/bitwise-not/S11.4.8_A3_T5.js # TypeError: Unary operators require data values. -language/expressions/bitwise-or/S11.10.3_A3_T1.5.js # TypeError: Binary operators require data values. -language/expressions/bitwise-xor/S11.10.2_A3_T1.5.js # TypeError: Binary operators require data values. language/expressions/class/dstr/async-gen-meth-ary-init-iter-get-err-array-prototype.js # Expected a TypeError to be thrown but no exception was thrown at all language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js # Expected SameValue(«3», «42») to be true language/expressions/class/dstr/async-gen-meth-dflt-ary-init-iter-get-err-array-prototype.js # Expected a TypeError to be thrown but no exception was thrown at all @@ -2496,49 +2429,22 @@ language/expressions/delete/S11.4.1_A2.2_T3.js # TypeError: Cannot read propert language/expressions/delete/S11.4.1_A3.2_T3.js # TypeError: MyFunction is not a constructor: only classes can be constructed with new. Use a class, o language/expressions/delete/S11.4.1_A3.3_T3.js # TypeError: MyFunction is not a constructor: only classes can be constructed with new. Use a class, o language/expressions/delete/S8.12.7_A2_T2.js # TypeError: Palette is not a constructor: only classes can be constructed with new. Use a class, or c -language/expressions/delete/non-reference-return-true.js # TypeError: Only data fields may be deleted. -language/expressions/delete/super-property-topropertykey.js # Expected a ReferenceError but got a SyntaxError +language/expressions/delete/super-property-topropertykey.js # Expected a ReferenceError but got a Test262Error language/expressions/delete/super-property.js # TypeError: Extending the built-in Object is not supported. Only classes and Error types can be exten -language/expressions/division/S11.5.2_A3_T1.5.js # TypeError: Binary operators require data values. language/expressions/function/dstr/ary-init-iter-get-err-array-prototype.js # Expected a TypeError to be thrown but no exception was thrown at all language/expressions/function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js # Expected SameValue(«3», «42») to be true language/expressions/function/dstr/dflt-ary-init-iter-get-err-array-prototype.js # Expected a TypeError to be thrown but no exception was thrown at all language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js # Expected SameValue(«3», «42») to be true -language/expressions/generators/default-proto.js # Expected SameValue(«object», «undefined») to be true language/expressions/generators/dstr/ary-init-iter-get-err-array-prototype.js # Expected a TypeError to be thrown but no exception was thrown at all language/expressions/generators/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js # Expected SameValue(«3», «42») to be true language/expressions/generators/dstr/dflt-ary-init-iter-get-err-array-prototype.js # Expected a TypeError to be thrown but no exception was thrown at all language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js # Expected SameValue(«3», «42») to be true -language/expressions/generators/prototype-relation-to-function.js # Expected SameValue(«object», «») to be true -language/expressions/greater-than-or-equal/S11.8.4_A3.2_T1.2.js # TypeError: Binary operators require data values. -language/expressions/greater-than/S11.8.2_A3.2_T1.2.js # TypeError: Binary operators require data values. language/expressions/in/S8.12.6_A2_T2.js # TypeError: Robin is not a constructor: only classes can be constructed with new. Use a class, or cal -language/expressions/left-shift/S11.7.1_A3_T1.5.js # TypeError: Binary operators require data values. -language/expressions/less-than-or-equal/S11.8.3_A3.2_T1.2.js # TypeError: Binary operators require data values. -language/expressions/less-than/S11.8.1_A3.2_T1.2.js # TypeError: Binary operators require data values. language/expressions/logical-assignment/lgcl-and-assignment-operator-lhs-before-rhs.js # Expected a DummyError but got a TypeError language/expressions/logical-assignment/lgcl-nullish-assignment-operator-lhs-before-rhs.js # Expected a DummyError but got a TypeError language/expressions/logical-assignment/lgcl-or-assignment-operator-lhs-before-rhs.js # Expected a DummyError but got a TypeError -language/expressions/modulus/S11.5.3_A3_T1.5.js # TypeError: Binary operators require data values. -language/expressions/multiplication/S11.5.1_A3_T1.5.js # TypeError: Binary operators require data values. language/expressions/new/ctorExpr-fn-ref-before-args-eval-fn-wrapup.js # TypeError: x is not a constructor: only classes can be constructed with new. Use a class, or call it language/expressions/new/ctorExpr-fn-ref-before-args-eval.js # TypeError: x is not a constructor: only classes can be constructed with new. Use a class, or call it -language/expressions/new/ctorExpr-isCtor-after-args-eval-fn-wrapup.js # arguments evaluated before checking valid ctor Expected SameValue(«undefined», «39») to be true -language/expressions/new/ctorExpr-isCtor-after-args-eval.js # Expected SameValue(«object», «Array») to be true -language/expressions/new/spread-err-mult-err-expr-throws.js # Expected a Test262Error but got a TypeError -language/expressions/new/spread-err-mult-err-itr-get-call.js # Expected a Test262Error but got a TypeError -language/expressions/new/spread-err-mult-err-itr-get-get.js # Expected a Test262Error but got a TypeError -language/expressions/new/spread-err-mult-err-itr-step.js # Expected a Test262Error but got a TypeError -language/expressions/new/spread-err-mult-err-itr-value.js # Expected a Test262Error but got a TypeError -language/expressions/new/spread-err-mult-err-obj-unresolvable.js # Expected a ReferenceError but got a TypeError -language/expressions/new/spread-err-mult-err-unresolvable.js # Expected a ReferenceError but got a TypeError -language/expressions/new/spread-err-sngl-err-expr-throws.js # Expected a Test262Error but got a TypeError -language/expressions/new/spread-err-sngl-err-itr-get-call.js # Expected a Test262Error but got a TypeError -language/expressions/new/spread-err-sngl-err-itr-get-get.js # Expected a Test262Error but got a TypeError -language/expressions/new/spread-err-sngl-err-itr-step.js # Expected a Test262Error but got a TypeError -language/expressions/new/spread-err-sngl-err-itr-value.js # Expected a Test262Error but got a TypeError -language/expressions/new/spread-err-sngl-err-obj-unresolvable.js # Expected a ReferenceError but got a TypeError -language/expressions/new/spread-err-sngl-err-unresolvable.js # Expected a ReferenceError but got a TypeError language/expressions/new/spread-mult-empty.js # TypeError: The called value is not a constructor: only classes can be constructed with new. Use a cl language/expressions/new/spread-mult-expr.js # TypeError: The called value is not a constructor: only classes can be constructed with new. Use a cl language/expressions/new/spread-mult-iter.js # TypeError: The called value is not a constructor: only classes can be constructed with new. Use a cl @@ -2575,29 +2481,19 @@ language/expressions/object/dstr/meth-dflt-ary-init-iter-get-err-array-prototype language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js # Expected SameValue(«3», «42») to be true language/expressions/optional-chaining/optional-call-preserves-this.js # TypeError: Cannot read properties of undefined (reading '…'). language/expressions/postfix-decrement/S11.3.2_A2.1_T1.js # TypeError: Cannot read properties of undefined (reading '…'). -language/expressions/postfix-decrement/S11.3.2_A3_T5.js # TypeError: '…' requires a data value. -language/expressions/postfix-decrement/S11.3.2_A4_T5.js # TypeError: '…' requires a data value. language/expressions/postfix-decrement/S11.3.2_A6_T1.js # Expected a DummyError but got a TypeError language/expressions/postfix-decrement/S11.3.2_A6_T2.js # Expected a DummyError but got a TypeError language/expressions/postfix-increment/S11.3.1_A2.1_T1.js # TypeError: Cannot read properties of undefined (reading '…'). -language/expressions/postfix-increment/S11.3.1_A3_T5.js # TypeError: '…' requires a data value. -language/expressions/postfix-increment/S11.3.1_A4_T5.js # TypeError: '…' requires a data value. language/expressions/postfix-increment/S11.3.1_A6_T1.js # Expected a DummyError but got a TypeError language/expressions/postfix-increment/S11.3.1_A6_T2.js # Expected a DummyError but got a TypeError language/expressions/prefix-decrement/S11.4.5_A2.1_T1.js # TypeError: Cannot read properties of undefined (reading '…'). -language/expressions/prefix-decrement/S11.4.5_A3_T5.js # TypeError: '…' requires a data value. -language/expressions/prefix-decrement/S11.4.5_A4_T5.js # TypeError: '…' requires a data value. language/expressions/prefix-decrement/S11.4.5_A6_T1.js # Expected a DummyError but got a TypeError language/expressions/prefix-decrement/S11.4.5_A6_T2.js # Expected a DummyError but got a TypeError language/expressions/prefix-increment/S11.4.4_A2.1_T1.js # TypeError: Cannot read properties of undefined (reading '…'). -language/expressions/prefix-increment/S11.4.4_A3_T5.js # TypeError: '…' requires a data value. -language/expressions/prefix-increment/S11.4.4_A4_T5.js # TypeError: '…' requires a data value. language/expressions/prefix-increment/S11.4.4_A6_T1.js # Expected a DummyError but got a TypeError language/expressions/prefix-increment/S11.4.4_A6_T2.js # Expected a DummyError but got a TypeError language/expressions/property-accessors/S11.2.1_A4_T5.js # #27: typeof String.prototype.length === "number". Actual: undefined language/expressions/property-accessors/S8.12.3_A1.js # TypeError: Cannot read properties of undefined (reading '…'). -language/expressions/right-shift/S11.7.2_A3_T1.5.js # TypeError: Binary operators require data values. -language/expressions/subtraction/S11.6.2_A3_T1.5.js # TypeError: Binary operators require data values. language/expressions/super/call-arg-evaluation-err.js # TypeError: Extending the built-in Object is not supported. Only classes and Error types can be exten language/expressions/super/call-bind-this-value-twice.js # TypeError: Class extends value a function is not a constructor or null. language/expressions/super/call-bind-this-value.js # TypeError: Class extends value a function is not a constructor or null. @@ -2612,9 +2508,6 @@ language/expressions/tagged-template/constructor-invocation.js # TypeError: The language/expressions/tagged-template/template-object-frozen-strict.js # Expected a TypeError to be thrown but no exception was thrown at all language/expressions/this/11.1.1-1.js # Expected SameValue(«undefined», «undefined») to be false language/expressions/typeof/get-value.js # TypeError: Object.defineProperties called on non-object -language/expressions/unary-minus/S11.4.7_A3_T5.js # TypeError: Unary operators require data values. -language/expressions/unary-plus/S11.4.6_A3_T5.js # TypeError: Unary operators require data values. -language/expressions/unsigned-right-shift/S11.7.3_A3_T1.5.js # TypeError: Binary operators require data values. language/expressions/yield/star-in-rltn-expr.js # TypeError: yield* requires a compatible iterable value. language/expressions/yield/star-iterable.js # First result `done` flag Expected SameValue(«false», «undefined») to be true language/expressions/yield/star-rhs-iter-nrml-res-done-no-value.js # access count (first iteration) Expected SameValue(«1», «0») to be true @@ -2633,10 +2526,6 @@ language/global-code/import.js # expected SyntaxError but the program ran language/global-code/return.js # expected SyntaxError but the program ran language/identifier-resolution/S11.1.2_A1_T1.js # TypeError: Cannot read properties of undefined (reading '…'). language/identifier-resolution/S11.1.2_A1_T2.js # #1.2: this.z; z === undefined throw ReferenceError. Actual: TypeError: Cannot read properties of und -language/identifiers/part-unicode-17.0.0-escaped.js # SyntaxError: Invalid Unicode escape. Code must be plain JavaScript written as a program body. -language/identifiers/part-unicode-17.0.0.js # SyntaxError: Unexpected character '…'. Code must be plain JavaScript written as a program body. -language/identifiers/start-unicode-17.0.0-escaped.js # SyntaxError: Invalid Unicode escape. Code must be plain JavaScript written as a program body. -language/identifiers/start-unicode-17.0.0.js # SyntaxError: Unexpected character '…'. Code must be plain JavaScript written as a program body. language/punctuators/S7.7_A1.js # TypeError: Cannot read properties of undefined (reading '…'). language/statements/async-generator/dstr/ary-init-iter-get-err-array-prototype.js # Expected a TypeError to be thrown but no exception was thrown at all language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js # Expected SameValue(«3», «42») to be true @@ -2728,7 +2617,7 @@ language/statements/class/subclass/class-definition-parent-proto-null.js # Type language/statements/class/subclass/default-constructor-2.js # TypeError: new f(...) is not supported; call f(...) without new instead. language/statements/class/subclass/derived-class-return-override-catch-finally-arrow.js # UnsupportedSyntax: SyntaxError: super() inside an arrow function is not supported. Call super() dire language/statements/class/subclass/derived-class-return-override-finally-super-arrow.js # UnsupportedSyntax: SyntaxError: super() inside an arrow function is not supported. Call super() dire -language/statements/class/subclass/derived-class-return-override-for-of-arrow.js # ReferenceError: Must call super constructor in derived class before accessing '…' or returning from +language/statements/class/subclass/derived-class-return-override-for-of-arrow.js # UnsupportedSyntax: SyntaxError: super() inside an arrow function is not supported. Call super() dire language/statements/class/subclass/superclass-bound-function.js # TypeError: Class extends value a function is not a constructor or null. language/statements/class/subclass/superclass-prototype-setter-constructor.js # TypeError: Class extends value a function is not a constructor or null. language/statements/class/subclass/superclass-prototype-setter-method-override.js # TypeError: Class extends value a function is not a constructor or null. @@ -2809,12 +2698,10 @@ language/statements/function/dstr/ary-init-iter-get-err-array-prototype.js # Ex language/statements/function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js # Expected SameValue(«3», «42») to be true language/statements/function/dstr/dflt-ary-init-iter-get-err-array-prototype.js # Expected a TypeError to be thrown but no exception was thrown at all language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js # Expected SameValue(«3», «42») to be true -language/statements/generators/default-proto.js # Expected SameValue(«object», «undefined») to be true language/statements/generators/dstr/ary-init-iter-get-err-array-prototype.js # Expected a TypeError to be thrown but no exception was thrown at all language/statements/generators/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js # Expected SameValue(«3», «42») to be true language/statements/generators/dstr/dflt-ary-init-iter-get-err-array-prototype.js # Expected a TypeError to be thrown but no exception was thrown at all language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js # Expected SameValue(«3», «42») to be true -language/statements/generators/prototype-relation-to-function.js # Expected SameValue(«object», «») to be true language/statements/labeled/value-await-non-module.js # SyntaxError: Unexpected token. Code must be plain JavaScript written as a program body. language/statements/let/dstr/ary-init-iter-get-err-array-prototype.js # Expected a TypeError to be thrown but no exception was thrown at all language/statements/let/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js # Expected SameValue(«3», «42») to be true diff --git a/packages/codemode/test/var-hoisting-test262.test.ts b/packages/codemode/test/var-hoisting-test262.test.ts index 667603f5232ae..92fcd3011102a 100644 --- a/packages/codemode/test/var-hoisting-test262.test.ts +++ b/packages/codemode/test/var-hoisting-test262.test.ts @@ -270,6 +270,20 @@ describe("function declarations and expressions", () => { `), ).toEqual([true, true, false, "object", "undefined"]) }) + + test("generator and async functions inherit from their own non-callable function prototypes", async () => { + expect( + await value(` + const proto = Object.getPrototypeOf + const kinds = [function* () {}, async function* () {}, async function () {}, async () => {}] + const protos = kinds.map(proto) + let failure + try { protos[0]() } catch (error) { failure = error.name } + return [protos.map((p) => typeof p), protos.map((p) => proto(p) === Function.prototype), protos[2] === protos[3], + protos[0].prototype === proto(kinds[0].prototype), Object.hasOwn(protos[2], "prototype"), failure] + `), + ).toEqual([["object", "object", "object", "object"], [true, true, true, true], true, true, false, "TypeError"]) + }) }) describe("switch case function hoisting", () => { diff --git a/packages/codemode/test/verify-bytecode.ts b/packages/codemode/test/verify-bytecode.ts index bbfcff4c26aec..272e22d139790 100644 --- a/packages/codemode/test/verify-bytecode.ts +++ b/packages/codemode/test/verify-bytecode.ts @@ -183,8 +183,10 @@ export const verifyCode = (c: Code): Array => { case Op.FOR_IN: case Op.ITER_INIT: case Op.GENERATOR_START: - if (op === Op.CHECK_BASE && a === CheckBaseKind.READ && d < 2) { - errors.push(`${label}: CHECK_BASE.read at depth ${d} (pc ${pc})`) + if (op === Op.CHECK_BASE && (a === CheckBaseKind.READ || a === CheckBaseKind.ASSIGN_PROP) && d < 2) { + errors.push( + `${label}: CHECK_BASE.${a === CheckBaseKind.READ ? "read" : "assignProp"} at depth ${d} (pc ${pc})`, + ) } next(0) break @@ -293,13 +295,8 @@ export const verifyCode = (c: Code): Array => { next(-(a + 1)) break case Op.NEW: - if (a === 255) { - if (d < 1) errors.push(`${label}: NEW.check at depth ${d} (pc ${pc})`) - next(0) - } else { - if (d < a + 1) errors.push(`${label}: NEW ${a} at depth ${d} (pc ${pc})`) - next(-a) - } + if (d < a + 1) errors.push(`${label}: NEW ${a} at depth ${d} (pc ${pc})`) + next(-a) break case Op.ITER_OPEN: { const jumpPc = pc + stride diff --git a/packages/codemode/test/vm.test.ts b/packages/codemode/test/vm.test.ts index aba7a22f2fbff..cf3491b4d4e1e 100644 --- a/packages/codemode/test/vm.test.ts +++ b/packages/codemode/test/vm.test.ts @@ -162,13 +162,12 @@ describe("scopes, TDZ, hoisting, and closures", () => { }) describe("expressions, evaluation order, and destructuring", () => { - test("member evaluation order: nullish base before key conversion, base check before rhs", () => { + test("member evaluation order: nullish base before key conversion, rhs before the base check", () => { expect(err(`const base = null; base[{ toString() { throw new RangeError("boom") } }]`).message).toContain( "Cannot read properties of null", ) - expect(err(`(1).x = (() => { throw new RangeError("rhs ran") })()`).message).toContain( - "Cannot create property 'x' on number '1'", - ) + expect(err(`(1).x = (() => { throw new RangeError("rhs ran") })()`).message).toContain("rhs ran") + expect(err(`(1).x = 2`).message).toContain("Cannot create property 'x' on number '1'") expect( val(` const log = []