[
  {
    "path": ".config/dotnet-tools.json",
    "content": "{\n  \"version\": 1,\n  \"isRoot\": true,\n  \"tools\": {\n    \"docfx\": {\n      \"version\": \"2.78.3\",\n      \"commands\": [\n        \"docfx\"\n      ],\n      \"rollForward\": false\n    }\n  }\n}\n"
  },
  {
    "path": ".editorconfig",
    "content": "﻿# top-most EditorConfig file\nroot = true\n\n[*]\ncharset = utf-8\nend_of_line = lf\nindent_style = space\nindent_size = 2\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n\n# Visual Studio Spell checker configs (https://learn.microsoft.com/en-us/visualstudio/ide/text-spell-checker?view=vs-2022#how-to-customize-the-spell-checker)\nspelling_exclusion_path  = ./exclusion.dic\n\n[*.cs]\nindent_size = 4\ncharset = utf-8-bom\nend_of_line = unset\n\n# Solution files\n[*.{sln,slnx}]\nend_of_line = unset\n\n# MSBuild project files\n[*.{csproj,props,targets}]\nend_of_line = unset\n\n# Xml config files\n[*.{ruleset,config,nuspec,resx,runsettings,DotSettings}]\nend_of_line = unset\n\n[*{_AssemblyInfo.cs,.notsupported.cs}]\ngenerated_code = true\n\n# C# code style settings\n[*.{cs}]\ndotnet_diagnostic.IDE0044.severity = none # IDE0044: Make field readonly\n\n# https://stackoverflow.com/questions/79195382/how-to-disable-fading-unused-methods-in-visual-studio-2022-17-12-0\ndotnet_diagnostic.IDE0051.severity = none # IDE0051: Remove unused private member\ndotnet_diagnostic.IDE0130.severity = none # IDE0130: Namespace does not match folder structure\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "github: [neuecc]\n"
  },
  {
    "path": ".github/dependabot.yaml",
    "content": "# ref: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot\nversion: 2\nupdates:\n  - package-ecosystem: \"github-actions\"\n    directory: \"/\"\n    schedule:\n      interval: \"weekly\" # Check for updates to GitHub Actions every week\n    groups:\n      dependencies:\n        patterns:\n          - \"*\"\n    cooldown:\n      default-days: 14 # Wait 14 days before creating another PR for the same dependency. This will prevent vulnerability on the package impact.\n    ignore:\n      # I just want update action when major/minor version is updated. patch updates are too noisy.\n      - dependency-name: \"*\"\n        update-types:\n          - version-update:semver-patch\n"
  },
  {
    "path": ".github/workflows/build-debug.yaml",
    "content": "name: Build-Debug\n\non:\n  push:\n    branches:\n      - \"master\"\n  pull_request:\n    branches:\n      - \"master\"\n\njobs:\n  build-dotnet:\n    permissions:\n      contents: read\n    runs-on: ubuntu-24.04\n    timeout-minutes: 10\n    steps:\n      - uses: Cysharp/Actions/.github/actions/checkout@main\n      - uses: Cysharp/Actions/.github/actions/setup-dotnet@main\n      - run: dotnet build -c Release\n      - run: dotnet test -c Release\n      - run: dotnet pack -c Release --no-build -p:IncludeSymbols=true -o $GITHUB_WORKSPACE/artifacts\n\n  build-unity:\n    if: ${{ ((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:')) && github.triggering_actor != 'dependabot[bot]' }}\n    strategy:\n      fail-fast: false\n      max-parallel: 2\n      matrix:\n        unity: [\"2022.3.39f1\", \"6000.0.12f1\"] # Test with LTS\n    permissions:\n      contents: read\n    runs-on: ubuntu-24.04\n    timeout-minutes: 30 # Unity build takes more than 20min.\n    steps:\n      - name: Load secrets\n        id: op-load-secret\n        uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0 # v2.0.0\n        with:\n          export-env: false\n        env:\n          OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }}\n          UNITY_EMAIL: \"op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/username\"\n          UNITY_PASSWORD: \"op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/credential\"\n          UNITY_SERIAL: \"op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/serial\"\n\n      - uses: Cysharp/Actions/.github/actions/checkout@main\n\n      # Execute scripts: Export Package\n      #  /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export\n      - name: Build Unity (.unitypacakge)\n        if: ${{ startsWith(matrix.unity, '2022') }} # only execute once\n        uses: Cysharp/Actions/.github/actions/unity-builder@main\n        env:\n          UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }}\n          UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }}\n          UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }}\n        with:\n          projectPath: src/UniTask\n          unityVersion: ${{ matrix.unity }}\n          targetPlatform: StandaloneLinux64\n          buildMethod: PackageExporter.Export\n\n      # Execute UnitTest\n      # /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod UnitTestBuilder.BuildUnitTest /headless /ScriptBackend IL2CPP /BuildTarget StandaloneLinux64\n      - name: Build UnitTest (IL2CPP)\n        uses: Cysharp/Actions/.github/actions/unity-builder@main\n        env:\n          UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }}\n          UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }}\n          UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }}\n        with:\n          projectPath: src/UniTask\n          unityVersion: ${{ matrix.unity }}\n          targetPlatform: StandaloneLinux64\n          buildMethod: UnitTestBuilder.BuildUnitTest\n          customParameters: \"/headless /ScriptBackend IL2CPP\"\n      - name: Check UnitTest file is generated\n        run: ls -lR ./src/UniTask/bin/UnitTest\n      - name: Execute UnitTest\n        run: ./src/UniTask/bin/UnitTest/StandaloneLinux64_IL2CPP/test\n\n      - uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files\n        with:\n          directory: src/UniTask\n\n      # Store artifacts.\n      - uses: Cysharp/Actions/.github/actions/upload-artifact@main\n        if: ${{ startsWith(matrix.unity, '2021') }} # only execute 2021\n        with:\n          name: UniTask.unitypackage-${{ matrix.unity }}.zip\n          path: ./src/UniTask/*.unitypackage\n          retention-days: 1\n"
  },
  {
    "path": ".github/workflows/build-docs.yaml",
    "content": "name: build-docs\n\non:\n  push:\n    branches:\n      - master\n      - feature/docs\n\njobs:\n  run-docfx:\n    if: ${{ ((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:')) && github.triggering_actor != 'dependabot[bot]' }}\n    permissions:\n      contents: write\n      pages: write\n    runs-on: ubuntu-24.04\n    timeout-minutes: 10\n    steps:\n      - name: Load secrets\n        id: op-load-secret\n        uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0 # v2.0.0\n        with:\n          export-env: false\n        env:\n          OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }}\n          UNITY_EMAIL: \"op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/username\"\n          UNITY_PASSWORD: \"op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/credential\"\n          UNITY_SERIAL: \"op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/serial\"\n      - uses: Cysharp/Actions/.github/actions/checkout@main\n      # Execute scripts: Export Package\n      #  /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export\n      - name: Build Unity (.unitypackage)\n        uses: Cysharp/Actions/.github/actions/unity-builder@main\n        env:\n          UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }}\n          UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }}\n          UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }}\n        with:\n          projectPath: src/UniTask\n          unityVersion: \"2022.3.39f1\"\n          targetPlatform: StandaloneLinux64\n          buildMethod: PackageExporter.Export\n\n      - uses: Cysharp/Actions/.github/actions/checkout@main\n        with:\n          repository: Cysharp/DocfxTemplate\n          path: docs/_DocfxTemplate\n      - uses: Cysharp/Actions/.github/actions/setup-dotnet@main\n      - name: dotnet tool restore\n        run: dotnet tool restore\n      - name: Docfx metadata\n        run: dotnet docfx metadata docs/docfx.json\n      - name: Docfx build\n        run: dotnet docfx build docs/docfx.json\n      - name: Publish to GitHub Pages\n        uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0\n        with:\n          github_token: ${{ secrets.GITHUB_TOKEN }}\n          publish_dir: docs/_site\n"
  },
  {
    "path": ".github/workflows/build-release.yaml",
    "content": "name: build-release\n\non:\n  workflow_dispatch:\n    inputs:\n      tag:\n        description: \"tag: git tag you want create. (sample 1.0.0)\"\n        required: true\n      dry-run:\n        description: \"dry-run: true will never create relase/nuget.\"\n        required: true\n        default: false\n        type: boolean\n\njobs:\n  update-packagejson:\n    permissions:\n      actions: read\n      contents: write\n    uses: Cysharp/Actions/.github/workflows/update-packagejson.yaml@main\n    with:\n      file-path: ./src/UniTask/Assets/Plugins/UniTask/package.json\n      tag: ${{ inputs.tag }}\n      dry-run: ${{ inputs.dry-run }}\n\n  build-dotnet:\n    needs: [update-packagejson]\n    permissions:\n      contents: read\n    runs-on: ubuntu-24.04\n    timeout-minutes: 10\n    steps:\n      - run: echo ${{ needs.update-packagejson.outputs.sha }}\n      - uses: Cysharp/Actions/.github/actions/checkout@main\n        with:\n          ref: ${{ needs.update-packagejson.outputs.sha }}\n      - uses: Cysharp/Actions/.github/actions/setup-dotnet@main\n      # build and pack\n      - run: dotnet build -c Release -p:Version=${{ inputs.tag }}\n      - run: dotnet test -c Release --no-build\n      - run: dotnet pack ./src/UniTask.NetCore/UniTask.NetCore.csproj -c Release --no-build -p:Version=${{ inputs.tag }} -o ./publish\n      # Store artifacts.\n      - uses: Cysharp/Actions/.github/actions/upload-artifact@main\n        with:\n          name: nuget\n          path: ./publish/\n          retention-days: 1\n\n  build-unity:\n    needs: [update-packagejson]\n    strategy:\n      matrix:\n        unity: [\"2022.3.39f1\"]\n    permissions:\n      contents: read\n    runs-on: ubuntu-24.04\n    timeout-minutes: 15\n    steps:\n      - name: Load secrets\n        id: op-load-secret\n        uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0 # v2.0.0\n        with:\n          export-env: false\n        env:\n          OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }}\n          UNITY_EMAIL: \"op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/username\"\n          UNITY_PASSWORD: \"op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/credential\"\n          UNITY_SERIAL: \"op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/serial\"\n\n      - run: echo ${{ needs.update-packagejson.outputs.sha }}\n      - uses: Cysharp/Actions/.github/actions/checkout@main\n        with:\n          ref: ${{ needs.update-packagejson.outputs.sha }}\n      # Execute scripts: Export Package\n      # /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export\n      - name: Build Unity (.unitypacakge)\n        uses: Cysharp/Actions/.github/actions/unity-builder@main\n        env:\n          UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }}\n          UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }}\n          UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }}\n        with:\n          projectPath: src/UniTask\n          unityVersion: ${{ matrix.unity }}\n          targetPlatform: StandaloneLinux64\n          buildMethod: PackageExporter.Export\n\n      - uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files\n        with:\n          directory: src/UniTask\n\n      # Store artifacts.\n      - uses: Cysharp/Actions/.github/actions/upload-artifact@main\n        with:\n          name: UniTask.${{ inputs.tag }}.unitypackage\n          path: ./src/UniTask/UniTask.${{ inputs.tag }}.unitypackage\n          retention-days: 1\n\n  # release\n  create-release:\n    needs: [update-packagejson, build-dotnet, build-unity]\n    permissions:\n      contents: write\n      id-token: write # required for NuGet Trusted Publish\n    uses: Cysharp/Actions/.github/workflows/create-release.yaml@main\n    with:\n      commit-id: ${{ needs.update-packagejson.outputs.sha }}\n      dry-run: ${{ inputs.dry-run }}\n      tag: ${{ inputs.tag }}\n      nuget-push: true\n      release-upload: true\n      release-asset-path: ./UniTask.${{ inputs.tag }}.unitypackage/UniTask.${{ inputs.tag }}.unitypackage\n    secrets: inherit\n\n  cleanup:\n    if: ${{ needs.update-packagejson.outputs.is-branch-created == 'true' }}\n    needs: [update-packagejson, build-dotnet, build-unity]\n    permissions:\n      contents: write\n    uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main\n    with:\n      branch: ${{ needs.update-packagejson.outputs.branch-name }}\n"
  },
  {
    "path": ".github/workflows/prevent-github-change.yaml",
    "content": "name: Prevent github change\non:\n  pull_request:\n    paths:\n      - \".github/**/*.yaml\"\n      - \".github/**/*.yml\"\n\njobs:\n  detect:\n    permissions:\n      contents: read\n    uses: Cysharp/Actions/.github/workflows/prevent-github-change.yaml@main\n"
  },
  {
    "path": ".github/workflows/stale.yaml",
    "content": "name: \"Close stale issues\"\n\non:\n  workflow_dispatch:\n  schedule:\n    - cron: \"0 0 * * *\"\n\njobs:\n  stale:\n    permissions:\n      contents: read\n      pull-requests: write\n      issues: write\n    uses: Cysharp/Actions/.github/workflows/stale-issue.yaml@main\n"
  },
  {
    "path": ".github/workflows/toc.yaml",
    "content": "name: TOC Generator\n\non:\n  push:\n    paths:\n      - 'README.md'\n\njobs:\n  toc:\n    permissions:\n      contents: write\n    uses: Cysharp/Actions/.github/workflows/toc-generator.yaml@main\n    with:\n      TOC_TITLE: \"## Table of Contents\"\n    secrets: inherit\n"
  },
  {
    "path": ".gitignore",
    "content": "# Unity\n\n*.pidb\n*.suo\n*.userprefs\n*.vsmdi\n*.testsettings\n*/bin\n*/obj\n*/publish\n$tf\nTestResults\n!*.sln\n!*.csproj\n!*/*.csproj\n[Ll]ibrary/\n[Tt]emp/\n[Oo]bj/\n\n# VS2013\n\n# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)\n[Bb]in/\n[Oo]bj/\n\n# mstest test results\nTestResults\n\n## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User-specific files\n*.suo\n*.user\n*.sln.docstates\n\n# Build results\n[Dd]ebug/\n[Rr]elease/\nx64/\n*_i.c\n*_p.c\n*.ilk\n# *.meta # already ignored in Unity section\n*.obj\n*.pch\n*.pdb\n*.pgc\n*.pgd\n*.rsp\n*.sbr\n*.tlb\n*.tli\n*.tlh\n*.tmp\n*.log\n*.vspscc\n*.vssscc\n.builds\n\n# Visual C++ cache files\nipch/\n*.aps\n*.ncb\n*.opensdf\n*.sdf\n\n# Visual Studio profiler\n*.psess\n*.vsp\n*.vspx\n\n# Guidance Automation Toolkit\n*.gpState\n\n# ReSharper is a .NET coding add-in\n_ReSharper*\n\n# NCrunch\n*.ncrunch*\n.*crunch*.local.xml\n\n# Installshield output folder\n[Ee]xpress\n\n# DocProject is a documentation generator add-in\nDocProject/buildhelp/\nDocProject/Help/*.HxT\nDocProject/Help/*.HxC\nDocProject/Help/*.hhc\nDocProject/Help/*.hhk\nDocProject/Help/*.hhp\nDocProject/Help/Html2\nDocProject/Help/html\n\n# Click-Once directory\npublish\n\n# Publish Web Output\n*.Publish.xml\n\n# NuGet Packages Directory\n*.nupkg\n# NuGet Symbol Packages\n*.snupkg\n# The packages folder can be ignored because of Package Restore\n# packages # upm pacakge will use Packages\n# **/[Pp]ackages/*\n# except build/, which is used as an MSBuild target.\n# !**/[Pp]ackages/build/\n# Uncomment if necessary however generally it will be regenerated when needed\n#!**/[Pp]ackages/repositories.config\n# NuGet v3's project.json files produces more ignorable files\n*.nuget.props\n*.nuget.targets\n\n# Windows Azure Build Output\ncsx\n*.build.csdef\n\n# Windows Store app package directory\nAppPackages/\n\n# Others\n[Bb]in\n[Oo]bj\nsql\nTestResults\n[Tt]est[Rr]esult*\n*.Cache\nClientBin\n[Ss]tyle[Cc]op.*\n~$*\n*.dbmdl\nGenerated_Code #added for RIA/Silverlight projects\n\n# Backup & report files from converting an old project file to a newer\n# Visual Studio version. Backup files are not needed, because we have git ;-)\n_UpgradeReport_Files/\nBackup*/\nUpgradeLog*.XML\nAssets/WSATestCertificate.pfx\n.vs/\n\n# Unity\n\n# Unity\n.vsconfig\nsrc/UniTask/Library/*\nsrc/UniTask/Temp/*\nsrc/UniTask/Logs/*\nsrc/UniTask/[Uu]ser[Ss]ettings/\nsrc/UniTask/*.sln\nsrc/UniTask/*.csproj\nsrc/UniTask/*.unitypackage\n!src/UniTask/Packages/\n"
  },
  {
    "path": "Directory.Build.props",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"15.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup>\n    <SignAssembly>true</SignAssembly>\n    <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)opensource.snk</AssemblyOriginatorKeyFile>\n\n    <!-- NuGet Package Information -->\n    <IsPackable>false</IsPackable>\n    <PackageVersion>$(Version)</PackageVersion>\n    <Company>Cysharp</Company>\n    <Authors>Cysharp</Authors>\n    <Copyright>© Cysharp, Inc.</Copyright>\n    <PackageTags>task;async</PackageTags>\n    <PackageProjectUrl>https://github.com/Cysharp/UniTask</PackageProjectUrl>\n    <PackageReadmeFile>README.md</PackageReadmeFile>\n    <RepositoryUrl>$(PackageProjectUrl)</RepositoryUrl>\n    <RepositoryType>git</RepositoryType>\n    <PackageLicenseExpression>MIT</PackageLicenseExpression>\n    <PackageIcon>Icon.png</PackageIcon>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <None Include=\"$(MSBuildThisFileDirectory)Icon.png\" Pack=\"true\" PackagePath=\"\\\" />\n    <None Include=\"$(MSBuildThisFileDirectory)README.md\" Pack=\"true\" PackagePath=\"\\\" />\n    <EmbeddedResource Include=\"$(MSBuildThisFileDirectory)LICENSE\" />\n  </ItemGroup>\n</Project>\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2019 Yoshifumi Kawai / Cysharp, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "UniTask\n===\n[![GitHub Actions](https://github.com/Cysharp/UniTask/workflows/Build-Debug/badge.svg)](https://github.com/Cysharp/UniTask/actions) [![Releases](https://img.shields.io/github/release/Cysharp/UniTask.svg)](https://github.com/Cysharp/UniTask/releases) [![Readme_CN](https://img.shields.io/badge/UniTask-%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3-red)](https://github.com/Cysharp/UniTask/blob/master/README_CN.md)\n\nProvides an efficient allocation free async/await integration for Unity.\n\n* Struct based `UniTask<T>` and custom AsyncMethodBuilder to achieve zero allocation\n* Makes all Unity AsyncOperations and Coroutines awaitable\n* PlayerLoop based task(`UniTask.Yield`, `UniTask.Delay`, `UniTask.DelayFrame`, etc..) that enable replacing all coroutine operations\n* MonoBehaviour Message Events and uGUI Events as awaitable/async-enumerable\n* Runs completely on Unity's PlayerLoop so doesn't use threads and runs on WebGL, wasm, etc.\n* Asynchronous LINQ, with Channel and AsyncReactiveProperty\n* TaskTracker window to prevent memory leaks\n* Highly compatible behaviour with Task/ValueTask/IValueTaskSource\n\nFor technical details, see blog post: [UniTask v2 — Zero Allocation async/await for Unity, with Asynchronous LINQ\n](https://medium.com/@neuecc/unitask-v2-zero-allocation-async-await-for-unity-with-asynchronous-linq-1aa9c96aa7dd)  \nFor advanced tips, see blog post: [Extends UnityWebRequest via async decorator pattern — Advanced Techniques of UniTask](https://medium.com/@neuecc/extends-unitywebrequest-via-async-decorator-pattern-advanced-techniques-of-unitask-ceff9c5ee846)\n\n<!-- START doctoc generated TOC please keep comment here to allow auto update -->\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->\n## Table of Contents\n\n- [Getting started](#getting-started)\n- [Basics of UniTask and AsyncOperation](#basics-of-unitask-and-asyncoperation)\n- [Cancellation and Exception handling](#cancellation-and-exception-handling)\n- [Timeout handling](#timeout-handling)\n- [Progress](#progress)\n- [PlayerLoop](#playerloop)\n- [async void vs async UniTaskVoid](#async-void-vs-async-unitaskvoid)\n- [UniTaskTracker](#unitasktracker)\n- [External Assets](#external-assets)\n- [AsyncEnumerable and Async LINQ](#asyncenumerable-and-async-linq)\n- [Awaitable Events](#awaitable-events)\n- [Channel](#channel)\n- [vs Awaitable](#vs-awaitable)\n- [For Unit Testing](#for-unit-testing)\n- [ThreadPool limitation](#threadpool-limitation)\n- [IEnumerator.ToUniTask limitation](#ienumeratortounitask-limitation)\n- [For UnityEditor](#for-unityeditor)\n- [Compare with Standard Task API](#compare-with-standard-task-api)\n- [Pooling Configuration](#pooling-configuration)\n- [Allocation on Profiler](#allocation-on-profiler)\n- [UniTaskSynchronizationContext](#unitasksynchronizationcontext)\n- [API References](#api-references)\n- [UPM Package](#upm-package)\n  - [Install via git URL](#install-via-git-url)\n- [.NET Core](#net-core)\n- [License](#license)\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n\nGetting started\n---\nInstall via [UPM package](#upm-package) with git reference or asset package(`UniTask.*.*.*.unitypackage`) available in [UniTask/releases](https://github.com/Cysharp/UniTask/releases).\n\n```csharp\n// extension awaiter/methods can be used by this namespace\nusing Cysharp.Threading.Tasks;\n\n// You can return type as struct UniTask<T>(or UniTask), it is unity specialized lightweight alternative of Task<T>\n// zero allocation and fast excution for zero overhead async/await integrate with Unity\nasync UniTask<string> DemoAsync()\n{\n    // You can await Unity's AsyncObject\n    var asset = await Resources.LoadAsync<TextAsset>(\"foo\");\n    var txt = (await UnityWebRequest.Get(\"https://...\").SendWebRequest()).downloadHandler.text;\n    await SceneManager.LoadSceneAsync(\"scene2\");\n\n    // .WithCancellation enables Cancel, GetCancellationTokenOnDestroy synchornizes with lifetime of GameObject\n    // after Unity 2022.2, you can use `destroyCancellationToken` in MonoBehaviour\n    var asset2 = await Resources.LoadAsync<TextAsset>(\"bar\").WithCancellation(this.GetCancellationTokenOnDestroy());\n\n    // .ToUniTask accepts progress callback(and all options), Progress.Create is a lightweight alternative of IProgress<T>\n    var asset3 = await Resources.LoadAsync<TextAsset>(\"baz\").ToUniTask(Progress.Create<float>(x => Debug.Log(x)));\n\n    // await frame-based operation like a coroutine\n    await UniTask.DelayFrame(100); \n\n    // replacement of yield return new WaitForSeconds/WaitForSecondsRealtime\n    await UniTask.Delay(TimeSpan.FromSeconds(10), ignoreTimeScale: false);\n    \n    // yield any playerloop timing(PreUpdate, Update, LateUpdate, etc...)\n    await UniTask.Yield(PlayerLoopTiming.PreLateUpdate);\n\n    // replacement of yield return null\n    await UniTask.Yield();\n    await UniTask.NextFrame();\n\n    // replacement of WaitForEndOfFrame\n#if UNITY_2023_1_OR_NEWER\n    await UniTask.WaitForEndOfFrame();\n#else\n    // requires MonoBehaviour(CoroutineRunner))\n    await UniTask.WaitForEndOfFrame(this); // this is MonoBehaviour\n#endif\n\n    // replacement of yield return new WaitForFixedUpdate(same as UniTask.Yield(PlayerLoopTiming.FixedUpdate))\n    await UniTask.WaitForFixedUpdate();\n    \n    // replacement of yield return WaitUntil\n    await UniTask.WaitUntil(() => isActive == false);\n\n    // special helper of WaitUntil\n    await UniTask.WaitUntilValueChanged(this, x => x.isActive);\n\n    // You can await IEnumerator coroutines\n    await FooCoroutineEnumerator();\n\n    // You can await a standard task\n    await Task.Run(() => 100);\n\n    // Multithreading, run on ThreadPool under this code\n    await UniTask.SwitchToThreadPool();\n\n    /* work on ThreadPool */\n\n    // return to MainThread(same as `ObserveOnMainThread` in UniRx)\n    await UniTask.SwitchToMainThread();\n\n    // get async webrequest\n    async UniTask<string> GetTextAsync(UnityWebRequest req)\n    {\n        var op = await req.SendWebRequest();\n        return op.downloadHandler.text;\n    }\n\n    var task1 = GetTextAsync(UnityWebRequest.Get(\"http://google.com\"));\n    var task2 = GetTextAsync(UnityWebRequest.Get(\"http://bing.com\"));\n    var task3 = GetTextAsync(UnityWebRequest.Get(\"http://yahoo.com\"));\n\n    // concurrent async-wait and get results easily by tuple syntax\n    var (google, bing, yahoo) = await UniTask.WhenAll(task1, task2, task3);\n\n    // shorthand of WhenAll, tuple can await directly\n    var (google2, bing2, yahoo2) = await (task1, task2, task3);\n\n    // return async-value.(or you can use `UniTask`(no result), `UniTaskVoid`(fire and forget)).\n    return (asset as TextAsset)?.text ?? throw new InvalidOperationException(\"Asset not found\");\n}\n```\n\nBasics of UniTask and AsyncOperation\n---\nUniTask features rely on C# 7.0([task-like custom async method builder feature](https://github.com/dotnet/roslyn/blob/master/docs/features/task-types.md)) so the required Unity version is after `Unity 2018.3`, the official lowest version supported is `Unity 2018.4.13f1`.\n\nWhy is UniTask(custom task-like object) required? Because Task is too heavy and not matched to Unity threading (single-thread). UniTask does not use threads and SynchronizationContext/ExecutionContext because Unity's asynchronous object is automaticaly dispatched by Unity's engine layer. It achieves faster and lower allocation, and is completely integrated with Unity.\n\nYou can await `AsyncOperation`, `ResourceRequest`, `AssetBundleRequest`, `AssetBundleCreateRequest`, `UnityWebRequestAsyncOperation`, `AsyncGPUReadbackRequest`, `IEnumerator` and others when `using Cysharp.Threading.Tasks;`.\n\nUniTask provides three pattern of extension methods.\n\n```csharp\n* await asyncOperation;\n* .WithCancellation(CancellationToken);\n* .ToUniTask(IProgress, PlayerLoopTiming, CancellationToken);\n```\n\n`WithCancellation` is a simple version of `ToUniTask`, both return `UniTask`. For details of cancellation, see: [Cancellation and Exception handling](#cancellation-and-exception-handling) section.\n\n> Note: await directly is returned from native timing of PlayerLoop but WithCancellation and ToUniTask are returned from specified PlayerLoopTiming. For details of timing, see: [PlayerLoop](#playerloop) section.\n\n> Note: AssetBundleRequest has `asset` and `allAssets`, default await returns `asset`. If you want to get `allAssets`, you can use `AwaitForAllAssets()` method.\n\nThe type of `UniTask` can use utilities like `UniTask.WhenAll`, `UniTask.WhenAny`, `UniTask.WhenEach`. They are like `Task.WhenAll`/`Task.WhenAny` but the return type is more useful. They return value tuples so you can deconstruct each result and pass multiple types.\n\n```csharp\npublic async UniTaskVoid LoadManyAsync()\n{\n    // parallel load.\n    var (a, b, c) = await UniTask.WhenAll(\n        LoadAsSprite(\"foo\"),\n        LoadAsSprite(\"bar\"),\n        LoadAsSprite(\"baz\"));\n}\n\nasync UniTask<Sprite> LoadAsSprite(string path)\n{\n    var resource = await Resources.LoadAsync<Sprite>(path);\n    return (resource as Sprite);\n}\n```\n\nIf you want to convert a callback to UniTask, you can use `UniTaskCompletionSource<T>` which is a lightweight edition of `TaskCompletionSource<T>`. \n\n```csharp\npublic UniTask<int> WrapByUniTaskCompletionSource()\n{\n    var utcs = new UniTaskCompletionSource<int>();\n\n    // when complete, call utcs.TrySetResult();\n    // when failed, call utcs.TrySetException();\n    // when cancel, call utcs.TrySetCanceled();\n\n    return utcs.Task; //return UniTask<int>\n}\n```\n\nYou can convert Task -> UniTask: `AsUniTask`, `UniTask` -> `UniTask<AsyncUnit>`: `AsAsyncUnitUniTask`, `UniTask<T>` -> `UniTask`: `AsUniTask`. `UniTask<T>` -> `UniTask`'s conversion cost is free.\n\nIf you want to convert async to coroutine, you can use `.ToCoroutine()`, this is useful if you want to only allow using the coroutine system.\n\nUniTask can not await twice. This is a similar constraint to the [ValueTask/IValueTaskSource](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.valuetask-1?view=netcore-3.1) introduced in .NET Standard 2.1.\n\n> The following operations should never be performed on a ValueTask<TResult> instance:\n>\n> * Awaiting the instance multiple times.\n> * Calling AsTask multiple times.\n> * Using .Result or .GetAwaiter().GetResult() when the operation hasn't yet completed, or using them multiple times.\n> * Using more than one of these techniques to consume the instance.\n>\n> If you do any of the above, the results are undefined.\n\n```csharp\nvar task = UniTask.DelayFrame(10);\nawait task;\nawait task; // NG, throws Exception\n```\n\nStore to the class field, you can use `UniTask.Lazy` that supports calling multiple times. `.Preserve()` allows for multiple calls (internally cached results). This is useful when there are multiple calls in a function scope.\n\nAlso `UniTaskCompletionSource` can await multiple times and await from many callers.\n\nCancellation and Exception handling\n---\nSome UniTask factory methods have a `CancellationToken cancellationToken = default` parameter. Also some async operations for Unity have `WithCancellation(CancellationToken)` and `ToUniTask(..., CancellationToken cancellation = default)` extension methods. \n\nYou can pass `CancellationToken` to parameter by standard [`CancellationTokenSource`](https://docs.microsoft.com/en-us/dotnet/api/system.threading.cancellationtokensource).\n\n```csharp\nvar cts = new CancellationTokenSource();\n\ncancelButton.onClick.AddListener(() =>\n{\n    cts.Cancel();\n});\n\nawait UnityWebRequest.Get(\"http://google.co.jp\").SendWebRequest().WithCancellation(cts.Token);\n\nawait UniTask.DelayFrame(1000, cancellationToken: cts.Token);\n```\n\nCancellationToken can be created by `CancellationTokenSource` or MonoBehaviour's extension method `GetCancellationTokenOnDestroy`.\n\n```csharp\n// this CancellationToken lifecycle is same as GameObject.\nawait UniTask.DelayFrame(1000, cancellationToken: this.GetCancellationTokenOnDestroy());\n```\n\nFor propagate Cancellation, all async method recommend to accept `CancellationToken cancellationToken` at last argument, and pass `CancellationToken` from root to end.\n\n```csharp\nawait FooAsync(this.GetCancellationTokenOnDestroy());\n\n// ---\n\nasync UniTask FooAsync(CancellationToken cancellationToken)\n{\n    await BarAsync(cancellationToken);\n}\n\nasync UniTask BarAsync(CancellationToken cancellationToken)\n{\n    await UniTask.Delay(TimeSpan.FromSeconds(3), cancellationToken);\n}\n```\n\n`CancellationToken` means lifecycle of async. You can hold your own lifecycle insteadof default CancellationTokenOnDestroy.\n\n```csharp\npublic class MyBehaviour : MonoBehaviour\n{\n    CancellationTokenSource disableCancellation = new CancellationTokenSource();\n    CancellationTokenSource destroyCancellation = new CancellationTokenSource();\n\n    private void OnEnable()\n    {\n        if (disableCancellation != null)\n        {\n            disableCancellation.Dispose();\n        }\n        disableCancellation = new CancellationTokenSource();\n    }\n\n    private void OnDisable()\n    {\n        disableCancellation.Cancel();\n    }\n\n    private void OnDestroy()\n    {\n        destroyCancellation.Cancel();\n        destroyCancellation.Dispose();\n    }\n}\n```\n\nAfter Unity 2022.2, Unity adds CancellationToken in [MonoBehaviour.destroyCancellationToken](https://docs.unity3d.com/ScriptReference/MonoBehaviour-destroyCancellationToken.html) and [Application.exitCancellationToken](https://docs.unity3d.com/ScriptReference/Application-exitCancellationToken.html).\n\nWhen cancellation is detected, all methods throw `OperationCanceledException` and propagate upstream. When exception(not limited to `OperationCanceledException`) is not handled in async method, it is propagated finally to `UniTaskScheduler.UnobservedTaskException`. The default behaviour of received unhandled exception is to write log as exception. Log level can be changed using `UniTaskScheduler.UnobservedExceptionWriteLogType`. If you want to use custom behaviour, set an action to `UniTaskScheduler.UnobservedTaskException.`\n\nAnd also `OperationCanceledException` is a special exception, this is silently ignored at `UnobservedTaskException`.\n\nIf you want to cancel behaviour in an async UniTask method, throw `OperationCanceledException` manually.\n\n```csharp\npublic async UniTask<int> FooAsync()\n{\n    await UniTask.Yield();\n    throw new OperationCanceledException();\n}\n```\n\nIf you handle an exception but want to ignore(propagate to global cancellation handling), use an exception filter.\n\n```csharp\npublic async UniTask<int> BarAsync()\n{\n    try\n    {\n        var x = await FooAsync();\n        return x * 2;\n    }\n    catch (Exception ex) when (!(ex is OperationCanceledException)) // when (ex is not OperationCanceledException) at C# 9.0\n    {\n        return -1;\n    }\n}\n```\n\nthrows/catch `OperationCanceledException` is slightly heavy, so if performance is a concern, use `UniTask.SuppressCancellationThrow` to avoid OperationCanceledException throw. It returns `(bool IsCanceled, T Result)` instead of throwing.\n\n```csharp\nvar (isCanceled, _) = await UniTask.DelayFrame(10, cancellationToken: cts.Token).SuppressCancellationThrow();\nif (isCanceled)\n{\n    // ...\n}\n```\n\nNote: Only suppress throws if you call directly into the most source method. Otherwise, the return value will be converted, but the entire pipeline will not suppress throws.\n\nSome features that use Unity's player loop, such as `UniTask.Yield` and `UniTask.Delay` etc, determines CancellationToken state on the player loop. \nThis means it does not cancel immediately upon `CancellationToken` fired. \n\nIf you want to change this behaviour, the cancellation to be immediate, set the `cancelImmediately` flag as an argument.\n\n```csharp\nawait UniTask.Yield(cancellationToken, cancelImmediately: true);\n```\n\nNote: Setting `cancelImmediately` to true and detecting an immediate cancellation is more costly than the default behavior.\nThis is because it uses `CancellationToken.Register`; it is heavier than checking CancellationToken on the player loop.\n\nTimeout handling\n---\nTimeout is a variation of cancellation. You can set timeout by `CancellationTokenSouce.CancelAfterSlim(TimeSpan)` and pass CancellationToken to async methods.\n\n```csharp\nvar cts = new CancellationTokenSource();\ncts.CancelAfterSlim(TimeSpan.FromSeconds(5)); // 5sec timeout.\n\ntry\n{\n    await UnityWebRequest.Get(\"http://foo\").SendWebRequest().WithCancellation(cts.Token);\n}\ncatch (OperationCanceledException ex)\n{\n    if (ex.CancellationToken == cts.Token)\n    {\n        UnityEngine.Debug.Log(\"Timeout\");\n    }\n}\n```\n\n> `CancellationTokenSouce.CancelAfter` is a standard api. However in Unity you should not use it because it depends threading timer. `CancelAfterSlim` is UniTask's extension methods, it uses PlayerLoop instead.\n\nIf you want to use timeout with other source of cancellation, use `CancellationTokenSource.CreateLinkedTokenSource`.\n\n```csharp\nvar cancelToken = new CancellationTokenSource();\ncancelButton.onClick.AddListener(() =>\n{\n    cancelToken.Cancel(); // cancel from button click.\n});\n\nvar timeoutToken = new CancellationTokenSource();\ntimeoutToken.CancelAfterSlim(TimeSpan.FromSeconds(5)); // 5sec timeout.\n\ntry\n{\n    // combine token\n    var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancelToken.Token, timeoutToken.Token);\n\n    await UnityWebRequest.Get(\"http://foo\").SendWebRequest().WithCancellation(linkedTokenSource.Token);\n}\ncatch (OperationCanceledException ex)\n{\n    if (timeoutToken.IsCancellationRequested)\n    {\n        UnityEngine.Debug.Log(\"Timeout.\");\n    }\n    else if (cancelToken.IsCancellationRequested)\n    {\n        UnityEngine.Debug.Log(\"Cancel clicked.\");\n    }\n}\n```\n\nOptimize for reduce allocation of CancellationTokenSource for timeout per call async method, you can use UniTask's `TimeoutController`.\n\n```csharp\nTimeoutController timeoutController = new TimeoutController(); // setup to field for reuse.\n\nasync UniTask FooAsync()\n{\n    try\n    {\n        // you can pass timeoutController.Timeout(TimeSpan) to cancellationToken.\n        await UnityWebRequest.Get(\"http://foo\").SendWebRequest()\n            .WithCancellation(timeoutController.Timeout(TimeSpan.FromSeconds(5)));\n        timeoutController.Reset(); // call Reset(Stop timeout timer and ready for reuse) when succeed.\n    }\n    catch (OperationCanceledException ex)\n    {\n        if (timeoutController.IsTimeout())\n        {\n            UnityEngine.Debug.Log(\"timeout\");\n        }\n    }\n}\n```\n\nIf you want to use timeout with other source of cancellation, use `new TimeoutController(CancellationToken)`.\n\n```csharp\nTimeoutController timeoutController;\nCancellationTokenSource clickCancelSource;\n\nvoid Start()\n{\n    this.clickCancelSource = new CancellationTokenSource();\n    this.timeoutController = new TimeoutController(clickCancelSource);\n}\n```\n\nNote: UniTask has `.Timeout`, `.TimeoutWithoutException` methods however, if possible, do not use these, please pass `CancellationToken`. Because `.Timeout` work from external of task, can not stop timeoutted task. `.Timeout` means ignore result when timeout. If you pass a `CancellationToken` to the method, it will act from inside of the task, so it is possible to stop a running task.\n\nProgress\n---\nSome async operations for unity have `ToUniTask(IProgress<float> progress = null, ...)` extension methods. \n\n```csharp\nvar progress = Progress.Create<float>(x => Debug.Log(x));\n\nvar request = await UnityWebRequest.Get(\"http://google.co.jp\")\n    .SendWebRequest()\n    .ToUniTask(progress: progress);\n```\n\nYou should not use standard `new System.Progress<T>`, because it causes allocation every time. Use `Cysharp.Threading.Tasks.Progress` instead. This progress factory has two methods, `Create` and `CreateOnlyValueChanged`. `CreateOnlyValueChanged` calls only when the progress value has changed.\n\nImplementing IProgress interface to caller is better as there is no lambda allocation.\n\n```csharp\npublic class Foo : MonoBehaviour, IProgress<float>\n{\n    public void Report(float value)\n    {\n        UnityEngine.Debug.Log(value);\n    }\n\n    public async UniTaskVoid WebRequest()\n    {\n        var request = await UnityWebRequest.Get(\"http://google.co.jp\")\n            .SendWebRequest()\n            .ToUniTask(progress: this); // pass this\n    }\n}\n```\n\nPlayerLoop\n---\nUniTask is run on a custom [PlayerLoop](https://docs.unity3d.com/ScriptReference/LowLevel.PlayerLoop.html). UniTask's playerloop based methods (such as `Delay`, `DelayFrame`, `asyncOperation.ToUniTask`, etc...) accept this `PlayerLoopTiming`.\n\n```csharp\npublic enum PlayerLoopTiming\n{\n    Initialization = 0,\n    LastInitialization = 1,\n\n    EarlyUpdate = 2,\n    LastEarlyUpdate = 3,\n\n    FixedUpdate = 4,\n    LastFixedUpdate = 5,\n\n    PreUpdate = 6,\n    LastPreUpdate = 7,\n\n    Update = 8,\n    LastUpdate = 9,\n\n    PreLateUpdate = 10,\n    LastPreLateUpdate = 11,\n\n    PostLateUpdate = 12,\n    LastPostLateUpdate = 13\n    \n#if UNITY_2020_2_OR_NEWER\n    TimeUpdate = 14,\n    LastTimeUpdate = 15,\n#endif\n}\n```\n\nIt indicates when to run, you can check [PlayerLoopList.md](https://gist.github.com/neuecc/bc3a1cfd4d74501ad057e49efcd7bdae) to Unity's default playerloop and injected UniTask's custom loop.\n\n`PlayerLoopTiming.Update` is similar to `yield return null` in a coroutine, but it is called before Update(Update and uGUI events(button.onClick, etc...) are called on `ScriptRunBehaviourUpdate`, yield return null is called on `ScriptRunDelayedDynamicFrameRate`). `PlayerLoopTiming.FixedUpdate` is similar to `WaitForFixedUpdate`.\n\n> `PlayerLoopTiming.LastPostLateUpdate` is not equivalent to coroutine's `yield return new WaitForEndOfFrame()`. Coroutine's WaitForEndOfFrame seems to run after the PlayerLoop is done. Some methods that require coroutine's end of frame(`Texture2D.ReadPixels`, `ScreenCapture.CaptureScreenshotAsTexture`, `CommandBuffer`, etc) do not work correctly when replaced with async/await. In these cases, pass MonoBehaviour(coroutine runnner) to `UniTask.WaitForEndOfFrame`. For example, `await UniTask.WaitForEndOfFrame(this);` is lightweight allocation free alternative of `yield return new WaitForEndOfFrame()`.\n> \n> Note: In Unity 2023.1 or newer, `await UniTask.WaitForEndOfFrame();` no longer requires MonoBehaviour. It uses `UnityEngine.Awaitable.EndOfFrameAsync`.\n\n`yield return null` and `UniTask.Yield` are similar but different. `yield return null` always returns next frame but `UniTask.Yield` returns next called. That is, call `UniTask.Yield(PlayerLoopTiming.Update)` on `PreUpdate`, it returns same frame. `UniTask.NextFrame()` guarantees return next frame, you can expect this to behave exactly the same as `yield return null`.\n\n> UniTask.Yield(without CancellationToken) is a special type, returns `YieldAwaitable` and runs on YieldRunner. It is the most lightweight and fastest.\n\n`AsyncOperation` is returned from native timing. For example, await `SceneManager.LoadSceneAsync` is returned from `EarlyUpdate.UpdatePreloading` and after being called, the loaded scene's `Start` is called from `EarlyUpdate.ScriptRunDelayedStartupFrame`. Also `await UnityWebRequest` is returned from `EarlyUpdate.ExecuteMainThreadJobs`.\n\nIn UniTask, await directly uses native timing, while `WithCancellation` and `ToUniTask` use specified timing. This is usually not a particular problem, but with `LoadSceneAsync`, it causes a different order of Start and continuation after await. So it is recommended not to use `LoadSceneAsync.ToUniTask`.\n\n> Note: When using Unity 2023.1 or newer, ensure you have `using UnityEngine;` in the using statements of your file when working with new `UnityEngine.Awaitable` methods like `SceneManager.LoadSceneAsync`. \n> This prevents compilation errors by avoiding the use of the `UnityEngine.AsyncOperation` version.\n\nIn the stacktrace, you can check where it is running in playerloop.\n\n![image](https://user-images.githubusercontent.com/46207/83735571-83caea80-a68b-11ea-8d22-5e22864f0d24.png)\n\nBy default, UniTask's PlayerLoop is initialized at `[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]`.\n\nThe order in which methods are called in BeforeSceneLoad is nondeterministic, so if you want to use UniTask in other BeforeSceneLoad methods, you should try to initialize it before this.\n\n```csharp\n// AfterAssembliesLoaded is called before BeforeSceneLoad\n[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]\npublic static void InitUniTaskLoop()\n{\n    var loop = PlayerLoop.GetCurrentPlayerLoop();\n    Cysharp.Threading.Tasks.PlayerLoopHelper.Initialize(ref loop);\n}\n```\n\nIf you import Unity's `Entities` package, that resets the custom player loop to default at `BeforeSceneLoad` and injects ECS's loop. When Unity calls ECS's inject method after UniTask's initialize method, UniTask will no longer work.\n\nTo solve this issue, you can re-initialize the UniTask PlayerLoop after ECS is initialized.\n\n```csharp\n// Get ECS Loop.\nvar playerLoop = ScriptBehaviourUpdateOrder.CurrentPlayerLoop;\n\n// Setup UniTask's PlayerLoop.\nPlayerLoopHelper.Initialize(ref playerLoop);\n```\n\nYou can diagnose whether UniTask's player loop is ready by calling `PlayerLoopHelper.IsInjectedUniTaskPlayerLoop()`. And also `PlayerLoopHelper.DumpCurrentPlayerLoop` logs all current playerloops to console.\n\n```csharp\nvoid Start()\n{\n    UnityEngine.Debug.Log(\"UniTaskPlayerLoop ready? \" + PlayerLoopHelper.IsInjectedUniTaskPlayerLoop());\n    PlayerLoopHelper.DumpCurrentPlayerLoop();\n}\n```\n\nYou can optimize loop cost slightly by remove unuse PlayerLoopTiming injection. You can call `PlayerLoopHelper.Initialize(InjectPlayerLoopTimings)` on initialize.\n\n```csharp\nvar loop = PlayerLoop.GetCurrentPlayerLoop();\nPlayerLoopHelper.Initialize(ref loop, InjectPlayerLoopTimings.Minimum); // minimum is Update | FixedUpdate | LastPostLateUpdate\n```\n\n`InjectPlayerLoopTimings` has three preset, `All` and `Standard`(All without last except LastPostLateUpdate), `Minimum`(`Update | FixedUpdate | LastPostLateUpdate`). Default is All and you can combine custom inject timings like `InjectPlayerLoopTimings.Update | InjectPlayerLoopTimings.FixedUpdate | InjectPlayerLoopTimings.PreLateUpdate`.\n\nYou can make error to use uninjected `PlayerLoopTiming` by [Microsoft.CodeAnalysis.BannedApiAnalyzers](https://github.com/dotnet/roslyn-analyzers/blob/master/src/Microsoft.CodeAnalysis.BannedApiAnalyzers/BannedApiAnalyzers.Help.md). For example, you can setup `BannedSymbols.txt` like this for `InjectPlayerLoopTimings.Minimum`.\n\n```txt\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.Initialization; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.LastInitialization; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.EarlyUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.LastEarlyUpdate; Isn't injected this PlayerLoop in this project.d\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.LastFixedUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.PreUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.LastPreUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.LastUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.PreLateUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.LastPreLateUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.PostLateUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.TimeUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.LastTimeUpdate; Isn't injected this PlayerLoop in this project.\n```\n\nYou can configure `RS0030` severity to error.\n\n![image](https://user-images.githubusercontent.com/46207/109150837-bb933880-77ac-11eb-85ba-4fd15819dbd0.png)\n\nasync void vs async UniTaskVoid\n---\n`async void` is a standard C# task system so it does not run on UniTask systems. It is better not to use it. `async UniTaskVoid` is a lightweight version of `async UniTask` because it does not have awaitable completion and reports errors immediately to `UniTaskScheduler.UnobservedTaskException`. If you don't require awaiting (fire and forget), using `UniTaskVoid` is better. Unfortunately to dismiss warning, you're required to call `Forget()`.\n\n```csharp\npublic async UniTaskVoid FireAndForgetMethod()\n{\n    // do anything...\n    await UniTask.Yield();\n}\n\npublic void Caller()\n{\n    FireAndForgetMethod().Forget();\n}\n```\n\nAlso UniTask has the `Forget` method, it is similar to `UniTaskVoid` and has the same effects. However `UniTaskVoid` is more efficient if you completely don't use `await`。\n\n```csharp\npublic async UniTask DoAsync()\n{\n    // do anything...\n    await UniTask.Yield();\n}\n\npublic void Caller()\n{\n    DoAsync().Forget();\n}\n```\n\nTo use an async lambda registered to an event, don't use `async void`. Instead you can use `UniTask.Action` or `UniTask.UnityAction`, both of which create a delegate via `async UniTaskVoid` lambda.\n\n```csharp\nAction actEvent;\nUnityAction unityEvent; // especially used in uGUI\n\n// Bad: async void\nactEvent += async () => { };\nunityEvent += async () => { };\n\n// Ok: create Action delegate by lambda\nactEvent += UniTask.Action(async () => { await UniTask.Yield(); });\nunityEvent += UniTask.UnityAction(async () => { await UniTask.Yield(); });\n```\n\n`UniTaskVoid` can also be used in MonoBehaviour's `Start` method.\n\n```csharp\nclass Sample : MonoBehaviour\n{\n    async UniTaskVoid Start()\n    {\n        // async init code.\n    }\n}\n```\n\nUniTaskTracker\n---\nuseful for checking (leaked) UniTasks. You can open tracker window in `Window -> UniTask Tracker`.\n\n![image](https://user-images.githubusercontent.com/46207/83527073-4434bf00-a522-11ea-86e9-3b3975b26266.png)\n\n* Enable AutoReload(Toggle) - Reload automatically.\n* Reload - Reload view.\n* GC.Collect - Invoke GC.Collect.\n* Enable Tracking(Toggle) - Start to track async/await UniTask. Performance impact: low.\n* Enable StackTrace(Toggle) - Capture StackTrace when task is started. Performance impact: high.\n\nUniTaskTracker is intended for debugging use only as enabling tracking and capturing stacktraces is useful but has a heavy performance impact. Recommended usage is to enable both tracking and stacktraces to find task leaks and to disable them both when done.\n\nExternal Assets\n---\nBy default, UniTask supports TextMeshPro(`BindTo(TMP_Text)` and `TMP_InputField` event extensions like standard uGUI `InputField`), DOTween(`Tween` as awaitable) and Addressables(`AsyncOperationHandle` and `AsyncOperationHandle<T>` as awaitable).\n\nThere are defined in separated asmdefs like `UniTask.TextMeshPro`, `UniTask.DOTween`, `UniTask.Addressables`.\n\nTextMeshPro and Addressables support are automatically enabled when importing their packages from package manager. \nHowever for DOTween support, after importing from the [DOTWeen assets](https://assetstore.unity.com/packages/tools/animation/dotween-hotween-v2-27676r) and define the scripting define symbol `UNITASK_DOTWEEN_SUPPORT` to enable it.\n\n```csharp\n// sequential\nawait transform.DOMoveX(2, 10);\nawait transform.DOMoveZ(5, 20);\n\n// parallel with cancellation\nvar ct = this.GetCancellationTokenOnDestroy();\n\nawait UniTask.WhenAll(\n    transform.DOMoveX(10, 3).WithCancellation(ct),\n    transform.DOScale(10, 3).WithCancellation(ct));\n```\n\nDOTween support's default behaviour(`await`, `WithCancellation`, `ToUniTask`) awaits tween is killed. It works on both Complete(true/false) and Kill(true/false). But if you want to reuse tweens (`SetAutoKill(false)`), it does not work as expected. If you want to await for another timing, the following extension methods exist in Tween, `AwaitForComplete`, `AwaitForPause`, `AwaitForPlay`, `AwaitForRewind`, `AwaitForStepComplete`.\n\nAsyncEnumerable and Async LINQ\n---\nUnity 2020.2 supports C# 8.0 so you can use `await foreach`. This is the new Update notation in the async era.\n\n```csharp\n// Unity 2020.2, C# 8.0\nawait foreach (var _ in UniTaskAsyncEnumerable.EveryUpdate().WithCancellation(token))\n{\n    Debug.Log(\"Update() \" + Time.frameCount);\n}\n```\n\nIn a C# 7.3 environment, you can use the `ForEachAsync` method to work in almost the same way.\n\n```csharp\n// C# 7.3(Unity 2018.3~)\nawait UniTaskAsyncEnumerable.EveryUpdate().ForEachAsync(_ =>\n{\n    Debug.Log(\"Update() \" + Time.frameCount);\n}, token);\n```\n\n`UniTask.WhenEach` that is similar to .NET 9's `Task.WhenEach` can consume new way for await multiple tasks.\n\n```csharp\nawait foreach (var result in UniTask.WhenEach(task1, task2, task3))\n{\n    // The result is of type WhenEachResult<T>.\n    // It contains either `T Result` or `Exception Exception`.\n    // You can check `IsCompletedSuccessfully` or `IsFaulted` to determine whether to access `.Result` or `.Exception`.\n    // If you want to throw an exception when `IsFaulted` and retrieve the result when successful, use `GetResult()`.\n    Debug.Log(result.GetResult());\n}\n```\n\nUniTaskAsyncEnumerable implements asynchronous LINQ, similar to LINQ in `IEnumerable<T>` or Rx in `IObservable<T>`. All standard LINQ query operators can be applied to asynchronous streams. For example, the following code shows how to apply a Where filter to a button-click asynchronous stream that runs once every two clicks.\n\n```csharp\nawait okButton.OnClickAsAsyncEnumerable().Where((x, i) => i % 2 == 0).ForEachAsync(_ =>\n{\n});\n```\n\nFire and Forget style(for example, event handling), you can also use `Subscribe`.\n\n```csharp\nokButton.OnClickAsAsyncEnumerable().Where((x, i) => i % 2 == 0).Subscribe(_ =>\n{\n});\n```\n\nAsync LINQ is enabled when `using Cysharp.Threading.Tasks.Linq;`, and `UniTaskAsyncEnumerable` is defined in `UniTask.Linq` asmdef.\n\nIt's closer to UniRx (Reactive Extensions), but UniTaskAsyncEnumerable is a pull-based asynchronous stream, whereas Rx was a push-based asynchronous stream. Note that although similar, the characteristics are different and the details behave differently along with them.\n\n`UniTaskAsyncEnumerable` is the entry point like `Enumerable`. In addition to the standard query operators, there are other generators for Unity such as `EveryUpdate`, `Timer`, `TimerFrame`, `Interval`, `IntervalFrame`, and `EveryValueChanged`. And also added additional UniTask original query operators like `Append`, `Prepend`, `DistinctUntilChanged`, `ToHashSet`, `Buffer`, `CombineLatest`,`Merge` `Do`, `Never`, `ForEachAsync`, `Pairwise`, `Publish`, `Queue`, `Return`, `SkipUntil`, `TakeUntil`, `SkipUntilCanceled`, `TakeUntilCanceled`, `TakeLast`, `Subscribe`.\n\nThe method with Func as an argument has three additional overloads, `***Await`, `***AwaitWithCancellation`.\n\n```csharp\nSelect(Func<T, TR> selector)\nSelectAwait(Func<T, UniTask<TR>> selector)\nSelectAwaitWithCancellation(Func<T, CancellationToken, UniTask<TR>> selector)\n```\n\nIf you want to use the `async` method inside the func, use the `***Await` or `***AwaitWithCancellation`.\n\nHow to create an async iterator: C# 8.0 supports async iterator(`async yield return`) but it only allows `IAsyncEnumerable<T>` and of course requires C# 8.0. UniTask supports `UniTaskAsyncEnumerable.Create` method to create custom async iterator.\n\n```csharp\n// IAsyncEnumerable, C# 8.0 version of async iterator. ( do not use this style, IAsyncEnumerable is not controled in UniTask).\npublic async IAsyncEnumerable<int> MyEveryUpdate([EnumeratorCancellation]CancellationToken cancelationToken = default)\n{\n    var frameCount = 0;\n    await UniTask.Yield();\n    while (!token.IsCancellationRequested)\n    {\n        yield return frameCount++;\n        await UniTask.Yield();\n    }\n}\n\n// UniTaskAsyncEnumerable.Create and use `await writer.YieldAsync` instead of `yield return`.\npublic IUniTaskAsyncEnumerable<int> MyEveryUpdate()\n{\n    // writer(IAsyncWriter<T>) has `YieldAsync(value)` method.\n    return UniTaskAsyncEnumerable.Create<int>(async (writer, token) =>\n    {\n        var frameCount = 0;\n        await UniTask.Yield();\n        while (!token.IsCancellationRequested)\n        {\n            await writer.YieldAsync(frameCount++); // instead of `yield return`\n            await UniTask.Yield();\n        }\n    });\n}\n```\n\nAwaitable Events\n---\nAll uGUI component implements `***AsAsyncEnumerable` to convert asynchronous streams of events.\n\n```csharp\nasync UniTask TripleClick()\n{\n    // In default, used button.GetCancellationTokenOnDestroy to manage lieftime of async\n    await button.OnClickAsync();\n    await button.OnClickAsync();\n    await button.OnClickAsync();\n    Debug.Log(\"Three times clicked\");\n}\n\n// more efficient way\nasync UniTask TripleClick()\n{\n    using (var handler = button.GetAsyncClickEventHandler())\n    {\n        await handler.OnClickAsync();\n        await handler.OnClickAsync();\n        await handler.OnClickAsync();\n        Debug.Log(\"Three times clicked\");\n    }\n}\n\n// use async LINQ\nasync UniTask TripleClick(CancellationToken token)\n{\n    await button.OnClickAsAsyncEnumerable().Take(3).Last();\n    Debug.Log(\"Three times clicked\");\n}\n\n// use async LINQ2\nasync UniTask TripleClick(CancellationToken token)\n{\n    await button.OnClickAsAsyncEnumerable().Take(3).ForEachAsync(_ =>\n    {\n        Debug.Log(\"Every clicked\");\n    });\n    Debug.Log(\"Three times clicked, complete.\");\n}\n```\n\nAll MonoBehaviour message events can convert async-streams by `AsyncTriggers` that can be enabled by `using Cysharp.Threading.Tasks.Triggers;`. AsyncTrigger can be created using `GetAsync***Trigger` and triggers itself as UniTaskAsyncEnumerable.\n\n```csharp\nvar trigger = this.GetOnCollisionEnterAsyncHandler();\nawait trigger.OnCollisionEnterAsync();\nawait trigger.OnCollisionEnterAsync();\nawait trigger.OnCollisionEnterAsync();\n\n// every moves.\nawait this.GetAsyncMoveTrigger().ForEachAsync(axisEventData =>\n{\n});\n```\n\n`AsyncReactiveProperty`, `AsyncReadOnlyReactiveProperty` is UniTask's version of ReactiveProperty. `BindTo` extension method of `IUniTaskAsyncEnumerable<T>` for binding asynchronous stream values to Unity components(Text/Selectable/TMP/Text).\n\n```csharp\nvar rp = new AsyncReactiveProperty<int>(99);\n\n// AsyncReactiveProperty itself is IUniTaskAsyncEnumerable, you can query by LINQ\nrp.ForEachAsync(x =>\n{\n    Debug.Log(x);\n}, this.GetCancellationTokenOnDestroy()).Forget();\n\nrp.Value = 10; // push 10 to all subscriber\nrp.Value = 11; // push 11 to all subscriber\n\n// WithoutCurrent ignore initial value\n// BindTo bind stream value to unity components.\nrp.WithoutCurrent().BindTo(this.textComponent);\n\nawait rp.WaitAsync(); // wait until next value set\n\n// also exists ToReadOnlyAsyncReactiveProperty\nvar rp2 = new AsyncReactiveProperty<int>(99);\nvar rorp = rp.CombineLatest(rp2, (x, y) => (x, y)).ToReadOnlyAsyncReactiveProperty(CancellationToken.None);\n```\n\nA pull-type asynchronous stream does not get the next values until the asynchronous processing in the sequence is complete. This could spill data from push-type events such as buttons.\n\n```csharp\n// can not get click event during 3 seconds complete.\nawait button.OnClickAsAsyncEnumerable().ForEachAwaitAsync(async x =>\n{\n    await UniTask.Delay(TimeSpan.FromSeconds(3));\n});\n```\n\nIt is useful (prevent double-click) but not useful sometimes.\n\nUsing the `Queue()` method will also queue events during asynchronous processing.\n\n```csharp\n// queued message in asynchronous processing\nawait button.OnClickAsAsyncEnumerable().Queue().ForEachAwaitAsync(async x =>\n{\n    await UniTask.Delay(TimeSpan.FromSeconds(3));\n});\n```\n\nOr use `Subscribe`, fire and forget style.\n\n```csharp\nbutton.OnClickAsAsyncEnumerable().Subscribe(async x =>\n{\n    await UniTask.Delay(TimeSpan.FromSeconds(3));\n});\n```\n\nChannel\n---\n`Channel` is the same as [System.Threading.Tasks.Channels](https://docs.microsoft.com/en-us/dotnet/api/system.threading.channels?view=netcore-3.1) which is similar to a GoLang Channel.\n\nCurrently it only supports multiple-producer, single-consumer unbounded channels. It can create by `Channel.CreateSingleConsumerUnbounded<T>()`.\n\nFor producer(`.Writer`), use `TryWrite` to push value and `TryComplete` to complete channel. For consumer(`.Reader`), use `TryRead`, `WaitToReadAsync`, `ReadAsync`, `Completion` and `ReadAllAsync` to read queued messages.\n\n`ReadAllAsync` returns `IUniTaskAsyncEnumerable<T>` so query LINQ operators. Reader only allows single-consumer but uses `.Publish()` query operator to enable multicast message. For example, make pub/sub utility.\n\n```csharp\npublic class AsyncMessageBroker<T> : IDisposable\n{\n    Channel<T> channel;\n\n    IConnectableUniTaskAsyncEnumerable<T> multicastSource;\n    IDisposable connection;\n\n    public AsyncMessageBroker()\n    {\n        channel = Channel.CreateSingleConsumerUnbounded<T>();\n        multicastSource = channel.Reader.ReadAllAsync().Publish();\n        connection = multicastSource.Connect(); // Publish returns IConnectableUniTaskAsyncEnumerable.\n    }\n\n    public void Publish(T value)\n    {\n        channel.Writer.TryWrite(value);\n    }\n\n    public IUniTaskAsyncEnumerable<T> Subscribe()\n    {\n        return multicastSource;\n    }\n\n    public void Dispose()\n    {\n        channel.Writer.TryComplete();\n        connection.Dispose();\n    }\n}\n```\n\nvs Awaitable\n---\nUnity 6 introduces the awaitable type, [Awaitable](https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Awaitable.html). To put it simply, Awaitable can be considered a subset of UniTask, and in fact, Awaitable's design was influenced by UniTask. It should be able to handle PlayerLoop-based awaits, pooled Tasks, and support for cancellation with `CancellationToken` in a similar way. With its inclusion in the standard library, you may wonder whether to continue using UniTask or migrate to Awaitable. Here's a brief guide.\n\nFirst, the functionality provided by Awaitable is equivalent to what coroutines offer. Instead of `yield return`, you use await; `await NextFrameAsync()` replaces `yield return null`; and there are equivalents for `WaitForSeconds` and `EndOfFrame`. However, that's the extent of it. Being coroutine-based in terms of functionality, it lacks Task-based features. In practical application development using async/await, operations like `WhenAll` are essential. Additionally, UniTask enables many frame-based operations (such as `DelayFrame`) and more flexible PlayerLoopTiming control, which are not available in Awaitable. Of course, there's no Tracker Window either.\n\nTherefore, I recommend using UniTask for application development. UniTask is a superset of Awaitable and includes many essential features. For library development, where you want to avoid external dependencies, using Awaitable as a return type for methods would be appropriate. Awaitable can be converted to UniTask using `AsUniTask`, so there's no issue in handling Awaitable-based functionality within the UniTask library. Of course, if you don't need to worry about dependencies, using UniTask would be the best choice even for library development.\n\nFor Unit Testing\n---\nUnity's `[UnityTest]` attribute can test coroutine(IEnumerator) but can not test async. `UniTask.ToCoroutine` bridges async/await to coroutine so you can test async methods.\n\n```csharp\n[UnityTest]\npublic IEnumerator DelayIgnore() => UniTask.ToCoroutine(async () =>\n{\n    var time = Time.realtimeSinceStartup;\n\n    Time.timeScale = 0.5f;\n    try\n    {\n        await UniTask.Delay(TimeSpan.FromSeconds(3), ignoreTimeScale: true);\n\n        var elapsed = Time.realtimeSinceStartup - time;\n        Assert.AreEqual(3, (int)Math.Round(TimeSpan.FromSeconds(elapsed).TotalSeconds, MidpointRounding.ToEven));\n    }\n    finally\n    {\n        Time.timeScale = 1.0f;\n    }\n});\n```\n\nUniTask's own unit tests are written using Unity Test Runner and [Cysharp/RuntimeUnitTestToolkit](https://github.com/Cysharp/RuntimeUnitTestToolkit) to integrate with CI and check if IL2CPP is working.\n\nThreadPool limitation\n---\nMost UniTask methods run on a single thread (PlayerLoop), with only `UniTask.Run`(`Task.Run` equivalent) and `UniTask.SwitchToThreadPool` running on a thread pool. If you use a thread pool, it won't work with WebGL and so on.\n\n`UniTask.Run` is now deprecated. You can use `UniTask.RunOnThreadPool` instead. And also consider whether you can use `UniTask.Create` or `UniTask.Void`.\n\nIEnumerator.ToUniTask limitation\n---\nYou can convert coroutine(IEnumerator) to UniTask(or await directly) but it has some limitations.\n\n* `WaitForEndOfFrame`/`WaitForFixedUpdate`/`Coroutine` is not supported.\n* Consuming loop timing is not the same as `StartCoroutine`, it uses the specified `PlayerLoopTiming` and the default `PlayerLoopTiming.Update` is run before MonoBehaviour's `Update` and `StartCoroutine`'s loop.\n\nIf you want fully compatible conversion from coroutine to async, use the `IEnumerator.ToUniTask(MonoBehaviour coroutineRunner)` overload. It executes StartCoroutine on an instance of the argument MonoBehaviour and waits for it to complete in UniTask.\n\nFor UnityEditor\n---\nUniTask can run on Unity Editor like an Editor Coroutine. However, there are some limitations.\n\n* UniTask.Delay's DelayType.DeltaTime, UnscaledDeltaTime do not work correctly because they can not get deltaTime in editor. Therefore run on EditMode, automatically change DelayType to `DelayType.Realtime` that wait for the right time.\n* All PlayerLoopTiming run on the timing `EditorApplication.update`.\n* `-batchmode` with `-quit` does not work because Unity does not run `EditorApplication.update` and quit after a single frame. Instead, don't use `-quit` and quit manually with `EditorApplication.Exit(0)`.\n\nCompare with Standard Task API\n---\nUniTask has many standard Task-like APIs. This table shows what the alternative apis are.\n\nUse standard type.\n\n| .NET Type | UniTask Type | \n| --- | --- |\n| `IProgress<T>` | --- |\n| `CancellationToken` | --- | \n| `CancellationTokenSource` | --- |\n\nUse UniTask type.\n\n| .NET Type | UniTask Type | \n| --- | --- |\n| `Task`/`ValueTask` | `UniTask` |\n| `Task<T>`/`ValueTask<T>` | `UniTask<T>` |\n| `async void` | `async UniTaskVoid` | \n| `+= async () => { }` | `UniTask.Void`, `UniTask.Action`, `UniTask.UnityAction` |\n| --- | `UniTaskCompletionSource` |\n| `TaskCompletionSource<T>` | `UniTaskCompletionSource<T>`/`AutoResetUniTaskCompletionSource<T>` |\n| `ManualResetValueTaskSourceCore<T>` | `UniTaskCompletionSourceCore<T>` |\n| `IValueTaskSource` | `IUniTaskSource` |\n| `IValueTaskSource<T>` | `IUniTaskSource<T>` |\n| `ValueTask.IsCompleted` | `UniTask.Status.IsCompleted()` |\n| `ValueTask<T>.IsCompleted` | `UniTask<T>.Status.IsCompleted()` |\n| `new Progress<T>` | `Progress.Create<T>` |\n| `CancellationToken.Register(UnsafeRegister)` | `CancellationToken.RegisterWithoutCaptureExecutionContext` |\n| `CancellationTokenSource.CancelAfter` | `CancellationTokenSource.CancelAfterSlim` |\n| `Channel.CreateUnbounded<T>(false){ SingleReader = true }` | `Channel.CreateSingleConsumerUnbounded<T>` |\n| `IAsyncEnumerable<T>` | `IUniTaskAsyncEnumerable<T>` |\n| `IAsyncEnumerator<T>` | `IUniTaskAsyncEnumerator<T>` |\n| `IAsyncDisposable` | `IUniTaskAsyncDisposable` |\n| `Task.Delay` | `UniTask.Delay` |\n| `Task.Yield` | `UniTask.Yield` |\n| `Task.Run` | `UniTask.RunOnThreadPool` |\n| `Task.WhenAll` | `UniTask.WhenAll` |\n| `Task.WhenAny` | `UniTask.WhenAny` |\n| `Task.WhenEach` | `UniTask.WhenEach` |\n| `Task.CompletedTask` | `UniTask.CompletedTask` |\n| `Task.FromException` | `UniTask.FromException` |\n| `Task.FromResult` | `UniTask.FromResult` |\n| `Task.FromCanceled` | `UniTask.FromCanceled` |\n| `Task.ContinueWith` | `UniTask.ContinueWith` |\n| `TaskScheduler.UnobservedTaskException` | `UniTaskScheduler.UnobservedTaskException` |\n\nPooling Configuration\n---\nUniTask aggressively caches async promise objects to achieve zero allocation (for technical details, see blog post [UniTask v2 — Zero Allocation async/await for Unity, with Asynchronous LINQ](https://medium.com/@neuecc/unitask-v2-zero-allocation-async-await-for-unity-with-asynchronous-linq-1aa9c96aa7dd)). By default, it caches all promises but you can configure `TaskPool.SetMaxPoolSize` to your value, the value indicates cache size per type. `TaskPool.GetCacheSizeInfo` returns currently cached objects in pool.\n\n```csharp\nforeach (var (type, size) in TaskPool.GetCacheSizeInfo())\n{\n    Debug.Log(type + \":\" + size);\n}\n```\n\nAllocation on Profiler\n---\nIn UnityEditor the profiler shows allocation of compiler generated AsyncStateMachine but it only occurs in debug(development) build. C# Compiler generates AsyncStateMachine as class on Debug build and as struct on Release build.\n\nUnity supports Code Optimization option starting in 2020.1 (right, footer).\n\n![](https://user-images.githubusercontent.com/46207/89967342-2f944600-dc8c-11ea-99fc-0b74527a16f6.png)\n\nYou can change C# compiler optimization to release to remove AsyncStateMachine allocation in development builds. This optimization option can also be set via `Compilation.CompilationPipeline-codeOptimization`, and `Compilation.CodeOptimization`.\n\nUniTaskSynchronizationContext\n---\nUnity's default SynchronizationContext(`UnitySynchronizationContext`) is a poor implementation for performance. UniTask bypasses `SynchronizationContext`(and `ExecutionContext`) so it does not use it but if exists in `async Task`, still used it. `UniTaskSynchronizationContext` is a replacement of `UnitySynchronizationContext` which is better for performance.\n\n```csharp\npublic class SyncContextInjecter\n{\n    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]\n    public static void Inject()\n    {\n        SynchronizationContext.SetSynchronizationContext(new UniTaskSynchronizationContext());\n    }\n}\n```\n\nThis is an optional choice and is not always recommended; `UniTaskSynchronizationContext` is less performant than `async UniTask` and is not a complete UniTask replacement. It also does not guarantee full behavioral compatibility with the `UnitySynchronizationContext`.\n\nAPI References\n---\nUniTask's API References are hosted at [cysharp.github.io/UniTask](https://cysharp.github.io/UniTask/api/Cysharp.Threading.Tasks.html) by [DocFX](https://dotnet.github.io/docfx/) and [Cysharp/DocfXTemplate](https://github.com/Cysharp/DocfxTemplate).\n\nFor example, UniTask's factory methods can be seen at [UniTask#methods](https://cysharp.github.io/UniTask/api/Cysharp.Threading.Tasks.UniTask.html#methods-1). UniTaskAsyncEnumerable's factory/extension methods can be seen at [UniTaskAsyncEnumerable#methods](https://cysharp.github.io/UniTask/api/Cysharp.Threading.Tasks.Linq.UniTaskAsyncEnumerable.html#methods-1).\n\nUPM Package\n---\n### Install via git URL\n\nRequires a version of unity that supports path query parameter for git packages (Unity >= 2019.3.4f1, Unity >= 2020.1a21). You can add `https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask` to Package Manager\n\n![image](https://user-images.githubusercontent.com/46207/79450714-3aadd100-8020-11ea-8aae-b8d87fc4d7be.png)\n\n![image](https://user-images.githubusercontent.com/46207/83702872-e0f17c80-a648-11ea-8183-7469dcd4f810.png)\n\nor add `\"com.cysharp.unitask\": \"https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask\"` to `Packages/manifest.json`.\n\nIf you want to set a target version, UniTask uses the `*.*.*` release tag so you can specify a version like `#2.1.0`. For example `https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask#2.1.0`.\n\n\n.NET Core\n---\nFor .NET Core, use NuGet.\n\n> PM> Install-Package [UniTask](https://www.nuget.org/packages/UniTask)\n\nUniTask of .NET Core version is a subset of Unity UniTask with PlayerLoop dependent methods removed.\n\nIt runs at higher performance than the standard Task/ValueTask, but you should be careful to ignore the ExecutionContext/SynchronizationContext when using it. `AsyncLocal` also does not work because it ignores ExecutionContext.\n\nIf you use UniTask internally, but provide ValueTask as an external API, you can write it like the following(Inspired by [PooledAwait](https://github.com/mgravell/PooledAwait)).\n\n```csharp\npublic class ZeroAllocAsyncAwaitInDotNetCore\n{\n    public ValueTask<int> DoAsync(int x, int y)\n    {\n        return Core(this, x, y);\n\n        static async UniTask<int> Core(ZeroAllocAsyncAwaitInDotNetCore self, int x, int y)\n        {\n            // do anything...\n            await Task.Delay(TimeSpan.FromSeconds(x + y));\n            await UniTask.Yield();\n\n            return 10;\n        }\n    }\n}\n\n// UniTask does not return to original SynchronizationContext but you can use helper `ReturnToCurrentSynchronizationContext`.\npublic ValueTask TestAsync()\n{\n    await using (UniTask.ReturnToCurrentSynchronizationContext())\n    {\n        await UniTask.SwitchToThreadPool();\n        // do anything..\n    }\n}\n```\n\n.NET Core version is intended to allow users to use UniTask as an interface when sharing code with Unity (such as [Cysharp/MagicOnion](https://github.com/Cysharp/MagicOnion/)). .NET Core version of UniTask enables smooth code sharing.\n\nUtility methods such as WhenAll which are equivalent to UniTask are provided as [Cysharp/ValueTaskSupplement](https://github.com/Cysharp/ValueTaskSupplement).\n\nLicense\n---\nThis library is under the MIT License.\n"
  },
  {
    "path": "README_CN.md",
    "content": "UniTask\n===\n[![GitHub Actions](https://github.com/Cysharp/UniTask/workflows/Build-Debug/badge.svg)](https://github.com/Cysharp/UniTask/actions) [![Releases](https://img.shields.io/github/release/Cysharp/UniTask.svg)](https://github.com/Cysharp/UniTask/releases)\n\n为Unity提供一个高性能，零堆内存分配的 async/await 异步方案。\n\n- 基于值类型的`UniTask<T>`和自定义的 AsyncMethodBuilder 来实现零堆内存分配\n- 使所有 Unity 的 AsyncOperations 和 Coroutines 可等待\n- 基于 PlayerLoop 的任务（`UniTask.Yield`，`UniTask.Delay`，`UniTask.DelayFrame`等..）可以替换所有协程操作\n- 对 MonoBehaviour 消息事件和 uGUI 事件进行可等待/异步枚举扩展\n- 完全在 Unity 的 PlayerLoop 上运行，因此不使用Thread，并且同样能在 WebGL、wasm 等平台上运行。\n- 带有 Channel 和 AsyncReactiveProperty 的异步 LINQ\n- 提供一个 TaskTracker EditorWindow 以追踪所有 UniTask 分配来预防内存泄漏\n- 与原生 Task/ValueTask/IValueTaskSource 高度兼容的行为\n\n有关技术细节，请参阅博客文章：[UniTask v2 — 适用于 Unity 的零堆内存分配的async/await，支持异步 LINQ](https://medium.com/@neuecc/unitask-v2-zero-allocation-async-await-for-unity-with-asynchronous-linq-1aa9c96aa7dd)  \n有关高级技巧，请参阅博客文章：[通过异步装饰器模式扩展 UnityWebRequest — UniTask 的高级技术](https://medium.com/@neuecc/extends-unitywebrequest-via-async-decorator-pattern-advanced-techniques-of-unitask-ceff9c5ee846)\n\n<!-- START doctoc generated TOC please keep comment here to allow auto update -->\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->\n## 目录\n\n- [入门](#%E5%85%A5%E9%97%A8)\n- [UniTask 和 AsyncOperation 的基础知识](#unitask-%E5%92%8C-asyncoperation-%E7%9A%84%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86)\n- [取消和异常处理](#%E5%8F%96%E6%B6%88%E5%92%8C%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86)\n- [超时处理](#%E8%B6%85%E6%97%B6%E5%A4%84%E7%90%86)\n- [进度](#%E8%BF%9B%E5%BA%A6)\n- [PlayerLoop](#playerloop)\n- [async void 与 async UniTaskVoid 对比](#async-void-%E4%B8%8E-async-unitaskvoid-%E5%AF%B9%E6%AF%94)\n- [UniTaskTracker](#unitasktracker)\n- [外部拓展](#%E5%A4%96%E9%83%A8%E6%8B%93%E5%B1%95)\n- [AsyncEnumerable 和 Async LINQ](#asyncenumerable-%E5%92%8C-async-linq)\n- [可等待事件](#%E5%8F%AF%E7%AD%89%E5%BE%85%E4%BA%8B%E4%BB%B6)\n- [Channel](#channel)\n- [与 Awaitable 对比](#%E4%B8%8E-awaitable-%E5%AF%B9%E6%AF%94)\n- [单元测试](#%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95)\n- [线程池的限制](#%E7%BA%BF%E7%A8%8B%E6%B1%A0%E7%9A%84%E9%99%90%E5%88%B6)\n- [IEnumerator.ToUniTask 的限制](#ienumeratortounitask-%E7%9A%84%E9%99%90%E5%88%B6)\n- [关于 UnityEditor](#%E5%85%B3%E4%BA%8E-unityeditor)\n- [与原生 Task API 对比](#%E4%B8%8E%E5%8E%9F%E7%94%9F-task-api-%E5%AF%B9%E6%AF%94)\n- [池化配置](#%E6%B1%A0%E5%8C%96%E9%85%8D%E7%BD%AE)\n- [Profiler 下的堆内存分配](#profiler-%E4%B8%8B%E7%9A%84%E5%A0%86%E5%86%85%E5%AD%98%E5%88%86%E9%85%8D)\n- [UniTaskSynchronizationContext](#unitasksynchronizationcontext)\n- [API 文档](#api-%E6%96%87%E6%A1%A3)\n- [UPM 包](#upm-%E5%8C%85)\n- [通过 git URL 安装](#%E9%80%9A%E8%BF%87-git-url-%E5%AE%89%E8%A3%85)\n- [关于 .NET Core](#%E5%85%B3%E4%BA%8E-net-core)\n- [许可证](#%E8%AE%B8%E5%8F%AF%E8%AF%81)\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n\n入门\n---\n通过[UniTask/releases](https://github.com/Cysharp/UniTask/releases)页面中提供的[UPM 包](https://github.com/Cysharp/UniTask#upm-package)或资产包（`UniTask.*.*.*.unitypackage`）安装。\n\n```csharp\n// 使用 UniTask 所需的命名空间\nusing Cysharp.Threading.Tasks;\n\n// 您可以返回一个形如 UniTask<T>(或 UniTask) 的类型，这种类型事为Unity定制的，作为替代原生 Task<T> 的轻量级方案\n// 为 Unity 集成的零堆内存分配，快速调用，0消耗的 async/await 方案\nasync UniTask<string> DemoAsync()\n{\n    // 您可以等待一个 Unity 异步对象\n    var asset = await Resources.LoadAsync<TextAsset>(\"foo\");\n    var txt = (await UnityWebRequest.Get(\"https://...\").SendWebRequest()).downloadHandler.text;\n    await SceneManager.LoadSceneAsync(\"scene2\");\n\n    // .WithCancellation 会启用取消功能，GetCancellationTokenOnDestroy 表示获取一个依赖对象生命周期的 Cancel 句柄，当对象被销毁时，将会调用这个 Cancel 句柄，从而实现取消的功能\n    // 在 Unity 2022.2之后，您可以在 MonoBehaviour 中使用`destroyCancellationToken`\n    var asset2 = await Resources.LoadAsync<TextAsset>(\"bar\").WithCancellation(this.GetCancellationTokenOnDestroy());\n\n    // .ToUniTask 可接收一个 progress 回调以及一些配置参数，Progress.Create 是 IProgress<T> 的轻量级替代方案\n    var asset3 = await Resources.LoadAsync<TextAsset>(\"baz\").ToUniTask(Progress.Create<float>(x => Debug.Log(x)));\n\n    // 等待一个基于帧的延时操作（就像一个协程一样）\n    await UniTask.DelayFrame(100); \n\n    // yield return new WaitForSeconds/WaitForSecondsRealtime 的替代方案\n    await UniTask.Delay(TimeSpan.FromSeconds(10), ignoreTimeScale: false);\n    \n    // 可以等待任何 playerloop 的生命周期（PreUpdate，Update，LateUpdate等）\n    await UniTask.Yield(PlayerLoopTiming.PreLateUpdate);\n\n    // yield return null 的替代方案\n    await UniTask.Yield();\n    await UniTask.NextFrame();\n\n    // WaitForEndOfFrame 的替代方案\n#if UNITY_2023_1_OR_NEWER\n    await UniTask.WaitForEndOfFrame();\n#else\n    // 需要 MonoBehaviour（CoroutineRunner）\n    await UniTask.WaitForEndOfFrame(this); // this是一个 MonoBehaviour\n#endif\n    \n    // yield return new WaitForFixedUpdate 的替代方案，（等同于 UniTask.Yield(PlayerLoopTiming.FixedUpdate)）\n    await UniTask.WaitForFixedUpdate();\n    \n    // yield return WaitUntil 的替代方案\n    await UniTask.WaitUntil(() => isActive == false);\n\n    // WaitUntil 扩展，指定某个值改变时触发\n    await UniTask.WaitUntilValueChanged(this, x => x.isActive);\n\n    // 您可以直接 await 一个 IEnumerator 协程\n    await FooCoroutineEnumerator();\n\n    // 您可以直接 await 一个原生 task\n    await Task.Run(() => 100);\n\n    // 多线程示例，在此行代码后的内容都运行在一个线程池上\n    await UniTask.SwitchToThreadPool();\n\n    /* 工作在线程池上的代码 */\n\n    // 转回主线程（等同于 UniRx 的`ObserveOnMainThread`）\n    await UniTask.SwitchToMainThread();\n\n    // 获取异步的 webrequest\n    async UniTask<string> GetTextAsync(UnityWebRequest req)\n    {\n        var op = await req.SendWebRequest();\n        return op.downloadHandler.text;\n    }\n\n    var task1 = GetTextAsync(UnityWebRequest.Get(\"http://google.com\"));\n    var task2 = GetTextAsync(UnityWebRequest.Get(\"http://bing.com\"));\n    var task3 = GetTextAsync(UnityWebRequest.Get(\"http://yahoo.com\"));\n\n    // 构造一个 async-wait，并通过元组语义轻松获取所有结果\n    var (google, bing, yahoo) = await UniTask.WhenAll(task1, task2, task3);\n\n    // WhenAll 的简写形式，元组可以直接 await\n    var (google2, bing2, yahoo2) = await (task1, task2, task3);\n\n    // 返回一个异步值，或者您也可以使用`UniTask`（无结果），`UniTaskVoid`（不可等待）\n    return (asset as TextAsset)?.text ?? throw new InvalidOperationException(\"Asset not found\");\n}\n```\n\nUniTask 和 AsyncOperation 的基础知识\n---\nUniTask 功能依赖于 C# 7.0（[task-like custom async method builder feature](https://github.com/dotnet/roslyn/blob/master/docs/features/task-types.md)），所以需要`Unity 2018.3`之后的版本，官方支持的最低版本是`Unity 2018.4.13f1`。\n\n为什么需要 UniTask（自定义task对象）？因为原生 Task 太重，与 Unity 线程（单线程）相性不好。因为 Unity 的异步对象由 Unity 的引擎层自动调度，所以 UniTask 不使用线程和 SynchronizationContext/ExecutionContext。它实现了更快和更低的分配，并且与Unity完全兼容。\n\n您可以在使用`using Cysharp.Threading.Tasks;`时对`AsyncOperation`，`ResourceRequest`，`AssetBundleRequest`，`AssetBundleCreateRequest`，`UnityWebRequestAsyncOperation`，`AsyncGPUReadbackRequest`，`IEnumerator`以及其他的异步操作进行 await\n\nUniTask 提供了三种模式的扩展方法。\n\n```csharp\nawait asyncOperation;\n.WithCancellation(CancellationToken);\n.ToUniTask(IProgress, PlayerLoopTiming, CancellationToken);\n```\n\n`WithCancellation`是`ToUniTask`的简化版本，两者都返回`UniTask`。有关 cancellation 的详细信息，请参阅：[取消和异常处理](https://github.com/Cysharp/UniTask#cancellation-and-exception-handling)部分。\n\n> 注意：await 会在 PlayerLoop 执行await对象的相应native生命周期方法时返回（如果条件满足的话），而 WithCancellation 和 ToUniTask 是从指定的 PlayerLoop 生命周期执行时返回。有关 PlayLoop生命周期 的详细信息，请参阅：[PlayerLoop](https://github.com/Cysharp/UniTask#playerloop)部分。\n\n> 注意： AssetBundleRequest 有`asset`和`allAssets`，默认 await 返回`asset`。如果您想得到`allAssets`，您可以使用`AwaitForAllAssets()`方法。\n\n`UniTask`可以使用`UniTask.WhenAll`，`UniTask.WhenAny`，`UniTask.WhenEach`等实用函数。它们就像`Task.WhenAll`和`Task.WhenAny`，但它们返回的数据类型更好用。它们会返回值元组，因此您可以传递多种类型并解构每个结果。\n\n```csharp\npublic async UniTaskVoid LoadManyAsync()\n{\n    // 并行加载.\n    var (a, b, c) = await UniTask.WhenAll(\n        LoadAsSprite(\"foo\"),\n        LoadAsSprite(\"bar\"),\n        LoadAsSprite(\"baz\"));\n}\n\nasync UniTask<Sprite> LoadAsSprite(string path)\n{\n    var resource = await Resources.LoadAsync<Sprite>(path);\n    return (resource as Sprite);\n}\n```\n\n如果您想要将一个回调转换为 UniTask，您可以使用`UniTaskCompletionSource<T>`，它是`TaskCompletionSource<T>`的轻量级版本。\n\n```csharp\npublic UniTask<int> WrapByUniTaskCompletionSource()\n{\n    var utcs = new UniTaskCompletionSource<int>();\n\n    // 当操作完成时，调用 utcs.TrySetResult();\n    // 当操作失败时，调用 utcs.TrySetException();\n    // 当操作取消时，调用 utcs.TrySetCanceled();\n\n    return utcs.Task; //本质上就是返回了一个 UniTask<int>\n}\n```\n\n您可以进行如下转换：<br>-`Task` -> `UniTask `：使用`AsUniTask`<br>-`UniTask` -> `UniTask<AsyncUnit>`：使用 `AsAsyncUnitUniTask`<br>-`UniTask<T>` -> `UniTask`：使用 `AsUniTask`。`UniTask<T>` -> `UniTask`的转换是无消耗的。\n\n如果您想将异步转换为协程，您可以使用`.ToCoroutine()`，这对于您想只允许使用协程系统大有帮助。\n\nUniTask 不能 await 两次。这是与.NET Standard 2.1 中引入的[ValueTask/IValueTaskSource](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.valuetask-1?view=netcore-3.1)具有相同的约束。\n\n> 千万不要对 `ValueTask<TResult>` 实例执行以下操作：\n>\n> - 多次await实例。\n> - 多次调用 AsTask。\n> - 在操作尚未完成时调用 .Result 或 .GetAwaiter().GetResult()，或对它们进行多次调用。\n> - 对实例进行上述多种操作。\n>\n> 如果您执行了上述任何操作，则结果是未定义的。\n\n```csharp\nvar task = UniTask.DelayFrame(10);\nawait task;\nawait task; // 错误，抛出异常\n```\n\n如果实在需要多次 await 一个异步操作，可以使用支持多次调用的`UniTask.Lazy`。`.Preserve()`同样允许多次调用（由 UniTask 内部缓存结果）。这种方法在函数范围内有多次调用时很有用。\n\n同样的，`UniTaskCompletionSource`可以在同一个地方被 await 多次，或者在很多不同的地方被 await。\n\n取消和异常处理\n---\n一些 UniTask 工厂方法中有一个`CancellationToken cancellationToken = default`参数。Unity 的一些异步操作也有`WithCancellation(CancellationToken)`和`ToUniTask(..., CancellationToken cancellation = default)`扩展方法。\n\n可以通过原生的[`CancellationTokenSource`](https://docs.microsoft.com/en-us/dotnet/api/system.threading.cancellationtokensource)将 CancellationToken 传递给参数\n\n```csharp\nvar cts = new CancellationTokenSource();\n\ncancelButton.onClick.AddListener(() =>\n{\n    cts.Cancel();\n});\n\nawait UnityWebRequest.Get(\"http://google.co.jp\").SendWebRequest().WithCancellation(cts.Token);\n\nawait UniTask.DelayFrame(1000, cancellationToken: cts.Token);\n```\n\nCancellationToken 可通过`CancellationTokenSource`或 MonoBehaviour 的扩展方法`GetCancellationTokenOnDestroy`来创建。\n\n```csharp\n// 这个 CancellationToken 的生命周期与 GameObject 的相同\nawait UniTask.DelayFrame(1000, cancellationToken: this.GetCancellationTokenOnDestroy());\n```\n\n对于链式取消，建议所有异步方法的最后一个参数都接受`CancellationToken cancellationToken`，并将`CancellationToken`从头传递到尾。\n\n```csharp\nawait FooAsync(this.GetCancellationTokenOnDestroy());\n\n// ---\n\nasync UniTask FooAsync(CancellationToken cancellationToken)\n{\n    await BarAsync(cancellationToken);\n}\n\nasync UniTask BarAsync(CancellationToken cancellationToken)\n{\n    await UniTask.Delay(TimeSpan.FromSeconds(3), cancellationToken);\n}\n```\n\n`CancellationToken`代表了异步操作的生命周期。您可以不使用默认的 CancellationTokenOnDestroy ，通过自定义的`CancellationToken`自行管理生命周期。\n\n```csharp\npublic class MyBehaviour : MonoBehaviour\n{\n    CancellationTokenSource disableCancellation = new CancellationTokenSource();\n    CancellationTokenSource destroyCancellation = new CancellationTokenSource();\n\n    private void OnEnable()\n    {\n        if (disableCancellation != null)\n        {\n            disableCancellation.Dispose();\n        }\n        disableCancellation = new CancellationTokenSource();\n    }\n\n    private void OnDisable()\n    {\n        disableCancellation.Cancel();\n    }\n\n    private void OnDestroy()\n    {\n        destroyCancellation.Cancel();\n        destroyCancellation.Dispose();\n    }\n}\n```\n\n在Unity 2022.2之后，Unity在[MonoBehaviour.destroyCancellationToken](https://docs.unity3d.com/ScriptReference/MonoBehaviour-destroyCancellationToken.html)和[Application.exitCancellationToken](https://docs.unity3d.com/ScriptReference/Application-exitCancellationToken.html)中添加了 CancellationToken。\n\n当检测到取消时，所有方法都会向上游抛出并传播`OperationCanceledException`。当异常（不限于`OperationCanceledException`）没有在异步方法中处理时，它将被传播到`UniTaskScheduler.UnobservedTaskException`。默认情况下，将接收到的未处理异常作为一般异常写入日志。可以使用`UniTaskScheduler.UnobservedExceptionWriteLogType`更改日志级别。若想对接收到未处理异常时的处理进行自定义，请为`UniTaskScheduler.UnobservedTaskException`设置一个委托\n\n而`OperationCanceledException`是一种特殊的异常，会被`UnobservedTaskException`无视\n\n如果要取消异步 UniTask 方法中的行为，请手动抛出`OperationCanceledException`。\n\n```csharp\npublic async UniTask<int> FooAsync()\n{\n    await UniTask.Yield();\n    throw new OperationCanceledException();\n}\n```\n\n如果您只想处理异常，忽略取消操作（让其传播到全局处理 cancellation 的地方），请使用异常过滤器。\n\n```csharp\npublic async UniTask<int> BarAsync()\n{\n    try\n    {\n        var x = await FooAsync();\n        return x * 2;\n    }\n    catch (Exception ex) when (!(ex is OperationCanceledException)) // 在 C# 9.0 下改成 when (ex is not OperationCanceledException) \n    {\n        return -1;\n    }\n}\n```\n\n抛出和捕获`OperationCanceledException`有点重度，如果比较在意性能开销，请使用`UniTask.SuppressCancellationThrow`以避免抛出 OperationCanceledException 。它将返回`(bool IsCanceled, T Result)`而不是抛出异常。\n\n```csharp\nvar (isCanceled, _) = await UniTask.DelayFrame(10, cancellationToken: cts.Token).SuppressCancellationThrow();\nif (isCanceled)\n{\n    // ...\n}\n```\n\n注意：仅当您在源头处直接调用`UniTask.SuppressCancellationThrow`时才会抑制异常抛出。否则，返回值将被转换，且整个管道不会抑制异常抛出。\n\n`UniTask.Yield`和`UniTask.Delay`等功能依赖于 Unity 的 PlayerLoop，它们在 PlayerLoop 中确定`CancellationToken`状态。\n这意味着当`CancellationToken`被触发时，它们并不会立即取消。\n\n如果要更改此行为，实现立即取消，可将`cancelImmediately`标志设置为 true。\n\n```csharp\nawait UniTask.Yield(cancellationToken, cancelImmediately: true);\n```\n\n注意：比起默认行为，设置 `cancelImmediately` 为 true 并检测立即取消会有更多的性能开销。\n这是因为它使用了`CancellationToken.Register`；这比在 PlayerLoop 中检查 CancellationToken 更重度。\n\n超时处理\n---\n超时是取消的一种变体。您可以通过`CancellationTokenSouce.CancelAfterSlim(TimeSpan)`设置超时并将 CancellationToken 传递给异步方法。\n\n```csharp\nvar cts = new CancellationTokenSource();\ncts.CancelAfterSlim(TimeSpan.FromSeconds(5)); // 设置5s超时。\n\ntry\n{\n    await UnityWebRequest.Get(\"http://foo\").SendWebRequest().WithCancellation(cts.Token);\n}\ncatch (OperationCanceledException ex)\n{\n    if (ex.CancellationToken == cts.Token)\n    {\n        UnityEngine.Debug.Log(\"Timeout\");\n    }\n}\n```\n\n> `CancellationTokenSouce.CancelAfter`是一个原生的 api。但是在 Unity 中您不应该使用它，因为它依赖于线程计时器。`CancelAfterSlim`是 UniTask 的扩展方法，它使用 PlayerLoop 代替了线程计时器。\n\n如果您想将超时与其他 cancellation 一起使用，请使用`CancellationTokenSource.CreateLinkedTokenSource`。\n\n```csharp\nvar cancelToken = new CancellationTokenSource();\ncancelButton.onClick.AddListener(()=>\n{\n    cancelToken.Cancel(); // 点击按钮后取消。\n});\n\nvar timeoutToken = new CancellationTokenSource();\ntimeoutToken.CancelAfterSlim(TimeSpan.FromSeconds(5)); // 设置5s超时。\n\ntry\n{\n    // 链接 token\n    var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancelToken.Token, timeoutToken.Token);\n\n    await UnityWebRequest.Get(\"http://foo\").SendWebRequest().WithCancellation(linkedTokenSource.Token);\n}\ncatch (OperationCanceledException ex)\n{\n    if (timeoutToken.IsCancellationRequested)\n    {\n        UnityEngine.Debug.Log(\"Timeout.\");\n    }\n    else if (cancelToken.IsCancellationRequested)\n    {\n        UnityEngine.Debug.Log(\"Cancel clicked.\");\n    }\n}\n```\n\n为减少每次调用异步方法时用于超时的 CancellationTokenSource 的堆内存分配，您可以使用 UniTask 的`TimeoutController`进行优化。\n\n```csharp\nTimeoutController timeoutController = new TimeoutController(); // 提前创建好，以便复用。\n\nasync UniTask FooAsync()\n{\n    try\n    {\n        // 您可以通过 timeoutController.Timeout(TimeSpan) 把超时设置传递到 cancellationToken。\n        await UnityWebRequest.Get(\"http://foo\").SendWebRequest()\n            .WithCancellation(timeoutController.Timeout(TimeSpan.FromSeconds(5)));\n        timeoutController.Reset(); // 当 await 完成后调用 Reset（停止超时计时器，并准备下一次复用）。\n    }\n    catch (OperationCanceledException ex)\n    {\n        if (timeoutController.IsTimeout())\n        {\n            UnityEngine.Debug.Log(\"timeout\");\n        }\n    }\n}\n```\n\n如果您想将超时结合其他取消源一起使用，请使用`new TimeoutController(CancellationToken)`.\n\n```csharp\nTimeoutController timeoutController;\nCancellationTokenSource clickCancelSource;\n\nvoid Start()\n{\n    this.clickCancelSource = new CancellationTokenSource();\n    this.timeoutController = new TimeoutController(clickCancelSource);\n}\n```\n\n注意：UniTask 有`.Timeout`，`.TimeoutWithoutException`方法，但如果可以的话，尽量不要使用这些方法，请传递`CancellationToken`。因为`.Timeout`是在任务外部执行，所以无法停止超时任务。`.Timeout`意味着超时后忽略结果。如果您将一个`CancellationToken`传递给该方法，它将从任务内部执行，因此可以停止正在运行的任务。\n\n进度\n---\n一些 Unity 的异步操作具有`ToUniTask(IProgress<float> progress = null, ...)`的扩展方法。\n\n```csharp\nvar progress = Progress.Create<float>(x => Debug.Log(x));\n\nvar request = await UnityWebRequest.Get(\"http://google.co.jp\")\n    .SendWebRequest()\n    .ToUniTask(progress: progress);\n```\n\n您不应该使用原生的`new System.Progress<T>`，因为每次调用它都会产生堆内存分配。请改用`Cysharp.Threading.Tasks.Progress`。这个 progress 工厂类有两个方法，`Create`和`CreateOnlyValueChanged`。`CreateOnlyValueChanged`仅在进度值更新时调用。\n\n为调用者实现 IProgress 接口会更好，这样不会因使用 lambda 而产生堆内存分配。\n\n```csharp\npublic class Foo : MonoBehaviour, IProgress<float>\n{\n    public void Report(float value)\n    {\n        UnityEngine.Debug.Log(value);\n    }\n\n    public async UniTaskVoid WebRequest()\n    {\n        var request = await UnityWebRequest.Get(\"http://google.co.jp\")\n            .SendWebRequest()\n            .ToUniTask(progress: this);\n    }\n}\n```\n\nPlayerLoop\n---\nUniTask 运行在自定义的[PlayerLoop](https://docs.unity3d.com/ScriptReference/LowLevel.PlayerLoop.html)中。UniTask 中基于 PlayerLoop 的方法（如`Delay`、`DelayFrame`、`asyncOperation.ToUniTask`等）接受这个`PlayerLoopTiming`。\n\n```csharp\npublic enum PlayerLoopTiming\n{\n    Initialization = 0,\n    LastInitialization = 1,\n\n    EarlyUpdate = 2,\n    LastEarlyUpdate = 3,\n\n    FixedUpdate = 4,\n    LastFixedUpdate = 5,\n\n    PreUpdate = 6,\n    LastPreUpdate = 7,\n\n    Update = 8,\n    LastUpdate = 9,\n\n    PreLateUpdate = 10,\n    LastPreLateUpdate = 11,\n\n    PostLateUpdate = 12,\n    LastPostLateUpdate = 13\n    \n#if UNITY_2020_2_OR_NEWER\n    TimeUpdate = 14,\n    LastTimeUpdate = 15,\n#endif\n}\n```\n\n它表明了异步任务会在哪个时机运行，您可以查阅[PlayerLoopList.md](https://gist.github.com/neuecc/bc3a1cfd4d74501ad057e49efcd7bdae)以了解 Unity 的默认 PlayerLoop 以及注入的 UniTask 的自定义循环。\n\n`PlayerLoopTiming.Update`与协程中的`yield return null`类似，但它会在`ScriptRunBehaviourUpdate`时，Update（Update 和 uGUI 事件(button.onClick等）之前被调用，而 yield return null 是在`ScriptRunDelayedDynamicFrameRate`时被调用。`PlayerLoopTiming.FixedUpdate`类似于`WaitForFixedUpdate`。\n\n> `PlayerLoopTiming.LastPostLateUpdate`不等同于协程的`yield return new WaitForEndOfFrame()`。协程的 WaitForEndOfFrame 似乎在 PlayerLoop 完成后运行。一些需要协程结束帧的方法(`Texture2D.ReadPixels`，`ScreenCapture.CaptureScreenshotAsTexture`，`CommandBuffer`等)在 async/await 时无法正常工作。在这些情况下，请将 MonoBehaviour（用于运行协程）传递给`UniTask.WaitForEndOfFrame`。例如，`await UniTask.WaitForEndOfFrame(this);`是`yield return new WaitForEndOfFrame()`轻量级无堆内存分配的替代方案。\n\n> 注意：在 Unity 2023.1或更高的版本中，`await UniTask.WaitForEndOfFrame();`不再需要 MonoBehaviour。因为它使用了`UnityEngine.Awaitable.EndOfFrameAsync`。\n\n`yield return null`和`UniTask.Yield`相似但不同。`yield return null`总是返回下一帧但`UniTask.Yield`返回下一次调用。也就是说，`UniTask.Yield(PlayerLoopTiming.Update)`在 `PreUpdate`上调用，它返回同一帧。`UniTask.NextFrame()`保证返回下一帧，您可以认为它的行为与`yield return null`一致。\n\n> UniTask.Yield（不带 CancellationToken）是一种特殊类型，返回`YieldAwaitable`并在 YieldRunner 上运行。它是最轻量和最快的。\n\n`AsyncOperation`在原生生命周期返回。例如，await `SceneManager.LoadSceneAsync`在`EarlyUpdate.UpdatePreloading`时返回，在此之后，在`EarlyUpdate.ScriptRunDelayedStartupFrame`时调用已加载场景的`Start`方法。同样的，`await UnityWebRequest`在`EarlyUpdate.ExecuteMainThreadJobs`时返回。\n\n在 UniTask 中，直接 await 使用的是原生生命周期，而`WithCancellation`和`ToUniTask`使用的特定的生命周期。这通常不会有问题，但对于`LoadSceneAsync`，它会导致`Start`方法与 await 之后的逻辑的执行顺序错乱。所以建议不要使用`LoadSceneAsync.ToUniTask`。\n\n> 注意：在 Unity 2023.1或更高的版本中，当您使用新的`UnityEngine.Awaitable`方法（如`SceneManager.LoadSceneAsync`）时，请确保您的文件的 using 指令区域中包含`using UnityEngine;`。\n> 这可以通过避免使用`UnityEngine.AsyncOperation`版本来防止编译错误。\n\n在堆栈跟踪中，您可以检查它在 PlayerLoop 中的运行位置。\n\n![image](https://user-images.githubusercontent.com/46207/83735571-83caea80-a68b-11ea-8d22-5e22864f0d24.png)\n\n默认情况下，UniTask 的 PlayerLoop 在`[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]`初始化。\n\n在 BeforeSceneLoad 中调用的方法，它们的执行顺序是不确定的，所以如果您想在其他 BeforeSceneLoad 方法中使用 UniTask，您应该尝试在此之前初始化好 PlayerLoop。\n\n```csharp\n// AfterAssembliesLoaded 表示将会在 BeforeSceneLoad 之前调用\n[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]\npublic static void InitUniTaskLoop()\n{\n    var loop = PlayerLoop.GetCurrentPlayerLoop();\n    Cysharp.Threading.Tasks.PlayerLoopHelper.Initialize(ref loop);\n}\n```\n\n如果您导入了 Unity 的`Entities`包，则会在`BeforeSceneLoad`将自定义 PlayerLoop 重置为默认值，并注入 ECS 的循环。当 Unity 在 UniTask 的初始化方法执行之后调用了 ECS 的注入方法，UniTask 将不再起作用。\n\n为了解决这个问题，您可以在 ECS 初始化后重新初始化 UniTask PlayerLoop。\n\n```csharp\n// 获取 ECS Loop。\nvar playerLoop = ScriptBehaviourUpdateOrder.CurrentPlayerLoop;\n\n// 设置 UniTask PlayerLoop。\nPlayerLoopHelper.Initialize(ref playerLoop);\n```\n\n您可以通过调用`PlayerLoopHelper.IsInjectedUniTaskPlayerLoop()`来诊断 UniTask 的 PlayerLoop 是否准备就绪。并且`PlayerLoopHelper.DumpCurrentPlayerLoop`还会将所有当前 PlayerLoop 记录到控制台。\n\n```csharp\nvoid Start()\n{\n    UnityEngine.Debug.Log(\"UniTaskPlayerLoop ready? \" + PlayerLoopHelper.IsInjectedUniTaskPlayerLoop());\n    PlayerLoopHelper.DumpCurrentPlayerLoop();\n}\n```\n\n您可以通过移除未使用的 PlayerLoopTiming 注入来稍微优化循环成本。您可以在初始化时调用`PlayerLoopHelper.Initialize(InjectPlayerLoopTimings)`。\n\n```csharp\nvar loop = PlayerLoop.GetCurrentPlayerLoop();\nPlayerLoopHelper.Initialize(ref loop, InjectPlayerLoopTimings.Minimum); // Minimum 就是 Update | FixedUpdate | LastPostLateUpdate\n```\n\n`InjectPlayerLoopTimings`有三个预设，`All`，`Standard`（All 除 LastPostLateUpdate 外），`Minimum`（`Update | FixedUpdate | LastPostLateUpdate`）。默认为 All，您可以通过组合来自定义要注入的时机，例如`InjectPlayerLoopTimings.Update | InjectPlayerLoopTimings.FixedUpdate | InjectPlayerLoopTimings.PreLateUpdate`。\n\n使用未注入`PlayerLoopTiming`的[Microsoft.CodeAnalysis.BannedApiAnalyzers](https://github.com/dotnet/roslyn-analyzers/blob/master/src/Microsoft.CodeAnalysis.BannedApiAnalyzers/BannedApiAnalyzers.Help.md)可能会出错。例如，您可以像下列方式那样，为`InjectPlayerLoopTimings.Minimum`设置`BannedSymbols.txt`\n\n```txt\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.Initialization; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.LastInitialization; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.EarlyUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.LastEarlyUpdate; Isn't injected this PlayerLoop in this project.d\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.LastFixedUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.PreUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.LastPreUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.LastUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.PreLateUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.LastPreLateUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.PostLateUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.TimeUpdate; Isn't injected this PlayerLoop in this project.\nF:Cysharp.Threading.Tasks.PlayerLoopTiming.LastTimeUpdate; Isn't injected this PlayerLoop in this project.\n```\n\n您可以将`RS0030`的严重性配置为错误。\n\n![image](https://user-images.githubusercontent.com/46207/109150837-bb933880-77ac-11eb-85ba-4fd15819dbd0.png)\n\nasync void 与 async UniTaskVoid 对比\n---\n`async void`是一个原生的 C# 任务系统，因此它不在 UniTask 系统上运行。也最好不要使用它。`async UniTaskVoid`是`async UniTask`的轻量级版本，因为它没有等待完成并立即向`UniTaskScheduler.UnobservedTaskException`报告错误。如果您不需要等待（即发即弃），那么使用`UniTaskVoid`会更好。不幸的是，要解除警告，您需要在尾部添加`Forget()`。\n\n```csharp\npublic async UniTaskVoid FireAndForgetMethod()\n{\n    // do anything...\n    await UniTask.Yield();\n}\n\npublic void Caller()\n{\n    FireAndForgetMethod().Forget();\n}\n```\n\nUniTask 也有`Forget`方法，与`UniTaskVoid`类似且效果相同。如果您完全不需要使用`await`，那么使用`UniTaskVoid`会更高效。\n\n```csharp\npublic async UniTask DoAsync()\n{\n    // do anything...\n    await UniTask.Yield();\n}\n\npublic void Caller()\n{\n    DoAsync().Forget();\n}\n```\n\n要使用注册到事件的异步 lambda，请不要使用`async void`。您可以使用`UniTask.Action` 或 `UniTask.UnityAction`来代替，这两者都通过`async UniTaskVoid` lambda 来创建委托。\n\n```csharp\nAction actEvent;\nUnityAction unityEvent; // UGUI 特供\n\n// 这样是不好的: async void\nactEvent += async () => { };\nunityEvent += async () => { };\n\n// 这样是可以的: 通过 lamada 创建 Action\nactEvent += UniTask.Action(async () => { await UniTask.Yield(); });\nunityEvent += UniTask.UnityAction(async () => { await UniTask.Yield(); });\n```\n\n`UniTaskVoid`也可以用在 MonoBehaviour 的`Start`方法中。\n\n```csharp\nclass Sample : MonoBehaviour\n{\n    async UniTaskVoid Start()\n    {\n        // 异步初始化代码。\n    }\n}\n```\n\nUniTaskTracker\n---\n对于检查（泄露的）UniTasks 很有用。您可以在`Window -> UniTask Tracker`中打开跟踪器窗口。\n\n![image](https://user-images.githubusercontent.com/46207/83527073-4434bf00-a522-11ea-86e9-3b3975b26266.png)\n\n- Enable AutoReload(Toggle) - 自动重新加载。\n- Reload - 重新加载视图（重新扫描内存中UniTask实例，并刷新界面）。\n- GC.Collect - 调用 GC.Collect。\n- Enable Tracking(Toggle) - 开始跟踪异步/等待 UniTask。性能影响：低。\n- Enable StackTrace(Toggle) - 在任务启动时捕获 StackTrace。性能影响：高。\n\nUniTaskTracker 仅用于调试用途，因为启用跟踪和捕获堆栈跟踪很有用，但会对性能产生重大影响。推荐的用法是只在查找任务泄漏时启用跟踪和堆栈跟踪，并在使用完毕后禁用它们。\n\n外部拓展\n---\n默认情况下，UniTask 支持 TextMeshPro（`BindTo(TMP_Text)`和像原生 uGUI `InputField` 那样的事件扩展，如`TMP_InputField`）、DOTween（`Tween`作为可等待的）和 Addressables（`AsyncOperationHandle`和`AsyncOperationHandle<T>`作为可等待的）。\n\n它们被定义在了如`UniTask.TextMeshPro`，`UniTask.DOTween`，`UniTask.Addressables`等单独的 asmdef文件中。\n\n从包管理器中导入软件包时，会自动启用对 TextMeshPro 和 Addressables 的支持。\n但对于 DOTween 的支持，则需要从[DOTWeen assets](https://assetstore.unity.com/packages/tools/animation/dotween-hotween-v2-27676r)中导入并定义脚本定义符号`UNITASK_DOTWEEN_SUPPORT`后才能启用。\n\n```csharp\n// 动画序列\nawait transform.DOMoveX(2, 10);\nawait transform.DOMoveZ(5, 20);\n\n// 并行，并传递 cancellation 用于取消\nvar ct = this.GetCancellationTokenOnDestroy();\n\nawait UniTask.WhenAll(\n    transform.DOMoveX(10, 3).WithCancellation(ct),\n    transform.DOScale(10, 3).WithCancellation(ct));\n```\n\nDOTween 支持的默认行为（`await`，`WithCancellation`，`ToUniTask`） 会等待到 tween 被终止。它适用于 Complete(true/false) 和 Kill(true/false)。但是如果您想复用 tweens（`SetAutoKill(false)`），它就不能按预期工作。如果您想等待另一个时间点，Tween 中存在以下扩展方法，`AwaitForComplete`，`AwaitForPause`，`AwaitForPlay`，`AwaitForRewind`，`AwaitForStepComplete`。\n\nAsyncEnumerable 和 Async LINQ\n---\nUnity 2020.2 支持 C# 8.0，因此您可以使用`await foreach`。这是异步时代的新更新符号。\n\n```csharp\n// Unity 2020.2，C# 8.0\nawait foreach (var _ in UniTaskAsyncEnumerable.EveryUpdate().WithCancellation(token))\n{\n    Debug.Log(\"Update() \" + Time.frameCount);\n}\n```\n\n在 C# 7.3 环境中，您可以使用`ForEachAsync`方法以几乎相同的方式工作。\n\n```csharp\n// C# 7.3(Unity 2018.3~)\nawait UniTaskAsyncEnumerable.EveryUpdate().ForEachAsync(_ =>\n{\n    Debug.Log(\"Update() \" + Time.frameCount);\n}, token);\n```\n\n`UniTask.WhenEach`类似于 .NET 9 的`Task.WhenEach`，它可以使用新的方式来等待多个任务。\n\n```csharp\nawait foreach (var result in UniTask.WhenEach(task1, task2, task3))\n{\n    // 结果的类型为 WhenEachResult<T>。\n    // 它包含 `T Result` or `Exception Exception`。\n    // 您可以检查 `IsCompletedSuccessfully` 或 `IsFaulted` 以确定是访 `.Result` 还是 `.Exception`。\n    // 如果希望在 `IsFaulted` 时抛出异常并在成功时获取结果，可以使用 `GetResult()`。\n    Debug.Log(result.GetResult());\n}\n```\n\nUniTaskAsyncEnumerable 实现了异步 LINQ，类似于 LINQ 的`IEnumerable<T>`或 Rx 的 `IObservable<T>`。所有标准 LINQ 查询运算符都可以应用于异步流。例如，以下代码展示了如何将 Where 过滤器应用于每两次单击运行一次的按钮点击异步流。\n\n```csharp\nawait okButton.OnClickAsAsyncEnumerable().Where((x, i) => i % 2 == 0).ForEachAsync(_ =>\n{\n});\n```\n\n即发即弃（Fire and Forget）风格（例如，事件处理），您也可以使用`Subscribe`。\n\n```csharp\nokButton.OnClickAsAsyncEnumerable().Where((x, i) => i % 2 == 0).Subscribe(_ =>\n{\n});\n```\n\n在引入`using Cysharp.Threading.Tasks.Linq;`后，异步 LINQ 将被启用，并且`UniTaskAsyncEnumerable`在 asmdef 文件`UniTask.Linq`中定义。\n\n它更接近 UniRx（Reactive Extensions），但 UniTaskAsyncEnumerable 是基于 pull 的异步流，而 Rx 是基于 push 的异步流。请注意，尽管它们相似，但特性不同，细节也有所不同。\n\n`UniTaskAsyncEnumerable`是类似`Enumerable`的入口点。除了标准查询操作符之外，还为 Unity 提供了其他生成器，例如`EveryUpdate`、`Timer`、`TimerFrame`、`Interval`、`IntervalFrame`和`EveryValueChanged`。此外，还添加了 UniTask 原生的查询操作符，如`Append`，`Prepend`，`DistinctUntilChanged`，`ToHashSet`，`Buffer`，`CombineLatest`，`Do`，`Never`，`ForEachAsync`，`Pairwise`，`Publish`，`Queue`，`Return`，`SkipUntil`，`TakeUntil`，`SkipUntilCanceled`，`TakeUntilCanceled`，`TakeLast`，`Subscribe`。\n\n以 Func 作为参数的方法具有三个额外的重载，另外两个是`***Await`和`***AwaitWithCancellation`。\n\n```csharp\nSelect(Func<T, TR> selector)\nSelectAwait(Func<T, UniTask<TR>> selector)\nSelectAwaitWithCancellation(Func<T, CancellationToken, UniTask<TR>> selector)\n```\n\n如果在 func 内部使用`async`方法，请使用`***Await`或`***AwaitWithCancellation`。\n\n如何创建异步迭代器：C# 8.0 支持异步迭代器（`async yield return`），但它只允许`IAsyncEnumerable<T>`，当然也需要 C# 8.0。UniTask 支持使用`UniTaskAsyncEnumerable.Create`方法来创建自定义异步迭代器。\n\n```csharp\n// IAsyncEnumerable，C# 8.0 异步迭代器。（请不要这样使用，因为 IAsyncEnumerable 不被 UniTask 所控制）。\npublic async IAsyncEnumerable<int> MyEveryUpdate([EnumeratorCancellation]CancellationToken cancelationToken = default)\n{\n    var frameCount = 0;\n    await UniTask.Yield();\n    while (!token.IsCancellationRequested)\n    {\n        yield return frameCount++;\n        await UniTask.Yield();\n    }\n}\n\n// UniTaskAsyncEnumerable.Create 并用 `await writer.YieldAsync` 代替 `yield return`.\npublic IUniTaskAsyncEnumerable<int> MyEveryUpdate()\n{\n    // writer(IAsyncWriter<T>) 有 `YieldAsync(value)` 方法。\n    return UniTaskAsyncEnumerable.Create<int>(async (writer, token) =>\n    {\n        var frameCount = 0;\n        await UniTask.Yield();\n        while (!token.IsCancellationRequested)\n        {\n            await writer.YieldAsync(frameCount++); // 代替 `yield return`\n            await UniTask.Yield();\n        }\n    });\n}\n```\n\n可等待事件\n---\n所有 uGUI 组件都实现了`***AsAsyncEnumerable`，以实现对事件的异步流的转换。\n\n```csharp\nasync UniTask TripleClick()\n{\n    // 默认情况下，使用了button.GetCancellationTokenOnDestroy 来管理异步生命周期\n    await button.OnClickAsync();\n    await button.OnClickAsync();\n    await button.OnClickAsync();\n    Debug.Log(\"Three times clicked\");\n}\n\n// 更高效的方法\nasync UniTask TripleClick()\n{\n    using (var handler = button.GetAsyncClickEventHandler())\n    {\n        await handler.OnClickAsync();\n        await handler.OnClickAsync();\n        await handler.OnClickAsync();\n        Debug.Log(\"Three times clicked\");\n    }\n}\n\n// 使用异步 LINQ\nasync UniTask TripleClick(CancellationToken token)\n{\n    await button.OnClickAsAsyncEnumerable().Take(3).Last();\n    Debug.Log(\"Three times clicked\");\n}\n\n// 使用异步 LINQ\nasync UniTask TripleClick(CancellationToken token)\n{\n    await button.OnClickAsAsyncEnumerable().Take(3).ForEachAsync(_ =>\n    {\n        Debug.Log(\"Every clicked\");\n    });\n    Debug.Log(\"Three times clicked, complete.\");\n}\n```\n\n所有 MonoBehaviour 消息事件均可通过`AsyncTriggers`转换成异步流，`AsyncTriggers`可通过引入`using Cysharp.Threading.Tasks.Triggers;`来启用。`AsyncTriggers`可以使用`GetAsync***Trigger`来创建，并将它作为 UniTaskAsyncEnumerable 来触发。\n\n```csharp\nvar trigger = this.GetOnCollisionEnterAsyncHandler();\nawait trigger.OnCollisionEnterAsync();\nawait trigger.OnCollisionEnterAsync();\nawait trigger.OnCollisionEnterAsync();\n\n// 每次移动触发。\nawait this.GetAsyncMoveTrigger().ForEachAsync(axisEventData =>\n{\n});\n```\n\n`AsyncReactiveProperty`，`AsyncReadOnlyReactiveProperty`是 UniTask 的 ReactiveProperty 版本。`BindTo`的`IUniTaskAsyncEnumerable<T>`扩展方法，可以把异步流值绑定到 Unity 组件（Text/Selectable/TMP/Text）。\n\n```csharp\nvar rp = new AsyncReactiveProperty<int>(99);\n\n// AsyncReactiveProperty 本身是 IUniTaskAsyncEnumerable，可以通过 LINQ 进行查询\nrp.ForEachAsync(x =>\n{\n    Debug.Log(x);\n}, this.GetCancellationTokenOnDestroy()).Forget();\n\nrp.Value = 10; // 推送10给所有订阅者\nrp.Value = 11; // 推送11给所有订阅者\n\n// WithoutCurrent 忽略初始值\n// BindTo 绑定 stream value 到 unity 组件.\nrp.WithoutCurrent().BindTo(this.textComponent);\n\nawait rp.WaitAsync(); // 一直等待，直到下一个值被设置\n\n// 同样支持 ToReadOnlyAsyncReactiveProperty\nvar rp2 = new AsyncReactiveProperty<int>(99);\nvar rorp = rp.CombineLatest(rp2, (x, y) => (x, y)).ToReadOnlyAsyncReactiveProperty(CancellationToken.None);\n```\n\n在序列中的异步处理完成之前，pull-based异步流不会获取下一个值。这可能会从按钮等推送类型的事件中溢出数据。\n\n```csharp\n// 在3s延迟结束前，无法获取 event\nawait button.OnClickAsAsyncEnumerable().ForEachAwaitAsync(async x =>\n{\n    await UniTask.Delay(TimeSpan.FromSeconds(3));\n});\n```\n\n它（在防止双击方面）是有用的，但有时也并非都有用。\n\n使用`Queue()`方法在异步处理期间也会对事件进行排队。\n\n```csharp\n// 异步处理中对 message 进行排队\nawait button.OnClickAsAsyncEnumerable().Queue().ForEachAwaitAsync(async x =>\n{\n    await UniTask.Delay(TimeSpan.FromSeconds(3));\n});\n```\n\n或使用即发即弃风格的`Subscribe`。\n\n```csharp\nbutton.OnClickAsAsyncEnumerable().Subscribe(async x =>\n{\n    await UniTask.Delay(TimeSpan.FromSeconds(3));\n});\n```\n\nChannel\n---\n`Channel`与[System.Threading.Tasks.Channels](https://docs.microsoft.com/en-us/dotnet/api/system.threading.channels?view=netcore-3.1)相同，类似于 GoLang Channel。\n\n目前只支持多生产者、单消费者无界 Channel。它可以通过`Channel.CreateSingleConsumerUnbounded<T>()`来创建。\n\n对于生产者(`.Writer`)，使用`TryWrite`来推送值，使用`TryComplete`来完成 Channel。对于消费者(`.Reader`)，使用`TryRead`、`WaitToReadAsync`、`ReadAsync`和`Completion`，`ReadAllAsync`来读取队列的消息。\n\n`ReadAllAsync`返回`IUniTaskAsyncEnumerable<T>` 因此可以使用 LINQ 操作符。Reader 只允许单消费者，但可以使用`.Publish()`查询操作符来启用多播消息。例如，可以制作发布/订阅工具。\n\n```csharp\npublic class AsyncMessageBroker<T> : IDisposable\n{\n    Channel<T> channel;\n\n    IConnectableUniTaskAsyncEnumerable<T> multicastSource;\n    IDisposable connection;\n\n    public AsyncMessageBroker()\n    {\n        channel = Channel.CreateSingleConsumerUnbounded<T>();\n        multicastSource = channel.Reader.ReadAllAsync().Publish();\n        connection = multicastSource.Connect(); // Publish returns IConnectableUniTaskAsyncEnumerable.\n    }\n\n    public void Publish(T value)\n    {\n        channel.Writer.TryWrite(value);\n    }\n\n    public IUniTaskAsyncEnumerable<T> Subscribe()\n    {\n        return multicastSource;\n    }\n\n    public void Dispose()\n    {\n        channel.Writer.TryComplete();\n        connection.Dispose();\n    }\n}\n```\n\n与 Awaitable 对比\n---\nUnity 6 引入了可等待类型[Awaitable](https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Awaitable.html)。简而言之，Awaitable 可以被认为是 UniTask 的一个子集，并且事实上，Awaitable的设计也受 UniTask 的影响。它应该能够处理基于 PlayerLoop 的 await，池化 Task，以及支持以类似的方式使用`CancellationToken`进行取消。随着它被包含在标准库中，您可能想知道是继续使用 UniTask 还是迁移到 Awaitable。以下是简要指南。\n\n首先，Awaitable 提供的功能与协程提供的功能相同。使用 await 代替`yield return`；`await NextFrameAsync()`代替`yield return null`；`WaitForSeconds`和`EndOfFrame`等价。然而，这只是两者之间的差异。就功能而言，它是基于协程的，缺乏基于 Task 的特性。在使用 async/await 的实际应用程序开发中，像`WhenAll`这样的操作是必不可少的。此外，UniTask 支持许多基于帧的操作（如`DelayFrame`）和更灵活的 PlayerLoopTiming 控制，这些在 Awaitable 中是不可用的。当然，它也没有跟踪器窗口。\n\n因此，我推荐在应用程序开发中使用 UniTask。UniTask 是 Awaitable 的超集，并包含了许多基本特性。对于库开发，如果您希望避免外部依赖，可以使用 Awaitable 作为方法的返回类型。因为 Awaitable 可以使用`AsUniTask`转换为 UniTask，所以支持在 UniTask 库中处理基于 Awaitable 的功能。即便是在库开发中，如果您不需要担心依赖关系，使用 UniTask 也会是您的最佳选择。\n\n单元测试\n---\nUnity 的`[UnityTest]`属性可以测试协程（IEnumerator）但不能测试异步。`UniTask.ToCoroutine`将 async/await 桥接到协程，以便您可以测试异步方法。\n\n```csharp\n[UnityTest]\npublic IEnumerator DelayIgnore() => UniTask.ToCoroutine(async () =>\n{\n    var time = Time.realtimeSinceStartup;\n\n    Time.timeScale = 0.5f;\n    try\n    {\n        await UniTask.Delay(TimeSpan.FromSeconds(3), ignoreTimeScale: true);\n\n        var elapsed = Time.realtimeSinceStartup - time;\n        Assert.AreEqual(3, (int)Math.Round(TimeSpan.FromSeconds(elapsed).TotalSeconds, MidpointRounding.ToEven));\n    }\n    finally\n    {\n        Time.timeScale = 1.0f;\n    }\n});\n```\n\nUniTask 自身的单元测试是使用 Unity Test Runner 和[Cysharp/RuntimeUnitTestToolkit](https://github.com/Cysharp/RuntimeUnitTestToolkit)编写的，以集成到 CI 中并检查 IL2CPP 是否正常工作。\n\n## 线程池的限制\n\n大多数 UniTask 方法在单个线程 (PlayerLoop) 上运行，只有`UniTask.Run`（等同于`Task.Run`）和`UniTask.SwitchToThreadPool`在线程池上运行。如果您使用线程池，它将无法与 WebGL 等平台兼容。\n\n`UniTask.Run`现在已弃用。您可以改用`UniTask.RunOnThreadPool`。并且还要考虑是否可以使用`UniTask.Create`或`UniTask.Void`。\n\n## IEnumerator.ToUniTask 的限制\n\n您可以将协程（IEnumerator）转换为 UniTask（或直接 await），但它有一些限制。\n\n- 不支持`WaitForEndOfFrame`，`WaitForFixedUpdate`，`Coroutine`\n- 生命周期与`StartCoroutine`不一样，它使用指定的`PlayerLoopTiming`，并且默认情况下，`PlayerLoopTiming.Update`在 MonoBehaviour 的`Update`和`StartCoroutine`的循环之前执行。\n\n如果您想要实现从协程到异步的完全兼容转换，请使用`IEnumerator.ToUniTask(MonoBehaviour coroutineRunner)`重载。它会在传入的 MonoBehaviour 实例中执行 StartCoroutine 并在 UniTask 中等待它完成。\n\n## 关于 UnityEditor\n\nUniTask 可以像编辑器协程一样在 Unity 编辑器上运行。但它有一些限制。\n\n- UniTask.Delay 的 DelayType.DeltaTime、UnscaledDeltaTime 无法正常工作，因为它们无法在编辑器中获取 deltaTime。因此在 EditMode 下运行时，会自动将 DelayType 更改为能等待正确的时间的`DelayType.Realtime`。\n- 所有 PlayerLoopTiming 都在`EditorApplication.update`生命周期上运行。\n- 带`-quit`的`-batchmode`不起作用，因为 Unity 不会执行 `EditorApplication.update` 并在一帧后退出。因此，不要使用`-quit`并使用`EditorApplication.Exit(0)`手动退出。\n\n与原生 Task API 对比\n---\nUniTask 有许多原生的类Task API。此表展示了两者相对应的 API。\n\n使用原生类型。\n\n| .NET 类型                   | UniTask 类型 | \n|---------------------------| --- |\n| `IProgress<T>`            | --- |\n| `CancellationToken`       | --- | \n| `CancellationTokenSource` | --- |\n\n使用 UniTask 类型。\n\n| .NET 类型 | UniTask 类型 | \n| --- | --- |\n| `Task`/`ValueTask` | `UniTask` |\n| `Task<T>`/`ValueTask<T>` | `UniTask<T>` |\n| `async void` | `async UniTaskVoid` | \n| `+= async () => { }` | `UniTask.Void`, `UniTask.Action`, `UniTask.UnityAction` |\n| --- | `UniTaskCompletionSource` |\n| `TaskCompletionSource<T>` | `UniTaskCompletionSource<T>`/`AutoResetUniTaskCompletionSource<T>` |\n| `ManualResetValueTaskSourceCore<T>` | `UniTaskCompletionSourceCore<T>` |\n| `IValueTaskSource` | `IUniTaskSource` |\n| `IValueTaskSource<T>` | `IUniTaskSource<T>` |\n| `ValueTask.IsCompleted` | `UniTask.Status.IsCompleted()` |\n| `ValueTask<T>.IsCompleted` | `UniTask<T>.Status.IsCompleted()` |\n| `new Progress<T>` | `Progress.Create<T>` |\n| `CancellationToken.Register(UnsafeRegister)` | `CancellationToken.RegisterWithoutCaptureExecutionContext` |\n| `CancellationTokenSource.CancelAfter` | `CancellationTokenSource.CancelAfterSlim` |\n| `Channel.CreateUnbounded<T>(false){ SingleReader = true }` | `Channel.CreateSingleConsumerUnbounded<T>` |\n| `IAsyncEnumerable<T>` | `IUniTaskAsyncEnumerable<T>` |\n| `IAsyncEnumerator<T>` | `IUniTaskAsyncEnumerator<T>` |\n| `IAsyncDisposable` | `IUniTaskAsyncDisposable` |\n| `Task.Delay` | `UniTask.Delay` |\n| `Task.Yield` | `UniTask.Yield` |\n| `Task.Run` | `UniTask.RunOnThreadPool` |\n| `Task.WhenAll` | `UniTask.WhenAll` |\n| `Task.WhenAny` | `UniTask.WhenAny` |\n| `Task.WhenEach` | `UniTask.WhenEach` |\n| `Task.CompletedTask` | `UniTask.CompletedTask` |\n| `Task.FromException` | `UniTask.FromException` |\n| `Task.FromResult` | `UniTask.FromResult` |\n| `Task.FromCanceled` | `UniTask.FromCanceled` |\n| `Task.ContinueWith` | `UniTask.ContinueWith` |\n| `TaskScheduler.UnobservedTaskException` | `UniTaskScheduler.UnobservedTaskException` |\n\n池化配置\n---\nUniTask 通过积极缓存异步 promise 对象实现零堆内存分配（有关技术细节，请参阅博客文章[UniTask v2 — 适用于 Unity 的零堆内存分配的async/await，支持异步 LINQ](https://medium.com/@neuecc/unitask-v2-zero-allocation-async-await-for-unity-with-asynchronous-linq-1aa9c96aa7dd)）。默认情况下，它缓存所有 promise，但您可以通过调用`TaskPool.SetMaxPoolSize`方法来自定义每种类型的最大缓存大小。`TaskPool.GetCacheSizeInfo`返回池中当前缓存的对象。\n\n```csharp\nforeach (var (type, size) in TaskPool.GetCacheSizeInfo())\n{\n    Debug.Log(type + \":\" + size);\n}\n```\n\nProfiler 下的堆内存分配\n---\n在 UnityEditor 中，能从 profiler 中看到编译器生成的 AsyncStateMachine 的堆内存分配，但它只出现在Debug（development）构建中。C# 编译器在Debug 构建时将 AsyncStateMachine 生成为类，而在Release 构建时将其生成为结构。\n\nUnity 从2020.1版本开始支持代码优化选项（位于右下角）。\n\n![](https://user-images.githubusercontent.com/46207/89967342-2f944600-dc8c-11ea-99fc-0b74527a16f6.png)\n\n在开发构建中，您可以通过将 C# 编译器优化设置为 release 模式来移除 AsyncStateMachine 的堆内存分配。此优化选项也可以通过`Compilation.CompilationPipeline-codeOptimization`和`Compilation.CodeOptimization`来设置。\n\nUniTaskSynchronizationContext\n---\nUnity 的默认 SynchronizationContext(`UnitySynchronizationContext`) 在性能方面表现不佳。UniTask 绕过`SynchronizationContext`(和`ExecutionContext`) 因此 UniTask 不使用它，但如果存在`async Task`，则仍然使用它。`UniTaskSynchronizationContext`是`UnitySynchronizationContext`性能更好的替代品。\n\n```csharp\npublic class SyncContextInjecter\n{\n    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]\n    public static void Inject()\n    {\n        SynchronizationContext.SetSynchronizationContext(new UniTaskSynchronizationContext());\n    }\n}\n```\n\n这是一个可选的选择，并不总是推荐；`UniTaskSynchronizationContext`性能不如`async UniTask`，并且不是完整的 UniTask 替代品。它也不保证与`UnitySynchronizationContext`完全兼容\n\nAPI 文档\n---\nUniTask 的 API 文档托管在[cysharp.github.io/UniTask](https://cysharp.github.io/UniTask/api/Cysharp.Threading.Tasks.html)，使用[DocFX](https://dotnet.github.io/docfx/)和[Cysharp/DocfXTemplate](https://github.com/Cysharp/DocfxTemplate)生成。\n\n例如，UniTask 的工厂方法可以在[UniTask#methods](https://cysharp.github.io/UniTask/api/Cysharp.Threading.Tasks.UniTask.html#methods-1)中查阅。UniTaskAsyncEnumerable 的工厂方法和扩展方法可以在[UniTaskAsyncEnumerable#methods](https://cysharp.github.io/UniTask/api/Cysharp.Threading.Tasks.Linq.UniTaskAsyncEnumerable.html#methods-1)中查阅。\n\nUPM 包\n---\n### 通过 git URL 安装\n\n需要支持 git 包路径查询参数的 Unity 版本（Unity >= 2019.3.4f1，Unity >= 2020.1a21）。您可以在包管理器中添加`https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask`\n\n![image](https://user-images.githubusercontent.com/46207/79450714-3aadd100-8020-11ea-8aae-b8d87fc4d7be.png)\n\n![image](https://user-images.githubusercontent.com/46207/83702872-e0f17c80-a648-11ea-8183-7469dcd4f810.png)\n\n或在`Packages/manifest.json`中添加`\"com.cysharp.unitask\": \"https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask\"` 。\n\nUniTask 使用`*.*.*`发布标签来指定版本，因此如果您要设置指定版本，您可以在后面添加像`#2.1.0`这样的版本标签。例如`https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask#2.1.0` 。\n\n\n关于 .NET Core\n---\n对于 .NET Core，请使用 NuGet。\n\n> PM> Install-Package [UniTask](https://www.nuget.org/packages/UniTask)\n\n.NET Core 版本的 UniTask 是 Unity 版本的 UniTask 的子集，它移除了依赖 PlayerLoop 的方法。\n\n相比于原生 Task 和 ValueTask，它能以更高的性能运行，但在使用时应注意忽略 ExecutionContext 和 SynchronizationContext。因为它忽略了 ExecutionContext，`AsyncLocal`也不起作用。\n\n如果您在内部使用 UniTask，但将 ValueTask 作为外部 API 提供，您可以编写如下代码（受[PooledAwait](https://github.com/mgravell/PooledAwait)启发）。\n\n```csharp\npublic class ZeroAllocAsyncAwaitInDotNetCore\n{\n    public ValueTask<int> DoAsync(int x, int y)\n    {\n        return Core(this, x, y);\n\n        static async UniTask<int> Core(ZeroAllocAsyncAwaitInDotNetCore self, int x, int y)\n        {\n            // do anything...\n            await Task.Delay(TimeSpan.FromSeconds(x + y));\n            await UniTask.Yield();\n\n            return 10;\n        }\n    }\n}\n\n// UniTask 不会返回到原生 SynchronizationContext，但可以使用 `ReturnToCurrentSynchronizationContext`来让他返回\npublic ValueTask TestAsync()\n{\n    await using (UniTask.ReturnToCurrentSynchronizationContext())\n    {\n        await UniTask.SwitchToThreadPool();\n        // do anything..\n    }\n}\n```\n\n.NET Core 版本的 UniTask 是为了让用户在与 Unity 共享代码时（例如使用[CysharpOnion](https://github.com/Cysharp/MagicOnion/)），能够将 UniTask 用作接口。.NET Core 版本的 UniTask 使得代码共享更加顺畅。\n\n[Cysharp/ValueTaskSupplement](https://github.com/Cysharp/ValueTaskSupplement)提供了一些实用方法，如 WhenAll，这些方法等效于 UniTask。\n\n许可证\n---\n此库采用MIT许可证\n"
  },
  {
    "path": "UniTask.NetCore.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 17\nVisualStudioVersion = 17.0.31606.5\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"UniTask.NetCoreTests\", \"src\\UniTask.NetCoreTests\\UniTask.NetCoreTests.csproj\", \"{B3E311A4-70D8-4131-9965-C073A99D201A}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"UniTask.NetCore\", \"src\\UniTask.NetCore\\UniTask.NetCore.csproj\", \"{16EE20D0-7FB1-483A-8467-A5EEDBF1F5BF}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"UniTask.NetCoreSandbox\", \"src\\UniTask.NetCoreSandbox\\UniTask.NetCoreSandbox.csproj\", \"{3915E72E-33E0-4A14-A6D8-872702200E58}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"UniTask.Analyzer\", \"src\\UniTask.Analyzer\\UniTask.Analyzer.csproj\", \"{0AC6F052-A255-4EE3-9E05-1C02D49AB1C2}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{B3E311A4-70D8-4131-9965-C073A99D201A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{B3E311A4-70D8-4131-9965-C073A99D201A}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{B3E311A4-70D8-4131-9965-C073A99D201A}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{B3E311A4-70D8-4131-9965-C073A99D201A}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{16EE20D0-7FB1-483A-8467-A5EEDBF1F5BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{16EE20D0-7FB1-483A-8467-A5EEDBF1F5BF}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{16EE20D0-7FB1-483A-8467-A5EEDBF1F5BF}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{16EE20D0-7FB1-483A-8467-A5EEDBF1F5BF}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{3915E72E-33E0-4A14-A6D8-872702200E58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{3915E72E-33E0-4A14-A6D8-872702200E58}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{3915E72E-33E0-4A14-A6D8-872702200E58}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{3915E72E-33E0-4A14-A6D8-872702200E58}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{0AC6F052-A255-4EE3-9E05-1C02D49AB1C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{0AC6F052-A255-4EE3-9E05-1C02D49AB1C2}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{0AC6F052-A255-4EE3-9E05-1C02D49AB1C2}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{0AC6F052-A255-4EE3-9E05-1C02D49AB1C2}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {90F78FCC-7CD4-4E88-A3DB-873F481F8C8B}\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "docs/.gitignore",
    "content": "###############\n#    folder   #\n###############\n/**/DROP/\n/**/TEMP/\n/**/packages/\n/**/bin/\n/**/obj/\n_site\n_DocfxTemplate"
  },
  {
    "path": "docs/api/.gitignore",
    "content": "###############\n#  temp file  #\n###############\n*.yml\n.manifest\n"
  },
  {
    "path": "docs/docfx.json",
    "content": "{\n  \"metadata\": [\n    {\n      \"src\": [\n        {\n          \"files\": [\n            \"UniTask/Library/ScriptAssemblies/UniTask*.dll\"\n          ],\n          \"exclude\": [\n            \"UniTask/Library/ScriptAssemblies/UniTask.Tests.dll\",\n            \"UniTask/Library/ScriptAssemblies/UniTask.Tests.Editor.dll\"\n          ],\n          \"src\": \"../src\"\n        }\n      ],\n      \"dest\": \"api\",\n      \"disableGitFeatures\": false,\n      \"disableDefaultFilter\": false\n    }\n  ],\n  \"build\": {\n    \"globalMetadata\": {\n      \"_disableContribution\": true,\n      \"_appTitle\": \"UniTask\"\n    },\n    \"content\": [\n      {\n        \"files\": [\n          \"api/**.yml\",\n          \"api/index.md\"\n        ]\n      },\n      {\n        \"files\": [\n          \"articles/**.md\",\n          \"articles/**/toc.yml\",\n          \"toc.yml\",\n          \"*.md\"\n        ]\n      }\n    ],\n    \"resource\": [\n      {\n        \"files\": [\n          \"images/**\"\n        ]\n      }\n    ],\n    \"overwrite\": [\n      {\n        \"files\": [\n          \"apidoc/**.md\"\n        ],\n        \"exclude\": [\n          \"obj/**\",\n          \"_site/**\"\n        ]\n      }\n    ],\n    \"dest\": \"_site\",\n    \"globalMetadataFiles\": [],\n    \"fileMetadataFiles\": [],\n    \"template\": [\n      \"_DocfxTemplate/templates/default-v2.5.2\",\n      \"_DocfxTemplate/templates/cysharp\"\n    ],\n    \"postProcessors\": [],\n    \"markdownEngineName\": \"markdig\",\n    \"noLangKeyword\": false,\n    \"keepFileLink\": false,\n    \"cleanupCacheHistory\": false\n  }\n}\n"
  },
  {
    "path": "docs/index.md",
    "content": "---\ntitle: Home\n---\n# UniTask\n\nProvides an efficient async/await integration to Unity.\n\nhttps://github.com/Cysharp/UniTask\n"
  },
  {
    "path": "docs/toc.yml",
    "content": "- name: API Documentation\n  href: api/\n  homepage: api/Cysharp.Threading.Tasks.html\n\n- name: Repository\n  href: https://github.com/Cysharp/UniTask\n  homepage: https://github.com/Cysharp/UniTask\n\n- name: Releases\n  href: https://github.com/Cysharp/UniTask/releases\n  homepage: https://github.com/Cysharp/UniTask/releases"
  },
  {
    "path": "src/UniTask/Assets/Editor/EditorRunnerChecker.cs",
    "content": "﻿#if UNITY_EDITOR\n\nusing Cysharp.Threading.Tasks;\nusing System;\nusing System.IO;\nusing System.Linq;\nusing UnityEditor;\nusing UnityEngine;\nusing UnityEngine.Networking;\n\npublic static class EditorRunnerChecker\n{\n    [MenuItem(\"Tools/UniTaskEditorRunnerChecker\")]\n    public static void RunUniTaskAsync()\n    {\n        RunCore().Forget();\n    }\n\n    static async UniTaskVoid RunCore()\n    {\n        Debug.Log(\"Start\");\n\n        //var r = await UnityWebRequest.Get(\"https://bing.com/\").SendWebRequest().ToUniTask();\n        //Debug.Log(r.downloadHandler.text.Substring(0, 100));\n        //await UniTask.Yield();\n\n        await UniTask.DelayFrame(30);\n\n        Debug.Log(\"End\");\n    }\n}\n\n#endif"
  },
  {
    "path": "src/UniTask/Assets/Editor/EditorRunnerChecker.cs.meta",
    "content": "fileFormatVersion: 2\nguid: e51b78c06cb410f42b36e0af9de3b065\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Editor/PackageExporter.cs",
    "content": "﻿#if UNITY_EDITOR\n\nusing System;\nusing System.IO;\nusing System.Linq;\nusing UnityEditor;\nusing UnityEngine;\n\npublic static class PackageExporter\n{\n    [MenuItem(\"Tools/Export Unitypackage\")]\n    public static void Export()\n    {\n        var root = \"Plugins/UniTask\";\n        var version = GetVersion(root);\n\n        var fileName = string.IsNullOrEmpty(version) ? \"UniTask.unitypackage\" : $\"UniTask.{version}.unitypackage\";\n        var exportPath = \"./\" + fileName;\n\n        var path = Path.Combine(Application.dataPath, root);\n        var assets = Directory.EnumerateFiles(path, \"*\", SearchOption.AllDirectories)\n            .Where(x => Path.GetExtension(x) == \".cs\" || Path.GetExtension(x) == \".asmdef\" || Path.GetExtension(x) == \".json\" || Path.GetExtension(x) == \".meta\")\n            .Select(x => \"Assets\" + x.Replace(Application.dataPath, \"\").Replace(@\"\\\", \"/\"))\n            .ToArray();\n\n        UnityEngine.Debug.Log(\"Export below files\" + Environment.NewLine + string.Join(Environment.NewLine, assets));\n\n        AssetDatabase.ExportPackage(\n            assets,\n            exportPath,\n            ExportPackageOptions.Default);\n\n        UnityEngine.Debug.Log(\"Export complete: \" + Path.GetFullPath(exportPath));\n    }\n\n    static string GetVersion(string root)\n    {\n        var version = Environment.GetEnvironmentVariable(\"UNITY_PACKAGE_VERSION\");\n        var versionJson = Path.Combine(Application.dataPath, root, \"package.json\");\n\n        if (File.Exists(versionJson))\n        {\n            var v = JsonUtility.FromJson<Version>(File.ReadAllText(versionJson));\n\n            if (!string.IsNullOrEmpty(version))\n            {\n                if (v.version != version)\n                {\n                    var msg = $\"package.json and env version are mismatched. UNITY_PACKAGE_VERSION:{version}, package.json:{v.version}\";\n\n                    if (Application.isBatchMode)\n                    {\n                        Console.WriteLine(msg);\n                        Application.Quit(1);\n                    }\n\n                    throw new Exception(\"package.json and env version are mismatched.\");\n                }\n            }\n\n            version = v.version;\n        }\n\n        return version;\n    }\n\n    public class Version\n    {\n        public string version;\n    }\n}\n\n#endif"
  },
  {
    "path": "src/UniTask/Assets/Editor/PackageExporter.cs.meta",
    "content": "fileFormatVersion: 2\nguid: af97405af79afbb4e9f7f49f30088474\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Editor.meta",
    "content": "fileFormatVersion: 2\nguid: 99c8676e874bf0343b421d3527868f16\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Editor/SplitterGUILayout.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Linq;\nusing System.Reflection;\nusing UnityEditor;\nusing UnityEngine;\n\nnamespace Cysharp.Threading.Tasks.Editor\n{\n    // reflection call of UnityEditor.SplitterGUILayout\n    internal static class SplitterGUILayout\n    {\n        static BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;\n\n        static Lazy<Type> splitterStateType = new Lazy<Type>(() =>\n        {\n            var type = typeof(EditorWindow).Assembly.GetTypes().First(x => x.FullName == \"UnityEditor.SplitterState\");\n            return type;\n        });\n\n        static Lazy<ConstructorInfo> splitterStateCtor = new Lazy<ConstructorInfo>(() =>\n        {\n            var type = splitterStateType.Value;\n            return type.GetConstructor(flags, null, new Type[] { typeof(float[]), typeof(int[]), typeof(int[]) }, null);\n        });\n\n        static Lazy<Type> splitterGUILayoutType = new Lazy<Type>(() =>\n        {\n            var type = typeof(EditorWindow).Assembly.GetTypes().First(x => x.FullName == \"UnityEditor.SplitterGUILayout\");\n            return type;\n        });\n\n        static Lazy<MethodInfo> beginVerticalSplit = new Lazy<MethodInfo>(() =>\n        {\n            var type = splitterGUILayoutType.Value;\n            return type.GetMethod(\"BeginVerticalSplit\", flags, null, new Type[] { splitterStateType.Value, typeof(GUILayoutOption[]) }, null);\n        });\n\n        static Lazy<MethodInfo> endVerticalSplit = new Lazy<MethodInfo>(() =>\n        {\n            var type = splitterGUILayoutType.Value;\n            return type.GetMethod(\"EndVerticalSplit\", flags, null, Type.EmptyTypes, null);\n        });\n\n        public static object CreateSplitterState(float[] relativeSizes, int[] minSizes, int[] maxSizes)\n        {\n            return splitterStateCtor.Value.Invoke(new object[] { relativeSizes, minSizes, maxSizes });\n        }\n\n        public static void BeginVerticalSplit(object splitterState, params GUILayoutOption[] options)\n        {\n            beginVerticalSplit.Value.Invoke(null, new object[] { splitterState, options });\n        }\n\n        public static void EndVerticalSplit()\n        {\n            endVerticalSplit.Value.Invoke(null, Type.EmptyTypes);\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Editor/SplitterGUILayout.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 40ef2e46f900131419e869398a8d3c9d\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Editor/UniTask.Editor.asmdef",
    "content": "{\n    \"name\": \"UniTask.Editor\",\n    \"references\": [\n        \"UniTask\"\n    ],\n    \"includePlatforms\": [\n        \"Editor\"\n    ],\n    \"excludePlatforms\": [],\n    \"allowUnsafeCode\": false,\n    \"overrideReferences\": false,\n    \"precompiledReferences\": [],\n    \"autoReferenced\": false,\n    \"defineConstraints\": [],\n    \"versionDefines\": [],\n    \"noEngineReferences\": false\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Editor/UniTask.Editor.asmdef.meta",
    "content": "fileFormatVersion: 2\nguid: 4129704b5a1a13841ba16f230bf24a57\nAssemblyDefinitionImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Editor/UniTaskTrackerTreeView.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing UnityEngine;\nusing UnityEditor;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\nusing System;\nusing UnityEditor.IMGUI.Controls;\nusing Cysharp.Threading.Tasks.Internal;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Cysharp.Threading.Tasks.Editor\n{\n    public class UniTaskTrackerViewItem : TreeViewItem\n    {\n        static Regex removeHref = new Regex(\"<a href.+>(.+)</a>\", RegexOptions.Compiled);\n\n        public string TaskType { get; set; }\n        public string Elapsed { get; set; }\n        public string Status { get; set; }\n\n        string position;\n        public string Position\n        {\n            get { return position; }\n            set\n            {\n                position = value;\n                PositionFirstLine = GetFirstLine(position);\n            }\n        }\n\n        public string PositionFirstLine { get; private set; }\n\n        static string GetFirstLine(string str)\n        {\n            var sb = new StringBuilder();\n            for (int i = 0; i < str.Length; i++)\n            {\n                if (str[i] == '\\r' || str[i] == '\\n')\n                {\n                    break;\n                }\n                sb.Append(str[i]);\n            }\n\n            return removeHref.Replace(sb.ToString(), \"$1\");\n        }\n\n        public UniTaskTrackerViewItem(int id) : base(id)\n        {\n\n        }\n    }\n\n    public class UniTaskTrackerTreeView : TreeView\n    {\n        const string sortedColumnIndexStateKey = \"UniTaskTrackerTreeView_sortedColumnIndex\";\n\n        public IReadOnlyList<TreeViewItem> CurrentBindingItems;\n\n        public UniTaskTrackerTreeView()\n            : this(new TreeViewState(), new MultiColumnHeader(new MultiColumnHeaderState(new[]\n            {\n                new MultiColumnHeaderState.Column() { headerContent = new GUIContent(\"TaskType\"), width = 20},\n                new MultiColumnHeaderState.Column() { headerContent = new GUIContent(\"Elapsed\"), width = 10},\n                new MultiColumnHeaderState.Column() { headerContent = new GUIContent(\"Status\"), width = 10},\n                new MultiColumnHeaderState.Column() { headerContent = new GUIContent(\"Position\")},\n            })))\n        {\n        }\n\n        UniTaskTrackerTreeView(TreeViewState state, MultiColumnHeader header)\n            : base(state, header)\n        {\n            rowHeight = 20;\n            showAlternatingRowBackgrounds = true;\n            showBorder = true;\n            header.sortingChanged += Header_sortingChanged;\n\n            header.ResizeToFit();\n            Reload();\n\n            header.sortedColumnIndex = SessionState.GetInt(sortedColumnIndexStateKey, 1);\n        }\n\n        public void ReloadAndSort()\n        {\n            var currentSelected = this.state.selectedIDs;\n            Reload();\n            Header_sortingChanged(this.multiColumnHeader);\n            this.state.selectedIDs = currentSelected;\n        }\n\n        private void Header_sortingChanged(MultiColumnHeader multiColumnHeader)\n        {\n            SessionState.SetInt(sortedColumnIndexStateKey, multiColumnHeader.sortedColumnIndex);\n            var index = multiColumnHeader.sortedColumnIndex;\n            var ascending = multiColumnHeader.IsSortedAscending(multiColumnHeader.sortedColumnIndex);\n\n            var items = rootItem.children.Cast<UniTaskTrackerViewItem>();\n\n            IOrderedEnumerable<UniTaskTrackerViewItem> orderedEnumerable;\n            switch (index)\n            {\n                case 0:\n                    orderedEnumerable = ascending ? items.OrderBy(item => item.TaskType) : items.OrderByDescending(item => item.TaskType);\n                    break;\n                case 1:\n                    orderedEnumerable = ascending ? items.OrderBy(item => double.Parse(item.Elapsed)) : items.OrderByDescending(item => double.Parse(item.Elapsed));\n                    break;\n                case 2:\n                    orderedEnumerable = ascending ? items.OrderBy(item => item.Status) : items.OrderByDescending(item => item.Elapsed);\n                    break;\n                case 3:\n                    orderedEnumerable = ascending ? items.OrderBy(item => item.Position) : items.OrderByDescending(item => item.PositionFirstLine);\n                    break;\n                default:\n                    throw new ArgumentOutOfRangeException(nameof(index), index, null);\n            }\n\n            CurrentBindingItems = rootItem.children = orderedEnumerable.Cast<TreeViewItem>().ToList();\n            BuildRows(rootItem);\n        }\n\n        protected override TreeViewItem BuildRoot()\n        {\n            var root = new TreeViewItem { depth = -1 };\n\n            var children = new List<TreeViewItem>();\n\n            TaskTracker.ForEachActiveTask((trackingId, awaiterType, status, created, stackTrace) =>\n            {\n                children.Add(new UniTaskTrackerViewItem(trackingId) { TaskType = awaiterType, Status = status.ToString(), Elapsed = (DateTime.UtcNow - created).TotalSeconds.ToString(\"00.00\"), Position = stackTrace });\n            });\n\n            CurrentBindingItems = children;\n            root.children = CurrentBindingItems as List<TreeViewItem>;\n            return root;\n        }\n\n        protected override bool CanMultiSelect(TreeViewItem item)\n        {\n            return false;\n        }\n\n        protected override void RowGUI(RowGUIArgs args)\n        {\n            var item = args.item as UniTaskTrackerViewItem;\n\n            for (var visibleColumnIndex = 0; visibleColumnIndex < args.GetNumVisibleColumns(); visibleColumnIndex++)\n            {\n                var rect = args.GetCellRect(visibleColumnIndex);\n                var columnIndex = args.GetColumn(visibleColumnIndex);\n\n                var labelStyle = args.selected ? EditorStyles.whiteLabel : EditorStyles.label;\n                labelStyle.alignment = TextAnchor.MiddleLeft;\n                switch (columnIndex)\n                {\n                    case 0:\n                        EditorGUI.LabelField(rect, item.TaskType, labelStyle);\n                        break;\n                    case 1:\n                        EditorGUI.LabelField(rect, item.Elapsed, labelStyle);\n                        break;\n                    case 2:\n                        EditorGUI.LabelField(rect, item.Status, labelStyle);\n                        break;\n                    case 3:\n                        EditorGUI.LabelField(rect, item.PositionFirstLine, labelStyle);\n                        break;\n                    default:\n                        throw new ArgumentOutOfRangeException(nameof(columnIndex), columnIndex, null);\n                }\n            }\n        }\n    }\n\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Editor/UniTaskTrackerTreeView.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 52e2d973a2156674e8c1c9433ed031f7\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Editor/UniTaskTrackerWindow.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing UnityEngine;\nusing UnityEditor;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\nusing System;\nusing UnityEditor.IMGUI.Controls;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks.Editor\n{\n    public class UniTaskTrackerWindow : EditorWindow\n    {\n        static int interval;\n\n        static UniTaskTrackerWindow window;\n\n        [MenuItem(\"Window/UniTask Tracker\")]\n        public static void OpenWindow()\n        {\n            if (window != null)\n            {\n                window.Close();\n            }\n\n            // will called OnEnable(singleton instance will be set).\n            GetWindow<UniTaskTrackerWindow>(\"UniTask Tracker\").Show();\n        }\n\n        static readonly GUILayoutOption[] EmptyLayoutOption = new GUILayoutOption[0];\n\n        UniTaskTrackerTreeView treeView;\n        object splitterState;\n\n        void OnEnable()\n        {\n            window = this; // set singleton.\n            splitterState = SplitterGUILayout.CreateSplitterState(new float[] { 75f, 25f }, new int[] { 32, 32 }, null);\n            treeView = new UniTaskTrackerTreeView();\n            TaskTracker.EditorEnableState.EnableAutoReload = EditorPrefs.GetBool(TaskTracker.EnableAutoReloadKey, false);\n            TaskTracker.EditorEnableState.EnableTracking = EditorPrefs.GetBool(TaskTracker.EnableTrackingKey, false);\n            TaskTracker.EditorEnableState.EnableStackTrace = EditorPrefs.GetBool(TaskTracker.EnableStackTraceKey, false);\n        }\n\n        void OnGUI()\n        {\n            // Head\n            RenderHeadPanel();\n\n            // Splittable\n            SplitterGUILayout.BeginVerticalSplit(this.splitterState, EmptyLayoutOption);\n            {\n                // Column Tabble\n                RenderTable();\n\n                // StackTrace details\n                RenderDetailsPanel();\n            }\n            SplitterGUILayout.EndVerticalSplit();\n        }\n\n        #region HeadPanel\n\n        public static bool EnableAutoReload => TaskTracker.EditorEnableState.EnableAutoReload;\n        public static bool EnableTracking => TaskTracker.EditorEnableState.EnableTracking;\n        public static bool EnableStackTrace => TaskTracker.EditorEnableState.EnableStackTrace;\n        static readonly GUIContent EnableAutoReloadHeadContent = EditorGUIUtility.TrTextContent(\"Enable AutoReload\", \"Reload automatically.\", (Texture)null);\n        static readonly GUIContent ReloadHeadContent = EditorGUIUtility.TrTextContent(\"Reload\", \"Reload View.\", (Texture)null);\n        static readonly GUIContent GCHeadContent = EditorGUIUtility.TrTextContent(\"GC.Collect\", \"Invoke GC.Collect.\", (Texture)null);\n        static readonly GUIContent EnableTrackingHeadContent = EditorGUIUtility.TrTextContent(\"Enable Tracking\", \"Start to track async/await UniTask. Performance impact: low\", (Texture)null);\n        static readonly GUIContent EnableStackTraceHeadContent = EditorGUIUtility.TrTextContent(\"Enable StackTrace\", \"Capture StackTrace when task is started. Performance impact: high\", (Texture)null);\n\n        // [Enable Tracking] | [Enable StackTrace]\n        void RenderHeadPanel()\n        {\n            EditorGUILayout.BeginVertical(EmptyLayoutOption);\n            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, EmptyLayoutOption);\n\n            if (GUILayout.Toggle(EnableAutoReload, EnableAutoReloadHeadContent, EditorStyles.toolbarButton, EmptyLayoutOption) != EnableAutoReload)\n            {\n                TaskTracker.EditorEnableState.EnableAutoReload = !EnableAutoReload;\n            }\n\n            if (GUILayout.Toggle(EnableTracking, EnableTrackingHeadContent, EditorStyles.toolbarButton, EmptyLayoutOption) != EnableTracking)\n            {\n                TaskTracker.EditorEnableState.EnableTracking = !EnableTracking;\n            }\n\n            if (GUILayout.Toggle(EnableStackTrace, EnableStackTraceHeadContent, EditorStyles.toolbarButton, EmptyLayoutOption) != EnableStackTrace)\n            {\n                TaskTracker.EditorEnableState.EnableStackTrace = !EnableStackTrace;\n            }\n\n            GUILayout.FlexibleSpace();\n\n            if (GUILayout.Button(ReloadHeadContent, EditorStyles.toolbarButton, EmptyLayoutOption))\n            {\n                TaskTracker.CheckAndResetDirty();\n                treeView.ReloadAndSort();\n                Repaint();\n            }\n\n            if (GUILayout.Button(GCHeadContent, EditorStyles.toolbarButton, EmptyLayoutOption))\n            {\n                GC.Collect(0);\n            }\n\n            EditorGUILayout.EndHorizontal();\n            EditorGUILayout.EndVertical();\n        }\n\n        #endregion\n\n        #region TableColumn\n\n        Vector2 tableScroll;\n        GUIStyle tableListStyle;\n\n        void RenderTable()\n        {\n            if (tableListStyle == null)\n            {\n                tableListStyle = new GUIStyle(\"CN Box\");\n                tableListStyle.margin.top = 0;\n                tableListStyle.padding.left = 3;\n            }\n\n            EditorGUILayout.BeginVertical(tableListStyle, EmptyLayoutOption);\n\n            this.tableScroll = EditorGUILayout.BeginScrollView(this.tableScroll, new GUILayoutOption[]\n            {\n                GUILayout.ExpandWidth(true),\n                GUILayout.MaxWidth(2000f)\n            });\n            var controlRect = EditorGUILayout.GetControlRect(new GUILayoutOption[]\n            {\n                GUILayout.ExpandHeight(true),\n                GUILayout.ExpandWidth(true)\n            });\n\n\n            treeView?.OnGUI(controlRect);\n\n            EditorGUILayout.EndScrollView();\n            EditorGUILayout.EndVertical();\n        }\n\n        private void Update()\n        {\n            if (EnableAutoReload)\n            {\n                if (interval++ % 120 == 0)\n                {\n                    if (TaskTracker.CheckAndResetDirty())\n                    {\n                        treeView.ReloadAndSort();\n                        Repaint();\n                    }\n                }\n            }\n        }\n\n        #endregion\n\n        #region Details\n\n        static GUIStyle detailsStyle;\n        Vector2 detailsScroll;\n\n        void RenderDetailsPanel()\n        {\n            if (detailsStyle == null)\n            {\n                detailsStyle = new GUIStyle(\"CN Message\");\n                detailsStyle.wordWrap = false;\n                detailsStyle.stretchHeight = true;\n                detailsStyle.margin.right = 15;\n            }\n\n            string message = \"\";\n            var selected = treeView.state.selectedIDs;\n            if (selected.Count > 0)\n            {\n                var first = selected[0];\n                var item = treeView.CurrentBindingItems.FirstOrDefault(x => x.id == first) as UniTaskTrackerViewItem;\n                if (item != null)\n                {\n                    message = item.Position;\n                }\n            }\n\n            detailsScroll = EditorGUILayout.BeginScrollView(this.detailsScroll, EmptyLayoutOption);\n            var vector = detailsStyle.CalcSize(new GUIContent(message));\n            EditorGUILayout.SelectableLabel(message, detailsStyle, new GUILayoutOption[]\n            {\n                GUILayout.ExpandHeight(true),\n                GUILayout.ExpandWidth(true),\n                GUILayout.MinWidth(vector.x),\n                GUILayout.MinHeight(vector.y)\n            });\n            EditorGUILayout.EndScrollView();\n        }\n\n        #endregion\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Editor/UniTaskTrackerWindow.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 5bee3e3860e37484aa3b861bf76d129f\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Editor.meta",
    "content": "fileFormatVersion: 2\nguid: 275b87293edc6634f9d72387851dbbdf\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/AsyncLazy.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public class AsyncLazy\n    {\n        static Action<object> continuation = SetCompletionSource;\n\n        Func<UniTask> taskFactory;\n        UniTaskCompletionSource completionSource;\n        UniTask.Awaiter awaiter;\n\n        object syncLock;\n        bool initialized;\n\n        public AsyncLazy(Func<UniTask> taskFactory)\n        {\n            this.taskFactory = taskFactory;\n            this.completionSource = new UniTaskCompletionSource();\n            this.syncLock = new object();\n            this.initialized = false;\n        }\n\n        internal AsyncLazy(UniTask task)\n        {\n            this.taskFactory = null;\n            this.completionSource = new UniTaskCompletionSource();\n            this.syncLock = null;\n            this.initialized = true;\n\n            var awaiter = task.GetAwaiter();\n            if (awaiter.IsCompleted)\n            {\n                SetCompletionSource(awaiter);\n            }\n            else\n            {\n                this.awaiter = awaiter;\n                awaiter.SourceOnCompleted(continuation, this);\n            }\n        }\n\n        public UniTask Task\n        {\n            get\n            {\n                EnsureInitialized();\n                return completionSource.Task;\n            }\n        }\n\n\n        public UniTask.Awaiter GetAwaiter() => Task.GetAwaiter();\n\n        void EnsureInitialized()\n        {\n            if (Volatile.Read(ref initialized))\n            {\n                return;\n            }\n\n            EnsureInitializedCore();\n        }\n\n        void EnsureInitializedCore()\n        {\n            lock (syncLock)\n            {\n                if (!Volatile.Read(ref initialized))\n                {\n                    var f = Interlocked.Exchange(ref taskFactory, null);\n                    if (f != null)\n                    {\n                        var task = f();\n                        var awaiter = task.GetAwaiter();\n                        if (awaiter.IsCompleted)\n                        {\n                            SetCompletionSource(awaiter);\n                        }\n                        else\n                        {\n                            this.awaiter = awaiter;\n                            awaiter.SourceOnCompleted(continuation, this);\n                        }\n\n                        Volatile.Write(ref initialized, true);\n                    }\n                }\n            }\n        }\n\n        void SetCompletionSource(in UniTask.Awaiter awaiter)\n        {\n            try\n            {\n                awaiter.GetResult();\n                completionSource.TrySetResult();\n            }\n            catch (Exception ex)\n            {\n                completionSource.TrySetException(ex);\n            }\n        }\n\n        static void SetCompletionSource(object state)\n        {\n            var self = (AsyncLazy)state;\n            try\n            {\n                self.awaiter.GetResult();\n                self.completionSource.TrySetResult();\n            }\n            catch (Exception ex)\n            {\n                self.completionSource.TrySetException(ex);\n            }\n            finally\n            {\n                self.awaiter = default;\n            }\n        }\n    }\n\n    public class AsyncLazy<T>\n    {\n        static Action<object> continuation = SetCompletionSource;\n\n        Func<UniTask<T>> taskFactory;\n        UniTaskCompletionSource<T> completionSource;\n        UniTask<T>.Awaiter awaiter;\n\n        object syncLock;\n        bool initialized;\n\n        public AsyncLazy(Func<UniTask<T>> taskFactory)\n        {\n            this.taskFactory = taskFactory;\n            this.completionSource = new UniTaskCompletionSource<T>();\n            this.syncLock = new object();\n            this.initialized = false;\n        }\n\n        internal AsyncLazy(UniTask<T> task)\n        {\n            this.taskFactory = null;\n            this.completionSource = new UniTaskCompletionSource<T>();\n            this.syncLock = null;\n            this.initialized = true;\n\n            var awaiter = task.GetAwaiter();\n            if (awaiter.IsCompleted)\n            {\n                SetCompletionSource(awaiter);\n            }\n            else\n            {\n                this.awaiter = awaiter;\n                awaiter.SourceOnCompleted(continuation, this);\n            }\n        }\n\n        public UniTask<T> Task\n        {\n            get\n            {\n                EnsureInitialized();\n                return completionSource.Task;\n            }\n        }\n\n\n        public UniTask<T>.Awaiter GetAwaiter() => Task.GetAwaiter();\n\n        void EnsureInitialized()\n        {\n            if (Volatile.Read(ref initialized))\n            {\n                return;\n            }\n\n            EnsureInitializedCore();\n        }\n\n        void EnsureInitializedCore()\n        {\n            lock (syncLock)\n            {\n                if (!Volatile.Read(ref initialized))\n                {\n                    var f = Interlocked.Exchange(ref taskFactory, null);\n                    if (f != null)\n                    {\n                        var task = f();\n                        var awaiter = task.GetAwaiter();\n                        if (awaiter.IsCompleted)\n                        {\n                            SetCompletionSource(awaiter);\n                        }\n                        else\n                        {\n                            this.awaiter = awaiter;\n                            awaiter.SourceOnCompleted(continuation, this);\n                        }\n\n                        Volatile.Write(ref initialized, true);\n                    }\n                }\n            }\n        }\n\n        void SetCompletionSource(in UniTask<T>.Awaiter awaiter)\n        {\n            try\n            {\n                var result = awaiter.GetResult();\n                completionSource.TrySetResult(result);\n            }\n            catch (Exception ex)\n            {\n                completionSource.TrySetException(ex);\n            }\n        }\n\n        static void SetCompletionSource(object state)\n        {\n            var self = (AsyncLazy<T>)state;\n            try\n            {\n                var result = self.awaiter.GetResult();\n                self.completionSource.TrySetResult(result);\n            }\n            catch (Exception ex)\n            {\n                self.completionSource.TrySetException(ex);\n            }\n            finally\n            {\n                self.awaiter = default;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/AsyncLazy.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 01d1404ca421466419a7db7340ff5e77\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/AsyncReactiveProperty.cs",
    "content": "﻿using System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public interface IReadOnlyAsyncReactiveProperty<T> : IUniTaskAsyncEnumerable<T>\n    {\n        T Value { get; }\n        IUniTaskAsyncEnumerable<T> WithoutCurrent();\n        UniTask<T> WaitAsync(CancellationToken cancellationToken = default);\n    }\n\n    public interface IAsyncReactiveProperty<T> : IReadOnlyAsyncReactiveProperty<T>\n    {\n        new T Value { get; set; }\n    }\n\n    [Serializable]\n    public class AsyncReactiveProperty<T> : IAsyncReactiveProperty<T>, IDisposable\n    {\n        TriggerEvent<T> triggerEvent;\n\n#if UNITY_2018_3_OR_NEWER\n        [UnityEngine.SerializeField]\n#endif\n        T latestValue;\n\n        public T Value\n        {\n            get\n            {\n                return latestValue;\n            }\n            set\n            {\n                this.latestValue = value;\n                triggerEvent.SetResult(value);\n            }\n        }\n\n        public AsyncReactiveProperty(T value)\n        {\n            this.latestValue = value;\n            this.triggerEvent = default;\n        }\n\n        public IUniTaskAsyncEnumerable<T> WithoutCurrent()\n        {\n            return new WithoutCurrentEnumerable(this);\n        }\n\n        public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken)\n        {\n            return new Enumerator(this, cancellationToken, true);\n        }\n\n        public void Dispose()\n        {\n            triggerEvent.SetCompleted();\n        }\n\n        public static implicit operator T(AsyncReactiveProperty<T> value)\n        {\n            return value.Value;\n        }\n\n        public override string ToString()\n        {\n            if (isValueType) return latestValue.ToString();\n            return latestValue?.ToString();\n        }\n\n        public UniTask<T> WaitAsync(CancellationToken cancellationToken = default)\n        {\n            return new UniTask<T>(WaitAsyncSource.Create(this, cancellationToken, out var token), token);\n        }\n\n        static bool isValueType;\n\n        static AsyncReactiveProperty()\n        {\n            isValueType = typeof(T).IsValueType;\n        }\n\n        sealed class WaitAsyncSource : IUniTaskSource<T>, ITriggerHandler<T>, ITaskPoolNode<WaitAsyncSource>\n        {\n            static Action<object> cancellationCallback = CancellationCallback;\n\n            static TaskPool<WaitAsyncSource> pool;\n            WaitAsyncSource nextNode;\n            ref WaitAsyncSource ITaskPoolNode<WaitAsyncSource>.NextNode => ref nextNode;\n\n            static WaitAsyncSource()\n            {\n                TaskPool.RegisterSizeGetter(typeof(WaitAsyncSource), () => pool.Size);\n            }\n\n            AsyncReactiveProperty<T> parent;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            UniTaskCompletionSourceCore<T> core;\n\n            WaitAsyncSource()\n            {\n            }\n\n            public static IUniTaskSource<T> Create(AsyncReactiveProperty<T> parent, CancellationToken cancellationToken, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource<T>.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new WaitAsyncSource();\n                }\n\n                result.parent = parent;\n                result.cancellationToken = cancellationToken;\n\n                if (cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallback, result);\n                }\n\n                result.parent.triggerEvent.Add(result);\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                cancellationTokenRegistration.Dispose();\n                cancellationTokenRegistration = default;\n                parent.triggerEvent.Remove(this);\n                parent = null;\n                cancellationToken = default;\n                return pool.TryPush(this);\n            }\n\n            static void CancellationCallback(object state)\n            {\n                var self = (WaitAsyncSource)state;\n                self.OnCanceled(self.cancellationToken);\n            }\n\n            // IUniTaskSource\n\n            public T GetResult(short token)\n            {\n                try\n                {\n                    return core.GetResult(token);\n                }\n                finally\n                {\n                    TryReturn();\n                }\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            // ITriggerHandler\n\n            ITriggerHandler<T> ITriggerHandler<T>.Prev { get; set; }\n            ITriggerHandler<T> ITriggerHandler<T>.Next { get; set; }\n\n            public void OnCanceled(CancellationToken cancellationToken)\n            {\n                core.TrySetCanceled(cancellationToken);\n            }\n\n            public void OnCompleted()\n            {\n                // Complete as Cancel.\n                core.TrySetCanceled(CancellationToken.None);\n            }\n\n            public void OnError(Exception ex)\n            {\n                core.TrySetException(ex);\n            }\n\n            public void OnNext(T value)\n            {\n                core.TrySetResult(value);\n            }\n        }\n\n        sealed class WithoutCurrentEnumerable : IUniTaskAsyncEnumerable<T>\n        {\n            readonly AsyncReactiveProperty<T> parent;\n\n            public WithoutCurrentEnumerable(AsyncReactiveProperty<T> parent)\n            {\n                this.parent = parent;\n            }\n\n            public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n            {\n                return new Enumerator(parent, cancellationToken, false);\n            }\n        }\n\n        sealed class Enumerator : MoveNextSource, IUniTaskAsyncEnumerator<T>, ITriggerHandler<T>\n        {\n            static Action<object> cancellationCallback = CancellationCallback;\n\n            readonly AsyncReactiveProperty<T> parent;\n            readonly CancellationToken cancellationToken;\n            readonly CancellationTokenRegistration cancellationTokenRegistration;\n            T value;\n            bool isDisposed;\n            bool firstCall;\n\n            public Enumerator(AsyncReactiveProperty<T> parent, CancellationToken cancellationToken, bool publishCurrentValue)\n            {\n                this.parent = parent;\n                this.cancellationToken = cancellationToken;\n                this.firstCall = publishCurrentValue;\n\n                parent.triggerEvent.Add(this);\n                TaskTracker.TrackActiveTask(this, 3);\n\n                if (cancellationToken.CanBeCanceled)\n                {\n                    cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallback, this);\n                }\n            }\n\n            public T Current => value;\n\n            ITriggerHandler<T> ITriggerHandler<T>.Prev { get; set; }\n            ITriggerHandler<T> ITriggerHandler<T>.Next { get; set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                // raise latest value on first call.\n                if (firstCall)\n                {\n                    firstCall = false;\n                    value = parent.Value;\n                    return CompletedTasks.True;\n                }\n\n                completionSource.Reset();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            public UniTask DisposeAsync()\n            {\n                if (!isDisposed)\n                {\n                    isDisposed = true;\n                    TaskTracker.RemoveTracking(this);\n                    completionSource.TrySetCanceled(cancellationToken);\n                    parent.triggerEvent.Remove(this);\n                }\n                return default;\n            }\n\n            public void OnNext(T value)\n            {\n                this.value = value;\n                completionSource.TrySetResult(true);\n            }\n\n            public void OnCanceled(CancellationToken cancellationToken)\n            {\n                DisposeAsync().Forget();\n            }\n\n            public void OnCompleted()\n            {\n                completionSource.TrySetResult(false);\n            }\n\n            public void OnError(Exception ex)\n            {\n                completionSource.TrySetException(ex);\n            }\n\n            static void CancellationCallback(object state)\n            {\n                var self = (Enumerator)state;\n                self.DisposeAsync().Forget();\n            }\n        }\n    }\n\n    public class ReadOnlyAsyncReactiveProperty<T> : IReadOnlyAsyncReactiveProperty<T>, IDisposable\n    {\n        TriggerEvent<T> triggerEvent;\n\n        T latestValue;\n        IUniTaskAsyncEnumerator<T> enumerator;\n\n        public T Value\n        {\n            get\n            {\n                return latestValue;\n            }\n        }\n\n        public ReadOnlyAsyncReactiveProperty(T initialValue, IUniTaskAsyncEnumerable<T> source, CancellationToken cancellationToken)\n        {\n            latestValue = initialValue;\n            ConsumeEnumerator(source, cancellationToken).Forget();\n        }\n\n        public ReadOnlyAsyncReactiveProperty(IUniTaskAsyncEnumerable<T> source, CancellationToken cancellationToken)\n        {\n            ConsumeEnumerator(source, cancellationToken).Forget();\n        }\n\n        async UniTaskVoid ConsumeEnumerator(IUniTaskAsyncEnumerable<T> source, CancellationToken cancellationToken)\n        {\n            enumerator = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await enumerator.MoveNextAsync())\n                {\n                    var value = enumerator.Current;\n                    this.latestValue = value;\n                    triggerEvent.SetResult(value);\n                }\n            }\n            finally\n            {\n                await enumerator.DisposeAsync();\n                enumerator = null;\n            }\n        }\n\n        public IUniTaskAsyncEnumerable<T> WithoutCurrent()\n        {\n            return new WithoutCurrentEnumerable(this);\n        }\n\n        public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken)\n        {\n            return new Enumerator(this, cancellationToken, true);\n        }\n\n        public void Dispose()\n        {\n            if (enumerator != null)\n            {\n                enumerator.DisposeAsync().Forget();\n            }\n\n            triggerEvent.SetCompleted();\n        }\n\n        public static implicit operator T(ReadOnlyAsyncReactiveProperty<T> value)\n        {\n            return value.Value;\n        }\n\n        public override string ToString()\n        {\n            if (isValueType) return latestValue.ToString();\n            return latestValue?.ToString();\n        }\n\n        public UniTask<T> WaitAsync(CancellationToken cancellationToken = default)\n        {\n            return new UniTask<T>(WaitAsyncSource.Create(this, cancellationToken, out var token), token);\n        }\n\n        static bool isValueType;\n\n        static ReadOnlyAsyncReactiveProperty()\n        {\n            isValueType = typeof(T).IsValueType;\n        }\n\n        sealed class WaitAsyncSource : IUniTaskSource<T>, ITriggerHandler<T>, ITaskPoolNode<WaitAsyncSource>\n        {\n            static Action<object> cancellationCallback = CancellationCallback;\n\n            static TaskPool<WaitAsyncSource> pool;\n            WaitAsyncSource nextNode;\n            ref WaitAsyncSource ITaskPoolNode<WaitAsyncSource>.NextNode => ref nextNode;\n\n            static WaitAsyncSource()\n            {\n                TaskPool.RegisterSizeGetter(typeof(WaitAsyncSource), () => pool.Size);\n            }\n\n            ReadOnlyAsyncReactiveProperty<T> parent;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            UniTaskCompletionSourceCore<T> core;\n\n            WaitAsyncSource()\n            {\n            }\n\n            public static IUniTaskSource<T> Create(ReadOnlyAsyncReactiveProperty<T> parent, CancellationToken cancellationToken, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource<T>.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new WaitAsyncSource();\n                }\n\n                result.parent = parent;\n                result.cancellationToken = cancellationToken;\n\n                if (cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallback, result);\n                }\n\n                result.parent.triggerEvent.Add(result);\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                cancellationTokenRegistration.Dispose();\n                cancellationTokenRegistration = default;\n                parent.triggerEvent.Remove(this);\n                parent = null;\n                cancellationToken = default;\n                return pool.TryPush(this);\n            }\n\n            static void CancellationCallback(object state)\n            {\n                var self = (WaitAsyncSource)state;\n                self.OnCanceled(self.cancellationToken);\n            }\n\n            // IUniTaskSource\n\n            public T GetResult(short token)\n            {\n                try\n                {\n                    return core.GetResult(token);\n                }\n                finally\n                {\n                    TryReturn();\n                }\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            // ITriggerHandler\n\n            ITriggerHandler<T> ITriggerHandler<T>.Prev { get; set; }\n            ITriggerHandler<T> ITriggerHandler<T>.Next { get; set; }\n\n            public void OnCanceled(CancellationToken cancellationToken)\n            {\n                core.TrySetCanceled(cancellationToken);\n            }\n\n            public void OnCompleted()\n            {\n                // Complete as Cancel.\n                core.TrySetCanceled(CancellationToken.None);\n            }\n\n            public void OnError(Exception ex)\n            {\n                core.TrySetException(ex);\n            }\n\n            public void OnNext(T value)\n            {\n                core.TrySetResult(value);\n            }\n        }\n\n        sealed class WithoutCurrentEnumerable : IUniTaskAsyncEnumerable<T>\n        {\n            readonly ReadOnlyAsyncReactiveProperty<T> parent;\n\n            public WithoutCurrentEnumerable(ReadOnlyAsyncReactiveProperty<T> parent)\n            {\n                this.parent = parent;\n            }\n\n            public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n            {\n                return new Enumerator(parent, cancellationToken, false);\n            }\n        }\n\n        sealed class Enumerator : MoveNextSource, IUniTaskAsyncEnumerator<T>, ITriggerHandler<T>\n        {\n            static Action<object> cancellationCallback = CancellationCallback;\n\n            readonly ReadOnlyAsyncReactiveProperty<T> parent;\n            readonly CancellationToken cancellationToken;\n            readonly CancellationTokenRegistration cancellationTokenRegistration;\n            T value;\n            bool isDisposed;\n            bool firstCall;\n\n            public Enumerator(ReadOnlyAsyncReactiveProperty<T> parent, CancellationToken cancellationToken, bool publishCurrentValue)\n            {\n                this.parent = parent;\n                this.cancellationToken = cancellationToken;\n                this.firstCall = publishCurrentValue;\n\n                parent.triggerEvent.Add(this);\n                TaskTracker.TrackActiveTask(this, 3);\n\n                if (cancellationToken.CanBeCanceled)\n                {\n                    cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallback, this);\n                }\n            }\n\n            public T Current => value;\n            ITriggerHandler<T> ITriggerHandler<T>.Prev { get; set; }\n            ITriggerHandler<T> ITriggerHandler<T>.Next { get; set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                // raise latest value on first call.\n                if (firstCall)\n                {\n                    firstCall = false;\n                    value = parent.Value;\n                    return CompletedTasks.True;\n                }\n\n                completionSource.Reset();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            public UniTask DisposeAsync()\n            {\n                if (!isDisposed)\n                {\n                    isDisposed = true;\n                    TaskTracker.RemoveTracking(this);\n                    completionSource.TrySetCanceled(cancellationToken);\n                    parent.triggerEvent.Remove(this);\n                }\n                return default;\n            }\n\n            public void OnNext(T value)\n            {\n                this.value = value;\n                completionSource.TrySetResult(true);\n            }\n\n            public void OnCanceled(CancellationToken cancellationToken)\n            {\n                DisposeAsync().Forget();\n            }\n\n            public void OnCompleted()\n            {\n                completionSource.TrySetResult(false);\n            }\n\n            public void OnError(Exception ex)\n            {\n                completionSource.TrySetException(ex);\n            }\n\n            static void CancellationCallback(object state)\n            {\n                var self = (Enumerator)state;\n                self.DisposeAsync().Forget();\n            }\n        }\n    }\n\n    public static class StateExtensions\n    {\n        public static ReadOnlyAsyncReactiveProperty<T> ToReadOnlyAsyncReactiveProperty<T>(this IUniTaskAsyncEnumerable<T> source, CancellationToken cancellationToken)\n        {\n            return new ReadOnlyAsyncReactiveProperty<T>(source, cancellationToken);\n        }\n\n        public static ReadOnlyAsyncReactiveProperty<T> ToReadOnlyAsyncReactiveProperty<T>(this IUniTaskAsyncEnumerable<T> source, T initialValue, CancellationToken cancellationToken)\n        {\n            return new ReadOnlyAsyncReactiveProperty<T>(initialValue, source, cancellationToken);\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/AsyncReactiveProperty.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 8ef320b87f537ee4fb2282e765dc6166\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/AsyncUnit.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or \n\nusing System;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public readonly struct AsyncUnit : IEquatable<AsyncUnit>\n    {\n        public static readonly AsyncUnit Default = new AsyncUnit();\n\n        public override int GetHashCode()\n        {\n            return 0;\n        }\n\n        public bool Equals(AsyncUnit other)\n        {\n            return true;\n        }\n\n        public override string ToString()\n        {\n            return \"()\";\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/AsyncUnit.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 4f95ac245430d304bb5128d13b6becc8\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenEqualityComparer.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public class CancellationTokenEqualityComparer : IEqualityComparer<CancellationToken>\n    {\n        public static readonly IEqualityComparer<CancellationToken> Default = new CancellationTokenEqualityComparer();\n\n        public bool Equals(CancellationToken x, CancellationToken y)\n        {\n            return x.Equals(y);\n        }\n\n        public int GetHashCode(CancellationToken obj)\n        {\n            return obj.GetHashCode();\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenEqualityComparer.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 7d739f510b125b74fa7290ac4335e46e\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenExtensions.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static class CancellationTokenExtensions\n    {\n        static readonly Action<object> cancellationTokenCallback = Callback;\n        static readonly Action<object> disposeCallback = DisposeCallback;\n\n        public static CancellationToken ToCancellationToken(this UniTask task)\n        {\n            var cts = new CancellationTokenSource();\n            ToCancellationTokenCore(task, cts).Forget();\n            return cts.Token;\n        }\n\n        public static CancellationToken ToCancellationToken(this UniTask task, CancellationToken linkToken)\n        {\n            if (linkToken.IsCancellationRequested)\n            {\n                return linkToken;\n            }\n\n            if (!linkToken.CanBeCanceled)\n            {\n                return ToCancellationToken(task);\n            }\n\n            var cts = CancellationTokenSource.CreateLinkedTokenSource(linkToken);\n            ToCancellationTokenCore(task, cts).Forget();\n\n            return cts.Token;\n        }\n\n        public static CancellationToken ToCancellationToken<T>(this UniTask<T> task)\n        {\n            return ToCancellationToken(task.AsUniTask());\n        }\n\n        public static CancellationToken ToCancellationToken<T>(this UniTask<T> task, CancellationToken linkToken)\n        {\n            return ToCancellationToken(task.AsUniTask(), linkToken);\n        }\n\n        static async UniTaskVoid ToCancellationTokenCore(UniTask task, CancellationTokenSource cts)\n        {\n            try\n            {\n                await task;\n            }\n            catch (Exception ex)\n            {\n                UniTaskScheduler.PublishUnobservedTaskException(ex);\n            }\n            cts.Cancel();\n            cts.Dispose();\n        }\n\n        public static (UniTask, CancellationTokenRegistration) ToUniTask(this CancellationToken cancellationToken)\n        {\n            if (cancellationToken.IsCancellationRequested)\n            {\n                return (UniTask.FromCanceled(cancellationToken), default(CancellationTokenRegistration));\n            }\n\n            var promise = new UniTaskCompletionSource();\n            return (promise.Task, cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationTokenCallback, promise));\n        }\n\n        static void Callback(object state)\n        {\n            var promise = (UniTaskCompletionSource)state;\n            promise.TrySetResult();\n        }\n\n        public static CancellationTokenAwaitable WaitUntilCanceled(this CancellationToken cancellationToken)\n        {\n            return new CancellationTokenAwaitable(cancellationToken);\n        }\n\n        public static CancellationTokenRegistration RegisterWithoutCaptureExecutionContext(this CancellationToken cancellationToken, Action callback)\n        {\n            var restoreFlow = false;\n            if (!ExecutionContext.IsFlowSuppressed())\n            {\n                ExecutionContext.SuppressFlow();\n                restoreFlow = true;\n            }\n\n            try\n            {\n                return cancellationToken.Register(callback, false);\n            }\n            finally\n            {\n                if (restoreFlow)\n                {\n                    ExecutionContext.RestoreFlow();\n                }\n            }\n        }\n\n        public static CancellationTokenRegistration RegisterWithoutCaptureExecutionContext(this CancellationToken cancellationToken, Action<object> callback, object state)\n        {\n            var restoreFlow = false;\n            if (!ExecutionContext.IsFlowSuppressed())\n            {\n                ExecutionContext.SuppressFlow();\n                restoreFlow = true;\n            }\n\n            try\n            {\n                return cancellationToken.Register(callback, state, false);\n            }\n            finally\n            {\n                if (restoreFlow)\n                {\n                    ExecutionContext.RestoreFlow();\n                }\n            }\n        }\n\n        public static CancellationTokenRegistration AddTo(this IDisposable disposable, CancellationToken cancellationToken)\n        {\n            return cancellationToken.RegisterWithoutCaptureExecutionContext(disposeCallback, disposable);\n        }\n\n        static void DisposeCallback(object state)\n        {\n            var d = (IDisposable)state;\n            d.Dispose();\n        }\n    }\n\n    public struct CancellationTokenAwaitable\n    {\n        CancellationToken cancellationToken;\n\n        public CancellationTokenAwaitable(CancellationToken cancellationToken)\n        {\n            this.cancellationToken = cancellationToken;\n        }\n\n        public Awaiter GetAwaiter()\n        {\n            return new Awaiter(cancellationToken);\n        }\n\n        public struct Awaiter : ICriticalNotifyCompletion\n        {\n            CancellationToken cancellationToken;\n\n            public Awaiter(CancellationToken cancellationToken)\n            {\n                this.cancellationToken = cancellationToken;\n            }\n\n            public bool IsCompleted => !cancellationToken.CanBeCanceled || cancellationToken.IsCancellationRequested;\n\n            public void GetResult()\n            {\n            }\n\n            public void OnCompleted(Action continuation)\n            {\n                UnsafeOnCompleted(continuation);\n            }\n\n            public void UnsafeOnCompleted(Action continuation)\n            {\n                cancellationToken.RegisterWithoutCaptureExecutionContext(continuation);\n            }\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenExtensions.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 4be7209f04146bd45ac5ee775a5f7c26\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenSourceExtensions.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System.Threading;\nusing UnityEngine;\nusing Cysharp.Threading.Tasks.Triggers;\nusing System;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks\n{\n\n    public static partial class CancellationTokenSourceExtensions\n    {\n        readonly static Action<object> CancelCancellationTokenSourceStateDelegate = new Action<object>(CancelCancellationTokenSourceState);\n\n        static void CancelCancellationTokenSourceState(object state)\n        {\n            var cts = (CancellationTokenSource)state;\n            cts.Cancel();\n        }\n\n        public static IDisposable CancelAfterSlim(this CancellationTokenSource cts, int millisecondsDelay, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update)\n        {\n            return CancelAfterSlim(cts, TimeSpan.FromMilliseconds(millisecondsDelay), delayType, delayTiming);\n        }\n\n        public static IDisposable CancelAfterSlim(this CancellationTokenSource cts, TimeSpan delayTimeSpan, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update)\n        {\n            return PlayerLoopTimer.StartNew(delayTimeSpan, false, delayType, delayTiming, cts.Token, CancelCancellationTokenSourceStateDelegate, cts);\n        }\n\n        public static void RegisterRaiseCancelOnDestroy(this CancellationTokenSource cts, Component component)\n        {\n            RegisterRaiseCancelOnDestroy(cts, component.gameObject);\n        }\n\n        public static void RegisterRaiseCancelOnDestroy(this CancellationTokenSource cts, GameObject gameObject)\n        {\n            var trigger = gameObject.GetAsyncDestroyTrigger();\n            trigger.CancellationToken.RegisterWithoutCaptureExecutionContext(CancelCancellationTokenSourceStateDelegate, cts);\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenSourceExtensions.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 22d85d07f1e70ab42a7a4c25bd65e661\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Channel.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static class Channel\n    {\n        public static Channel<T> CreateSingleConsumerUnbounded<T>()\n        {\n            return new SingleConsumerUnboundedChannel<T>();\n        }\n    }\n\n    public abstract class Channel<TWrite, TRead>\n    {\n        public ChannelReader<TRead> Reader { get; protected set; }\n        public ChannelWriter<TWrite> Writer { get; protected set; }\n\n        public static implicit operator ChannelReader<TRead>(Channel<TWrite, TRead> channel) => channel.Reader;\n        public static implicit operator ChannelWriter<TWrite>(Channel<TWrite, TRead> channel) => channel.Writer;\n    }\n\n    public abstract class Channel<T> : Channel<T, T>\n    {\n    }\n\n    public abstract class ChannelReader<T>\n    {\n        public abstract bool TryRead(out T item);\n        public abstract UniTask<bool> WaitToReadAsync(CancellationToken cancellationToken = default(CancellationToken));\n\n        public abstract UniTask Completion { get; }\n\n        public virtual UniTask<T> ReadAsync(CancellationToken cancellationToken = default(CancellationToken))\n        {\n            if (this.TryRead(out var item))\n            {\n                return UniTask.FromResult(item);\n            }\n\n            return ReadAsyncCore(cancellationToken);\n        }\n\n        async UniTask<T> ReadAsyncCore(CancellationToken cancellationToken = default(CancellationToken))\n        {\n            if (await WaitToReadAsync(cancellationToken))\n            {\n                if (TryRead(out var item))\n                {\n                    return item;\n                }\n            }\n\n            throw new ChannelClosedException();\n        }\n\n        public abstract IUniTaskAsyncEnumerable<T> ReadAllAsync(CancellationToken cancellationToken = default(CancellationToken));\n    }\n\n    public abstract class ChannelWriter<T>\n    {\n        public abstract bool TryWrite(T item);\n        public abstract bool TryComplete(Exception error = null);\n\n        public void Complete(Exception error = null)\n        {\n            if (!TryComplete(error))\n            {\n                throw new ChannelClosedException();\n            }\n        }\n    }\n\n    public partial class ChannelClosedException : InvalidOperationException\n    {\n        public ChannelClosedException() :\n            base(\"Channel is already closed.\")\n        { }\n\n        public ChannelClosedException(string message) : base(message) { }\n\n        public ChannelClosedException(Exception innerException) :\n            base(\"Channel is already closed\", innerException)\n        { }\n\n        public ChannelClosedException(string message, Exception innerException) : base(message, innerException) { }\n    }\n\n    internal class SingleConsumerUnboundedChannel<T> : Channel<T>\n    {\n        readonly Queue<T> items;\n        readonly SingleConsumerUnboundedChannelReader readerSource;\n        UniTaskCompletionSource completedTaskSource;\n        UniTask completedTask;\n\n        Exception completionError;\n        bool closed;\n\n        public SingleConsumerUnboundedChannel()\n        {\n            items = new Queue<T>();\n            Writer = new SingleConsumerUnboundedChannelWriter(this);\n            readerSource = new SingleConsumerUnboundedChannelReader(this);\n            Reader = readerSource;\n        }\n\n        sealed class SingleConsumerUnboundedChannelWriter : ChannelWriter<T>\n        {\n            readonly SingleConsumerUnboundedChannel<T> parent;\n\n            public SingleConsumerUnboundedChannelWriter(SingleConsumerUnboundedChannel<T> parent)\n            {\n                this.parent = parent;\n            }\n\n            public override bool TryWrite(T item)\n            {\n                bool waiting;\n                lock (parent.items)\n                {\n                    if (parent.closed) return false;\n\n                    parent.items.Enqueue(item);\n                    waiting = parent.readerSource.isWaiting;\n                }\n\n                if (waiting)\n                {\n                    parent.readerSource.SingalContinuation();\n                }\n\n                return true;\n            }\n\n            public override bool TryComplete(Exception error = null)\n            {\n                bool waiting;\n                lock (parent.items)\n                {\n                    if (parent.closed) return false;\n                    parent.closed = true;\n                    waiting = parent.readerSource.isWaiting;\n\n                    if (parent.items.Count == 0)\n                    {\n                        if (error == null)\n                        {\n                            if (parent.completedTaskSource != null)\n                            {\n                                parent.completedTaskSource.TrySetResult();\n                            }\n                            else\n                            {\n                                parent.completedTask = UniTask.CompletedTask;\n                            }\n                        }\n                        else\n                        {\n                            if (parent.completedTaskSource != null)\n                            {\n                                parent.completedTaskSource.TrySetException(error);\n                            }\n                            else\n                            {\n                                parent.completedTask = UniTask.FromException(error);\n                            }\n                        }\n\n                        if (waiting)\n                        {\n                            parent.readerSource.SingalCompleted(error);\n                        }\n                    }\n\n                    parent.completionError = error;\n                }\n\n                return true;\n            }\n        }\n\n        sealed class SingleConsumerUnboundedChannelReader : ChannelReader<T>, IUniTaskSource<bool>\n        {\n            readonly Action<object> CancellationCallbackDelegate = CancellationCallback;\n            readonly SingleConsumerUnboundedChannel<T> parent;\n\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            UniTaskCompletionSourceCore<bool> core;\n            internal bool isWaiting;\n\n            public SingleConsumerUnboundedChannelReader(SingleConsumerUnboundedChannel<T> parent)\n            {\n                this.parent = parent;\n\n                TaskTracker.TrackActiveTask(this, 4);\n            }\n\n            public override UniTask Completion\n            {\n                get\n                {\n                    if (parent.completedTaskSource != null) return parent.completedTaskSource.Task;\n\n                    if (parent.closed)\n                    {\n                        return parent.completedTask;\n                    }\n\n                    parent.completedTaskSource = new UniTaskCompletionSource();\n                    return parent.completedTaskSource.Task;\n                }\n            }\n\n            public override bool TryRead(out T item)\n            {\n                lock (parent.items)\n                {\n                    if (parent.items.Count != 0)\n                    {\n                        item = parent.items.Dequeue();\n\n                        // complete when all value was consumed.\n                        if (parent.closed && parent.items.Count == 0)\n                        {\n                            if (parent.completionError != null)\n                            {\n                                if (parent.completedTaskSource != null)\n                                {\n                                    parent.completedTaskSource.TrySetException(parent.completionError);\n                                }\n                                else\n                                {\n                                    parent.completedTask = UniTask.FromException(parent.completionError);\n                                }\n                            }\n                            else\n                            {\n                                if (parent.completedTaskSource != null)\n                                {\n                                    parent.completedTaskSource.TrySetResult();\n                                }\n                                else\n                                {\n                                    parent.completedTask = UniTask.CompletedTask;\n                                }\n                            }\n                        }\n                    }\n                    else\n                    {\n                        item = default;\n                        return false;\n                    }\n                }\n\n                return true;\n            }\n\n            public override UniTask<bool> WaitToReadAsync(CancellationToken cancellationToken)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return UniTask.FromCanceled<bool>(cancellationToken);\n                }\n\n                lock (parent.items)\n                {\n                    if (parent.items.Count != 0)\n                    {\n                        return CompletedTasks.True;\n                    }\n\n                    if (parent.closed)\n                    {\n                        if (parent.completionError == null)\n                        {\n                            return CompletedTasks.False;\n                        }\n                        else\n                        {\n                            return UniTask.FromException<bool>(parent.completionError);\n                        }\n                    }\n\n                    cancellationTokenRegistration.Dispose();\n\n                    core.Reset();\n                    isWaiting = true;\n\n                    this.cancellationToken = cancellationToken;\n                    if (this.cancellationToken.CanBeCanceled)\n                    {\n                        cancellationTokenRegistration = this.cancellationToken.RegisterWithoutCaptureExecutionContext(CancellationCallbackDelegate, this);\n                    }\n\n                    return new UniTask<bool>(this, core.Version);\n                }\n            }\n\n            public void SingalContinuation()\n            {\n                core.TrySetResult(true);\n            }\n\n            public void SingalCancellation(CancellationToken cancellationToken)\n            {\n                TaskTracker.RemoveTracking(this);\n                core.TrySetCanceled(cancellationToken);\n            }\n\n            public void SingalCompleted(Exception error)\n            {\n                if (error != null)\n                {\n                    TaskTracker.RemoveTracking(this);\n                    core.TrySetException(error);\n                }\n                else\n                {\n                    TaskTracker.RemoveTracking(this);\n                    core.TrySetResult(false);\n                }\n            }\n\n            public override IUniTaskAsyncEnumerable<T> ReadAllAsync(CancellationToken cancellationToken = default)\n            {\n                return new ReadAllAsyncEnumerable(this, cancellationToken);\n            }\n\n            bool IUniTaskSource<bool>.GetResult(short token)\n            {\n                return core.GetResult(token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                core.GetResult(token);\n            }\n\n            UniTaskStatus IUniTaskSource.GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            void IUniTaskSource.OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            UniTaskStatus IUniTaskSource.UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            static void CancellationCallback(object state)\n            {\n                var self = (SingleConsumerUnboundedChannelReader)state;\n                self.SingalCancellation(self.cancellationToken);\n            }\n\n            sealed class ReadAllAsyncEnumerable : IUniTaskAsyncEnumerable<T>, IUniTaskAsyncEnumerator<T>\n            {\n                readonly Action<object> CancellationCallback1Delegate = CancellationCallback1;\n                readonly Action<object> CancellationCallback2Delegate = CancellationCallback2;\n\n                readonly SingleConsumerUnboundedChannelReader parent;\n                CancellationToken cancellationToken1;\n                CancellationToken cancellationToken2;\n                CancellationTokenRegistration cancellationTokenRegistration1;\n                CancellationTokenRegistration cancellationTokenRegistration2;\n\n                T current;\n                bool cacheValue;\n                bool running;\n\n                public ReadAllAsyncEnumerable(SingleConsumerUnboundedChannelReader parent, CancellationToken cancellationToken)\n                {\n                    this.parent = parent;\n                    this.cancellationToken1 = cancellationToken;\n                }\n\n                public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n                {\n                    if (running)\n                    {\n                        throw new InvalidOperationException(\"Enumerator is already running, does not allow call GetAsyncEnumerator twice.\");\n                    }\n\n                    if (this.cancellationToken1 != cancellationToken)\n                    {\n                        this.cancellationToken2 = cancellationToken;\n                    }\n\n                    if (this.cancellationToken1.CanBeCanceled)\n                    {\n                        this.cancellationTokenRegistration1 =  this.cancellationToken1.RegisterWithoutCaptureExecutionContext(CancellationCallback1Delegate, this);\n                    }\n\n                    if (this.cancellationToken2.CanBeCanceled)\n                    {\n                        this.cancellationTokenRegistration2 = this.cancellationToken2.RegisterWithoutCaptureExecutionContext(CancellationCallback2Delegate, this);\n                    }\n\n                    running = true;\n                    return this;\n                }\n\n                public T Current\n                {\n                    get\n                    {\n                        if (cacheValue)\n                        {\n                            return current;\n                        }\n                        parent.TryRead(out current);\n                        return current;\n                    }\n                }\n\n                public UniTask<bool> MoveNextAsync()\n                {\n                    cacheValue = false;\n                    return parent.WaitToReadAsync(CancellationToken.None); // ok to use None, registered in ctor.\n                }\n\n                public UniTask DisposeAsync()\n                {\n                    cancellationTokenRegistration1.Dispose();\n                    cancellationTokenRegistration2.Dispose();\n                    return default;\n                }\n\n                static void CancellationCallback1(object state)\n                {\n                    var self = (ReadAllAsyncEnumerable)state;\n                    self.parent.SingalCancellation(self.cancellationToken1);\n                }\n\n                static void CancellationCallback2(object state)\n                {\n                    var self = (ReadAllAsyncEnumerable)state;\n                    self.parent.SingalCancellation(self.cancellationToken2);\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Channel.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 5ceb3107bbdd1f14eb39091273798360\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/CompilerServices/AsyncMethodBuilderAttribute.cs",
    "content": "﻿\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n#pragma warning disable CS0436\n\nnamespace System.Runtime.CompilerServices\n{\n    internal sealed class AsyncMethodBuilderAttribute : Attribute\n    {\n        public Type BuilderType { get; }\n\n        public AsyncMethodBuilderAttribute(Type builderType)\n        {\n            BuilderType = builderType;\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/CompilerServices/AsyncMethodBuilderAttribute.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 02ce354d37b10454e8376062f7cbe57a\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/CompilerServices/AsyncUniTaskMethodBuilder.cs",
    "content": "﻿\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Diagnostics;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Security;\n\nnamespace Cysharp.Threading.Tasks.CompilerServices\n{\n    [StructLayout(LayoutKind.Auto)]\n    public struct AsyncUniTaskMethodBuilder\n    {\n        IStateMachineRunnerPromise runnerPromise;\n        Exception ex;\n\n        // 1. Static Create method.\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static AsyncUniTaskMethodBuilder Create()\n        {\n            return default;\n        }\n\n        // 2. TaskLike Task property.\n        public UniTask Task\n        {\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            get\n            {\n                if (runnerPromise != null)\n                {\n                    return runnerPromise.Task;\n                }\n                else if (ex != null)\n                {\n                    return UniTask.FromException(ex);\n                }\n                else\n                {\n                    return UniTask.CompletedTask;\n                }\n            }\n        }\n\n        // 3. SetException\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void SetException(Exception exception)\n        {\n            if (runnerPromise == null)\n            {\n                ex = exception;\n            }\n            else\n            {\n                runnerPromise.SetException(exception);\n            }\n        }\n\n        // 4. SetResult\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void SetResult()\n        {\n            if (runnerPromise != null)\n            {\n                runnerPromise.SetResult();\n            }\n        }\n\n        // 5. AwaitOnCompleted\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)\n            where TAwaiter : INotifyCompletion\n            where TStateMachine : IAsyncStateMachine\n        {\n            if (runnerPromise == null)\n            {\n                AsyncUniTask<TStateMachine>.SetStateMachine(ref stateMachine, ref runnerPromise);\n            }\n\n            awaiter.OnCompleted(runnerPromise.MoveNext);\n        }\n\n        // 6. AwaitUnsafeOnCompleted\n        [DebuggerHidden]\n        [SecuritySafeCritical]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)\n            where TAwaiter : ICriticalNotifyCompletion\n            where TStateMachine : IAsyncStateMachine\n        {\n            if (runnerPromise == null)\n            {\n                AsyncUniTask<TStateMachine>.SetStateMachine(ref stateMachine, ref runnerPromise);\n            }\n\n            awaiter.UnsafeOnCompleted(runnerPromise.MoveNext);\n        }\n\n        // 7. Start\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void Start<TStateMachine>(ref TStateMachine stateMachine)\n            where TStateMachine : IAsyncStateMachine\n        {\n            stateMachine.MoveNext();\n        }\n\n        // 8. SetStateMachine\n        [DebuggerHidden]\n        public void SetStateMachine(IAsyncStateMachine stateMachine)\n        {\n            // don't use boxed stateMachine.\n        }\n\n#if DEBUG || !UNITY_2018_3_OR_NEWER\n        // Important for IDE debugger.\n        object debuggingId;\n        private object ObjectIdForDebugger\n        {\n            get\n            {\n                if (debuggingId == null)\n                {\n                    debuggingId = new object();\n                }\n                return debuggingId;\n            }\n        }\n#endif\n    }\n\n    [StructLayout(LayoutKind.Auto)]\n    public struct AsyncUniTaskMethodBuilder<T>\n    {\n        IStateMachineRunnerPromise<T> runnerPromise;\n        Exception ex;\n        T result;\n\n        // 1. Static Create method.\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static AsyncUniTaskMethodBuilder<T> Create()\n        {\n            return default;\n        }\n\n        // 2. TaskLike Task property.\n        public UniTask<T> Task\n        {\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            get\n            {\n                if (runnerPromise != null)\n                {\n                    return runnerPromise.Task;\n                }\n                else if (ex != null)\n                {\n                    return UniTask.FromException<T>(ex);\n                }\n                else\n                {\n                    return UniTask.FromResult(result);\n                }\n            }\n        }\n\n        // 3. SetException\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void SetException(Exception exception)\n        {\n            if (runnerPromise == null)\n            {\n                ex = exception;\n            }\n            else\n            {\n                runnerPromise.SetException(exception);\n            }\n        }\n\n        // 4. SetResult\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void SetResult(T result)\n        {\n            if (runnerPromise == null)\n            {\n                this.result = result;\n            }\n            else\n            {\n                runnerPromise.SetResult(result);\n            }\n        }\n\n        // 5. AwaitOnCompleted\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)\n            where TAwaiter : INotifyCompletion\n            where TStateMachine : IAsyncStateMachine\n        {\n            if (runnerPromise == null)\n            {\n                AsyncUniTask<TStateMachine, T>.SetStateMachine(ref stateMachine, ref runnerPromise);\n            }\n\n            awaiter.OnCompleted(runnerPromise.MoveNext);\n        }\n\n        // 6. AwaitUnsafeOnCompleted\n        [DebuggerHidden]\n        [SecuritySafeCritical]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)\n            where TAwaiter : ICriticalNotifyCompletion\n            where TStateMachine : IAsyncStateMachine\n        {\n            if (runnerPromise == null)\n            {\n                AsyncUniTask<TStateMachine, T>.SetStateMachine(ref stateMachine, ref runnerPromise);\n            }\n\n            awaiter.UnsafeOnCompleted(runnerPromise.MoveNext);\n        }\n\n        // 7. Start\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void Start<TStateMachine>(ref TStateMachine stateMachine)\n            where TStateMachine : IAsyncStateMachine\n        {\n            stateMachine.MoveNext();\n        }\n\n        // 8. SetStateMachine\n        [DebuggerHidden]\n        public void SetStateMachine(IAsyncStateMachine stateMachine)\n        {\n            // don't use boxed stateMachine.\n        }\n\n#if DEBUG || !UNITY_2018_3_OR_NEWER\n        // Important for IDE debugger.\n        object debuggingId;\n        private object ObjectIdForDebugger\n        {\n            get\n            {\n                if (debuggingId == null)\n                {\n                    debuggingId = new object();\n                }\n                return debuggingId;\n            }\n        }\n#endif\n\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/CompilerServices/AsyncUniTaskMethodBuilder.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 68d72a45afdec574ebc26e7de2c38330\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/CompilerServices/AsyncUniTaskVoidMethodBuilder.cs",
    "content": "﻿\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Diagnostics;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Security;\n\nnamespace Cysharp.Threading.Tasks.CompilerServices\n{\n    [StructLayout(LayoutKind.Auto)]\n    public struct AsyncUniTaskVoidMethodBuilder\n    {\n        IStateMachineRunner runner;\n\n        // 1. Static Create method.\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static AsyncUniTaskVoidMethodBuilder Create()\n        {\n            return default;\n        }\n\n        // 2. TaskLike Task property(void)\n        public UniTaskVoid Task\n        {\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            get\n            {\n                return default;\n            }\n        }\n\n        // 3. SetException\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void SetException(Exception exception)\n        {\n            // runner is finished, return first.\n            if (runner != null)\n            {\n#if ENABLE_IL2CPP\n                // workaround for IL2CPP bug.\n                PlayerLoopHelper.AddContinuation(PlayerLoopTiming.LastPostLateUpdate, runner.ReturnAction);\n#else\n                runner.Return();\n#endif\n                runner = null;\n            }\n\n            UniTaskScheduler.PublishUnobservedTaskException(exception);\n        }\n\n        // 4. SetResult\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void SetResult()\n        {\n            // runner is finished, return.\n            if (runner != null)\n            {\n#if ENABLE_IL2CPP\n                // workaround for IL2CPP bug.\n                PlayerLoopHelper.AddContinuation(PlayerLoopTiming.LastPostLateUpdate, runner.ReturnAction);\n#else\n                runner.Return();\n#endif\n                runner = null;\n            }\n        }\n\n        // 5. AwaitOnCompleted\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)\n            where TAwaiter : INotifyCompletion\n            where TStateMachine : IAsyncStateMachine\n        {\n            if (runner == null)\n            {\n                AsyncUniTaskVoid<TStateMachine>.SetStateMachine(ref stateMachine, ref runner);\n            }\n\n            awaiter.OnCompleted(runner.MoveNext);\n        }\n\n        // 6. AwaitUnsafeOnCompleted\n        [DebuggerHidden]\n        [SecuritySafeCritical]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)\n            where TAwaiter : ICriticalNotifyCompletion\n            where TStateMachine : IAsyncStateMachine\n        {\n            if (runner == null)\n            {\n                AsyncUniTaskVoid<TStateMachine>.SetStateMachine(ref stateMachine, ref runner);\n            }\n\n            awaiter.UnsafeOnCompleted(runner.MoveNext);\n        }\n\n        // 7. Start\n        [DebuggerHidden]\n        public void Start<TStateMachine>(ref TStateMachine stateMachine)\n            where TStateMachine : IAsyncStateMachine\n        {\n            stateMachine.MoveNext();\n        }\n\n        // 8. SetStateMachine\n        [DebuggerHidden]\n        public void SetStateMachine(IAsyncStateMachine stateMachine)\n        {\n            // don't use boxed stateMachine.\n        }\n\n#if DEBUG || !UNITY_2018_3_OR_NEWER\n        // Important for IDE debugger.\n        object debuggingId;\n        private object ObjectIdForDebugger\n        {\n            get\n            {\n                if (debuggingId == null)\n                {\n                    debuggingId = new object();\n                }\n                return debuggingId;\n            }\n        }\n#endif\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/CompilerServices/AsyncUniTaskVoidMethodBuilder.cs.meta",
    "content": "fileFormatVersion: 2\nguid: e891aaac17b933a47a9d7fa3b8e1226f\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/CompilerServices/StateMachineRunner.cs",
    "content": "﻿#pragma warning disable CS1591\n\nusing Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Linq;\nusing System.Diagnostics;\nusing System.Runtime.CompilerServices;\n\nnamespace Cysharp.Threading.Tasks.CompilerServices\n{\n    // #ENABLE_IL2CPP in this file is to avoid bug of IL2CPP VM.\n    // Issue is tracked on https://issuetracker.unity3d.com/issues/il2cpp-incorrect-results-when-calling-a-method-from-outside-class-in-a-struct\n    // but currently it is labeled `Won't Fix`.\n\n    internal interface IStateMachineRunner\n    {\n        Action MoveNext { get; }\n        void Return();\n\n#if ENABLE_IL2CPP\n        Action ReturnAction { get; }\n#endif\n    }\n\n    internal interface IStateMachineRunnerPromise : IUniTaskSource\n    {\n        Action MoveNext { get; }\n        UniTask Task { get; }\n        void SetResult();\n        void SetException(Exception exception);\n    }\n\n    internal interface IStateMachineRunnerPromise<T> : IUniTaskSource<T>\n    {\n        Action MoveNext { get; }\n        UniTask<T> Task { get; }\n        void SetResult(T result);\n        void SetException(Exception exception);\n    }\n\n    internal static class StateMachineUtility\n    {\n        // Get AsyncStateMachine internal state to check IL2CPP bug\n        public static int GetState(IAsyncStateMachine stateMachine)\n        {\n            var info = stateMachine.GetType().GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)\n                .First(x => x.Name.EndsWith(\"__state\"));\n            return (int)info.GetValue(stateMachine);\n        }\n    }\n\n    internal sealed class AsyncUniTaskVoid<TStateMachine> : IStateMachineRunner, ITaskPoolNode<AsyncUniTaskVoid<TStateMachine>>, IUniTaskSource\n        where TStateMachine : IAsyncStateMachine\n    {\n        static TaskPool<AsyncUniTaskVoid<TStateMachine>> pool;\n\n#if ENABLE_IL2CPP\n        public Action ReturnAction { get; }\n#endif\n\n        TStateMachine stateMachine;\n\n        public Action MoveNext { get; }\n\n        public AsyncUniTaskVoid()\n        {\n            MoveNext = Run;\n#if ENABLE_IL2CPP\n            ReturnAction = Return;\n#endif\n        }\n\n        public static void SetStateMachine(ref TStateMachine stateMachine, ref IStateMachineRunner runnerFieldRef)\n        {\n            if (!pool.TryPop(out var result))\n            {\n                result = new AsyncUniTaskVoid<TStateMachine>();\n            }\n            TaskTracker.TrackActiveTask(result, 3);\n\n            runnerFieldRef = result; // set runner before copied.\n            result.stateMachine = stateMachine; // copy struct StateMachine(in release build).\n        }\n\n        static AsyncUniTaskVoid()\n        {\n            TaskPool.RegisterSizeGetter(typeof(AsyncUniTaskVoid<TStateMachine>), () => pool.Size);\n        }\n\n        AsyncUniTaskVoid<TStateMachine> nextNode;\n        public ref AsyncUniTaskVoid<TStateMachine> NextNode => ref nextNode;\n\n        public void Return()\n        {\n            TaskTracker.RemoveTracking(this);\n            stateMachine = default;\n            pool.TryPush(this);\n        }\n\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        void Run()\n        {\n            stateMachine.MoveNext();\n        }\n\n        // dummy interface implementation for TaskTracker.\n\n        UniTaskStatus IUniTaskSource.GetStatus(short token)\n        {\n            return UniTaskStatus.Pending;\n        }\n\n        UniTaskStatus IUniTaskSource.UnsafeGetStatus()\n        {\n            return UniTaskStatus.Pending;\n        }\n\n        void IUniTaskSource.OnCompleted(Action<object> continuation, object state, short token)\n        {\n        }\n\n        void IUniTaskSource.GetResult(short token)\n        {\n        }\n    }\n\n    internal sealed class AsyncUniTask<TStateMachine> : IStateMachineRunnerPromise, IUniTaskSource, ITaskPoolNode<AsyncUniTask<TStateMachine>>\n        where TStateMachine : IAsyncStateMachine\n    {\n        static TaskPool<AsyncUniTask<TStateMachine>> pool;\n\n#if ENABLE_IL2CPP\n        readonly Action returnDelegate;  \n#endif\n        public Action MoveNext { get; }\n\n        TStateMachine stateMachine;\n        UniTaskCompletionSourceCore<AsyncUnit> core;\n\n        AsyncUniTask()\n        {\n            MoveNext = Run;\n#if ENABLE_IL2CPP\n            returnDelegate = Return;\n#endif\n        }\n\n        public static void SetStateMachine(ref TStateMachine stateMachine, ref IStateMachineRunnerPromise runnerPromiseFieldRef)\n        {\n            if (!pool.TryPop(out var result))\n            {\n                result = new AsyncUniTask<TStateMachine>();\n            }\n            TaskTracker.TrackActiveTask(result, 3);\n\n            runnerPromiseFieldRef = result; // set runner before copied.\n            result.stateMachine = stateMachine; // copy struct StateMachine(in release build).\n        }\n\n        AsyncUniTask<TStateMachine> nextNode;\n        public ref AsyncUniTask<TStateMachine> NextNode => ref nextNode;\n\n        static AsyncUniTask()\n        {\n            TaskPool.RegisterSizeGetter(typeof(AsyncUniTask<TStateMachine>), () => pool.Size);\n        }\n\n        void Return()\n        {\n            TaskTracker.RemoveTracking(this);\n            core.Reset();\n            stateMachine = default;\n            pool.TryPush(this);\n        }\n\n        bool TryReturn()\n        {\n            TaskTracker.RemoveTracking(this);\n            core.Reset();\n            stateMachine = default;\n            return pool.TryPush(this);\n        }\n\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        void Run()\n        {\n            stateMachine.MoveNext();\n        }\n\n        public UniTask Task\n        {\n            [DebuggerHidden]\n            get\n            {\n                return new UniTask(this, core.Version);\n            }\n        }\n\n        [DebuggerHidden]\n        public void SetResult()\n        {\n            core.TrySetResult(AsyncUnit.Default);\n        }\n\n        [DebuggerHidden]\n        public void SetException(Exception exception)\n        {\n            core.TrySetException(exception);\n        }\n\n        [DebuggerHidden]\n        public void GetResult(short token)\n        {\n            try\n            {\n                core.GetResult(token);\n            }\n            finally\n            {\n#if ENABLE_IL2CPP\n                // workaround for IL2CPP bug.\n                PlayerLoopHelper.AddContinuation(PlayerLoopTiming.LastPostLateUpdate, returnDelegate);\n#else\n                TryReturn();\n#endif\n            }\n        }\n\n        [DebuggerHidden]\n        public UniTaskStatus GetStatus(short token)\n        {\n            return core.GetStatus(token);\n        }\n\n        [DebuggerHidden]\n        public UniTaskStatus UnsafeGetStatus()\n        {\n            return core.UnsafeGetStatus();\n        }\n\n        [DebuggerHidden]\n        public void OnCompleted(Action<object> continuation, object state, short token)\n        {\n            core.OnCompleted(continuation, state, token);\n        }\n    }\n\n    internal sealed class AsyncUniTask<TStateMachine, T> : IStateMachineRunnerPromise<T>, IUniTaskSource<T>, ITaskPoolNode<AsyncUniTask<TStateMachine, T>>\n        where TStateMachine : IAsyncStateMachine\n    {\n        static TaskPool<AsyncUniTask<TStateMachine, T>> pool;\n\n#if ENABLE_IL2CPP\n        readonly Action returnDelegate;  \n#endif\n\n        public Action MoveNext { get; }\n\n        TStateMachine stateMachine;\n        UniTaskCompletionSourceCore<T> core;\n\n        AsyncUniTask()\n        {\n            MoveNext = Run;\n#if ENABLE_IL2CPP\n            returnDelegate = Return;\n#endif\n        }\n\n        public static void SetStateMachine(ref TStateMachine stateMachine, ref IStateMachineRunnerPromise<T> runnerPromiseFieldRef)\n        {\n            if (!pool.TryPop(out var result))\n            {\n                result = new AsyncUniTask<TStateMachine, T>();\n            }\n            TaskTracker.TrackActiveTask(result, 3);\n\n            runnerPromiseFieldRef = result; // set runner before copied.\n            result.stateMachine = stateMachine; // copy struct StateMachine(in release build).\n        }\n\n        AsyncUniTask<TStateMachine, T> nextNode;\n        public ref AsyncUniTask<TStateMachine, T> NextNode => ref nextNode;\n\n        static AsyncUniTask()\n        {\n            TaskPool.RegisterSizeGetter(typeof(AsyncUniTask<TStateMachine, T>), () => pool.Size);\n        }\n\n        void Return()\n        {\n            TaskTracker.RemoveTracking(this);\n            core.Reset();\n            stateMachine = default;\n            pool.TryPush(this);\n        }\n\n        bool TryReturn()\n        {\n            TaskTracker.RemoveTracking(this);\n            core.Reset();\n            stateMachine = default;\n            return pool.TryPush(this);\n        }\n\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        void Run()\n        {\n            // UnityEngine.Debug.Log($\"MoveNext State:\" + StateMachineUtility.GetState(stateMachine));\n            stateMachine.MoveNext();\n        }\n\n        public UniTask<T> Task\n        {\n            [DebuggerHidden]\n            get\n            {\n                return new UniTask<T>(this, core.Version);\n            }\n        }\n\n        [DebuggerHidden]\n        public void SetResult(T result)\n        {\n            core.TrySetResult(result);\n        }\n\n        [DebuggerHidden]\n        public void SetException(Exception exception)\n        {\n            core.TrySetException(exception);\n        }\n\n        [DebuggerHidden]\n        public T GetResult(short token)\n        {\n            try\n            {\n                return core.GetResult(token);\n            }\n            finally\n            {\n#if ENABLE_IL2CPP\n                // workaround for IL2CPP bug.\n                PlayerLoopHelper.AddContinuation(PlayerLoopTiming.LastPostLateUpdate, returnDelegate);\n#else\n                TryReturn();\n#endif\n            }\n        }\n\n        [DebuggerHidden]\n        void IUniTaskSource.GetResult(short token)\n        {\n            GetResult(token);\n        }\n\n        [DebuggerHidden]\n        public UniTaskStatus GetStatus(short token)\n        {\n            return core.GetStatus(token);\n        }\n\n        [DebuggerHidden]\n        public UniTaskStatus UnsafeGetStatus()\n        {\n            return core.UnsafeGetStatus();\n        }\n\n        [DebuggerHidden]\n        public void OnCompleted(Action<object> continuation, object state, short token)\n        {\n            core.OnCompleted(continuation, state, token);\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/CompilerServices/StateMachineRunner.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 98649642833cabf44a9dc060ce4c84a1\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/CompilerServices.meta",
    "content": "fileFormatVersion: 2\nguid: 64b064347ca7a404494a996b072e2e29\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/EnumerableAsyncExtensions.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Collections.Generic;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static class EnumerableAsyncExtensions\n    {\n        // overload resolver - .Select(async x => { }) : IEnumerable<UniTask<T>>\n\n        public static IEnumerable<UniTask> Select<T>(this IEnumerable<T> source, Func<T, UniTask> selector)\n        {\n            return System.Linq.Enumerable.Select(source, selector);\n        }\n\n        public static IEnumerable<UniTask<TR>> Select<T, TR>(this IEnumerable<T> source, Func<T, UniTask<TR>> selector)\n        {\n            return System.Linq.Enumerable.Select(source, selector);\n        }\n\n        public static IEnumerable<UniTask> Select<T>(this IEnumerable<T> source, Func<T, int, UniTask> selector)\n        {\n            return System.Linq.Enumerable.Select(source, selector);\n        }\n\n        public static IEnumerable<UniTask<TR>> Select<T, TR>(this IEnumerable<T> source, Func<T, int, UniTask<TR>> selector)\n        {\n            return System.Linq.Enumerable.Select(source, selector);\n        }\n    }\n}\n\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/EnumerableAsyncExtensions.cs.meta",
    "content": "fileFormatVersion: 2\nguid: ff50260d74bd54c4b92cf99895549445\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/EnumeratorAsyncExtensions.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Collections;\nusing System.Reflection;\nusing System.Runtime.ExceptionServices;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\nusing UnityEngine;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static class EnumeratorAsyncExtensions\n    {\n        public static UniTask.Awaiter GetAwaiter<T>(this T enumerator)\n            where T : IEnumerator\n        {\n            var e = (IEnumerator)enumerator;\n            Error.ThrowArgumentNullException(e, nameof(enumerator));\n            return new UniTask(EnumeratorPromise.Create(e, PlayerLoopTiming.Update, CancellationToken.None, out var token), token).GetAwaiter();\n        }\n\n        public static UniTask WithCancellation(this IEnumerator enumerator, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(enumerator, nameof(enumerator));\n            return new UniTask(EnumeratorPromise.Create(enumerator, PlayerLoopTiming.Update, cancellationToken, out var token), token);\n        }\n\n        public static UniTask ToUniTask(this IEnumerator enumerator, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))\n        {\n            Error.ThrowArgumentNullException(enumerator, nameof(enumerator));\n            return new UniTask(EnumeratorPromise.Create(enumerator, timing, cancellationToken, out var token), token);\n        }\n\n        public static UniTask ToUniTask(this IEnumerator enumerator, MonoBehaviour coroutineRunner)\n        {\n            var source = AutoResetUniTaskCompletionSource.Create();\n            coroutineRunner.StartCoroutine(Core(enumerator, coroutineRunner, source));\n            return source.Task;\n        }\n\n        static IEnumerator Core(IEnumerator inner, MonoBehaviour coroutineRunner, AutoResetUniTaskCompletionSource source)\n        {\n            yield return coroutineRunner.StartCoroutine(inner);\n            source.TrySetResult();\n        }\n\n        sealed class EnumeratorPromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<EnumeratorPromise>\n        {\n            static TaskPool<EnumeratorPromise> pool;\n            EnumeratorPromise nextNode;\n            public ref EnumeratorPromise NextNode => ref nextNode;\n\n            static EnumeratorPromise()\n            {\n                TaskPool.RegisterSizeGetter(typeof(EnumeratorPromise), () => pool.Size);\n            }\n\n            IEnumerator innerEnumerator;\n            CancellationToken cancellationToken;\n            int initialFrame;\n            bool loopRunning;\n            bool calledGetResult;\n\n            UniTaskCompletionSourceCore<object> core;\n\n            EnumeratorPromise()\n            {\n            }\n\n            public static IUniTaskSource Create(IEnumerator innerEnumerator, PlayerLoopTiming timing, CancellationToken cancellationToken, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new EnumeratorPromise();\n                }\n                TaskTracker.TrackActiveTask(result, 3);\n\n                result.innerEnumerator = ConsumeEnumerator(innerEnumerator);\n                result.cancellationToken = cancellationToken;\n                result.loopRunning = true;\n                result.calledGetResult = false;\n                result.initialFrame = -1;\n\n                token = result.core.Version;\n\n                // run immediately.\n                if (result.MoveNext())\n                {\n                    PlayerLoopHelper.AddAction(timing, result);\n                }\n                \n                return result;\n            }\n\n            public void GetResult(short token)\n            {\n                try\n                {\n                    calledGetResult = true;\n                    core.GetResult(token);\n                }\n                finally\n                {\n                    if (!loopRunning)\n                    {\n                        TryReturn();\n                    }\n                }\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (calledGetResult)\n                {\n                    loopRunning = false;\n                    TryReturn();\n                    return false;\n                }\n\n                if (innerEnumerator == null) // invalid status, returned but loop running?\n                {\n                    return false;\n                }\n\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    loopRunning = false;\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (initialFrame == -1)\n                {\n                    // Time can not touch in threadpool.\n                    if (PlayerLoopHelper.IsMainThread)\n                    {\n                        initialFrame = Time.frameCount;\n                    }\n                }\n                else if (initialFrame == Time.frameCount)\n                {\n                    return true; // already executed in first frame, skip.\n                }\n\n                try\n                {\n                    if (innerEnumerator.MoveNext())\n                    {\n                        return true;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    loopRunning = false;\n                    core.TrySetException(ex);\n                    return false;\n                }\n\n                loopRunning = false;\n                core.TrySetResult(null);\n                return false;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                innerEnumerator = default;\n                cancellationToken = default;\n\n                return pool.TryPush(this);\n            }\n\n            // Unwrap YieldInstructions\n\n            static IEnumerator ConsumeEnumerator(IEnumerator enumerator)\n            {\n                while (enumerator.MoveNext())\n                {\n                    var current = enumerator.Current;\n                    if (current == null)\n                    {\n                        yield return null;\n                    }\n                    else if (current is CustomYieldInstruction cyi)\n                    {\n                        // WWW, WaitForSecondsRealtime\n                        while (cyi.keepWaiting)\n                        {\n                            yield return null;\n                        }\n                    }\n                    else if (current is YieldInstruction)\n                    {\n                        IEnumerator innerCoroutine = null;\n                        switch (current)\n                        {\n                            case AsyncOperation ao:\n                                innerCoroutine = UnwrapWaitAsyncOperation(ao);\n                                break;\n                            case WaitForSeconds wfs:\n                                innerCoroutine = UnwrapWaitForSeconds(wfs);\n                                break;\n                        }\n                        if (innerCoroutine != null)\n                        {\n                            while (innerCoroutine.MoveNext())\n                            {\n                                yield return null;\n                            }\n                        }\n                        else\n                        {\n                            goto WARN;\n                        }\n                    }\n                    else if (current is IEnumerator e3)\n                    {\n                        var e4 = ConsumeEnumerator(e3);\n                        while (e4.MoveNext())\n                        {\n                            yield return null;\n                        }\n                    }\n                    else\n                    {\n                        goto WARN;\n                    }\n\n                    continue;\n\n                    WARN:\n                    // WaitForEndOfFrame, WaitForFixedUpdate, others.\n                    UnityEngine.Debug.LogWarning($\"yield {current.GetType().Name} is not supported on await IEnumerator or IEnumerator.ToUniTask(), please use ToUniTask(MonoBehaviour coroutineRunner) instead.\");\n                    yield return null;\n                }\n            }\n\n            static readonly FieldInfo waitForSeconds_Seconds = typeof(WaitForSeconds).GetField(\"m_Seconds\", BindingFlags.Instance | BindingFlags.GetField | BindingFlags.NonPublic);\n\n            static IEnumerator UnwrapWaitForSeconds(WaitForSeconds waitForSeconds)\n            {\n                var second = (float)waitForSeconds_Seconds.GetValue(waitForSeconds);\n                var elapsed = 0.0f;\n                while (true)\n                {\n                    yield return null;\n\n                    elapsed += Time.deltaTime;\n                    if (elapsed >= second)\n                    {\n                        break;\n                    }\n                };\n            }\n\n            static IEnumerator UnwrapWaitAsyncOperation(AsyncOperation asyncOperation)\n            {\n                while (!asyncOperation.isDone)\n                {\n                    yield return null;\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/EnumeratorAsyncExtensions.cs.meta",
    "content": "fileFormatVersion: 2\nguid: bc661232f11e4a741af54ba1c175d5ee\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/ExceptionExtensions.cs",
    "content": "﻿\nusing System;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static class ExceptionExtensions\n    {\n        public static bool IsOperationCanceledException(this Exception exception)\n        {\n            return exception is OperationCanceledException;\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/ExceptionExtensions.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 930800098504c0d46958ce23a0495202\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/Addressables/AddressablesAsyncExtensions.cs",
    "content": "﻿// asmdef Version Defines, enabled when com.unity.addressables is imported.\n\n#if UNITASK_ADDRESSABLE_SUPPORT\n\nusing Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.ExceptionServices;\nusing System.Threading;\nusing UnityEngine.AddressableAssets;\nusing UnityEngine.ResourceManagement.AsyncOperations;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static class AddressablesAsyncExtensions\n    {\n#region AsyncOperationHandle\n\n        public static UniTask.Awaiter GetAwaiter(this AsyncOperationHandle handle)\n        {\n            return ToUniTask(handle).GetAwaiter();\n        }\n\n        public static UniTask WithCancellation(this AsyncOperationHandle handle, CancellationToken cancellationToken, bool cancelImmediately = false, bool autoReleaseWhenCanceled = false)\n        {\n            return ToUniTask(handle, cancellationToken: cancellationToken, cancelImmediately: cancelImmediately, autoReleaseWhenCanceled: autoReleaseWhenCanceled);\n        }\n\n        public static UniTask ToUniTask(this AsyncOperationHandle handle, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false, bool autoReleaseWhenCanceled = false)\n        {\n            if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled(cancellationToken);\n\n            if (!handle.IsValid())\n            {\n                // autoReleaseHandle:true handle is invalid(immediately internal handle == null) so return completed.\n                return UniTask.CompletedTask;\n            }\n\n            if (handle.IsDone)\n            {\n                if (handle.Status == AsyncOperationStatus.Failed)\n                {\n                    return UniTask.FromException(handle.OperationException);\n                }\n                return UniTask.CompletedTask;\n            }\n\n            return new UniTask(AsyncOperationHandleConfiguredSource.Create(handle, timing, progress, cancellationToken, cancelImmediately, autoReleaseWhenCanceled, out var token), token);\n        }\n\n        public struct AsyncOperationHandleAwaiter : ICriticalNotifyCompletion\n        {\n            AsyncOperationHandle handle;\n            Action<AsyncOperationHandle> continuationAction;\n\n            public AsyncOperationHandleAwaiter(AsyncOperationHandle handle)\n            {\n                this.handle = handle;\n                this.continuationAction = null;\n            }\n\n            public bool IsCompleted => handle.IsDone;\n\n            public void GetResult()\n            {\n                if (continuationAction != null)\n                {\n                    handle.Completed -= continuationAction;\n                    continuationAction = null;\n                }\n\n                if (handle.Status == AsyncOperationStatus.Failed)\n                {\n                    var e = handle.OperationException;\n                    handle = default;\n                    ExceptionDispatchInfo.Capture(e).Throw();\n                }\n\n                var result = handle.Result;\n                handle = default;\n            }\n\n            public void OnCompleted(Action continuation)\n            {\n                UnsafeOnCompleted(continuation);\n            }\n\n            public void UnsafeOnCompleted(Action continuation)\n            {\n                Error.ThrowWhenContinuationIsAlreadyRegistered(continuationAction);\n                continuationAction = PooledDelegate<AsyncOperationHandle>.Create(continuation);\n                handle.Completed += continuationAction;\n            }\n        }\n\n        sealed class AsyncOperationHandleConfiguredSource : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<AsyncOperationHandleConfiguredSource>\n        {\n            static TaskPool<AsyncOperationHandleConfiguredSource> pool;\n            AsyncOperationHandleConfiguredSource nextNode;\n            public ref AsyncOperationHandleConfiguredSource NextNode => ref nextNode;\n\n            static AsyncOperationHandleConfiguredSource()\n            {\n                TaskPool.RegisterSizeGetter(typeof(AsyncOperationHandleConfiguredSource), () => pool.Size);\n            }\n\n            readonly Action<AsyncOperationHandle> completedCallback;\n            AsyncOperationHandle handle;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            IProgress<float> progress;\n            bool autoReleaseWhenCanceled;\n            bool cancelImmediately;\n            bool completed;\n\n            UniTaskCompletionSourceCore<AsyncUnit> core;\n\n            AsyncOperationHandleConfiguredSource()\n            {\n                completedCallback = HandleCompleted;\n            }\n\n            public static IUniTaskSource Create(AsyncOperationHandle handle, PlayerLoopTiming timing, IProgress<float> progress, CancellationToken cancellationToken, bool cancelImmediately, bool autoReleaseWhenCanceled, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new AsyncOperationHandleConfiguredSource();\n                }\n\n                result.handle = handle;\n                result.progress = progress;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n                result.autoReleaseWhenCanceled = autoReleaseWhenCanceled;\n                result.completed = false;\n                \n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var promise = (AsyncOperationHandleConfiguredSource)state;\n                        if (promise.autoReleaseWhenCanceled && promise.handle.IsValid())\n                        {\n                            Addressables.Release(promise.handle);\n                        }\n                        promise.core.TrySetCanceled(promise.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                handle.Completed += result.completedCallback;\n\n                token = result.core.Version;\n                return result;\n            }\n\n            void HandleCompleted(AsyncOperationHandle _)\n            {\n                if (handle.IsValid())\n                {\n                    handle.Completed -= completedCallback;\n                }\n\n                if (completed)\n                {\n                    return;\n                }\n                \n                completed = true;\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    if (autoReleaseWhenCanceled && handle.IsValid())\n                    {\n                        Addressables.Release(handle);\n                    }\n                    core.TrySetCanceled(cancellationToken);\n                }\n                else if (handle.Status == AsyncOperationStatus.Failed)\n                {\n                    core.TrySetException(handle.OperationException);\n                }\n                else\n                {\n                    core.TrySetResult(AsyncUnit.Default);\n                }\n            }\n\n            public void GetResult(short token)\n            {\n                try\n                {\n                    core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (completed)\n                {\n                    return false;\n                }\n\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    completed = true;\n                    if (autoReleaseWhenCanceled && handle.IsValid())\n                    {\n                        Addressables.Release(handle);\n                    }\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (progress != null && handle.IsValid())\n                {\n                    progress.Report(handle.GetDownloadStatus().Percent);\n                }\n\n                return true;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                handle = default;\n                progress = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                return pool.TryPush(this);\n            }\n        }\n\n#endregion\n\n#region AsyncOperationHandle_T\n\n        public static UniTask<T>.Awaiter GetAwaiter<T>(this AsyncOperationHandle<T> handle)\n        {\n            return ToUniTask(handle).GetAwaiter();\n        }\n\n        public static UniTask<T> WithCancellation<T>(this AsyncOperationHandle<T> handle, CancellationToken cancellationToken, bool cancelImmediately = false, bool autoReleaseWhenCanceled = false)\n        {\n            return ToUniTask(handle, cancellationToken: cancellationToken, cancelImmediately: cancelImmediately, autoReleaseWhenCanceled: autoReleaseWhenCanceled);\n        }\n\n        public static UniTask<T> ToUniTask<T>(this AsyncOperationHandle<T> handle, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false, bool autoReleaseWhenCanceled = false)\n        {\n            if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<T>(cancellationToken);\n\n            if (!handle.IsValid())\n            {\n                throw new Exception(\"Attempting to use an invalid operation handle\");\n            }\n\n            if (handle.IsDone)\n            {\n                if (handle.Status == AsyncOperationStatus.Failed)\n                {\n                    return UniTask.FromException<T>(handle.OperationException);\n                }\n                return UniTask.FromResult(handle.Result);\n            }\n\n            return new UniTask<T>(AsyncOperationHandleConfiguredSource<T>.Create(handle, timing, progress, cancellationToken, cancelImmediately, autoReleaseWhenCanceled, out var token), token);\n        }\n\n        sealed class AsyncOperationHandleConfiguredSource<T> : IUniTaskSource<T>, IPlayerLoopItem, ITaskPoolNode<AsyncOperationHandleConfiguredSource<T>>\n        {\n            static TaskPool<AsyncOperationHandleConfiguredSource<T>> pool;\n            AsyncOperationHandleConfiguredSource<T> nextNode;\n            public ref AsyncOperationHandleConfiguredSource<T> NextNode => ref nextNode;\n\n            static AsyncOperationHandleConfiguredSource()\n            {\n                TaskPool.RegisterSizeGetter(typeof(AsyncOperationHandleConfiguredSource<T>), () => pool.Size);\n            }\n\n            readonly Action<AsyncOperationHandle<T>> completedCallback;\n            AsyncOperationHandle<T> handle;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            IProgress<float> progress;\n            bool autoReleaseWhenCanceled;\n            bool cancelImmediately;\n            bool completed;\n\n            UniTaskCompletionSourceCore<T> core;\n\n            AsyncOperationHandleConfiguredSource()\n            {\n                completedCallback = HandleCompleted;\n            }\n\n            public static IUniTaskSource<T> Create(AsyncOperationHandle<T> handle, PlayerLoopTiming timing, IProgress<float> progress, CancellationToken cancellationToken, bool cancelImmediately, bool autoReleaseWhenCanceled, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource<T>.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new AsyncOperationHandleConfiguredSource<T>();\n                }\n\n                result.handle = handle;\n                result.cancellationToken = cancellationToken;\n                result.completed = false;\n                result.progress = progress;\n                result.autoReleaseWhenCanceled = autoReleaseWhenCanceled;\n                result.cancelImmediately = cancelImmediately;\n                \n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var promise = (AsyncOperationHandleConfiguredSource<T>)state;\n                        if (promise.autoReleaseWhenCanceled && promise.handle.IsValid())\n                        {\n                            Addressables.Release(promise.handle);\n                        }\n                        promise.core.TrySetCanceled(promise.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                handle.Completed += result.completedCallback;\n\n                token = result.core.Version;\n                return result;\n            }\n\n            void HandleCompleted(AsyncOperationHandle<T> argHandle)\n            {\n                if (handle.IsValid())\n                {\n                    handle.Completed -= completedCallback;\n                }\n\n                if (completed)\n                {\n                    return;\n                }\n                completed = true;\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    if (autoReleaseWhenCanceled && handle.IsValid())\n                    {\n                        Addressables.Release(handle);\n                    }\n                    core.TrySetCanceled(cancellationToken);\n                }\n                else if (argHandle.Status == AsyncOperationStatus.Failed)\n                {\n                    core.TrySetException(argHandle.OperationException);\n                }\n                else\n                {\n                    core.TrySetResult(argHandle.Result);\n                }\n            }\n\n            public T GetResult(short token)\n            {\n                try\n                {\n                    return core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (completed)\n                {\n                    return false;\n                }\n\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    completed = true;\n                    if (autoReleaseWhenCanceled && handle.IsValid())\n                    {\n                        Addressables.Release(handle);\n                    }\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (progress != null && handle.IsValid())\n                {\n                    progress.Report(handle.GetDownloadStatus().Percent);\n                }\n\n                return true;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                handle = default;\n                progress = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                return pool.TryPush(this);\n            }\n        }\n\n#endregion\n    }\n}\n\n#endif"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/Addressables/AddressablesAsyncExtensions.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 3dc6441f9094f354b931dc3c79fb99e5\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/Addressables/UniTask.Addressables.asmdef",
    "content": "{\n    \"name\": \"UniTask.Addressables\",\n    \"references\": [\n        \"UniTask\",\n        \"Unity.ResourceManager\",\n        \"Unity.Addressables\"\n    ],\n    \"includePlatforms\": [],\n    \"excludePlatforms\": [],\n    \"allowUnsafeCode\": false,\n    \"overrideReferences\": false,\n    \"precompiledReferences\": [],\n    \"autoReferenced\": true,\n    \"defineConstraints\": [],\n    \"versionDefines\": [\n        {\n            \"name\": \"com.unity.addressables\",\n            \"expression\": \"\",\n            \"define\": \"UNITASK_ADDRESSABLE_SUPPORT\"\n        },\n\t{\n            \"name\": \"com.unity.addressables.cn\",\n            \"expression\": \"\",\n            \"define\": \"UNITASK_ADDRESSABLE_SUPPORT\"\n        }\n    ],\n    \"noEngineReferences\": false\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/Addressables/UniTask.Addressables.asmdef.meta",
    "content": "fileFormatVersion: 2\nguid: 593a5b492d29ac6448b1ebf7f035ef33\nAssemblyDefinitionImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/Addressables.meta",
    "content": "fileFormatVersion: 2\nguid: a5b9231662e24c942b544bd85d4b39cb\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/DOTween/DOTweenAsyncExtensions.cs",
    "content": "﻿// asmdef Version Defines, enabled when com.demigiant.dotween is imported.\n\n#if UNITASK_DOTWEEN_SUPPORT\n\nusing Cysharp.Threading.Tasks.Internal;\nusing DG.Tweening;\nusing System;\nusing System.Collections.Concurrent;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public enum TweenCancelBehaviour\n    {\n        Kill,\n        KillWithCompleteCallback,\n        Complete,\n        CompleteWithSequenceCallback,\n        CancelAwait,\n\n        // AndCancelAwait\n        KillAndCancelAwait,\n        KillWithCompleteCallbackAndCancelAwait,\n        CompleteAndCancelAwait,\n        CompleteWithSequenceCallbackAndCancelAwait\n    }\n\n    public static class DOTweenAsyncExtensions\n    {\n        enum CallbackType\n        {\n            Kill,\n            Complete,\n            Pause,\n            Play,\n            Rewind,\n            StepComplete\n        }\n\n        public static TweenAwaiter GetAwaiter(this Tween tween)\n        {\n            return new TweenAwaiter(tween);\n        }\n\n        public static UniTask WithCancellation(this Tween tween, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(tween, nameof(tween));\n\n            if (!tween.IsActive()) return UniTask.CompletedTask;\n            return new UniTask(TweenConfiguredSource.Create(tween, TweenCancelBehaviour.Kill, cancellationToken, CallbackType.Kill, out var token), token);\n        }\n\n        public static UniTask ToUniTask(this Tween tween, TweenCancelBehaviour tweenCancelBehaviour = TweenCancelBehaviour.Kill, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(tween, nameof(tween));\n\n            if (!tween.IsActive()) return UniTask.CompletedTask;\n            return new UniTask(TweenConfiguredSource.Create(tween, tweenCancelBehaviour, cancellationToken, CallbackType.Kill, out var token), token);\n        }\n\n        public static UniTask AwaitForComplete(this Tween tween, TweenCancelBehaviour tweenCancelBehaviour = TweenCancelBehaviour.Kill, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(tween, nameof(tween));\n\n            if (!tween.IsActive()) return UniTask.CompletedTask;\n            return new UniTask(TweenConfiguredSource.Create(tween, tweenCancelBehaviour, cancellationToken, CallbackType.Complete, out var token), token);\n        }\n\n        public static UniTask AwaitForPause(this Tween tween, TweenCancelBehaviour tweenCancelBehaviour = TweenCancelBehaviour.Kill, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(tween, nameof(tween));\n\n            if (!tween.IsActive()) return UniTask.CompletedTask;\n            return new UniTask(TweenConfiguredSource.Create(tween, tweenCancelBehaviour, cancellationToken, CallbackType.Pause, out var token), token);\n        }\n\n        public static UniTask AwaitForPlay(this Tween tween, TweenCancelBehaviour tweenCancelBehaviour = TweenCancelBehaviour.Kill, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(tween, nameof(tween));\n\n            if (!tween.IsActive()) return UniTask.CompletedTask;\n            return new UniTask(TweenConfiguredSource.Create(tween, tweenCancelBehaviour, cancellationToken, CallbackType.Play, out var token), token);\n        }\n\n        public static UniTask AwaitForRewind(this Tween tween, TweenCancelBehaviour tweenCancelBehaviour = TweenCancelBehaviour.Kill, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(tween, nameof(tween));\n\n            if (!tween.IsActive()) return UniTask.CompletedTask;\n            return new UniTask(TweenConfiguredSource.Create(tween, tweenCancelBehaviour, cancellationToken, CallbackType.Rewind, out var token), token);\n        }\n\n        public static UniTask AwaitForStepComplete(this Tween tween, TweenCancelBehaviour tweenCancelBehaviour = TweenCancelBehaviour.Kill, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(tween, nameof(tween));\n\n            if (!tween.IsActive()) return UniTask.CompletedTask;\n            return new UniTask(TweenConfiguredSource.Create(tween, tweenCancelBehaviour, cancellationToken, CallbackType.StepComplete, out var token), token);\n        }\n\n        public struct TweenAwaiter : ICriticalNotifyCompletion\n        {\n            readonly Tween tween;\n\n            // killed(non active) as completed.\n            public bool IsCompleted => !tween.IsActive();\n\n            public TweenAwaiter(Tween tween)\n            {\n                this.tween = tween;\n            }\n\n            public TweenAwaiter GetAwaiter()\n            {\n                return this;\n            }\n\n            public void GetResult()\n            {\n            }\n\n            public void OnCompleted(System.Action continuation)\n            {\n                UnsafeOnCompleted(continuation);\n            }\n\n            public void UnsafeOnCompleted(System.Action continuation)\n            {\n                // onKill is called after OnCompleted, both Complete(false/true) and Kill(false/true).\n                tween.onKill = PooledTweenCallback.Create(continuation);\n            }\n        }\n\n        sealed class TweenConfiguredSource : IUniTaskSource, ITaskPoolNode<TweenConfiguredSource>\n        {\n            static TaskPool<TweenConfiguredSource> pool;\n            TweenConfiguredSource nextNode;\n            public ref TweenConfiguredSource NextNode => ref nextNode;\n\n            static TweenConfiguredSource()\n            {\n                TaskPool.RegisterSizeGetter(typeof(TweenConfiguredSource), () => pool.Size);\n            }\n\n            readonly TweenCallback onCompleteCallbackDelegate;\n\n            Tween tween;\n            TweenCancelBehaviour cancelBehaviour;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationRegistration;\n            CallbackType callbackType;\n            bool canceled;\n\n            TweenCallback originalCompleteAction;\n            UniTaskCompletionSourceCore<AsyncUnit> core;\n\n            TweenConfiguredSource()\n            {\n                onCompleteCallbackDelegate = OnCompleteCallbackDelegate;\n            }\n\n            public static IUniTaskSource Create(Tween tween, TweenCancelBehaviour cancelBehaviour, CancellationToken cancellationToken, CallbackType callbackType, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    DoCancelBeforeCreate(tween, cancelBehaviour);\n                    return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new TweenConfiguredSource();\n                }\n\n                result.tween = tween;\n                result.cancelBehaviour = cancelBehaviour;\n                result.cancellationToken = cancellationToken;\n                result.callbackType = callbackType;\n                result.canceled = false;\n\n                switch (callbackType)\n                {\n                    case CallbackType.Kill:\n                        result.originalCompleteAction = tween.onKill;\n                        tween.onKill = result.onCompleteCallbackDelegate;\n                        break;\n                    case CallbackType.Complete:\n                        result.originalCompleteAction = tween.onComplete;\n                        tween.onComplete = result.onCompleteCallbackDelegate;\n                        break;\n                    case CallbackType.Pause:\n                        result.originalCompleteAction = tween.onPause;\n                        tween.onPause = result.onCompleteCallbackDelegate;\n                        break;\n                    case CallbackType.Play:\n                        result.originalCompleteAction = tween.onPlay;\n                        tween.onPlay = result.onCompleteCallbackDelegate;\n                        break;\n                    case CallbackType.Rewind:\n                        result.originalCompleteAction = tween.onRewind;\n                        tween.onRewind = result.onCompleteCallbackDelegate;\n                        break;\n                    case CallbackType.StepComplete:\n                        result.originalCompleteAction = tween.onStepComplete;\n                        tween.onStepComplete = result.onCompleteCallbackDelegate;\n                        break;\n                    default:\n                        break;\n                }\n\n                if (result.originalCompleteAction == result.onCompleteCallbackDelegate)\n                {\n                    result.originalCompleteAction = null;\n                }\n\n                if (cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(x =>\n                    {\n                        var source = (TweenConfiguredSource)x;\n                        switch (source.cancelBehaviour)\n                        {\n                            case TweenCancelBehaviour.Kill:\n                            default:\n                                source.tween.Kill(false);\n                                break;\n                            case TweenCancelBehaviour.KillAndCancelAwait:\n                                source.canceled = true;\n                                source.tween.Kill(false);\n                                break;\n                            case TweenCancelBehaviour.KillWithCompleteCallback:\n                                source.tween.Kill(true);\n                                break;\n                            case TweenCancelBehaviour.KillWithCompleteCallbackAndCancelAwait:\n                                source.canceled = true;\n                                source.tween.Kill(true);\n                                break;\n                            case TweenCancelBehaviour.Complete:\n                                source.tween.Complete(false);\n                                break;\n                            case TweenCancelBehaviour.CompleteAndCancelAwait:\n                                source.canceled = true;\n                                source.tween.Complete(false);\n                                break;\n                            case TweenCancelBehaviour.CompleteWithSequenceCallback:\n                                source.tween.Complete(true);\n                                break;\n                            case TweenCancelBehaviour.CompleteWithSequenceCallbackAndCancelAwait:\n                                source.canceled = true;\n                                source.tween.Complete(true);\n                                break;\n                            case TweenCancelBehaviour.CancelAwait:\n                                source.RestoreOriginalCallback();\n                                source.core.TrySetCanceled(source.cancellationToken);\n                                break;\n                        }\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            void OnCompleteCallbackDelegate()\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    if (this.cancelBehaviour == TweenCancelBehaviour.KillAndCancelAwait\n                        || this.cancelBehaviour == TweenCancelBehaviour.KillWithCompleteCallbackAndCancelAwait\n                        || this.cancelBehaviour == TweenCancelBehaviour.CompleteAndCancelAwait\n                        || this.cancelBehaviour == TweenCancelBehaviour.CompleteWithSequenceCallbackAndCancelAwait\n                        || this.cancelBehaviour == TweenCancelBehaviour.CancelAwait)\n                    {\n                        canceled = true;\n                    }\n                }\n                if (canceled)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                }\n                else\n                {\n                    originalCompleteAction?.Invoke();\n                    core.TrySetResult(AsyncUnit.Default);\n                }\n            }\n\n            static void DoCancelBeforeCreate(Tween tween, TweenCancelBehaviour tweenCancelBehaviour)\n            {\n\n                switch (tweenCancelBehaviour)\n                {\n                    case TweenCancelBehaviour.Kill:\n                    default:\n                        tween.Kill(false);\n                        break;\n                    case TweenCancelBehaviour.KillAndCancelAwait:\n                        tween.Kill(false);\n                        break;\n                    case TweenCancelBehaviour.KillWithCompleteCallback:\n                        tween.Kill(true);\n                        break;\n                    case TweenCancelBehaviour.KillWithCompleteCallbackAndCancelAwait:\n                        tween.Kill(true);\n                        break;\n                    case TweenCancelBehaviour.Complete:\n                        tween.Complete(false);\n                        break;\n                    case TweenCancelBehaviour.CompleteAndCancelAwait:\n                        tween.Complete(false);\n                        break;\n                    case TweenCancelBehaviour.CompleteWithSequenceCallback:\n                        tween.Complete(true);\n                        break;\n                    case TweenCancelBehaviour.CompleteWithSequenceCallbackAndCancelAwait:\n                        tween.Complete(true);\n                        break;\n                    case TweenCancelBehaviour.CancelAwait:\n                        break;\n                }\n            }\n\n            public void GetResult(short token)\n            {\n                try\n                {\n                    core.GetResult(token);\n                }\n                finally\n                {\n                    TryReturn();\n                }\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                cancellationRegistration.Dispose();\n\n                RestoreOriginalCallback();\n\n                tween = default;\n                cancellationToken = default;\n                originalCompleteAction = default;\n                return pool.TryPush(this);\n            }\n\n            void RestoreOriginalCallback()\n            {\n                switch (callbackType)\n                {\n                    case CallbackType.Kill:\n                        tween.onKill = originalCompleteAction;\n                        break;\n                    case CallbackType.Complete:\n                        tween.onComplete = originalCompleteAction;\n                        break;\n                    case CallbackType.Pause:\n                        tween.onPause = originalCompleteAction;\n                        break;\n                    case CallbackType.Play:\n                        tween.onPlay = originalCompleteAction;\n                        break;\n                    case CallbackType.Rewind:\n                        tween.onRewind = originalCompleteAction;\n                        break;\n                    case CallbackType.StepComplete:\n                        tween.onStepComplete = originalCompleteAction;\n                        break;\n                    default:\n                        break;\n                }\n            }\n        }\n    }\n\n    sealed class PooledTweenCallback\n    {\n        static readonly ConcurrentQueue<PooledTweenCallback> pool = new ConcurrentQueue<PooledTweenCallback>();\n\n        readonly TweenCallback runDelegate;\n\n        Action continuation;\n\n\n        PooledTweenCallback()\n        {\n            runDelegate = Run;\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static TweenCallback Create(Action continuation)\n        {\n            if (!pool.TryDequeue(out var item))\n            {\n                item = new PooledTweenCallback();\n            }\n\n            item.continuation = continuation;\n            return item.runDelegate;\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        void Run()\n        {\n            var call = continuation;\n            continuation = null;\n            if (call != null)\n            {\n                pool.Enqueue(this);\n                call.Invoke();\n            }\n        }\n    }\n}\n\n#endif\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/DOTween/DOTweenAsyncExtensions.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 1f448d5bc5b232e4f98d89d5d1832e8e\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/DOTween/UniTask.DOTween.asmdef",
    "content": "{\n    \"name\": \"UniTask.DOTween\",\n    \"references\": [\n        \"UniTask\",\n        \"DOTween.Modules\"\n    ],\n    \"includePlatforms\": [],\n    \"excludePlatforms\": [],\n    \"allowUnsafeCode\": false,\n    \"overrideReferences\": false,\n    \"precompiledReferences\": [],\n    \"autoReferenced\": true,\n    \"defineConstraints\": [],\n    \"versionDefines\": [\n        {\n            \"name\": \"com.demigiant.dotween\",\n            \"expression\": \"\",\n            \"define\": \"UNITASK_DOTWEEN_SUPPORT\"\n        }\n    ],\n    \"noEngineReferences\": false\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/DOTween/UniTask.DOTween.asmdef.meta",
    "content": "fileFormatVersion: 2\nguid: 029c1c1b674aaae47a6841a0b89ad80e\nAssemblyDefinitionImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/DOTween.meta",
    "content": "fileFormatVersion: 2\nguid: 25cb2f742bfeb1d48a4e65d3140b955d\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/TextMeshPro/TextMeshProAsyncExtensions.InputField.cs",
    "content": "﻿#if UNITASK_TEXTMESHPRO_SUPPORT\n\nusing System;\nusing System.Threading;\nusing TMPro;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static partial class TextMeshProAsyncExtensions\n    {\n        public static IAsyncValueChangedEventHandler<string> GetAsyncValueChangedEventHandler(this TMP_InputField inputField)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onValueChanged, inputField.GetCancellationTokenOnDestroy(), false);\n        }\n\n        public static IAsyncValueChangedEventHandler<string> GetAsyncValueChangedEventHandler(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onValueChanged, cancellationToken, false);\n        }\n\n        public static UniTask<string> OnValueChangedAsync(this TMP_InputField inputField)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onValueChanged, inputField.GetCancellationTokenOnDestroy(), true).OnInvokeAsync();\n        }\n\n        public static UniTask<string> OnValueChangedAsync(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onValueChanged, cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<string> OnValueChangedAsAsyncEnumerable(this TMP_InputField inputField)\n        {\n            return new UnityEventHandlerAsyncEnumerable<string>(inputField.onValueChanged, inputField.GetCancellationTokenOnDestroy());\n        }\n\n        public static IUniTaskAsyncEnumerable<string> OnValueChangedAsAsyncEnumerable(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable<string>(inputField.onValueChanged, cancellationToken);\n        }\n\n        public static IAsyncEndEditEventHandler<string> GetAsyncEndEditEventHandler(this TMP_InputField inputField)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onEndEdit, inputField.GetCancellationTokenOnDestroy(), false);\n        }\n\n        public static IAsyncEndEditEventHandler<string> GetAsyncEndEditEventHandler(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onEndEdit, cancellationToken, false);\n        }\n\n        public static UniTask<string> OnEndEditAsync(this TMP_InputField inputField)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onEndEdit, inputField.GetCancellationTokenOnDestroy(), true).OnInvokeAsync();\n        }\n\n        public static UniTask<string> OnEndEditAsync(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onEndEdit, cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<string> OnEndEditAsAsyncEnumerable(this TMP_InputField inputField)\n        {\n            return new UnityEventHandlerAsyncEnumerable<string>(inputField.onEndEdit, inputField.GetCancellationTokenOnDestroy());\n        }\n\n        public static IUniTaskAsyncEnumerable<string> OnEndEditAsAsyncEnumerable(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable<string>(inputField.onEndEdit, cancellationToken);\n        }\n\n        public static IAsyncEndTextSelectionEventHandler<(string, int, int)> GetAsyncEndTextSelectionEventHandler(this TMP_InputField inputField)\n        {\n            return new AsyncUnityEventHandler<(string, int, int)>(new TextSelectionEventConverter(inputField.onEndTextSelection), inputField.GetCancellationTokenOnDestroy(), false);\n        }\n\n        public static IAsyncEndTextSelectionEventHandler<(string, int, int)> GetAsyncEndTextSelectionEventHandler(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<(string, int, int)>(new TextSelectionEventConverter(inputField.onEndTextSelection), cancellationToken, false);\n        }\n\n        public static UniTask<(string, int, int)> OnEndTextSelectionAsync(this TMP_InputField inputField)\n        {\n            return new AsyncUnityEventHandler<(string, int, int)>(new TextSelectionEventConverter(inputField.onEndTextSelection), inputField.GetCancellationTokenOnDestroy(), true).OnInvokeAsync();\n        }\n\n        public static UniTask<(string, int, int)> OnEndTextSelectionAsync(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<(string, int, int)>(new TextSelectionEventConverter(inputField.onEndTextSelection), cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<(string, int, int)> OnEndTextSelectionAsAsyncEnumerable(this TMP_InputField inputField)\n        {\n            return new UnityEventHandlerAsyncEnumerable<(string, int, int)>(new TextSelectionEventConverter(inputField.onEndTextSelection), inputField.GetCancellationTokenOnDestroy());\n        }\n\n        public static IUniTaskAsyncEnumerable<(string, int, int)> OnEndTextSelectionAsAsyncEnumerable(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable<(string, int, int)>(new TextSelectionEventConverter(inputField.onEndTextSelection), cancellationToken);\n        }\n\n        public static IAsyncTextSelectionEventHandler<(string, int, int)> GetAsyncTextSelectionEventHandler(this TMP_InputField inputField)\n        {\n            return new AsyncUnityEventHandler<(string, int, int)>(new TextSelectionEventConverter(inputField.onTextSelection), inputField.GetCancellationTokenOnDestroy(), false);\n        }\n\n        public static IAsyncTextSelectionEventHandler<(string, int, int)> GetAsyncTextSelectionEventHandler(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<(string, int, int)>(new TextSelectionEventConverter(inputField.onTextSelection), cancellationToken, false);\n        }\n\n        public static UniTask<(string, int, int)> OnTextSelectionAsync(this TMP_InputField inputField)\n        {\n            return new AsyncUnityEventHandler<(string, int, int)>(new TextSelectionEventConverter(inputField.onTextSelection), inputField.GetCancellationTokenOnDestroy(), true).OnInvokeAsync();\n        }\n\n        public static UniTask<(string, int, int)> OnTextSelectionAsync(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<(string, int, int)>(new TextSelectionEventConverter(inputField.onTextSelection), cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<(string, int, int)> OnTextSelectionAsAsyncEnumerable(this TMP_InputField inputField)\n        {\n            return new UnityEventHandlerAsyncEnumerable<(string, int, int)>(new TextSelectionEventConverter(inputField.onTextSelection), inputField.GetCancellationTokenOnDestroy());\n        }\n\n        public static IUniTaskAsyncEnumerable<(string, int, int)> OnTextSelectionAsAsyncEnumerable(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable<(string, int, int)>(new TextSelectionEventConverter(inputField.onTextSelection), cancellationToken);\n        }\n\n        public static IAsyncDeselectEventHandler<string> GetAsyncDeselectEventHandler(this TMP_InputField inputField)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onDeselect, inputField.GetCancellationTokenOnDestroy(), false);\n        }\n\n        public static IAsyncDeselectEventHandler<string> GetAsyncDeselectEventHandler(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onDeselect, cancellationToken, false);\n        }\n\n        public static UniTask<string> OnDeselectAsync(this TMP_InputField inputField)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onDeselect, inputField.GetCancellationTokenOnDestroy(), true).OnInvokeAsync();\n        }\n\n        public static UniTask<string> OnDeselectAsync(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onDeselect, cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<string> OnDeselectAsAsyncEnumerable(this TMP_InputField inputField)\n        {\n            return new UnityEventHandlerAsyncEnumerable<string>(inputField.onDeselect, inputField.GetCancellationTokenOnDestroy());\n        }\n\n        public static IUniTaskAsyncEnumerable<string> OnDeselectAsAsyncEnumerable(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable<string>(inputField.onDeselect, cancellationToken);\n        }\n\n        public static IAsyncSelectEventHandler<string> GetAsyncSelectEventHandler(this TMP_InputField inputField)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onSelect, inputField.GetCancellationTokenOnDestroy(), false);\n        }\n\n        public static IAsyncSelectEventHandler<string> GetAsyncSelectEventHandler(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onSelect, cancellationToken, false);\n        }\n\n        public static UniTask<string> OnSelectAsync(this TMP_InputField inputField)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onSelect, inputField.GetCancellationTokenOnDestroy(), true).OnInvokeAsync();\n        }\n\n        public static UniTask<string> OnSelectAsync(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onSelect, cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<string> OnSelectAsAsyncEnumerable(this TMP_InputField inputField)\n        {\n            return new UnityEventHandlerAsyncEnumerable<string>(inputField.onSelect, inputField.GetCancellationTokenOnDestroy());\n        }\n\n        public static IUniTaskAsyncEnumerable<string> OnSelectAsAsyncEnumerable(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable<string>(inputField.onSelect, cancellationToken);\n        }\n\n        public static IAsyncSubmitEventHandler<string> GetAsyncSubmitEventHandler(this TMP_InputField inputField)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onSubmit, inputField.GetCancellationTokenOnDestroy(), false);\n        }\n\n        public static IAsyncSubmitEventHandler<string> GetAsyncSubmitEventHandler(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onSubmit, cancellationToken, false);\n        }\n\n        public static UniTask<string> OnSubmitAsync(this TMP_InputField inputField)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onSubmit, inputField.GetCancellationTokenOnDestroy(), true).OnInvokeAsync();\n        }\n\n        public static UniTask<string> OnSubmitAsync(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onSubmit, cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<string> OnSubmitAsAsyncEnumerable(this TMP_InputField inputField)\n        {\n            return new UnityEventHandlerAsyncEnumerable<string>(inputField.onSubmit, inputField.GetCancellationTokenOnDestroy());\n        }\n\n        public static IUniTaskAsyncEnumerable<string> OnSubmitAsAsyncEnumerable(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable<string>(inputField.onSubmit, cancellationToken);\n        }\n\n    }\n}\n\n#endif"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/TextMeshPro/TextMeshProAsyncExtensions.InputField.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 79f4f2475e0b2c44e97ed1dee760627b\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/TextMeshPro/TextMeshProAsyncExtensions.InputField.tt",
    "content": "﻿<#@ template debug=\"false\" hostspecific=\"false\" language=\"C#\" #>\n<#@ assembly name=\"System.Core\" #>\n<#@ import namespace=\"System.Linq\" #>\n<#@ import namespace=\"System.Text\" #>\n<#@ import namespace=\"System.Collections.Generic\" #>\n<#@ output extension=\".cs\" #>\n<#\n    var handlers = new (string name, string type)[] {\n        (\"ValueChanged\", \"string\"),\n        (\"EndEdit\", \"string\"),\n        (\"EndTextSelection\", \"(string, int, int)\"),\n        (\"TextSelection\", \"(string, int, int)\"),\n        (\"Deselect\", \"string\"),\n        (\"Select\", \"string\"),\n        (\"Submit\", \"string\"),\n    };\n\n    Func<string, bool> shouldConvert = x => x.EndsWith(\"TextSelection\");\n    Func<string, string> eventName = x => shouldConvert(x) ? $\"new TextSelectionEventConverter(inputField.on{x})\" : $\"inputField.on{x}\";\n#>\n#if UNITASK_TEXTMESHPRO_SUPPORT\n\nusing System;\nusing System.Threading;\nusing TMPro;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static partial class TextMeshProAsyncExtensions\n    {\n<# foreach(var (name, type) in handlers) { #>\n        public static IAsync<#= (name) #>EventHandler<<#= type #>> GetAsync<#= (name) #>EventHandler(this TMP_InputField inputField)\n        {\n            return new AsyncUnityEventHandler<<#= type #>>(<#= eventName(name) #>, inputField.GetCancellationTokenOnDestroy(), false);\n        }\n\n        public static IAsync<#= (name) #>EventHandler<<#= type #>> GetAsync<#= (name) #>EventHandler(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<<#= type #>>(<#= eventName(name) #>, cancellationToken, false);\n        }\n\n        public static UniTask<<#= type #>> On<#= (name) #>Async(this TMP_InputField inputField)\n        {\n            return new AsyncUnityEventHandler<<#= type #>>(<#= eventName(name) #>, inputField.GetCancellationTokenOnDestroy(), true).OnInvokeAsync();\n        }\n\n        public static UniTask<<#= type #>> On<#= (name) #>Async(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<<#= type #>>(<#= eventName(name) #>, cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<<#= type #>> On<#= (name) #>AsAsyncEnumerable(this TMP_InputField inputField)\n        {\n            return new UnityEventHandlerAsyncEnumerable<<#= type #>>(<#= eventName(name) #>, inputField.GetCancellationTokenOnDestroy());\n        }\n\n        public static IUniTaskAsyncEnumerable<<#= type #>> On<#= (name) #>AsAsyncEnumerable(this TMP_InputField inputField, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable<<#= type #>>(<#= eventName(name) #>, cancellationToken);\n        }\n\n<# } #>\n    }\n}\n\n#endif"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/TextMeshPro/TextMeshProAsyncExtensions.InputField.tt.meta",
    "content": "fileFormatVersion: 2\nguid: e9bb9fc551a975d44a7180e022a2debe\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/TextMeshPro/TextMeshProAsyncExtensions.cs",
    "content": "﻿#if UNITASK_TEXTMESHPRO_SUPPORT\n\nusing System;\nusing System.Threading;\nusing TMPro;\nusing UnityEngine.Events;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static partial class TextMeshProAsyncExtensions\n    {\n        // <string> -> Text\n        public static void BindTo(this IUniTaskAsyncEnumerable<string> source, TMP_Text text, bool rebindOnError = true)\n        {\n            BindToCore(source, text, text.GetCancellationTokenOnDestroy(), rebindOnError).Forget();\n        }\n\n        public static void BindTo(this IUniTaskAsyncEnumerable<string> source, TMP_Text text, CancellationToken cancellationToken, bool rebindOnError = true)\n        {\n            BindToCore(source, text, cancellationToken, rebindOnError).Forget();\n        }\n\n        static async UniTaskVoid BindToCore(IUniTaskAsyncEnumerable<string> source, TMP_Text text, CancellationToken cancellationToken, bool rebindOnError)\n        {\n            var repeat = false;\n            BIND_AGAIN:\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (true)\n                {\n                    bool moveNext;\n                    try\n                    {\n                        moveNext = await e.MoveNextAsync();\n                        repeat = false;\n                    }\n                    catch (Exception ex)\n                    {\n                        if (ex is OperationCanceledException) return;\n\n                        if (rebindOnError && !repeat)\n                        {\n                            repeat = true;\n                            goto BIND_AGAIN;\n                        }\n                        else\n                        {\n                            throw;\n                        }\n                    }\n\n                    if (!moveNext) return;\n\n                    text.text = e.Current;\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        // <T> -> Text\n\n        public static void BindTo<T>(this IUniTaskAsyncEnumerable<T> source, TMP_Text text, bool rebindOnError = true)\n        {\n            BindToCore(source, text, text.GetCancellationTokenOnDestroy(), rebindOnError).Forget();\n        }\n\n        public static void BindTo<T>(this IUniTaskAsyncEnumerable<T> source, TMP_Text text, CancellationToken cancellationToken, bool rebindOnError = true)\n        {\n            BindToCore(source, text, cancellationToken, rebindOnError).Forget();\n        }\n\n        public static void BindTo<T>(this AsyncReactiveProperty<T> source, TMP_Text text, bool rebindOnError = true)\n        {\n            BindToCore(source, text, text.GetCancellationTokenOnDestroy(), rebindOnError).Forget();\n        }\n\n        static async UniTaskVoid BindToCore<T>(IUniTaskAsyncEnumerable<T> source, TMP_Text text, CancellationToken cancellationToken, bool rebindOnError)\n        {\n            var repeat = false;\n            BIND_AGAIN:\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (true)\n                {\n                    bool moveNext;\n                    try\n                    {\n                        moveNext = await e.MoveNextAsync();\n                        repeat = false;\n                    }\n                    catch (Exception ex)\n                    {\n                        if (ex is OperationCanceledException) return;\n\n                        if (rebindOnError && !repeat)\n                        {\n                            repeat = true;\n                            goto BIND_AGAIN;\n                        }\n                        else\n                        {\n                            throw;\n                        }\n                    }\n\n                    if (!moveNext) return;\n\n                    text.text = e.Current.ToString();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n    }\n}\n\n#endif"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/TextMeshPro/TextMeshProAsyncExtensions.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b6ba480edafb67d4e91bb10feb64fae5\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/TextMeshPro/UniTask.TextMeshPro.asmdef",
    "content": "{\n    \"name\": \"UniTask.TextMeshPro\",\n    \"references\": [\n        \"UniTask\",\n        \"Unity.TextMeshPro\"\n    ],\n    \"includePlatforms\": [],\n    \"excludePlatforms\": [],\n    \"allowUnsafeCode\": false,\n    \"overrideReferences\": false,\n    \"precompiledReferences\": [],\n    \"autoReferenced\": true,\n    \"defineConstraints\": [],\n    \"versionDefines\": [\n        {\n            \"name\": \"com.unity.textmeshpro\",\n            \"expression\": \"\",\n            \"define\": \"UNITASK_TEXTMESHPRO_SUPPORT\"\n        },\n        {\n            \"name\": \"com.unity.ugui\",\n            \"expression\": \"2.0.0\",\n            \"define\": \"UNITASK_TEXTMESHPRO_SUPPORT\"\n        }\n    ],\n    \"noEngineReferences\": false\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/TextMeshPro/UniTask.TextMeshPro.asmdef.meta",
    "content": "fileFormatVersion: 2\nguid: dc47925d1a5fa2946bdd37746b2b5d48\nAssemblyDefinitionImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External/TextMeshPro.meta",
    "content": "fileFormatVersion: 2\nguid: f89da606bde9a4e4e94ae1189a029887\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/External.meta",
    "content": "fileFormatVersion: 2\nguid: a3e874acee8398745b1dc3eddac09eaa\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/IUniTaskAsyncEnumerable.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Runtime.InteropServices;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public interface IUniTaskAsyncEnumerable<out T>\n    {\n        IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default);\n    }\n\n    public interface IUniTaskAsyncEnumerator<out T> : IUniTaskAsyncDisposable\n    {\n        T Current { get; }\n        UniTask<bool> MoveNextAsync();\n    }\n\n    public interface IUniTaskAsyncDisposable\n    {\n        UniTask DisposeAsync();\n    }\n\n    public interface IUniTaskOrderedAsyncEnumerable<TElement> : IUniTaskAsyncEnumerable<TElement>\n    {\n        IUniTaskOrderedAsyncEnumerable<TElement> CreateOrderedEnumerable<TKey>(Func<TElement, TKey> keySelector, IComparer<TKey> comparer, bool descending);\n        IUniTaskOrderedAsyncEnumerable<TElement> CreateOrderedEnumerable<TKey>(Func<TElement, UniTask<TKey>> keySelector, IComparer<TKey> comparer, bool descending);\n        IUniTaskOrderedAsyncEnumerable<TElement> CreateOrderedEnumerable<TKey>(Func<TElement, CancellationToken, UniTask<TKey>> keySelector, IComparer<TKey> comparer, bool descending);\n    }\n\n    public interface IConnectableUniTaskAsyncEnumerable<out T> : IUniTaskAsyncEnumerable<T>\n    {\n        IDisposable Connect();\n    }\n\n    // don't use AsyncGrouping.\n    //public interface IUniTaskAsyncGrouping<out TKey, out TElement> : IUniTaskAsyncEnumerable<TElement>\n    //{\n    //    TKey Key { get; }\n    //}\n\n    public static class UniTaskAsyncEnumerableExtensions\n    {\n        public static UniTaskCancelableAsyncEnumerable<T> WithCancellation<T>(this IUniTaskAsyncEnumerable<T> source, CancellationToken cancellationToken)\n        {\n            return new UniTaskCancelableAsyncEnumerable<T>(source, cancellationToken);\n        }\n    }\n\n    [StructLayout(LayoutKind.Auto)]\n    public readonly struct UniTaskCancelableAsyncEnumerable<T>\n    {\n        private readonly IUniTaskAsyncEnumerable<T> enumerable;\n        private readonly CancellationToken cancellationToken;\n\n        internal UniTaskCancelableAsyncEnumerable(IUniTaskAsyncEnumerable<T> enumerable, CancellationToken cancellationToken)\n        {\n            this.enumerable = enumerable;\n            this.cancellationToken = cancellationToken;\n        }\n\n        public Enumerator GetAsyncEnumerator()\n        {\n            return new Enumerator(enumerable.GetAsyncEnumerator(cancellationToken));\n        }\n\n        [StructLayout(LayoutKind.Auto)]\n        public readonly struct Enumerator\n        {\n            private readonly IUniTaskAsyncEnumerator<T> enumerator;\n\n            internal Enumerator(IUniTaskAsyncEnumerator<T> enumerator)\n            {\n                this.enumerator = enumerator;\n            }\n\n            public T Current => enumerator.Current;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                return enumerator.MoveNextAsync();\n            }\n\n\n            public UniTask DisposeAsync()\n            {\n                return enumerator.DisposeAsync();\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/IUniTaskAsyncEnumerable.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b20cf9f02ac585948a4372fa4ee06504\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/IUniTaskSource.cs",
    "content": "﻿#pragma warning disable CS1591\n#pragma warning disable CS0108\n\n#if (UNITASK_NETCORE && !NETSTANDARD2_0) || UNITY_2022_3_OR_NEWER\n#define SUPPORT_VALUETASK\n#endif\n\nusing System;\nusing System.Runtime.CompilerServices;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public enum UniTaskStatus\n    {\n        /// <summary>The operation has not yet completed.</summary>\n        Pending = 0,\n        /// <summary>The operation completed successfully.</summary>\n        Succeeded = 1,\n        /// <summary>The operation completed with an error.</summary>\n        Faulted = 2,\n        /// <summary>The operation completed due to cancellation.</summary>\n        Canceled = 3\n    }\n\n    // similar as IValueTaskSource\n    public interface IUniTaskSource\n#if SUPPORT_VALUETASK\n        : System.Threading.Tasks.Sources.IValueTaskSource\n#endif\n    {\n        UniTaskStatus GetStatus(short token);\n        void OnCompleted(Action<object> continuation, object state, short token);\n        void GetResult(short token);\n\n        UniTaskStatus UnsafeGetStatus(); // only for debug use.\n\n#if SUPPORT_VALUETASK\n\n        System.Threading.Tasks.Sources.ValueTaskSourceStatus System.Threading.Tasks.Sources.IValueTaskSource.GetStatus(short token)\n        {\n            return (System.Threading.Tasks.Sources.ValueTaskSourceStatus)(int)((IUniTaskSource)this).GetStatus(token);\n        }\n\n        void System.Threading.Tasks.Sources.IValueTaskSource.GetResult(short token)\n        {\n            ((IUniTaskSource)this).GetResult(token);\n        }\n\n        void System.Threading.Tasks.Sources.IValueTaskSource.OnCompleted(Action<object> continuation, object state, short token, System.Threading.Tasks.Sources.ValueTaskSourceOnCompletedFlags flags)\n        {\n            // ignore flags, always none.\n            ((IUniTaskSource)this).OnCompleted(continuation, state, token);\n        }\n\n#endif\n    }\n\n    public interface IUniTaskSource<out T> : IUniTaskSource\n#if SUPPORT_VALUETASK\n        , System.Threading.Tasks.Sources.IValueTaskSource<T>\n#endif\n    {\n        new T GetResult(short token);\n\n#if SUPPORT_VALUETASK\n\n        new public UniTaskStatus GetStatus(short token)\n        {\n            return ((IUniTaskSource)this).GetStatus(token);\n        }\n\n        new public void OnCompleted(Action<object> continuation, object state, short token)\n        {\n            ((IUniTaskSource)this).OnCompleted(continuation, state, token);\n        }\n\n        System.Threading.Tasks.Sources.ValueTaskSourceStatus System.Threading.Tasks.Sources.IValueTaskSource<T>.GetStatus(short token)\n        {\n            return (System.Threading.Tasks.Sources.ValueTaskSourceStatus)(int)((IUniTaskSource)this).GetStatus(token);\n        }\n\n        T System.Threading.Tasks.Sources.IValueTaskSource<T>.GetResult(short token)\n        {\n            return ((IUniTaskSource<T>)this).GetResult(token);\n        }\n\n        void System.Threading.Tasks.Sources.IValueTaskSource<T>.OnCompleted(Action<object> continuation, object state, short token, System.Threading.Tasks.Sources.ValueTaskSourceOnCompletedFlags flags)\n        {\n            // ignore flags, always none.\n            ((IUniTaskSource)this).OnCompleted(continuation, state, token);\n        }\n\n#endif\n    }\n\n    public static class UniTaskStatusExtensions\n    {\n        /// <summary>status != Pending.</summary>\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static bool IsCompleted(this UniTaskStatus status)\n        {\n            return status != UniTaskStatus.Pending;\n        }\n\n        /// <summary>status == Succeeded.</summary>\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static bool IsCompletedSuccessfully(this UniTaskStatus status)\n        {\n            return status == UniTaskStatus.Succeeded;\n        }\n\n        /// <summary>status == Canceled.</summary>\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static bool IsCanceled(this UniTaskStatus status)\n        {\n            return status == UniTaskStatus.Canceled;\n        }\n\n        /// <summary>status == Faulted.</summary>\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static bool IsFaulted(this UniTaskStatus status)\n        {\n            return status == UniTaskStatus.Faulted;\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/IUniTaskSource.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 3e4d023d8404ab742b5e808c98097c3c\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/ArrayPool.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Internal\n{\n    // Same interface as System.Buffers.ArrayPool<T> but only provides Shared.\n\n    internal sealed class ArrayPool<T>\n    {\n        // Same size as System.Buffers.DefaultArrayPool<T>\n        const int DefaultMaxNumberOfArraysPerBucket = 50;\n\n        static readonly T[] EmptyArray = new T[0];\n\n        public static readonly ArrayPool<T> Shared = new ArrayPool<T>();\n\n        readonly MinimumQueue<T[]>[] buckets;\n        readonly SpinLock[] locks;\n\n        ArrayPool()\n        {\n            // see: GetQueueIndex\n            buckets = new MinimumQueue<T[]>[18];\n            locks = new SpinLock[18];\n            for (int i = 0; i < buckets.Length; i++)\n            {\n                buckets[i] = new MinimumQueue<T[]>(4);\n                locks[i] = new SpinLock(false);\n            }\n        }\n\n        public T[] Rent(int minimumLength)\n        {\n            if (minimumLength < 0)\n            {\n                throw new ArgumentOutOfRangeException(\"minimumLength\");\n            }\n            else if (minimumLength == 0)\n            {\n                return EmptyArray;\n            }\n\n            var size = CalculateSize(minimumLength);\n            var index = GetQueueIndex(size);\n            if (index != -1)\n            {\n                var q = buckets[index];\n                var lockTaken = false;\n                try\n                {\n                    locks[index].Enter(ref lockTaken);\n\n                    if (q.Count != 0)\n                    {\n                        return q.Dequeue();\n                    }\n                }\n                finally\n                {\n                    if (lockTaken) locks[index].Exit(false);\n                }\n            }\n\n            return new T[size];\n        }\n\n        public void Return(T[] array, bool clearArray = false)\n        {\n            if (array == null || array.Length == 0)\n            {\n                return;\n            }\n\n            var index = GetQueueIndex(array.Length);\n            if (index != -1)\n            {\n                if (clearArray)\n                {\n                    Array.Clear(array, 0, array.Length);\n                }\n\n                var q = buckets[index];\n                var lockTaken = false;\n\n                try\n                {\n                    locks[index].Enter(ref lockTaken);\n\n                    if (q.Count > DefaultMaxNumberOfArraysPerBucket)\n                    {\n                        return;\n                    }\n\n                    q.Enqueue(array);\n                }\n                finally\n                {\n                    if (lockTaken) locks[index].Exit(false);\n                }\n            }\n        }\n\n        static int CalculateSize(int size)\n        {\n            size--;\n            size |= size >> 1;\n            size |= size >> 2;\n            size |= size >> 4;\n            size |= size >> 8;\n            size |= size >> 16;\n            size += 1;\n\n            if (size < 8)\n            {\n                size = 8;\n            }\n\n            return size;\n        }\n\n        static int GetQueueIndex(int size)\n        {\n            switch (size)\n            {\n                case 8: return 0;\n                case 16: return 1;\n                case 32: return 2;\n                case 64: return 3;\n                case 128: return 4;\n                case 256: return 5;\n                case 512: return 6;\n                case 1024: return 7;\n                case 2048: return 8;\n                case 4096: return 9;\n                case 8192: return 10;\n                case 16384: return 11;\n                case 32768: return 12;\n                case 65536: return 13;\n                case 131072: return 14;\n                case 262144: return 15;\n                case 524288: return 16;\n                case 1048576: return 17; // max array length\n                default:\n                    return -1;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/ArrayPool.cs.meta",
    "content": "fileFormatVersion: 2\nguid: f83ebad81fb89fb4882331616ca6d248\ntimeCreated: 1532361008\nlicenseType: Free\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/ArrayPoolUtil.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Collections.Generic;\nusing System.Runtime.CompilerServices;\n\nnamespace Cysharp.Threading.Tasks.Internal\n{\n    internal static class ArrayPoolUtil\n    {\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        internal static void EnsureCapacity<T>(ref T[] array, int index, ArrayPool<T> pool)\n        {\n            if (array.Length <= index)\n            {\n                EnsureCapacityCore(ref array, index, pool);\n            }\n        }\n\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        static void EnsureCapacityCore<T>(ref T[] array, int index, ArrayPool<T> pool)\n        {\n            if (array.Length <= index)\n            {\n                var newSize = array.Length * 2;\n                var newArray = pool.Rent((index < newSize) ? newSize : (index * 2));\n                Array.Copy(array, 0, newArray, 0, array.Length);\n\n                pool.Return(array, clearArray: !RuntimeHelpersAbstraction.IsWellKnownNoReferenceContainsType<T>());\n\n                array = newArray;\n            }\n        }\n\n        public static RentArray<T> Materialize<T>(IEnumerable<T> source)\n        {\n            if (source is T[] array)\n            {\n                return new RentArray<T>(array, array.Length, null);\n            }\n\n            var defaultCount = 32;\n            if (source is ICollection<T> coll)\n            {\n                if (coll.Count == 0)\n                {\n                    return new RentArray<T>(Array.Empty<T>(), 0, null);\n                }\n\n                defaultCount = coll.Count;\n                var pool = ArrayPool<T>.Shared;\n                var buffer = pool.Rent(defaultCount);\n                coll.CopyTo(buffer, 0);\n                return new RentArray<T>(buffer, coll.Count, pool);\n            }\n            else if (source is IReadOnlyCollection<T> rcoll)\n            {\n                defaultCount = rcoll.Count;\n            }\n\n            if (defaultCount == 0)\n            {\n                return new RentArray<T>(Array.Empty<T>(), 0, null);\n            }\n\n            {\n                var pool = ArrayPool<T>.Shared;\n\n                var index = 0;\n                var buffer = pool.Rent(defaultCount);\n                foreach (var item in source)\n                {\n                    EnsureCapacity(ref buffer, index, pool);\n                    buffer[index++] = item;\n                }\n\n                return new RentArray<T>(buffer, index, pool);\n            }\n        }\n\n        public struct RentArray<T> : IDisposable\n        {\n            public readonly T[] Array;\n            public readonly int Length;\n            ArrayPool<T> pool;\n\n            public RentArray(T[] array, int length, ArrayPool<T> pool)\n            {\n                this.Array = array;\n                this.Length = length;\n                this.pool = pool;\n            }\n\n            public void Dispose()\n            {\n                DisposeManually(!RuntimeHelpersAbstraction.IsWellKnownNoReferenceContainsType<T>());\n            }\n\n            public void DisposeManually(bool clearArray)\n            {\n                if (pool != null)\n                {\n                    if (clearArray)\n                    {\n                        System.Array.Clear(Array, 0, Length);\n                    }\n\n                    pool.Return(Array, clearArray: false);\n                    pool = null;\n                }\n            }\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/ArrayPoolUtil.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 424cc208fb61d4e448b08fcfa0eee25e\ntimeCreated: 1532361007\nlicenseType: Free\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/ArrayUtil.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Collections.Generic;\nusing System.Runtime.CompilerServices;\n\nnamespace Cysharp.Threading.Tasks.Internal\n{\n    internal static class ArrayUtil\n    {\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static void EnsureCapacity<T>(ref T[] array, int index)\n        {\n            if (array.Length <= index)\n            {\n                EnsureCore(ref array, index);\n            }\n        }\n\n        // rare case, no inlining.\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        static void EnsureCore<T>(ref T[] array, int index)\n        {\n            var newSize = array.Length * 2;\n            var newArray = new T[(index < newSize) ? newSize : (index * 2)];\n            Array.Copy(array, 0, newArray, 0, array.Length);\n\n            array = newArray;\n        }\n\n        /// <summary>\n        /// Optimizing utility to avoid .ToArray() that creates buffer copy(cut to just size).\n        /// </summary>\n        public static (T[] array, int length) Materialize<T>(IEnumerable<T> source)\n        {\n            if (source is T[] array)\n            {\n                return (array, array.Length);\n            }\n\n            var defaultCount = 4;\n            if (source is ICollection<T> coll)\n            {\n                defaultCount = coll.Count;\n                var buffer = new T[defaultCount];\n                coll.CopyTo(buffer, 0);\n                return (buffer, defaultCount);\n            }\n            else if (source is IReadOnlyCollection<T> rcoll)\n            {\n                defaultCount = rcoll.Count;\n            }\n\n            if (defaultCount == 0)\n            {\n                return (Array.Empty<T>(), 0);\n            }\n\n            {\n                var index = 0;\n                var buffer = new T[defaultCount];\n                foreach (var item in source)\n                {\n                    EnsureCapacity(ref buffer, index);\n                    buffer[index++] = item;\n                }\n\n                return (buffer, index);\n            }\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/ArrayUtil.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 23146a82ec99f2542a87971c8d3d7988\ntimeCreated: 1532361007\nlicenseType: Free\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/ContinuationQueue.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Internal\n{\n    internal sealed class ContinuationQueue\n    {\n        const int MaxArrayLength = 0X7FEFFFFF;\n        const int InitialSize = 16;\n\n        readonly PlayerLoopTiming timing;\n\n        SpinLock gate = new SpinLock(false);\n        bool dequing = false;\n\n        int actionListCount = 0;\n        Action[] actionList = new Action[InitialSize];\n\n        int waitingListCount = 0;\n        Action[] waitingList = new Action[InitialSize];\n\n        public ContinuationQueue(PlayerLoopTiming timing)\n        {\n            this.timing = timing;\n        }\n\n        public void Enqueue(Action continuation)\n        {\n            bool lockTaken = false;\n            try\n            {\n                gate.Enter(ref lockTaken);\n\n                if (dequing)\n                {\n                    // Ensure Capacity\n                    if (waitingList.Length == waitingListCount)\n                    {\n                        var newLength = waitingListCount * 2;\n                        if ((uint)newLength > MaxArrayLength) newLength = MaxArrayLength;\n\n                        var newArray = new Action[newLength];\n                        Array.Copy(waitingList, newArray, waitingListCount);\n                        waitingList = newArray;\n                    }\n                    waitingList[waitingListCount] = continuation;\n                    waitingListCount++;\n                }\n                else\n                {\n                    // Ensure Capacity\n                    if (actionList.Length == actionListCount)\n                    {\n                        var newLength = actionListCount * 2;\n                        if ((uint)newLength > MaxArrayLength) newLength = MaxArrayLength;\n\n                        var newArray = new Action[newLength];\n                        Array.Copy(actionList, newArray, actionListCount);\n                        actionList = newArray;\n                    }\n                    actionList[actionListCount] = continuation;\n                    actionListCount++;\n                }\n            }\n            finally\n            {\n                if (lockTaken) gate.Exit(false);\n            }\n        }\n\n        public int Clear()\n        {\n            var rest = actionListCount + waitingListCount;\n\n            actionListCount = 0;\n            actionList = new Action[InitialSize];\n\n            waitingListCount = 0;\n            waitingList = new Action[InitialSize];\n\n            return rest;\n        }\n\n        // delegate entrypoint.\n        public void Run()\n        {\n            // for debugging, create named stacktrace.\n#if DEBUG\n            switch (timing)\n            {\n                case PlayerLoopTiming.Initialization:\n                    Initialization();\n                    break;\n                case PlayerLoopTiming.LastInitialization:\n                    LastInitialization();\n                    break;\n                case PlayerLoopTiming.EarlyUpdate:\n                    EarlyUpdate();\n                    break;\n                case PlayerLoopTiming.LastEarlyUpdate:\n                    LastEarlyUpdate();\n                    break;\n                case PlayerLoopTiming.FixedUpdate:\n                    FixedUpdate();\n                    break;\n                case PlayerLoopTiming.LastFixedUpdate:\n                    LastFixedUpdate();\n                    break;\n                case PlayerLoopTiming.PreUpdate:\n                    PreUpdate();\n                    break;\n                case PlayerLoopTiming.LastPreUpdate:\n                    LastPreUpdate();\n                    break;\n                case PlayerLoopTiming.Update:\n                    Update();\n                    break;\n                case PlayerLoopTiming.LastUpdate:\n                    LastUpdate();\n                    break;\n                case PlayerLoopTiming.PreLateUpdate:\n                    PreLateUpdate();\n                    break;\n                case PlayerLoopTiming.LastPreLateUpdate:\n                    LastPreLateUpdate();\n                    break;\n                case PlayerLoopTiming.PostLateUpdate:\n                    PostLateUpdate();\n                    break;\n                case PlayerLoopTiming.LastPostLateUpdate:\n                    LastPostLateUpdate();\n                    break;\n#if UNITY_2020_2_OR_NEWER\n                case PlayerLoopTiming.TimeUpdate:\n                    TimeUpdate();\n                    break;\n                case PlayerLoopTiming.LastTimeUpdate:\n                    LastTimeUpdate();\n                    break;\n#endif\n                default:\n                    break;\n            }\n#else\n            RunCore();\n#endif\n        }\n\n        void Initialization() => RunCore();\n        void LastInitialization() => RunCore();\n        void EarlyUpdate() => RunCore();\n        void LastEarlyUpdate() => RunCore();\n        void FixedUpdate() => RunCore();\n        void LastFixedUpdate() => RunCore();\n        void PreUpdate() => RunCore();\n        void LastPreUpdate() => RunCore();\n        void Update() => RunCore();\n        void LastUpdate() => RunCore();\n        void PreLateUpdate() => RunCore();\n        void LastPreLateUpdate() => RunCore();\n        void PostLateUpdate() => RunCore();\n        void LastPostLateUpdate() => RunCore();\n#if UNITY_2020_2_OR_NEWER\n        void TimeUpdate() => RunCore();\n        void LastTimeUpdate() => RunCore();\n#endif\n\n        [System.Diagnostics.DebuggerHidden]\n        void RunCore()\n        {\n            {\n                bool lockTaken = false;\n                try\n                {\n                    gate.Enter(ref lockTaken);\n                    if (actionListCount == 0) return;\n                    dequing = true;\n                }\n                finally\n                {\n                    if (lockTaken) gate.Exit(false);\n                }\n            }\n\n            for (int i = 0; i < actionListCount; i++)\n            {\n\n                var action = actionList[i];\n                actionList[i] = null;\n                try\n                {\n                    action();\n                }\n                catch (Exception ex)\n                {\n                    UnityEngine.Debug.LogException(ex);\n                }\n            }\n\n            {\n                bool lockTaken = false;\n                try\n                {\n                    gate.Enter(ref lockTaken);\n                    dequing = false;\n\n                    var swapTempActionList = actionList;\n\n                    actionListCount = waitingListCount;\n                    actionList = waitingList;\n\n                    waitingListCount = 0;\n                    waitingList = swapTempActionList;\n                }\n                finally\n                {\n                    if (lockTaken) gate.Exit(false);\n                }\n            }\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/ContinuationQueue.cs.meta",
    "content": "fileFormatVersion: 2\nguid: f66c32454e50f2546b17deadc80a4c77\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/DiagnosticsExtensions.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Security;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing UnityEngine;\n\nnamespace Cysharp.Threading.Tasks.Internal\n{\n    internal static class DiagnosticsExtensions\n    {\n        static bool displayFilenames = true;\n\n        static readonly Regex typeBeautifyRegex = new Regex(\"`.+$\", RegexOptions.Compiled);\n\n        static readonly Dictionary<Type, string> builtInTypeNames = new Dictionary<Type, string>\n        {\n            { typeof(void), \"void\" },\n            { typeof(bool), \"bool\" },\n            { typeof(byte), \"byte\" },\n            { typeof(char), \"char\" },\n            { typeof(decimal), \"decimal\" },\n            { typeof(double), \"double\" },\n            { typeof(float), \"float\" },\n            { typeof(int), \"int\" },\n            { typeof(long), \"long\" },\n            { typeof(object), \"object\" },\n            { typeof(sbyte), \"sbyte\" },\n            { typeof(short), \"short\" },\n            { typeof(string), \"string\" },\n            { typeof(uint), \"uint\" },\n            { typeof(ulong), \"ulong\" },\n            { typeof(ushort), \"ushort\" },\n            { typeof(Task), \"Task\" },\n            { typeof(UniTask), \"UniTask\" },\n            { typeof(UniTaskVoid), \"UniTaskVoid\" }\n        };\n\n        public static string CleanupAsyncStackTrace(this StackTrace stackTrace)\n        {\n            if (stackTrace == null) return \"\";\n\n            var sb = new StringBuilder();\n            for (int i = 0; i < stackTrace.FrameCount; i++)\n            {\n                var sf = stackTrace.GetFrame(i);\n\n                var mb = sf.GetMethod();\n\n                if (IgnoreLine(mb)) continue;\n                if (IsAsync(mb))\n                {\n                    sb.Append(\"async \");\n                    TryResolveStateMachineMethod(ref mb, out var decType);\n                }\n\n                // return type\n                if (mb is MethodInfo mi)\n                {\n                    sb.Append(BeautifyType(mi.ReturnType, false));\n                    sb.Append(\" \");\n                }\n\n                // method name\n                sb.Append(BeautifyType(mb.DeclaringType, false));\n                if (!mb.IsConstructor)\n                {\n                    sb.Append(\".\");\n                }\n                sb.Append(mb.Name);\n                if (mb.IsGenericMethod)\n                {\n                    sb.Append(\"<\");\n                    foreach (var item in mb.GetGenericArguments())\n                    {\n                        sb.Append(BeautifyType(item, true));\n                    }\n                    sb.Append(\">\");\n                }\n\n                // parameter\n                sb.Append(\"(\");\n                sb.Append(string.Join(\", \", mb.GetParameters().Select(p => BeautifyType(p.ParameterType, true) + \" \" + p.Name)));\n                sb.Append(\")\");\n\n                // file name\n                if (displayFilenames && (sf.GetILOffset() != -1))\n                {\n                    String fileName = null;\n\n                    try\n                    {\n                        fileName = sf.GetFileName();\n                    }\n                    catch (NotSupportedException)\n                    {\n                        displayFilenames = false;\n                    }\n                    catch (SecurityException)\n                    {\n                        displayFilenames = false;\n                    }\n\n                    if (fileName != null)\n                    {\n                        sb.Append(' ');\n                        sb.AppendFormat(CultureInfo.InvariantCulture, \"(at {0})\", AppendHyperLink(fileName, sf.GetFileLineNumber().ToString()));\n                    }\n                }\n\n                sb.AppendLine();\n            }\n            return sb.ToString();\n        }\n\n\n        static bool IsAsync(MethodBase methodInfo)\n        {\n            var declareType = methodInfo.DeclaringType;\n            return typeof(IAsyncStateMachine).IsAssignableFrom(declareType);\n        }\n\n        // code from Ben.Demystifier/EnhancedStackTrace.Frame.cs\n        static bool TryResolveStateMachineMethod(ref MethodBase method, out Type declaringType)\n        {\n            declaringType = method.DeclaringType;\n\n            var parentType = declaringType.DeclaringType;\n            if (parentType == null)\n            {\n                return false;\n            }\n\n            var methods = parentType.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly);\n            if (methods == null)\n            {\n                return false;\n            }\n\n            foreach (var candidateMethod in methods)\n            {\n                var attributes = candidateMethod.GetCustomAttributes<StateMachineAttribute>(false);\n                if (attributes == null)\n                {\n                    continue;\n                }\n\n                foreach (var asma in attributes)\n                {\n                    if (asma.StateMachineType == declaringType)\n                    {\n                        method = candidateMethod;\n                        declaringType = candidateMethod.DeclaringType;\n                        // Mark the iterator as changed; so it gets the + annotation of the original method\n                        // async statemachines resolve directly to their builder methods so aren't marked as changed\n                        return asma is IteratorStateMachineAttribute;\n                    }\n                }\n            }\n\n            return false;\n        }\n\n        static string BeautifyType(Type t, bool shortName)\n        {\n            if (builtInTypeNames.TryGetValue(t, out var builtin))\n            {\n                return builtin;\n            }\n            if (t.IsGenericParameter) return t.Name;\n            if (t.IsArray) return BeautifyType(t.GetElementType(), shortName) + \"[]\";\n            if (t.FullName?.StartsWith(\"System.ValueTuple\") ?? false)\n            {\n                return \"(\" + string.Join(\", \", t.GetGenericArguments().Select(x => BeautifyType(x, true))) + \")\";\n            }\n            if (!t.IsGenericType) return shortName ? t.Name : t.FullName.Replace(\"Cysharp.Threading.Tasks.Triggers.\", \"\").Replace(\"Cysharp.Threading.Tasks.Internal.\", \"\").Replace(\"Cysharp.Threading.Tasks.\", \"\") ?? t.Name;\n\n            var innerFormat = string.Join(\", \", t.GetGenericArguments().Select(x => BeautifyType(x, true)));\n\n            var genericType = t.GetGenericTypeDefinition().FullName;\n            if (genericType == \"System.Threading.Tasks.Task`1\")\n            {\n                genericType = \"Task\";\n            }\n\n            return typeBeautifyRegex.Replace(genericType, \"\").Replace(\"Cysharp.Threading.Tasks.Triggers.\", \"\").Replace(\"Cysharp.Threading.Tasks.Internal.\", \"\").Replace(\"Cysharp.Threading.Tasks.\", \"\") + \"<\" + innerFormat + \">\";\n        }\n\n        static bool IgnoreLine(MethodBase methodInfo)\n        {\n            var declareType = methodInfo.DeclaringType.FullName;\n            if (declareType == \"System.Threading.ExecutionContext\")\n            {\n                return true;\n            }\n            else if (declareType.StartsWith(\"System.Runtime.CompilerServices\"))\n            {\n                return true;\n            }\n            else if (declareType.StartsWith(\"Cysharp.Threading.Tasks.CompilerServices\"))\n            {\n                return true;\n            }\n            else if (declareType == \"System.Threading.Tasks.AwaitTaskContinuation\")\n            {\n                return true;\n            }\n            else if (declareType.StartsWith(\"System.Threading.Tasks.Task\"))\n            {\n                return true;\n            }\n            else if (declareType.StartsWith(\"Cysharp.Threading.Tasks.UniTaskCompletionSourceCore\"))\n            {\n                return true;\n            }\n            else if (declareType.StartsWith(\"Cysharp.Threading.Tasks.AwaiterActions\"))\n            {\n                return true;\n            }\n\n            return false;\n        }\n\n        static string AppendHyperLink(string path, string line)\n        {\n            var fi = new FileInfo(path);\n            if (fi.Directory == null)\n            {\n                return fi.Name;\n            }\n            else\n            {\n                var fname = fi.FullName.Replace(Path.DirectorySeparatorChar, '/').Replace(PlayerLoopHelper.ApplicationDataPath, \"\");\n                var withAssetsPath = \"Assets/\" + fname;\n                return \"<a href=\\\"\" + withAssetsPath + \"\\\" line=\\\"\" + line + \"\\\">\" + withAssetsPath + \":\" + line + \"</a>\";\n            }\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/DiagnosticsExtensions.cs.meta",
    "content": "fileFormatVersion: 2\nguid: f80fb1c9ed4c99447be1b0a47a8d980b\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/Error.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Runtime.CompilerServices;\n\nnamespace Cysharp.Threading.Tasks.Internal\n{\n    internal static class Error\n    {\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static void ThrowArgumentNullException<T>(T value, string paramName)\n          where T : class\n        {\n            if (value == null) ThrowArgumentNullExceptionCore(paramName);\n        }\n\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        static void ThrowArgumentNullExceptionCore(string paramName)\n        {\n            throw new ArgumentNullException(paramName);\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static Exception ArgumentOutOfRange(string paramName)\n        {\n            return new ArgumentOutOfRangeException(paramName);\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static Exception NoElements()\n        {\n            return new InvalidOperationException(\"Source sequence doesn't contain any elements.\");\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static Exception MoreThanOneElement()\n        {\n            return new InvalidOperationException(\"Source sequence contains more than one element.\");\n        }\n\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        public static void ThrowArgumentException(string message)\n        {\n            throw new ArgumentException(message);\n        }\n\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        public static void ThrowNotYetCompleted()\n        {\n            throw new InvalidOperationException(\"Not yet completed.\");\n        }\n\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        public static T ThrowNotYetCompleted<T>()\n        {\n            throw new InvalidOperationException(\"Not yet completed.\");\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static void ThrowWhenContinuationIsAlreadyRegistered<T>(T continuationField)\n          where T : class\n        {\n            if (continuationField != null) ThrowInvalidOperationExceptionCore(\"continuation is already registered.\");\n        }\n\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        static void ThrowInvalidOperationExceptionCore(string message)\n        {\n            throw new InvalidOperationException(message);\n        }\n\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        public static void ThrowOperationCanceledException()\n        {\n            throw new OperationCanceledException();\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/Error.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 5f39f495294d4604b8082202faf98554\ntimeCreated: 1532361007\nlicenseType: Free\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/MinimumQueue.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Runtime.CompilerServices;\n\nnamespace Cysharp.Threading.Tasks.Internal\n{\n    // optimized version of Standard Queue<T>.\n    internal class MinimumQueue<T>\n    {\n        const int MinimumGrow = 4;\n        const int GrowFactor = 200;\n\n        T[] array;\n        int head;\n        int tail;\n        int size;\n\n        public MinimumQueue(int capacity)\n        {\n            if (capacity < 0) throw new ArgumentOutOfRangeException(\"capacity\");\n            array = new T[capacity];\n            head = tail = size = 0;\n        }\n\n        public int Count\n        {\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            get { return size; }\n        }\n\n        public T Peek()\n        {\n            if (size == 0) ThrowForEmptyQueue();\n            return array[head];\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void Enqueue(T item)\n        {\n            if (size == array.Length)\n            {\n                Grow();\n            }\n\n            array[tail] = item;\n            MoveNext(ref tail);\n            size++;\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public T Dequeue()\n        {\n            if (size == 0) ThrowForEmptyQueue();\n\n            int head = this.head;\n            T[] array = this.array;\n            T removed = array[head];\n            array[head] = default(T);\n            MoveNext(ref this.head);\n            size--;\n            return removed;\n        }\n\n        void Grow()\n        {\n            int newcapacity = (int)((long)array.Length * (long)GrowFactor / 100);\n            if (newcapacity < array.Length + MinimumGrow)\n            {\n                newcapacity = array.Length + MinimumGrow;\n            }\n            SetCapacity(newcapacity);\n        }\n\n        void SetCapacity(int capacity)\n        {\n            T[] newarray = new T[capacity];\n            if (size > 0)\n            {\n                if (head < tail)\n                {\n                    Array.Copy(array, head, newarray, 0, size);\n                }\n                else\n                {\n                    Array.Copy(array, head, newarray, 0, array.Length - head);\n                    Array.Copy(array, 0, newarray, array.Length - head, tail);\n                }\n            }\n\n            array = newarray;\n            head = 0;\n            tail = (size == capacity) ? 0 : size;\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        void MoveNext(ref int index)\n        {\n            int tmp = index + 1;\n            if (tmp == array.Length)\n            {\n                tmp = 0;\n            }\n            index = tmp;\n        }\n\n        void ThrowForEmptyQueue()\n        {\n            throw new InvalidOperationException(\"EmptyQueue\");\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/MinimumQueue.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 7d63add489ccc99498114d79702b904d\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/PlayerLoopRunner.cs",
    "content": "﻿\nusing System;\nusing UnityEngine;\n\nnamespace Cysharp.Threading.Tasks.Internal\n{\n    internal sealed class PlayerLoopRunner\n    {\n        const int InitialSize = 16;\n\n        readonly PlayerLoopTiming timing;\n        readonly object runningAndQueueLock = new object();\n        readonly object arrayLock = new object();\n        readonly Action<Exception> unhandledExceptionCallback;\n\n        int tail = 0;\n        bool running = false;\n        IPlayerLoopItem[] loopItems = new IPlayerLoopItem[InitialSize];\n        MinimumQueue<IPlayerLoopItem> waitQueue = new MinimumQueue<IPlayerLoopItem>(InitialSize);\n\n\n\n        public PlayerLoopRunner(PlayerLoopTiming timing)\n        {\n            this.unhandledExceptionCallback = ex => Debug.LogException(ex);\n            this.timing = timing;\n        }\n\n        public void AddAction(IPlayerLoopItem item)\n        {\n            lock (runningAndQueueLock)\n            {\n                if (running)\n                {\n                    waitQueue.Enqueue(item);\n                    return;\n                }\n            }\n\n            lock (arrayLock)\n            {\n                // Ensure Capacity\n                if (loopItems.Length == tail)\n                {\n                    Array.Resize(ref loopItems, checked(tail * 2));\n                }\n                loopItems[tail++] = item;\n            }\n        }\n\n        public int Clear()\n        {\n            lock (arrayLock)\n            {\n                var rest = 0;\n\n                for (var index = 0; index < loopItems.Length; index++)\n                {\n                    if (loopItems[index] != null)\n                    {\n                        rest++;\n                    }\n\n                    loopItems[index] = null;\n                }\n\n                tail = 0;\n                return rest;\n            }\n        }\n\n        // delegate entrypoint.\n        public void Run()\n        {\n            // for debugging, create named stacktrace.\n#if DEBUG\n            switch (timing)\n            {\n                case PlayerLoopTiming.Initialization:\n                    Initialization();\n                    break;\n                case PlayerLoopTiming.LastInitialization:\n                    LastInitialization();\n                    break;\n                case PlayerLoopTiming.EarlyUpdate:\n                    EarlyUpdate();\n                    break;\n                case PlayerLoopTiming.LastEarlyUpdate:\n                    LastEarlyUpdate();\n                    break;\n                case PlayerLoopTiming.FixedUpdate:\n                    FixedUpdate();\n                    break;\n                case PlayerLoopTiming.LastFixedUpdate:\n                    LastFixedUpdate();\n                    break;\n                case PlayerLoopTiming.PreUpdate:\n                    PreUpdate();\n                    break;\n                case PlayerLoopTiming.LastPreUpdate:\n                    LastPreUpdate();\n                    break;\n                case PlayerLoopTiming.Update:\n                    Update();\n                    break;\n                case PlayerLoopTiming.LastUpdate:\n                    LastUpdate();\n                    break;\n                case PlayerLoopTiming.PreLateUpdate:\n                    PreLateUpdate();\n                    break;\n                case PlayerLoopTiming.LastPreLateUpdate:\n                    LastPreLateUpdate();\n                    break;\n                case PlayerLoopTiming.PostLateUpdate:\n                    PostLateUpdate();\n                    break;\n                case PlayerLoopTiming.LastPostLateUpdate:\n                    LastPostLateUpdate();\n                    break;\n#if UNITY_2020_2_OR_NEWER\n                case PlayerLoopTiming.TimeUpdate:\n                    TimeUpdate();\n                    break;\n                case PlayerLoopTiming.LastTimeUpdate:\n                    LastTimeUpdate();\n                    break;\n#endif\n                default:\n                    break;\n            }\n#else\n            RunCore();\n#endif\n        }\n\n        void Initialization() => RunCore();\n        void LastInitialization() => RunCore();\n        void EarlyUpdate() => RunCore();\n        void LastEarlyUpdate() => RunCore();\n        void FixedUpdate() => RunCore();\n        void LastFixedUpdate() => RunCore();\n        void PreUpdate() => RunCore();\n        void LastPreUpdate() => RunCore();\n        void Update() => RunCore();\n        void LastUpdate() => RunCore();\n        void PreLateUpdate() => RunCore();\n        void LastPreLateUpdate() => RunCore();\n        void PostLateUpdate() => RunCore();\n        void LastPostLateUpdate() => RunCore();\n#if UNITY_2020_2_OR_NEWER\n        void TimeUpdate() => RunCore();\n        void LastTimeUpdate() => RunCore();\n#endif\n\n        [System.Diagnostics.DebuggerHidden]\n        void RunCore()\n        {\n            lock (runningAndQueueLock)\n            {\n                running = true;\n            }\n\n            lock (arrayLock)\n            {\n                var j = tail - 1;\n\n                for (int i = 0; i < loopItems.Length; i++)\n                {\n                    var action = loopItems[i];\n                    if (action != null)\n                    {\n                        try\n                        {\n                            if (!action.MoveNext())\n                            {\n                                loopItems[i] = null;\n                            }\n                            else\n                            {\n                                continue; // next i \n                            }\n                        }\n                        catch (Exception ex)\n                        {\n                            loopItems[i] = null;\n                            try\n                            {\n                                unhandledExceptionCallback(ex);\n                            }\n                            catch { }\n                        }\n                    }\n\n                    // find null, loop from tail\n                    while (i < j)\n                    {\n                        var fromTail = loopItems[j];\n                        if (fromTail != null)\n                        {\n                            try\n                            {\n                                if (!fromTail.MoveNext())\n                                {\n                                    loopItems[j] = null;\n                                    j--;\n                                    continue; // next j\n                                }\n                                else\n                                {\n                                    // swap\n                                    loopItems[i] = fromTail;\n                                    loopItems[j] = null;\n                                    j--;\n                                    goto NEXT_LOOP; // next i\n                                }\n                            }\n                            catch (Exception ex)\n                            {\n                                loopItems[j] = null;\n                                j--;\n                                try\n                                {\n                                    unhandledExceptionCallback(ex);\n                                }\n                                catch { }\n                                continue; // next j\n                            }\n                        }\n                        else\n                        {\n                            j--;\n                        }\n                    }\n\n                    tail = i; // loop end\n                    break; // LOOP END\n\n                    NEXT_LOOP:\n                    continue;\n                }\n\n\n                lock (runningAndQueueLock)\n                {\n                    running = false;\n                    while (waitQueue.Count != 0)\n                    {\n                        if (loopItems.Length == tail)\n                        {\n                            Array.Resize(ref loopItems, checked(tail * 2));\n                        }\n                        loopItems[tail++] = waitQueue.Dequeue();\n                    }\n                }\n            }\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/PlayerLoopRunner.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 340c6d420bb4f484aa8683415ea92571\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/PooledDelegate.cs",
    "content": "﻿using System;\nusing System.Runtime.CompilerServices;\n\nnamespace Cysharp.Threading.Tasks.Internal\n{\n    internal sealed class PooledDelegate<T> : ITaskPoolNode<PooledDelegate<T>>\n    {\n        static TaskPool<PooledDelegate<T>> pool;\n\n        PooledDelegate<T> nextNode;\n        public ref PooledDelegate<T> NextNode => ref nextNode;\n\n        static PooledDelegate()\n        {\n            TaskPool.RegisterSizeGetter(typeof(PooledDelegate<T>), () => pool.Size);\n        }\n\n        readonly Action<T> runDelegate;\n        Action continuation;\n\n        PooledDelegate()\n        {\n            runDelegate = Run;\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static Action<T> Create(Action continuation)\n        {\n            if (!pool.TryPop(out var item))\n            {\n                item = new PooledDelegate<T>();\n            }\n\n            item.continuation = continuation;\n            return item.runDelegate;\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        void Run(T _)\n        {\n            var call = continuation;\n            continuation = null;\n            if (call != null)\n            {\n                pool.TryPush(this);\n                call.Invoke();\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/PooledDelegate.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 8932579438742fa40b010edd412dbfba\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/RuntimeHelpersAbstraction.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\n#if UNITY_2018_3_OR_NEWER\nusing UnityEngine;\n#endif\n\nnamespace Cysharp.Threading.Tasks.Internal\n{\n    internal static class RuntimeHelpersAbstraction\n    {\n        // If we can use RuntimeHelpers.IsReferenceOrContainsReferences(.NET Core 2.0), use it.\n        public static bool IsWellKnownNoReferenceContainsType<T>()\n        {\n            return WellKnownNoReferenceContainsType<T>.IsWellKnownType;\n        }\n\n        static bool WellKnownNoReferenceContainsTypeInitialize(Type t)\n        {\n            // The primitive types are Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, IntPtr, UIntPtr, Char, Double, and Single.\n            if (t.IsPrimitive) return true;\n\n            if (t.IsEnum) return true;\n            if (t == typeof(DateTime)) return true;\n            if (t == typeof(DateTimeOffset)) return true;\n            if (t == typeof(Guid)) return true;\n            if (t == typeof(decimal)) return true;\n\n            // unwrap nullable\n            if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>))\n            {\n                return WellKnownNoReferenceContainsTypeInitialize(t.GetGenericArguments()[0]);\n            }\n\n#if UNITY_2018_3_OR_NEWER\n\n            // or add other wellknown types(Vector, etc...) here\n            if (t == typeof(Vector2)) return true;\n            if (t == typeof(Vector3)) return true;\n            if (t == typeof(Vector4)) return true;\n            if (t == typeof(Color)) return true;\n            if (t == typeof(Rect)) return true;\n            if (t == typeof(Bounds)) return true;\n            if (t == typeof(Quaternion)) return true;\n            if (t == typeof(Vector2Int)) return true;\n            if (t == typeof(Vector3Int)) return true;\n\n#endif\n\n            return false;\n        }\n\n        static class WellKnownNoReferenceContainsType<T>\n        {\n            public static readonly bool IsWellKnownType;\n\n            static WellKnownNoReferenceContainsType()\n            {\n                IsWellKnownType = WellKnownNoReferenceContainsTypeInitialize(typeof(T));\n            }\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/RuntimeHelpersAbstraction.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 94975e4d4e0c0ea4ba787d3872ce9bb4\ntimeCreated: 1532361007\nlicenseType: Free\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/StatePool.cs",
    "content": "﻿using System;\nusing System.Collections.Concurrent;\nusing System.Runtime.CompilerServices;\n\nnamespace Cysharp.Threading.Tasks.Internal\n{\n    internal static class StateTuple\n    {\n        public static StateTuple<T1> Create<T1>(T1 item1)\n        {\n            return StatePool<T1>.Create(item1);\n        }\n\n        public static StateTuple<T1, T2> Create<T1, T2>(T1 item1, T2 item2)\n        {\n            return StatePool<T1, T2>.Create(item1, item2);\n        }\n\n        public static StateTuple<T1, T2, T3> Create<T1, T2, T3>(T1 item1, T2 item2, T3 item3)\n        {\n            return StatePool<T1, T2, T3>.Create(item1, item2, item3);\n        }\n    }\n\n    internal class StateTuple<T1> : IDisposable\n    {\n        public T1 Item1;\n\n        public void Deconstruct(out T1 item1)\n        {\n            item1 = this.Item1;\n        }\n\n        public void Dispose()\n        {\n            StatePool<T1>.Return(this);\n        }\n    }\n\n    internal static class StatePool<T1>\n    {\n        static readonly ConcurrentQueue<StateTuple<T1>> queue = new ConcurrentQueue<StateTuple<T1>>();\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static StateTuple<T1> Create(T1 item1)\n        {\n            if (queue.TryDequeue(out var value))\n            {\n                value.Item1 = item1;\n                return value;\n            }\n\n            return new StateTuple<T1> { Item1 = item1 };\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static void Return(StateTuple<T1> tuple)\n        {\n            tuple.Item1 = default;\n            queue.Enqueue(tuple);\n        }\n    }\n\n    internal class StateTuple<T1, T2> : IDisposable\n    {\n        public T1 Item1;\n        public T2 Item2;\n\n        public void Deconstruct(out T1 item1, out T2 item2)\n        {\n            item1 = this.Item1;\n            item2 = this.Item2;\n        }\n\n        public void Dispose()\n        {\n            StatePool<T1, T2>.Return(this);\n        }\n    }\n\n    internal static class StatePool<T1, T2>\n    {\n        static readonly ConcurrentQueue<StateTuple<T1, T2>> queue = new ConcurrentQueue<StateTuple<T1, T2>>();\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static StateTuple<T1, T2> Create(T1 item1, T2 item2)\n        {\n            if (queue.TryDequeue(out var value))\n            {\n                value.Item1 = item1;\n                value.Item2 = item2;\n                return value;\n            }\n\n            return new StateTuple<T1, T2> { Item1 = item1, Item2 = item2 };\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static void Return(StateTuple<T1, T2> tuple)\n        {\n            tuple.Item1 = default;\n            tuple.Item2 = default;\n            queue.Enqueue(tuple);\n        }\n    }\n\n    internal class StateTuple<T1, T2, T3> : IDisposable\n    {\n        public T1 Item1;\n        public T2 Item2;\n        public T3 Item3;\n\n        public void Deconstruct(out T1 item1, out T2 item2, out T3 item3)\n        {\n            item1 = this.Item1;\n            item2 = this.Item2;\n            item3 = this.Item3;\n        }\n\n        public void Dispose()\n        {\n            StatePool<T1, T2, T3>.Return(this);\n        }\n    }\n\n    internal static class StatePool<T1, T2, T3>\n    {\n        static readonly ConcurrentQueue<StateTuple<T1, T2, T3>> queue = new ConcurrentQueue<StateTuple<T1, T2, T3>>();\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static StateTuple<T1, T2, T3> Create(T1 item1, T2 item2, T3 item3)\n        {\n            if (queue.TryDequeue(out var value))\n            {\n                value.Item1 = item1;\n                value.Item2 = item2;\n                value.Item3 = item3;\n                return value;\n            }\n\n            return new StateTuple<T1, T2, T3> { Item1 = item1, Item2 = item2, Item3 = item3 };\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static void Return(StateTuple<T1, T2, T3> tuple)\n        {\n            tuple.Item1 = default;\n            tuple.Item2 = default;\n            tuple.Item3 = default;\n            queue.Enqueue(tuple);\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/StatePool.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 60cdf0bcaea36b444a7ae7263ae7598f\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/TaskTracker.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Text;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks\n{\n    // public for add user custom.\n\n    public static class TaskTracker\n    {\n#if UNITY_EDITOR\n\n        static int trackingId = 0;\n\n        public const string EnableAutoReloadKey = \"UniTaskTrackerWindow_EnableAutoReloadKey\";\n        public const string EnableTrackingKey = \"UniTaskTrackerWindow_EnableTrackingKey\";\n        public const string EnableStackTraceKey = \"UniTaskTrackerWindow_EnableStackTraceKey\";\n\n        public static class EditorEnableState\n        {\n            static bool enableAutoReload;\n            public static bool EnableAutoReload\n            {\n                get { return enableAutoReload; }\n                set\n                {\n                    enableAutoReload = value;\n                    UnityEditor.EditorPrefs.SetBool(EnableAutoReloadKey, value);\n                }\n            }\n\n            static bool enableTracking;\n            public static bool EnableTracking\n            {\n                get { return enableTracking; }\n                set\n                {\n                    enableTracking = value;\n                    UnityEditor.EditorPrefs.SetBool(EnableTrackingKey, value);\n                }\n            }\n\n            static bool enableStackTrace;\n            public static bool EnableStackTrace\n            {\n                get { return enableStackTrace; }\n                set\n                {\n                    enableStackTrace = value;\n                    UnityEditor.EditorPrefs.SetBool(EnableStackTraceKey, value);\n                }\n            }\n        }\n\n#endif\n\n\n        static List<KeyValuePair<IUniTaskSource, (string formattedType, int trackingId, DateTime addTime, string stackTrace)>> listPool = new List<KeyValuePair<IUniTaskSource, (string formattedType, int trackingId, DateTime addTime, string stackTrace)>>();\n\n        static readonly WeakDictionary<IUniTaskSource, (string formattedType, int trackingId, DateTime addTime, string stackTrace)> tracking = new WeakDictionary<IUniTaskSource, (string formattedType, int trackingId, DateTime addTime, string stackTrace)>();\n\n        [Conditional(\"UNITY_EDITOR\")]\n        public static void TrackActiveTask(IUniTaskSource task, int skipFrame)\n        {\n#if UNITY_EDITOR\n            dirty = true;\n            if (!EditorEnableState.EnableTracking) return;\n            var stackTrace = EditorEnableState.EnableStackTrace ? new StackTrace(skipFrame, true).CleanupAsyncStackTrace() : \"\";\n\n            string typeName;\n            if (EditorEnableState.EnableStackTrace)\n            {\n                var sb = new StringBuilder();\n                TypeBeautify(task.GetType(), sb);\n                typeName = sb.ToString();\n            }\n            else\n            {\n                typeName = task.GetType().Name;\n            }\n            tracking.TryAdd(task, (typeName, Interlocked.Increment(ref trackingId), DateTime.UtcNow, stackTrace));\n#endif\n        }\n\n        [Conditional(\"UNITY_EDITOR\")]\n        public static void RemoveTracking(IUniTaskSource task)\n        {\n#if UNITY_EDITOR\n            dirty = true;\n            if (!EditorEnableState.EnableTracking) return;\n            var success = tracking.TryRemove(task);\n#endif\n        }\n\n        static bool dirty;\n\n        public static bool CheckAndResetDirty()\n        {\n            var current = dirty;\n            dirty = false;\n            return current;\n        }\n\n        /// <summary>(trackingId, awaiterType, awaiterStatus, createdTime, stackTrace)</summary>\n        public static void ForEachActiveTask(Action<int, string, UniTaskStatus, DateTime, string> action)\n        {\n            lock (listPool)\n            {\n                var count = tracking.ToList(ref listPool, clear: false);\n                try\n                {\n                    for (int i = 0; i < count; i++)\n                    {\n                        action(listPool[i].Value.trackingId, listPool[i].Value.formattedType, listPool[i].Key.UnsafeGetStatus(), listPool[i].Value.addTime, listPool[i].Value.stackTrace);\n                        listPool[i] = default;\n                    }\n                }\n                catch\n                {\n                    listPool.Clear();\n                    throw;\n                }\n            }\n        }\n\n        static void TypeBeautify(Type type, StringBuilder sb)\n        {\n            if (type.IsNested)\n            {\n                // TypeBeautify(type.DeclaringType, sb);\n                sb.Append(type.DeclaringType.Name.ToString());\n                sb.Append(\".\");\n            }\n\n            if (type.IsGenericType)\n            {\n                var genericsStart = type.Name.IndexOf(\"`\");\n                if (genericsStart != -1)\n                {\n                    sb.Append(type.Name.Substring(0, genericsStart));\n                }\n                else\n                {\n                    sb.Append(type.Name);\n                }\n                sb.Append(\"<\");\n                var first = true;\n                foreach (var item in type.GetGenericArguments())\n                {\n                    if (!first)\n                    {\n                        sb.Append(\", \");\n                    }\n                    first = false;\n                    TypeBeautify(item, sb);\n                }\n                sb.Append(\">\");\n            }\n            else\n            {\n                sb.Append(type.Name);\n            }\n        }\n\n        //static string RemoveUniTaskNamespace(string str)\n        //{\n        //    return str.Replace(\"Cysharp.Threading.Tasks.CompilerServices\", \"\")\n        //        .Replace(\"Cysharp.Threading.Tasks.Linq\", \"\")\n        //        .Replace(\"Cysharp.Threading.Tasks\", \"\");\n        //}\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/TaskTracker.cs.meta",
    "content": "fileFormatVersion: 2\nguid: a203c73eb4ccdbb44bddfd82d38fdda9\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/UnityEqualityComparer.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing UnityEngine;\n\nnamespace Cysharp.Threading.Tasks.Internal\n{\n    internal static class UnityEqualityComparer\n    {\n        public static readonly IEqualityComparer<Vector2> Vector2 = new Vector2EqualityComparer();\n        public static readonly IEqualityComparer<Vector3> Vector3 = new Vector3EqualityComparer();\n        public static readonly IEqualityComparer<Vector4> Vector4 = new Vector4EqualityComparer();\n        public static readonly IEqualityComparer<Color> Color = new ColorEqualityComparer();\n        public static readonly IEqualityComparer<Color32> Color32 = new Color32EqualityComparer();\n        public static readonly IEqualityComparer<Rect> Rect = new RectEqualityComparer();\n        public static readonly IEqualityComparer<Bounds> Bounds = new BoundsEqualityComparer();\n        public static readonly IEqualityComparer<Quaternion> Quaternion = new QuaternionEqualityComparer();\n\n        static readonly RuntimeTypeHandle vector2Type = typeof(Vector2).TypeHandle;\n        static readonly RuntimeTypeHandle vector3Type = typeof(Vector3).TypeHandle;\n        static readonly RuntimeTypeHandle vector4Type = typeof(Vector4).TypeHandle;\n        static readonly RuntimeTypeHandle colorType = typeof(Color).TypeHandle;\n        static readonly RuntimeTypeHandle color32Type = typeof(Color32).TypeHandle;\n        static readonly RuntimeTypeHandle rectType = typeof(Rect).TypeHandle;\n        static readonly RuntimeTypeHandle boundsType = typeof(Bounds).TypeHandle;\n        static readonly RuntimeTypeHandle quaternionType = typeof(Quaternion).TypeHandle;\n\n#if UNITY_2017_2_OR_NEWER\n\n        public static readonly IEqualityComparer<Vector2Int> Vector2Int = new Vector2IntEqualityComparer();\n        public static readonly IEqualityComparer<Vector3Int> Vector3Int = new Vector3IntEqualityComparer();\n        public static readonly IEqualityComparer<RangeInt> RangeInt = new RangeIntEqualityComparer();\n        public static readonly IEqualityComparer<RectInt> RectInt = new RectIntEqualityComparer();\n        public static readonly IEqualityComparer<BoundsInt> BoundsInt = new BoundsIntEqualityComparer();\n\n        static readonly RuntimeTypeHandle vector2IntType = typeof(Vector2Int).TypeHandle;\n        static readonly RuntimeTypeHandle vector3IntType = typeof(Vector3Int).TypeHandle;\n        static readonly RuntimeTypeHandle rangeIntType = typeof(RangeInt).TypeHandle;\n        static readonly RuntimeTypeHandle rectIntType = typeof(RectInt).TypeHandle;\n        static readonly RuntimeTypeHandle boundsIntType = typeof(BoundsInt).TypeHandle;\n\n#endif\n\n        static class Cache<T>\n        {\n            public static readonly IEqualityComparer<T> Comparer;\n\n            static Cache()\n            {\n                var comparer = GetDefaultHelper(typeof(T));\n                if (comparer == null)\n                {\n                    Comparer = EqualityComparer<T>.Default;\n                }\n                else\n                {\n                    Comparer = (IEqualityComparer<T>)comparer;\n                }\n            }\n        }\n\n        public static IEqualityComparer<T> GetDefault<T>()\n        {\n            return Cache<T>.Comparer;\n        }\n\n        static object GetDefaultHelper(Type type)\n        {\n            var t = type.TypeHandle;\n\n            if (t.Equals(vector2Type)) return (object)UnityEqualityComparer.Vector2;\n            if (t.Equals(vector3Type)) return (object)UnityEqualityComparer.Vector3;\n            if (t.Equals(vector4Type)) return (object)UnityEqualityComparer.Vector4;\n            if (t.Equals(colorType)) return (object)UnityEqualityComparer.Color;\n            if (t.Equals(color32Type)) return (object)UnityEqualityComparer.Color32;\n            if (t.Equals(rectType)) return (object)UnityEqualityComparer.Rect;\n            if (t.Equals(boundsType)) return (object)UnityEqualityComparer.Bounds;\n            if (t.Equals(quaternionType)) return (object)UnityEqualityComparer.Quaternion;\n\n#if UNITY_2017_2_OR_NEWER\n\n            if (t.Equals(vector2IntType)) return (object)UnityEqualityComparer.Vector2Int;\n            if (t.Equals(vector3IntType)) return (object)UnityEqualityComparer.Vector3Int;\n            if (t.Equals(rangeIntType)) return (object)UnityEqualityComparer.RangeInt;\n            if (t.Equals(rectIntType)) return (object)UnityEqualityComparer.RectInt;\n            if (t.Equals(boundsIntType)) return (object)UnityEqualityComparer.BoundsInt;\n#endif\n\n            return null;\n        }\n\n        sealed class Vector2EqualityComparer : IEqualityComparer<Vector2>\n        {\n            public bool Equals(Vector2 self, Vector2 vector)\n            {\n                return self.x.Equals(vector.x) && self.y.Equals(vector.y);\n            }\n\n            public int GetHashCode(Vector2 obj)\n            {\n                return obj.x.GetHashCode() ^ obj.y.GetHashCode() << 2;\n            }\n        }\n\n        sealed class Vector3EqualityComparer : IEqualityComparer<Vector3>\n        {\n            public bool Equals(Vector3 self, Vector3 vector)\n            {\n                return self.x.Equals(vector.x) && self.y.Equals(vector.y) && self.z.Equals(vector.z);\n            }\n\n            public int GetHashCode(Vector3 obj)\n            {\n                return obj.x.GetHashCode() ^ obj.y.GetHashCode() << 2 ^ obj.z.GetHashCode() >> 2;\n            }\n        }\n\n        sealed class Vector4EqualityComparer : IEqualityComparer<Vector4>\n        {\n            public bool Equals(Vector4 self, Vector4 vector)\n            {\n                return self.x.Equals(vector.x) && self.y.Equals(vector.y) && self.z.Equals(vector.z) && self.w.Equals(vector.w);\n            }\n\n            public int GetHashCode(Vector4 obj)\n            {\n                return obj.x.GetHashCode() ^ obj.y.GetHashCode() << 2 ^ obj.z.GetHashCode() >> 2 ^ obj.w.GetHashCode() >> 1;\n            }\n        }\n\n        sealed class ColorEqualityComparer : IEqualityComparer<Color>\n        {\n            public bool Equals(Color self, Color other)\n            {\n                return self.r.Equals(other.r) && self.g.Equals(other.g) && self.b.Equals(other.b) && self.a.Equals(other.a);\n            }\n\n            public int GetHashCode(Color obj)\n            {\n                return obj.r.GetHashCode() ^ obj.g.GetHashCode() << 2 ^ obj.b.GetHashCode() >> 2 ^ obj.a.GetHashCode() >> 1;\n            }\n        }\n\n        sealed class RectEqualityComparer : IEqualityComparer<Rect>\n        {\n            public bool Equals(Rect self, Rect other)\n            {\n                return self.x.Equals(other.x) && self.width.Equals(other.width) && self.y.Equals(other.y) && self.height.Equals(other.height);\n            }\n\n            public int GetHashCode(Rect obj)\n            {\n                return obj.x.GetHashCode() ^ obj.width.GetHashCode() << 2 ^ obj.y.GetHashCode() >> 2 ^ obj.height.GetHashCode() >> 1;\n            }\n        }\n\n        sealed class BoundsEqualityComparer : IEqualityComparer<Bounds>\n        {\n            public bool Equals(Bounds self, Bounds vector)\n            {\n                return self.center.Equals(vector.center) && self.extents.Equals(vector.extents);\n            }\n\n            public int GetHashCode(Bounds obj)\n            {\n                return obj.center.GetHashCode() ^ obj.extents.GetHashCode() << 2;\n            }\n        }\n\n        sealed class QuaternionEqualityComparer : IEqualityComparer<Quaternion>\n        {\n            public bool Equals(Quaternion self, Quaternion vector)\n            {\n                return self.x.Equals(vector.x) && self.y.Equals(vector.y) && self.z.Equals(vector.z) && self.w.Equals(vector.w);\n            }\n\n            public int GetHashCode(Quaternion obj)\n            {\n                return obj.x.GetHashCode() ^ obj.y.GetHashCode() << 2 ^ obj.z.GetHashCode() >> 2 ^ obj.w.GetHashCode() >> 1;\n            }\n        }\n\n        sealed class Color32EqualityComparer : IEqualityComparer<Color32>\n        {\n            public bool Equals(Color32 self, Color32 vector)\n            {\n                return self.a.Equals(vector.a) && self.r.Equals(vector.r) && self.g.Equals(vector.g) && self.b.Equals(vector.b);\n            }\n\n            public int GetHashCode(Color32 obj)\n            {\n                return obj.a.GetHashCode() ^ obj.r.GetHashCode() << 2 ^ obj.g.GetHashCode() >> 2 ^ obj.b.GetHashCode() >> 1;\n            }\n        }\n\n#if UNITY_2017_2_OR_NEWER\n\n        sealed class Vector2IntEqualityComparer : IEqualityComparer<Vector2Int>\n        {\n            public bool Equals(Vector2Int self, Vector2Int vector)\n            {\n                return self.x.Equals(vector.x) && self.y.Equals(vector.y);\n            }\n\n            public int GetHashCode(Vector2Int obj)\n            {\n                return obj.x.GetHashCode() ^ obj.y.GetHashCode() << 2;\n            }\n        }\n\n        sealed class Vector3IntEqualityComparer : IEqualityComparer<Vector3Int>\n        {\n            public static readonly Vector3IntEqualityComparer Default = new Vector3IntEqualityComparer();\n\n            public bool Equals(Vector3Int self, Vector3Int vector)\n            {\n                return self.x.Equals(vector.x) && self.y.Equals(vector.y) && self.z.Equals(vector.z);\n            }\n\n            public int GetHashCode(Vector3Int obj)\n            {\n                return obj.x.GetHashCode() ^ obj.y.GetHashCode() << 2 ^ obj.z.GetHashCode() >> 2;\n            }\n        }\n\n        sealed class RangeIntEqualityComparer : IEqualityComparer<RangeInt>\n        {\n            public bool Equals(RangeInt self, RangeInt vector)\n            {\n                return self.start.Equals(vector.start) && self.length.Equals(vector.length);\n            }\n\n            public int GetHashCode(RangeInt obj)\n            {\n                return obj.start.GetHashCode() ^ obj.length.GetHashCode() << 2;\n            }\n        }\n\n        sealed class RectIntEqualityComparer : IEqualityComparer<RectInt>\n        {\n            public bool Equals(RectInt self, RectInt other)\n            {\n                return self.x.Equals(other.x) && self.width.Equals(other.width) && self.y.Equals(other.y) && self.height.Equals(other.height);\n            }\n\n            public int GetHashCode(RectInt obj)\n            {\n                return obj.x.GetHashCode() ^ obj.width.GetHashCode() << 2 ^ obj.y.GetHashCode() >> 2 ^ obj.height.GetHashCode() >> 1;\n            }\n        }\n\n        sealed class BoundsIntEqualityComparer : IEqualityComparer<BoundsInt>\n        {\n            public bool Equals(BoundsInt self, BoundsInt vector)\n            {\n                return Vector3IntEqualityComparer.Default.Equals(self.position, vector.position)\n                    && Vector3IntEqualityComparer.Default.Equals(self.size, vector.size);\n            }\n\n            public int GetHashCode(BoundsInt obj)\n            {\n                return Vector3IntEqualityComparer.Default.GetHashCode(obj.position) ^ Vector3IntEqualityComparer.Default.GetHashCode(obj.size) << 2;\n            }\n        }\n\n#endif\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/UnityEqualityComparer.cs.meta",
    "content": "fileFormatVersion: 2\nguid: ebaaf14253c9cfb47b23283218ff9b67\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/UnityWebRequestExtensions.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing UnityEngine.Networking;\n\nnamespace Cysharp.Threading.Tasks.Internal\n{\n#if ENABLE_UNITYWEBREQUEST && (!UNITY_2019_1_OR_NEWER || UNITASK_WEBREQUEST_SUPPORT)\n    \n    internal static class UnityWebRequestResultExtensions\n    {\n        public static bool IsError(this UnityWebRequest unityWebRequest)\n        {\n#if UNITY_2020_2_OR_NEWER\n            var result = unityWebRequest.result;\n            return (result == UnityWebRequest.Result.ConnectionError)\n                || (result == UnityWebRequest.Result.DataProcessingError)\n                || (result == UnityWebRequest.Result.ProtocolError);\n#else\n            return unityWebRequest.isHttpError || unityWebRequest.isNetworkError;\n#endif\n        }\n    }\n\n#endif\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/UnityWebRequestExtensions.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 111ba0e639de1d7428af6c823ead4918\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/ValueStopwatch.cs",
    "content": "﻿using System;\nusing System.Diagnostics;\n\nnamespace Cysharp.Threading.Tasks.Internal\n{\n    internal readonly struct ValueStopwatch\n    {\n        static readonly double TimestampToTicks = TimeSpan.TicksPerSecond / (double)Stopwatch.Frequency;\n\n        readonly long startTimestamp;\n\n        public static ValueStopwatch StartNew() => new ValueStopwatch(Stopwatch.GetTimestamp());\n\n        ValueStopwatch(long startTimestamp)\n        {\n            this.startTimestamp = startTimestamp;\n        }\n\n        public TimeSpan Elapsed => TimeSpan.FromTicks(this.ElapsedTicks);\n\n        public bool IsInvalid => startTimestamp == 0;\n\n        public long ElapsedTicks\n        {\n            get\n            {\n                if (startTimestamp == 0)\n                {\n                    throw new InvalidOperationException(\"Detected invalid initialization(use 'default'), only to create from StartNew().\");\n                }\n\n                var delta = Stopwatch.GetTimestamp() - startTimestamp;\n                return (long)(delta * TimestampToTicks);\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/ValueStopwatch.cs.meta",
    "content": "fileFormatVersion: 2\nguid: f16fb466974ad034c8732c79c7fd67ea\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/WeakDictionary.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Internal\n{\n    // Add, Remove, Enumerate with sweep. All operations are thread safe(in spinlock).\n    internal class WeakDictionary<TKey, TValue>\n        where TKey : class\n    {\n        Entry[] buckets;\n        int size;\n        SpinLock gate; // mutable struct(not readonly)\n\n        readonly float loadFactor;\n        readonly IEqualityComparer<TKey> keyEqualityComparer;\n\n        public WeakDictionary(int capacity = 4, float loadFactor = 0.75f, IEqualityComparer<TKey> keyComparer = null)\n        {\n            var tableSize = CalculateCapacity(capacity, loadFactor);\n            this.buckets = new Entry[tableSize];\n            this.loadFactor = loadFactor;\n            this.gate = new SpinLock(false);\n            this.keyEqualityComparer = keyComparer ?? EqualityComparer<TKey>.Default;\n        }\n\n        public bool TryAdd(TKey key, TValue value)\n        {\n            bool lockTaken = false;\n            try\n            {\n                gate.Enter(ref lockTaken);\n                return TryAddInternal(key, value);\n            }\n            finally\n            {\n                if (lockTaken) gate.Exit(false);\n            }\n        }\n\n        public bool TryGetValue(TKey key, out TValue value)\n        {\n            bool lockTaken = false;\n            try\n            {\n                gate.Enter(ref lockTaken);\n                if (TryGetEntry(key, out _, out var entry))\n                {\n                    value = entry.Value;\n                    return true;\n                }\n\n                value = default(TValue);\n                return false;\n            }\n            finally\n            {\n                if (lockTaken) gate.Exit(false);\n            }\n        }\n\n        public bool TryRemove(TKey key)\n        {\n            bool lockTaken = false;\n            try\n            {\n                gate.Enter(ref lockTaken);\n                if (TryGetEntry(key, out var hashIndex, out var entry))\n                {\n                    Remove(hashIndex, entry);\n                    return true;\n                }\n\n                return false;\n            }\n            finally\n            {\n                if (lockTaken) gate.Exit(false);\n            }\n        }\n\n        bool TryAddInternal(TKey key, TValue value)\n        {\n            var nextCapacity = CalculateCapacity(size + 1, loadFactor);\n\n            TRY_ADD_AGAIN:\n            if (buckets.Length < nextCapacity)\n            {\n                // rehash\n                var nextBucket = new Entry[nextCapacity];\n                for (int i = 0; i < buckets.Length; i++)\n                {\n                    var e = buckets[i];\n                    while (e != null)\n                    {\n                        AddToBuckets(nextBucket, key, e.Value, e.Hash);\n                        e = e.Next;\n                    }\n                }\n\n                buckets = nextBucket;\n                goto TRY_ADD_AGAIN;\n            }\n            else\n            {\n                // add entry\n                var successAdd = AddToBuckets(buckets, key, value, keyEqualityComparer.GetHashCode(key));\n                if (successAdd) size++;\n                return successAdd;\n            }\n        }\n\n        bool AddToBuckets(Entry[] targetBuckets, TKey newKey, TValue value, int keyHash)\n        {\n            var h = keyHash;\n            var hashIndex = h & (targetBuckets.Length - 1);\n\n            TRY_ADD_AGAIN:\n            if (targetBuckets[hashIndex] == null)\n            {\n                targetBuckets[hashIndex] = new Entry\n                {\n                    Key = new WeakReference<TKey>(newKey, false),\n                    Value = value,\n                    Hash = h\n                };\n\n                return true;\n            }\n            else\n            {\n                // add to last.\n                var entry = targetBuckets[hashIndex];\n                while (entry != null)\n                {\n                    if (entry.Key.TryGetTarget(out var target))\n                    {\n                        if (keyEqualityComparer.Equals(newKey, target))\n                        {\n                            return false; // duplicate\n                        }\n                    }\n                    else\n                    {\n                        Remove(hashIndex, entry);\n                        if (targetBuckets[hashIndex] == null) goto TRY_ADD_AGAIN; // add new entry\n                    }\n\n                    if (entry.Next != null)\n                    {\n                        entry = entry.Next;\n                    }\n                    else\n                    {\n                        // found last\n                        entry.Next = new Entry\n                        {\n                            Key = new WeakReference<TKey>(newKey, false),\n                            Value = value,\n                            Hash = h\n                        };\n                        entry.Next.Prev = entry;\n                    }\n                }\n\n                return false;\n            }\n        }\n\n        bool TryGetEntry(TKey key, out int hashIndex, out Entry entry)\n        {\n            var table = buckets;\n            var hash = keyEqualityComparer.GetHashCode(key);\n            hashIndex = hash & table.Length - 1;\n            entry = table[hashIndex];\n\n            while (entry != null)\n            {\n                if (entry.Key.TryGetTarget(out var target))\n                {\n                    if (keyEqualityComparer.Equals(key, target))\n                    {\n                        return true;\n                    }\n                }\n                else\n                {\n                    // sweap\n                    Remove(hashIndex, entry);\n                }\n\n                entry = entry.Next;\n            }\n\n            return false;\n        }\n\n        void Remove(int hashIndex, Entry entry)\n        {\n            if (entry.Prev == null && entry.Next == null)\n            {\n                buckets[hashIndex] = null;\n            }\n            else\n            {\n                if (entry.Prev == null)\n                {\n                    buckets[hashIndex] = entry.Next;\n                }\n                if (entry.Prev != null)\n                {\n                    entry.Prev.Next = entry.Next;\n                }\n                if (entry.Next != null)\n                {\n                    entry.Next.Prev = entry.Prev;\n                }\n            }\n            size--;\n        }\n\n        public List<KeyValuePair<TKey, TValue>> ToList()\n        {\n            var list = new List<KeyValuePair<TKey, TValue>>(size);\n            ToList(ref list, false);\n            return list;\n        }\n\n        // avoid allocate everytime.\n        public int ToList(ref List<KeyValuePair<TKey, TValue>> list, bool clear = true)\n        {\n            if (clear)\n            {\n                list.Clear();\n            }\n\n            var listIndex = 0;\n\n            bool lockTaken = false;\n            try\n            {\n                for (int i = 0; i < buckets.Length; i++)\n                {\n                    var entry = buckets[i];\n                    while (entry != null)\n                    {\n                        if (entry.Key.TryGetTarget(out var target))\n                        {\n                            var item = new KeyValuePair<TKey, TValue>(target, entry.Value);\n                            if (listIndex < list.Count)\n                            {\n                                list[listIndex++] = item;\n                            }\n                            else\n                            {\n                                list.Add(item);\n                                listIndex++;\n                            }\n                        }\n                        else\n                        {\n                            // sweap\n                            Remove(i, entry);\n                        }\n\n                        entry = entry.Next;\n                    }\n                }\n            }\n            finally\n            {\n                if (lockTaken) gate.Exit(false);\n            }\n\n            return listIndex;\n        }\n\n        static int CalculateCapacity(int collectionSize, float loadFactor)\n        {\n            var size = (int)(((float)collectionSize) / loadFactor);\n\n            size--;\n            size |= size >> 1;\n            size |= size >> 2;\n            size |= size >> 4;\n            size |= size >> 8;\n            size |= size >> 16;\n            size += 1;\n\n            if (size < 8)\n            {\n                size = 8;\n            }\n            return size;\n        }\n\n        class Entry\n        {\n            public WeakReference<TKey> Key;\n            public TValue Value;\n            public int Hash;\n            public Entry Prev;\n            public Entry Next;\n\n            // debug only\n            public override string ToString()\n            {\n                if (Key.TryGetTarget(out var target))\n                {\n                    return target + \"(\" + Count() + \")\";\n                }\n                else\n                {\n                    return \"(Dead)\";\n                }\n            }\n\n            int Count()\n            {\n                var count = 1;\n                var n = this;\n                while (n.Next != null)\n                {\n                    count++;\n                    n = n.Next;\n                }\n                return count;\n            }\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/WeakDictionary.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 6c78563864409714593226af59bcb6f3\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Internal.meta",
    "content": "fileFormatVersion: 2\nguid: 633f49a8aafb6fa43894cd4646c71743\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Aggregate.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<TSource> AggregateAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TSource, TSource> accumulator, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(accumulator, nameof(accumulator));\n\n            return Aggregate.AggregateAsync(source, accumulator, cancellationToken);\n        }\n\n        public static UniTask<TAccumulate> AggregateAsync<TSource, TAccumulate>(this IUniTaskAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(accumulator, nameof(accumulator));\n\n            return Aggregate.AggregateAsync(source, seed, accumulator, cancellationToken);\n        }\n\n        public static UniTask<TResult> AggregateAsync<TSource, TAccumulate, TResult>(this IUniTaskAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, Func<TAccumulate, TResult> resultSelector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(accumulator, nameof(accumulator));\n            Error.ThrowArgumentNullException(accumulator, nameof(resultSelector));\n\n            return Aggregate.AggregateAsync(source, seed, accumulator, resultSelector, cancellationToken);\n        }\n\n        public static UniTask<TSource> AggregateAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TSource, UniTask<TSource>> accumulator, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(accumulator, nameof(accumulator));\n\n            return Aggregate.AggregateAwaitAsync(source, accumulator, cancellationToken);\n        }\n\n        public static UniTask<TAccumulate> AggregateAwaitAsync<TSource, TAccumulate>(this IUniTaskAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, UniTask<TAccumulate>> accumulator, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(accumulator, nameof(accumulator));\n\n            return Aggregate.AggregateAwaitAsync(source, seed, accumulator, cancellationToken);\n        }\n\n        public static UniTask<TResult> AggregateAwaitAsync<TSource, TAccumulate, TResult>(this IUniTaskAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, UniTask<TAccumulate>> accumulator, Func<TAccumulate, UniTask<TResult>> resultSelector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(accumulator, nameof(accumulator));\n            Error.ThrowArgumentNullException(accumulator, nameof(resultSelector));\n\n            return Aggregate.AggregateAwaitAsync(source, seed, accumulator, resultSelector, cancellationToken);\n        }\n\n        public static UniTask<TSource> AggregateAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TSource, CancellationToken, UniTask<TSource>> accumulator, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(accumulator, nameof(accumulator));\n\n            return Aggregate.AggregateAwaitWithCancellationAsync(source, accumulator, cancellationToken);\n        }\n\n        public static UniTask<TAccumulate> AggregateAwaitWithCancellationAsync<TSource, TAccumulate>(this IUniTaskAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, CancellationToken, UniTask<TAccumulate>> accumulator, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(accumulator, nameof(accumulator));\n\n            return Aggregate.AggregateAwaitWithCancellationAsync(source, seed, accumulator, cancellationToken);\n        }\n\n        public static UniTask<TResult> AggregateAwaitWithCancellationAsync<TSource, TAccumulate, TResult>(this IUniTaskAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, CancellationToken, UniTask<TAccumulate>> accumulator, Func<TAccumulate, CancellationToken, UniTask<TResult>> resultSelector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(accumulator, nameof(accumulator));\n            Error.ThrowArgumentNullException(accumulator, nameof(resultSelector));\n\n            return Aggregate.AggregateAwaitWithCancellationAsync(source, seed, accumulator, resultSelector, cancellationToken);\n        }\n    }\n\n    internal static class Aggregate\n    {\n        internal static async UniTask<TSource> AggregateAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TSource, TSource> accumulator, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                TSource value;\n                if (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                }\n                else\n                {\n                    throw Error.NoElements();\n                }\n\n                while (await e.MoveNextAsync())\n                {\n                    value = accumulator(value, e.Current);\n                }\n                return value;\n\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        internal static async UniTask<TAccumulate> AggregateAsync<TSource, TAccumulate>(IUniTaskAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                TAccumulate value = seed;\n                while (await e.MoveNextAsync())\n                {\n                    value = accumulator(value, e.Current);\n                }\n                return value;\n\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        internal static async UniTask<TResult> AggregateAsync<TSource, TAccumulate, TResult>(IUniTaskAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator, Func<TAccumulate, TResult> resultSelector, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                TAccumulate value = seed;\n                while (await e.MoveNextAsync())\n                {\n                    value = accumulator(value, e.Current);\n                }\n                return resultSelector(value);\n\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        // with async\n\n        internal static async UniTask<TSource> AggregateAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TSource, UniTask<TSource>> accumulator, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                TSource value;\n                if (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                }\n                else\n                {\n                    throw Error.NoElements();\n                }\n\n                while (await e.MoveNextAsync())\n                {\n                    value = await accumulator(value, e.Current);\n                }\n                return value;\n\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        internal static async UniTask<TAccumulate> AggregateAwaitAsync<TSource, TAccumulate>(IUniTaskAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, UniTask<TAccumulate>> accumulator, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                TAccumulate value = seed;\n                while (await e.MoveNextAsync())\n                {\n                    value = await accumulator(value, e.Current);\n                }\n                return value;\n\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        internal static async UniTask<TResult> AggregateAwaitAsync<TSource, TAccumulate, TResult>(IUniTaskAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, UniTask<TAccumulate>> accumulator, Func<TAccumulate, UniTask<TResult>> resultSelector, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                TAccumulate value = seed;\n                while (await e.MoveNextAsync())\n                {\n                    value = await accumulator(value, e.Current);\n                }\n                return await resultSelector(value);\n\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n\n        // with cancellation\n\n        internal static async UniTask<TSource> AggregateAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TSource, CancellationToken, UniTask<TSource>> accumulator, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                TSource value;\n                if (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                }\n                else\n                {\n                    throw Error.NoElements();\n                }\n\n                while (await e.MoveNextAsync())\n                {\n                    value = await accumulator(value, e.Current, cancellationToken);\n                }\n                return value;\n\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        internal static async UniTask<TAccumulate> AggregateAwaitWithCancellationAsync<TSource, TAccumulate>(IUniTaskAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, CancellationToken, UniTask<TAccumulate>> accumulator, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                TAccumulate value = seed;\n                while (await e.MoveNextAsync())\n                {\n                    value = await accumulator(value, e.Current, cancellationToken);\n                }\n                return value;\n\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        internal static async UniTask<TResult> AggregateAwaitWithCancellationAsync<TSource, TAccumulate, TResult>(IUniTaskAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, CancellationToken, UniTask<TAccumulate>> accumulator, Func<TAccumulate, CancellationToken, UniTask<TResult>> resultSelector, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                TAccumulate value = seed;\n                while (await e.MoveNextAsync())\n                {\n                    value = await accumulator(value, e.Current, cancellationToken);\n                }\n                return await resultSelector(value, cancellationToken);\n\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Aggregate.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 5dc68c05a4228c643937f6ebd185bcca\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/All.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<Boolean> AllAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return All.AllAsync(source, predicate, cancellationToken);\n        }\n\n        public static UniTask<Boolean> AllAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return All.AllAwaitAsync(source, predicate, cancellationToken);\n        }\n\n        public static UniTask<Boolean> AllAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return All.AllAwaitWithCancellationAsync(source, predicate, cancellationToken);\n        }\n    }\n\n    internal static class All\n    {\n        internal static async UniTask<bool> AllAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    if (!predicate(e.Current))\n                    {\n                        return false;\n                    }\n                }\n\n                return true;\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        internal static async UniTask<bool> AllAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    if (!await predicate(e.Current))\n                    {\n                        return false;\n                    }\n                }\n\n                return true;\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        internal static async UniTask<bool> AllAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    if (!await predicate(e.Current, cancellationToken))\n                    {\n                        return false;\n                    }\n                }\n\n                return true;\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/All.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 7271437e0033af2448b600ee248924dd\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Any.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<Boolean> AnyAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Any.AnyAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Boolean> AnyAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return Any.AnyAsync(source, predicate, cancellationToken);\n        }\n\n        public static UniTask<Boolean> AnyAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return Any.AnyAwaitAsync(source, predicate, cancellationToken);\n        }\n\n        public static UniTask<Boolean> AnyAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return Any.AnyAwaitWithCancellationAsync(source, predicate, cancellationToken);\n        }\n    }\n\n    internal static class Any\n    {\n        internal static async UniTask<bool> AnyAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                if (await e.MoveNextAsync())\n                {\n                    return true;\n                }\n\n                return false;\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        internal static async UniTask<bool> AnyAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    if (predicate(e.Current))\n                    {\n                        return true;\n                    }\n                }\n\n                return false;\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        internal static async UniTask<bool> AnyAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    if (await predicate(e.Current))\n                    {\n                        return true;\n                    }\n                }\n\n                return false;\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        internal static async UniTask<bool> AnyAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    if (await predicate(e.Current, cancellationToken))\n                    {\n                        return true;\n                    }\n                }\n\n                return false;\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Any.cs.meta",
    "content": "fileFormatVersion: 2\nguid: e2b2e65745263994fbe34f3e0ec8eb12\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/AppendPrepend.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> Append<TSource>(this IUniTaskAsyncEnumerable<TSource> source, TSource element)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new AppendPrepend<TSource>(source, element, true);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> Prepend<TSource>(this IUniTaskAsyncEnumerable<TSource> source, TSource element)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new AppendPrepend<TSource>(source, element, false);\n        }\n    }\n\n    internal sealed class AppendPrepend<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly TSource element;\n        readonly bool append; // or prepend\n\n        public AppendPrepend(IUniTaskAsyncEnumerable<TSource> source, TSource element, bool append)\n        {\n            this.source = source;\n            this.element = element;\n            this.append = append;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _AppendPrepend(source, element, append, cancellationToken);\n        }\n\n        sealed class _AppendPrepend : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            enum State : byte\n            {\n                None,\n                RequirePrepend,\n                RequireAppend,\n                Completed\n            }\n\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly TSource element;\n            CancellationToken cancellationToken;\n\n            State state;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n\n            public _AppendPrepend(IUniTaskAsyncEnumerable<TSource> source, TSource element, bool append, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.element = element;\n                this.state = append ? State.RequireAppend : State.RequirePrepend;\n                this.cancellationToken = cancellationToken;\n\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TSource Current { get; private set; }\n\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                if (enumerator == null)\n                {\n                    if (state == State.RequirePrepend)\n                    {\n                        Current = element;\n                        state = State.None;\n                        return CompletedTasks.True;\n                    }\n\n                    enumerator = source.GetAsyncEnumerator(cancellationToken);\n                }\n\n                if (state == State.Completed)\n                {\n                    return CompletedTasks.False;\n                }\n\n                awaiter = enumerator.MoveNextAsync().GetAwaiter();\n\n                if (awaiter.IsCompleted)\n                {\n                    MoveNextCoreDelegate(this);\n                }\n                else\n                {\n                    awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                }\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_AppendPrepend)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        self.Current = self.enumerator.Current;\n                        self.completionSource.TrySetResult(true);\n                    }\n                    else\n                    {\n                        if (self.state == State.RequireAppend)\n                        {\n                            self.state = State.Completed;\n                            self.Current = self.element;\n                            self.completionSource.TrySetResult(true);\n                        }\n                        else\n                        {\n                            self.state = State.Completed;\n                            self.completionSource.TrySetResult(false);\n                        }\n                    }\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n                return default;\n            }\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/AppendPrepend.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 3268ec424b8055f45aa2a26d17c80468\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/AsUniTaskAsyncEnumerable.cs",
    "content": "﻿namespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> AsUniTaskAsyncEnumerable<TSource>(this IUniTaskAsyncEnumerable<TSource> source)\n        {\n            return source;\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/AsUniTaskAsyncEnumerable.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 69866e262589ea643bbc62a1d696077a\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/AsyncEnumeratorBase.cs",
    "content": "﻿using System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    // note: refactor all inherit class and should remove this.\n    // see Select and Where.\n    internal abstract class AsyncEnumeratorBase<TSource, TResult> : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n    {\n        static readonly Action<object> moveNextCallbackDelegate = MoveNextCallBack;\n\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        protected CancellationToken cancellationToken;\n\n        IUniTaskAsyncEnumerator<TSource> enumerator;\n        UniTask<bool>.Awaiter sourceMoveNext;\n\n        public AsyncEnumeratorBase(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)\n        {\n            this.source = source;\n            this.cancellationToken = cancellationToken;\n            TaskTracker.TrackActiveTask(this, 4);\n        }\n\n        // abstract\n\n        /// <summary>\n        /// If return value is false, continue source.MoveNext.\n        /// </summary>\n        protected abstract bool TryMoveNextCore(bool sourceHasCurrent, out bool result);\n\n        // Util\n        protected TSource SourceCurrent => enumerator.Current;\n\n        // IUniTaskAsyncEnumerator<T>\n\n        public TResult Current { get; protected set; }\n\n        public UniTask<bool> MoveNextAsync()\n        {\n            if (enumerator == null)\n            {\n                enumerator = source.GetAsyncEnumerator(cancellationToken);\n            }\n\n            completionSource.Reset();\n            if (!OnFirstIteration())\n            {\n                SourceMoveNext();\n            }\n            return new UniTask<bool>(this, completionSource.Version);\n        }\n\n        protected virtual bool OnFirstIteration()\n        {\n            return false;\n        }\n\n        protected void SourceMoveNext()\n        {\n            CONTINUE:\n            sourceMoveNext = enumerator.MoveNextAsync().GetAwaiter();\n            if (sourceMoveNext.IsCompleted)\n            {\n                bool result = false;\n                try\n                {\n                    if (!TryMoveNextCore(sourceMoveNext.GetResult(), out result))\n                    {\n                        goto CONTINUE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    completionSource.TrySetCanceled(cancellationToken);\n                }\n                else\n                {\n                    completionSource.TrySetResult(result);\n                }\n            }\n            else\n            {\n                sourceMoveNext.SourceOnCompleted(moveNextCallbackDelegate, this);\n            }\n        }\n\n        static void MoveNextCallBack(object state)\n        {\n            var self = (AsyncEnumeratorBase<TSource, TResult>)state;\n            bool result;\n            try\n            {\n                if (!self.TryMoveNextCore(self.sourceMoveNext.GetResult(), out result))\n                {\n                    self.SourceMoveNext();\n                    return;\n                }\n            }\n            catch (Exception ex)\n            {\n                self.completionSource.TrySetException(ex);\n                return;\n            }\n\n            if (self.cancellationToken.IsCancellationRequested)\n            {\n                self.completionSource.TrySetCanceled(self.cancellationToken);\n            }\n            else\n            {\n                self.completionSource.TrySetResult(result);\n            }\n        }\n\n        // if require additional resource to dispose, override and call base.DisposeAsync.\n        public virtual UniTask DisposeAsync()\n        {\n            TaskTracker.RemoveTracking(this);\n            if (enumerator != null)\n            {\n                return enumerator.DisposeAsync();\n            }\n            return default;\n        }\n    }\n\n    internal abstract class AsyncEnumeratorAwaitSelectorBase<TSource, TResult, TAwait> : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n    {\n        static readonly Action<object> moveNextCallbackDelegate = MoveNextCallBack;\n        static readonly Action<object> setCurrentCallbackDelegate = SetCurrentCallBack;\n\n\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        protected CancellationToken cancellationToken;\n\n        IUniTaskAsyncEnumerator<TSource> enumerator;\n        UniTask<bool>.Awaiter sourceMoveNext;\n\n        UniTask<TAwait>.Awaiter resultAwaiter;\n\n        public AsyncEnumeratorAwaitSelectorBase(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)\n        {\n            this.source = source;\n            this.cancellationToken = cancellationToken;\n            TaskTracker.TrackActiveTask(this, 4);\n        }\n\n        // abstract\n\n        protected abstract UniTask<TAwait> TransformAsync(TSource sourceCurrent);\n        protected abstract bool TrySetCurrentCore(TAwait awaitResult, out bool terminateIteration);\n\n        // Util\n        protected TSource SourceCurrent { get; private set; }\n\n        protected (bool waitCallback, bool requireNextIteration) ActionCompleted(bool trySetCurrentResult, out bool moveNextResult)\n        {\n            if (trySetCurrentResult)\n            {\n                moveNextResult = true;\n                return (false, false);\n            }\n            else\n            {\n                moveNextResult = default;\n                return (false, true);\n            }\n        }\n        protected (bool waitCallback, bool requireNextIteration) WaitAwaitCallback(out bool moveNextResult) { moveNextResult = default; return (true, false); }\n        protected (bool waitCallback, bool requireNextIteration) IterateFinished(out bool moveNextResult) { moveNextResult = false; return (false, false); }\n\n        // IUniTaskAsyncEnumerator<T>\n\n        public TResult Current { get; protected set; }\n\n        public UniTask<bool> MoveNextAsync()\n        {\n            if (enumerator == null)\n            {\n                enumerator = source.GetAsyncEnumerator(cancellationToken);\n            }\n\n            completionSource.Reset();\n            SourceMoveNext();\n            return new UniTask<bool>(this, completionSource.Version);\n        }\n\n        protected void SourceMoveNext()\n        {\n            CONTINUE:\n            sourceMoveNext = enumerator.MoveNextAsync().GetAwaiter();\n            if (sourceMoveNext.IsCompleted)\n            {\n                bool result = false;\n                try\n                {\n                    (bool waitCallback, bool requireNextIteration) = TryMoveNextCore(sourceMoveNext.GetResult(), out result);\n\n                    if (waitCallback)\n                    {\n                        return;\n                    }\n\n                    if (requireNextIteration)\n                    {\n                        goto CONTINUE;\n                    }\n                    else\n                    {\n                        completionSource.TrySetResult(result);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n            }\n            else\n            {\n                sourceMoveNext.SourceOnCompleted(moveNextCallbackDelegate, this);\n            }\n        }\n\n        (bool waitCallback, bool requireNextIteration) TryMoveNextCore(bool sourceHasCurrent, out bool result)\n        {\n            if (sourceHasCurrent)\n            {\n                SourceCurrent = enumerator.Current;\n                var task = TransformAsync(SourceCurrent);\n                if (UnwarapTask(task, out var taskResult))\n                {\n                    var currentResult = TrySetCurrentCore(taskResult, out var terminateIteration);\n                    if (terminateIteration)\n                    {\n                        return IterateFinished(out result);\n                    }\n\n                    return ActionCompleted(currentResult, out result);\n                }\n                else\n                {\n                    return WaitAwaitCallback(out result);\n                }\n            }\n\n            return IterateFinished(out result);\n        }\n\n        protected bool UnwarapTask(UniTask<TAwait> taskResult, out TAwait result)\n        {\n            resultAwaiter = taskResult.GetAwaiter();\n\n            if (resultAwaiter.IsCompleted)\n            {\n                result = resultAwaiter.GetResult();\n                return true;\n            }\n            else\n            {\n                resultAwaiter.SourceOnCompleted(setCurrentCallbackDelegate, this);\n                result = default;\n                return false;\n            }\n        }\n\n        static void MoveNextCallBack(object state)\n        {\n            var self = (AsyncEnumeratorAwaitSelectorBase<TSource, TResult, TAwait>)state;\n            bool result = false;\n            try\n            {\n                (bool waitCallback, bool requireNextIteration) = self.TryMoveNextCore(self.sourceMoveNext.GetResult(), out result);\n\n                if (waitCallback)\n                {\n                    return;\n                }\n\n                if (requireNextIteration)\n                {\n                    self.SourceMoveNext();\n                    return;\n                }\n                else\n                {\n                    self.completionSource.TrySetResult(result);\n                }\n            }\n            catch (Exception ex)\n            {\n                self.completionSource.TrySetException(ex);\n                return;\n            }\n        }\n\n        static void SetCurrentCallBack(object state)\n        {\n            var self = (AsyncEnumeratorAwaitSelectorBase<TSource, TResult, TAwait>)state;\n\n            bool doneSetCurrent;\n            bool terminateIteration;\n            try\n            {\n                var result = self.resultAwaiter.GetResult();\n                doneSetCurrent = self.TrySetCurrentCore(result, out terminateIteration);\n            }\n            catch (Exception ex)\n            {\n                self.completionSource.TrySetException(ex);\n                return;\n            }\n\n            if (self.cancellationToken.IsCancellationRequested)\n            {\n                self.completionSource.TrySetCanceled(self.cancellationToken);\n            }\n            else\n            {\n                if (doneSetCurrent)\n                {\n                    self.completionSource.TrySetResult(true);\n                }\n                else\n                {\n                    if (terminateIteration)\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                    else\n                    {\n                        self.SourceMoveNext();\n                    }\n                }\n            }\n        }\n\n        // if require additional resource to dispose, override and call base.DisposeAsync.\n        public virtual UniTask DisposeAsync()\n        {\n            TaskTracker.RemoveTracking(this);\n            if (enumerator != null)\n            {\n                return enumerator.DisposeAsync();\n            }\n            return default;\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/AsyncEnumeratorBase.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 01ba1d3b17e13fb4c95740131c7e6e19\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Average.cs",
    "content": "﻿using System;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<double> AverageAsync(this IUniTaskAsyncEnumerable<Int32> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Average.AverageAsync(source, cancellationToken);\n        }\n\n        public static UniTask<double> AverageAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<double> AverageAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int32>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<double> AverageAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int32>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<double> AverageAsync(this IUniTaskAsyncEnumerable<Int64> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Average.AverageAsync(source, cancellationToken);\n        }\n\n        public static UniTask<double> AverageAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int64> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<double> AverageAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int64>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<double> AverageAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int64>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<float> AverageAsync(this IUniTaskAsyncEnumerable<Single> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Average.AverageAsync(source, cancellationToken);\n        }\n\n        public static UniTask<float> AverageAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Single> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<float> AverageAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Single>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<float> AverageAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Single>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<double> AverageAsync(this IUniTaskAsyncEnumerable<Double> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Average.AverageAsync(source, cancellationToken);\n        }\n\n        public static UniTask<double> AverageAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Double> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<double> AverageAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Double>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<double> AverageAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Double>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<decimal> AverageAsync(this IUniTaskAsyncEnumerable<Decimal> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Average.AverageAsync(source, cancellationToken);\n        }\n\n        public static UniTask<decimal> AverageAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Decimal> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<decimal> AverageAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Decimal>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<decimal> AverageAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Decimal>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<double?> AverageAsync(this IUniTaskAsyncEnumerable<Int32?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Average.AverageAsync(source, cancellationToken);\n        }\n\n        public static UniTask<double?> AverageAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<double?> AverageAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int32?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<double?> AverageAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int32?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<double?> AverageAsync(this IUniTaskAsyncEnumerable<Int64?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Average.AverageAsync(source, cancellationToken);\n        }\n\n        public static UniTask<double?> AverageAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int64?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<double?> AverageAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int64?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<double?> AverageAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int64?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<float?> AverageAsync(this IUniTaskAsyncEnumerable<Single?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Average.AverageAsync(source, cancellationToken);\n        }\n\n        public static UniTask<float?> AverageAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Single?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<float?> AverageAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Single?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<float?> AverageAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Single?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<double?> AverageAsync(this IUniTaskAsyncEnumerable<Double?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Average.AverageAsync(source, cancellationToken);\n        }\n\n        public static UniTask<double?> AverageAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Double?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<double?> AverageAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Double?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<double?> AverageAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Double?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<decimal?> AverageAsync(this IUniTaskAsyncEnumerable<Decimal?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Average.AverageAsync(source, cancellationToken);\n        }\n\n        public static UniTask<decimal?> AverageAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Decimal?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<decimal?> AverageAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Decimal?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<decimal?> AverageAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Decimal?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n    }\n\n    internal static class Average\n    {\n        public static async UniTask<double> AverageAsync(IUniTaskAsyncEnumerable<Int32> source, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Int32 sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += e.Current;\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (double)sum / count;\n        }\n\n        public static async UniTask<double> AverageAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Int32 sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += selector(e.Current);\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (double)sum / count;\n        }\n\n        public static async UniTask<double> AverageAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int32>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Int32 sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += await selector(e.Current);\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (double)sum / count;\n        }\n\n        public static async UniTask<double> AverageAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int32>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Int32 sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += await selector(e.Current, cancellationToken);\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (double)sum / count;\n        }\n\n        public static async UniTask<double> AverageAsync(IUniTaskAsyncEnumerable<Int64> source, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Int64 sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += e.Current;\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (double)sum / count;\n        }\n\n        public static async UniTask<double> AverageAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int64> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Int64 sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += selector(e.Current);\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (double)sum / count;\n        }\n\n        public static async UniTask<double> AverageAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int64>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Int64 sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += await selector(e.Current);\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (double)sum / count;\n        }\n\n        public static async UniTask<double> AverageAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int64>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Int64 sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += await selector(e.Current, cancellationToken);\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (double)sum / count;\n        }\n\n        public static async UniTask<float> AverageAsync(IUniTaskAsyncEnumerable<Single> source, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Single sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += e.Current;\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (float)(sum / count);\n        }\n\n        public static async UniTask<float> AverageAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Single> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Single sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += selector(e.Current);\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (float)(sum / count);\n        }\n\n        public static async UniTask<float> AverageAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Single>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Single sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += await selector(e.Current);\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (float)(sum / count);\n        }\n\n        public static async UniTask<float> AverageAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Single>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Single sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += await selector(e.Current, cancellationToken);\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (float)(sum / count);\n        }\n\n        public static async UniTask<double> AverageAsync(IUniTaskAsyncEnumerable<Double> source, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Double sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += e.Current;\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum / count;\n        }\n\n        public static async UniTask<double> AverageAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Double> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Double sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += selector(e.Current);\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum / count;\n        }\n\n        public static async UniTask<double> AverageAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Double>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Double sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += await selector(e.Current);\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum / count;\n        }\n\n        public static async UniTask<double> AverageAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Double>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Double sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += await selector(e.Current, cancellationToken);\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum / count;\n        }\n\n        public static async UniTask<decimal> AverageAsync(IUniTaskAsyncEnumerable<Decimal> source, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Decimal sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += e.Current;\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum / count;\n        }\n\n        public static async UniTask<decimal> AverageAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Decimal> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Decimal sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += selector(e.Current);\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum / count;\n        }\n\n        public static async UniTask<decimal> AverageAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Decimal>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Decimal sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += await selector(e.Current);\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum / count;\n        }\n\n        public static async UniTask<decimal> AverageAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Decimal>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Decimal sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked\n                    {\n                        sum += await selector(e.Current, cancellationToken);\n                        count++;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum / count;\n        }\n\n        public static async UniTask<double?> AverageAsync(IUniTaskAsyncEnumerable<Int32?> source, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Int32? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (double)sum / count;\n        }\n\n        public static async UniTask<double?> AverageAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32?> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Int32? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = selector(e.Current);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (double)sum / count;\n        }\n\n        public static async UniTask<double?> AverageAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int32?>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Int32? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = await selector(e.Current);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (double)sum / count;\n        }\n\n        public static async UniTask<double?> AverageAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int32?>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Int32? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = await selector(e.Current, cancellationToken);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (double)sum / count;\n        }\n\n        public static async UniTask<double?> AverageAsync(IUniTaskAsyncEnumerable<Int64?> source, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Int64? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (double)sum / count;\n        }\n\n        public static async UniTask<double?> AverageAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int64?> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Int64? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = selector(e.Current);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (double)sum / count;\n        }\n\n        public static async UniTask<double?> AverageAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int64?>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Int64? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = await selector(e.Current);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (double)sum / count;\n        }\n\n        public static async UniTask<double?> AverageAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int64?>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Int64? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = await selector(e.Current, cancellationToken);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (double)sum / count;\n        }\n\n        public static async UniTask<float?> AverageAsync(IUniTaskAsyncEnumerable<Single?> source, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Single? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (float)(sum / count);\n        }\n\n        public static async UniTask<float?> AverageAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Single?> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Single? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = selector(e.Current);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (float)(sum / count);\n        }\n\n        public static async UniTask<float?> AverageAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Single?>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Single? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = await selector(e.Current);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (float)(sum / count);\n        }\n\n        public static async UniTask<float?> AverageAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Single?>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Single? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = await selector(e.Current, cancellationToken);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return (float)(sum / count);\n        }\n\n        public static async UniTask<double?> AverageAsync(IUniTaskAsyncEnumerable<Double?> source, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Double? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum / count;\n        }\n\n        public static async UniTask<double?> AverageAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Double?> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Double? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = selector(e.Current);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum / count;\n        }\n\n        public static async UniTask<double?> AverageAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Double?>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Double? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = await selector(e.Current);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum / count;\n        }\n\n        public static async UniTask<double?> AverageAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Double?>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Double? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = await selector(e.Current, cancellationToken);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum / count;\n        }\n\n        public static async UniTask<decimal?> AverageAsync(IUniTaskAsyncEnumerable<Decimal?> source, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Decimal? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum / count;\n        }\n\n        public static async UniTask<decimal?> AverageAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Decimal?> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Decimal? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = selector(e.Current);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum / count;\n        }\n\n        public static async UniTask<decimal?> AverageAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Decimal?>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Decimal? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = await selector(e.Current);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum / count;\n        }\n\n        public static async UniTask<decimal?> AverageAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Decimal?>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            Decimal? sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = await selector(e.Current, cancellationToken);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum / count;\n        }\n\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Average.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 58499f95012fb3c47bb7bcbc5862e562\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Average.tt",
    "content": "﻿<#@ template debug=\"false\" hostspecific=\"false\" language=\"C#\" #>\n<#@ assembly name=\"System.Core\" #>\n<#@ import namespace=\"System.Linq\" #>\n<#@ import namespace=\"System.Text\" #>\n<#@ import namespace=\"System.Collections.Generic\" #>\n<#@ output extension=\".cs\" #>\n<#\n    var types = new[]\n    {\n        (typeof(int), \"double\"),\n        (typeof(long), \"double\"),\n        (typeof(float),\"float\"),\n        (typeof(double),\"double\"),\n        (typeof(decimal),\"decimal\"),\n        \n        (typeof(int?),\"double?\"),\n        (typeof(long?),\"double?\"),\n        (typeof(float?),\"float?\"),\n        (typeof(double?),\"double?\"),\n        (typeof(decimal?),\"decimal?\"),\n    };\n\n    Func<Type, bool> IsNullable = x => x.IsGenericType;\n    Func<Type, Type> ElementType = x => IsNullable(x) ? x.GetGenericArguments()[0] : x;\n    Func<Type, string> TypeName = x => IsNullable(x) ? x.GetGenericArguments()[0].Name + \"?\" : x.Name;\n    Func<Type, string> WithSuffix = x => IsNullable(x) ? \".GetValueOrDefault()\" : \"\";\n    Func<Type, string> CalcResult = x => { var e = ElementType(x); return (e == typeof(int) || e == typeof(long)) ? \"(double)sum / count\" : (e == typeof(float)) ? \"(float)(sum / count)\" : \"sum / count\"; };\n#>\nusing System;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n<# foreach(var (t, ret) in types) { #>\n        public static UniTask<<#= ret #>> AverageAsync(this IUniTaskAsyncEnumerable<<#= TypeName(t) #>> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Average.AverageAsync(source, cancellationToken);\n        }\n\n        public static UniTask<<#= ret #>> AverageAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, <#= TypeName(t) #>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<<#= ret #>> AverageAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<<#= TypeName(t) #>>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<<#= ret #>> AverageAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<<#= TypeName(t) #>>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Average.AverageAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n<# } #>\n    }\n\n    internal static class Average\n    {\n<# foreach(var (t, ret) in types) { #>\n        public static async UniTask<<#= ret #>> AverageAsync(IUniTaskAsyncEnumerable<<#= TypeName(t) #>> source, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            <#= TypeName(t) #> sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n<# if (IsNullable(t)) { #>\n                    var v = e.Current;\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n<# } else { #>\n                    checked\n                    {\n                        sum += e.Current;\n                        count++;\n                    }\n<# } #>\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return <#= CalcResult(t) #>;\n        }\n\n        public static async UniTask<<#= ret #>> AverageAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, <#= TypeName(t) #>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            <#= TypeName(t) #> sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n<# if (IsNullable(t)) { #>\n                    var v = selector(e.Current);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n<# } else { #>\n                    checked\n                    {\n                        sum += selector(e.Current);\n                        count++;\n                    }\n<# } #>\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return <#= CalcResult(t) #>;\n        }\n\n        public static async UniTask<<#= ret #>> AverageAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<<#= TypeName(t) #>>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            <#= TypeName(t) #> sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n<# if (IsNullable(t)) { #>\n                    var v = await selector(e.Current);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n<# } else { #>\n                    checked\n                    {\n                        sum += await selector(e.Current);\n                        count++;\n                    }\n<# } #>\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return <#= CalcResult(t) #>;\n        }\n\n        public static async UniTask<<#= ret #>> AverageAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<<#= TypeName(t) #>>> selector, CancellationToken cancellationToken)\n        {\n            long count = 0;\n            <#= TypeName(t) #> sum = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n<# if (IsNullable(t)) { #>\n                    var v = await selector(e.Current, cancellationToken);\n                    if (v.HasValue)\n                    {\n                        checked    \n                        {\n                            sum += v.Value;\n                            count++;\n                        }\n                    }\n<# } else { #>\n                    checked\n                    {\n                        sum += await selector(e.Current, cancellationToken);\n                        count++;\n                    }\n<# } #>\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return <#= CalcResult(t) #>;\n        }\n\n<# } #>\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Average.tt.meta",
    "content": "fileFormatVersion: 2\nguid: 84bce45768c171d4490153eb08630a98\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Buffer.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<IList<TSource>> Buffer<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Int32 count)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            if (count <= 0) throw Error.ArgumentOutOfRange(nameof(count));\n\n            return new Buffer<TSource>(source, count);\n        }\n\n        public static IUniTaskAsyncEnumerable<IList<TSource>> Buffer<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Int32 count, Int32 skip)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            if (count <= 0) throw Error.ArgumentOutOfRange(nameof(count));\n            if (skip <= 0) throw Error.ArgumentOutOfRange(nameof(skip));\n\n            return new BufferSkip<TSource>(source, count, skip);\n        }\n    }\n\n    internal sealed class Buffer<TSource> : IUniTaskAsyncEnumerable<IList<TSource>>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly int count;\n\n        public Buffer(IUniTaskAsyncEnumerable<TSource> source, int count)\n        {\n            this.source = source;\n            this.count = count;\n        }\n\n        public IUniTaskAsyncEnumerator<IList<TSource>> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Buffer(source, count, cancellationToken);\n        }\n\n        sealed class _Buffer : MoveNextSource, IUniTaskAsyncEnumerator<IList<TSource>>\n        {\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly int count;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            bool continueNext;\n\n            bool completed;\n            List<TSource> buffer;\n\n            public _Buffer(IUniTaskAsyncEnumerable<TSource> source, int count, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.count = count;\n                this.cancellationToken = cancellationToken;\n\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public IList<TSource> Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                if (enumerator == null)\n                {\n                    enumerator = source.GetAsyncEnumerator(cancellationToken);\n                    buffer = new List<TSource>(count);\n                }\n\n                completionSource.Reset();\n                SourceMoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void SourceMoveNext()\n            {\n                if (completed)\n                {\n                    if (buffer != null && buffer.Count > 0)\n                    {\n                        var ret = buffer;\n                        buffer = null;\n                        Current = ret;\n                        completionSource.TrySetResult(true);\n                        return;\n                    }\n                    else\n                    {\n                        completionSource.TrySetResult(false);\n                        return;\n                    }\n                }\n\n                try\n                {\n\n                    LOOP:\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        continueNext = true;\n                        MoveNextCore(this);\n                        if (continueNext)\n                        {\n                            continueNext = false;\n                            goto LOOP; // avoid recursive\n                        }\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                }\n            }\n\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_Buffer)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        self.buffer.Add(self.enumerator.Current);\n\n                        if (self.buffer.Count == self.count)\n                        {\n                            self.Current = self.buffer;\n                            self.buffer = new List<TSource>(self.count);\n                            self.continueNext = false;\n                            self.completionSource.TrySetResult(true);\n                            return;\n                        }\n                        else\n                        {\n                            if (!self.continueNext)\n                            {\n                                self.SourceMoveNext();\n                            }\n                        }\n                    }\n                    else\n                    {\n                        self.continueNext = false;\n                        self.completed = true;\n                        self.SourceMoveNext();\n                    }\n                }\n                else\n                {\n                    self.continueNext = false;\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n                return default;\n            }\n        }\n    }\n\n    internal sealed class BufferSkip<TSource> : IUniTaskAsyncEnumerable<IList<TSource>>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly int count;\n        readonly int skip;\n\n        public BufferSkip(IUniTaskAsyncEnumerable<TSource> source, int count, int skip)\n        {\n            this.source = source;\n            this.count = count;\n            this.skip = skip;\n        }\n\n        public IUniTaskAsyncEnumerator<IList<TSource>> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _BufferSkip(source, count, skip, cancellationToken);\n        }\n\n        sealed class _BufferSkip : MoveNextSource, IUniTaskAsyncEnumerator<IList<TSource>>\n        {\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly int count;\n            readonly int skip;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            bool continueNext;\n\n            bool completed;\n            Queue<List<TSource>> buffers;\n            int index = 0;\n\n            public _BufferSkip(IUniTaskAsyncEnumerable<TSource> source, int count, int skip, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.count = count;\n                this.skip = skip;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public IList<TSource> Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                if (enumerator == null)\n                {\n                    enumerator = source.GetAsyncEnumerator(cancellationToken);\n                    buffers = new Queue<List<TSource>>();\n                }\n\n                completionSource.Reset();\n                SourceMoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void SourceMoveNext()\n            {\n                if (completed)\n                {\n                    if (buffers.Count > 0)\n                    {\n                        Current = buffers.Dequeue();\n                        completionSource.TrySetResult(true);\n                        return;\n                    }\n                    else\n                    {\n                        completionSource.TrySetResult(false);\n                        return;\n                    }\n                }\n\n                try\n                {\n\n                    LOOP:\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        continueNext = true;\n                        MoveNextCore(this);\n                        if (continueNext)\n                        {\n                            continueNext = false;\n                            goto LOOP; // avoid recursive\n                        }\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                }\n            }\n\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_BufferSkip)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        if (self.index++ % self.skip == 0)\n                        {\n                            self.buffers.Enqueue(new List<TSource>(self.count));\n                        }\n\n                        var item = self.enumerator.Current;\n                        foreach (var buffer in self.buffers)\n                        {\n                            buffer.Add(item);\n                        }\n\n                        if (self.buffers.Count > 0 && self.buffers.Peek().Count == self.count)\n                        {\n                            self.Current = self.buffers.Dequeue();\n                            self.continueNext = false;\n                            self.completionSource.TrySetResult(true);\n                            return;\n                        }\n                        else\n                        {\n                            if (!self.continueNext)\n                            {\n                                self.SourceMoveNext();\n                            }\n                        }\n                    }\n                    else\n                    {\n                        self.continueNext = false;\n                        self.completed = true;\n                        self.SourceMoveNext();\n                    }\n                }\n                else\n                {\n                    self.continueNext = false;\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Buffer.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 951310243334a3148a7872977cb31c5c\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Cast.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TResult> Cast<TResult>(this IUniTaskAsyncEnumerable<Object> source)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new Cast<TResult>(source);\n        }\n    }\n\n    internal sealed class Cast<TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<object> source;\n\n        public Cast(IUniTaskAsyncEnumerable<object> source)\n        {\n            this.source = source;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Cast(source, cancellationToken);\n        }\n\n        class _Cast : AsyncEnumeratorBase<object, TResult>\n        {\n            public _Cast(IUniTaskAsyncEnumerable<object> source, CancellationToken cancellationToken)\n\n                : base(source, cancellationToken)\n            {\n            }\n\n            protected override bool TryMoveNextCore(bool sourceHasCurrent, out bool result)\n            {\n                if (sourceHasCurrent)\n                {\n                    Current = (TResult)SourceCurrent;\n                    result = true;\n                    return true;\n                }\n\n                result = false;\n                return true;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Cast.cs.meta",
    "content": "fileFormatVersion: 2\nguid: edebeae8b61352b428abe9ce8f3fc71a\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/CombineLatest.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TResult> CombineLatest<T1, T2, TResult>(this IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, Func<T1, T2, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source1, nameof(source1));\n            Error.ThrowArgumentNullException(source2, nameof(source2));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new CombineLatest<T1, T2, TResult>(source1, source2, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> CombineLatest<T1, T2, T3, TResult>(this IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, Func<T1, T2, T3, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source1, nameof(source1));\n            Error.ThrowArgumentNullException(source2, nameof(source2));\n            Error.ThrowArgumentNullException(source3, nameof(source3));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new CombineLatest<T1, T2, T3, TResult>(source1, source2, source3, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> CombineLatest<T1, T2, T3, T4, TResult>(this IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, Func<T1, T2, T3, T4, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source1, nameof(source1));\n            Error.ThrowArgumentNullException(source2, nameof(source2));\n            Error.ThrowArgumentNullException(source3, nameof(source3));\n            Error.ThrowArgumentNullException(source4, nameof(source4));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new CombineLatest<T1, T2, T3, T4, TResult>(source1, source2, source3, source4, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> CombineLatest<T1, T2, T3, T4, T5, TResult>(this IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, Func<T1, T2, T3, T4, T5, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source1, nameof(source1));\n            Error.ThrowArgumentNullException(source2, nameof(source2));\n            Error.ThrowArgumentNullException(source3, nameof(source3));\n            Error.ThrowArgumentNullException(source4, nameof(source4));\n            Error.ThrowArgumentNullException(source5, nameof(source5));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new CombineLatest<T1, T2, T3, T4, T5, TResult>(source1, source2, source3, source4, source5, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, TResult>(this IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, Func<T1, T2, T3, T4, T5, T6, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source1, nameof(source1));\n            Error.ThrowArgumentNullException(source2, nameof(source2));\n            Error.ThrowArgumentNullException(source3, nameof(source3));\n            Error.ThrowArgumentNullException(source4, nameof(source4));\n            Error.ThrowArgumentNullException(source5, nameof(source5));\n            Error.ThrowArgumentNullException(source6, nameof(source6));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new CombineLatest<T1, T2, T3, T4, T5, T6, TResult>(source1, source2, source3, source4, source5, source6, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, TResult>(this IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, Func<T1, T2, T3, T4, T5, T6, T7, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source1, nameof(source1));\n            Error.ThrowArgumentNullException(source2, nameof(source2));\n            Error.ThrowArgumentNullException(source3, nameof(source3));\n            Error.ThrowArgumentNullException(source4, nameof(source4));\n            Error.ThrowArgumentNullException(source5, nameof(source5));\n            Error.ThrowArgumentNullException(source6, nameof(source6));\n            Error.ThrowArgumentNullException(source7, nameof(source7));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new CombineLatest<T1, T2, T3, T4, T5, T6, T7, TResult>(source1, source2, source3, source4, source5, source6, source7, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(this IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source1, nameof(source1));\n            Error.ThrowArgumentNullException(source2, nameof(source2));\n            Error.ThrowArgumentNullException(source3, nameof(source3));\n            Error.ThrowArgumentNullException(source4, nameof(source4));\n            Error.ThrowArgumentNullException(source5, nameof(source5));\n            Error.ThrowArgumentNullException(source6, nameof(source6));\n            Error.ThrowArgumentNullException(source7, nameof(source7));\n            Error.ThrowArgumentNullException(source8, nameof(source8));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(this IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source1, nameof(source1));\n            Error.ThrowArgumentNullException(source2, nameof(source2));\n            Error.ThrowArgumentNullException(source3, nameof(source3));\n            Error.ThrowArgumentNullException(source4, nameof(source4));\n            Error.ThrowArgumentNullException(source5, nameof(source5));\n            Error.ThrowArgumentNullException(source6, nameof(source6));\n            Error.ThrowArgumentNullException(source7, nameof(source7));\n            Error.ThrowArgumentNullException(source8, nameof(source8));\n            Error.ThrowArgumentNullException(source9, nameof(source9));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(this IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source1, nameof(source1));\n            Error.ThrowArgumentNullException(source2, nameof(source2));\n            Error.ThrowArgumentNullException(source3, nameof(source3));\n            Error.ThrowArgumentNullException(source4, nameof(source4));\n            Error.ThrowArgumentNullException(source5, nameof(source5));\n            Error.ThrowArgumentNullException(source6, nameof(source6));\n            Error.ThrowArgumentNullException(source7, nameof(source7));\n            Error.ThrowArgumentNullException(source8, nameof(source8));\n            Error.ThrowArgumentNullException(source9, nameof(source9));\n            Error.ThrowArgumentNullException(source10, nameof(source10));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(this IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, IUniTaskAsyncEnumerable<T11> source11, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source1, nameof(source1));\n            Error.ThrowArgumentNullException(source2, nameof(source2));\n            Error.ThrowArgumentNullException(source3, nameof(source3));\n            Error.ThrowArgumentNullException(source4, nameof(source4));\n            Error.ThrowArgumentNullException(source5, nameof(source5));\n            Error.ThrowArgumentNullException(source6, nameof(source6));\n            Error.ThrowArgumentNullException(source7, nameof(source7));\n            Error.ThrowArgumentNullException(source8, nameof(source8));\n            Error.ThrowArgumentNullException(source9, nameof(source9));\n            Error.ThrowArgumentNullException(source10, nameof(source10));\n            Error.ThrowArgumentNullException(source11, nameof(source11));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(this IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, IUniTaskAsyncEnumerable<T11> source11, IUniTaskAsyncEnumerable<T12> source12, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source1, nameof(source1));\n            Error.ThrowArgumentNullException(source2, nameof(source2));\n            Error.ThrowArgumentNullException(source3, nameof(source3));\n            Error.ThrowArgumentNullException(source4, nameof(source4));\n            Error.ThrowArgumentNullException(source5, nameof(source5));\n            Error.ThrowArgumentNullException(source6, nameof(source6));\n            Error.ThrowArgumentNullException(source7, nameof(source7));\n            Error.ThrowArgumentNullException(source8, nameof(source8));\n            Error.ThrowArgumentNullException(source9, nameof(source9));\n            Error.ThrowArgumentNullException(source10, nameof(source10));\n            Error.ThrowArgumentNullException(source11, nameof(source11));\n            Error.ThrowArgumentNullException(source12, nameof(source12));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(this IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, IUniTaskAsyncEnumerable<T11> source11, IUniTaskAsyncEnumerable<T12> source12, IUniTaskAsyncEnumerable<T13> source13, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source1, nameof(source1));\n            Error.ThrowArgumentNullException(source2, nameof(source2));\n            Error.ThrowArgumentNullException(source3, nameof(source3));\n            Error.ThrowArgumentNullException(source4, nameof(source4));\n            Error.ThrowArgumentNullException(source5, nameof(source5));\n            Error.ThrowArgumentNullException(source6, nameof(source6));\n            Error.ThrowArgumentNullException(source7, nameof(source7));\n            Error.ThrowArgumentNullException(source8, nameof(source8));\n            Error.ThrowArgumentNullException(source9, nameof(source9));\n            Error.ThrowArgumentNullException(source10, nameof(source10));\n            Error.ThrowArgumentNullException(source11, nameof(source11));\n            Error.ThrowArgumentNullException(source12, nameof(source12));\n            Error.ThrowArgumentNullException(source13, nameof(source13));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(this IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, IUniTaskAsyncEnumerable<T11> source11, IUniTaskAsyncEnumerable<T12> source12, IUniTaskAsyncEnumerable<T13> source13, IUniTaskAsyncEnumerable<T14> source14, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source1, nameof(source1));\n            Error.ThrowArgumentNullException(source2, nameof(source2));\n            Error.ThrowArgumentNullException(source3, nameof(source3));\n            Error.ThrowArgumentNullException(source4, nameof(source4));\n            Error.ThrowArgumentNullException(source5, nameof(source5));\n            Error.ThrowArgumentNullException(source6, nameof(source6));\n            Error.ThrowArgumentNullException(source7, nameof(source7));\n            Error.ThrowArgumentNullException(source8, nameof(source8));\n            Error.ThrowArgumentNullException(source9, nameof(source9));\n            Error.ThrowArgumentNullException(source10, nameof(source10));\n            Error.ThrowArgumentNullException(source11, nameof(source11));\n            Error.ThrowArgumentNullException(source12, nameof(source12));\n            Error.ThrowArgumentNullException(source13, nameof(source13));\n            Error.ThrowArgumentNullException(source14, nameof(source14));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(this IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, IUniTaskAsyncEnumerable<T11> source11, IUniTaskAsyncEnumerable<T12> source12, IUniTaskAsyncEnumerable<T13> source13, IUniTaskAsyncEnumerable<T14> source14, IUniTaskAsyncEnumerable<T15> source15, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source1, nameof(source1));\n            Error.ThrowArgumentNullException(source2, nameof(source2));\n            Error.ThrowArgumentNullException(source3, nameof(source3));\n            Error.ThrowArgumentNullException(source4, nameof(source4));\n            Error.ThrowArgumentNullException(source5, nameof(source5));\n            Error.ThrowArgumentNullException(source6, nameof(source6));\n            Error.ThrowArgumentNullException(source7, nameof(source7));\n            Error.ThrowArgumentNullException(source8, nameof(source8));\n            Error.ThrowArgumentNullException(source9, nameof(source9));\n            Error.ThrowArgumentNullException(source10, nameof(source10));\n            Error.ThrowArgumentNullException(source11, nameof(source11));\n            Error.ThrowArgumentNullException(source12, nameof(source12));\n            Error.ThrowArgumentNullException(source13, nameof(source13));\n            Error.ThrowArgumentNullException(source14, nameof(source14));\n            Error.ThrowArgumentNullException(source15, nameof(source15));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, source15, resultSelector);\n        }\n\n    }\n\n    internal class CombineLatest<T1, T2, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<T1> source1;\n        readonly IUniTaskAsyncEnumerable<T2> source2;\n        \n        readonly Func<T1, T2, TResult> resultSelector;\n\n        public CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, Func<T1, T2, TResult> resultSelector)\n        {\n            this.source1 = source1;\n            this.source2 = source2;\n        \n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _CombineLatest(source1, source2, resultSelector, cancellationToken);\n        }\n\n        class _CombineLatest : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> Completed1Delegate = Completed1;\n            static readonly Action<object> Completed2Delegate = Completed2;\n            const int CompleteCount = 2;\n\n            readonly IUniTaskAsyncEnumerable<T1> source1;\n            readonly IUniTaskAsyncEnumerable<T2> source2;\n       \n            readonly Func<T1, T2, TResult> resultSelector;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<T1> enumerator1;\n            UniTask<bool>.Awaiter awaiter1;\n            bool hasCurrent1;\n            bool running1;\n            T1 current1;\n\n            IUniTaskAsyncEnumerator<T2> enumerator2;\n            UniTask<bool>.Awaiter awaiter2;\n            bool hasCurrent2;\n            bool running2;\n            T2 current2;\n\n            int completedCount;\n            bool syncRunning;\n            TResult result;\n\n            public _CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, Func<T1, T2, TResult> resultSelector, CancellationToken cancellationToken)\n            {\n                this.source1 = source1;\n                this.source2 = source2;\n                \n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current => result;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                if (completedCount == CompleteCount) return CompletedTasks.False;\n\n                if (enumerator1 == null)\n                {\n                    enumerator1 = source1.GetAsyncEnumerator(cancellationToken);\n                    enumerator2 = source2.GetAsyncEnumerator(cancellationToken);\n                }\n\n                completionSource.Reset();\n\n                AGAIN:\n                syncRunning = true;\n                if (!running1)\n                {\n                    running1 = true;\n                    awaiter1 = enumerator1.MoveNextAsync().GetAwaiter();\n                    if (awaiter1.IsCompleted)\n                    {\n                        Completed1(this);\n                    }\n                    else\n                    {\n                        awaiter1.SourceOnCompleted(Completed1Delegate, this);\n                    }\n                }\n                if (!running2)\n                {\n                    running2 = true;\n                    awaiter2 = enumerator2.MoveNextAsync().GetAwaiter();\n                    if (awaiter2.IsCompleted)\n                    {\n                        Completed2(this);\n                    }\n                    else\n                    {\n                        awaiter2.SourceOnCompleted(Completed2Delegate, this);\n                    }\n                }\n\n                if (!running1 || !running2)\n                {\n                    goto AGAIN;\n                }\n                syncRunning = false;\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void Completed1(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running1 = false;\n\n                try\n                {\n                    if (self.awaiter1.GetResult())\n                    {\n                        self.hasCurrent1 = true;\n                        self.current1 = self.enumerator1.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running1 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter1 = self.enumerator1.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter1.SourceOnCompleted(Completed1Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed2(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running2 = false;\n\n                try\n                {\n                    if (self.awaiter2.GetResult())\n                    {\n                        self.hasCurrent2 = true;\n                        self.current2 = self.enumerator2.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running2 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter2 = self.enumerator2.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter2.SourceOnCompleted(Completed2Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            bool TrySetResult()\n            {\n                if (hasCurrent1 && hasCurrent2)\n                {\n                    result = resultSelector(current1, current2);\n                    completionSource.TrySetResult(true);\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator1 != null)\n                {\n                    await enumerator1.DisposeAsync();\n                }\n                if (enumerator2 != null)\n                {\n                    await enumerator2.DisposeAsync();\n                }\n            }\n        }\n    }\n\n    internal class CombineLatest<T1, T2, T3, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<T1> source1;\n        readonly IUniTaskAsyncEnumerable<T2> source2;\n        readonly IUniTaskAsyncEnumerable<T3> source3;\n        \n        readonly Func<T1, T2, T3, TResult> resultSelector;\n\n        public CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, Func<T1, T2, T3, TResult> resultSelector)\n        {\n            this.source1 = source1;\n            this.source2 = source2;\n            this.source3 = source3;\n        \n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _CombineLatest(source1, source2, source3, resultSelector, cancellationToken);\n        }\n\n        class _CombineLatest : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> Completed1Delegate = Completed1;\n            static readonly Action<object> Completed2Delegate = Completed2;\n            static readonly Action<object> Completed3Delegate = Completed3;\n            const int CompleteCount = 3;\n\n            readonly IUniTaskAsyncEnumerable<T1> source1;\n            readonly IUniTaskAsyncEnumerable<T2> source2;\n            readonly IUniTaskAsyncEnumerable<T3> source3;\n       \n            readonly Func<T1, T2, T3, TResult> resultSelector;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<T1> enumerator1;\n            UniTask<bool>.Awaiter awaiter1;\n            bool hasCurrent1;\n            bool running1;\n            T1 current1;\n\n            IUniTaskAsyncEnumerator<T2> enumerator2;\n            UniTask<bool>.Awaiter awaiter2;\n            bool hasCurrent2;\n            bool running2;\n            T2 current2;\n\n            IUniTaskAsyncEnumerator<T3> enumerator3;\n            UniTask<bool>.Awaiter awaiter3;\n            bool hasCurrent3;\n            bool running3;\n            T3 current3;\n\n            int completedCount;\n            bool syncRunning;\n            TResult result;\n\n            public _CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, Func<T1, T2, T3, TResult> resultSelector, CancellationToken cancellationToken)\n            {\n                this.source1 = source1;\n                this.source2 = source2;\n                this.source3 = source3;\n                \n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current => result;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                if (completedCount == CompleteCount) return CompletedTasks.False;\n\n                if (enumerator1 == null)\n                {\n                    enumerator1 = source1.GetAsyncEnumerator(cancellationToken);\n                    enumerator2 = source2.GetAsyncEnumerator(cancellationToken);\n                    enumerator3 = source3.GetAsyncEnumerator(cancellationToken);\n                }\n\n                completionSource.Reset();\n\n                AGAIN:\n                syncRunning = true;\n                if (!running1)\n                {\n                    running1 = true;\n                    awaiter1 = enumerator1.MoveNextAsync().GetAwaiter();\n                    if (awaiter1.IsCompleted)\n                    {\n                        Completed1(this);\n                    }\n                    else\n                    {\n                        awaiter1.SourceOnCompleted(Completed1Delegate, this);\n                    }\n                }\n                if (!running2)\n                {\n                    running2 = true;\n                    awaiter2 = enumerator2.MoveNextAsync().GetAwaiter();\n                    if (awaiter2.IsCompleted)\n                    {\n                        Completed2(this);\n                    }\n                    else\n                    {\n                        awaiter2.SourceOnCompleted(Completed2Delegate, this);\n                    }\n                }\n                if (!running3)\n                {\n                    running3 = true;\n                    awaiter3 = enumerator3.MoveNextAsync().GetAwaiter();\n                    if (awaiter3.IsCompleted)\n                    {\n                        Completed3(this);\n                    }\n                    else\n                    {\n                        awaiter3.SourceOnCompleted(Completed3Delegate, this);\n                    }\n                }\n\n                if (!running1 || !running2 || !running3)\n                {\n                    goto AGAIN;\n                }\n                syncRunning = false;\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void Completed1(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running1 = false;\n\n                try\n                {\n                    if (self.awaiter1.GetResult())\n                    {\n                        self.hasCurrent1 = true;\n                        self.current1 = self.enumerator1.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running1 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter1 = self.enumerator1.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter1.SourceOnCompleted(Completed1Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed2(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running2 = false;\n\n                try\n                {\n                    if (self.awaiter2.GetResult())\n                    {\n                        self.hasCurrent2 = true;\n                        self.current2 = self.enumerator2.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running2 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter2 = self.enumerator2.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter2.SourceOnCompleted(Completed2Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed3(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running3 = false;\n\n                try\n                {\n                    if (self.awaiter3.GetResult())\n                    {\n                        self.hasCurrent3 = true;\n                        self.current3 = self.enumerator3.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running3 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter3 = self.enumerator3.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter3.SourceOnCompleted(Completed3Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            bool TrySetResult()\n            {\n                if (hasCurrent1 && hasCurrent2 && hasCurrent3)\n                {\n                    result = resultSelector(current1, current2, current3);\n                    completionSource.TrySetResult(true);\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator1 != null)\n                {\n                    await enumerator1.DisposeAsync();\n                }\n                if (enumerator2 != null)\n                {\n                    await enumerator2.DisposeAsync();\n                }\n                if (enumerator3 != null)\n                {\n                    await enumerator3.DisposeAsync();\n                }\n            }\n        }\n    }\n\n    internal class CombineLatest<T1, T2, T3, T4, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<T1> source1;\n        readonly IUniTaskAsyncEnumerable<T2> source2;\n        readonly IUniTaskAsyncEnumerable<T3> source3;\n        readonly IUniTaskAsyncEnumerable<T4> source4;\n        \n        readonly Func<T1, T2, T3, T4, TResult> resultSelector;\n\n        public CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, Func<T1, T2, T3, T4, TResult> resultSelector)\n        {\n            this.source1 = source1;\n            this.source2 = source2;\n            this.source3 = source3;\n            this.source4 = source4;\n        \n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _CombineLatest(source1, source2, source3, source4, resultSelector, cancellationToken);\n        }\n\n        class _CombineLatest : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> Completed1Delegate = Completed1;\n            static readonly Action<object> Completed2Delegate = Completed2;\n            static readonly Action<object> Completed3Delegate = Completed3;\n            static readonly Action<object> Completed4Delegate = Completed4;\n            const int CompleteCount = 4;\n\n            readonly IUniTaskAsyncEnumerable<T1> source1;\n            readonly IUniTaskAsyncEnumerable<T2> source2;\n            readonly IUniTaskAsyncEnumerable<T3> source3;\n            readonly IUniTaskAsyncEnumerable<T4> source4;\n       \n            readonly Func<T1, T2, T3, T4, TResult> resultSelector;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<T1> enumerator1;\n            UniTask<bool>.Awaiter awaiter1;\n            bool hasCurrent1;\n            bool running1;\n            T1 current1;\n\n            IUniTaskAsyncEnumerator<T2> enumerator2;\n            UniTask<bool>.Awaiter awaiter2;\n            bool hasCurrent2;\n            bool running2;\n            T2 current2;\n\n            IUniTaskAsyncEnumerator<T3> enumerator3;\n            UniTask<bool>.Awaiter awaiter3;\n            bool hasCurrent3;\n            bool running3;\n            T3 current3;\n\n            IUniTaskAsyncEnumerator<T4> enumerator4;\n            UniTask<bool>.Awaiter awaiter4;\n            bool hasCurrent4;\n            bool running4;\n            T4 current4;\n\n            int completedCount;\n            bool syncRunning;\n            TResult result;\n\n            public _CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, Func<T1, T2, T3, T4, TResult> resultSelector, CancellationToken cancellationToken)\n            {\n                this.source1 = source1;\n                this.source2 = source2;\n                this.source3 = source3;\n                this.source4 = source4;\n                \n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current => result;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                if (completedCount == CompleteCount) return CompletedTasks.False;\n\n                if (enumerator1 == null)\n                {\n                    enumerator1 = source1.GetAsyncEnumerator(cancellationToken);\n                    enumerator2 = source2.GetAsyncEnumerator(cancellationToken);\n                    enumerator3 = source3.GetAsyncEnumerator(cancellationToken);\n                    enumerator4 = source4.GetAsyncEnumerator(cancellationToken);\n                }\n\n                completionSource.Reset();\n\n                AGAIN:\n                syncRunning = true;\n                if (!running1)\n                {\n                    running1 = true;\n                    awaiter1 = enumerator1.MoveNextAsync().GetAwaiter();\n                    if (awaiter1.IsCompleted)\n                    {\n                        Completed1(this);\n                    }\n                    else\n                    {\n                        awaiter1.SourceOnCompleted(Completed1Delegate, this);\n                    }\n                }\n                if (!running2)\n                {\n                    running2 = true;\n                    awaiter2 = enumerator2.MoveNextAsync().GetAwaiter();\n                    if (awaiter2.IsCompleted)\n                    {\n                        Completed2(this);\n                    }\n                    else\n                    {\n                        awaiter2.SourceOnCompleted(Completed2Delegate, this);\n                    }\n                }\n                if (!running3)\n                {\n                    running3 = true;\n                    awaiter3 = enumerator3.MoveNextAsync().GetAwaiter();\n                    if (awaiter3.IsCompleted)\n                    {\n                        Completed3(this);\n                    }\n                    else\n                    {\n                        awaiter3.SourceOnCompleted(Completed3Delegate, this);\n                    }\n                }\n                if (!running4)\n                {\n                    running4 = true;\n                    awaiter4 = enumerator4.MoveNextAsync().GetAwaiter();\n                    if (awaiter4.IsCompleted)\n                    {\n                        Completed4(this);\n                    }\n                    else\n                    {\n                        awaiter4.SourceOnCompleted(Completed4Delegate, this);\n                    }\n                }\n\n                if (!running1 || !running2 || !running3 || !running4)\n                {\n                    goto AGAIN;\n                }\n                syncRunning = false;\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void Completed1(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running1 = false;\n\n                try\n                {\n                    if (self.awaiter1.GetResult())\n                    {\n                        self.hasCurrent1 = true;\n                        self.current1 = self.enumerator1.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running1 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter1 = self.enumerator1.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter1.SourceOnCompleted(Completed1Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed2(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running2 = false;\n\n                try\n                {\n                    if (self.awaiter2.GetResult())\n                    {\n                        self.hasCurrent2 = true;\n                        self.current2 = self.enumerator2.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running2 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter2 = self.enumerator2.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter2.SourceOnCompleted(Completed2Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed3(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running3 = false;\n\n                try\n                {\n                    if (self.awaiter3.GetResult())\n                    {\n                        self.hasCurrent3 = true;\n                        self.current3 = self.enumerator3.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running3 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter3 = self.enumerator3.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter3.SourceOnCompleted(Completed3Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed4(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running4 = false;\n\n                try\n                {\n                    if (self.awaiter4.GetResult())\n                    {\n                        self.hasCurrent4 = true;\n                        self.current4 = self.enumerator4.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running4 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter4 = self.enumerator4.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter4.SourceOnCompleted(Completed4Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            bool TrySetResult()\n            {\n                if (hasCurrent1 && hasCurrent2 && hasCurrent3 && hasCurrent4)\n                {\n                    result = resultSelector(current1, current2, current3, current4);\n                    completionSource.TrySetResult(true);\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator1 != null)\n                {\n                    await enumerator1.DisposeAsync();\n                }\n                if (enumerator2 != null)\n                {\n                    await enumerator2.DisposeAsync();\n                }\n                if (enumerator3 != null)\n                {\n                    await enumerator3.DisposeAsync();\n                }\n                if (enumerator4 != null)\n                {\n                    await enumerator4.DisposeAsync();\n                }\n            }\n        }\n    }\n\n    internal class CombineLatest<T1, T2, T3, T4, T5, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<T1> source1;\n        readonly IUniTaskAsyncEnumerable<T2> source2;\n        readonly IUniTaskAsyncEnumerable<T3> source3;\n        readonly IUniTaskAsyncEnumerable<T4> source4;\n        readonly IUniTaskAsyncEnumerable<T5> source5;\n        \n        readonly Func<T1, T2, T3, T4, T5, TResult> resultSelector;\n\n        public CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, Func<T1, T2, T3, T4, T5, TResult> resultSelector)\n        {\n            this.source1 = source1;\n            this.source2 = source2;\n            this.source3 = source3;\n            this.source4 = source4;\n            this.source5 = source5;\n        \n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _CombineLatest(source1, source2, source3, source4, source5, resultSelector, cancellationToken);\n        }\n\n        class _CombineLatest : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> Completed1Delegate = Completed1;\n            static readonly Action<object> Completed2Delegate = Completed2;\n            static readonly Action<object> Completed3Delegate = Completed3;\n            static readonly Action<object> Completed4Delegate = Completed4;\n            static readonly Action<object> Completed5Delegate = Completed5;\n            const int CompleteCount = 5;\n\n            readonly IUniTaskAsyncEnumerable<T1> source1;\n            readonly IUniTaskAsyncEnumerable<T2> source2;\n            readonly IUniTaskAsyncEnumerable<T3> source3;\n            readonly IUniTaskAsyncEnumerable<T4> source4;\n            readonly IUniTaskAsyncEnumerable<T5> source5;\n       \n            readonly Func<T1, T2, T3, T4, T5, TResult> resultSelector;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<T1> enumerator1;\n            UniTask<bool>.Awaiter awaiter1;\n            bool hasCurrent1;\n            bool running1;\n            T1 current1;\n\n            IUniTaskAsyncEnumerator<T2> enumerator2;\n            UniTask<bool>.Awaiter awaiter2;\n            bool hasCurrent2;\n            bool running2;\n            T2 current2;\n\n            IUniTaskAsyncEnumerator<T3> enumerator3;\n            UniTask<bool>.Awaiter awaiter3;\n            bool hasCurrent3;\n            bool running3;\n            T3 current3;\n\n            IUniTaskAsyncEnumerator<T4> enumerator4;\n            UniTask<bool>.Awaiter awaiter4;\n            bool hasCurrent4;\n            bool running4;\n            T4 current4;\n\n            IUniTaskAsyncEnumerator<T5> enumerator5;\n            UniTask<bool>.Awaiter awaiter5;\n            bool hasCurrent5;\n            bool running5;\n            T5 current5;\n\n            int completedCount;\n            bool syncRunning;\n            TResult result;\n\n            public _CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, Func<T1, T2, T3, T4, T5, TResult> resultSelector, CancellationToken cancellationToken)\n            {\n                this.source1 = source1;\n                this.source2 = source2;\n                this.source3 = source3;\n                this.source4 = source4;\n                this.source5 = source5;\n                \n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current => result;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                if (completedCount == CompleteCount) return CompletedTasks.False;\n\n                if (enumerator1 == null)\n                {\n                    enumerator1 = source1.GetAsyncEnumerator(cancellationToken);\n                    enumerator2 = source2.GetAsyncEnumerator(cancellationToken);\n                    enumerator3 = source3.GetAsyncEnumerator(cancellationToken);\n                    enumerator4 = source4.GetAsyncEnumerator(cancellationToken);\n                    enumerator5 = source5.GetAsyncEnumerator(cancellationToken);\n                }\n\n                completionSource.Reset();\n\n                AGAIN:\n                syncRunning = true;\n                if (!running1)\n                {\n                    running1 = true;\n                    awaiter1 = enumerator1.MoveNextAsync().GetAwaiter();\n                    if (awaiter1.IsCompleted)\n                    {\n                        Completed1(this);\n                    }\n                    else\n                    {\n                        awaiter1.SourceOnCompleted(Completed1Delegate, this);\n                    }\n                }\n                if (!running2)\n                {\n                    running2 = true;\n                    awaiter2 = enumerator2.MoveNextAsync().GetAwaiter();\n                    if (awaiter2.IsCompleted)\n                    {\n                        Completed2(this);\n                    }\n                    else\n                    {\n                        awaiter2.SourceOnCompleted(Completed2Delegate, this);\n                    }\n                }\n                if (!running3)\n                {\n                    running3 = true;\n                    awaiter3 = enumerator3.MoveNextAsync().GetAwaiter();\n                    if (awaiter3.IsCompleted)\n                    {\n                        Completed3(this);\n                    }\n                    else\n                    {\n                        awaiter3.SourceOnCompleted(Completed3Delegate, this);\n                    }\n                }\n                if (!running4)\n                {\n                    running4 = true;\n                    awaiter4 = enumerator4.MoveNextAsync().GetAwaiter();\n                    if (awaiter4.IsCompleted)\n                    {\n                        Completed4(this);\n                    }\n                    else\n                    {\n                        awaiter4.SourceOnCompleted(Completed4Delegate, this);\n                    }\n                }\n                if (!running5)\n                {\n                    running5 = true;\n                    awaiter5 = enumerator5.MoveNextAsync().GetAwaiter();\n                    if (awaiter5.IsCompleted)\n                    {\n                        Completed5(this);\n                    }\n                    else\n                    {\n                        awaiter5.SourceOnCompleted(Completed5Delegate, this);\n                    }\n                }\n\n                if (!running1 || !running2 || !running3 || !running4 || !running5)\n                {\n                    goto AGAIN;\n                }\n                syncRunning = false;\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void Completed1(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running1 = false;\n\n                try\n                {\n                    if (self.awaiter1.GetResult())\n                    {\n                        self.hasCurrent1 = true;\n                        self.current1 = self.enumerator1.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running1 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter1 = self.enumerator1.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter1.SourceOnCompleted(Completed1Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed2(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running2 = false;\n\n                try\n                {\n                    if (self.awaiter2.GetResult())\n                    {\n                        self.hasCurrent2 = true;\n                        self.current2 = self.enumerator2.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running2 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter2 = self.enumerator2.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter2.SourceOnCompleted(Completed2Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed3(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running3 = false;\n\n                try\n                {\n                    if (self.awaiter3.GetResult())\n                    {\n                        self.hasCurrent3 = true;\n                        self.current3 = self.enumerator3.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running3 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter3 = self.enumerator3.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter3.SourceOnCompleted(Completed3Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed4(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running4 = false;\n\n                try\n                {\n                    if (self.awaiter4.GetResult())\n                    {\n                        self.hasCurrent4 = true;\n                        self.current4 = self.enumerator4.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running4 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter4 = self.enumerator4.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter4.SourceOnCompleted(Completed4Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed5(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running5 = false;\n\n                try\n                {\n                    if (self.awaiter5.GetResult())\n                    {\n                        self.hasCurrent5 = true;\n                        self.current5 = self.enumerator5.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running5 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter5 = self.enumerator5.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter5.SourceOnCompleted(Completed5Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            bool TrySetResult()\n            {\n                if (hasCurrent1 && hasCurrent2 && hasCurrent3 && hasCurrent4 && hasCurrent5)\n                {\n                    result = resultSelector(current1, current2, current3, current4, current5);\n                    completionSource.TrySetResult(true);\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator1 != null)\n                {\n                    await enumerator1.DisposeAsync();\n                }\n                if (enumerator2 != null)\n                {\n                    await enumerator2.DisposeAsync();\n                }\n                if (enumerator3 != null)\n                {\n                    await enumerator3.DisposeAsync();\n                }\n                if (enumerator4 != null)\n                {\n                    await enumerator4.DisposeAsync();\n                }\n                if (enumerator5 != null)\n                {\n                    await enumerator5.DisposeAsync();\n                }\n            }\n        }\n    }\n\n    internal class CombineLatest<T1, T2, T3, T4, T5, T6, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<T1> source1;\n        readonly IUniTaskAsyncEnumerable<T2> source2;\n        readonly IUniTaskAsyncEnumerable<T3> source3;\n        readonly IUniTaskAsyncEnumerable<T4> source4;\n        readonly IUniTaskAsyncEnumerable<T5> source5;\n        readonly IUniTaskAsyncEnumerable<T6> source6;\n        \n        readonly Func<T1, T2, T3, T4, T5, T6, TResult> resultSelector;\n\n        public CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, Func<T1, T2, T3, T4, T5, T6, TResult> resultSelector)\n        {\n            this.source1 = source1;\n            this.source2 = source2;\n            this.source3 = source3;\n            this.source4 = source4;\n            this.source5 = source5;\n            this.source6 = source6;\n        \n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _CombineLatest(source1, source2, source3, source4, source5, source6, resultSelector, cancellationToken);\n        }\n\n        class _CombineLatest : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> Completed1Delegate = Completed1;\n            static readonly Action<object> Completed2Delegate = Completed2;\n            static readonly Action<object> Completed3Delegate = Completed3;\n            static readonly Action<object> Completed4Delegate = Completed4;\n            static readonly Action<object> Completed5Delegate = Completed5;\n            static readonly Action<object> Completed6Delegate = Completed6;\n            const int CompleteCount = 6;\n\n            readonly IUniTaskAsyncEnumerable<T1> source1;\n            readonly IUniTaskAsyncEnumerable<T2> source2;\n            readonly IUniTaskAsyncEnumerable<T3> source3;\n            readonly IUniTaskAsyncEnumerable<T4> source4;\n            readonly IUniTaskAsyncEnumerable<T5> source5;\n            readonly IUniTaskAsyncEnumerable<T6> source6;\n       \n            readonly Func<T1, T2, T3, T4, T5, T6, TResult> resultSelector;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<T1> enumerator1;\n            UniTask<bool>.Awaiter awaiter1;\n            bool hasCurrent1;\n            bool running1;\n            T1 current1;\n\n            IUniTaskAsyncEnumerator<T2> enumerator2;\n            UniTask<bool>.Awaiter awaiter2;\n            bool hasCurrent2;\n            bool running2;\n            T2 current2;\n\n            IUniTaskAsyncEnumerator<T3> enumerator3;\n            UniTask<bool>.Awaiter awaiter3;\n            bool hasCurrent3;\n            bool running3;\n            T3 current3;\n\n            IUniTaskAsyncEnumerator<T4> enumerator4;\n            UniTask<bool>.Awaiter awaiter4;\n            bool hasCurrent4;\n            bool running4;\n            T4 current4;\n\n            IUniTaskAsyncEnumerator<T5> enumerator5;\n            UniTask<bool>.Awaiter awaiter5;\n            bool hasCurrent5;\n            bool running5;\n            T5 current5;\n\n            IUniTaskAsyncEnumerator<T6> enumerator6;\n            UniTask<bool>.Awaiter awaiter6;\n            bool hasCurrent6;\n            bool running6;\n            T6 current6;\n\n            int completedCount;\n            bool syncRunning;\n            TResult result;\n\n            public _CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, Func<T1, T2, T3, T4, T5, T6, TResult> resultSelector, CancellationToken cancellationToken)\n            {\n                this.source1 = source1;\n                this.source2 = source2;\n                this.source3 = source3;\n                this.source4 = source4;\n                this.source5 = source5;\n                this.source6 = source6;\n                \n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current => result;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                if (completedCount == CompleteCount) return CompletedTasks.False;\n\n                if (enumerator1 == null)\n                {\n                    enumerator1 = source1.GetAsyncEnumerator(cancellationToken);\n                    enumerator2 = source2.GetAsyncEnumerator(cancellationToken);\n                    enumerator3 = source3.GetAsyncEnumerator(cancellationToken);\n                    enumerator4 = source4.GetAsyncEnumerator(cancellationToken);\n                    enumerator5 = source5.GetAsyncEnumerator(cancellationToken);\n                    enumerator6 = source6.GetAsyncEnumerator(cancellationToken);\n                }\n\n                completionSource.Reset();\n\n                AGAIN:\n                syncRunning = true;\n                if (!running1)\n                {\n                    running1 = true;\n                    awaiter1 = enumerator1.MoveNextAsync().GetAwaiter();\n                    if (awaiter1.IsCompleted)\n                    {\n                        Completed1(this);\n                    }\n                    else\n                    {\n                        awaiter1.SourceOnCompleted(Completed1Delegate, this);\n                    }\n                }\n                if (!running2)\n                {\n                    running2 = true;\n                    awaiter2 = enumerator2.MoveNextAsync().GetAwaiter();\n                    if (awaiter2.IsCompleted)\n                    {\n                        Completed2(this);\n                    }\n                    else\n                    {\n                        awaiter2.SourceOnCompleted(Completed2Delegate, this);\n                    }\n                }\n                if (!running3)\n                {\n                    running3 = true;\n                    awaiter3 = enumerator3.MoveNextAsync().GetAwaiter();\n                    if (awaiter3.IsCompleted)\n                    {\n                        Completed3(this);\n                    }\n                    else\n                    {\n                        awaiter3.SourceOnCompleted(Completed3Delegate, this);\n                    }\n                }\n                if (!running4)\n                {\n                    running4 = true;\n                    awaiter4 = enumerator4.MoveNextAsync().GetAwaiter();\n                    if (awaiter4.IsCompleted)\n                    {\n                        Completed4(this);\n                    }\n                    else\n                    {\n                        awaiter4.SourceOnCompleted(Completed4Delegate, this);\n                    }\n                }\n                if (!running5)\n                {\n                    running5 = true;\n                    awaiter5 = enumerator5.MoveNextAsync().GetAwaiter();\n                    if (awaiter5.IsCompleted)\n                    {\n                        Completed5(this);\n                    }\n                    else\n                    {\n                        awaiter5.SourceOnCompleted(Completed5Delegate, this);\n                    }\n                }\n                if (!running6)\n                {\n                    running6 = true;\n                    awaiter6 = enumerator6.MoveNextAsync().GetAwaiter();\n                    if (awaiter6.IsCompleted)\n                    {\n                        Completed6(this);\n                    }\n                    else\n                    {\n                        awaiter6.SourceOnCompleted(Completed6Delegate, this);\n                    }\n                }\n\n                if (!running1 || !running2 || !running3 || !running4 || !running5 || !running6)\n                {\n                    goto AGAIN;\n                }\n                syncRunning = false;\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void Completed1(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running1 = false;\n\n                try\n                {\n                    if (self.awaiter1.GetResult())\n                    {\n                        self.hasCurrent1 = true;\n                        self.current1 = self.enumerator1.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running1 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter1 = self.enumerator1.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter1.SourceOnCompleted(Completed1Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed2(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running2 = false;\n\n                try\n                {\n                    if (self.awaiter2.GetResult())\n                    {\n                        self.hasCurrent2 = true;\n                        self.current2 = self.enumerator2.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running2 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter2 = self.enumerator2.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter2.SourceOnCompleted(Completed2Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed3(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running3 = false;\n\n                try\n                {\n                    if (self.awaiter3.GetResult())\n                    {\n                        self.hasCurrent3 = true;\n                        self.current3 = self.enumerator3.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running3 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter3 = self.enumerator3.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter3.SourceOnCompleted(Completed3Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed4(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running4 = false;\n\n                try\n                {\n                    if (self.awaiter4.GetResult())\n                    {\n                        self.hasCurrent4 = true;\n                        self.current4 = self.enumerator4.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running4 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter4 = self.enumerator4.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter4.SourceOnCompleted(Completed4Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed5(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running5 = false;\n\n                try\n                {\n                    if (self.awaiter5.GetResult())\n                    {\n                        self.hasCurrent5 = true;\n                        self.current5 = self.enumerator5.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running5 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter5 = self.enumerator5.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter5.SourceOnCompleted(Completed5Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed6(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running6 = false;\n\n                try\n                {\n                    if (self.awaiter6.GetResult())\n                    {\n                        self.hasCurrent6 = true;\n                        self.current6 = self.enumerator6.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running6 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter6 = self.enumerator6.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter6.SourceOnCompleted(Completed6Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            bool TrySetResult()\n            {\n                if (hasCurrent1 && hasCurrent2 && hasCurrent3 && hasCurrent4 && hasCurrent5 && hasCurrent6)\n                {\n                    result = resultSelector(current1, current2, current3, current4, current5, current6);\n                    completionSource.TrySetResult(true);\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator1 != null)\n                {\n                    await enumerator1.DisposeAsync();\n                }\n                if (enumerator2 != null)\n                {\n                    await enumerator2.DisposeAsync();\n                }\n                if (enumerator3 != null)\n                {\n                    await enumerator3.DisposeAsync();\n                }\n                if (enumerator4 != null)\n                {\n                    await enumerator4.DisposeAsync();\n                }\n                if (enumerator5 != null)\n                {\n                    await enumerator5.DisposeAsync();\n                }\n                if (enumerator6 != null)\n                {\n                    await enumerator6.DisposeAsync();\n                }\n            }\n        }\n    }\n\n    internal class CombineLatest<T1, T2, T3, T4, T5, T6, T7, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<T1> source1;\n        readonly IUniTaskAsyncEnumerable<T2> source2;\n        readonly IUniTaskAsyncEnumerable<T3> source3;\n        readonly IUniTaskAsyncEnumerable<T4> source4;\n        readonly IUniTaskAsyncEnumerable<T5> source5;\n        readonly IUniTaskAsyncEnumerable<T6> source6;\n        readonly IUniTaskAsyncEnumerable<T7> source7;\n        \n        readonly Func<T1, T2, T3, T4, T5, T6, T7, TResult> resultSelector;\n\n        public CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, Func<T1, T2, T3, T4, T5, T6, T7, TResult> resultSelector)\n        {\n            this.source1 = source1;\n            this.source2 = source2;\n            this.source3 = source3;\n            this.source4 = source4;\n            this.source5 = source5;\n            this.source6 = source6;\n            this.source7 = source7;\n        \n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _CombineLatest(source1, source2, source3, source4, source5, source6, source7, resultSelector, cancellationToken);\n        }\n\n        class _CombineLatest : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> Completed1Delegate = Completed1;\n            static readonly Action<object> Completed2Delegate = Completed2;\n            static readonly Action<object> Completed3Delegate = Completed3;\n            static readonly Action<object> Completed4Delegate = Completed4;\n            static readonly Action<object> Completed5Delegate = Completed5;\n            static readonly Action<object> Completed6Delegate = Completed6;\n            static readonly Action<object> Completed7Delegate = Completed7;\n            const int CompleteCount = 7;\n\n            readonly IUniTaskAsyncEnumerable<T1> source1;\n            readonly IUniTaskAsyncEnumerable<T2> source2;\n            readonly IUniTaskAsyncEnumerable<T3> source3;\n            readonly IUniTaskAsyncEnumerable<T4> source4;\n            readonly IUniTaskAsyncEnumerable<T5> source5;\n            readonly IUniTaskAsyncEnumerable<T6> source6;\n            readonly IUniTaskAsyncEnumerable<T7> source7;\n       \n            readonly Func<T1, T2, T3, T4, T5, T6, T7, TResult> resultSelector;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<T1> enumerator1;\n            UniTask<bool>.Awaiter awaiter1;\n            bool hasCurrent1;\n            bool running1;\n            T1 current1;\n\n            IUniTaskAsyncEnumerator<T2> enumerator2;\n            UniTask<bool>.Awaiter awaiter2;\n            bool hasCurrent2;\n            bool running2;\n            T2 current2;\n\n            IUniTaskAsyncEnumerator<T3> enumerator3;\n            UniTask<bool>.Awaiter awaiter3;\n            bool hasCurrent3;\n            bool running3;\n            T3 current3;\n\n            IUniTaskAsyncEnumerator<T4> enumerator4;\n            UniTask<bool>.Awaiter awaiter4;\n            bool hasCurrent4;\n            bool running4;\n            T4 current4;\n\n            IUniTaskAsyncEnumerator<T5> enumerator5;\n            UniTask<bool>.Awaiter awaiter5;\n            bool hasCurrent5;\n            bool running5;\n            T5 current5;\n\n            IUniTaskAsyncEnumerator<T6> enumerator6;\n            UniTask<bool>.Awaiter awaiter6;\n            bool hasCurrent6;\n            bool running6;\n            T6 current6;\n\n            IUniTaskAsyncEnumerator<T7> enumerator7;\n            UniTask<bool>.Awaiter awaiter7;\n            bool hasCurrent7;\n            bool running7;\n            T7 current7;\n\n            int completedCount;\n            bool syncRunning;\n            TResult result;\n\n            public _CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, Func<T1, T2, T3, T4, T5, T6, T7, TResult> resultSelector, CancellationToken cancellationToken)\n            {\n                this.source1 = source1;\n                this.source2 = source2;\n                this.source3 = source3;\n                this.source4 = source4;\n                this.source5 = source5;\n                this.source6 = source6;\n                this.source7 = source7;\n                \n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current => result;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                if (completedCount == CompleteCount) return CompletedTasks.False;\n\n                if (enumerator1 == null)\n                {\n                    enumerator1 = source1.GetAsyncEnumerator(cancellationToken);\n                    enumerator2 = source2.GetAsyncEnumerator(cancellationToken);\n                    enumerator3 = source3.GetAsyncEnumerator(cancellationToken);\n                    enumerator4 = source4.GetAsyncEnumerator(cancellationToken);\n                    enumerator5 = source5.GetAsyncEnumerator(cancellationToken);\n                    enumerator6 = source6.GetAsyncEnumerator(cancellationToken);\n                    enumerator7 = source7.GetAsyncEnumerator(cancellationToken);\n                }\n\n                completionSource.Reset();\n\n                AGAIN:\n                syncRunning = true;\n                if (!running1)\n                {\n                    running1 = true;\n                    awaiter1 = enumerator1.MoveNextAsync().GetAwaiter();\n                    if (awaiter1.IsCompleted)\n                    {\n                        Completed1(this);\n                    }\n                    else\n                    {\n                        awaiter1.SourceOnCompleted(Completed1Delegate, this);\n                    }\n                }\n                if (!running2)\n                {\n                    running2 = true;\n                    awaiter2 = enumerator2.MoveNextAsync().GetAwaiter();\n                    if (awaiter2.IsCompleted)\n                    {\n                        Completed2(this);\n                    }\n                    else\n                    {\n                        awaiter2.SourceOnCompleted(Completed2Delegate, this);\n                    }\n                }\n                if (!running3)\n                {\n                    running3 = true;\n                    awaiter3 = enumerator3.MoveNextAsync().GetAwaiter();\n                    if (awaiter3.IsCompleted)\n                    {\n                        Completed3(this);\n                    }\n                    else\n                    {\n                        awaiter3.SourceOnCompleted(Completed3Delegate, this);\n                    }\n                }\n                if (!running4)\n                {\n                    running4 = true;\n                    awaiter4 = enumerator4.MoveNextAsync().GetAwaiter();\n                    if (awaiter4.IsCompleted)\n                    {\n                        Completed4(this);\n                    }\n                    else\n                    {\n                        awaiter4.SourceOnCompleted(Completed4Delegate, this);\n                    }\n                }\n                if (!running5)\n                {\n                    running5 = true;\n                    awaiter5 = enumerator5.MoveNextAsync().GetAwaiter();\n                    if (awaiter5.IsCompleted)\n                    {\n                        Completed5(this);\n                    }\n                    else\n                    {\n                        awaiter5.SourceOnCompleted(Completed5Delegate, this);\n                    }\n                }\n                if (!running6)\n                {\n                    running6 = true;\n                    awaiter6 = enumerator6.MoveNextAsync().GetAwaiter();\n                    if (awaiter6.IsCompleted)\n                    {\n                        Completed6(this);\n                    }\n                    else\n                    {\n                        awaiter6.SourceOnCompleted(Completed6Delegate, this);\n                    }\n                }\n                if (!running7)\n                {\n                    running7 = true;\n                    awaiter7 = enumerator7.MoveNextAsync().GetAwaiter();\n                    if (awaiter7.IsCompleted)\n                    {\n                        Completed7(this);\n                    }\n                    else\n                    {\n                        awaiter7.SourceOnCompleted(Completed7Delegate, this);\n                    }\n                }\n\n                if (!running1 || !running2 || !running3 || !running4 || !running5 || !running6 || !running7)\n                {\n                    goto AGAIN;\n                }\n                syncRunning = false;\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void Completed1(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running1 = false;\n\n                try\n                {\n                    if (self.awaiter1.GetResult())\n                    {\n                        self.hasCurrent1 = true;\n                        self.current1 = self.enumerator1.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running1 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter1 = self.enumerator1.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter1.SourceOnCompleted(Completed1Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed2(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running2 = false;\n\n                try\n                {\n                    if (self.awaiter2.GetResult())\n                    {\n                        self.hasCurrent2 = true;\n                        self.current2 = self.enumerator2.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running2 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter2 = self.enumerator2.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter2.SourceOnCompleted(Completed2Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed3(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running3 = false;\n\n                try\n                {\n                    if (self.awaiter3.GetResult())\n                    {\n                        self.hasCurrent3 = true;\n                        self.current3 = self.enumerator3.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running3 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter3 = self.enumerator3.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter3.SourceOnCompleted(Completed3Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed4(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running4 = false;\n\n                try\n                {\n                    if (self.awaiter4.GetResult())\n                    {\n                        self.hasCurrent4 = true;\n                        self.current4 = self.enumerator4.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running4 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter4 = self.enumerator4.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter4.SourceOnCompleted(Completed4Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed5(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running5 = false;\n\n                try\n                {\n                    if (self.awaiter5.GetResult())\n                    {\n                        self.hasCurrent5 = true;\n                        self.current5 = self.enumerator5.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running5 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter5 = self.enumerator5.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter5.SourceOnCompleted(Completed5Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed6(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running6 = false;\n\n                try\n                {\n                    if (self.awaiter6.GetResult())\n                    {\n                        self.hasCurrent6 = true;\n                        self.current6 = self.enumerator6.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running6 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter6 = self.enumerator6.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter6.SourceOnCompleted(Completed6Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed7(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running7 = false;\n\n                try\n                {\n                    if (self.awaiter7.GetResult())\n                    {\n                        self.hasCurrent7 = true;\n                        self.current7 = self.enumerator7.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running7 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter7 = self.enumerator7.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter7.SourceOnCompleted(Completed7Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            bool TrySetResult()\n            {\n                if (hasCurrent1 && hasCurrent2 && hasCurrent3 && hasCurrent4 && hasCurrent5 && hasCurrent6 && hasCurrent7)\n                {\n                    result = resultSelector(current1, current2, current3, current4, current5, current6, current7);\n                    completionSource.TrySetResult(true);\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator1 != null)\n                {\n                    await enumerator1.DisposeAsync();\n                }\n                if (enumerator2 != null)\n                {\n                    await enumerator2.DisposeAsync();\n                }\n                if (enumerator3 != null)\n                {\n                    await enumerator3.DisposeAsync();\n                }\n                if (enumerator4 != null)\n                {\n                    await enumerator4.DisposeAsync();\n                }\n                if (enumerator5 != null)\n                {\n                    await enumerator5.DisposeAsync();\n                }\n                if (enumerator6 != null)\n                {\n                    await enumerator6.DisposeAsync();\n                }\n                if (enumerator7 != null)\n                {\n                    await enumerator7.DisposeAsync();\n                }\n            }\n        }\n    }\n\n    internal class CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<T1> source1;\n        readonly IUniTaskAsyncEnumerable<T2> source2;\n        readonly IUniTaskAsyncEnumerable<T3> source3;\n        readonly IUniTaskAsyncEnumerable<T4> source4;\n        readonly IUniTaskAsyncEnumerable<T5> source5;\n        readonly IUniTaskAsyncEnumerable<T6> source6;\n        readonly IUniTaskAsyncEnumerable<T7> source7;\n        readonly IUniTaskAsyncEnumerable<T8> source8;\n        \n        readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> resultSelector;\n\n        public CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> resultSelector)\n        {\n            this.source1 = source1;\n            this.source2 = source2;\n            this.source3 = source3;\n            this.source4 = source4;\n            this.source5 = source5;\n            this.source6 = source6;\n            this.source7 = source7;\n            this.source8 = source8;\n        \n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _CombineLatest(source1, source2, source3, source4, source5, source6, source7, source8, resultSelector, cancellationToken);\n        }\n\n        class _CombineLatest : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> Completed1Delegate = Completed1;\n            static readonly Action<object> Completed2Delegate = Completed2;\n            static readonly Action<object> Completed3Delegate = Completed3;\n            static readonly Action<object> Completed4Delegate = Completed4;\n            static readonly Action<object> Completed5Delegate = Completed5;\n            static readonly Action<object> Completed6Delegate = Completed6;\n            static readonly Action<object> Completed7Delegate = Completed7;\n            static readonly Action<object> Completed8Delegate = Completed8;\n            const int CompleteCount = 8;\n\n            readonly IUniTaskAsyncEnumerable<T1> source1;\n            readonly IUniTaskAsyncEnumerable<T2> source2;\n            readonly IUniTaskAsyncEnumerable<T3> source3;\n            readonly IUniTaskAsyncEnumerable<T4> source4;\n            readonly IUniTaskAsyncEnumerable<T5> source5;\n            readonly IUniTaskAsyncEnumerable<T6> source6;\n            readonly IUniTaskAsyncEnumerable<T7> source7;\n            readonly IUniTaskAsyncEnumerable<T8> source8;\n       \n            readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> resultSelector;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<T1> enumerator1;\n            UniTask<bool>.Awaiter awaiter1;\n            bool hasCurrent1;\n            bool running1;\n            T1 current1;\n\n            IUniTaskAsyncEnumerator<T2> enumerator2;\n            UniTask<bool>.Awaiter awaiter2;\n            bool hasCurrent2;\n            bool running2;\n            T2 current2;\n\n            IUniTaskAsyncEnumerator<T3> enumerator3;\n            UniTask<bool>.Awaiter awaiter3;\n            bool hasCurrent3;\n            bool running3;\n            T3 current3;\n\n            IUniTaskAsyncEnumerator<T4> enumerator4;\n            UniTask<bool>.Awaiter awaiter4;\n            bool hasCurrent4;\n            bool running4;\n            T4 current4;\n\n            IUniTaskAsyncEnumerator<T5> enumerator5;\n            UniTask<bool>.Awaiter awaiter5;\n            bool hasCurrent5;\n            bool running5;\n            T5 current5;\n\n            IUniTaskAsyncEnumerator<T6> enumerator6;\n            UniTask<bool>.Awaiter awaiter6;\n            bool hasCurrent6;\n            bool running6;\n            T6 current6;\n\n            IUniTaskAsyncEnumerator<T7> enumerator7;\n            UniTask<bool>.Awaiter awaiter7;\n            bool hasCurrent7;\n            bool running7;\n            T7 current7;\n\n            IUniTaskAsyncEnumerator<T8> enumerator8;\n            UniTask<bool>.Awaiter awaiter8;\n            bool hasCurrent8;\n            bool running8;\n            T8 current8;\n\n            int completedCount;\n            bool syncRunning;\n            TResult result;\n\n            public _CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> resultSelector, CancellationToken cancellationToken)\n            {\n                this.source1 = source1;\n                this.source2 = source2;\n                this.source3 = source3;\n                this.source4 = source4;\n                this.source5 = source5;\n                this.source6 = source6;\n                this.source7 = source7;\n                this.source8 = source8;\n                \n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current => result;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                if (completedCount == CompleteCount) return CompletedTasks.False;\n\n                if (enumerator1 == null)\n                {\n                    enumerator1 = source1.GetAsyncEnumerator(cancellationToken);\n                    enumerator2 = source2.GetAsyncEnumerator(cancellationToken);\n                    enumerator3 = source3.GetAsyncEnumerator(cancellationToken);\n                    enumerator4 = source4.GetAsyncEnumerator(cancellationToken);\n                    enumerator5 = source5.GetAsyncEnumerator(cancellationToken);\n                    enumerator6 = source6.GetAsyncEnumerator(cancellationToken);\n                    enumerator7 = source7.GetAsyncEnumerator(cancellationToken);\n                    enumerator8 = source8.GetAsyncEnumerator(cancellationToken);\n                }\n\n                completionSource.Reset();\n\n                AGAIN:\n                syncRunning = true;\n                if (!running1)\n                {\n                    running1 = true;\n                    awaiter1 = enumerator1.MoveNextAsync().GetAwaiter();\n                    if (awaiter1.IsCompleted)\n                    {\n                        Completed1(this);\n                    }\n                    else\n                    {\n                        awaiter1.SourceOnCompleted(Completed1Delegate, this);\n                    }\n                }\n                if (!running2)\n                {\n                    running2 = true;\n                    awaiter2 = enumerator2.MoveNextAsync().GetAwaiter();\n                    if (awaiter2.IsCompleted)\n                    {\n                        Completed2(this);\n                    }\n                    else\n                    {\n                        awaiter2.SourceOnCompleted(Completed2Delegate, this);\n                    }\n                }\n                if (!running3)\n                {\n                    running3 = true;\n                    awaiter3 = enumerator3.MoveNextAsync().GetAwaiter();\n                    if (awaiter3.IsCompleted)\n                    {\n                        Completed3(this);\n                    }\n                    else\n                    {\n                        awaiter3.SourceOnCompleted(Completed3Delegate, this);\n                    }\n                }\n                if (!running4)\n                {\n                    running4 = true;\n                    awaiter4 = enumerator4.MoveNextAsync().GetAwaiter();\n                    if (awaiter4.IsCompleted)\n                    {\n                        Completed4(this);\n                    }\n                    else\n                    {\n                        awaiter4.SourceOnCompleted(Completed4Delegate, this);\n                    }\n                }\n                if (!running5)\n                {\n                    running5 = true;\n                    awaiter5 = enumerator5.MoveNextAsync().GetAwaiter();\n                    if (awaiter5.IsCompleted)\n                    {\n                        Completed5(this);\n                    }\n                    else\n                    {\n                        awaiter5.SourceOnCompleted(Completed5Delegate, this);\n                    }\n                }\n                if (!running6)\n                {\n                    running6 = true;\n                    awaiter6 = enumerator6.MoveNextAsync().GetAwaiter();\n                    if (awaiter6.IsCompleted)\n                    {\n                        Completed6(this);\n                    }\n                    else\n                    {\n                        awaiter6.SourceOnCompleted(Completed6Delegate, this);\n                    }\n                }\n                if (!running7)\n                {\n                    running7 = true;\n                    awaiter7 = enumerator7.MoveNextAsync().GetAwaiter();\n                    if (awaiter7.IsCompleted)\n                    {\n                        Completed7(this);\n                    }\n                    else\n                    {\n                        awaiter7.SourceOnCompleted(Completed7Delegate, this);\n                    }\n                }\n                if (!running8)\n                {\n                    running8 = true;\n                    awaiter8 = enumerator8.MoveNextAsync().GetAwaiter();\n                    if (awaiter8.IsCompleted)\n                    {\n                        Completed8(this);\n                    }\n                    else\n                    {\n                        awaiter8.SourceOnCompleted(Completed8Delegate, this);\n                    }\n                }\n\n                if (!running1 || !running2 || !running3 || !running4 || !running5 || !running6 || !running7 || !running8)\n                {\n                    goto AGAIN;\n                }\n                syncRunning = false;\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void Completed1(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running1 = false;\n\n                try\n                {\n                    if (self.awaiter1.GetResult())\n                    {\n                        self.hasCurrent1 = true;\n                        self.current1 = self.enumerator1.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running1 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter1 = self.enumerator1.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter1.SourceOnCompleted(Completed1Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed2(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running2 = false;\n\n                try\n                {\n                    if (self.awaiter2.GetResult())\n                    {\n                        self.hasCurrent2 = true;\n                        self.current2 = self.enumerator2.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running2 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter2 = self.enumerator2.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter2.SourceOnCompleted(Completed2Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed3(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running3 = false;\n\n                try\n                {\n                    if (self.awaiter3.GetResult())\n                    {\n                        self.hasCurrent3 = true;\n                        self.current3 = self.enumerator3.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running3 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter3 = self.enumerator3.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter3.SourceOnCompleted(Completed3Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed4(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running4 = false;\n\n                try\n                {\n                    if (self.awaiter4.GetResult())\n                    {\n                        self.hasCurrent4 = true;\n                        self.current4 = self.enumerator4.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running4 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter4 = self.enumerator4.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter4.SourceOnCompleted(Completed4Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed5(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running5 = false;\n\n                try\n                {\n                    if (self.awaiter5.GetResult())\n                    {\n                        self.hasCurrent5 = true;\n                        self.current5 = self.enumerator5.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running5 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter5 = self.enumerator5.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter5.SourceOnCompleted(Completed5Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed6(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running6 = false;\n\n                try\n                {\n                    if (self.awaiter6.GetResult())\n                    {\n                        self.hasCurrent6 = true;\n                        self.current6 = self.enumerator6.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running6 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter6 = self.enumerator6.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter6.SourceOnCompleted(Completed6Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed7(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running7 = false;\n\n                try\n                {\n                    if (self.awaiter7.GetResult())\n                    {\n                        self.hasCurrent7 = true;\n                        self.current7 = self.enumerator7.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running7 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter7 = self.enumerator7.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter7.SourceOnCompleted(Completed7Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed8(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running8 = false;\n\n                try\n                {\n                    if (self.awaiter8.GetResult())\n                    {\n                        self.hasCurrent8 = true;\n                        self.current8 = self.enumerator8.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running8 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running8 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running8 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter8 = self.enumerator8.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter8.SourceOnCompleted(Completed8Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            bool TrySetResult()\n            {\n                if (hasCurrent1 && hasCurrent2 && hasCurrent3 && hasCurrent4 && hasCurrent5 && hasCurrent6 && hasCurrent7 && hasCurrent8)\n                {\n                    result = resultSelector(current1, current2, current3, current4, current5, current6, current7, current8);\n                    completionSource.TrySetResult(true);\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator1 != null)\n                {\n                    await enumerator1.DisposeAsync();\n                }\n                if (enumerator2 != null)\n                {\n                    await enumerator2.DisposeAsync();\n                }\n                if (enumerator3 != null)\n                {\n                    await enumerator3.DisposeAsync();\n                }\n                if (enumerator4 != null)\n                {\n                    await enumerator4.DisposeAsync();\n                }\n                if (enumerator5 != null)\n                {\n                    await enumerator5.DisposeAsync();\n                }\n                if (enumerator6 != null)\n                {\n                    await enumerator6.DisposeAsync();\n                }\n                if (enumerator7 != null)\n                {\n                    await enumerator7.DisposeAsync();\n                }\n                if (enumerator8 != null)\n                {\n                    await enumerator8.DisposeAsync();\n                }\n            }\n        }\n    }\n\n    internal class CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<T1> source1;\n        readonly IUniTaskAsyncEnumerable<T2> source2;\n        readonly IUniTaskAsyncEnumerable<T3> source3;\n        readonly IUniTaskAsyncEnumerable<T4> source4;\n        readonly IUniTaskAsyncEnumerable<T5> source5;\n        readonly IUniTaskAsyncEnumerable<T6> source6;\n        readonly IUniTaskAsyncEnumerable<T7> source7;\n        readonly IUniTaskAsyncEnumerable<T8> source8;\n        readonly IUniTaskAsyncEnumerable<T9> source9;\n        \n        readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> resultSelector;\n\n        public CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> resultSelector)\n        {\n            this.source1 = source1;\n            this.source2 = source2;\n            this.source3 = source3;\n            this.source4 = source4;\n            this.source5 = source5;\n            this.source6 = source6;\n            this.source7 = source7;\n            this.source8 = source8;\n            this.source9 = source9;\n        \n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _CombineLatest(source1, source2, source3, source4, source5, source6, source7, source8, source9, resultSelector, cancellationToken);\n        }\n\n        class _CombineLatest : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> Completed1Delegate = Completed1;\n            static readonly Action<object> Completed2Delegate = Completed2;\n            static readonly Action<object> Completed3Delegate = Completed3;\n            static readonly Action<object> Completed4Delegate = Completed4;\n            static readonly Action<object> Completed5Delegate = Completed5;\n            static readonly Action<object> Completed6Delegate = Completed6;\n            static readonly Action<object> Completed7Delegate = Completed7;\n            static readonly Action<object> Completed8Delegate = Completed8;\n            static readonly Action<object> Completed9Delegate = Completed9;\n            const int CompleteCount = 9;\n\n            readonly IUniTaskAsyncEnumerable<T1> source1;\n            readonly IUniTaskAsyncEnumerable<T2> source2;\n            readonly IUniTaskAsyncEnumerable<T3> source3;\n            readonly IUniTaskAsyncEnumerable<T4> source4;\n            readonly IUniTaskAsyncEnumerable<T5> source5;\n            readonly IUniTaskAsyncEnumerable<T6> source6;\n            readonly IUniTaskAsyncEnumerable<T7> source7;\n            readonly IUniTaskAsyncEnumerable<T8> source8;\n            readonly IUniTaskAsyncEnumerable<T9> source9;\n       \n            readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> resultSelector;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<T1> enumerator1;\n            UniTask<bool>.Awaiter awaiter1;\n            bool hasCurrent1;\n            bool running1;\n            T1 current1;\n\n            IUniTaskAsyncEnumerator<T2> enumerator2;\n            UniTask<bool>.Awaiter awaiter2;\n            bool hasCurrent2;\n            bool running2;\n            T2 current2;\n\n            IUniTaskAsyncEnumerator<T3> enumerator3;\n            UniTask<bool>.Awaiter awaiter3;\n            bool hasCurrent3;\n            bool running3;\n            T3 current3;\n\n            IUniTaskAsyncEnumerator<T4> enumerator4;\n            UniTask<bool>.Awaiter awaiter4;\n            bool hasCurrent4;\n            bool running4;\n            T4 current4;\n\n            IUniTaskAsyncEnumerator<T5> enumerator5;\n            UniTask<bool>.Awaiter awaiter5;\n            bool hasCurrent5;\n            bool running5;\n            T5 current5;\n\n            IUniTaskAsyncEnumerator<T6> enumerator6;\n            UniTask<bool>.Awaiter awaiter6;\n            bool hasCurrent6;\n            bool running6;\n            T6 current6;\n\n            IUniTaskAsyncEnumerator<T7> enumerator7;\n            UniTask<bool>.Awaiter awaiter7;\n            bool hasCurrent7;\n            bool running7;\n            T7 current7;\n\n            IUniTaskAsyncEnumerator<T8> enumerator8;\n            UniTask<bool>.Awaiter awaiter8;\n            bool hasCurrent8;\n            bool running8;\n            T8 current8;\n\n            IUniTaskAsyncEnumerator<T9> enumerator9;\n            UniTask<bool>.Awaiter awaiter9;\n            bool hasCurrent9;\n            bool running9;\n            T9 current9;\n\n            int completedCount;\n            bool syncRunning;\n            TResult result;\n\n            public _CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> resultSelector, CancellationToken cancellationToken)\n            {\n                this.source1 = source1;\n                this.source2 = source2;\n                this.source3 = source3;\n                this.source4 = source4;\n                this.source5 = source5;\n                this.source6 = source6;\n                this.source7 = source7;\n                this.source8 = source8;\n                this.source9 = source9;\n                \n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current => result;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                if (completedCount == CompleteCount) return CompletedTasks.False;\n\n                if (enumerator1 == null)\n                {\n                    enumerator1 = source1.GetAsyncEnumerator(cancellationToken);\n                    enumerator2 = source2.GetAsyncEnumerator(cancellationToken);\n                    enumerator3 = source3.GetAsyncEnumerator(cancellationToken);\n                    enumerator4 = source4.GetAsyncEnumerator(cancellationToken);\n                    enumerator5 = source5.GetAsyncEnumerator(cancellationToken);\n                    enumerator6 = source6.GetAsyncEnumerator(cancellationToken);\n                    enumerator7 = source7.GetAsyncEnumerator(cancellationToken);\n                    enumerator8 = source8.GetAsyncEnumerator(cancellationToken);\n                    enumerator9 = source9.GetAsyncEnumerator(cancellationToken);\n                }\n\n                completionSource.Reset();\n\n                AGAIN:\n                syncRunning = true;\n                if (!running1)\n                {\n                    running1 = true;\n                    awaiter1 = enumerator1.MoveNextAsync().GetAwaiter();\n                    if (awaiter1.IsCompleted)\n                    {\n                        Completed1(this);\n                    }\n                    else\n                    {\n                        awaiter1.SourceOnCompleted(Completed1Delegate, this);\n                    }\n                }\n                if (!running2)\n                {\n                    running2 = true;\n                    awaiter2 = enumerator2.MoveNextAsync().GetAwaiter();\n                    if (awaiter2.IsCompleted)\n                    {\n                        Completed2(this);\n                    }\n                    else\n                    {\n                        awaiter2.SourceOnCompleted(Completed2Delegate, this);\n                    }\n                }\n                if (!running3)\n                {\n                    running3 = true;\n                    awaiter3 = enumerator3.MoveNextAsync().GetAwaiter();\n                    if (awaiter3.IsCompleted)\n                    {\n                        Completed3(this);\n                    }\n                    else\n                    {\n                        awaiter3.SourceOnCompleted(Completed3Delegate, this);\n                    }\n                }\n                if (!running4)\n                {\n                    running4 = true;\n                    awaiter4 = enumerator4.MoveNextAsync().GetAwaiter();\n                    if (awaiter4.IsCompleted)\n                    {\n                        Completed4(this);\n                    }\n                    else\n                    {\n                        awaiter4.SourceOnCompleted(Completed4Delegate, this);\n                    }\n                }\n                if (!running5)\n                {\n                    running5 = true;\n                    awaiter5 = enumerator5.MoveNextAsync().GetAwaiter();\n                    if (awaiter5.IsCompleted)\n                    {\n                        Completed5(this);\n                    }\n                    else\n                    {\n                        awaiter5.SourceOnCompleted(Completed5Delegate, this);\n                    }\n                }\n                if (!running6)\n                {\n                    running6 = true;\n                    awaiter6 = enumerator6.MoveNextAsync().GetAwaiter();\n                    if (awaiter6.IsCompleted)\n                    {\n                        Completed6(this);\n                    }\n                    else\n                    {\n                        awaiter6.SourceOnCompleted(Completed6Delegate, this);\n                    }\n                }\n                if (!running7)\n                {\n                    running7 = true;\n                    awaiter7 = enumerator7.MoveNextAsync().GetAwaiter();\n                    if (awaiter7.IsCompleted)\n                    {\n                        Completed7(this);\n                    }\n                    else\n                    {\n                        awaiter7.SourceOnCompleted(Completed7Delegate, this);\n                    }\n                }\n                if (!running8)\n                {\n                    running8 = true;\n                    awaiter8 = enumerator8.MoveNextAsync().GetAwaiter();\n                    if (awaiter8.IsCompleted)\n                    {\n                        Completed8(this);\n                    }\n                    else\n                    {\n                        awaiter8.SourceOnCompleted(Completed8Delegate, this);\n                    }\n                }\n                if (!running9)\n                {\n                    running9 = true;\n                    awaiter9 = enumerator9.MoveNextAsync().GetAwaiter();\n                    if (awaiter9.IsCompleted)\n                    {\n                        Completed9(this);\n                    }\n                    else\n                    {\n                        awaiter9.SourceOnCompleted(Completed9Delegate, this);\n                    }\n                }\n\n                if (!running1 || !running2 || !running3 || !running4 || !running5 || !running6 || !running7 || !running8 || !running9)\n                {\n                    goto AGAIN;\n                }\n                syncRunning = false;\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void Completed1(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running1 = false;\n\n                try\n                {\n                    if (self.awaiter1.GetResult())\n                    {\n                        self.hasCurrent1 = true;\n                        self.current1 = self.enumerator1.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running1 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter1 = self.enumerator1.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter1.SourceOnCompleted(Completed1Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed2(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running2 = false;\n\n                try\n                {\n                    if (self.awaiter2.GetResult())\n                    {\n                        self.hasCurrent2 = true;\n                        self.current2 = self.enumerator2.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running2 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter2 = self.enumerator2.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter2.SourceOnCompleted(Completed2Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed3(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running3 = false;\n\n                try\n                {\n                    if (self.awaiter3.GetResult())\n                    {\n                        self.hasCurrent3 = true;\n                        self.current3 = self.enumerator3.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running3 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter3 = self.enumerator3.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter3.SourceOnCompleted(Completed3Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed4(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running4 = false;\n\n                try\n                {\n                    if (self.awaiter4.GetResult())\n                    {\n                        self.hasCurrent4 = true;\n                        self.current4 = self.enumerator4.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running4 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter4 = self.enumerator4.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter4.SourceOnCompleted(Completed4Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed5(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running5 = false;\n\n                try\n                {\n                    if (self.awaiter5.GetResult())\n                    {\n                        self.hasCurrent5 = true;\n                        self.current5 = self.enumerator5.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running5 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter5 = self.enumerator5.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter5.SourceOnCompleted(Completed5Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed6(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running6 = false;\n\n                try\n                {\n                    if (self.awaiter6.GetResult())\n                    {\n                        self.hasCurrent6 = true;\n                        self.current6 = self.enumerator6.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running6 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter6 = self.enumerator6.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter6.SourceOnCompleted(Completed6Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed7(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running7 = false;\n\n                try\n                {\n                    if (self.awaiter7.GetResult())\n                    {\n                        self.hasCurrent7 = true;\n                        self.current7 = self.enumerator7.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running7 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter7 = self.enumerator7.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter7.SourceOnCompleted(Completed7Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed8(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running8 = false;\n\n                try\n                {\n                    if (self.awaiter8.GetResult())\n                    {\n                        self.hasCurrent8 = true;\n                        self.current8 = self.enumerator8.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running8 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running8 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running8 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter8 = self.enumerator8.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter8.SourceOnCompleted(Completed8Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed9(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running9 = false;\n\n                try\n                {\n                    if (self.awaiter9.GetResult())\n                    {\n                        self.hasCurrent9 = true;\n                        self.current9 = self.enumerator9.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running9 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running9 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running9 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter9 = self.enumerator9.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter9.SourceOnCompleted(Completed9Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            bool TrySetResult()\n            {\n                if (hasCurrent1 && hasCurrent2 && hasCurrent3 && hasCurrent4 && hasCurrent5 && hasCurrent6 && hasCurrent7 && hasCurrent8 && hasCurrent9)\n                {\n                    result = resultSelector(current1, current2, current3, current4, current5, current6, current7, current8, current9);\n                    completionSource.TrySetResult(true);\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator1 != null)\n                {\n                    await enumerator1.DisposeAsync();\n                }\n                if (enumerator2 != null)\n                {\n                    await enumerator2.DisposeAsync();\n                }\n                if (enumerator3 != null)\n                {\n                    await enumerator3.DisposeAsync();\n                }\n                if (enumerator4 != null)\n                {\n                    await enumerator4.DisposeAsync();\n                }\n                if (enumerator5 != null)\n                {\n                    await enumerator5.DisposeAsync();\n                }\n                if (enumerator6 != null)\n                {\n                    await enumerator6.DisposeAsync();\n                }\n                if (enumerator7 != null)\n                {\n                    await enumerator7.DisposeAsync();\n                }\n                if (enumerator8 != null)\n                {\n                    await enumerator8.DisposeAsync();\n                }\n                if (enumerator9 != null)\n                {\n                    await enumerator9.DisposeAsync();\n                }\n            }\n        }\n    }\n\n    internal class CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<T1> source1;\n        readonly IUniTaskAsyncEnumerable<T2> source2;\n        readonly IUniTaskAsyncEnumerable<T3> source3;\n        readonly IUniTaskAsyncEnumerable<T4> source4;\n        readonly IUniTaskAsyncEnumerable<T5> source5;\n        readonly IUniTaskAsyncEnumerable<T6> source6;\n        readonly IUniTaskAsyncEnumerable<T7> source7;\n        readonly IUniTaskAsyncEnumerable<T8> source8;\n        readonly IUniTaskAsyncEnumerable<T9> source9;\n        readonly IUniTaskAsyncEnumerable<T10> source10;\n        \n        readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> resultSelector;\n\n        public CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> resultSelector)\n        {\n            this.source1 = source1;\n            this.source2 = source2;\n            this.source3 = source3;\n            this.source4 = source4;\n            this.source5 = source5;\n            this.source6 = source6;\n            this.source7 = source7;\n            this.source8 = source8;\n            this.source9 = source9;\n            this.source10 = source10;\n        \n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _CombineLatest(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, resultSelector, cancellationToken);\n        }\n\n        class _CombineLatest : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> Completed1Delegate = Completed1;\n            static readonly Action<object> Completed2Delegate = Completed2;\n            static readonly Action<object> Completed3Delegate = Completed3;\n            static readonly Action<object> Completed4Delegate = Completed4;\n            static readonly Action<object> Completed5Delegate = Completed5;\n            static readonly Action<object> Completed6Delegate = Completed6;\n            static readonly Action<object> Completed7Delegate = Completed7;\n            static readonly Action<object> Completed8Delegate = Completed8;\n            static readonly Action<object> Completed9Delegate = Completed9;\n            static readonly Action<object> Completed10Delegate = Completed10;\n            const int CompleteCount = 10;\n\n            readonly IUniTaskAsyncEnumerable<T1> source1;\n            readonly IUniTaskAsyncEnumerable<T2> source2;\n            readonly IUniTaskAsyncEnumerable<T3> source3;\n            readonly IUniTaskAsyncEnumerable<T4> source4;\n            readonly IUniTaskAsyncEnumerable<T5> source5;\n            readonly IUniTaskAsyncEnumerable<T6> source6;\n            readonly IUniTaskAsyncEnumerable<T7> source7;\n            readonly IUniTaskAsyncEnumerable<T8> source8;\n            readonly IUniTaskAsyncEnumerable<T9> source9;\n            readonly IUniTaskAsyncEnumerable<T10> source10;\n       \n            readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> resultSelector;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<T1> enumerator1;\n            UniTask<bool>.Awaiter awaiter1;\n            bool hasCurrent1;\n            bool running1;\n            T1 current1;\n\n            IUniTaskAsyncEnumerator<T2> enumerator2;\n            UniTask<bool>.Awaiter awaiter2;\n            bool hasCurrent2;\n            bool running2;\n            T2 current2;\n\n            IUniTaskAsyncEnumerator<T3> enumerator3;\n            UniTask<bool>.Awaiter awaiter3;\n            bool hasCurrent3;\n            bool running3;\n            T3 current3;\n\n            IUniTaskAsyncEnumerator<T4> enumerator4;\n            UniTask<bool>.Awaiter awaiter4;\n            bool hasCurrent4;\n            bool running4;\n            T4 current4;\n\n            IUniTaskAsyncEnumerator<T5> enumerator5;\n            UniTask<bool>.Awaiter awaiter5;\n            bool hasCurrent5;\n            bool running5;\n            T5 current5;\n\n            IUniTaskAsyncEnumerator<T6> enumerator6;\n            UniTask<bool>.Awaiter awaiter6;\n            bool hasCurrent6;\n            bool running6;\n            T6 current6;\n\n            IUniTaskAsyncEnumerator<T7> enumerator7;\n            UniTask<bool>.Awaiter awaiter7;\n            bool hasCurrent7;\n            bool running7;\n            T7 current7;\n\n            IUniTaskAsyncEnumerator<T8> enumerator8;\n            UniTask<bool>.Awaiter awaiter8;\n            bool hasCurrent8;\n            bool running8;\n            T8 current8;\n\n            IUniTaskAsyncEnumerator<T9> enumerator9;\n            UniTask<bool>.Awaiter awaiter9;\n            bool hasCurrent9;\n            bool running9;\n            T9 current9;\n\n            IUniTaskAsyncEnumerator<T10> enumerator10;\n            UniTask<bool>.Awaiter awaiter10;\n            bool hasCurrent10;\n            bool running10;\n            T10 current10;\n\n            int completedCount;\n            bool syncRunning;\n            TResult result;\n\n            public _CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> resultSelector, CancellationToken cancellationToken)\n            {\n                this.source1 = source1;\n                this.source2 = source2;\n                this.source3 = source3;\n                this.source4 = source4;\n                this.source5 = source5;\n                this.source6 = source6;\n                this.source7 = source7;\n                this.source8 = source8;\n                this.source9 = source9;\n                this.source10 = source10;\n                \n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current => result;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                if (completedCount == CompleteCount) return CompletedTasks.False;\n\n                if (enumerator1 == null)\n                {\n                    enumerator1 = source1.GetAsyncEnumerator(cancellationToken);\n                    enumerator2 = source2.GetAsyncEnumerator(cancellationToken);\n                    enumerator3 = source3.GetAsyncEnumerator(cancellationToken);\n                    enumerator4 = source4.GetAsyncEnumerator(cancellationToken);\n                    enumerator5 = source5.GetAsyncEnumerator(cancellationToken);\n                    enumerator6 = source6.GetAsyncEnumerator(cancellationToken);\n                    enumerator7 = source7.GetAsyncEnumerator(cancellationToken);\n                    enumerator8 = source8.GetAsyncEnumerator(cancellationToken);\n                    enumerator9 = source9.GetAsyncEnumerator(cancellationToken);\n                    enumerator10 = source10.GetAsyncEnumerator(cancellationToken);\n                }\n\n                completionSource.Reset();\n\n                AGAIN:\n                syncRunning = true;\n                if (!running1)\n                {\n                    running1 = true;\n                    awaiter1 = enumerator1.MoveNextAsync().GetAwaiter();\n                    if (awaiter1.IsCompleted)\n                    {\n                        Completed1(this);\n                    }\n                    else\n                    {\n                        awaiter1.SourceOnCompleted(Completed1Delegate, this);\n                    }\n                }\n                if (!running2)\n                {\n                    running2 = true;\n                    awaiter2 = enumerator2.MoveNextAsync().GetAwaiter();\n                    if (awaiter2.IsCompleted)\n                    {\n                        Completed2(this);\n                    }\n                    else\n                    {\n                        awaiter2.SourceOnCompleted(Completed2Delegate, this);\n                    }\n                }\n                if (!running3)\n                {\n                    running3 = true;\n                    awaiter3 = enumerator3.MoveNextAsync().GetAwaiter();\n                    if (awaiter3.IsCompleted)\n                    {\n                        Completed3(this);\n                    }\n                    else\n                    {\n                        awaiter3.SourceOnCompleted(Completed3Delegate, this);\n                    }\n                }\n                if (!running4)\n                {\n                    running4 = true;\n                    awaiter4 = enumerator4.MoveNextAsync().GetAwaiter();\n                    if (awaiter4.IsCompleted)\n                    {\n                        Completed4(this);\n                    }\n                    else\n                    {\n                        awaiter4.SourceOnCompleted(Completed4Delegate, this);\n                    }\n                }\n                if (!running5)\n                {\n                    running5 = true;\n                    awaiter5 = enumerator5.MoveNextAsync().GetAwaiter();\n                    if (awaiter5.IsCompleted)\n                    {\n                        Completed5(this);\n                    }\n                    else\n                    {\n                        awaiter5.SourceOnCompleted(Completed5Delegate, this);\n                    }\n                }\n                if (!running6)\n                {\n                    running6 = true;\n                    awaiter6 = enumerator6.MoveNextAsync().GetAwaiter();\n                    if (awaiter6.IsCompleted)\n                    {\n                        Completed6(this);\n                    }\n                    else\n                    {\n                        awaiter6.SourceOnCompleted(Completed6Delegate, this);\n                    }\n                }\n                if (!running7)\n                {\n                    running7 = true;\n                    awaiter7 = enumerator7.MoveNextAsync().GetAwaiter();\n                    if (awaiter7.IsCompleted)\n                    {\n                        Completed7(this);\n                    }\n                    else\n                    {\n                        awaiter7.SourceOnCompleted(Completed7Delegate, this);\n                    }\n                }\n                if (!running8)\n                {\n                    running8 = true;\n                    awaiter8 = enumerator8.MoveNextAsync().GetAwaiter();\n                    if (awaiter8.IsCompleted)\n                    {\n                        Completed8(this);\n                    }\n                    else\n                    {\n                        awaiter8.SourceOnCompleted(Completed8Delegate, this);\n                    }\n                }\n                if (!running9)\n                {\n                    running9 = true;\n                    awaiter9 = enumerator9.MoveNextAsync().GetAwaiter();\n                    if (awaiter9.IsCompleted)\n                    {\n                        Completed9(this);\n                    }\n                    else\n                    {\n                        awaiter9.SourceOnCompleted(Completed9Delegate, this);\n                    }\n                }\n                if (!running10)\n                {\n                    running10 = true;\n                    awaiter10 = enumerator10.MoveNextAsync().GetAwaiter();\n                    if (awaiter10.IsCompleted)\n                    {\n                        Completed10(this);\n                    }\n                    else\n                    {\n                        awaiter10.SourceOnCompleted(Completed10Delegate, this);\n                    }\n                }\n\n                if (!running1 || !running2 || !running3 || !running4 || !running5 || !running6 || !running7 || !running8 || !running9 || !running10)\n                {\n                    goto AGAIN;\n                }\n                syncRunning = false;\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void Completed1(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running1 = false;\n\n                try\n                {\n                    if (self.awaiter1.GetResult())\n                    {\n                        self.hasCurrent1 = true;\n                        self.current1 = self.enumerator1.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running1 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter1 = self.enumerator1.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter1.SourceOnCompleted(Completed1Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed2(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running2 = false;\n\n                try\n                {\n                    if (self.awaiter2.GetResult())\n                    {\n                        self.hasCurrent2 = true;\n                        self.current2 = self.enumerator2.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running2 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter2 = self.enumerator2.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter2.SourceOnCompleted(Completed2Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed3(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running3 = false;\n\n                try\n                {\n                    if (self.awaiter3.GetResult())\n                    {\n                        self.hasCurrent3 = true;\n                        self.current3 = self.enumerator3.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running3 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter3 = self.enumerator3.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter3.SourceOnCompleted(Completed3Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed4(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running4 = false;\n\n                try\n                {\n                    if (self.awaiter4.GetResult())\n                    {\n                        self.hasCurrent4 = true;\n                        self.current4 = self.enumerator4.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running4 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter4 = self.enumerator4.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter4.SourceOnCompleted(Completed4Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed5(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running5 = false;\n\n                try\n                {\n                    if (self.awaiter5.GetResult())\n                    {\n                        self.hasCurrent5 = true;\n                        self.current5 = self.enumerator5.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running5 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter5 = self.enumerator5.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter5.SourceOnCompleted(Completed5Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed6(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running6 = false;\n\n                try\n                {\n                    if (self.awaiter6.GetResult())\n                    {\n                        self.hasCurrent6 = true;\n                        self.current6 = self.enumerator6.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running6 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter6 = self.enumerator6.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter6.SourceOnCompleted(Completed6Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed7(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running7 = false;\n\n                try\n                {\n                    if (self.awaiter7.GetResult())\n                    {\n                        self.hasCurrent7 = true;\n                        self.current7 = self.enumerator7.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running7 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter7 = self.enumerator7.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter7.SourceOnCompleted(Completed7Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed8(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running8 = false;\n\n                try\n                {\n                    if (self.awaiter8.GetResult())\n                    {\n                        self.hasCurrent8 = true;\n                        self.current8 = self.enumerator8.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running8 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running8 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running8 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter8 = self.enumerator8.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter8.SourceOnCompleted(Completed8Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed9(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running9 = false;\n\n                try\n                {\n                    if (self.awaiter9.GetResult())\n                    {\n                        self.hasCurrent9 = true;\n                        self.current9 = self.enumerator9.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running9 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running9 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running9 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter9 = self.enumerator9.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter9.SourceOnCompleted(Completed9Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed10(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running10 = false;\n\n                try\n                {\n                    if (self.awaiter10.GetResult())\n                    {\n                        self.hasCurrent10 = true;\n                        self.current10 = self.enumerator10.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running10 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running10 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running10 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter10 = self.enumerator10.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter10.SourceOnCompleted(Completed10Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            bool TrySetResult()\n            {\n                if (hasCurrent1 && hasCurrent2 && hasCurrent3 && hasCurrent4 && hasCurrent5 && hasCurrent6 && hasCurrent7 && hasCurrent8 && hasCurrent9 && hasCurrent10)\n                {\n                    result = resultSelector(current1, current2, current3, current4, current5, current6, current7, current8, current9, current10);\n                    completionSource.TrySetResult(true);\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator1 != null)\n                {\n                    await enumerator1.DisposeAsync();\n                }\n                if (enumerator2 != null)\n                {\n                    await enumerator2.DisposeAsync();\n                }\n                if (enumerator3 != null)\n                {\n                    await enumerator3.DisposeAsync();\n                }\n                if (enumerator4 != null)\n                {\n                    await enumerator4.DisposeAsync();\n                }\n                if (enumerator5 != null)\n                {\n                    await enumerator5.DisposeAsync();\n                }\n                if (enumerator6 != null)\n                {\n                    await enumerator6.DisposeAsync();\n                }\n                if (enumerator7 != null)\n                {\n                    await enumerator7.DisposeAsync();\n                }\n                if (enumerator8 != null)\n                {\n                    await enumerator8.DisposeAsync();\n                }\n                if (enumerator9 != null)\n                {\n                    await enumerator9.DisposeAsync();\n                }\n                if (enumerator10 != null)\n                {\n                    await enumerator10.DisposeAsync();\n                }\n            }\n        }\n    }\n\n    internal class CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<T1> source1;\n        readonly IUniTaskAsyncEnumerable<T2> source2;\n        readonly IUniTaskAsyncEnumerable<T3> source3;\n        readonly IUniTaskAsyncEnumerable<T4> source4;\n        readonly IUniTaskAsyncEnumerable<T5> source5;\n        readonly IUniTaskAsyncEnumerable<T6> source6;\n        readonly IUniTaskAsyncEnumerable<T7> source7;\n        readonly IUniTaskAsyncEnumerable<T8> source8;\n        readonly IUniTaskAsyncEnumerable<T9> source9;\n        readonly IUniTaskAsyncEnumerable<T10> source10;\n        readonly IUniTaskAsyncEnumerable<T11> source11;\n        \n        readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> resultSelector;\n\n        public CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, IUniTaskAsyncEnumerable<T11> source11, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> resultSelector)\n        {\n            this.source1 = source1;\n            this.source2 = source2;\n            this.source3 = source3;\n            this.source4 = source4;\n            this.source5 = source5;\n            this.source6 = source6;\n            this.source7 = source7;\n            this.source8 = source8;\n            this.source9 = source9;\n            this.source10 = source10;\n            this.source11 = source11;\n        \n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _CombineLatest(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, resultSelector, cancellationToken);\n        }\n\n        class _CombineLatest : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> Completed1Delegate = Completed1;\n            static readonly Action<object> Completed2Delegate = Completed2;\n            static readonly Action<object> Completed3Delegate = Completed3;\n            static readonly Action<object> Completed4Delegate = Completed4;\n            static readonly Action<object> Completed5Delegate = Completed5;\n            static readonly Action<object> Completed6Delegate = Completed6;\n            static readonly Action<object> Completed7Delegate = Completed7;\n            static readonly Action<object> Completed8Delegate = Completed8;\n            static readonly Action<object> Completed9Delegate = Completed9;\n            static readonly Action<object> Completed10Delegate = Completed10;\n            static readonly Action<object> Completed11Delegate = Completed11;\n            const int CompleteCount = 11;\n\n            readonly IUniTaskAsyncEnumerable<T1> source1;\n            readonly IUniTaskAsyncEnumerable<T2> source2;\n            readonly IUniTaskAsyncEnumerable<T3> source3;\n            readonly IUniTaskAsyncEnumerable<T4> source4;\n            readonly IUniTaskAsyncEnumerable<T5> source5;\n            readonly IUniTaskAsyncEnumerable<T6> source6;\n            readonly IUniTaskAsyncEnumerable<T7> source7;\n            readonly IUniTaskAsyncEnumerable<T8> source8;\n            readonly IUniTaskAsyncEnumerable<T9> source9;\n            readonly IUniTaskAsyncEnumerable<T10> source10;\n            readonly IUniTaskAsyncEnumerable<T11> source11;\n       \n            readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> resultSelector;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<T1> enumerator1;\n            UniTask<bool>.Awaiter awaiter1;\n            bool hasCurrent1;\n            bool running1;\n            T1 current1;\n\n            IUniTaskAsyncEnumerator<T2> enumerator2;\n            UniTask<bool>.Awaiter awaiter2;\n            bool hasCurrent2;\n            bool running2;\n            T2 current2;\n\n            IUniTaskAsyncEnumerator<T3> enumerator3;\n            UniTask<bool>.Awaiter awaiter3;\n            bool hasCurrent3;\n            bool running3;\n            T3 current3;\n\n            IUniTaskAsyncEnumerator<T4> enumerator4;\n            UniTask<bool>.Awaiter awaiter4;\n            bool hasCurrent4;\n            bool running4;\n            T4 current4;\n\n            IUniTaskAsyncEnumerator<T5> enumerator5;\n            UniTask<bool>.Awaiter awaiter5;\n            bool hasCurrent5;\n            bool running5;\n            T5 current5;\n\n            IUniTaskAsyncEnumerator<T6> enumerator6;\n            UniTask<bool>.Awaiter awaiter6;\n            bool hasCurrent6;\n            bool running6;\n            T6 current6;\n\n            IUniTaskAsyncEnumerator<T7> enumerator7;\n            UniTask<bool>.Awaiter awaiter7;\n            bool hasCurrent7;\n            bool running7;\n            T7 current7;\n\n            IUniTaskAsyncEnumerator<T8> enumerator8;\n            UniTask<bool>.Awaiter awaiter8;\n            bool hasCurrent8;\n            bool running8;\n            T8 current8;\n\n            IUniTaskAsyncEnumerator<T9> enumerator9;\n            UniTask<bool>.Awaiter awaiter9;\n            bool hasCurrent9;\n            bool running9;\n            T9 current9;\n\n            IUniTaskAsyncEnumerator<T10> enumerator10;\n            UniTask<bool>.Awaiter awaiter10;\n            bool hasCurrent10;\n            bool running10;\n            T10 current10;\n\n            IUniTaskAsyncEnumerator<T11> enumerator11;\n            UniTask<bool>.Awaiter awaiter11;\n            bool hasCurrent11;\n            bool running11;\n            T11 current11;\n\n            int completedCount;\n            bool syncRunning;\n            TResult result;\n\n            public _CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, IUniTaskAsyncEnumerable<T11> source11, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> resultSelector, CancellationToken cancellationToken)\n            {\n                this.source1 = source1;\n                this.source2 = source2;\n                this.source3 = source3;\n                this.source4 = source4;\n                this.source5 = source5;\n                this.source6 = source6;\n                this.source7 = source7;\n                this.source8 = source8;\n                this.source9 = source9;\n                this.source10 = source10;\n                this.source11 = source11;\n                \n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current => result;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                if (completedCount == CompleteCount) return CompletedTasks.False;\n\n                if (enumerator1 == null)\n                {\n                    enumerator1 = source1.GetAsyncEnumerator(cancellationToken);\n                    enumerator2 = source2.GetAsyncEnumerator(cancellationToken);\n                    enumerator3 = source3.GetAsyncEnumerator(cancellationToken);\n                    enumerator4 = source4.GetAsyncEnumerator(cancellationToken);\n                    enumerator5 = source5.GetAsyncEnumerator(cancellationToken);\n                    enumerator6 = source6.GetAsyncEnumerator(cancellationToken);\n                    enumerator7 = source7.GetAsyncEnumerator(cancellationToken);\n                    enumerator8 = source8.GetAsyncEnumerator(cancellationToken);\n                    enumerator9 = source9.GetAsyncEnumerator(cancellationToken);\n                    enumerator10 = source10.GetAsyncEnumerator(cancellationToken);\n                    enumerator11 = source11.GetAsyncEnumerator(cancellationToken);\n                }\n\n                completionSource.Reset();\n\n                AGAIN:\n                syncRunning = true;\n                if (!running1)\n                {\n                    running1 = true;\n                    awaiter1 = enumerator1.MoveNextAsync().GetAwaiter();\n                    if (awaiter1.IsCompleted)\n                    {\n                        Completed1(this);\n                    }\n                    else\n                    {\n                        awaiter1.SourceOnCompleted(Completed1Delegate, this);\n                    }\n                }\n                if (!running2)\n                {\n                    running2 = true;\n                    awaiter2 = enumerator2.MoveNextAsync().GetAwaiter();\n                    if (awaiter2.IsCompleted)\n                    {\n                        Completed2(this);\n                    }\n                    else\n                    {\n                        awaiter2.SourceOnCompleted(Completed2Delegate, this);\n                    }\n                }\n                if (!running3)\n                {\n                    running3 = true;\n                    awaiter3 = enumerator3.MoveNextAsync().GetAwaiter();\n                    if (awaiter3.IsCompleted)\n                    {\n                        Completed3(this);\n                    }\n                    else\n                    {\n                        awaiter3.SourceOnCompleted(Completed3Delegate, this);\n                    }\n                }\n                if (!running4)\n                {\n                    running4 = true;\n                    awaiter4 = enumerator4.MoveNextAsync().GetAwaiter();\n                    if (awaiter4.IsCompleted)\n                    {\n                        Completed4(this);\n                    }\n                    else\n                    {\n                        awaiter4.SourceOnCompleted(Completed4Delegate, this);\n                    }\n                }\n                if (!running5)\n                {\n                    running5 = true;\n                    awaiter5 = enumerator5.MoveNextAsync().GetAwaiter();\n                    if (awaiter5.IsCompleted)\n                    {\n                        Completed5(this);\n                    }\n                    else\n                    {\n                        awaiter5.SourceOnCompleted(Completed5Delegate, this);\n                    }\n                }\n                if (!running6)\n                {\n                    running6 = true;\n                    awaiter6 = enumerator6.MoveNextAsync().GetAwaiter();\n                    if (awaiter6.IsCompleted)\n                    {\n                        Completed6(this);\n                    }\n                    else\n                    {\n                        awaiter6.SourceOnCompleted(Completed6Delegate, this);\n                    }\n                }\n                if (!running7)\n                {\n                    running7 = true;\n                    awaiter7 = enumerator7.MoveNextAsync().GetAwaiter();\n                    if (awaiter7.IsCompleted)\n                    {\n                        Completed7(this);\n                    }\n                    else\n                    {\n                        awaiter7.SourceOnCompleted(Completed7Delegate, this);\n                    }\n                }\n                if (!running8)\n                {\n                    running8 = true;\n                    awaiter8 = enumerator8.MoveNextAsync().GetAwaiter();\n                    if (awaiter8.IsCompleted)\n                    {\n                        Completed8(this);\n                    }\n                    else\n                    {\n                        awaiter8.SourceOnCompleted(Completed8Delegate, this);\n                    }\n                }\n                if (!running9)\n                {\n                    running9 = true;\n                    awaiter9 = enumerator9.MoveNextAsync().GetAwaiter();\n                    if (awaiter9.IsCompleted)\n                    {\n                        Completed9(this);\n                    }\n                    else\n                    {\n                        awaiter9.SourceOnCompleted(Completed9Delegate, this);\n                    }\n                }\n                if (!running10)\n                {\n                    running10 = true;\n                    awaiter10 = enumerator10.MoveNextAsync().GetAwaiter();\n                    if (awaiter10.IsCompleted)\n                    {\n                        Completed10(this);\n                    }\n                    else\n                    {\n                        awaiter10.SourceOnCompleted(Completed10Delegate, this);\n                    }\n                }\n                if (!running11)\n                {\n                    running11 = true;\n                    awaiter11 = enumerator11.MoveNextAsync().GetAwaiter();\n                    if (awaiter11.IsCompleted)\n                    {\n                        Completed11(this);\n                    }\n                    else\n                    {\n                        awaiter11.SourceOnCompleted(Completed11Delegate, this);\n                    }\n                }\n\n                if (!running1 || !running2 || !running3 || !running4 || !running5 || !running6 || !running7 || !running8 || !running9 || !running10 || !running11)\n                {\n                    goto AGAIN;\n                }\n                syncRunning = false;\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void Completed1(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running1 = false;\n\n                try\n                {\n                    if (self.awaiter1.GetResult())\n                    {\n                        self.hasCurrent1 = true;\n                        self.current1 = self.enumerator1.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running1 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter1 = self.enumerator1.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter1.SourceOnCompleted(Completed1Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed2(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running2 = false;\n\n                try\n                {\n                    if (self.awaiter2.GetResult())\n                    {\n                        self.hasCurrent2 = true;\n                        self.current2 = self.enumerator2.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running2 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter2 = self.enumerator2.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter2.SourceOnCompleted(Completed2Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed3(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running3 = false;\n\n                try\n                {\n                    if (self.awaiter3.GetResult())\n                    {\n                        self.hasCurrent3 = true;\n                        self.current3 = self.enumerator3.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running3 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter3 = self.enumerator3.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter3.SourceOnCompleted(Completed3Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed4(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running4 = false;\n\n                try\n                {\n                    if (self.awaiter4.GetResult())\n                    {\n                        self.hasCurrent4 = true;\n                        self.current4 = self.enumerator4.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running4 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter4 = self.enumerator4.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter4.SourceOnCompleted(Completed4Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed5(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running5 = false;\n\n                try\n                {\n                    if (self.awaiter5.GetResult())\n                    {\n                        self.hasCurrent5 = true;\n                        self.current5 = self.enumerator5.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running5 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter5 = self.enumerator5.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter5.SourceOnCompleted(Completed5Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed6(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running6 = false;\n\n                try\n                {\n                    if (self.awaiter6.GetResult())\n                    {\n                        self.hasCurrent6 = true;\n                        self.current6 = self.enumerator6.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running6 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter6 = self.enumerator6.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter6.SourceOnCompleted(Completed6Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed7(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running7 = false;\n\n                try\n                {\n                    if (self.awaiter7.GetResult())\n                    {\n                        self.hasCurrent7 = true;\n                        self.current7 = self.enumerator7.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running7 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter7 = self.enumerator7.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter7.SourceOnCompleted(Completed7Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed8(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running8 = false;\n\n                try\n                {\n                    if (self.awaiter8.GetResult())\n                    {\n                        self.hasCurrent8 = true;\n                        self.current8 = self.enumerator8.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running8 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running8 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running8 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter8 = self.enumerator8.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter8.SourceOnCompleted(Completed8Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed9(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running9 = false;\n\n                try\n                {\n                    if (self.awaiter9.GetResult())\n                    {\n                        self.hasCurrent9 = true;\n                        self.current9 = self.enumerator9.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running9 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running9 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running9 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter9 = self.enumerator9.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter9.SourceOnCompleted(Completed9Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed10(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running10 = false;\n\n                try\n                {\n                    if (self.awaiter10.GetResult())\n                    {\n                        self.hasCurrent10 = true;\n                        self.current10 = self.enumerator10.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running10 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running10 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running10 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter10 = self.enumerator10.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter10.SourceOnCompleted(Completed10Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed11(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running11 = false;\n\n                try\n                {\n                    if (self.awaiter11.GetResult())\n                    {\n                        self.hasCurrent11 = true;\n                        self.current11 = self.enumerator11.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running11 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running11 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running11 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter11 = self.enumerator11.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter11.SourceOnCompleted(Completed11Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            bool TrySetResult()\n            {\n                if (hasCurrent1 && hasCurrent2 && hasCurrent3 && hasCurrent4 && hasCurrent5 && hasCurrent6 && hasCurrent7 && hasCurrent8 && hasCurrent9 && hasCurrent10 && hasCurrent11)\n                {\n                    result = resultSelector(current1, current2, current3, current4, current5, current6, current7, current8, current9, current10, current11);\n                    completionSource.TrySetResult(true);\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator1 != null)\n                {\n                    await enumerator1.DisposeAsync();\n                }\n                if (enumerator2 != null)\n                {\n                    await enumerator2.DisposeAsync();\n                }\n                if (enumerator3 != null)\n                {\n                    await enumerator3.DisposeAsync();\n                }\n                if (enumerator4 != null)\n                {\n                    await enumerator4.DisposeAsync();\n                }\n                if (enumerator5 != null)\n                {\n                    await enumerator5.DisposeAsync();\n                }\n                if (enumerator6 != null)\n                {\n                    await enumerator6.DisposeAsync();\n                }\n                if (enumerator7 != null)\n                {\n                    await enumerator7.DisposeAsync();\n                }\n                if (enumerator8 != null)\n                {\n                    await enumerator8.DisposeAsync();\n                }\n                if (enumerator9 != null)\n                {\n                    await enumerator9.DisposeAsync();\n                }\n                if (enumerator10 != null)\n                {\n                    await enumerator10.DisposeAsync();\n                }\n                if (enumerator11 != null)\n                {\n                    await enumerator11.DisposeAsync();\n                }\n            }\n        }\n    }\n\n    internal class CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<T1> source1;\n        readonly IUniTaskAsyncEnumerable<T2> source2;\n        readonly IUniTaskAsyncEnumerable<T3> source3;\n        readonly IUniTaskAsyncEnumerable<T4> source4;\n        readonly IUniTaskAsyncEnumerable<T5> source5;\n        readonly IUniTaskAsyncEnumerable<T6> source6;\n        readonly IUniTaskAsyncEnumerable<T7> source7;\n        readonly IUniTaskAsyncEnumerable<T8> source8;\n        readonly IUniTaskAsyncEnumerable<T9> source9;\n        readonly IUniTaskAsyncEnumerable<T10> source10;\n        readonly IUniTaskAsyncEnumerable<T11> source11;\n        readonly IUniTaskAsyncEnumerable<T12> source12;\n        \n        readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> resultSelector;\n\n        public CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, IUniTaskAsyncEnumerable<T11> source11, IUniTaskAsyncEnumerable<T12> source12, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> resultSelector)\n        {\n            this.source1 = source1;\n            this.source2 = source2;\n            this.source3 = source3;\n            this.source4 = source4;\n            this.source5 = source5;\n            this.source6 = source6;\n            this.source7 = source7;\n            this.source8 = source8;\n            this.source9 = source9;\n            this.source10 = source10;\n            this.source11 = source11;\n            this.source12 = source12;\n        \n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _CombineLatest(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, resultSelector, cancellationToken);\n        }\n\n        class _CombineLatest : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> Completed1Delegate = Completed1;\n            static readonly Action<object> Completed2Delegate = Completed2;\n            static readonly Action<object> Completed3Delegate = Completed3;\n            static readonly Action<object> Completed4Delegate = Completed4;\n            static readonly Action<object> Completed5Delegate = Completed5;\n            static readonly Action<object> Completed6Delegate = Completed6;\n            static readonly Action<object> Completed7Delegate = Completed7;\n            static readonly Action<object> Completed8Delegate = Completed8;\n            static readonly Action<object> Completed9Delegate = Completed9;\n            static readonly Action<object> Completed10Delegate = Completed10;\n            static readonly Action<object> Completed11Delegate = Completed11;\n            static readonly Action<object> Completed12Delegate = Completed12;\n            const int CompleteCount = 12;\n\n            readonly IUniTaskAsyncEnumerable<T1> source1;\n            readonly IUniTaskAsyncEnumerable<T2> source2;\n            readonly IUniTaskAsyncEnumerable<T3> source3;\n            readonly IUniTaskAsyncEnumerable<T4> source4;\n            readonly IUniTaskAsyncEnumerable<T5> source5;\n            readonly IUniTaskAsyncEnumerable<T6> source6;\n            readonly IUniTaskAsyncEnumerable<T7> source7;\n            readonly IUniTaskAsyncEnumerable<T8> source8;\n            readonly IUniTaskAsyncEnumerable<T9> source9;\n            readonly IUniTaskAsyncEnumerable<T10> source10;\n            readonly IUniTaskAsyncEnumerable<T11> source11;\n            readonly IUniTaskAsyncEnumerable<T12> source12;\n       \n            readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> resultSelector;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<T1> enumerator1;\n            UniTask<bool>.Awaiter awaiter1;\n            bool hasCurrent1;\n            bool running1;\n            T1 current1;\n\n            IUniTaskAsyncEnumerator<T2> enumerator2;\n            UniTask<bool>.Awaiter awaiter2;\n            bool hasCurrent2;\n            bool running2;\n            T2 current2;\n\n            IUniTaskAsyncEnumerator<T3> enumerator3;\n            UniTask<bool>.Awaiter awaiter3;\n            bool hasCurrent3;\n            bool running3;\n            T3 current3;\n\n            IUniTaskAsyncEnumerator<T4> enumerator4;\n            UniTask<bool>.Awaiter awaiter4;\n            bool hasCurrent4;\n            bool running4;\n            T4 current4;\n\n            IUniTaskAsyncEnumerator<T5> enumerator5;\n            UniTask<bool>.Awaiter awaiter5;\n            bool hasCurrent5;\n            bool running5;\n            T5 current5;\n\n            IUniTaskAsyncEnumerator<T6> enumerator6;\n            UniTask<bool>.Awaiter awaiter6;\n            bool hasCurrent6;\n            bool running6;\n            T6 current6;\n\n            IUniTaskAsyncEnumerator<T7> enumerator7;\n            UniTask<bool>.Awaiter awaiter7;\n            bool hasCurrent7;\n            bool running7;\n            T7 current7;\n\n            IUniTaskAsyncEnumerator<T8> enumerator8;\n            UniTask<bool>.Awaiter awaiter8;\n            bool hasCurrent8;\n            bool running8;\n            T8 current8;\n\n            IUniTaskAsyncEnumerator<T9> enumerator9;\n            UniTask<bool>.Awaiter awaiter9;\n            bool hasCurrent9;\n            bool running9;\n            T9 current9;\n\n            IUniTaskAsyncEnumerator<T10> enumerator10;\n            UniTask<bool>.Awaiter awaiter10;\n            bool hasCurrent10;\n            bool running10;\n            T10 current10;\n\n            IUniTaskAsyncEnumerator<T11> enumerator11;\n            UniTask<bool>.Awaiter awaiter11;\n            bool hasCurrent11;\n            bool running11;\n            T11 current11;\n\n            IUniTaskAsyncEnumerator<T12> enumerator12;\n            UniTask<bool>.Awaiter awaiter12;\n            bool hasCurrent12;\n            bool running12;\n            T12 current12;\n\n            int completedCount;\n            bool syncRunning;\n            TResult result;\n\n            public _CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, IUniTaskAsyncEnumerable<T11> source11, IUniTaskAsyncEnumerable<T12> source12, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> resultSelector, CancellationToken cancellationToken)\n            {\n                this.source1 = source1;\n                this.source2 = source2;\n                this.source3 = source3;\n                this.source4 = source4;\n                this.source5 = source5;\n                this.source6 = source6;\n                this.source7 = source7;\n                this.source8 = source8;\n                this.source9 = source9;\n                this.source10 = source10;\n                this.source11 = source11;\n                this.source12 = source12;\n                \n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current => result;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                if (completedCount == CompleteCount) return CompletedTasks.False;\n\n                if (enumerator1 == null)\n                {\n                    enumerator1 = source1.GetAsyncEnumerator(cancellationToken);\n                    enumerator2 = source2.GetAsyncEnumerator(cancellationToken);\n                    enumerator3 = source3.GetAsyncEnumerator(cancellationToken);\n                    enumerator4 = source4.GetAsyncEnumerator(cancellationToken);\n                    enumerator5 = source5.GetAsyncEnumerator(cancellationToken);\n                    enumerator6 = source6.GetAsyncEnumerator(cancellationToken);\n                    enumerator7 = source7.GetAsyncEnumerator(cancellationToken);\n                    enumerator8 = source8.GetAsyncEnumerator(cancellationToken);\n                    enumerator9 = source9.GetAsyncEnumerator(cancellationToken);\n                    enumerator10 = source10.GetAsyncEnumerator(cancellationToken);\n                    enumerator11 = source11.GetAsyncEnumerator(cancellationToken);\n                    enumerator12 = source12.GetAsyncEnumerator(cancellationToken);\n                }\n\n                completionSource.Reset();\n\n                AGAIN:\n                syncRunning = true;\n                if (!running1)\n                {\n                    running1 = true;\n                    awaiter1 = enumerator1.MoveNextAsync().GetAwaiter();\n                    if (awaiter1.IsCompleted)\n                    {\n                        Completed1(this);\n                    }\n                    else\n                    {\n                        awaiter1.SourceOnCompleted(Completed1Delegate, this);\n                    }\n                }\n                if (!running2)\n                {\n                    running2 = true;\n                    awaiter2 = enumerator2.MoveNextAsync().GetAwaiter();\n                    if (awaiter2.IsCompleted)\n                    {\n                        Completed2(this);\n                    }\n                    else\n                    {\n                        awaiter2.SourceOnCompleted(Completed2Delegate, this);\n                    }\n                }\n                if (!running3)\n                {\n                    running3 = true;\n                    awaiter3 = enumerator3.MoveNextAsync().GetAwaiter();\n                    if (awaiter3.IsCompleted)\n                    {\n                        Completed3(this);\n                    }\n                    else\n                    {\n                        awaiter3.SourceOnCompleted(Completed3Delegate, this);\n                    }\n                }\n                if (!running4)\n                {\n                    running4 = true;\n                    awaiter4 = enumerator4.MoveNextAsync().GetAwaiter();\n                    if (awaiter4.IsCompleted)\n                    {\n                        Completed4(this);\n                    }\n                    else\n                    {\n                        awaiter4.SourceOnCompleted(Completed4Delegate, this);\n                    }\n                }\n                if (!running5)\n                {\n                    running5 = true;\n                    awaiter5 = enumerator5.MoveNextAsync().GetAwaiter();\n                    if (awaiter5.IsCompleted)\n                    {\n                        Completed5(this);\n                    }\n                    else\n                    {\n                        awaiter5.SourceOnCompleted(Completed5Delegate, this);\n                    }\n                }\n                if (!running6)\n                {\n                    running6 = true;\n                    awaiter6 = enumerator6.MoveNextAsync().GetAwaiter();\n                    if (awaiter6.IsCompleted)\n                    {\n                        Completed6(this);\n                    }\n                    else\n                    {\n                        awaiter6.SourceOnCompleted(Completed6Delegate, this);\n                    }\n                }\n                if (!running7)\n                {\n                    running7 = true;\n                    awaiter7 = enumerator7.MoveNextAsync().GetAwaiter();\n                    if (awaiter7.IsCompleted)\n                    {\n                        Completed7(this);\n                    }\n                    else\n                    {\n                        awaiter7.SourceOnCompleted(Completed7Delegate, this);\n                    }\n                }\n                if (!running8)\n                {\n                    running8 = true;\n                    awaiter8 = enumerator8.MoveNextAsync().GetAwaiter();\n                    if (awaiter8.IsCompleted)\n                    {\n                        Completed8(this);\n                    }\n                    else\n                    {\n                        awaiter8.SourceOnCompleted(Completed8Delegate, this);\n                    }\n                }\n                if (!running9)\n                {\n                    running9 = true;\n                    awaiter9 = enumerator9.MoveNextAsync().GetAwaiter();\n                    if (awaiter9.IsCompleted)\n                    {\n                        Completed9(this);\n                    }\n                    else\n                    {\n                        awaiter9.SourceOnCompleted(Completed9Delegate, this);\n                    }\n                }\n                if (!running10)\n                {\n                    running10 = true;\n                    awaiter10 = enumerator10.MoveNextAsync().GetAwaiter();\n                    if (awaiter10.IsCompleted)\n                    {\n                        Completed10(this);\n                    }\n                    else\n                    {\n                        awaiter10.SourceOnCompleted(Completed10Delegate, this);\n                    }\n                }\n                if (!running11)\n                {\n                    running11 = true;\n                    awaiter11 = enumerator11.MoveNextAsync().GetAwaiter();\n                    if (awaiter11.IsCompleted)\n                    {\n                        Completed11(this);\n                    }\n                    else\n                    {\n                        awaiter11.SourceOnCompleted(Completed11Delegate, this);\n                    }\n                }\n                if (!running12)\n                {\n                    running12 = true;\n                    awaiter12 = enumerator12.MoveNextAsync().GetAwaiter();\n                    if (awaiter12.IsCompleted)\n                    {\n                        Completed12(this);\n                    }\n                    else\n                    {\n                        awaiter12.SourceOnCompleted(Completed12Delegate, this);\n                    }\n                }\n\n                if (!running1 || !running2 || !running3 || !running4 || !running5 || !running6 || !running7 || !running8 || !running9 || !running10 || !running11 || !running12)\n                {\n                    goto AGAIN;\n                }\n                syncRunning = false;\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void Completed1(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running1 = false;\n\n                try\n                {\n                    if (self.awaiter1.GetResult())\n                    {\n                        self.hasCurrent1 = true;\n                        self.current1 = self.enumerator1.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running1 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter1 = self.enumerator1.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter1.SourceOnCompleted(Completed1Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed2(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running2 = false;\n\n                try\n                {\n                    if (self.awaiter2.GetResult())\n                    {\n                        self.hasCurrent2 = true;\n                        self.current2 = self.enumerator2.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running2 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter2 = self.enumerator2.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter2.SourceOnCompleted(Completed2Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed3(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running3 = false;\n\n                try\n                {\n                    if (self.awaiter3.GetResult())\n                    {\n                        self.hasCurrent3 = true;\n                        self.current3 = self.enumerator3.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running3 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter3 = self.enumerator3.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter3.SourceOnCompleted(Completed3Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed4(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running4 = false;\n\n                try\n                {\n                    if (self.awaiter4.GetResult())\n                    {\n                        self.hasCurrent4 = true;\n                        self.current4 = self.enumerator4.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running4 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter4 = self.enumerator4.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter4.SourceOnCompleted(Completed4Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed5(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running5 = false;\n\n                try\n                {\n                    if (self.awaiter5.GetResult())\n                    {\n                        self.hasCurrent5 = true;\n                        self.current5 = self.enumerator5.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running5 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter5 = self.enumerator5.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter5.SourceOnCompleted(Completed5Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed6(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running6 = false;\n\n                try\n                {\n                    if (self.awaiter6.GetResult())\n                    {\n                        self.hasCurrent6 = true;\n                        self.current6 = self.enumerator6.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running6 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter6 = self.enumerator6.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter6.SourceOnCompleted(Completed6Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed7(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running7 = false;\n\n                try\n                {\n                    if (self.awaiter7.GetResult())\n                    {\n                        self.hasCurrent7 = true;\n                        self.current7 = self.enumerator7.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running7 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter7 = self.enumerator7.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter7.SourceOnCompleted(Completed7Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed8(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running8 = false;\n\n                try\n                {\n                    if (self.awaiter8.GetResult())\n                    {\n                        self.hasCurrent8 = true;\n                        self.current8 = self.enumerator8.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running8 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running8 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running8 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter8 = self.enumerator8.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter8.SourceOnCompleted(Completed8Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed9(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running9 = false;\n\n                try\n                {\n                    if (self.awaiter9.GetResult())\n                    {\n                        self.hasCurrent9 = true;\n                        self.current9 = self.enumerator9.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running9 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running9 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running9 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter9 = self.enumerator9.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter9.SourceOnCompleted(Completed9Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed10(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running10 = false;\n\n                try\n                {\n                    if (self.awaiter10.GetResult())\n                    {\n                        self.hasCurrent10 = true;\n                        self.current10 = self.enumerator10.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running10 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running10 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running10 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter10 = self.enumerator10.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter10.SourceOnCompleted(Completed10Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed11(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running11 = false;\n\n                try\n                {\n                    if (self.awaiter11.GetResult())\n                    {\n                        self.hasCurrent11 = true;\n                        self.current11 = self.enumerator11.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running11 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running11 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running11 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter11 = self.enumerator11.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter11.SourceOnCompleted(Completed11Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed12(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running12 = false;\n\n                try\n                {\n                    if (self.awaiter12.GetResult())\n                    {\n                        self.hasCurrent12 = true;\n                        self.current12 = self.enumerator12.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running12 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running12 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running12 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter12 = self.enumerator12.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter12.SourceOnCompleted(Completed12Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            bool TrySetResult()\n            {\n                if (hasCurrent1 && hasCurrent2 && hasCurrent3 && hasCurrent4 && hasCurrent5 && hasCurrent6 && hasCurrent7 && hasCurrent8 && hasCurrent9 && hasCurrent10 && hasCurrent11 && hasCurrent12)\n                {\n                    result = resultSelector(current1, current2, current3, current4, current5, current6, current7, current8, current9, current10, current11, current12);\n                    completionSource.TrySetResult(true);\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator1 != null)\n                {\n                    await enumerator1.DisposeAsync();\n                }\n                if (enumerator2 != null)\n                {\n                    await enumerator2.DisposeAsync();\n                }\n                if (enumerator3 != null)\n                {\n                    await enumerator3.DisposeAsync();\n                }\n                if (enumerator4 != null)\n                {\n                    await enumerator4.DisposeAsync();\n                }\n                if (enumerator5 != null)\n                {\n                    await enumerator5.DisposeAsync();\n                }\n                if (enumerator6 != null)\n                {\n                    await enumerator6.DisposeAsync();\n                }\n                if (enumerator7 != null)\n                {\n                    await enumerator7.DisposeAsync();\n                }\n                if (enumerator8 != null)\n                {\n                    await enumerator8.DisposeAsync();\n                }\n                if (enumerator9 != null)\n                {\n                    await enumerator9.DisposeAsync();\n                }\n                if (enumerator10 != null)\n                {\n                    await enumerator10.DisposeAsync();\n                }\n                if (enumerator11 != null)\n                {\n                    await enumerator11.DisposeAsync();\n                }\n                if (enumerator12 != null)\n                {\n                    await enumerator12.DisposeAsync();\n                }\n            }\n        }\n    }\n\n    internal class CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<T1> source1;\n        readonly IUniTaskAsyncEnumerable<T2> source2;\n        readonly IUniTaskAsyncEnumerable<T3> source3;\n        readonly IUniTaskAsyncEnumerable<T4> source4;\n        readonly IUniTaskAsyncEnumerable<T5> source5;\n        readonly IUniTaskAsyncEnumerable<T6> source6;\n        readonly IUniTaskAsyncEnumerable<T7> source7;\n        readonly IUniTaskAsyncEnumerable<T8> source8;\n        readonly IUniTaskAsyncEnumerable<T9> source9;\n        readonly IUniTaskAsyncEnumerable<T10> source10;\n        readonly IUniTaskAsyncEnumerable<T11> source11;\n        readonly IUniTaskAsyncEnumerable<T12> source12;\n        readonly IUniTaskAsyncEnumerable<T13> source13;\n        \n        readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> resultSelector;\n\n        public CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, IUniTaskAsyncEnumerable<T11> source11, IUniTaskAsyncEnumerable<T12> source12, IUniTaskAsyncEnumerable<T13> source13, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> resultSelector)\n        {\n            this.source1 = source1;\n            this.source2 = source2;\n            this.source3 = source3;\n            this.source4 = source4;\n            this.source5 = source5;\n            this.source6 = source6;\n            this.source7 = source7;\n            this.source8 = source8;\n            this.source9 = source9;\n            this.source10 = source10;\n            this.source11 = source11;\n            this.source12 = source12;\n            this.source13 = source13;\n        \n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _CombineLatest(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, resultSelector, cancellationToken);\n        }\n\n        class _CombineLatest : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> Completed1Delegate = Completed1;\n            static readonly Action<object> Completed2Delegate = Completed2;\n            static readonly Action<object> Completed3Delegate = Completed3;\n            static readonly Action<object> Completed4Delegate = Completed4;\n            static readonly Action<object> Completed5Delegate = Completed5;\n            static readonly Action<object> Completed6Delegate = Completed6;\n            static readonly Action<object> Completed7Delegate = Completed7;\n            static readonly Action<object> Completed8Delegate = Completed8;\n            static readonly Action<object> Completed9Delegate = Completed9;\n            static readonly Action<object> Completed10Delegate = Completed10;\n            static readonly Action<object> Completed11Delegate = Completed11;\n            static readonly Action<object> Completed12Delegate = Completed12;\n            static readonly Action<object> Completed13Delegate = Completed13;\n            const int CompleteCount = 13;\n\n            readonly IUniTaskAsyncEnumerable<T1> source1;\n            readonly IUniTaskAsyncEnumerable<T2> source2;\n            readonly IUniTaskAsyncEnumerable<T3> source3;\n            readonly IUniTaskAsyncEnumerable<T4> source4;\n            readonly IUniTaskAsyncEnumerable<T5> source5;\n            readonly IUniTaskAsyncEnumerable<T6> source6;\n            readonly IUniTaskAsyncEnumerable<T7> source7;\n            readonly IUniTaskAsyncEnumerable<T8> source8;\n            readonly IUniTaskAsyncEnumerable<T9> source9;\n            readonly IUniTaskAsyncEnumerable<T10> source10;\n            readonly IUniTaskAsyncEnumerable<T11> source11;\n            readonly IUniTaskAsyncEnumerable<T12> source12;\n            readonly IUniTaskAsyncEnumerable<T13> source13;\n       \n            readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> resultSelector;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<T1> enumerator1;\n            UniTask<bool>.Awaiter awaiter1;\n            bool hasCurrent1;\n            bool running1;\n            T1 current1;\n\n            IUniTaskAsyncEnumerator<T2> enumerator2;\n            UniTask<bool>.Awaiter awaiter2;\n            bool hasCurrent2;\n            bool running2;\n            T2 current2;\n\n            IUniTaskAsyncEnumerator<T3> enumerator3;\n            UniTask<bool>.Awaiter awaiter3;\n            bool hasCurrent3;\n            bool running3;\n            T3 current3;\n\n            IUniTaskAsyncEnumerator<T4> enumerator4;\n            UniTask<bool>.Awaiter awaiter4;\n            bool hasCurrent4;\n            bool running4;\n            T4 current4;\n\n            IUniTaskAsyncEnumerator<T5> enumerator5;\n            UniTask<bool>.Awaiter awaiter5;\n            bool hasCurrent5;\n            bool running5;\n            T5 current5;\n\n            IUniTaskAsyncEnumerator<T6> enumerator6;\n            UniTask<bool>.Awaiter awaiter6;\n            bool hasCurrent6;\n            bool running6;\n            T6 current6;\n\n            IUniTaskAsyncEnumerator<T7> enumerator7;\n            UniTask<bool>.Awaiter awaiter7;\n            bool hasCurrent7;\n            bool running7;\n            T7 current7;\n\n            IUniTaskAsyncEnumerator<T8> enumerator8;\n            UniTask<bool>.Awaiter awaiter8;\n            bool hasCurrent8;\n            bool running8;\n            T8 current8;\n\n            IUniTaskAsyncEnumerator<T9> enumerator9;\n            UniTask<bool>.Awaiter awaiter9;\n            bool hasCurrent9;\n            bool running9;\n            T9 current9;\n\n            IUniTaskAsyncEnumerator<T10> enumerator10;\n            UniTask<bool>.Awaiter awaiter10;\n            bool hasCurrent10;\n            bool running10;\n            T10 current10;\n\n            IUniTaskAsyncEnumerator<T11> enumerator11;\n            UniTask<bool>.Awaiter awaiter11;\n            bool hasCurrent11;\n            bool running11;\n            T11 current11;\n\n            IUniTaskAsyncEnumerator<T12> enumerator12;\n            UniTask<bool>.Awaiter awaiter12;\n            bool hasCurrent12;\n            bool running12;\n            T12 current12;\n\n            IUniTaskAsyncEnumerator<T13> enumerator13;\n            UniTask<bool>.Awaiter awaiter13;\n            bool hasCurrent13;\n            bool running13;\n            T13 current13;\n\n            int completedCount;\n            bool syncRunning;\n            TResult result;\n\n            public _CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, IUniTaskAsyncEnumerable<T11> source11, IUniTaskAsyncEnumerable<T12> source12, IUniTaskAsyncEnumerable<T13> source13, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> resultSelector, CancellationToken cancellationToken)\n            {\n                this.source1 = source1;\n                this.source2 = source2;\n                this.source3 = source3;\n                this.source4 = source4;\n                this.source5 = source5;\n                this.source6 = source6;\n                this.source7 = source7;\n                this.source8 = source8;\n                this.source9 = source9;\n                this.source10 = source10;\n                this.source11 = source11;\n                this.source12 = source12;\n                this.source13 = source13;\n                \n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current => result;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                if (completedCount == CompleteCount) return CompletedTasks.False;\n\n                if (enumerator1 == null)\n                {\n                    enumerator1 = source1.GetAsyncEnumerator(cancellationToken);\n                    enumerator2 = source2.GetAsyncEnumerator(cancellationToken);\n                    enumerator3 = source3.GetAsyncEnumerator(cancellationToken);\n                    enumerator4 = source4.GetAsyncEnumerator(cancellationToken);\n                    enumerator5 = source5.GetAsyncEnumerator(cancellationToken);\n                    enumerator6 = source6.GetAsyncEnumerator(cancellationToken);\n                    enumerator7 = source7.GetAsyncEnumerator(cancellationToken);\n                    enumerator8 = source8.GetAsyncEnumerator(cancellationToken);\n                    enumerator9 = source9.GetAsyncEnumerator(cancellationToken);\n                    enumerator10 = source10.GetAsyncEnumerator(cancellationToken);\n                    enumerator11 = source11.GetAsyncEnumerator(cancellationToken);\n                    enumerator12 = source12.GetAsyncEnumerator(cancellationToken);\n                    enumerator13 = source13.GetAsyncEnumerator(cancellationToken);\n                }\n\n                completionSource.Reset();\n\n                AGAIN:\n                syncRunning = true;\n                if (!running1)\n                {\n                    running1 = true;\n                    awaiter1 = enumerator1.MoveNextAsync().GetAwaiter();\n                    if (awaiter1.IsCompleted)\n                    {\n                        Completed1(this);\n                    }\n                    else\n                    {\n                        awaiter1.SourceOnCompleted(Completed1Delegate, this);\n                    }\n                }\n                if (!running2)\n                {\n                    running2 = true;\n                    awaiter2 = enumerator2.MoveNextAsync().GetAwaiter();\n                    if (awaiter2.IsCompleted)\n                    {\n                        Completed2(this);\n                    }\n                    else\n                    {\n                        awaiter2.SourceOnCompleted(Completed2Delegate, this);\n                    }\n                }\n                if (!running3)\n                {\n                    running3 = true;\n                    awaiter3 = enumerator3.MoveNextAsync().GetAwaiter();\n                    if (awaiter3.IsCompleted)\n                    {\n                        Completed3(this);\n                    }\n                    else\n                    {\n                        awaiter3.SourceOnCompleted(Completed3Delegate, this);\n                    }\n                }\n                if (!running4)\n                {\n                    running4 = true;\n                    awaiter4 = enumerator4.MoveNextAsync().GetAwaiter();\n                    if (awaiter4.IsCompleted)\n                    {\n                        Completed4(this);\n                    }\n                    else\n                    {\n                        awaiter4.SourceOnCompleted(Completed4Delegate, this);\n                    }\n                }\n                if (!running5)\n                {\n                    running5 = true;\n                    awaiter5 = enumerator5.MoveNextAsync().GetAwaiter();\n                    if (awaiter5.IsCompleted)\n                    {\n                        Completed5(this);\n                    }\n                    else\n                    {\n                        awaiter5.SourceOnCompleted(Completed5Delegate, this);\n                    }\n                }\n                if (!running6)\n                {\n                    running6 = true;\n                    awaiter6 = enumerator6.MoveNextAsync().GetAwaiter();\n                    if (awaiter6.IsCompleted)\n                    {\n                        Completed6(this);\n                    }\n                    else\n                    {\n                        awaiter6.SourceOnCompleted(Completed6Delegate, this);\n                    }\n                }\n                if (!running7)\n                {\n                    running7 = true;\n                    awaiter7 = enumerator7.MoveNextAsync().GetAwaiter();\n                    if (awaiter7.IsCompleted)\n                    {\n                        Completed7(this);\n                    }\n                    else\n                    {\n                        awaiter7.SourceOnCompleted(Completed7Delegate, this);\n                    }\n                }\n                if (!running8)\n                {\n                    running8 = true;\n                    awaiter8 = enumerator8.MoveNextAsync().GetAwaiter();\n                    if (awaiter8.IsCompleted)\n                    {\n                        Completed8(this);\n                    }\n                    else\n                    {\n                        awaiter8.SourceOnCompleted(Completed8Delegate, this);\n                    }\n                }\n                if (!running9)\n                {\n                    running9 = true;\n                    awaiter9 = enumerator9.MoveNextAsync().GetAwaiter();\n                    if (awaiter9.IsCompleted)\n                    {\n                        Completed9(this);\n                    }\n                    else\n                    {\n                        awaiter9.SourceOnCompleted(Completed9Delegate, this);\n                    }\n                }\n                if (!running10)\n                {\n                    running10 = true;\n                    awaiter10 = enumerator10.MoveNextAsync().GetAwaiter();\n                    if (awaiter10.IsCompleted)\n                    {\n                        Completed10(this);\n                    }\n                    else\n                    {\n                        awaiter10.SourceOnCompleted(Completed10Delegate, this);\n                    }\n                }\n                if (!running11)\n                {\n                    running11 = true;\n                    awaiter11 = enumerator11.MoveNextAsync().GetAwaiter();\n                    if (awaiter11.IsCompleted)\n                    {\n                        Completed11(this);\n                    }\n                    else\n                    {\n                        awaiter11.SourceOnCompleted(Completed11Delegate, this);\n                    }\n                }\n                if (!running12)\n                {\n                    running12 = true;\n                    awaiter12 = enumerator12.MoveNextAsync().GetAwaiter();\n                    if (awaiter12.IsCompleted)\n                    {\n                        Completed12(this);\n                    }\n                    else\n                    {\n                        awaiter12.SourceOnCompleted(Completed12Delegate, this);\n                    }\n                }\n                if (!running13)\n                {\n                    running13 = true;\n                    awaiter13 = enumerator13.MoveNextAsync().GetAwaiter();\n                    if (awaiter13.IsCompleted)\n                    {\n                        Completed13(this);\n                    }\n                    else\n                    {\n                        awaiter13.SourceOnCompleted(Completed13Delegate, this);\n                    }\n                }\n\n                if (!running1 || !running2 || !running3 || !running4 || !running5 || !running6 || !running7 || !running8 || !running9 || !running10 || !running11 || !running12 || !running13)\n                {\n                    goto AGAIN;\n                }\n                syncRunning = false;\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void Completed1(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running1 = false;\n\n                try\n                {\n                    if (self.awaiter1.GetResult())\n                    {\n                        self.hasCurrent1 = true;\n                        self.current1 = self.enumerator1.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running1 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter1 = self.enumerator1.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter1.SourceOnCompleted(Completed1Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed2(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running2 = false;\n\n                try\n                {\n                    if (self.awaiter2.GetResult())\n                    {\n                        self.hasCurrent2 = true;\n                        self.current2 = self.enumerator2.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running2 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter2 = self.enumerator2.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter2.SourceOnCompleted(Completed2Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed3(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running3 = false;\n\n                try\n                {\n                    if (self.awaiter3.GetResult())\n                    {\n                        self.hasCurrent3 = true;\n                        self.current3 = self.enumerator3.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running3 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter3 = self.enumerator3.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter3.SourceOnCompleted(Completed3Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed4(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running4 = false;\n\n                try\n                {\n                    if (self.awaiter4.GetResult())\n                    {\n                        self.hasCurrent4 = true;\n                        self.current4 = self.enumerator4.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running4 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter4 = self.enumerator4.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter4.SourceOnCompleted(Completed4Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed5(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running5 = false;\n\n                try\n                {\n                    if (self.awaiter5.GetResult())\n                    {\n                        self.hasCurrent5 = true;\n                        self.current5 = self.enumerator5.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running5 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter5 = self.enumerator5.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter5.SourceOnCompleted(Completed5Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed6(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running6 = false;\n\n                try\n                {\n                    if (self.awaiter6.GetResult())\n                    {\n                        self.hasCurrent6 = true;\n                        self.current6 = self.enumerator6.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running6 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter6 = self.enumerator6.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter6.SourceOnCompleted(Completed6Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed7(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running7 = false;\n\n                try\n                {\n                    if (self.awaiter7.GetResult())\n                    {\n                        self.hasCurrent7 = true;\n                        self.current7 = self.enumerator7.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running7 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter7 = self.enumerator7.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter7.SourceOnCompleted(Completed7Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed8(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running8 = false;\n\n                try\n                {\n                    if (self.awaiter8.GetResult())\n                    {\n                        self.hasCurrent8 = true;\n                        self.current8 = self.enumerator8.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running8 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running8 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running8 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter8 = self.enumerator8.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter8.SourceOnCompleted(Completed8Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed9(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running9 = false;\n\n                try\n                {\n                    if (self.awaiter9.GetResult())\n                    {\n                        self.hasCurrent9 = true;\n                        self.current9 = self.enumerator9.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running9 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running9 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running9 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter9 = self.enumerator9.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter9.SourceOnCompleted(Completed9Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed10(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running10 = false;\n\n                try\n                {\n                    if (self.awaiter10.GetResult())\n                    {\n                        self.hasCurrent10 = true;\n                        self.current10 = self.enumerator10.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running10 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running10 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running10 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter10 = self.enumerator10.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter10.SourceOnCompleted(Completed10Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed11(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running11 = false;\n\n                try\n                {\n                    if (self.awaiter11.GetResult())\n                    {\n                        self.hasCurrent11 = true;\n                        self.current11 = self.enumerator11.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running11 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running11 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running11 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter11 = self.enumerator11.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter11.SourceOnCompleted(Completed11Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed12(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running12 = false;\n\n                try\n                {\n                    if (self.awaiter12.GetResult())\n                    {\n                        self.hasCurrent12 = true;\n                        self.current12 = self.enumerator12.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running12 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running12 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running12 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter12 = self.enumerator12.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter12.SourceOnCompleted(Completed12Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed13(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running13 = false;\n\n                try\n                {\n                    if (self.awaiter13.GetResult())\n                    {\n                        self.hasCurrent13 = true;\n                        self.current13 = self.enumerator13.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running13 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running13 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running13 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter13 = self.enumerator13.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter13.SourceOnCompleted(Completed13Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            bool TrySetResult()\n            {\n                if (hasCurrent1 && hasCurrent2 && hasCurrent3 && hasCurrent4 && hasCurrent5 && hasCurrent6 && hasCurrent7 && hasCurrent8 && hasCurrent9 && hasCurrent10 && hasCurrent11 && hasCurrent12 && hasCurrent13)\n                {\n                    result = resultSelector(current1, current2, current3, current4, current5, current6, current7, current8, current9, current10, current11, current12, current13);\n                    completionSource.TrySetResult(true);\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator1 != null)\n                {\n                    await enumerator1.DisposeAsync();\n                }\n                if (enumerator2 != null)\n                {\n                    await enumerator2.DisposeAsync();\n                }\n                if (enumerator3 != null)\n                {\n                    await enumerator3.DisposeAsync();\n                }\n                if (enumerator4 != null)\n                {\n                    await enumerator4.DisposeAsync();\n                }\n                if (enumerator5 != null)\n                {\n                    await enumerator5.DisposeAsync();\n                }\n                if (enumerator6 != null)\n                {\n                    await enumerator6.DisposeAsync();\n                }\n                if (enumerator7 != null)\n                {\n                    await enumerator7.DisposeAsync();\n                }\n                if (enumerator8 != null)\n                {\n                    await enumerator8.DisposeAsync();\n                }\n                if (enumerator9 != null)\n                {\n                    await enumerator9.DisposeAsync();\n                }\n                if (enumerator10 != null)\n                {\n                    await enumerator10.DisposeAsync();\n                }\n                if (enumerator11 != null)\n                {\n                    await enumerator11.DisposeAsync();\n                }\n                if (enumerator12 != null)\n                {\n                    await enumerator12.DisposeAsync();\n                }\n                if (enumerator13 != null)\n                {\n                    await enumerator13.DisposeAsync();\n                }\n            }\n        }\n    }\n\n    internal class CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<T1> source1;\n        readonly IUniTaskAsyncEnumerable<T2> source2;\n        readonly IUniTaskAsyncEnumerable<T3> source3;\n        readonly IUniTaskAsyncEnumerable<T4> source4;\n        readonly IUniTaskAsyncEnumerable<T5> source5;\n        readonly IUniTaskAsyncEnumerable<T6> source6;\n        readonly IUniTaskAsyncEnumerable<T7> source7;\n        readonly IUniTaskAsyncEnumerable<T8> source8;\n        readonly IUniTaskAsyncEnumerable<T9> source9;\n        readonly IUniTaskAsyncEnumerable<T10> source10;\n        readonly IUniTaskAsyncEnumerable<T11> source11;\n        readonly IUniTaskAsyncEnumerable<T12> source12;\n        readonly IUniTaskAsyncEnumerable<T13> source13;\n        readonly IUniTaskAsyncEnumerable<T14> source14;\n        \n        readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> resultSelector;\n\n        public CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, IUniTaskAsyncEnumerable<T11> source11, IUniTaskAsyncEnumerable<T12> source12, IUniTaskAsyncEnumerable<T13> source13, IUniTaskAsyncEnumerable<T14> source14, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> resultSelector)\n        {\n            this.source1 = source1;\n            this.source2 = source2;\n            this.source3 = source3;\n            this.source4 = source4;\n            this.source5 = source5;\n            this.source6 = source6;\n            this.source7 = source7;\n            this.source8 = source8;\n            this.source9 = source9;\n            this.source10 = source10;\n            this.source11 = source11;\n            this.source12 = source12;\n            this.source13 = source13;\n            this.source14 = source14;\n        \n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _CombineLatest(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, resultSelector, cancellationToken);\n        }\n\n        class _CombineLatest : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> Completed1Delegate = Completed1;\n            static readonly Action<object> Completed2Delegate = Completed2;\n            static readonly Action<object> Completed3Delegate = Completed3;\n            static readonly Action<object> Completed4Delegate = Completed4;\n            static readonly Action<object> Completed5Delegate = Completed5;\n            static readonly Action<object> Completed6Delegate = Completed6;\n            static readonly Action<object> Completed7Delegate = Completed7;\n            static readonly Action<object> Completed8Delegate = Completed8;\n            static readonly Action<object> Completed9Delegate = Completed9;\n            static readonly Action<object> Completed10Delegate = Completed10;\n            static readonly Action<object> Completed11Delegate = Completed11;\n            static readonly Action<object> Completed12Delegate = Completed12;\n            static readonly Action<object> Completed13Delegate = Completed13;\n            static readonly Action<object> Completed14Delegate = Completed14;\n            const int CompleteCount = 14;\n\n            readonly IUniTaskAsyncEnumerable<T1> source1;\n            readonly IUniTaskAsyncEnumerable<T2> source2;\n            readonly IUniTaskAsyncEnumerable<T3> source3;\n            readonly IUniTaskAsyncEnumerable<T4> source4;\n            readonly IUniTaskAsyncEnumerable<T5> source5;\n            readonly IUniTaskAsyncEnumerable<T6> source6;\n            readonly IUniTaskAsyncEnumerable<T7> source7;\n            readonly IUniTaskAsyncEnumerable<T8> source8;\n            readonly IUniTaskAsyncEnumerable<T9> source9;\n            readonly IUniTaskAsyncEnumerable<T10> source10;\n            readonly IUniTaskAsyncEnumerable<T11> source11;\n            readonly IUniTaskAsyncEnumerable<T12> source12;\n            readonly IUniTaskAsyncEnumerable<T13> source13;\n            readonly IUniTaskAsyncEnumerable<T14> source14;\n       \n            readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> resultSelector;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<T1> enumerator1;\n            UniTask<bool>.Awaiter awaiter1;\n            bool hasCurrent1;\n            bool running1;\n            T1 current1;\n\n            IUniTaskAsyncEnumerator<T2> enumerator2;\n            UniTask<bool>.Awaiter awaiter2;\n            bool hasCurrent2;\n            bool running2;\n            T2 current2;\n\n            IUniTaskAsyncEnumerator<T3> enumerator3;\n            UniTask<bool>.Awaiter awaiter3;\n            bool hasCurrent3;\n            bool running3;\n            T3 current3;\n\n            IUniTaskAsyncEnumerator<T4> enumerator4;\n            UniTask<bool>.Awaiter awaiter4;\n            bool hasCurrent4;\n            bool running4;\n            T4 current4;\n\n            IUniTaskAsyncEnumerator<T5> enumerator5;\n            UniTask<bool>.Awaiter awaiter5;\n            bool hasCurrent5;\n            bool running5;\n            T5 current5;\n\n            IUniTaskAsyncEnumerator<T6> enumerator6;\n            UniTask<bool>.Awaiter awaiter6;\n            bool hasCurrent6;\n            bool running6;\n            T6 current6;\n\n            IUniTaskAsyncEnumerator<T7> enumerator7;\n            UniTask<bool>.Awaiter awaiter7;\n            bool hasCurrent7;\n            bool running7;\n            T7 current7;\n\n            IUniTaskAsyncEnumerator<T8> enumerator8;\n            UniTask<bool>.Awaiter awaiter8;\n            bool hasCurrent8;\n            bool running8;\n            T8 current8;\n\n            IUniTaskAsyncEnumerator<T9> enumerator9;\n            UniTask<bool>.Awaiter awaiter9;\n            bool hasCurrent9;\n            bool running9;\n            T9 current9;\n\n            IUniTaskAsyncEnumerator<T10> enumerator10;\n            UniTask<bool>.Awaiter awaiter10;\n            bool hasCurrent10;\n            bool running10;\n            T10 current10;\n\n            IUniTaskAsyncEnumerator<T11> enumerator11;\n            UniTask<bool>.Awaiter awaiter11;\n            bool hasCurrent11;\n            bool running11;\n            T11 current11;\n\n            IUniTaskAsyncEnumerator<T12> enumerator12;\n            UniTask<bool>.Awaiter awaiter12;\n            bool hasCurrent12;\n            bool running12;\n            T12 current12;\n\n            IUniTaskAsyncEnumerator<T13> enumerator13;\n            UniTask<bool>.Awaiter awaiter13;\n            bool hasCurrent13;\n            bool running13;\n            T13 current13;\n\n            IUniTaskAsyncEnumerator<T14> enumerator14;\n            UniTask<bool>.Awaiter awaiter14;\n            bool hasCurrent14;\n            bool running14;\n            T14 current14;\n\n            int completedCount;\n            bool syncRunning;\n            TResult result;\n\n            public _CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, IUniTaskAsyncEnumerable<T11> source11, IUniTaskAsyncEnumerable<T12> source12, IUniTaskAsyncEnumerable<T13> source13, IUniTaskAsyncEnumerable<T14> source14, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> resultSelector, CancellationToken cancellationToken)\n            {\n                this.source1 = source1;\n                this.source2 = source2;\n                this.source3 = source3;\n                this.source4 = source4;\n                this.source5 = source5;\n                this.source6 = source6;\n                this.source7 = source7;\n                this.source8 = source8;\n                this.source9 = source9;\n                this.source10 = source10;\n                this.source11 = source11;\n                this.source12 = source12;\n                this.source13 = source13;\n                this.source14 = source14;\n                \n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current => result;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                if (completedCount == CompleteCount) return CompletedTasks.False;\n\n                if (enumerator1 == null)\n                {\n                    enumerator1 = source1.GetAsyncEnumerator(cancellationToken);\n                    enumerator2 = source2.GetAsyncEnumerator(cancellationToken);\n                    enumerator3 = source3.GetAsyncEnumerator(cancellationToken);\n                    enumerator4 = source4.GetAsyncEnumerator(cancellationToken);\n                    enumerator5 = source5.GetAsyncEnumerator(cancellationToken);\n                    enumerator6 = source6.GetAsyncEnumerator(cancellationToken);\n                    enumerator7 = source7.GetAsyncEnumerator(cancellationToken);\n                    enumerator8 = source8.GetAsyncEnumerator(cancellationToken);\n                    enumerator9 = source9.GetAsyncEnumerator(cancellationToken);\n                    enumerator10 = source10.GetAsyncEnumerator(cancellationToken);\n                    enumerator11 = source11.GetAsyncEnumerator(cancellationToken);\n                    enumerator12 = source12.GetAsyncEnumerator(cancellationToken);\n                    enumerator13 = source13.GetAsyncEnumerator(cancellationToken);\n                    enumerator14 = source14.GetAsyncEnumerator(cancellationToken);\n                }\n\n                completionSource.Reset();\n\n                AGAIN:\n                syncRunning = true;\n                if (!running1)\n                {\n                    running1 = true;\n                    awaiter1 = enumerator1.MoveNextAsync().GetAwaiter();\n                    if (awaiter1.IsCompleted)\n                    {\n                        Completed1(this);\n                    }\n                    else\n                    {\n                        awaiter1.SourceOnCompleted(Completed1Delegate, this);\n                    }\n                }\n                if (!running2)\n                {\n                    running2 = true;\n                    awaiter2 = enumerator2.MoveNextAsync().GetAwaiter();\n                    if (awaiter2.IsCompleted)\n                    {\n                        Completed2(this);\n                    }\n                    else\n                    {\n                        awaiter2.SourceOnCompleted(Completed2Delegate, this);\n                    }\n                }\n                if (!running3)\n                {\n                    running3 = true;\n                    awaiter3 = enumerator3.MoveNextAsync().GetAwaiter();\n                    if (awaiter3.IsCompleted)\n                    {\n                        Completed3(this);\n                    }\n                    else\n                    {\n                        awaiter3.SourceOnCompleted(Completed3Delegate, this);\n                    }\n                }\n                if (!running4)\n                {\n                    running4 = true;\n                    awaiter4 = enumerator4.MoveNextAsync().GetAwaiter();\n                    if (awaiter4.IsCompleted)\n                    {\n                        Completed4(this);\n                    }\n                    else\n                    {\n                        awaiter4.SourceOnCompleted(Completed4Delegate, this);\n                    }\n                }\n                if (!running5)\n                {\n                    running5 = true;\n                    awaiter5 = enumerator5.MoveNextAsync().GetAwaiter();\n                    if (awaiter5.IsCompleted)\n                    {\n                        Completed5(this);\n                    }\n                    else\n                    {\n                        awaiter5.SourceOnCompleted(Completed5Delegate, this);\n                    }\n                }\n                if (!running6)\n                {\n                    running6 = true;\n                    awaiter6 = enumerator6.MoveNextAsync().GetAwaiter();\n                    if (awaiter6.IsCompleted)\n                    {\n                        Completed6(this);\n                    }\n                    else\n                    {\n                        awaiter6.SourceOnCompleted(Completed6Delegate, this);\n                    }\n                }\n                if (!running7)\n                {\n                    running7 = true;\n                    awaiter7 = enumerator7.MoveNextAsync().GetAwaiter();\n                    if (awaiter7.IsCompleted)\n                    {\n                        Completed7(this);\n                    }\n                    else\n                    {\n                        awaiter7.SourceOnCompleted(Completed7Delegate, this);\n                    }\n                }\n                if (!running8)\n                {\n                    running8 = true;\n                    awaiter8 = enumerator8.MoveNextAsync().GetAwaiter();\n                    if (awaiter8.IsCompleted)\n                    {\n                        Completed8(this);\n                    }\n                    else\n                    {\n                        awaiter8.SourceOnCompleted(Completed8Delegate, this);\n                    }\n                }\n                if (!running9)\n                {\n                    running9 = true;\n                    awaiter9 = enumerator9.MoveNextAsync().GetAwaiter();\n                    if (awaiter9.IsCompleted)\n                    {\n                        Completed9(this);\n                    }\n                    else\n                    {\n                        awaiter9.SourceOnCompleted(Completed9Delegate, this);\n                    }\n                }\n                if (!running10)\n                {\n                    running10 = true;\n                    awaiter10 = enumerator10.MoveNextAsync().GetAwaiter();\n                    if (awaiter10.IsCompleted)\n                    {\n                        Completed10(this);\n                    }\n                    else\n                    {\n                        awaiter10.SourceOnCompleted(Completed10Delegate, this);\n                    }\n                }\n                if (!running11)\n                {\n                    running11 = true;\n                    awaiter11 = enumerator11.MoveNextAsync().GetAwaiter();\n                    if (awaiter11.IsCompleted)\n                    {\n                        Completed11(this);\n                    }\n                    else\n                    {\n                        awaiter11.SourceOnCompleted(Completed11Delegate, this);\n                    }\n                }\n                if (!running12)\n                {\n                    running12 = true;\n                    awaiter12 = enumerator12.MoveNextAsync().GetAwaiter();\n                    if (awaiter12.IsCompleted)\n                    {\n                        Completed12(this);\n                    }\n                    else\n                    {\n                        awaiter12.SourceOnCompleted(Completed12Delegate, this);\n                    }\n                }\n                if (!running13)\n                {\n                    running13 = true;\n                    awaiter13 = enumerator13.MoveNextAsync().GetAwaiter();\n                    if (awaiter13.IsCompleted)\n                    {\n                        Completed13(this);\n                    }\n                    else\n                    {\n                        awaiter13.SourceOnCompleted(Completed13Delegate, this);\n                    }\n                }\n                if (!running14)\n                {\n                    running14 = true;\n                    awaiter14 = enumerator14.MoveNextAsync().GetAwaiter();\n                    if (awaiter14.IsCompleted)\n                    {\n                        Completed14(this);\n                    }\n                    else\n                    {\n                        awaiter14.SourceOnCompleted(Completed14Delegate, this);\n                    }\n                }\n\n                if (!running1 || !running2 || !running3 || !running4 || !running5 || !running6 || !running7 || !running8 || !running9 || !running10 || !running11 || !running12 || !running13 || !running14)\n                {\n                    goto AGAIN;\n                }\n                syncRunning = false;\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void Completed1(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running1 = false;\n\n                try\n                {\n                    if (self.awaiter1.GetResult())\n                    {\n                        self.hasCurrent1 = true;\n                        self.current1 = self.enumerator1.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running1 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter1 = self.enumerator1.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter1.SourceOnCompleted(Completed1Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed2(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running2 = false;\n\n                try\n                {\n                    if (self.awaiter2.GetResult())\n                    {\n                        self.hasCurrent2 = true;\n                        self.current2 = self.enumerator2.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running2 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter2 = self.enumerator2.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter2.SourceOnCompleted(Completed2Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed3(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running3 = false;\n\n                try\n                {\n                    if (self.awaiter3.GetResult())\n                    {\n                        self.hasCurrent3 = true;\n                        self.current3 = self.enumerator3.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running3 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter3 = self.enumerator3.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter3.SourceOnCompleted(Completed3Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed4(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running4 = false;\n\n                try\n                {\n                    if (self.awaiter4.GetResult())\n                    {\n                        self.hasCurrent4 = true;\n                        self.current4 = self.enumerator4.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running4 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter4 = self.enumerator4.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter4.SourceOnCompleted(Completed4Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed5(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running5 = false;\n\n                try\n                {\n                    if (self.awaiter5.GetResult())\n                    {\n                        self.hasCurrent5 = true;\n                        self.current5 = self.enumerator5.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running5 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter5 = self.enumerator5.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter5.SourceOnCompleted(Completed5Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed6(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running6 = false;\n\n                try\n                {\n                    if (self.awaiter6.GetResult())\n                    {\n                        self.hasCurrent6 = true;\n                        self.current6 = self.enumerator6.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running6 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter6 = self.enumerator6.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter6.SourceOnCompleted(Completed6Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed7(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running7 = false;\n\n                try\n                {\n                    if (self.awaiter7.GetResult())\n                    {\n                        self.hasCurrent7 = true;\n                        self.current7 = self.enumerator7.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running7 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter7 = self.enumerator7.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter7.SourceOnCompleted(Completed7Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed8(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running8 = false;\n\n                try\n                {\n                    if (self.awaiter8.GetResult())\n                    {\n                        self.hasCurrent8 = true;\n                        self.current8 = self.enumerator8.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running8 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running8 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running8 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter8 = self.enumerator8.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter8.SourceOnCompleted(Completed8Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed9(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running9 = false;\n\n                try\n                {\n                    if (self.awaiter9.GetResult())\n                    {\n                        self.hasCurrent9 = true;\n                        self.current9 = self.enumerator9.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running9 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running9 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running9 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter9 = self.enumerator9.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter9.SourceOnCompleted(Completed9Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed10(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running10 = false;\n\n                try\n                {\n                    if (self.awaiter10.GetResult())\n                    {\n                        self.hasCurrent10 = true;\n                        self.current10 = self.enumerator10.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running10 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running10 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running10 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter10 = self.enumerator10.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter10.SourceOnCompleted(Completed10Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed11(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running11 = false;\n\n                try\n                {\n                    if (self.awaiter11.GetResult())\n                    {\n                        self.hasCurrent11 = true;\n                        self.current11 = self.enumerator11.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running11 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running11 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running11 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter11 = self.enumerator11.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter11.SourceOnCompleted(Completed11Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed12(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running12 = false;\n\n                try\n                {\n                    if (self.awaiter12.GetResult())\n                    {\n                        self.hasCurrent12 = true;\n                        self.current12 = self.enumerator12.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running12 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running12 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running12 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter12 = self.enumerator12.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter12.SourceOnCompleted(Completed12Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed13(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running13 = false;\n\n                try\n                {\n                    if (self.awaiter13.GetResult())\n                    {\n                        self.hasCurrent13 = true;\n                        self.current13 = self.enumerator13.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running13 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running13 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running13 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter13 = self.enumerator13.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter13.SourceOnCompleted(Completed13Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed14(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running14 = false;\n\n                try\n                {\n                    if (self.awaiter14.GetResult())\n                    {\n                        self.hasCurrent14 = true;\n                        self.current14 = self.enumerator14.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running14 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running14 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running14 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter14 = self.enumerator14.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter14.SourceOnCompleted(Completed14Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            bool TrySetResult()\n            {\n                if (hasCurrent1 && hasCurrent2 && hasCurrent3 && hasCurrent4 && hasCurrent5 && hasCurrent6 && hasCurrent7 && hasCurrent8 && hasCurrent9 && hasCurrent10 && hasCurrent11 && hasCurrent12 && hasCurrent13 && hasCurrent14)\n                {\n                    result = resultSelector(current1, current2, current3, current4, current5, current6, current7, current8, current9, current10, current11, current12, current13, current14);\n                    completionSource.TrySetResult(true);\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator1 != null)\n                {\n                    await enumerator1.DisposeAsync();\n                }\n                if (enumerator2 != null)\n                {\n                    await enumerator2.DisposeAsync();\n                }\n                if (enumerator3 != null)\n                {\n                    await enumerator3.DisposeAsync();\n                }\n                if (enumerator4 != null)\n                {\n                    await enumerator4.DisposeAsync();\n                }\n                if (enumerator5 != null)\n                {\n                    await enumerator5.DisposeAsync();\n                }\n                if (enumerator6 != null)\n                {\n                    await enumerator6.DisposeAsync();\n                }\n                if (enumerator7 != null)\n                {\n                    await enumerator7.DisposeAsync();\n                }\n                if (enumerator8 != null)\n                {\n                    await enumerator8.DisposeAsync();\n                }\n                if (enumerator9 != null)\n                {\n                    await enumerator9.DisposeAsync();\n                }\n                if (enumerator10 != null)\n                {\n                    await enumerator10.DisposeAsync();\n                }\n                if (enumerator11 != null)\n                {\n                    await enumerator11.DisposeAsync();\n                }\n                if (enumerator12 != null)\n                {\n                    await enumerator12.DisposeAsync();\n                }\n                if (enumerator13 != null)\n                {\n                    await enumerator13.DisposeAsync();\n                }\n                if (enumerator14 != null)\n                {\n                    await enumerator14.DisposeAsync();\n                }\n            }\n        }\n    }\n\n    internal class CombineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<T1> source1;\n        readonly IUniTaskAsyncEnumerable<T2> source2;\n        readonly IUniTaskAsyncEnumerable<T3> source3;\n        readonly IUniTaskAsyncEnumerable<T4> source4;\n        readonly IUniTaskAsyncEnumerable<T5> source5;\n        readonly IUniTaskAsyncEnumerable<T6> source6;\n        readonly IUniTaskAsyncEnumerable<T7> source7;\n        readonly IUniTaskAsyncEnumerable<T8> source8;\n        readonly IUniTaskAsyncEnumerable<T9> source9;\n        readonly IUniTaskAsyncEnumerable<T10> source10;\n        readonly IUniTaskAsyncEnumerable<T11> source11;\n        readonly IUniTaskAsyncEnumerable<T12> source12;\n        readonly IUniTaskAsyncEnumerable<T13> source13;\n        readonly IUniTaskAsyncEnumerable<T14> source14;\n        readonly IUniTaskAsyncEnumerable<T15> source15;\n        \n        readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> resultSelector;\n\n        public CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, IUniTaskAsyncEnumerable<T11> source11, IUniTaskAsyncEnumerable<T12> source12, IUniTaskAsyncEnumerable<T13> source13, IUniTaskAsyncEnumerable<T14> source14, IUniTaskAsyncEnumerable<T15> source15, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> resultSelector)\n        {\n            this.source1 = source1;\n            this.source2 = source2;\n            this.source3 = source3;\n            this.source4 = source4;\n            this.source5 = source5;\n            this.source6 = source6;\n            this.source7 = source7;\n            this.source8 = source8;\n            this.source9 = source9;\n            this.source10 = source10;\n            this.source11 = source11;\n            this.source12 = source12;\n            this.source13 = source13;\n            this.source14 = source14;\n            this.source15 = source15;\n        \n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _CombineLatest(source1, source2, source3, source4, source5, source6, source7, source8, source9, source10, source11, source12, source13, source14, source15, resultSelector, cancellationToken);\n        }\n\n        class _CombineLatest : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> Completed1Delegate = Completed1;\n            static readonly Action<object> Completed2Delegate = Completed2;\n            static readonly Action<object> Completed3Delegate = Completed3;\n            static readonly Action<object> Completed4Delegate = Completed4;\n            static readonly Action<object> Completed5Delegate = Completed5;\n            static readonly Action<object> Completed6Delegate = Completed6;\n            static readonly Action<object> Completed7Delegate = Completed7;\n            static readonly Action<object> Completed8Delegate = Completed8;\n            static readonly Action<object> Completed9Delegate = Completed9;\n            static readonly Action<object> Completed10Delegate = Completed10;\n            static readonly Action<object> Completed11Delegate = Completed11;\n            static readonly Action<object> Completed12Delegate = Completed12;\n            static readonly Action<object> Completed13Delegate = Completed13;\n            static readonly Action<object> Completed14Delegate = Completed14;\n            static readonly Action<object> Completed15Delegate = Completed15;\n            const int CompleteCount = 15;\n\n            readonly IUniTaskAsyncEnumerable<T1> source1;\n            readonly IUniTaskAsyncEnumerable<T2> source2;\n            readonly IUniTaskAsyncEnumerable<T3> source3;\n            readonly IUniTaskAsyncEnumerable<T4> source4;\n            readonly IUniTaskAsyncEnumerable<T5> source5;\n            readonly IUniTaskAsyncEnumerable<T6> source6;\n            readonly IUniTaskAsyncEnumerable<T7> source7;\n            readonly IUniTaskAsyncEnumerable<T8> source8;\n            readonly IUniTaskAsyncEnumerable<T9> source9;\n            readonly IUniTaskAsyncEnumerable<T10> source10;\n            readonly IUniTaskAsyncEnumerable<T11> source11;\n            readonly IUniTaskAsyncEnumerable<T12> source12;\n            readonly IUniTaskAsyncEnumerable<T13> source13;\n            readonly IUniTaskAsyncEnumerable<T14> source14;\n            readonly IUniTaskAsyncEnumerable<T15> source15;\n       \n            readonly Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> resultSelector;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<T1> enumerator1;\n            UniTask<bool>.Awaiter awaiter1;\n            bool hasCurrent1;\n            bool running1;\n            T1 current1;\n\n            IUniTaskAsyncEnumerator<T2> enumerator2;\n            UniTask<bool>.Awaiter awaiter2;\n            bool hasCurrent2;\n            bool running2;\n            T2 current2;\n\n            IUniTaskAsyncEnumerator<T3> enumerator3;\n            UniTask<bool>.Awaiter awaiter3;\n            bool hasCurrent3;\n            bool running3;\n            T3 current3;\n\n            IUniTaskAsyncEnumerator<T4> enumerator4;\n            UniTask<bool>.Awaiter awaiter4;\n            bool hasCurrent4;\n            bool running4;\n            T4 current4;\n\n            IUniTaskAsyncEnumerator<T5> enumerator5;\n            UniTask<bool>.Awaiter awaiter5;\n            bool hasCurrent5;\n            bool running5;\n            T5 current5;\n\n            IUniTaskAsyncEnumerator<T6> enumerator6;\n            UniTask<bool>.Awaiter awaiter6;\n            bool hasCurrent6;\n            bool running6;\n            T6 current6;\n\n            IUniTaskAsyncEnumerator<T7> enumerator7;\n            UniTask<bool>.Awaiter awaiter7;\n            bool hasCurrent7;\n            bool running7;\n            T7 current7;\n\n            IUniTaskAsyncEnumerator<T8> enumerator8;\n            UniTask<bool>.Awaiter awaiter8;\n            bool hasCurrent8;\n            bool running8;\n            T8 current8;\n\n            IUniTaskAsyncEnumerator<T9> enumerator9;\n            UniTask<bool>.Awaiter awaiter9;\n            bool hasCurrent9;\n            bool running9;\n            T9 current9;\n\n            IUniTaskAsyncEnumerator<T10> enumerator10;\n            UniTask<bool>.Awaiter awaiter10;\n            bool hasCurrent10;\n            bool running10;\n            T10 current10;\n\n            IUniTaskAsyncEnumerator<T11> enumerator11;\n            UniTask<bool>.Awaiter awaiter11;\n            bool hasCurrent11;\n            bool running11;\n            T11 current11;\n\n            IUniTaskAsyncEnumerator<T12> enumerator12;\n            UniTask<bool>.Awaiter awaiter12;\n            bool hasCurrent12;\n            bool running12;\n            T12 current12;\n\n            IUniTaskAsyncEnumerator<T13> enumerator13;\n            UniTask<bool>.Awaiter awaiter13;\n            bool hasCurrent13;\n            bool running13;\n            T13 current13;\n\n            IUniTaskAsyncEnumerator<T14> enumerator14;\n            UniTask<bool>.Awaiter awaiter14;\n            bool hasCurrent14;\n            bool running14;\n            T14 current14;\n\n            IUniTaskAsyncEnumerator<T15> enumerator15;\n            UniTask<bool>.Awaiter awaiter15;\n            bool hasCurrent15;\n            bool running15;\n            T15 current15;\n\n            int completedCount;\n            bool syncRunning;\n            TResult result;\n\n            public _CombineLatest(IUniTaskAsyncEnumerable<T1> source1, IUniTaskAsyncEnumerable<T2> source2, IUniTaskAsyncEnumerable<T3> source3, IUniTaskAsyncEnumerable<T4> source4, IUniTaskAsyncEnumerable<T5> source5, IUniTaskAsyncEnumerable<T6> source6, IUniTaskAsyncEnumerable<T7> source7, IUniTaskAsyncEnumerable<T8> source8, IUniTaskAsyncEnumerable<T9> source9, IUniTaskAsyncEnumerable<T10> source10, IUniTaskAsyncEnumerable<T11> source11, IUniTaskAsyncEnumerable<T12> source12, IUniTaskAsyncEnumerable<T13> source13, IUniTaskAsyncEnumerable<T14> source14, IUniTaskAsyncEnumerable<T15> source15, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> resultSelector, CancellationToken cancellationToken)\n            {\n                this.source1 = source1;\n                this.source2 = source2;\n                this.source3 = source3;\n                this.source4 = source4;\n                this.source5 = source5;\n                this.source6 = source6;\n                this.source7 = source7;\n                this.source8 = source8;\n                this.source9 = source9;\n                this.source10 = source10;\n                this.source11 = source11;\n                this.source12 = source12;\n                this.source13 = source13;\n                this.source14 = source14;\n                this.source15 = source15;\n                \n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current => result;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                if (completedCount == CompleteCount) return CompletedTasks.False;\n\n                if (enumerator1 == null)\n                {\n                    enumerator1 = source1.GetAsyncEnumerator(cancellationToken);\n                    enumerator2 = source2.GetAsyncEnumerator(cancellationToken);\n                    enumerator3 = source3.GetAsyncEnumerator(cancellationToken);\n                    enumerator4 = source4.GetAsyncEnumerator(cancellationToken);\n                    enumerator5 = source5.GetAsyncEnumerator(cancellationToken);\n                    enumerator6 = source6.GetAsyncEnumerator(cancellationToken);\n                    enumerator7 = source7.GetAsyncEnumerator(cancellationToken);\n                    enumerator8 = source8.GetAsyncEnumerator(cancellationToken);\n                    enumerator9 = source9.GetAsyncEnumerator(cancellationToken);\n                    enumerator10 = source10.GetAsyncEnumerator(cancellationToken);\n                    enumerator11 = source11.GetAsyncEnumerator(cancellationToken);\n                    enumerator12 = source12.GetAsyncEnumerator(cancellationToken);\n                    enumerator13 = source13.GetAsyncEnumerator(cancellationToken);\n                    enumerator14 = source14.GetAsyncEnumerator(cancellationToken);\n                    enumerator15 = source15.GetAsyncEnumerator(cancellationToken);\n                }\n\n                completionSource.Reset();\n\n                AGAIN:\n                syncRunning = true;\n                if (!running1)\n                {\n                    running1 = true;\n                    awaiter1 = enumerator1.MoveNextAsync().GetAwaiter();\n                    if (awaiter1.IsCompleted)\n                    {\n                        Completed1(this);\n                    }\n                    else\n                    {\n                        awaiter1.SourceOnCompleted(Completed1Delegate, this);\n                    }\n                }\n                if (!running2)\n                {\n                    running2 = true;\n                    awaiter2 = enumerator2.MoveNextAsync().GetAwaiter();\n                    if (awaiter2.IsCompleted)\n                    {\n                        Completed2(this);\n                    }\n                    else\n                    {\n                        awaiter2.SourceOnCompleted(Completed2Delegate, this);\n                    }\n                }\n                if (!running3)\n                {\n                    running3 = true;\n                    awaiter3 = enumerator3.MoveNextAsync().GetAwaiter();\n                    if (awaiter3.IsCompleted)\n                    {\n                        Completed3(this);\n                    }\n                    else\n                    {\n                        awaiter3.SourceOnCompleted(Completed3Delegate, this);\n                    }\n                }\n                if (!running4)\n                {\n                    running4 = true;\n                    awaiter4 = enumerator4.MoveNextAsync().GetAwaiter();\n                    if (awaiter4.IsCompleted)\n                    {\n                        Completed4(this);\n                    }\n                    else\n                    {\n                        awaiter4.SourceOnCompleted(Completed4Delegate, this);\n                    }\n                }\n                if (!running5)\n                {\n                    running5 = true;\n                    awaiter5 = enumerator5.MoveNextAsync().GetAwaiter();\n                    if (awaiter5.IsCompleted)\n                    {\n                        Completed5(this);\n                    }\n                    else\n                    {\n                        awaiter5.SourceOnCompleted(Completed5Delegate, this);\n                    }\n                }\n                if (!running6)\n                {\n                    running6 = true;\n                    awaiter6 = enumerator6.MoveNextAsync().GetAwaiter();\n                    if (awaiter6.IsCompleted)\n                    {\n                        Completed6(this);\n                    }\n                    else\n                    {\n                        awaiter6.SourceOnCompleted(Completed6Delegate, this);\n                    }\n                }\n                if (!running7)\n                {\n                    running7 = true;\n                    awaiter7 = enumerator7.MoveNextAsync().GetAwaiter();\n                    if (awaiter7.IsCompleted)\n                    {\n                        Completed7(this);\n                    }\n                    else\n                    {\n                        awaiter7.SourceOnCompleted(Completed7Delegate, this);\n                    }\n                }\n                if (!running8)\n                {\n                    running8 = true;\n                    awaiter8 = enumerator8.MoveNextAsync().GetAwaiter();\n                    if (awaiter8.IsCompleted)\n                    {\n                        Completed8(this);\n                    }\n                    else\n                    {\n                        awaiter8.SourceOnCompleted(Completed8Delegate, this);\n                    }\n                }\n                if (!running9)\n                {\n                    running9 = true;\n                    awaiter9 = enumerator9.MoveNextAsync().GetAwaiter();\n                    if (awaiter9.IsCompleted)\n                    {\n                        Completed9(this);\n                    }\n                    else\n                    {\n                        awaiter9.SourceOnCompleted(Completed9Delegate, this);\n                    }\n                }\n                if (!running10)\n                {\n                    running10 = true;\n                    awaiter10 = enumerator10.MoveNextAsync().GetAwaiter();\n                    if (awaiter10.IsCompleted)\n                    {\n                        Completed10(this);\n                    }\n                    else\n                    {\n                        awaiter10.SourceOnCompleted(Completed10Delegate, this);\n                    }\n                }\n                if (!running11)\n                {\n                    running11 = true;\n                    awaiter11 = enumerator11.MoveNextAsync().GetAwaiter();\n                    if (awaiter11.IsCompleted)\n                    {\n                        Completed11(this);\n                    }\n                    else\n                    {\n                        awaiter11.SourceOnCompleted(Completed11Delegate, this);\n                    }\n                }\n                if (!running12)\n                {\n                    running12 = true;\n                    awaiter12 = enumerator12.MoveNextAsync().GetAwaiter();\n                    if (awaiter12.IsCompleted)\n                    {\n                        Completed12(this);\n                    }\n                    else\n                    {\n                        awaiter12.SourceOnCompleted(Completed12Delegate, this);\n                    }\n                }\n                if (!running13)\n                {\n                    running13 = true;\n                    awaiter13 = enumerator13.MoveNextAsync().GetAwaiter();\n                    if (awaiter13.IsCompleted)\n                    {\n                        Completed13(this);\n                    }\n                    else\n                    {\n                        awaiter13.SourceOnCompleted(Completed13Delegate, this);\n                    }\n                }\n                if (!running14)\n                {\n                    running14 = true;\n                    awaiter14 = enumerator14.MoveNextAsync().GetAwaiter();\n                    if (awaiter14.IsCompleted)\n                    {\n                        Completed14(this);\n                    }\n                    else\n                    {\n                        awaiter14.SourceOnCompleted(Completed14Delegate, this);\n                    }\n                }\n                if (!running15)\n                {\n                    running15 = true;\n                    awaiter15 = enumerator15.MoveNextAsync().GetAwaiter();\n                    if (awaiter15.IsCompleted)\n                    {\n                        Completed15(this);\n                    }\n                    else\n                    {\n                        awaiter15.SourceOnCompleted(Completed15Delegate, this);\n                    }\n                }\n\n                if (!running1 || !running2 || !running3 || !running4 || !running5 || !running6 || !running7 || !running8 || !running9 || !running10 || !running11 || !running12 || !running13 || !running14 || !running15)\n                {\n                    goto AGAIN;\n                }\n                syncRunning = false;\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void Completed1(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running1 = false;\n\n                try\n                {\n                    if (self.awaiter1.GetResult())\n                    {\n                        self.hasCurrent1 = true;\n                        self.current1 = self.enumerator1.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running1 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running1 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter1 = self.enumerator1.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter1.SourceOnCompleted(Completed1Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed2(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running2 = false;\n\n                try\n                {\n                    if (self.awaiter2.GetResult())\n                    {\n                        self.hasCurrent2 = true;\n                        self.current2 = self.enumerator2.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running2 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running2 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter2 = self.enumerator2.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter2.SourceOnCompleted(Completed2Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed3(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running3 = false;\n\n                try\n                {\n                    if (self.awaiter3.GetResult())\n                    {\n                        self.hasCurrent3 = true;\n                        self.current3 = self.enumerator3.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running3 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running3 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter3 = self.enumerator3.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter3.SourceOnCompleted(Completed3Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed4(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running4 = false;\n\n                try\n                {\n                    if (self.awaiter4.GetResult())\n                    {\n                        self.hasCurrent4 = true;\n                        self.current4 = self.enumerator4.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running4 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running4 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter4 = self.enumerator4.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter4.SourceOnCompleted(Completed4Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed5(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running5 = false;\n\n                try\n                {\n                    if (self.awaiter5.GetResult())\n                    {\n                        self.hasCurrent5 = true;\n                        self.current5 = self.enumerator5.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running5 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running5 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter5 = self.enumerator5.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter5.SourceOnCompleted(Completed5Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed6(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running6 = false;\n\n                try\n                {\n                    if (self.awaiter6.GetResult())\n                    {\n                        self.hasCurrent6 = true;\n                        self.current6 = self.enumerator6.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running6 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running6 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter6 = self.enumerator6.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter6.SourceOnCompleted(Completed6Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed7(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running7 = false;\n\n                try\n                {\n                    if (self.awaiter7.GetResult())\n                    {\n                        self.hasCurrent7 = true;\n                        self.current7 = self.enumerator7.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running7 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running7 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter7 = self.enumerator7.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter7.SourceOnCompleted(Completed7Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed8(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running8 = false;\n\n                try\n                {\n                    if (self.awaiter8.GetResult())\n                    {\n                        self.hasCurrent8 = true;\n                        self.current8 = self.enumerator8.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running8 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running8 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running8 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter8 = self.enumerator8.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter8.SourceOnCompleted(Completed8Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed9(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running9 = false;\n\n                try\n                {\n                    if (self.awaiter9.GetResult())\n                    {\n                        self.hasCurrent9 = true;\n                        self.current9 = self.enumerator9.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running9 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running9 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running9 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter9 = self.enumerator9.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter9.SourceOnCompleted(Completed9Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed10(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running10 = false;\n\n                try\n                {\n                    if (self.awaiter10.GetResult())\n                    {\n                        self.hasCurrent10 = true;\n                        self.current10 = self.enumerator10.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running10 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running10 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running10 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter10 = self.enumerator10.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter10.SourceOnCompleted(Completed10Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed11(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running11 = false;\n\n                try\n                {\n                    if (self.awaiter11.GetResult())\n                    {\n                        self.hasCurrent11 = true;\n                        self.current11 = self.enumerator11.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running11 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running11 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running11 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter11 = self.enumerator11.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter11.SourceOnCompleted(Completed11Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed12(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running12 = false;\n\n                try\n                {\n                    if (self.awaiter12.GetResult())\n                    {\n                        self.hasCurrent12 = true;\n                        self.current12 = self.enumerator12.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running12 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running12 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running12 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter12 = self.enumerator12.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter12.SourceOnCompleted(Completed12Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed13(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running13 = false;\n\n                try\n                {\n                    if (self.awaiter13.GetResult())\n                    {\n                        self.hasCurrent13 = true;\n                        self.current13 = self.enumerator13.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running13 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running13 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running13 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter13 = self.enumerator13.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter13.SourceOnCompleted(Completed13Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed14(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running14 = false;\n\n                try\n                {\n                    if (self.awaiter14.GetResult())\n                    {\n                        self.hasCurrent14 = true;\n                        self.current14 = self.enumerator14.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running14 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running14 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running14 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter14 = self.enumerator14.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter14.SourceOnCompleted(Completed14Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            static void Completed15(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running15 = false;\n\n                try\n                {\n                    if (self.awaiter15.GetResult())\n                    {\n                        self.hasCurrent15 = true;\n                        self.current15 = self.enumerator15.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running15 = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running15 = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running15 = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter15 = self.enumerator15.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter15.SourceOnCompleted(Completed15Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n            bool TrySetResult()\n            {\n                if (hasCurrent1 && hasCurrent2 && hasCurrent3 && hasCurrent4 && hasCurrent5 && hasCurrent6 && hasCurrent7 && hasCurrent8 && hasCurrent9 && hasCurrent10 && hasCurrent11 && hasCurrent12 && hasCurrent13 && hasCurrent14 && hasCurrent15)\n                {\n                    result = resultSelector(current1, current2, current3, current4, current5, current6, current7, current8, current9, current10, current11, current12, current13, current14, current15);\n                    completionSource.TrySetResult(true);\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator1 != null)\n                {\n                    await enumerator1.DisposeAsync();\n                }\n                if (enumerator2 != null)\n                {\n                    await enumerator2.DisposeAsync();\n                }\n                if (enumerator3 != null)\n                {\n                    await enumerator3.DisposeAsync();\n                }\n                if (enumerator4 != null)\n                {\n                    await enumerator4.DisposeAsync();\n                }\n                if (enumerator5 != null)\n                {\n                    await enumerator5.DisposeAsync();\n                }\n                if (enumerator6 != null)\n                {\n                    await enumerator6.DisposeAsync();\n                }\n                if (enumerator7 != null)\n                {\n                    await enumerator7.DisposeAsync();\n                }\n                if (enumerator8 != null)\n                {\n                    await enumerator8.DisposeAsync();\n                }\n                if (enumerator9 != null)\n                {\n                    await enumerator9.DisposeAsync();\n                }\n                if (enumerator10 != null)\n                {\n                    await enumerator10.DisposeAsync();\n                }\n                if (enumerator11 != null)\n                {\n                    await enumerator11.DisposeAsync();\n                }\n                if (enumerator12 != null)\n                {\n                    await enumerator12.DisposeAsync();\n                }\n                if (enumerator13 != null)\n                {\n                    await enumerator13.DisposeAsync();\n                }\n                if (enumerator14 != null)\n                {\n                    await enumerator14.DisposeAsync();\n                }\n                if (enumerator15 != null)\n                {\n                    await enumerator15.DisposeAsync();\n                }\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/CombineLatest.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 6cb07f6e88287e34d9b9301a572284a5\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/CombineLatest.tt",
    "content": "﻿<#@ template debug=\"false\" hostspecific=\"false\" language=\"C#\" #>\n<#@ assembly name=\"System.Core\" #>\n<#@ import namespace=\"System.Linq\" #>\n<#@ import namespace=\"System.Text\" #>\n<#@ import namespace=\"System.Collections.Generic\" #>\n<#@ output extension=\".cs\" #>\n<#\n    var tMax = 15;\n    Func<int, string> typeArgs = x => string.Join(\", \", Enumerable.Range(1, x).Select(x => $\"T{x}\")) + \", TResult\";\n    Func<int, string> paramArgs = x => string.Join(\", \", Enumerable.Range(1, x).Select(x => $\"IUniTaskAsyncEnumerable<T{x}> source{x}\"));\n    Func<int, string> parameters = x => string.Join(\", \", Enumerable.Range(1, x).Select(x => $\"source{x}\"));\n\n\n#>\nusing Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n<# for(var i = 2; i <= tMax; i++) { #>\n        public static IUniTaskAsyncEnumerable<TResult> CombineLatest<<#= typeArgs(i) #>>(this <#= paramArgs(i) #>, Func<<#= typeArgs(i) #>> resultSelector)\n        {\n<# for(var j = 1; j <= i; j++) { #>\n            Error.ThrowArgumentNullException(source<#= j #>, nameof(source<#= j #>));\n<# } #>\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new CombineLatest<<#= typeArgs(i) #>>(<#= parameters(i) #>, resultSelector);\n        }\n\n<# } #>\n    }\n\n<# for(var i = 2; i <= tMax; i++) { #>\n    internal class CombineLatest<<#= typeArgs(i) #>> : IUniTaskAsyncEnumerable<TResult>\n    {\n<# for(var j = 1; j <= i; j++) { #>\n        readonly IUniTaskAsyncEnumerable<T<#= j #>> source<#= j #>;\n<# } #>        \n        readonly Func<<#= typeArgs(i) #>> resultSelector;\n\n        public CombineLatest(<#= paramArgs(i) #>, Func<<#= typeArgs(i) #>> resultSelector)\n        {\n<# for(var j = 1; j <= i; j++) { #>\n            this.source<#= j #> = source<#= j #>;\n<# } #>        \n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _CombineLatest(<#= parameters(i) #>, resultSelector, cancellationToken);\n        }\n\n        class _CombineLatest : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n<# for(var j = 1; j <= i; j++) { #>\n            static readonly Action<object> Completed<#= j #>Delegate = Completed<#= j #>;\n<# } #>\n            const int CompleteCount = <#= i #>;\n\n<# for(var j = 1; j <= i; j++) { #>\n            readonly IUniTaskAsyncEnumerable<T<#= j #>> source<#= j #>;\n<# } #>       \n            readonly Func<<#= typeArgs(i) #>> resultSelector;\n            CancellationToken cancellationToken;\n\n<# for(var j = 1; j <= i; j++) { #>\n            IUniTaskAsyncEnumerator<T<#= j #>> enumerator<#= j #>;\n            UniTask<bool>.Awaiter awaiter<#= j #>;\n            bool hasCurrent<#= j #>;\n            bool running<#= j #>;\n            T<#= j #> current<#= j #>;\n\n<# } #>\n            int completedCount;\n            bool syncRunning;\n            TResult result;\n\n            public _CombineLatest(<#= paramArgs(i) #>, Func<<#= typeArgs(i) #>> resultSelector, CancellationToken cancellationToken)\n            {\n<# for(var j = 1; j <= i; j++) { #>\n                this.source<#= j #> = source<#= j #>;\n<# } #>                \n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current => result;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                if (completedCount == CompleteCount) return CompletedTasks.False;\n\n                if (enumerator1 == null)\n                {\n<# for(var j = 1; j <= i; j++) { #>\n                    enumerator<#= j #> = source<#= j #>.GetAsyncEnumerator(cancellationToken);\n<# } #>\n                }\n\n                completionSource.Reset();\n\n                AGAIN:\n                syncRunning = true;\n<# for(var j = 1; j <= i; j++) { #>\n                if (!running<#= j #>)\n                {\n                    running<#= j #> = true;\n                    awaiter<#= j #> = enumerator<#= j #>.MoveNextAsync().GetAwaiter();\n                    if (awaiter<#= j #>.IsCompleted)\n                    {\n                        Completed<#= j #>(this);\n                    }\n                    else\n                    {\n                        awaiter<#= j #>.SourceOnCompleted(Completed<#= j #>Delegate, this);\n                    }\n                }\n<# } #>\n\n                if (<#= string.Join(\" || \", Enumerable.Range(1, i).Select(x => $\"!running{x}\")) #>)\n                {\n                    goto AGAIN;\n                }\n                syncRunning = false;\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n<# for(var j = 1; j <= i; j++) { #>\n            static void Completed<#= j #>(object state)\n            {\n                var self = (_CombineLatest)state;\n                self.running<#= j #> = false;\n\n                try\n                {\n                    if (self.awaiter<#= j #>.GetResult())\n                    {\n                        self.hasCurrent<#= j #> = true;\n                        self.current<#= j #> = self.enumerator<#= j #>.Current;\n                        goto SUCCESS;\n                    }\n                    else\n                    {\n                        self.running<#= j #> = true; // as complete, no more call MoveNextAsync.\n                        if (Interlocked.Increment(ref self.completedCount) == CompleteCount)\n                        {\n                            goto COMPLETE;\n                        }\n                        return;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    self.running<#= j #> = true; // as complete, no more call MoveNextAsync.\n                    self.completedCount = CompleteCount;\n                    self.completionSource.TrySetException(ex);\n                    return;\n                }\n\n                SUCCESS:\n                if (!self.TrySetResult())\n                {\n                    if (self.syncRunning) return;\n                    self.running<#= j #> = true; // as complete, no more call MoveNextAsync.\n                    try\n                    {\n                        self.awaiter<#= j #> = self.enumerator<#= j #>.MoveNextAsync().GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completedCount = CompleteCount;\n                        self.completionSource.TrySetException(ex);\n                        return;\n                    }\n\n                    self.awaiter<#= j #>.SourceOnCompleted(Completed<#= j #>Delegate, self);\n                }\n                return;\n                COMPLETE:\n                self.completionSource.TrySetResult(false);\n                return;\n            }\n\n<# } #>\n            bool TrySetResult()\n            {\n                if (<#= string.Join(\" && \", Enumerable.Range(1, i).Select(x => $\"hasCurrent{x}\")) #>)\n                {\n                    result = resultSelector(<#= string.Join(\", \", Enumerable.Range(1, i).Select(x => $\"current{x}\")) #>);\n                    completionSource.TrySetResult(true);\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n<# for(var j = 1; j <= i; j++) { #>\n                if (enumerator<#= j #> != null)\n                {\n                    await enumerator<#= j #>.DisposeAsync();\n                }\n<# } #>\n            }\n        }\n    }\n\n<# } #>\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/CombineLatest.tt.meta",
    "content": "fileFormatVersion: 2\nguid: b1b8cfa9d17af814a971ee2224aaaaa2\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Concat.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> Concat<TSource>(this IUniTaskAsyncEnumerable<TSource> first, IUniTaskAsyncEnumerable<TSource> second)\n        {\n            Error.ThrowArgumentNullException(first, nameof(first));\n            Error.ThrowArgumentNullException(second, nameof(second));\n\n            return new Concat<TSource>(first, second);\n        }\n    }\n\n    internal sealed class Concat<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> first;\n        readonly IUniTaskAsyncEnumerable<TSource> second;\n\n        public Concat(IUniTaskAsyncEnumerable<TSource> first, IUniTaskAsyncEnumerable<TSource> second)\n        {\n            this.first = first;\n            this.second = second;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Concat(first, second, cancellationToken);\n        }\n\n        sealed class _Concat : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n\n            enum IteratingState\n            {\n                IteratingFirst,\n                IteratingSecond,\n                Complete\n            }\n\n            readonly IUniTaskAsyncEnumerable<TSource> first;\n            readonly IUniTaskAsyncEnumerable<TSource> second;\n            CancellationToken cancellationToken;\n\n            IteratingState iteratingState;\n\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n\n            public _Concat(IUniTaskAsyncEnumerable<TSource> first, IUniTaskAsyncEnumerable<TSource> second, CancellationToken cancellationToken)\n            {\n                this.first = first;\n                this.second = second;\n                this.cancellationToken = cancellationToken;\n                this.iteratingState = IteratingState.IteratingFirst;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                if (iteratingState == IteratingState.Complete) return CompletedTasks.False;\n\n                completionSource.Reset();\n                StartIterate();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void StartIterate()\n            {\n                if (enumerator == null)\n                {\n                    if (iteratingState == IteratingState.IteratingFirst)\n                    {\n                        enumerator = first.GetAsyncEnumerator(cancellationToken);\n                    }\n                    else if (iteratingState == IteratingState.IteratingSecond)\n                    {\n                        enumerator = second.GetAsyncEnumerator(cancellationToken);\n                    }\n                }\n\n                try\n                {\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                if (awaiter.IsCompleted)\n                {\n                    MoveNextCoreDelegate(this);\n                }\n                else\n                {\n                    awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                }\n            }\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_Concat)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        self.Current = self.enumerator.Current;\n                        self.completionSource.TrySetResult(true);\n                    }\n                    else\n                    {\n                        if (self.iteratingState == IteratingState.IteratingFirst)\n                        {\n                            self.RunSecondAfterDisposeAsync().Forget();\n                            return;\n                        }\n\n                        self.iteratingState = IteratingState.Complete;\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            async UniTaskVoid RunSecondAfterDisposeAsync()\n            {\n                try\n                {\n                    await enumerator.DisposeAsync();\n                    enumerator = null;\n                    awaiter = default;\n                    iteratingState = IteratingState.IteratingSecond;\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                }\n\n                StartIterate();\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Concat.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 7cb9e19c449127a459851a135ce7d527\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Contains.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<Boolean> ContainsAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, TSource value, CancellationToken cancellationToken = default)\n        {\n            return ContainsAsync(source, value, EqualityComparer<TSource>.Default, cancellationToken);\n        }\n\n        public static UniTask<Boolean> ContainsAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, TSource value, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return Contains.ContainsAsync(source, value, comparer, cancellationToken);\n        }\n    }\n\n    internal static class Contains\n    {\n        internal static async UniTask<bool> ContainsAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, TSource value, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    if (comparer.Equals(value, e.Current))\n                    {\n                        return true;\n                    }\n                }\n\n                return false;\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Contains.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 36ab06d30f3223048b4f676e05431a7f\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Count.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<Int32> CountAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Count.CountAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Int32> CountAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return Count.CountAsync(source, predicate, cancellationToken);\n        }\n\n        public static UniTask<Int32> CountAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return Count.CountAwaitAsync(source, predicate, cancellationToken);\n        }\n\n        public static UniTask<Int32> CountAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return Count.CountAwaitWithCancellationAsync(source, predicate, cancellationToken);\n        }\n    }\n\n    internal static class Count\n    {\n        internal static async UniTask<int> CountAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)\n        {\n            var count = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked { count++; }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return count;\n        }\n\n        internal static async UniTask<int> CountAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate, CancellationToken cancellationToken)\n        {\n            var count = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    if (predicate(e.Current))\n                    {\n                        checked { count++; }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return count;\n        }\n\n        internal static async UniTask<int> CountAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate, CancellationToken cancellationToken)\n        {\n            var count = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    if (await predicate(e.Current))\n                    {\n                        checked { count++; }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return count;\n        }\n\n        internal static async UniTask<int> CountAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate, CancellationToken cancellationToken)\n        {\n            var count = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    if (await predicate(e.Current, cancellationToken))\n                    {\n                        checked { count++; }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return count;\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Count.cs.meta",
    "content": "fileFormatVersion: 2\nguid: e606d38eed688574bb2ba89d983cc9bb\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Create.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<T> Create<T>(Func<IAsyncWriter<T>, CancellationToken, UniTask> create)\n        {\n            Error.ThrowArgumentNullException(create, nameof(create));\n            return new Create<T>(create);\n        }\n    }\n\n    public interface IAsyncWriter<T>\n    {\n        UniTask YieldAsync(T value);\n    }\n\n    internal sealed class Create<T> : IUniTaskAsyncEnumerable<T>\n    {\n        readonly Func<IAsyncWriter<T>, CancellationToken, UniTask> create;\n\n        public Create(Func<IAsyncWriter<T>, CancellationToken, UniTask> create)\n        {\n            this.create = create;\n        }\n\n        public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Create(create, cancellationToken);\n        }\n\n        sealed class _Create : MoveNextSource, IUniTaskAsyncEnumerator<T>\n        {\n            readonly Func<IAsyncWriter<T>, CancellationToken, UniTask> create;\n            readonly CancellationToken cancellationToken;\n\n            int state = -1;\n            AsyncWriter writer;\n\n            public _Create(Func<IAsyncWriter<T>, CancellationToken, UniTask> create, CancellationToken cancellationToken)\n            {\n                this.create = create;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public T Current { get; private set; }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                writer.Dispose();\n                return default;\n            }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (state == -2) return default;\n\n                completionSource.Reset();\n                MoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNext()\n            {\n                try\n                {\n                    switch (state)\n                    {\n                        case -1: // init\n                            {\n                                writer = new AsyncWriter(this);\n                                RunWriterTask(create(writer, cancellationToken)).Forget();\n                                if (Volatile.Read(ref state) == -2)\n                                {\n                                    return; // complete synchronously\n                                }\n                                state = 0; // wait YieldAsync, it set TrySetResult(true)\n                                return;\n                            }\n                        case 0:\n                            writer.SignalWriter();\n                            return;\n                        default:\n                            goto DONE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    state = -2;\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                state = -2;\n                completionSource.TrySetResult(false);\n                return;\n            }\n\n            async UniTaskVoid RunWriterTask(UniTask task)\n            {\n                try\n                {\n                    await task;\n                    goto DONE;\n                }\n                catch (Exception ex)\n                {\n                    Volatile.Write(ref state, -2);\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                Volatile.Write(ref state, -2);\n                completionSource.TrySetResult(false);\n            }\n\n            public void SetResult(T value)\n            {\n                Current = value;\n                completionSource.TrySetResult(true);\n            }\n        }\n\n        sealed class AsyncWriter : IUniTaskSource, IAsyncWriter<T>, IDisposable\n        {\n            readonly _Create enumerator;\n\n            UniTaskCompletionSourceCore<AsyncUnit> core;\n\n            public AsyncWriter(_Create enumerator)\n            {\n                this.enumerator = enumerator;\n            }\n            \n            public void Dispose()\n            {\n                var status = core.GetStatus(core.Version);\n                if (status == UniTaskStatus.Pending)\n                {\n                    core.TrySetCanceled();\n                }\n            }            \n\n            public void GetResult(short token)\n            {\n                core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTask YieldAsync(T value)\n            {\n                core.Reset();\n                enumerator.SetResult(value);\n                return new UniTask(this, core.Version);\n            }\n\n            public void SignalWriter()\n            {\n                core.TrySetResult(AsyncUnit.Default);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Create.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 0202f723469f93945afa063bfb440d15\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/DefaultIfEmpty.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> DefaultIfEmpty<TSource>(this IUniTaskAsyncEnumerable<TSource> source)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new DefaultIfEmpty<TSource>(source, default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> DefaultIfEmpty<TSource>(this IUniTaskAsyncEnumerable<TSource> source, TSource defaultValue)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new DefaultIfEmpty<TSource>(source, defaultValue);\n        }\n    }\n\n    internal sealed class DefaultIfEmpty<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly TSource defaultValue;\n\n        public DefaultIfEmpty(IUniTaskAsyncEnumerable<TSource> source, TSource defaultValue)\n        {\n            this.source = source;\n            this.defaultValue = defaultValue;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _DefaultIfEmpty(source, defaultValue, cancellationToken);\n        }\n\n        sealed class _DefaultIfEmpty : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            enum IteratingState : byte\n            {\n                Empty,\n                Iterating,\n                Completed\n            }\n\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly TSource defaultValue;\n            CancellationToken cancellationToken;\n\n            IteratingState iteratingState;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n\n            public _DefaultIfEmpty(IUniTaskAsyncEnumerable<TSource> source, TSource defaultValue, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.defaultValue = defaultValue;\n                this.cancellationToken = cancellationToken;\n\n                this.iteratingState = IteratingState.Empty;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TSource Current { get; private set; }\n\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                if (iteratingState == IteratingState.Completed)\n                {\n                    return CompletedTasks.False;\n                }\n\n                if (enumerator == null)\n                {\n                    enumerator = source.GetAsyncEnumerator(cancellationToken);\n                }\n\n                awaiter = enumerator.MoveNextAsync().GetAwaiter();\n\n                if (awaiter.IsCompleted)\n                {\n                    MoveNextCore(this);\n                }\n                else\n                {\n                    awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                }\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_DefaultIfEmpty)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        self.iteratingState = IteratingState.Iterating;\n                        self.Current = self.enumerator.Current;\n                        self.completionSource.TrySetResult(true);\n                    }\n                    else\n                    {\n                        if (self.iteratingState == IteratingState.Empty)\n                        {\n                            self.iteratingState = IteratingState.Completed;\n\n                            self.Current = self.defaultValue;\n                            self.completionSource.TrySetResult(true);\n                        }\n                        else\n                        {\n                            self.completionSource.TrySetResult(false);\n                        }\n                    }\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n                return default;\n            }\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/DefaultIfEmpty.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 19e437c039ad7e1478dbce1779ef8660\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Distinct.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> Distinct<TSource>(this IUniTaskAsyncEnumerable<TSource> source)\n        {\n            return Distinct(source, EqualityComparer<TSource>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> Distinct<TSource>(this IUniTaskAsyncEnumerable<TSource> source, IEqualityComparer<TSource> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new Distinct<TSource>(source, comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> Distinct<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector)\n        {\n            return Distinct(source, keySelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> Distinct<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new Distinct<TSource, TKey>(source, keySelector, comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> DistinctAwait<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector)\n        {\n            return DistinctAwait(source, keySelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> DistinctAwait<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new DistinctAwait<TSource, TKey>(source, keySelector, comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> DistinctAwaitWithCancellation<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector)\n        {\n            return DistinctAwaitWithCancellation(source, keySelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> DistinctAwaitWithCancellation<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new DistinctAwaitWithCancellation<TSource, TKey>(source, keySelector, comparer);\n        }\n    }\n\n    internal sealed class Distinct<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly IEqualityComparer<TSource> comparer;\n\n        public Distinct(IUniTaskAsyncEnumerable<TSource> source, IEqualityComparer<TSource> comparer)\n        {\n            this.source = source;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Distinct(source, comparer, cancellationToken);\n        }\n\n        class _Distinct : AsyncEnumeratorBase<TSource, TSource>\n        {\n            readonly HashSet<TSource> set;\n\n            public _Distinct(IUniTaskAsyncEnumerable<TSource> source, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken)\n\n                : base(source, cancellationToken)\n            {\n                this.set = new HashSet<TSource>(comparer);\n            }\n\n            protected override bool TryMoveNextCore(bool sourceHasCurrent, out bool result)\n            {\n                if (sourceHasCurrent)\n                {\n                    var v = SourceCurrent;\n                    if (set.Add(v))\n                    {\n                        Current = v;\n                        result = true;\n                        return true;\n                    }\n                    else\n                    {\n                        result = default;\n                        return false;\n                    }\n                }\n\n                result = false;\n                return true;\n            }\n        }\n    }\n\n    internal sealed class Distinct<TSource, TKey> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, TKey> keySelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public Distinct(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)\n        {\n            this.source = source;\n            this.keySelector = keySelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Distinct(source, keySelector, comparer, cancellationToken);\n        }\n\n        class _Distinct : AsyncEnumeratorBase<TSource, TSource>\n        {\n            readonly HashSet<TKey> set;\n            readonly Func<TSource, TKey> keySelector;\n\n            public _Distinct(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n\n                : base(source, cancellationToken)\n            {\n                this.set = new HashSet<TKey>(comparer);\n                this.keySelector = keySelector;\n            }\n\n            protected override bool TryMoveNextCore(bool sourceHasCurrent, out bool result)\n            {\n                if (sourceHasCurrent)\n                {\n                    var v = SourceCurrent;\n                    if (set.Add(keySelector(v)))\n                    {\n                        Current = v;\n                        result = true;\n                        return true;\n                    }\n                    else\n                    {\n                        result = default;\n                        return false;\n                    }\n                }\n\n                result = false;\n                return true;\n            }\n        }\n    }\n\n    internal sealed class DistinctAwait<TSource, TKey> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, UniTask<TKey>> keySelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public DistinctAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer)\n        {\n            this.source = source;\n            this.keySelector = keySelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _DistinctAwait(source, keySelector, comparer, cancellationToken);\n        }\n\n        class _DistinctAwait : AsyncEnumeratorAwaitSelectorBase<TSource, TSource, TKey>\n        {\n            readonly HashSet<TKey> set;\n            readonly Func<TSource, UniTask<TKey>> keySelector;\n\n            public _DistinctAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n\n                : base(source, cancellationToken)\n            {\n                this.set = new HashSet<TKey>(comparer);\n                this.keySelector = keySelector;\n            }\n\n            protected override UniTask<TKey> TransformAsync(TSource sourceCurrent)\n            {\n                return keySelector(sourceCurrent);\n            }\n\n            protected override bool TrySetCurrentCore(TKey awaitResult, out bool terminateIteration)\n            {\n                if (set.Add(awaitResult))\n                {\n                    Current = SourceCurrent;\n                    terminateIteration = false;\n                    return true;\n                }\n                else\n                {\n                    terminateIteration = false;\n                    return false;\n                }\n            }\n        }\n    }\n\n    internal sealed class DistinctAwaitWithCancellation<TSource, TKey> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, CancellationToken, UniTask<TKey>> keySelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public DistinctAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer)\n        {\n            this.source = source;\n            this.keySelector = keySelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _DistinctAwaitWithCancellation(source, keySelector, comparer, cancellationToken);\n        }\n\n        class _DistinctAwaitWithCancellation : AsyncEnumeratorAwaitSelectorBase<TSource, TSource, TKey>\n        {\n            readonly HashSet<TKey> set;\n            readonly Func<TSource, CancellationToken, UniTask<TKey>> keySelector;\n\n            public _DistinctAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n\n                : base(source, cancellationToken)\n            {\n                this.set = new HashSet<TKey>(comparer);\n                this.keySelector = keySelector;\n            }\n\n            protected override UniTask<TKey> TransformAsync(TSource sourceCurrent)\n            {\n                return keySelector(sourceCurrent, cancellationToken);\n            }\n\n            protected override bool TrySetCurrentCore(TKey awaitResult, out bool terminateIteration)\n            {\n                if (set.Add(awaitResult))\n                {\n                    Current = SourceCurrent;\n                    terminateIteration = false;\n                    return true;\n                }\n                else\n                {\n                    terminateIteration = false;\n                    return false;\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Distinct.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 8f09903be66e5d943b243d7c19cb3811\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/DistinctUntilChanged.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> DistinctUntilChanged<TSource>(this IUniTaskAsyncEnumerable<TSource> source)\n        {\n            return DistinctUntilChanged(source, EqualityComparer<TSource>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> DistinctUntilChanged<TSource>(this IUniTaskAsyncEnumerable<TSource> source, IEqualityComparer<TSource> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new DistinctUntilChanged<TSource>(source, comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> DistinctUntilChanged<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector)\n        {\n            return DistinctUntilChanged(source, keySelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> DistinctUntilChanged<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new DistinctUntilChanged<TSource, TKey>(source, keySelector, comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> DistinctUntilChangedAwait<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector)\n        {\n            return DistinctUntilChangedAwait(source, keySelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> DistinctUntilChangedAwait<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new DistinctUntilChangedAwait<TSource, TKey>(source, keySelector, comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> DistinctUntilChangedAwaitWithCancellation<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector)\n        {\n            return DistinctUntilChangedAwaitWithCancellation(source, keySelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> DistinctUntilChangedAwaitWithCancellation<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new DistinctUntilChangedAwaitWithCancellation<TSource, TKey>(source, keySelector, comparer);\n        }\n    }\n\n    internal sealed class DistinctUntilChanged<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly IEqualityComparer<TSource> comparer;\n\n        public DistinctUntilChanged(IUniTaskAsyncEnumerable<TSource> source, IEqualityComparer<TSource> comparer)\n        {\n            this.source = source;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _DistinctUntilChanged(source, comparer, cancellationToken);\n        }\n\n        sealed class _DistinctUntilChanged : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly IEqualityComparer<TSource> comparer;\n            readonly CancellationToken cancellationToken;\n\n            int state = -1;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            Action moveNextAction;\n\n            public _DistinctUntilChanged(IUniTaskAsyncEnumerable<TSource> source, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.comparer = comparer;\n                this.cancellationToken = cancellationToken;\n                this.moveNextAction = MoveNext;\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (state == -2) return default;\n\n                completionSource.Reset();\n                MoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNext()\n            {\n                REPEAT:\n                try\n                {\n                    switch (state)\n                    {\n                        case -1: // init\n                            enumerator = source.GetAsyncEnumerator(cancellationToken);\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case -3;\n                            }\n                            else\n                            {\n                                state = -3;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case -3: // first\n                            if (awaiter.GetResult())\n                            {\n                                Current = enumerator.Current;\n                                goto CONTINUE;\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        case 0: // normal\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case 1;\n                            }\n                            else\n                            {\n                                state = 1;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case 1:\n                            if (awaiter.GetResult())\n                            {\n                                var v = enumerator.Current;\n                                if (!comparer.Equals(Current, v))\n                                {\n                                    Current = v;\n                                    goto CONTINUE;\n                                }\n                                else\n                                {\n                                    state = 0;\n                                    goto REPEAT;\n                                }\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        case -2:\n                        default:\n                            goto DONE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    state = -2;\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                state = -2;\n                completionSource.TrySetResult(false);\n                return;\n\n                CONTINUE:\n                state = 0;\n                completionSource.TrySetResult(true);\n                return;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                return enumerator.DisposeAsync();\n            }\n        }\n    }\n\n    internal sealed class DistinctUntilChanged<TSource, TKey> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, TKey> keySelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public DistinctUntilChanged(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)\n        {\n            this.source = source;\n            this.keySelector = keySelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _DistinctUntilChanged(source, keySelector, comparer, cancellationToken);\n        }\n\n        sealed class _DistinctUntilChanged : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, TKey> keySelector;\n            readonly IEqualityComparer<TKey> comparer;\n            readonly CancellationToken cancellationToken;\n\n            int state = -1;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            Action moveNextAction;\n            TKey prev;\n\n            public _DistinctUntilChanged(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.keySelector = keySelector;\n                this.comparer = comparer;\n                this.cancellationToken = cancellationToken;\n                this.moveNextAction = MoveNext;\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (state == -2) return default;\n\n                completionSource.Reset();\n                MoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNext()\n            {\n                REPEAT:\n                try\n                {\n                    switch (state)\n                    {\n                        case -1: // init\n                            enumerator = source.GetAsyncEnumerator(cancellationToken);\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case -3;\n                            }\n                            else\n                            {\n                                state = -3;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case -3: // first\n                            if (awaiter.GetResult())\n                            {\n                                Current = enumerator.Current;\n                                goto CONTINUE;\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        case 0: // normal\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case 1;\n                            }\n                            else\n                            {\n                                state = 1;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case 1:\n                            if (awaiter.GetResult())\n                            {\n                                var v = enumerator.Current;\n                                var key = keySelector(v);\n                                if (!comparer.Equals(prev, key))\n                                {\n                                    prev = key;\n                                    Current = v;\n                                    goto CONTINUE;\n                                }\n                                else\n                                {\n                                    state = 0;\n                                    goto REPEAT;\n                                }\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        case -2:\n                        default:\n                            goto DONE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    state = -2;\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                state = -2;\n                completionSource.TrySetResult(false);\n                return;\n\n                CONTINUE:\n                state = 0;\n                completionSource.TrySetResult(true);\n                return;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                return enumerator.DisposeAsync();\n            }\n        }\n    }\n\n    internal sealed class DistinctUntilChangedAwait<TSource, TKey> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, UniTask<TKey>> keySelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public DistinctUntilChangedAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer)\n        {\n            this.source = source;\n            this.keySelector = keySelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _DistinctUntilChangedAwait(source, keySelector, comparer, cancellationToken);\n        }\n\n        sealed class _DistinctUntilChangedAwait : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, UniTask<TKey>> keySelector;\n            readonly IEqualityComparer<TKey> comparer;\n            readonly CancellationToken cancellationToken;\n\n            int state = -1;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            UniTask<TKey>.Awaiter awaiter2;\n            Action moveNextAction;\n            TSource enumeratorCurrent;\n            TKey prev;\n\n            public _DistinctUntilChangedAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.keySelector = keySelector;\n                this.comparer = comparer;\n                this.cancellationToken = cancellationToken;\n                this.moveNextAction = MoveNext;\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (state == -2) return default;\n\n                completionSource.Reset();\n                MoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNext()\n            {\n                REPEAT:\n                try\n                {\n                    switch (state)\n                    {\n                        case -1: // init\n                            enumerator = source.GetAsyncEnumerator(cancellationToken);\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case -3;\n                            }\n                            else\n                            {\n                                state = -3;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case -3: // first\n                            if (awaiter.GetResult())\n                            {\n                                Current = enumerator.Current;\n                                goto CONTINUE;\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        case 0: // normal\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case 1;\n                            }\n                            else\n                            {\n                                state = 1;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case 1:\n                            if (awaiter.GetResult())\n                            {\n                                enumeratorCurrent = enumerator.Current;\n                                awaiter2 = keySelector(enumeratorCurrent).GetAwaiter();\n                                if (awaiter2.IsCompleted)\n                                {\n                                    goto case 2;\n                                }\n                                else\n                                {\n                                    state = 2;\n                                    awaiter2.UnsafeOnCompleted(moveNextAction);\n                                    return;\n                                }\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        case 2:\n                            var key = awaiter2.GetResult();\n                            if (!comparer.Equals(prev, key))\n                            {\n                                prev = key;\n                                Current = enumeratorCurrent;\n                                goto CONTINUE;\n                            }\n                            else\n                            {\n                                state = 0;\n                                goto REPEAT;\n                            }\n                        case -2:\n                        default:\n                            goto DONE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    state = -2;\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                state = -2;\n                completionSource.TrySetResult(false);\n                return;\n\n                CONTINUE:\n                state = 0;\n                completionSource.TrySetResult(true);\n                return;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                return enumerator.DisposeAsync();\n            }\n        }\n    }\n\n    internal sealed class DistinctUntilChangedAwaitWithCancellation<TSource, TKey> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, CancellationToken, UniTask<TKey>> keySelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public DistinctUntilChangedAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer)\n        {\n            this.source = source;\n            this.keySelector = keySelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _DistinctUntilChangedAwaitWithCancellation(source, keySelector, comparer, cancellationToken);\n        }\n\n        sealed class _DistinctUntilChangedAwaitWithCancellation : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, CancellationToken, UniTask<TKey>> keySelector;\n            readonly IEqualityComparer<TKey> comparer;\n            readonly CancellationToken cancellationToken;\n\n            int state = -1;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            UniTask<TKey>.Awaiter awaiter2;\n            Action moveNextAction;\n            TSource enumeratorCurrent;\n            TKey prev;\n\n            public _DistinctUntilChangedAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.keySelector = keySelector;\n                this.comparer = comparer;\n                this.cancellationToken = cancellationToken;\n                this.moveNextAction = MoveNext;\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (state == -2) return default;\n\n                completionSource.Reset();\n                MoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNext()\n            {\n                REPEAT:\n                try\n                {\n                    switch (state)\n                    {\n                        case -1: // init\n                            enumerator = source.GetAsyncEnumerator(cancellationToken);\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case -3;\n                            }\n                            else\n                            {\n                                state = -3;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case -3: // first\n                            if (awaiter.GetResult())\n                            {\n                                Current = enumerator.Current;\n                                goto CONTINUE;\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        case 0: // normal\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case 1;\n                            }\n                            else\n                            {\n                                state = 1;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case 1:\n                            if (awaiter.GetResult())\n                            {\n                                enumeratorCurrent = enumerator.Current;\n                                awaiter2 = keySelector(enumeratorCurrent, cancellationToken).GetAwaiter();\n                                if (awaiter2.IsCompleted)\n                                {\n                                    goto case 2;\n                                }\n                                else\n                                {\n                                    state = 2;\n                                    awaiter2.UnsafeOnCompleted(moveNextAction);\n                                    return;\n                                }\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        case 2:\n                            var key = awaiter2.GetResult();\n                            if (!comparer.Equals(prev, key))\n                            {\n                                prev = key;\n                                Current = enumeratorCurrent;\n                                goto CONTINUE;\n                            }\n                            else\n                            {\n                                state = 0;\n                                goto REPEAT;\n                            }\n                        case -2:\n                        default:\n                            goto DONE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    state = -2;\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                state = -2;\n                completionSource.TrySetResult(false);\n                return;\n\n                CONTINUE:\n                state = 0;\n                completionSource.TrySetResult(true);\n                return;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                return enumerator.DisposeAsync();\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/DistinctUntilChanged.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 0351f6767df7e644b935d4d599968162\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Do.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Internal;\nusing Cysharp.Threading.Tasks.Linq;\nusing System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> Do<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Action<TSource> onNext)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            return source.Do(onNext, null, null);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> Do<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            return source.Do(onNext, onError, null);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> Do<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Action<TSource> onNext, Action onCompleted)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            return source.Do(onNext, null, onCompleted);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> Do<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError, Action onCompleted)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            return new Do<TSource>(source, onNext, onError, onCompleted);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> Do<TSource>(this IUniTaskAsyncEnumerable<TSource> source, IObserver<TSource> observer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(observer, nameof(observer));\n\n            return source.Do(observer.OnNext, observer.OnError, observer.OnCompleted); // alloc delegate.\n        }\n\n        // not yet impl.\n\n        //public static IUniTaskAsyncEnumerable<TSource> DoAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask> onNext)\n        //{\n        //    throw new NotImplementedException();\n        //}\n\n        //public static IUniTaskAsyncEnumerable<TSource> DoAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask> onNext, Func<Exception, UniTask> onError)\n        //{\n        //    throw new NotImplementedException();\n        //}\n\n        //public static IUniTaskAsyncEnumerable<TSource> DoAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask> onNext, Func<UniTask> onCompleted)\n        //{\n        //    throw new NotImplementedException();\n        //}\n\n        //public static IUniTaskAsyncEnumerable<TSource> DoAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask> onNext, Func<Exception, UniTask> onError, Func<UniTask> onCompleted)\n        //{\n        //    throw new NotImplementedException();\n        //}\n\n        //public static IUniTaskAsyncEnumerable<TSource> DoAwaitWithCancellation<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask> onNext)\n        //{\n        //    throw new NotImplementedException();\n        //}\n\n        //public static IUniTaskAsyncEnumerable<TSource> DoAwaitWithCancellation<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask> onNext, Func<Exception, CancellationToken, UniTask> onError)\n        //{\n        //    throw new NotImplementedException();\n        //}\n\n        //public static IUniTaskAsyncEnumerable<TSource> DoAwaitWithCancellation<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask> onNext, Func<CancellationToken, UniTask> onCompleted)\n        //{\n        //    throw new NotImplementedException();\n        //}\n\n        //public static IUniTaskAsyncEnumerable<TSource> DoAwaitWithCancellation<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask> onNext, Func<Exception, CancellationToken, UniTask> onError, Func<CancellationToken, UniTask> onCompleted)\n        //{\n        //    throw new NotImplementedException();\n        //}\n    }\n\n    internal sealed class Do<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Action<TSource> onNext;\n        readonly Action<Exception> onError;\n        readonly Action onCompleted;\n\n        public Do(IUniTaskAsyncEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError, Action onCompleted)\n        {\n            this.source = source;\n            this.onNext = onNext;\n            this.onError = onError;\n            this.onCompleted = onCompleted;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Do(source, onNext, onError, onCompleted, cancellationToken);\n        }\n\n        sealed class _Do : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Action<TSource> onNext;\n            readonly Action<Exception> onError;\n            readonly Action onCompleted;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n\n            public _Do(IUniTaskAsyncEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError, Action onCompleted, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.onNext = onNext;\n                this.onError = onError;\n                this.onCompleted = onCompleted;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TSource Current { get; private set; }\n\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                bool isCompleted = false;\n                try\n                {\n                    if (enumerator == null)\n                    {\n                        enumerator = source.GetAsyncEnumerator(cancellationToken);\n                    }\n\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                    isCompleted = awaiter.IsCompleted;\n                }\n                catch (Exception ex)\n                {\n                    CallTrySetExceptionAfterNotification(ex);\n                    return new UniTask<bool>(this, completionSource.Version);\n                }\n\n                if (isCompleted)\n                {\n                    MoveNextCore(this);\n                }\n                else\n                {\n                    awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                }\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void CallTrySetExceptionAfterNotification(Exception ex)\n            {\n                if (onError != null)\n                {\n                    try\n                    {\n                        onError(ex);\n                    }\n                    catch (Exception ex2)\n                    {\n                        completionSource.TrySetException(ex2);\n                        return;\n                    }\n                }\n\n                completionSource.TrySetException(ex);\n            }\n\n            bool TryGetResultWithNotification<T>(UniTask<T>.Awaiter awaiter, out T result)\n            {\n                try\n                {\n                    result = awaiter.GetResult();\n                    return true;\n                }\n                catch (Exception ex)\n                {\n                    CallTrySetExceptionAfterNotification(ex);\n                    result = default;\n                    return false;\n                }\n            }\n\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_Do)state;\n\n                if (self.TryGetResultWithNotification(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        var v = self.enumerator.Current;\n\n                        if (self.onNext != null)\n                        {\n                            try\n                            {\n                                self.onNext(v);\n                            }\n                            catch (Exception ex)\n                            {\n                                self.CallTrySetExceptionAfterNotification(ex);\n                            }\n                        }\n\n                        self.Current = v;\n                        self.completionSource.TrySetResult(true);\n                    }\n                    else\n                    {\n                        if (self.onCompleted != null)\n                        {\n                            try\n                            {\n                                self.onCompleted();\n                            }\n                            catch (Exception ex)\n                            {\n                                self.CallTrySetExceptionAfterNotification(ex);\n                                return;\n                            }\n                        }\n\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n                return default;\n            }\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Do.cs.meta",
    "content": "fileFormatVersion: 2\nguid: dd83c8e12dedf75409b829b93146d130\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ElementAt.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<TSource> ElementAtAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, int index, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return ElementAt.ElementAtAsync(source, index, cancellationToken, false);\n        }\n\n        public static UniTask<TSource> ElementAtOrDefaultAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, int index, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return ElementAt.ElementAtAsync(source, index, cancellationToken, true);\n        }\n    }\n\n    internal static class ElementAt\n    {\n        public static async UniTask<TSource> ElementAtAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, int index, CancellationToken cancellationToken, bool defaultIfEmpty)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                int i = 0;\n                while (await e.MoveNextAsync())\n                {\n                    if (i++ == index)\n                    {\n                        return e.Current;\n                    }\n                }\n\n                if (defaultIfEmpty)\n                {\n                    return default;\n                }\n                else\n                {\n                    throw Error.ArgumentOutOfRange(nameof(index));\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ElementAt.cs.meta",
    "content": "fileFormatVersion: 2\nguid: c835bd2dd8555234c8919c7b8ef3b69a\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Empty.cs",
    "content": "﻿using System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<T> Empty<T>()\n        {\n            return Cysharp.Threading.Tasks.Linq.Empty<T>.Instance;\n        }\n    }\n\n    internal class Empty<T> : IUniTaskAsyncEnumerable<T>\n    {\n        public static readonly IUniTaskAsyncEnumerable<T> Instance = new Empty<T>();\n\n        Empty()\n        {\n        }\n\n        public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return _Empty.Instance;\n        }\n\n        class _Empty : IUniTaskAsyncEnumerator<T>\n        {\n            public static readonly IUniTaskAsyncEnumerator<T> Instance = new _Empty();\n\n            _Empty()\n            {\n            }\n\n            public T Current => default;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                return CompletedTasks.False;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Empty.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 4fa123ad6258abb4184721b719a13810\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Except.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> Except<TSource>(this IUniTaskAsyncEnumerable<TSource> first, IUniTaskAsyncEnumerable<TSource> second)\n        {\n            Error.ThrowArgumentNullException(first, nameof(first));\n            Error.ThrowArgumentNullException(second, nameof(second));\n\n            return new Except<TSource>(first, second, EqualityComparer<TSource>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> Except<TSource>(this IUniTaskAsyncEnumerable<TSource> first, IUniTaskAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)\n        {\n            Error.ThrowArgumentNullException(first, nameof(first));\n            Error.ThrowArgumentNullException(second, nameof(second));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new Except<TSource>(first, second, comparer);\n        }\n    }\n\n    internal sealed class Except<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> first;\n        readonly IUniTaskAsyncEnumerable<TSource> second;\n        readonly IEqualityComparer<TSource> comparer;\n\n        public Except(IUniTaskAsyncEnumerable<TSource> first, IUniTaskAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)\n        {\n            this.first = first;\n            this.second = second;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Except(first, second, comparer, cancellationToken);\n        }\n\n        class _Except : AsyncEnumeratorBase<TSource, TSource>\n        {\n            static Action<object> HashSetAsyncCoreDelegate = HashSetAsyncCore;\n\n            readonly IEqualityComparer<TSource> comparer;\n            readonly IUniTaskAsyncEnumerable<TSource> second;\n\n            HashSet<TSource> set;\n            UniTask<HashSet<TSource>>.Awaiter awaiter;\n\n            public _Except(IUniTaskAsyncEnumerable<TSource> first, IUniTaskAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken)\n\n                : base(first, cancellationToken)\n            {\n                this.second = second;\n                this.comparer = comparer;\n            }\n\n            protected override bool OnFirstIteration()\n            {\n                if (set != null) return false;\n\n                awaiter = second.ToHashSetAsync(cancellationToken).GetAwaiter();\n                if (awaiter.IsCompleted)\n                {\n                    set = awaiter.GetResult();\n                    SourceMoveNext();\n                }\n                else\n                {\n                    awaiter.SourceOnCompleted(HashSetAsyncCoreDelegate, this);\n                }\n\n                return true;\n            }\n\n            static void HashSetAsyncCore(object state)\n            {\n                var self = (_Except)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    self.set = result;\n                    self.SourceMoveNext();\n                }\n            }\n\n            protected override bool TryMoveNextCore(bool sourceHasCurrent, out bool result)\n            {\n                if (sourceHasCurrent)\n                {\n                    var v = SourceCurrent;\n                    if (set.Add(v))\n                    {\n                        Current = v;\n                        result = true;\n                        return true;\n                    }\n                    else\n                    {\n                        result = default;\n                        return false;\n                    }\n                }\n\n                result = false;\n                return true;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Except.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 38c1c4129f59dcb49a5b864eaf4ec63c\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/First.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<TSource> FirstAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return First.FirstAsync(source, cancellationToken, false);\n        }\n\n        public static UniTask<TSource> FirstAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return First.FirstAsync(source, predicate, cancellationToken, false);\n        }\n\n        public static UniTask<TSource> FirstAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return First.FirstAwaitAsync(source, predicate, cancellationToken, false);\n        }\n\n        public static UniTask<TSource> FirstAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return First.FirstAwaitWithCancellationAsync(source, predicate, cancellationToken, false);\n        }\n\n        public static UniTask<TSource> FirstOrDefaultAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return First.FirstAsync(source, cancellationToken, true);\n        }\n\n        public static UniTask<TSource> FirstOrDefaultAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return First.FirstAsync(source, predicate, cancellationToken, true);\n        }\n\n        public static UniTask<TSource> FirstOrDefaultAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return First.FirstAwaitAsync(source, predicate, cancellationToken, true);\n        }\n\n        public static UniTask<TSource> FirstOrDefaultAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return First.FirstAwaitWithCancellationAsync(source, predicate, cancellationToken, true);\n        }\n    }\n\n    internal static class First\n    {\n        public static async UniTask<TSource> FirstAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken, bool defaultIfEmpty)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                if (await e.MoveNextAsync())\n                {\n                    return e.Current;\n                }\n                else\n                {\n                    if (defaultIfEmpty)\n                    {\n                        return default;\n                    }\n                    else\n                    {\n                        throw Error.NoElements();\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTask<TSource> FirstAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate, CancellationToken cancellationToken, bool defaultIfEmpty)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    if (predicate(v))\n                    {\n                        return v;\n                    }\n                }\n\n                if (defaultIfEmpty)\n                {\n                    return default;\n                }\n                else\n                {\n                    throw Error.NoElements();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTask<TSource> FirstAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate, CancellationToken cancellationToken, bool defaultIfEmpty)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    if (await predicate(v))\n                    {\n                        return v;\n                    }\n                }\n\n                if (defaultIfEmpty)\n                {\n                    return default;\n                }\n                else\n                {\n                    throw Error.NoElements();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTask<TSource> FirstAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate, CancellationToken cancellationToken, bool defaultIfEmpty)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    if (await predicate(v, cancellationToken))\n                    {\n                        return v;\n                    }\n                }\n\n                if (defaultIfEmpty)\n                {\n                    return default;\n                }\n                else\n                {\n                    throw Error.NoElements();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/First.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 417946e97e9eed84db6f840f57037ca6\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ForEach.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask ForEachAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Action<TSource> action, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(action, nameof(action));\n\n            return Cysharp.Threading.Tasks.Linq.ForEach.ForEachAsync(source, action, cancellationToken);\n        }\n\n        public static UniTask ForEachAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Action<TSource, Int32> action, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(action, nameof(action));\n\n            return Cysharp.Threading.Tasks.Linq.ForEach.ForEachAsync(source, action, cancellationToken);\n        }\n\n        /// <summary>Obsolete(Error), Use Use ForEachAwaitAsync instead.</summary>\n        [Obsolete(\"Use ForEachAwaitAsync instead.\", true)]\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\n        public static UniTask ForEachAsync<T>(this IUniTaskAsyncEnumerable<T> source, Func<T, UniTask> action, CancellationToken cancellationToken = default)\n        {\n            throw new NotSupportedException(\"Use ForEachAwaitAsync instead.\");\n        }\n\n        /// <summary>Obsolete(Error), Use Use ForEachAwaitAsync instead.</summary>\n        [Obsolete(\"Use ForEachAwaitAsync instead.\", true)]\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\n        public static UniTask ForEachAsync<T>(this IUniTaskAsyncEnumerable<T> source, Func<T, int, UniTask> action, CancellationToken cancellationToken = default)\n        {\n            throw new NotSupportedException(\"Use ForEachAwaitAsync instead.\");\n        }\n\n        public static UniTask ForEachAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask> action, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(action, nameof(action));\n\n            return Cysharp.Threading.Tasks.Linq.ForEach.ForEachAwaitAsync(source, action, cancellationToken);\n        }\n\n        public static UniTask ForEachAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, UniTask> action, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(action, nameof(action));\n\n            return Cysharp.Threading.Tasks.Linq.ForEach.ForEachAwaitAsync(source, action, cancellationToken);\n        }\n\n        public static UniTask ForEachAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask> action, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(action, nameof(action));\n\n            return Cysharp.Threading.Tasks.Linq.ForEach.ForEachAwaitWithCancellationAsync(source, action, cancellationToken);\n        }\n\n        public static UniTask ForEachAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, CancellationToken, UniTask> action, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(action, nameof(action));\n\n            return Cysharp.Threading.Tasks.Linq.ForEach.ForEachAwaitWithCancellationAsync(source, action, cancellationToken);\n        }\n    }\n\n    internal static class ForEach\n    {\n        public static async UniTask ForEachAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Action<TSource> action, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    action(e.Current);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTask ForEachAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Action<TSource, Int32> action, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                int index = 0;\n                while (await e.MoveNextAsync())\n                {\n                    action(e.Current, checked(index++));\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTask ForEachAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask> action, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    await action(e.Current);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTask ForEachAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, UniTask> action, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                int index = 0;\n                while (await e.MoveNextAsync())\n                {\n                    await action(e.Current, checked(index++));\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTask ForEachAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask> action, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    await action(e.Current, cancellationToken);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTask ForEachAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, CancellationToken, UniTask> action, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                int index = 0;\n                while (await e.MoveNextAsync())\n                {\n                    await action(e.Current, checked(index++), cancellationToken);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ForEach.cs.meta",
    "content": "fileFormatVersion: 2\nguid: ca8d7f8177ba16140920af405aea3fd4\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/GroupBy.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        // Ix-Async returns IGrouping but it is competely waste, use standard IGrouping.\n\n        public static IUniTaskAsyncEnumerable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            return new GroupBy<TSource, TKey, TSource>(source, keySelector, x => x, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n            return new GroupBy<TSource, TKey, TSource>(source, keySelector, x => x, comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            return new GroupBy<TSource, TKey, TElement>(source, keySelector, elementSelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n            return new GroupBy<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> GroupBy<TSource, TKey, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            return new GroupBy<TSource, TKey, TSource, TResult>(source, keySelector, x => x, resultSelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> GroupBy<TSource, TKey, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n            return new GroupBy<TSource, TKey, TSource, TResult>(source, keySelector, x => x, resultSelector, comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            return new GroupBy<TSource, TKey, TElement, TResult>(source, keySelector, elementSelector, resultSelector, EqualityComparer<TKey>.Default);\n        }\n        public static IUniTaskAsyncEnumerable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n            return new GroupBy<TSource, TKey, TElement, TResult>(source, keySelector, elementSelector, resultSelector, comparer);\n        }\n\n        // await\n\n        public static IUniTaskAsyncEnumerable<IGrouping<TKey, TSource>> GroupByAwait<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            return new GroupByAwait<TSource, TKey, TSource>(source, keySelector, x => UniTask.FromResult(x), EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<IGrouping<TKey, TSource>> GroupByAwait<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n            return new GroupByAwait<TSource, TKey, TSource>(source, keySelector, x => UniTask.FromResult(x), comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<IGrouping<TKey, TElement>> GroupByAwait<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, Func<TSource, UniTask<TElement>> elementSelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            return new GroupByAwait<TSource, TKey, TElement>(source, keySelector, elementSelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<IGrouping<TKey, TElement>> GroupByAwait<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, Func<TSource, UniTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n            return new GroupByAwait<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> GroupByAwait<TSource, TKey, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, Func<TKey, IEnumerable<TSource>, UniTask<TResult>> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            return new GroupByAwait<TSource, TKey, TSource, TResult>(source, keySelector, x => UniTask.FromResult(x), resultSelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> GroupByAwait<TSource, TKey, TElement, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, Func<TSource, UniTask<TElement>> elementSelector, Func<TKey, IEnumerable<TElement>, UniTask<TResult>> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            return new GroupByAwait<TSource, TKey, TElement, TResult>(source, keySelector, elementSelector, resultSelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> GroupByAwait<TSource, TKey, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, Func<TKey, IEnumerable<TSource>, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n            return new GroupByAwait<TSource, TKey, TSource, TResult>(source, keySelector, x => UniTask.FromResult(x), resultSelector, comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> GroupByAwait<TSource, TKey, TElement, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, Func<TSource, UniTask<TElement>> elementSelector, Func<TKey, IEnumerable<TElement>, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n            return new GroupByAwait<TSource, TKey, TElement, TResult>(source, keySelector, elementSelector, resultSelector, comparer);\n        }\n\n        // with ct\n\n        public static IUniTaskAsyncEnumerable<IGrouping<TKey, TSource>> GroupByAwaitWithCancellation<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            return new GroupByAwaitWithCancellation<TSource, TKey, TSource>(source, keySelector, (x, _) => UniTask.FromResult(x), EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<IGrouping<TKey, TSource>> GroupByAwaitWithCancellation<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n            return new GroupByAwaitWithCancellation<TSource, TKey, TSource>(source, keySelector, (x, _) => UniTask.FromResult(x), comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<IGrouping<TKey, TElement>> GroupByAwaitWithCancellation<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, Func<TSource, CancellationToken, UniTask<TElement>> elementSelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            return new GroupByAwaitWithCancellation<TSource, TKey, TElement>(source, keySelector, elementSelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<IGrouping<TKey, TElement>> GroupByAwaitWithCancellation<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, Func<TSource, CancellationToken, UniTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n            return new GroupByAwaitWithCancellation<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> GroupByAwaitWithCancellation<TSource, TKey, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, Func<TKey, IEnumerable<TSource>, CancellationToken, UniTask<TResult>> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            return new GroupByAwaitWithCancellation<TSource, TKey, TSource, TResult>(source, keySelector, (x, _) => UniTask.FromResult(x), resultSelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> GroupByAwaitWithCancellation<TSource, TKey, TElement, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, Func<TSource, CancellationToken, UniTask<TElement>> elementSelector, Func<TKey, IEnumerable<TElement>, CancellationToken, UniTask<TResult>> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            return new GroupByAwaitWithCancellation<TSource, TKey, TElement, TResult>(source, keySelector, elementSelector, resultSelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> GroupByAwaitWithCancellation<TSource, TKey, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, Func<TKey, IEnumerable<TSource>, CancellationToken, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n            return new GroupByAwaitWithCancellation<TSource, TKey, TSource, TResult>(source, keySelector, (x, _) => UniTask.FromResult(x), resultSelector, comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> GroupByAwaitWithCancellation<TSource, TKey, TElement, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, Func<TSource, CancellationToken, UniTask<TElement>> elementSelector, Func<TKey, IEnumerable<TElement>, CancellationToken, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n            return new GroupByAwaitWithCancellation<TSource, TKey, TElement, TResult>(source, keySelector, elementSelector, resultSelector, comparer);\n        }\n    }\n\n    internal sealed class GroupBy<TSource, TKey, TElement> : IUniTaskAsyncEnumerable<IGrouping<TKey, TElement>>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, TKey> keySelector;\n        readonly Func<TSource, TElement> elementSelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public GroupBy(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)\n        {\n            this.source = source;\n            this.keySelector = keySelector;\n            this.elementSelector = elementSelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<IGrouping<TKey, TElement>> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _GroupBy(source, keySelector, elementSelector, comparer, cancellationToken);\n        }\n\n        sealed class _GroupBy : MoveNextSource, IUniTaskAsyncEnumerator<IGrouping<TKey, TElement>>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, TKey> keySelector;\n            readonly Func<TSource, TElement> elementSelector;\n            readonly IEqualityComparer<TKey> comparer;\n            CancellationToken cancellationToken;\n\n            IEnumerator<IGrouping<TKey, TElement>> groupEnumerator;\n\n            public _GroupBy(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.keySelector = keySelector;\n                this.elementSelector = elementSelector;\n                this.comparer = comparer;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public IGrouping<TKey, TElement> Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                if (groupEnumerator == null)\n                {\n                    CreateLookup().Forget();\n                }\n                else\n                {\n                    SourceMoveNext();\n                }\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            async UniTaskVoid CreateLookup()\n            {\n                try\n                {\n                    var lookup = await source.ToLookupAsync(keySelector, elementSelector, comparer, cancellationToken);\n                    groupEnumerator = lookup.GetEnumerator();\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n                SourceMoveNext();\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    if (groupEnumerator.MoveNext())\n                    {\n                        Current = groupEnumerator.Current as IGrouping<TKey, TElement>;\n                        completionSource.TrySetResult(true);\n                    }\n                    else\n                    {\n                        completionSource.TrySetResult(false);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (groupEnumerator != null)\n                {\n                    groupEnumerator.Dispose();\n                }\n\n                return default;\n            }\n        }\n    }\n\n    internal sealed class GroupBy<TSource, TKey, TElement, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, TKey> keySelector;\n        readonly Func<TSource, TElement> elementSelector;\n        readonly Func<TKey, IEnumerable<TElement>, TResult> resultSelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public GroupBy(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            this.source = source;\n            this.keySelector = keySelector;\n            this.elementSelector = elementSelector;\n            this.resultSelector = resultSelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _GroupBy(source, keySelector, elementSelector, resultSelector, comparer, cancellationToken);\n        }\n\n        sealed class _GroupBy : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, TKey> keySelector;\n            readonly Func<TSource, TElement> elementSelector;\n            readonly Func<TKey, IEnumerable<TElement>, TResult> resultSelector;\n            readonly IEqualityComparer<TKey> comparer;\n            CancellationToken cancellationToken;\n\n            IEnumerator<IGrouping<TKey, TElement>> groupEnumerator;\n\n            public _GroupBy(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.keySelector = keySelector;\n                this.elementSelector = elementSelector;\n                this.resultSelector = resultSelector;\n                this.comparer = comparer;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                if (groupEnumerator == null)\n                {\n                    CreateLookup().Forget();\n                }\n                else\n                {\n                    SourceMoveNext();\n                }\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            async UniTaskVoid CreateLookup()\n            {\n                try\n                {\n                    var lookup = await source.ToLookupAsync(keySelector, elementSelector, comparer, cancellationToken);\n                    groupEnumerator = lookup.GetEnumerator();\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n                SourceMoveNext();\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    if (groupEnumerator.MoveNext())\n                    {\n                        var current = groupEnumerator.Current;\n                        Current = resultSelector(current.Key, current);\n                        completionSource.TrySetResult(true);\n                    }\n                    else\n                    {\n                        completionSource.TrySetResult(false);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (groupEnumerator != null)\n                {\n                    groupEnumerator.Dispose();\n                }\n\n                return default;\n            }\n        }\n    }\n\n    internal sealed class GroupByAwait<TSource, TKey, TElement> : IUniTaskAsyncEnumerable<IGrouping<TKey, TElement>>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, UniTask<TKey>> keySelector;\n        readonly Func<TSource, UniTask<TElement>> elementSelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public GroupByAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, Func<TSource, UniTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer)\n        {\n            this.source = source;\n            this.keySelector = keySelector;\n            this.elementSelector = elementSelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<IGrouping<TKey, TElement>> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _GroupByAwait(source, keySelector, elementSelector, comparer, cancellationToken);\n        }\n\n        sealed class _GroupByAwait : MoveNextSource, IUniTaskAsyncEnumerator<IGrouping<TKey, TElement>>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, UniTask<TKey>> keySelector;\n            readonly Func<TSource, UniTask<TElement>> elementSelector;\n            readonly IEqualityComparer<TKey> comparer;\n            CancellationToken cancellationToken;\n\n            IEnumerator<IGrouping<TKey, TElement>> groupEnumerator;\n\n            public _GroupByAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, Func<TSource, UniTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.keySelector = keySelector;\n                this.elementSelector = elementSelector;\n                this.comparer = comparer;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public IGrouping<TKey, TElement> Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                if (groupEnumerator == null)\n                {\n                    CreateLookup().Forget();\n                }\n                else\n                {\n                    SourceMoveNext();\n                }\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            async UniTaskVoid CreateLookup()\n            {\n                try\n                {\n                    var lookup = await source.ToLookupAwaitAsync(keySelector, elementSelector, comparer, cancellationToken);\n                    groupEnumerator = lookup.GetEnumerator();\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n                SourceMoveNext();\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    if (groupEnumerator.MoveNext())\n                    {\n                        Current = groupEnumerator.Current as IGrouping<TKey, TElement>;\n                        completionSource.TrySetResult(true);\n                    }\n                    else\n                    {\n                        completionSource.TrySetResult(false);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (groupEnumerator != null)\n                {\n                    groupEnumerator.Dispose();\n                }\n\n                return default;\n            }\n        }\n    }\n\n    internal sealed class GroupByAwait<TSource, TKey, TElement, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, UniTask<TKey>> keySelector;\n        readonly Func<TSource, UniTask<TElement>> elementSelector;\n        readonly Func<TKey, IEnumerable<TElement>, UniTask<TResult>> resultSelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public GroupByAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, Func<TSource, UniTask<TElement>> elementSelector, Func<TKey, IEnumerable<TElement>, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            this.source = source;\n            this.keySelector = keySelector;\n            this.elementSelector = elementSelector;\n            this.resultSelector = resultSelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _GroupByAwait(source, keySelector, elementSelector, resultSelector, comparer, cancellationToken);\n        }\n\n        sealed class _GroupByAwait : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            readonly static Action<object> ResultSelectCoreDelegate = ResultSelectCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, UniTask<TKey>> keySelector;\n            readonly Func<TSource, UniTask<TElement>> elementSelector;\n            readonly Func<TKey, IEnumerable<TElement>, UniTask<TResult>> resultSelector;\n            readonly IEqualityComparer<TKey> comparer;\n            CancellationToken cancellationToken;\n\n            IEnumerator<IGrouping<TKey, TElement>> groupEnumerator;\n            UniTask<TResult>.Awaiter awaiter;\n\n            public _GroupByAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, Func<TSource, UniTask<TElement>> elementSelector, Func<TKey, IEnumerable<TElement>, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.keySelector = keySelector;\n                this.elementSelector = elementSelector;\n                this.resultSelector = resultSelector;\n                this.comparer = comparer;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                if (groupEnumerator == null)\n                {\n                    CreateLookup().Forget();\n                }\n                else\n                {\n                    SourceMoveNext();\n                }\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            async UniTaskVoid CreateLookup()\n            {\n                try\n                {\n                    var lookup = await source.ToLookupAwaitAsync(keySelector, elementSelector, comparer, cancellationToken);\n                    groupEnumerator = lookup.GetEnumerator();\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n                SourceMoveNext();\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    if (groupEnumerator.MoveNext())\n                    {\n                        var current = groupEnumerator.Current;\n\n                        awaiter = resultSelector(current.Key, current).GetAwaiter();\n                        if (awaiter.IsCompleted)\n                        {\n                            ResultSelectCore(this);\n                        }\n                        else\n                        {\n                            awaiter.SourceOnCompleted(ResultSelectCoreDelegate, this);\n                        }\n                        return;\n                    }\n                    else\n                    {\n                        completionSource.TrySetResult(false);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n            }\n\n            static void ResultSelectCore(object state)\n            {\n                var self = (_GroupByAwait)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    self.Current = result;\n                    self.completionSource.TrySetResult(true);\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (groupEnumerator != null)\n                {\n                    groupEnumerator.Dispose();\n                }\n\n                return default;\n            }\n        }\n    }\n\n    internal sealed class GroupByAwaitWithCancellation<TSource, TKey, TElement> : IUniTaskAsyncEnumerable<IGrouping<TKey, TElement>>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, CancellationToken, UniTask<TKey>> keySelector;\n        readonly Func<TSource, CancellationToken, UniTask<TElement>> elementSelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public GroupByAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, Func<TSource, CancellationToken, UniTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer)\n        {\n            this.source = source;\n            this.keySelector = keySelector;\n            this.elementSelector = elementSelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<IGrouping<TKey, TElement>> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _GroupByAwaitWithCancellation(source, keySelector, elementSelector, comparer, cancellationToken);\n        }\n\n        sealed class _GroupByAwaitWithCancellation : MoveNextSource, IUniTaskAsyncEnumerator<IGrouping<TKey, TElement>>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, CancellationToken, UniTask<TKey>> keySelector;\n            readonly Func<TSource, CancellationToken, UniTask<TElement>> elementSelector;\n            readonly IEqualityComparer<TKey> comparer;\n            CancellationToken cancellationToken;\n\n            IEnumerator<IGrouping<TKey, TElement>> groupEnumerator;\n\n            public _GroupByAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, Func<TSource, CancellationToken, UniTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.keySelector = keySelector;\n                this.elementSelector = elementSelector;\n                this.comparer = comparer;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public IGrouping<TKey, TElement> Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                if (groupEnumerator == null)\n                {\n                    CreateLookup().Forget();\n                }\n                else\n                {\n                    SourceMoveNext();\n                }\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            async UniTaskVoid CreateLookup()\n            {\n                try\n                {\n                    var lookup = await source.ToLookupAwaitWithCancellationAsync(keySelector, elementSelector, comparer, cancellationToken);\n                    groupEnumerator = lookup.GetEnumerator();\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n                SourceMoveNext();\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    if (groupEnumerator.MoveNext())\n                    {\n                        Current = groupEnumerator.Current as IGrouping<TKey, TElement>;\n                        completionSource.TrySetResult(true);\n                    }\n                    else\n                    {\n                        completionSource.TrySetResult(false);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (groupEnumerator != null)\n                {\n                    groupEnumerator.Dispose();\n                }\n\n                return default;\n            }\n        }\n    }\n\n    internal sealed class GroupByAwaitWithCancellation<TSource, TKey, TElement, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, CancellationToken, UniTask<TKey>> keySelector;\n        readonly Func<TSource, CancellationToken, UniTask<TElement>> elementSelector;\n        readonly Func<TKey, IEnumerable<TElement>, CancellationToken, UniTask<TResult>> resultSelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public GroupByAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, Func<TSource, CancellationToken, UniTask<TElement>> elementSelector, Func<TKey, IEnumerable<TElement>, CancellationToken, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            this.source = source;\n            this.keySelector = keySelector;\n            this.elementSelector = elementSelector;\n            this.resultSelector = resultSelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _GroupByAwaitWithCancellation(source, keySelector, elementSelector, resultSelector, comparer, cancellationToken);\n        }\n\n        sealed class _GroupByAwaitWithCancellation : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            readonly static Action<object> ResultSelectCoreDelegate = ResultSelectCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, CancellationToken, UniTask<TKey>> keySelector;\n            readonly Func<TSource, CancellationToken, UniTask<TElement>> elementSelector;\n            readonly Func<TKey, IEnumerable<TElement>, CancellationToken, UniTask<TResult>> resultSelector;\n            readonly IEqualityComparer<TKey> comparer;\n            CancellationToken cancellationToken;\n\n            IEnumerator<IGrouping<TKey, TElement>> groupEnumerator;\n            UniTask<TResult>.Awaiter awaiter;\n\n            public _GroupByAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, Func<TSource, CancellationToken, UniTask<TElement>> elementSelector, Func<TKey, IEnumerable<TElement>, CancellationToken, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.keySelector = keySelector;\n                this.elementSelector = elementSelector;\n                this.resultSelector = resultSelector;\n                this.comparer = comparer;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                if (groupEnumerator == null)\n                {\n                    CreateLookup().Forget();\n                }\n                else\n                {\n                    SourceMoveNext();\n                }\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            async UniTaskVoid CreateLookup()\n            {\n                try\n                {\n                    var lookup = await source.ToLookupAwaitWithCancellationAsync(keySelector, elementSelector, comparer, cancellationToken);\n                    groupEnumerator = lookup.GetEnumerator();\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n                SourceMoveNext();\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    if (groupEnumerator.MoveNext())\n                    {\n                        var current = groupEnumerator.Current;\n\n                        awaiter = resultSelector(current.Key, current, cancellationToken).GetAwaiter();\n                        if (awaiter.IsCompleted)\n                        {\n                            ResultSelectCore(this);\n                        }\n                        else\n                        {\n                            awaiter.SourceOnCompleted(ResultSelectCoreDelegate, this);\n                        }\n                        return;\n                    }\n                    else\n                    {\n                        completionSource.TrySetResult(false);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n            }\n\n            static void ResultSelectCore(object state)\n            {\n                var self = (_GroupByAwaitWithCancellation)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    self.Current = result;\n                    self.completionSource.TrySetResult(true);\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (groupEnumerator != null)\n                {\n                    groupEnumerator.Dispose();\n                }\n\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/GroupBy.cs.meta",
    "content": "fileFormatVersion: 2\nguid: a2de80df1cc8a1240ab0ee7badd334d0\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/GroupJoin.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IEnumerable<TInner>, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(outer, nameof(outer));\n            Error.ThrowArgumentNullException(inner, nameof(inner));\n            Error.ThrowArgumentNullException(outerKeySelector, nameof(outerKeySelector));\n            Error.ThrowArgumentNullException(innerKeySelector, nameof(innerKeySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new GroupJoin<TOuter, TInner, TKey, TResult>(outer, inner, outerKeySelector, innerKeySelector, resultSelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IEnumerable<TInner>, TResult> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(outer, nameof(outer));\n            Error.ThrowArgumentNullException(inner, nameof(inner));\n            Error.ThrowArgumentNullException(outerKeySelector, nameof(outerKeySelector));\n            Error.ThrowArgumentNullException(innerKeySelector, nameof(innerKeySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new GroupJoin<TOuter, TInner, TKey, TResult>(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> GroupJoinAwait<TOuter, TInner, TKey, TResult>(this IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, UniTask<TKey>> outerKeySelector, Func<TInner, UniTask<TKey>> innerKeySelector, Func<TOuter, IEnumerable<TInner>, UniTask<TResult>> resultSelector)\n        {\n            Error.ThrowArgumentNullException(outer, nameof(outer));\n            Error.ThrowArgumentNullException(inner, nameof(inner));\n            Error.ThrowArgumentNullException(outerKeySelector, nameof(outerKeySelector));\n            Error.ThrowArgumentNullException(innerKeySelector, nameof(innerKeySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new GroupJoinAwait<TOuter, TInner, TKey, TResult>(outer, inner, outerKeySelector, innerKeySelector, resultSelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> GroupJoinAwait<TOuter, TInner, TKey, TResult>(this IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, UniTask<TKey>> outerKeySelector, Func<TInner, UniTask<TKey>> innerKeySelector, Func<TOuter, IEnumerable<TInner>, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(outer, nameof(outer));\n            Error.ThrowArgumentNullException(inner, nameof(inner));\n            Error.ThrowArgumentNullException(outerKeySelector, nameof(outerKeySelector));\n            Error.ThrowArgumentNullException(innerKeySelector, nameof(innerKeySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new GroupJoinAwait<TOuter, TInner, TKey, TResult>(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> GroupJoinAwaitWithCancellation<TOuter, TInner, TKey, TResult>(this IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, CancellationToken, UniTask<TKey>> outerKeySelector, Func<TInner, CancellationToken, UniTask<TKey>> innerKeySelector, Func<TOuter, IEnumerable<TInner>, CancellationToken, UniTask<TResult>> resultSelector)\n        {\n            Error.ThrowArgumentNullException(outer, nameof(outer));\n            Error.ThrowArgumentNullException(inner, nameof(inner));\n            Error.ThrowArgumentNullException(outerKeySelector, nameof(outerKeySelector));\n            Error.ThrowArgumentNullException(innerKeySelector, nameof(innerKeySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new GroupJoinAwaitWithCancellation<TOuter, TInner, TKey, TResult>(outer, inner, outerKeySelector, innerKeySelector, resultSelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> GroupJoinAwaitWithCancellation<TOuter, TInner, TKey, TResult>(this IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, CancellationToken, UniTask<TKey>> outerKeySelector, Func<TInner, CancellationToken, UniTask<TKey>> innerKeySelector, Func<TOuter, IEnumerable<TInner>, CancellationToken, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(outer, nameof(outer));\n            Error.ThrowArgumentNullException(inner, nameof(inner));\n            Error.ThrowArgumentNullException(outerKeySelector, nameof(outerKeySelector));\n            Error.ThrowArgumentNullException(innerKeySelector, nameof(innerKeySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new GroupJoinAwaitWithCancellation<TOuter, TInner, TKey, TResult>(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer);\n        }\n\n    }\n\n    internal sealed class GroupJoin<TOuter, TInner, TKey, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TOuter> outer;\n        readonly IUniTaskAsyncEnumerable<TInner> inner;\n        readonly Func<TOuter, TKey> outerKeySelector;\n        readonly Func<TInner, TKey> innerKeySelector;\n        readonly Func<TOuter, IEnumerable<TInner>, TResult> resultSelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public GroupJoin(IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IEnumerable<TInner>, TResult> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            this.outer = outer;\n            this.inner = inner;\n            this.outerKeySelector = outerKeySelector;\n            this.innerKeySelector = innerKeySelector;\n            this.resultSelector = resultSelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _GroupJoin(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer, cancellationToken);\n        }\n\n        sealed class _GroupJoin : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n\n            readonly IUniTaskAsyncEnumerable<TOuter> outer;\n            readonly IUniTaskAsyncEnumerable<TInner> inner;\n            readonly Func<TOuter, TKey> outerKeySelector;\n            readonly Func<TInner, TKey> innerKeySelector;\n            readonly Func<TOuter, IEnumerable<TInner>, TResult> resultSelector;\n            readonly IEqualityComparer<TKey> comparer;\n            CancellationToken cancellationToken;\n\n            ILookup<TKey, TInner> lookup;\n            IUniTaskAsyncEnumerator<TOuter> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n\n\n            public _GroupJoin(IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IEnumerable<TInner>, TResult> resultSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n            {\n                this.outer = outer;\n                this.inner = inner;\n                this.outerKeySelector = outerKeySelector;\n                this.innerKeySelector = innerKeySelector;\n                this.resultSelector = resultSelector;\n                this.comparer = comparer;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                if (lookup == null)\n                {\n                    CreateLookup().Forget();\n                }\n                else\n                {\n                    SourceMoveNext();\n                }\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            async UniTaskVoid CreateLookup()\n            {\n                try\n                {\n                    lookup = await inner.ToLookupAsync(innerKeySelector, comparer, cancellationToken);\n                    enumerator = outer.GetAsyncEnumerator(cancellationToken);\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n                SourceMoveNext();\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        MoveNextCore(this);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                }\n            }\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_GroupJoin)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        var outer = self.enumerator.Current;\n                        var key = self.outerKeySelector(outer);\n                        var values = self.lookup[key];\n\n                        self.Current = self.resultSelector(outer, values);\n                        self.completionSource.TrySetResult(true);\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n\n                return default;\n            }\n        }\n    }\n\n    internal sealed class GroupJoinAwait<TOuter, TInner, TKey, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TOuter> outer;\n        readonly IUniTaskAsyncEnumerable<TInner> inner;\n        readonly Func<TOuter, UniTask<TKey>> outerKeySelector;\n        readonly Func<TInner, UniTask<TKey>> innerKeySelector;\n        readonly Func<TOuter, IEnumerable<TInner>, UniTask<TResult>> resultSelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public GroupJoinAwait(IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, UniTask<TKey>> outerKeySelector, Func<TInner, UniTask<TKey>> innerKeySelector, Func<TOuter, IEnumerable<TInner>, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            this.outer = outer;\n            this.inner = inner;\n            this.outerKeySelector = outerKeySelector;\n            this.innerKeySelector = innerKeySelector;\n            this.resultSelector = resultSelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _GroupJoinAwait(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer, cancellationToken);\n        }\n\n        sealed class _GroupJoinAwait : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n            readonly static Action<object> ResultSelectCoreDelegate = ResultSelectCore;\n            readonly static Action<object> OuterKeySelectCoreDelegate = OuterKeySelectCore;\n\n            readonly IUniTaskAsyncEnumerable<TOuter> outer;\n            readonly IUniTaskAsyncEnumerable<TInner> inner;\n            readonly Func<TOuter, UniTask<TKey>> outerKeySelector;\n            readonly Func<TInner, UniTask<TKey>> innerKeySelector;\n            readonly Func<TOuter, IEnumerable<TInner>, UniTask<TResult>> resultSelector;\n            readonly IEqualityComparer<TKey> comparer;\n            CancellationToken cancellationToken;\n\n            ILookup<TKey, TInner> lookup;\n            IUniTaskAsyncEnumerator<TOuter> enumerator;\n            TOuter outerValue;\n            UniTask<bool>.Awaiter awaiter;\n            UniTask<TKey>.Awaiter outerKeyAwaiter;\n            UniTask<TResult>.Awaiter resultAwaiter;\n\n\n            public _GroupJoinAwait(IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, UniTask<TKey>> outerKeySelector, Func<TInner, UniTask<TKey>> innerKeySelector, Func<TOuter, IEnumerable<TInner>, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n            {\n                this.outer = outer;\n                this.inner = inner;\n                this.outerKeySelector = outerKeySelector;\n                this.innerKeySelector = innerKeySelector;\n                this.resultSelector = resultSelector;\n                this.comparer = comparer;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                if (lookup == null)\n                {\n                    CreateLookup().Forget();\n                }\n                else\n                {\n                    SourceMoveNext();\n                }\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            async UniTaskVoid CreateLookup()\n            {\n                try\n                {\n                    lookup = await inner.ToLookupAwaitAsync(innerKeySelector, comparer, cancellationToken);\n                    enumerator = outer.GetAsyncEnumerator(cancellationToken);\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n                SourceMoveNext();\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        MoveNextCore(this);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                }\n            }\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_GroupJoinAwait)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        try\n                        {\n\n                            self.outerValue = self.enumerator.Current;\n                            self.outerKeyAwaiter = self.outerKeySelector(self.outerValue).GetAwaiter();\n                            if (self.outerKeyAwaiter.IsCompleted)\n                            {\n                                OuterKeySelectCore(self);\n                            }\n                            else\n                            {\n                                self.outerKeyAwaiter.SourceOnCompleted(OuterKeySelectCoreDelegate, self);\n                            }\n                        }\n                        catch (Exception ex)\n                        {\n                            self.completionSource.TrySetException(ex);\n                        }\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            static void OuterKeySelectCore(object state)\n            {\n                var self = (_GroupJoinAwait)state;\n\n                if (self.TryGetResult(self.outerKeyAwaiter, out var result))\n                {\n                    try\n                    {\n                        var values = self.lookup[result];\n                        self.resultAwaiter = self.resultSelector(self.outerValue, values).GetAwaiter();\n                        if (self.resultAwaiter.IsCompleted)\n                        {\n                            ResultSelectCore(self);\n                        }\n                        else\n                        {\n                            self.resultAwaiter.SourceOnCompleted(ResultSelectCoreDelegate, self);\n                        }\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completionSource.TrySetException(ex);\n                    }\n                }\n            }\n\n            static void ResultSelectCore(object state)\n            {\n                var self = (_GroupJoinAwait)state;\n\n                if (self.TryGetResult(self.resultAwaiter, out var result))\n                {\n                    self.Current = result;\n                    self.completionSource.TrySetResult(true);\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n\n                return default;\n            }\n        }\n    }\n\n    internal sealed class GroupJoinAwaitWithCancellation<TOuter, TInner, TKey, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TOuter> outer;\n        readonly IUniTaskAsyncEnumerable<TInner> inner;\n        readonly Func<TOuter, CancellationToken, UniTask<TKey>> outerKeySelector;\n        readonly Func<TInner, CancellationToken, UniTask<TKey>> innerKeySelector;\n        readonly Func<TOuter, IEnumerable<TInner>, CancellationToken, UniTask<TResult>> resultSelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public GroupJoinAwaitWithCancellation(IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, CancellationToken, UniTask<TKey>> outerKeySelector, Func<TInner, CancellationToken, UniTask<TKey>> innerKeySelector, Func<TOuter, IEnumerable<TInner>, CancellationToken, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            this.outer = outer;\n            this.inner = inner;\n            this.outerKeySelector = outerKeySelector;\n            this.innerKeySelector = innerKeySelector;\n            this.resultSelector = resultSelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _GroupJoinAwaitWithCancellation(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer, cancellationToken);\n        }\n\n        sealed class _GroupJoinAwaitWithCancellation : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n            readonly static Action<object> ResultSelectCoreDelegate = ResultSelectCore;\n            readonly static Action<object> OuterKeySelectCoreDelegate = OuterKeySelectCore;\n\n            readonly IUniTaskAsyncEnumerable<TOuter> outer;\n            readonly IUniTaskAsyncEnumerable<TInner> inner;\n            readonly Func<TOuter, CancellationToken, UniTask<TKey>> outerKeySelector;\n            readonly Func<TInner, CancellationToken, UniTask<TKey>> innerKeySelector;\n            readonly Func<TOuter, IEnumerable<TInner>, CancellationToken, UniTask<TResult>> resultSelector;\n            readonly IEqualityComparer<TKey> comparer;\n            CancellationToken cancellationToken;\n\n            ILookup<TKey, TInner> lookup;\n            IUniTaskAsyncEnumerator<TOuter> enumerator;\n            TOuter outerValue;\n            UniTask<bool>.Awaiter awaiter;\n            UniTask<TKey>.Awaiter outerKeyAwaiter;\n            UniTask<TResult>.Awaiter resultAwaiter;\n\n\n            public _GroupJoinAwaitWithCancellation(IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, CancellationToken, UniTask<TKey>> outerKeySelector, Func<TInner, CancellationToken, UniTask<TKey>> innerKeySelector, Func<TOuter, IEnumerable<TInner>, CancellationToken, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n            {\n                this.outer = outer;\n                this.inner = inner;\n                this.outerKeySelector = outerKeySelector;\n                this.innerKeySelector = innerKeySelector;\n                this.resultSelector = resultSelector;\n                this.comparer = comparer;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                if (lookup == null)\n                {\n                    CreateLookup().Forget();\n                }\n                else\n                {\n                    SourceMoveNext();\n                }\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            async UniTaskVoid CreateLookup()\n            {\n                try\n                {\n                    lookup = await inner.ToLookupAwaitWithCancellationAsync(innerKeySelector, comparer, cancellationToken);\n                    enumerator = outer.GetAsyncEnumerator(cancellationToken);\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n                SourceMoveNext();\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        MoveNextCore(this);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                }\n            }\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_GroupJoinAwaitWithCancellation)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        try\n                        {\n\n                            self.outerValue = self.enumerator.Current;\n                            self.outerKeyAwaiter = self.outerKeySelector(self.outerValue, self.cancellationToken).GetAwaiter();\n                            if (self.outerKeyAwaiter.IsCompleted)\n                            {\n                                OuterKeySelectCore(self);\n                            }\n                            else\n                            {\n                                self.outerKeyAwaiter.SourceOnCompleted(OuterKeySelectCoreDelegate, self);\n                            }\n                        }\n                        catch (Exception ex)\n                        {\n                            self.completionSource.TrySetException(ex);\n                        }\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            static void OuterKeySelectCore(object state)\n            {\n                var self = (_GroupJoinAwaitWithCancellation)state;\n\n                if (self.TryGetResult(self.outerKeyAwaiter, out var result))\n                {\n                    try\n                    {\n                        var values = self.lookup[result];\n                        self.resultAwaiter = self.resultSelector(self.outerValue, values, self.cancellationToken).GetAwaiter();\n                        if (self.resultAwaiter.IsCompleted)\n                        {\n                            ResultSelectCore(self);\n                        }\n                        else\n                        {\n                            self.resultAwaiter.SourceOnCompleted(ResultSelectCoreDelegate, self);\n                        }\n                    }\n                    catch (Exception ex)\n                    {\n                        self.completionSource.TrySetException(ex);\n                    }\n                }\n            }\n\n            static void ResultSelectCore(object state)\n            {\n                var self = (_GroupJoinAwaitWithCancellation)state;\n\n                if (self.TryGetResult(self.resultAwaiter, out var result))\n                {\n                    self.Current = result;\n                    self.completionSource.TrySetResult(true);\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/GroupJoin.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 7bf7759d03bf3f64190d3ae83b182c2c\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Intersect.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> Intersect<TSource>(this IUniTaskAsyncEnumerable<TSource> first, IUniTaskAsyncEnumerable<TSource> second)\n        {\n            Error.ThrowArgumentNullException(first, nameof(first));\n            Error.ThrowArgumentNullException(second, nameof(second));\n\n            return new Intersect<TSource>(first, second, EqualityComparer<TSource>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> Intersect<TSource>(this IUniTaskAsyncEnumerable<TSource> first, IUniTaskAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)\n        {\n            Error.ThrowArgumentNullException(first, nameof(first));\n            Error.ThrowArgumentNullException(second, nameof(second));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new Intersect<TSource>(first, second, comparer);\n        }\n    }\n\n    internal sealed class Intersect<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> first;\n        readonly IUniTaskAsyncEnumerable<TSource> second;\n        readonly IEqualityComparer<TSource> comparer;\n\n        public Intersect(IUniTaskAsyncEnumerable<TSource> first, IUniTaskAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)\n        {\n            this.first = first;\n            this.second = second;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Intersect(first, second, comparer, cancellationToken);\n        }\n\n        class _Intersect : AsyncEnumeratorBase<TSource, TSource>\n        {\n            static Action<object> HashSetAsyncCoreDelegate = HashSetAsyncCore;\n\n            readonly IEqualityComparer<TSource> comparer;\n            readonly IUniTaskAsyncEnumerable<TSource> second;\n\n            HashSet<TSource> set;\n            UniTask<HashSet<TSource>>.Awaiter awaiter;\n\n            public _Intersect(IUniTaskAsyncEnumerable<TSource> first, IUniTaskAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken)\n\n                : base(first, cancellationToken)\n            {\n                this.second = second;\n                this.comparer = comparer;\n            }\n\n            protected override bool OnFirstIteration()\n            {\n                if (set != null) return false;\n\n                awaiter = second.ToHashSetAsync(cancellationToken).GetAwaiter();\n                if (awaiter.IsCompleted)\n                {\n                    set = awaiter.GetResult();\n                    SourceMoveNext();\n                }\n                else\n                {\n                    awaiter.SourceOnCompleted(HashSetAsyncCoreDelegate, this);\n                }\n\n                return true;\n            }\n\n            static void HashSetAsyncCore(object state)\n            {\n                var self = (_Intersect)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    self.set = result;\n                    self.SourceMoveNext();\n                }\n            }\n\n            protected override bool TryMoveNextCore(bool sourceHasCurrent, out bool result)\n            {\n                if (sourceHasCurrent)\n                {\n                    var v = SourceCurrent;\n\n                    if (set.Remove(v))\n                    {\n                        Current = v;\n                        result = true;\n                        return true;\n                    }\n                    else\n                    {\n                        result = default;\n                        return false;\n                    }\n                }\n\n                result = false;\n                return true;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Intersect.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 93999a70f5d57134bbe971f3e988c4f2\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Join.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TResult> Join<TOuter, TInner, TKey, TResult>(this IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(outer, nameof(outer));\n            Error.ThrowArgumentNullException(inner, nameof(inner));\n            Error.ThrowArgumentNullException(outerKeySelector, nameof(outerKeySelector));\n            Error.ThrowArgumentNullException(innerKeySelector, nameof(innerKeySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new Join<TOuter, TInner, TKey, TResult>(outer, inner, outerKeySelector, innerKeySelector, resultSelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> Join<TOuter, TInner, TKey, TResult>(this IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(outer, nameof(outer));\n            Error.ThrowArgumentNullException(inner, nameof(inner));\n            Error.ThrowArgumentNullException(outerKeySelector, nameof(outerKeySelector));\n            Error.ThrowArgumentNullException(innerKeySelector, nameof(innerKeySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new Join<TOuter, TInner, TKey, TResult>(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> JoinAwait<TOuter, TInner, TKey, TResult>(this IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, UniTask<TKey>> outerKeySelector, Func<TInner, UniTask<TKey>> innerKeySelector, Func<TOuter, TInner, UniTask<TResult>> resultSelector)\n        {\n            Error.ThrowArgumentNullException(outer, nameof(outer));\n            Error.ThrowArgumentNullException(inner, nameof(inner));\n            Error.ThrowArgumentNullException(outerKeySelector, nameof(outerKeySelector));\n            Error.ThrowArgumentNullException(innerKeySelector, nameof(innerKeySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new JoinAwait<TOuter, TInner, TKey, TResult>(outer, inner, outerKeySelector, innerKeySelector, resultSelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> JoinAwait<TOuter, TInner, TKey, TResult>(this IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, UniTask<TKey>> outerKeySelector, Func<TInner, UniTask<TKey>> innerKeySelector, Func<TOuter, TInner, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(outer, nameof(outer));\n            Error.ThrowArgumentNullException(inner, nameof(inner));\n            Error.ThrowArgumentNullException(outerKeySelector, nameof(outerKeySelector));\n            Error.ThrowArgumentNullException(innerKeySelector, nameof(innerKeySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new JoinAwait<TOuter, TInner, TKey, TResult>(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> JoinAwaitWithCancellation<TOuter, TInner, TKey, TResult>(this IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, CancellationToken, UniTask<TKey>> outerKeySelector, Func<TInner, CancellationToken, UniTask<TKey>> innerKeySelector, Func<TOuter, TInner, CancellationToken, UniTask<TResult>> resultSelector)\n        {\n            Error.ThrowArgumentNullException(outer, nameof(outer));\n            Error.ThrowArgumentNullException(inner, nameof(inner));\n            Error.ThrowArgumentNullException(outerKeySelector, nameof(outerKeySelector));\n            Error.ThrowArgumentNullException(innerKeySelector, nameof(innerKeySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new JoinAwaitWithCancellation<TOuter, TInner, TKey, TResult>(outer, inner, outerKeySelector, innerKeySelector, resultSelector, EqualityComparer<TKey>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> JoinAwaitWithCancellation<TOuter, TInner, TKey, TResult>(this IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, CancellationToken, UniTask<TKey>> outerKeySelector, Func<TInner, CancellationToken, UniTask<TKey>> innerKeySelector, Func<TOuter, TInner, CancellationToken, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(outer, nameof(outer));\n            Error.ThrowArgumentNullException(inner, nameof(inner));\n            Error.ThrowArgumentNullException(outerKeySelector, nameof(outerKeySelector));\n            Error.ThrowArgumentNullException(innerKeySelector, nameof(innerKeySelector));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new JoinAwaitWithCancellation<TOuter, TInner, TKey, TResult>(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer);\n        }\n    }\n\n    internal sealed class Join<TOuter, TInner, TKey, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TOuter> outer;\n        readonly IUniTaskAsyncEnumerable<TInner> inner;\n        readonly Func<TOuter, TKey> outerKeySelector;\n        readonly Func<TInner, TKey> innerKeySelector;\n        readonly Func<TOuter, TInner, TResult> resultSelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public Join(IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            this.outer = outer;\n            this.inner = inner;\n            this.outerKeySelector = outerKeySelector;\n            this.innerKeySelector = innerKeySelector;\n            this.resultSelector = resultSelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Join(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer, cancellationToken);\n        }\n\n        sealed class _Join : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n\n            readonly IUniTaskAsyncEnumerable<TOuter> outer;\n            readonly IUniTaskAsyncEnumerable<TInner> inner;\n            readonly Func<TOuter, TKey> outerKeySelector;\n            readonly Func<TInner, TKey> innerKeySelector;\n            readonly Func<TOuter, TInner, TResult> resultSelector;\n            readonly IEqualityComparer<TKey> comparer;\n            CancellationToken cancellationToken;\n\n            ILookup<TKey, TInner> lookup;\n            IUniTaskAsyncEnumerator<TOuter> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            TOuter currentOuterValue;\n            IEnumerator<TInner> valueEnumerator;\n\n            bool continueNext;\n\n            public _Join(IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n            {\n                this.outer = outer;\n                this.inner = inner;\n                this.outerKeySelector = outerKeySelector;\n                this.innerKeySelector = innerKeySelector;\n                this.resultSelector = resultSelector;\n                this.comparer = comparer;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                if (lookup == null)\n                {\n                    CreateInnerHashSet().Forget();\n                }\n                else\n                {\n                    SourceMoveNext();\n                }\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            async UniTaskVoid CreateInnerHashSet()\n            {\n                try\n                {\n                    lookup = await inner.ToLookupAsync(innerKeySelector, comparer, cancellationToken);\n                    enumerator = outer.GetAsyncEnumerator(cancellationToken);\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n                SourceMoveNext();\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    LOOP:\n                    if (valueEnumerator != null)\n                    {\n                        if (valueEnumerator.MoveNext())\n                        {\n                            Current = resultSelector(currentOuterValue, valueEnumerator.Current);\n                            goto TRY_SET_RESULT_TRUE;\n                        }\n                        else\n                        {\n                            valueEnumerator.Dispose();\n                            valueEnumerator = null;\n                        }\n                    }\n\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        continueNext = true;\n                        MoveNextCore(this);\n                        if (continueNext)\n                        {\n                            continueNext = false;\n                            goto LOOP; // avoid recursive\n                        }\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                }\n\n                return;\n\n                TRY_SET_RESULT_TRUE:\n                completionSource.TrySetResult(true);\n            }\n\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_Join)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        self.currentOuterValue = self.enumerator.Current;\n                        var key = self.outerKeySelector(self.currentOuterValue);\n                        self.valueEnumerator = self.lookup[key].GetEnumerator();\n\n                        if (self.continueNext)\n                        {\n                            return;\n                        }\n                        else\n                        {\n                            self.SourceMoveNext();\n                        }\n                    }\n                    else\n                    {\n                        self.continueNext = false;\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n                else\n                {\n                    self.continueNext = false;\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (valueEnumerator != null)\n                {\n                    valueEnumerator.Dispose();\n                }\n\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n\n                return default;\n            }\n        }\n    }\n\n    internal sealed class JoinAwait<TOuter, TInner, TKey, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TOuter> outer;\n        readonly IUniTaskAsyncEnumerable<TInner> inner;\n        readonly Func<TOuter, UniTask<TKey>> outerKeySelector;\n        readonly Func<TInner, UniTask<TKey>> innerKeySelector;\n        readonly Func<TOuter, TInner, UniTask<TResult>> resultSelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public JoinAwait(IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, UniTask<TKey>> outerKeySelector, Func<TInner, UniTask<TKey>> innerKeySelector, Func<TOuter, TInner, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            this.outer = outer;\n            this.inner = inner;\n            this.outerKeySelector = outerKeySelector;\n            this.innerKeySelector = innerKeySelector;\n            this.resultSelector = resultSelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _JoinAwait(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer, cancellationToken);\n        }\n\n        sealed class _JoinAwait : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n            static readonly Action<object> OuterSelectCoreDelegate = OuterSelectCore;\n            static readonly Action<object> ResultSelectCoreDelegate = ResultSelectCore;\n\n            readonly IUniTaskAsyncEnumerable<TOuter> outer;\n            readonly IUniTaskAsyncEnumerable<TInner> inner;\n            readonly Func<TOuter, UniTask<TKey>> outerKeySelector;\n            readonly Func<TInner, UniTask<TKey>> innerKeySelector;\n            readonly Func<TOuter, TInner, UniTask<TResult>> resultSelector;\n            readonly IEqualityComparer<TKey> comparer;\n            CancellationToken cancellationToken;\n\n            ILookup<TKey, TInner> lookup;\n            IUniTaskAsyncEnumerator<TOuter> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            TOuter currentOuterValue;\n            IEnumerator<TInner> valueEnumerator;\n\n            UniTask<TResult>.Awaiter resultAwaiter;\n            UniTask<TKey>.Awaiter outerKeyAwaiter;\n\n            bool continueNext;\n\n            public _JoinAwait(IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, UniTask<TKey>> outerKeySelector, Func<TInner, UniTask<TKey>> innerKeySelector, Func<TOuter, TInner, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n            {\n                this.outer = outer;\n                this.inner = inner;\n                this.outerKeySelector = outerKeySelector;\n                this.innerKeySelector = innerKeySelector;\n                this.resultSelector = resultSelector;\n                this.comparer = comparer;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                if (lookup == null)\n                {\n                    CreateInnerHashSet().Forget();\n                }\n                else\n                {\n                    SourceMoveNext();\n                }\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            async UniTaskVoid CreateInnerHashSet()\n            {\n                try\n                {\n                    lookup = await inner.ToLookupAwaitAsync(innerKeySelector, comparer, cancellationToken);\n                    enumerator = outer.GetAsyncEnumerator(cancellationToken);\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n                SourceMoveNext();\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    LOOP:\n                    if (valueEnumerator != null)\n                    {\n                        if (valueEnumerator.MoveNext())\n                        {\n                            resultAwaiter = resultSelector(currentOuterValue, valueEnumerator.Current).GetAwaiter();\n                            if (resultAwaiter.IsCompleted)\n                            {\n                                ResultSelectCore(this);\n                            }\n                            else\n                            {\n                                resultAwaiter.SourceOnCompleted(ResultSelectCoreDelegate, this);\n                            }\n                            return;\n                        }\n                        else\n                        {\n                            valueEnumerator.Dispose();\n                            valueEnumerator = null;\n                        }\n                    }\n\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        continueNext = true;\n                        MoveNextCore(this);\n                        if (continueNext)\n                        {\n                            continueNext = false;\n                            goto LOOP; // avoid recursive\n                        }\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                }\n            }\n\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_JoinAwait)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        self.currentOuterValue = self.enumerator.Current;\n\n                        self.outerKeyAwaiter = self.outerKeySelector(self.currentOuterValue).GetAwaiter();\n\n                        if (self.outerKeyAwaiter.IsCompleted)\n                        {\n                            OuterSelectCore(self);\n                        }\n                        else\n                        {\n                            self.continueNext = false;\n                            self.outerKeyAwaiter.SourceOnCompleted(OuterSelectCoreDelegate, self);\n                        }\n                    }\n                    else\n                    {\n                        self.continueNext = false;\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n                else\n                {\n                    self.continueNext = false;\n                }\n            }\n\n            static void OuterSelectCore(object state)\n            {\n                var self = (_JoinAwait)state;\n\n                if (self.TryGetResult(self.outerKeyAwaiter, out var key))\n                {\n                    self.valueEnumerator = self.lookup[key].GetEnumerator();\n\n                    if (self.continueNext)\n                    {\n                        return;\n                    }\n                    else\n                    {\n                        self.SourceMoveNext();\n                    }\n                }\n                else\n                {\n                    self.continueNext = false;\n                }\n            }\n\n            static void ResultSelectCore(object state)\n            {\n                var self = (_JoinAwait)state;\n\n                if (self.TryGetResult(self.resultAwaiter, out var result))\n                {\n                    self.Current = result;\n                    self.completionSource.TrySetResult(true);\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (valueEnumerator != null)\n                {\n                    valueEnumerator.Dispose();\n                }\n\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n\n                return default;\n            }\n        }\n    }\n\n    internal sealed class JoinAwaitWithCancellation<TOuter, TInner, TKey, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TOuter> outer;\n        readonly IUniTaskAsyncEnumerable<TInner> inner;\n        readonly Func<TOuter, CancellationToken, UniTask<TKey>> outerKeySelector;\n        readonly Func<TInner, CancellationToken, UniTask<TKey>> innerKeySelector;\n        readonly Func<TOuter, TInner, CancellationToken, UniTask<TResult>> resultSelector;\n        readonly IEqualityComparer<TKey> comparer;\n\n        public JoinAwaitWithCancellation(IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, CancellationToken, UniTask<TKey>> outerKeySelector, Func<TInner, CancellationToken, UniTask<TKey>> innerKeySelector, Func<TOuter, TInner, CancellationToken, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer)\n        {\n            this.outer = outer;\n            this.inner = inner;\n            this.outerKeySelector = outerKeySelector;\n            this.innerKeySelector = innerKeySelector;\n            this.resultSelector = resultSelector;\n            this.comparer = comparer;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _JoinAwaitWithCancellation(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer, cancellationToken);\n        }\n\n        sealed class _JoinAwaitWithCancellation : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n            static readonly Action<object> OuterSelectCoreDelegate = OuterSelectCore;\n            static readonly Action<object> ResultSelectCoreDelegate = ResultSelectCore;\n\n            readonly IUniTaskAsyncEnumerable<TOuter> outer;\n            readonly IUniTaskAsyncEnumerable<TInner> inner;\n            readonly Func<TOuter, CancellationToken, UniTask<TKey>> outerKeySelector;\n            readonly Func<TInner, CancellationToken, UniTask<TKey>> innerKeySelector;\n            readonly Func<TOuter, TInner, CancellationToken, UniTask<TResult>> resultSelector;\n            readonly IEqualityComparer<TKey> comparer;\n            CancellationToken cancellationToken;\n\n            ILookup<TKey, TInner> lookup;\n            IUniTaskAsyncEnumerator<TOuter> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            TOuter currentOuterValue;\n            IEnumerator<TInner> valueEnumerator;\n\n            UniTask<TResult>.Awaiter resultAwaiter;\n            UniTask<TKey>.Awaiter outerKeyAwaiter;\n\n            bool continueNext;\n\n            public _JoinAwaitWithCancellation(IUniTaskAsyncEnumerable<TOuter> outer, IUniTaskAsyncEnumerable<TInner> inner, Func<TOuter, CancellationToken, UniTask<TKey>> outerKeySelector, Func<TInner, CancellationToken, UniTask<TKey>> innerKeySelector, Func<TOuter, TInner, CancellationToken, UniTask<TResult>> resultSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n            {\n                this.outer = outer;\n                this.inner = inner;\n                this.outerKeySelector = outerKeySelector;\n                this.innerKeySelector = innerKeySelector;\n                this.resultSelector = resultSelector;\n                this.comparer = comparer;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                if (lookup == null)\n                {\n                    CreateInnerHashSet().Forget();\n                }\n                else\n                {\n                    SourceMoveNext();\n                }\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            async UniTaskVoid CreateInnerHashSet()\n            {\n                try\n                {\n                    lookup = await inner.ToLookupAwaitWithCancellationAsync(innerKeySelector, comparer, cancellationToken: cancellationToken);\n                    enumerator = outer.GetAsyncEnumerator(cancellationToken);\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n                SourceMoveNext();\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    LOOP:\n                    if (valueEnumerator != null)\n                    {\n                        if (valueEnumerator.MoveNext())\n                        {\n                            resultAwaiter = resultSelector(currentOuterValue, valueEnumerator.Current, cancellationToken).GetAwaiter();\n                            if (resultAwaiter.IsCompleted)\n                            {\n                                ResultSelectCore(this);\n                            }\n                            else\n                            {\n                                resultAwaiter.SourceOnCompleted(ResultSelectCoreDelegate, this);\n                            }\n                            return;\n                        }\n                        else\n                        {\n                            valueEnumerator.Dispose();\n                            valueEnumerator = null;\n                        }\n                    }\n\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        continueNext = true;\n                        MoveNextCore(this);\n                        if (continueNext)\n                        {\n                            continueNext = false;\n                            goto LOOP; // avoid recursive\n                        }\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                }\n            }\n\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_JoinAwaitWithCancellation)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        self.currentOuterValue = self.enumerator.Current;\n\n                        self.outerKeyAwaiter = self.outerKeySelector(self.currentOuterValue, self.cancellationToken).GetAwaiter();\n\n                        if (self.outerKeyAwaiter.IsCompleted)\n                        {\n                            OuterSelectCore(self);\n                        }\n                        else\n                        {\n                            self.continueNext = false;\n                            self.outerKeyAwaiter.SourceOnCompleted(OuterSelectCoreDelegate, self);\n                        }\n                    }\n                    else\n                    {\n                        self.continueNext = false;\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n                else\n                {\n                    self.continueNext = false;\n                }\n            }\n\n            static void OuterSelectCore(object state)\n            {\n                var self = (_JoinAwaitWithCancellation)state;\n\n                if (self.TryGetResult(self.outerKeyAwaiter, out var key))\n                {\n                    self.valueEnumerator = self.lookup[key].GetEnumerator();\n\n                    if (self.continueNext)\n                    {\n                        return;\n                    }\n                    else\n                    {\n                        self.SourceMoveNext();\n                    }\n                }\n                else\n                {\n                    self.continueNext = false;\n                }\n            }\n\n            static void ResultSelectCore(object state)\n            {\n                var self = (_JoinAwaitWithCancellation)state;\n\n                if (self.TryGetResult(self.resultAwaiter, out var result))\n                {\n                    self.Current = result;\n                    self.completionSource.TrySetResult(true);\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (valueEnumerator != null)\n                {\n                    valueEnumerator.Dispose();\n                }\n\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n\n                return default;\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Join.cs.meta",
    "content": "fileFormatVersion: 2\nguid: dc4ff8cb6d7c9a64896f2f082124d6b3\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Last.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<TSource> LastAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Last.LastAsync(source, cancellationToken, false);\n        }\n\n        public static UniTask<TSource> LastAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return Last.LastAsync(source, predicate, cancellationToken, false);\n        }\n\n        public static UniTask<TSource> LastAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return Last.LastAwaitAsync(source, predicate, cancellationToken, false);\n        }\n\n        public static UniTask<TSource> LastAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return Last.LastAwaitWithCancellationAsync(source, predicate, cancellationToken, false);\n        }\n\n        public static UniTask<TSource> LastOrDefaultAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Last.LastAsync(source, cancellationToken, true);\n        }\n\n        public static UniTask<TSource> LastOrDefaultAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return Last.LastAsync(source, predicate, cancellationToken, true);\n        }\n\n        public static UniTask<TSource> LastOrDefaultAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return Last.LastAwaitAsync(source, predicate, cancellationToken, true);\n        }\n\n        public static UniTask<TSource> LastOrDefaultAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return Last.LastAwaitWithCancellationAsync(source, predicate, cancellationToken, true);\n        }\n    }\n\n    internal static class Last\n    {\n        public static async UniTask<TSource> LastAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken, bool defaultIfEmpty)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                TSource value = default;\n                if (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                }\n                else\n                {\n                    if (defaultIfEmpty)\n                    {\n                        return value;\n                    }\n                    else\n                    {\n                        throw Error.NoElements();\n                    }\n                }\n\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                }\n                return value;\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTask<TSource> LastAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate, CancellationToken cancellationToken, bool defaultIfEmpty)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                TSource value = default;\n\n                bool found = false;\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    if (predicate(v))\n                    {\n                        found = true;\n                        value = v;\n                    }\n                }\n\n                if (defaultIfEmpty)\n                {\n                    return value;\n                }\n                else\n                {\n                    if (found)\n                    {\n                        return value;\n                    }\n                    else\n                    {\n                        throw Error.NoElements();\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTask<TSource> LastAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate, CancellationToken cancellationToken, bool defaultIfEmpty)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                TSource value = default;\n\n                bool found = false;\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    if (await predicate(v))\n                    {\n                        found = true;\n                        value = v;\n                    }\n                }\n\n                if (defaultIfEmpty)\n                {\n                    return value;\n                }\n                else\n                {\n                    if (found)\n                    {\n                        return value;\n                    }\n                    else\n                    {\n                        throw Error.NoElements();\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTask<TSource> LastAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate, CancellationToken cancellationToken, bool defaultIfEmpty)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                TSource value = default;\n\n                bool found = false;\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    if (await predicate(v, cancellationToken))\n                    {\n                        found = true;\n                        value = v;\n                    }\n                }\n\n                if (defaultIfEmpty)\n                {\n                    return value;\n                }\n                else\n                {\n                    if (found)\n                    {\n                        return value;\n                    }\n                    else\n                    {\n                        throw Error.NoElements();\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Last.cs.meta",
    "content": "fileFormatVersion: 2\nguid: a0ccc93be1387fa4a975f06310127c11\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/LongCount.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<long> LongCountAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return LongCount.LongCountAsync(source, cancellationToken);\n        }\n\n        public static UniTask<long> LongCountAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return LongCount.LongCountAsync(source, predicate, cancellationToken);\n        }\n\n        public static UniTask<long> LongCountAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return LongCount.LongCountAwaitAsync(source, predicate, cancellationToken);\n        }\n\n        public static UniTask<long> LongCountAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return LongCount.LongCountAwaitWithCancellationAsync(source, predicate, cancellationToken);\n        }\n    }\n\n    internal static class LongCount\n    {\n        internal static async UniTask<long> LongCountAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)\n        {\n            long count = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    checked { count++; }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return count;\n        }\n\n        internal static async UniTask<long> LongCountAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate, CancellationToken cancellationToken)\n        {\n            long count = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    if (predicate(e.Current))\n                    {\n                        checked { count++; }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return count;\n        }\n\n        internal static async UniTask<long> LongCountAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate, CancellationToken cancellationToken)\n        {\n            long count = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    if (await predicate(e.Current))\n                    {\n                        checked { count++; }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return count;\n        }\n\n        internal static async UniTask<long> LongCountAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate, CancellationToken cancellationToken)\n        {\n            long count = 0;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    if (await predicate(e.Current, cancellationToken))\n                    {\n                        checked { count++; }\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return count;\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/LongCount.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 198b39e58ced3ab4f97ccbe0916787d5\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Max.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<TSource> MaxAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Max.MaxAsync(source, cancellationToken);\n        }\n\n        public static UniTask<TResult> MaxAsync<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TResult> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<TResult> MaxAwaitAsync<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TResult>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<TResult> MaxAwaitWithCancellationAsync<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TResult>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n    }\n\n    internal static partial class Max\n    {\n        public static async UniTask<TSource> MaxAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)\n        {\n            TSource value = default;\n            var comparer = Comparer<TSource>.Default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n\n                    goto NEXT_LOOP;\n                }\n\n                return value;\n\n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if (comparer.Compare(value, x) < 0)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<TResult> MaxAsync<TSource, TResult>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TResult> selector, CancellationToken cancellationToken)\n        {\n            TResult value = default;\n            var comparer = Comparer<TResult>.Default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n\n                    goto NEXT_LOOP;\n                }\n\n                return value;\n\n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if (comparer.Compare(value, x) < 0)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<TResult> MaxAwaitAsync<TSource, TResult>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TResult>> selector, CancellationToken cancellationToken)\n        {\n            TResult value = default;\n            var comparer = Comparer<TResult>.Default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n\n                    goto NEXT_LOOP;\n                }\n\n                return value;\n\n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if (comparer.Compare(value, x) < 0)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<TResult> MaxAwaitWithCancellationAsync<TSource, TResult>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TResult>> selector, CancellationToken cancellationToken)\n        {\n            TResult value = default;\n            var comparer = Comparer<TResult>.Default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n\n                    goto NEXT_LOOP;\n                }\n\n                return value;\n\n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if (comparer.Compare(value, x) < 0)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Max.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 5c8a118a6b664c441820b8a87d7f6e28\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Merge.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<T> Merge<T>(this IUniTaskAsyncEnumerable<T> first, IUniTaskAsyncEnumerable<T> second)\n        {\n            Error.ThrowArgumentNullException(first, nameof(first));\n            Error.ThrowArgumentNullException(second, nameof(second));\n\n            return new Merge<T>(new [] { first, second });\n        }\n\n        public static IUniTaskAsyncEnumerable<T> Merge<T>(this IUniTaskAsyncEnumerable<T> first, IUniTaskAsyncEnumerable<T> second, IUniTaskAsyncEnumerable<T> third)\n        {\n            Error.ThrowArgumentNullException(first, nameof(first));\n            Error.ThrowArgumentNullException(second, nameof(second));\n            Error.ThrowArgumentNullException(third, nameof(third));\n\n            return new Merge<T>(new[] { first, second, third });\n        }\n\n        public static IUniTaskAsyncEnumerable<T> Merge<T>(this IEnumerable<IUniTaskAsyncEnumerable<T>> sources)\n        {\n            return sources is IUniTaskAsyncEnumerable<T>[] array\n                ? new Merge<T>(array)\n                : new Merge<T>(sources.ToArray());\n        }\n\n        public static IUniTaskAsyncEnumerable<T> Merge<T>(params IUniTaskAsyncEnumerable<T>[] sources)\n        {\n            return new Merge<T>(sources);\n        }\n    }\n\n    internal sealed class Merge<T> : IUniTaskAsyncEnumerable<T>\n    {\n        readonly IUniTaskAsyncEnumerable<T>[] sources;\n\n        public Merge(IUniTaskAsyncEnumerable<T>[] sources)\n        {\n            if (sources.Length <= 0)\n            {\n                Error.ThrowArgumentException(\"No source async enumerable to merge\");\n            }\n            this.sources = sources;\n        }\n\n        public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n            => new _Merge(sources, cancellationToken);\n\n        enum MergeSourceState\n        {\n            Pending,\n            Running,\n            Completed,\n        }\n\n        sealed class _Merge : MoveNextSource, IUniTaskAsyncEnumerator<T>\n        {\n            static readonly Action<object> GetResultAtAction = GetResultAt;\n\n            readonly int length;\n            readonly IUniTaskAsyncEnumerator<T>[] enumerators;\n            readonly MergeSourceState[] states;\n            readonly Queue<(T, Exception, bool)> queuedResult = new Queue<(T, Exception, bool)>();\n            readonly CancellationToken cancellationToken;\n\n            int moveNextCompleted;\n\n            public T Current { get; private set; }\n\n            public _Merge(IUniTaskAsyncEnumerable<T>[] sources, CancellationToken cancellationToken)\n            {\n                this.cancellationToken = cancellationToken;\n                length = sources.Length;\n                states = ArrayPool<MergeSourceState>.Shared.Rent(length);\n                enumerators = ArrayPool<IUniTaskAsyncEnumerator<T>>.Shared.Rent(length);\n                for (var i = 0; i < length; i++)\n                {\n                    enumerators[i] = sources[i].GetAsyncEnumerator(cancellationToken);\n                    states[i] = (int)MergeSourceState.Pending;;\n                }\n            }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                completionSource.Reset();\n                Interlocked.Exchange(ref moveNextCompleted, 0);\n\n                if (HasQueuedResult() && Interlocked.CompareExchange(ref moveNextCompleted, 1, 0) == 0)\n                {\n                    (T, Exception, bool) value;\n                    lock (states)\n                    {\n                        value = queuedResult.Dequeue();\n                    }\n                    var resultValue = value.Item1;\n                    var exception = value.Item2;\n                    var hasNext = value.Item3;\n                    if (exception != null)\n                    {\n                        completionSource.TrySetException(exception);\n                    }\n                    else\n                    {\n                        Current = resultValue;\n                        completionSource.TrySetResult(hasNext);\n                    }\n                    return new UniTask<bool>(this, completionSource.Version);\n                }\n\n                for (var i = 0; i < length; i++)\n                {\n                    lock (states)\n                    {\n                        if (states[i] == MergeSourceState.Pending)\n                        {\n                            states[i] = MergeSourceState.Running;\n                        }\n                        else\n                        {\n                            continue;\n                        }\n                    }\n                    var awaiter = enumerators[i].MoveNextAsync().GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        GetResultAt(i, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(GetResultAtAction, StateTuple.Create(this, i, awaiter));\n                    }\n                }\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                for (var i = 0; i < length; i++)\n                {\n                    await enumerators[i].DisposeAsync();\n                }\n\n                ArrayPool<MergeSourceState>.Shared.Return(states, true);\n                ArrayPool<IUniTaskAsyncEnumerator<T>>.Shared.Return(enumerators, true);\n            }\n\n            static void GetResultAt(object state)\n            {\n                using (var tuple = (StateTuple<_Merge, int, UniTask<bool>.Awaiter>)state)\n                {\n                    tuple.Item1.GetResultAt(tuple.Item2, tuple.Item3);\n                }\n            }\n\n            void GetResultAt(int index, UniTask<bool>.Awaiter awaiter)\n            {\n                bool hasNext;\n                bool completedAll;\n                try\n                {\n                    hasNext = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    if (Interlocked.CompareExchange(ref moveNextCompleted, 1, 0) == 0)\n                    {\n                        completionSource.TrySetException(ex);\n                    }\n                    else\n                    {\n                        lock (states)\n                        {\n                            queuedResult.Enqueue((default, ex, default));\n                        }\n                    }\n                    return;\n                }\n\n                lock (states)\n                {\n                    states[index] = hasNext ? MergeSourceState.Pending : MergeSourceState.Completed;\n                    completedAll = !hasNext && IsCompletedAll();\n                }\n                if (hasNext || completedAll)\n                {\n                    if (Interlocked.CompareExchange(ref moveNextCompleted, 1, 0) == 0)\n                    {\n                        Current = enumerators[index].Current;\n                        completionSource.TrySetResult(!completedAll);\n                    }\n                    else\n                    {\n                        lock (states)\n                        {\n                            queuedResult.Enqueue((enumerators[index].Current, null, !completedAll));\n                        }\n                    }\n                }\n            }\n\n            bool HasQueuedResult()\n            {\n                lock (states)\n                {\n                    return queuedResult.Count > 0;\n                }\n            }\n\n            bool IsCompletedAll()\n            {\n                lock (states)\n                {\n                    for (var i = 0; i < length; i++)\n                    {\n                        if (states[i] != MergeSourceState.Completed)\n                        {\n                            return false;\n                        }\n                    }\n                }\n                return true;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Merge.cs.meta",
    "content": "fileFormatVersion: 2\nguid: ca56812f160c45d0bacb4339819edf1a\ntimeCreated: 1694133666"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Min.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<TSource> MinAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Min.MinAsync(source, cancellationToken);\n        }\n\n        public static UniTask<TResult> MinAsync<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TResult> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<TResult> MinAwaitAsync<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TResult>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<TResult> MinAwaitWithCancellationAsync<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TResult>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n    }\n\n    internal static partial class Min\n    {\n        public static async UniTask<TSource> MinAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)\n        {\n            TSource value = default;\n            var comparer = Comparer<TSource>.Default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n\n                    goto NEXT_LOOP;\n                }\n\n                return value;\n\n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if (comparer.Compare(value, x) > 0)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<TResult> MinAsync<TSource, TResult>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TResult> selector, CancellationToken cancellationToken)\n        {\n            TResult value = default;\n            var comparer = Comparer<TResult>.Default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n\n                    goto NEXT_LOOP;\n                }\n\n                return value;\n\n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if (comparer.Compare(value, x) > 0)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<TResult> MinAwaitAsync<TSource, TResult>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TResult>> selector, CancellationToken cancellationToken)\n        {\n            TResult value = default;\n            var comparer = Comparer<TResult>.Default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n\n                    goto NEXT_LOOP;\n                }\n\n                return value;\n\n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if (comparer.Compare(value, x) > 0)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<TResult> MinAwaitWithCancellationAsync<TSource, TResult>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TResult>> selector, CancellationToken cancellationToken)\n        {\n            TResult value = default;\n            var comparer = Comparer<TResult>.Default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n\n                    goto NEXT_LOOP;\n                }\n\n                return value;\n\n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if (comparer.Compare(value, x) > 0)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Min.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 57ac9da21d3457849a8e45548290a508\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/MinMax.cs",
    "content": "﻿using System;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<Int32> MinAsync(this IUniTaskAsyncEnumerable<Int32> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Min.MinAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Int32> MinAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int32> MinAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int32>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int32> MinAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int32>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64> MinAsync(this IUniTaskAsyncEnumerable<Int64> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Min.MinAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Int64> MinAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int64> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64> MinAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int64>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64> MinAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int64>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single> MinAsync(this IUniTaskAsyncEnumerable<Single> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Min.MinAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Single> MinAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Single> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single> MinAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Single>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single> MinAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Single>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double> MinAsync(this IUniTaskAsyncEnumerable<Double> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Min.MinAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Double> MinAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Double> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double> MinAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Double>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double> MinAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Double>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal> MinAsync(this IUniTaskAsyncEnumerable<Decimal> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Min.MinAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Decimal> MinAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Decimal> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal> MinAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Decimal>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal> MinAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Decimal>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int32?> MinAsync(this IUniTaskAsyncEnumerable<Int32?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Min.MinAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Int32?> MinAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int32?> MinAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int32?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int32?> MinAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int32?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64?> MinAsync(this IUniTaskAsyncEnumerable<Int64?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Min.MinAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Int64?> MinAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int64?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64?> MinAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int64?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64?> MinAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int64?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single?> MinAsync(this IUniTaskAsyncEnumerable<Single?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Min.MinAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Single?> MinAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Single?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single?> MinAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Single?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single?> MinAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Single?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double?> MinAsync(this IUniTaskAsyncEnumerable<Double?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Min.MinAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Double?> MinAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Double?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double?> MinAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Double?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double?> MinAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Double?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal?> MinAsync(this IUniTaskAsyncEnumerable<Decimal?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Min.MinAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Decimal?> MinAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Decimal?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal?> MinAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Decimal?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal?> MinAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Decimal?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Min.MinAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n    }\n\n    internal static partial class Min\n    {\n        public static async UniTask<Int32> MinAsync(IUniTaskAsyncEnumerable<Int32> source, CancellationToken cancellationToken)\n        {\n            Int32 value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int32> MinAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32> selector, CancellationToken cancellationToken)\n        {\n            Int32 value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int32> MinAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int32>> selector, CancellationToken cancellationToken)\n        {\n            Int32 value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int32> MinAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int32>> selector, CancellationToken cancellationToken)\n        {\n            Int32 value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int64> MinAsync(IUniTaskAsyncEnumerable<Int64> source, CancellationToken cancellationToken)\n        {\n            Int64 value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int64> MinAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int64> selector, CancellationToken cancellationToken)\n        {\n            Int64 value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int64> MinAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int64>> selector, CancellationToken cancellationToken)\n        {\n            Int64 value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int64> MinAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int64>> selector, CancellationToken cancellationToken)\n        {\n            Int64 value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Single> MinAsync(IUniTaskAsyncEnumerable<Single> source, CancellationToken cancellationToken)\n        {\n            Single value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Single> MinAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Single> selector, CancellationToken cancellationToken)\n        {\n            Single value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Single> MinAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Single>> selector, CancellationToken cancellationToken)\n        {\n            Single value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Single> MinAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Single>> selector, CancellationToken cancellationToken)\n        {\n            Single value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Double> MinAsync(IUniTaskAsyncEnumerable<Double> source, CancellationToken cancellationToken)\n        {\n            Double value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Double> MinAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Double> selector, CancellationToken cancellationToken)\n        {\n            Double value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Double> MinAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Double>> selector, CancellationToken cancellationToken)\n        {\n            Double value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Double> MinAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Double>> selector, CancellationToken cancellationToken)\n        {\n            Double value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Decimal> MinAsync(IUniTaskAsyncEnumerable<Decimal> source, CancellationToken cancellationToken)\n        {\n            Decimal value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Decimal> MinAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Decimal> selector, CancellationToken cancellationToken)\n        {\n            Decimal value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Decimal> MinAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Decimal>> selector, CancellationToken cancellationToken)\n        {\n            Decimal value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Decimal> MinAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Decimal>> selector, CancellationToken cancellationToken)\n        {\n            Decimal value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int32?> MinAsync(IUniTaskAsyncEnumerable<Int32?> source, CancellationToken cancellationToken)\n        {\n            Int32? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int32?> MinAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32?> selector, CancellationToken cancellationToken)\n        {\n            Int32? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int32?> MinAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int32?>> selector, CancellationToken cancellationToken)\n        {\n            Int32? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int32?> MinAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int32?>> selector, CancellationToken cancellationToken)\n        {\n            Int32? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int64?> MinAsync(IUniTaskAsyncEnumerable<Int64?> source, CancellationToken cancellationToken)\n        {\n            Int64? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int64?> MinAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int64?> selector, CancellationToken cancellationToken)\n        {\n            Int64? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int64?> MinAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int64?>> selector, CancellationToken cancellationToken)\n        {\n            Int64? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int64?> MinAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int64?>> selector, CancellationToken cancellationToken)\n        {\n            Int64? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Single?> MinAsync(IUniTaskAsyncEnumerable<Single?> source, CancellationToken cancellationToken)\n        {\n            Single? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Single?> MinAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Single?> selector, CancellationToken cancellationToken)\n        {\n            Single? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Single?> MinAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Single?>> selector, CancellationToken cancellationToken)\n        {\n            Single? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Single?> MinAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Single?>> selector, CancellationToken cancellationToken)\n        {\n            Single? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Double?> MinAsync(IUniTaskAsyncEnumerable<Double?> source, CancellationToken cancellationToken)\n        {\n            Double? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Double?> MinAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Double?> selector, CancellationToken cancellationToken)\n        {\n            Double? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Double?> MinAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Double?>> selector, CancellationToken cancellationToken)\n        {\n            Double? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Double?> MinAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Double?>> selector, CancellationToken cancellationToken)\n        {\n            Double? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Decimal?> MinAsync(IUniTaskAsyncEnumerable<Decimal?> source, CancellationToken cancellationToken)\n        {\n            Decimal? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Decimal?> MinAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Decimal?> selector, CancellationToken cancellationToken)\n        {\n            Decimal? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Decimal?> MinAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Decimal?>> selector, CancellationToken cancellationToken)\n        {\n            Decimal? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Decimal?> MinAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Decimal?>> selector, CancellationToken cancellationToken)\n        {\n            Decimal? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if( x == null) continue;\n                    if (value > x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n    }\n\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<Int32> MaxAsync(this IUniTaskAsyncEnumerable<Int32> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Max.MaxAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Int32> MaxAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int32> MaxAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int32>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int32> MaxAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int32>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64> MaxAsync(this IUniTaskAsyncEnumerable<Int64> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Max.MaxAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Int64> MaxAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int64> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64> MaxAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int64>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64> MaxAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int64>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single> MaxAsync(this IUniTaskAsyncEnumerable<Single> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Max.MaxAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Single> MaxAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Single> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single> MaxAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Single>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single> MaxAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Single>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double> MaxAsync(this IUniTaskAsyncEnumerable<Double> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Max.MaxAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Double> MaxAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Double> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double> MaxAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Double>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double> MaxAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Double>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal> MaxAsync(this IUniTaskAsyncEnumerable<Decimal> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Max.MaxAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Decimal> MaxAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Decimal> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal> MaxAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Decimal>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal> MaxAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Decimal>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int32?> MaxAsync(this IUniTaskAsyncEnumerable<Int32?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Max.MaxAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Int32?> MaxAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int32?> MaxAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int32?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int32?> MaxAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int32?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64?> MaxAsync(this IUniTaskAsyncEnumerable<Int64?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Max.MaxAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Int64?> MaxAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int64?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64?> MaxAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int64?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64?> MaxAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int64?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single?> MaxAsync(this IUniTaskAsyncEnumerable<Single?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Max.MaxAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Single?> MaxAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Single?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single?> MaxAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Single?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single?> MaxAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Single?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double?> MaxAsync(this IUniTaskAsyncEnumerable<Double?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Max.MaxAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Double?> MaxAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Double?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double?> MaxAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Double?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double?> MaxAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Double?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal?> MaxAsync(this IUniTaskAsyncEnumerable<Decimal?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Max.MaxAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Decimal?> MaxAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Decimal?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal?> MaxAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Decimal?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal?> MaxAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Decimal?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Max.MaxAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n    }\n\n    internal static partial class Max\n    {\n        public static async UniTask<Int32> MaxAsync(IUniTaskAsyncEnumerable<Int32> source, CancellationToken cancellationToken)\n        {\n            Int32 value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int32> MaxAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32> selector, CancellationToken cancellationToken)\n        {\n            Int32 value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int32> MaxAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int32>> selector, CancellationToken cancellationToken)\n        {\n            Int32 value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int32> MaxAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int32>> selector, CancellationToken cancellationToken)\n        {\n            Int32 value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int64> MaxAsync(IUniTaskAsyncEnumerable<Int64> source, CancellationToken cancellationToken)\n        {\n            Int64 value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int64> MaxAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int64> selector, CancellationToken cancellationToken)\n        {\n            Int64 value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int64> MaxAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int64>> selector, CancellationToken cancellationToken)\n        {\n            Int64 value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int64> MaxAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int64>> selector, CancellationToken cancellationToken)\n        {\n            Int64 value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Single> MaxAsync(IUniTaskAsyncEnumerable<Single> source, CancellationToken cancellationToken)\n        {\n            Single value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Single> MaxAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Single> selector, CancellationToken cancellationToken)\n        {\n            Single value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Single> MaxAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Single>> selector, CancellationToken cancellationToken)\n        {\n            Single value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Single> MaxAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Single>> selector, CancellationToken cancellationToken)\n        {\n            Single value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Double> MaxAsync(IUniTaskAsyncEnumerable<Double> source, CancellationToken cancellationToken)\n        {\n            Double value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Double> MaxAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Double> selector, CancellationToken cancellationToken)\n        {\n            Double value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Double> MaxAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Double>> selector, CancellationToken cancellationToken)\n        {\n            Double value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Double> MaxAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Double>> selector, CancellationToken cancellationToken)\n        {\n            Double value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Decimal> MaxAsync(IUniTaskAsyncEnumerable<Decimal> source, CancellationToken cancellationToken)\n        {\n            Decimal value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Decimal> MaxAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Decimal> selector, CancellationToken cancellationToken)\n        {\n            Decimal value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Decimal> MaxAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Decimal>> selector, CancellationToken cancellationToken)\n        {\n            Decimal value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Decimal> MaxAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Decimal>> selector, CancellationToken cancellationToken)\n        {\n            Decimal value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                \n                    goto NEXT_LOOP;\n                }\n\n                throw Error.NoElements();\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int32?> MaxAsync(IUniTaskAsyncEnumerable<Int32?> source, CancellationToken cancellationToken)\n        {\n            Int32? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int32?> MaxAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32?> selector, CancellationToken cancellationToken)\n        {\n            Int32? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int32?> MaxAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int32?>> selector, CancellationToken cancellationToken)\n        {\n            Int32? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int32?> MaxAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int32?>> selector, CancellationToken cancellationToken)\n        {\n            Int32? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int64?> MaxAsync(IUniTaskAsyncEnumerable<Int64?> source, CancellationToken cancellationToken)\n        {\n            Int64? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int64?> MaxAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int64?> selector, CancellationToken cancellationToken)\n        {\n            Int64? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int64?> MaxAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int64?>> selector, CancellationToken cancellationToken)\n        {\n            Int64? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Int64?> MaxAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int64?>> selector, CancellationToken cancellationToken)\n        {\n            Int64? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Single?> MaxAsync(IUniTaskAsyncEnumerable<Single?> source, CancellationToken cancellationToken)\n        {\n            Single? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Single?> MaxAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Single?> selector, CancellationToken cancellationToken)\n        {\n            Single? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Single?> MaxAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Single?>> selector, CancellationToken cancellationToken)\n        {\n            Single? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Single?> MaxAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Single?>> selector, CancellationToken cancellationToken)\n        {\n            Single? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Double?> MaxAsync(IUniTaskAsyncEnumerable<Double?> source, CancellationToken cancellationToken)\n        {\n            Double? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Double?> MaxAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Double?> selector, CancellationToken cancellationToken)\n        {\n            Double? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Double?> MaxAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Double?>> selector, CancellationToken cancellationToken)\n        {\n            Double? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Double?> MaxAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Double?>> selector, CancellationToken cancellationToken)\n        {\n            Double? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Decimal?> MaxAsync(IUniTaskAsyncEnumerable<Decimal?> source, CancellationToken cancellationToken)\n        {\n            Decimal? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Decimal?> MaxAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Decimal?> selector, CancellationToken cancellationToken)\n        {\n            Decimal? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Decimal?> MaxAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Decimal?>> selector, CancellationToken cancellationToken)\n        {\n            Decimal? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<Decimal?> MaxAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Decimal?>> selector, CancellationToken cancellationToken)\n        {\n            Decimal? value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n                    if(value == null) continue;\n                \n                    goto NEXT_LOOP;\n                }\n\n                return default;\n                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n                    if( x == null) continue;\n                    if (value < x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/MinMax.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 2d6da02d9ab970e4999daf7147d98e36\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/MinMax.tt",
    "content": "﻿<#@ template debug=\"false\" hostspecific=\"false\" language=\"C#\" #>\n<#@ assembly name=\"System.Core\" #>\n<#@ import namespace=\"System.Linq\" #>\n<#@ import namespace=\"System.Text\" #>\n<#@ import namespace=\"System.Collections.Generic\" #>\n<#@ output extension=\".cs\" #>\n<#\n    var types = new[]\n    {\n        typeof(int),\n        typeof(long),\n        typeof(float),\n        typeof(double),\n        typeof(decimal),\n        \n        typeof(int?),\n        typeof(long?),\n        typeof(float?),\n        typeof(double?),\n        typeof(decimal?),\n    };\n\n    Func<Type, bool> IsNullable = x => x.IsGenericType;\n    Func<Type, string> TypeName = x => IsNullable(x) ? x.GetGenericArguments()[0].Name + \"?\" : x.Name;\n    Func<Type, string> WithSuffix = x => IsNullable(x) ? \".GetValueOrDefault()\" : \"\";\n#>\nusing System;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n<# foreach(var (minMax, op) in new[]{(\"Min\",\">\"), (\"Max\", \"<\")}) { #>\n    public static partial class UniTaskAsyncEnumerable\n    {\n<# foreach(var t in types) { #>\n        public static UniTask<<#= TypeName(t) #>> <#= minMax #>Async(this IUniTaskAsyncEnumerable<<#= TypeName(t) #>> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return <#= minMax #>.<#= minMax #>Async(source, cancellationToken);\n        }\n\n        public static UniTask<<#= TypeName(t) #>> <#= minMax #>Async<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, <#= TypeName(t) #>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return <#= minMax #>.<#= minMax #>Async(source, selector, cancellationToken);\n        }\n\n        public static UniTask<<#= TypeName(t) #>> <#= minMax #>AwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<<#= TypeName(t) #>>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return <#= minMax #>.<#= minMax #>AwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<<#= TypeName(t) #>> <#= minMax #>AwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<<#= TypeName(t) #>>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return <#= minMax #>.<#= minMax #>AwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n<# } #>\n    }\n\n    internal static partial class <#= minMax #>\n    {\n<# foreach(var t in types) { #>\n        public static async UniTask<<#= TypeName(t) #>> <#= minMax #>Async(IUniTaskAsyncEnumerable<<#= TypeName(t) #>> source, CancellationToken cancellationToken)\n        {\n            <#= TypeName(t) #> value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = e.Current;\n<# if (IsNullable(t)) { #>\n                    if(value == null) continue;\n<# } #>                \n                    goto NEXT_LOOP;\n                }\n\n<# if (IsNullable(t)) { #>\n                return default;\n<# } else { #>\n                throw Error.NoElements();\n<# } #>                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = e.Current;\n<# if (IsNullable(t)) { #>\n                    if( x == null) continue;\n<# } #>\n                    if (value <#= op #> x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<<#= TypeName(t) #>> <#= minMax #>Async<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, <#= TypeName(t) #>> selector, CancellationToken cancellationToken)\n        {\n            <#= TypeName(t) #> value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = selector(e.Current);\n<# if (IsNullable(t)) { #>\n                    if(value == null) continue;\n<# } #>                \n                    goto NEXT_LOOP;\n                }\n\n<# if (IsNullable(t)) { #>\n                return default;\n<# } else { #>\n                throw Error.NoElements();\n<# } #>                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = selector(e.Current);\n<# if (IsNullable(t)) { #>\n                    if( x == null) continue;\n<# } #>\n                    if (value <#= op #> x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<<#= TypeName(t) #>> <#= minMax #>AwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<<#= TypeName(t) #>>> selector, CancellationToken cancellationToken)\n        {\n            <#= TypeName(t) #> value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current);\n<# if (IsNullable(t)) { #>\n                    if(value == null) continue;\n<# } #>                \n                    goto NEXT_LOOP;\n                }\n\n<# if (IsNullable(t)) { #>\n                return default;\n<# } else { #>\n                throw Error.NoElements();\n<# } #>                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current);\n<# if (IsNullable(t)) { #>\n                    if( x == null) continue;\n<# } #>\n                    if (value <#= op #> x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n        public static async UniTask<<#= TypeName(t) #>> <#= minMax #>AwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<<#= TypeName(t) #>>> selector, CancellationToken cancellationToken)\n        {\n            <#= TypeName(t) #> value = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    value = await selector(e.Current, cancellationToken);\n<# if (IsNullable(t)) { #>\n                    if(value == null) continue;\n<# } #>                \n                    goto NEXT_LOOP;\n                }\n\n<# if (IsNullable(t)) { #>\n                return default;\n<# } else { #>\n                throw Error.NoElements();\n<# } #>                \n                NEXT_LOOP:\n\n                while (await e.MoveNextAsync())\n                {\n                    var x = await selector(e.Current, cancellationToken);\n<# if (IsNullable(t)) { #>\n                    if( x == null) continue;\n<# } #>\n                    if (value <#= op #> x)\n                    {\n                        value = x;\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return value;\n        }\n\n<# } #>\n    }\n\n<# } #>\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/MinMax.tt.meta",
    "content": "fileFormatVersion: 2\nguid: 18108e9feb2ec40498df573cfef2ea15\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Never.cs",
    "content": "﻿using System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<T> Never<T>()\n        {\n            return Cysharp.Threading.Tasks.Linq.Never<T>.Instance;\n        }\n    }\n\n    internal class Never<T> : IUniTaskAsyncEnumerable<T>\n    {\n        public static readonly IUniTaskAsyncEnumerable<T> Instance = new Never<T>();\n\n        Never()\n        {\n        }\n\n        public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Never(cancellationToken);\n        }\n\n        class _Never : IUniTaskAsyncEnumerator<T>\n        {\n            CancellationToken cancellationToken;\n\n            public _Never(CancellationToken cancellationToken)\n            {\n                this.cancellationToken = cancellationToken;\n            }\n\n            public T Current => default;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                var tcs = new UniTaskCompletionSource<bool>();\n\n                cancellationToken.Register(state =>\n                {\n                    var task = (UniTaskCompletionSource<bool>)state;\n                    task.TrySetCanceled(cancellationToken);\n                }, tcs);\n\n                return tcs.Task;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Never.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 8b307c3d3be71a94da251564bcdefa3d\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/OfType.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TResult> OfType<TResult>(this IUniTaskAsyncEnumerable<Object> source)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new OfType<TResult>(source);\n        }\n    }\n\n    internal sealed class OfType<TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<object> source;\n\n        public OfType(IUniTaskAsyncEnumerable<object> source)\n        {\n            this.source = source;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _OfType(source, cancellationToken);\n        }\n\n        class _OfType : AsyncEnumeratorBase<object, TResult>\n        {\n            public _OfType(IUniTaskAsyncEnumerable<object> source, CancellationToken cancellationToken)\n\n                : base(source, cancellationToken)\n            {\n            }\n\n            protected override bool TryMoveNextCore(bool sourceHasCurrent, out bool result)\n            {\n                if (sourceHasCurrent)\n                {\n                    if (SourceCurrent is TResult castCurent)\n                    {\n                        Current = castCurent;\n                        result = true;\n                        return true;\n                    }\n                    else\n                    {\n                        result = default;\n                        return false;\n                    }\n                }\n\n                result = false;\n                return true;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/OfType.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 111ffe87a7d700442a9ef5af554b252c\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/OrderBy.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        #region OrderBy_OrderByDescending\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> OrderBy<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return new OrderedAsyncEnumerable<TSource, TKey>(source, keySelector, Comparer<TKey>.Default, false, null);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> OrderBy<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new OrderedAsyncEnumerable<TSource, TKey>(source, keySelector, comparer, false, null);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> OrderByAwait<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return new OrderedAsyncEnumerableAwait<TSource, TKey>(source, keySelector, Comparer<TKey>.Default, false, null);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> OrderByAwait<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, IComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new OrderedAsyncEnumerableAwait<TSource, TKey>(source, keySelector, comparer, false, null);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> OrderByAwaitWithCancellation<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return new OrderedAsyncEnumerableAwaitWithCancellation<TSource, TKey>(source, keySelector, Comparer<TKey>.Default, false, null);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> OrderByAwaitWithCancellation<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, IComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new OrderedAsyncEnumerableAwaitWithCancellation<TSource, TKey>(source, keySelector, comparer, false, null);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> OrderByDescending<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return new OrderedAsyncEnumerable<TSource, TKey>(source, keySelector, Comparer<TKey>.Default, true, null);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> OrderByDescending<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new OrderedAsyncEnumerable<TSource, TKey>(source, keySelector, comparer, true, null);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> OrderByDescendingAwait<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return new OrderedAsyncEnumerableAwait<TSource, TKey>(source, keySelector, Comparer<TKey>.Default, true, null);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> OrderByDescendingAwait<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, IComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new OrderedAsyncEnumerableAwait<TSource, TKey>(source, keySelector, comparer, true, null);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> OrderByDescendingAwaitWithCancellation<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return new OrderedAsyncEnumerableAwaitWithCancellation<TSource, TKey>(source, keySelector, Comparer<TKey>.Default, true, null);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> OrderByDescendingAwaitWithCancellation<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, IComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return new OrderedAsyncEnumerableAwaitWithCancellation<TSource, TKey>(source, keySelector, comparer, true, null);\n        }\n\n        #endregion\n\n        #region ThenBy_ThenByDescending\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> ThenBy<TSource, TKey>(this IUniTaskOrderedAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return source.CreateOrderedEnumerable(keySelector, Comparer<TKey>.Default, false);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> ThenBy<TSource, TKey>(this IUniTaskOrderedAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return source.CreateOrderedEnumerable(keySelector, comparer, false);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> ThenByAwait<TSource, TKey>(this IUniTaskOrderedAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return source.CreateOrderedEnumerable(keySelector, Comparer<TKey>.Default, false);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> ThenByAwait<TSource, TKey>(this IUniTaskOrderedAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, IComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return source.CreateOrderedEnumerable(keySelector, comparer, false);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> ThenByAwaitWithCancellation<TSource, TKey>(this IUniTaskOrderedAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return source.CreateOrderedEnumerable(keySelector, Comparer<TKey>.Default, false);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> ThenByAwaitWithCancellation<TSource, TKey>(this IUniTaskOrderedAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, IComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return source.CreateOrderedEnumerable(keySelector, comparer, false);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> ThenByDescending<TSource, TKey>(this IUniTaskOrderedAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return source.CreateOrderedEnumerable(keySelector, Comparer<TKey>.Default, true);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> ThenByDescending<TSource, TKey>(this IUniTaskOrderedAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return source.CreateOrderedEnumerable(keySelector, comparer, true);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> ThenByDescendingAwait<TSource, TKey>(this IUniTaskOrderedAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return source.CreateOrderedEnumerable(keySelector, Comparer<TKey>.Default, true);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> ThenByDescendingAwait<TSource, TKey>(this IUniTaskOrderedAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, IComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return source.CreateOrderedEnumerable(keySelector, comparer, true);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> ThenByDescendingAwaitWithCancellation<TSource, TKey>(this IUniTaskOrderedAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return source.CreateOrderedEnumerable(keySelector, Comparer<TKey>.Default, true);\n        }\n\n        public static IUniTaskOrderedAsyncEnumerable<TSource> ThenByDescendingAwaitWithCancellation<TSource, TKey>(this IUniTaskOrderedAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, IComparer<TKey> comparer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return source.CreateOrderedEnumerable(keySelector, comparer, true);\n        }\n\n        #endregion\n    }\n\n    internal abstract class AsyncEnumerableSorter<TElement>\n    {\n        internal abstract UniTask ComputeKeysAsync(TElement[] elements, int count);\n\n        internal abstract int CompareKeys(int index1, int index2);\n\n        internal async UniTask<int[]> SortAsync(TElement[] elements, int count)\n        {\n            await ComputeKeysAsync(elements, count);\n\n            int[] map = new int[count];\n            for (int i = 0; i < count; i++) map[i] = i;\n            QuickSort(map, 0, count - 1);\n            return map;\n        }\n\n        void QuickSort(int[] map, int left, int right)\n        {\n            do\n            {\n                int i = left;\n                int j = right;\n                int x = map[i + ((j - i) >> 1)];\n                do\n                {\n                    while (i < map.Length && CompareKeys(x, map[i]) > 0) i++;\n                    while (j >= 0 && CompareKeys(x, map[j]) < 0) j--;\n                    if (i > j) break;\n                    if (i < j)\n                    {\n                        int temp = map[i];\n                        map[i] = map[j];\n                        map[j] = temp;\n                    }\n                    i++;\n                    j--;\n                } while (i <= j);\n                if (j - left <= right - i)\n                {\n                    if (left < j) QuickSort(map, left, j);\n                    left = i;\n                }\n                else\n                {\n                    if (i < right) QuickSort(map, i, right);\n                    right = j;\n                }\n            } while (left < right);\n        }\n    }\n\n    internal class SyncSelectorAsyncEnumerableSorter<TElement, TKey> : AsyncEnumerableSorter<TElement>\n    {\n        readonly Func<TElement, TKey> keySelector;\n        readonly IComparer<TKey> comparer;\n        readonly bool descending;\n        readonly AsyncEnumerableSorter<TElement> next;\n        TKey[] keys;\n\n        internal SyncSelectorAsyncEnumerableSorter(Func<TElement, TKey> keySelector, IComparer<TKey> comparer, bool descending, AsyncEnumerableSorter<TElement> next)\n        {\n            this.keySelector = keySelector;\n            this.comparer = comparer;\n            this.descending = descending;\n            this.next = next;\n        }\n\n        internal override async UniTask ComputeKeysAsync(TElement[] elements, int count)\n        {\n            keys = new TKey[count];\n            for (int i = 0; i < count; i++) keys[i] = keySelector(elements[i]);\n            if (next != null) await next.ComputeKeysAsync(elements, count);\n        }\n\n        internal override int CompareKeys(int index1, int index2)\n        {\n            int c = comparer.Compare(keys[index1], keys[index2]);\n            if (c == 0)\n            {\n                if (next == null) return index1 - index2;\n                return next.CompareKeys(index1, index2);\n            }\n            return descending ? -c : c;\n        }\n    }\n\n    internal class AsyncSelectorEnumerableSorter<TElement, TKey> : AsyncEnumerableSorter<TElement>\n    {\n        readonly Func<TElement, UniTask<TKey>> keySelector;\n        readonly IComparer<TKey> comparer;\n        readonly bool descending;\n        readonly AsyncEnumerableSorter<TElement> next;\n        TKey[] keys;\n\n        internal AsyncSelectorEnumerableSorter(Func<TElement, UniTask<TKey>> keySelector, IComparer<TKey> comparer, bool descending, AsyncEnumerableSorter<TElement> next)\n        {\n            this.keySelector = keySelector;\n            this.comparer = comparer;\n            this.descending = descending;\n            this.next = next;\n        }\n\n        internal override async UniTask ComputeKeysAsync(TElement[] elements, int count)\n        {\n            keys = new TKey[count];\n            for (int i = 0; i < count; i++) keys[i] = await keySelector(elements[i]);\n            if (next != null) await next.ComputeKeysAsync(elements, count);\n        }\n\n        internal override int CompareKeys(int index1, int index2)\n        {\n            int c = comparer.Compare(keys[index1], keys[index2]);\n            if (c == 0)\n            {\n                if (next == null) return index1 - index2;\n                return next.CompareKeys(index1, index2);\n            }\n            return descending ? -c : c;\n        }\n    }\n\n    internal class AsyncSelectorWithCancellationEnumerableSorter<TElement, TKey> : AsyncEnumerableSorter<TElement>\n    {\n        readonly Func<TElement, CancellationToken, UniTask<TKey>> keySelector;\n        readonly IComparer<TKey> comparer;\n        readonly bool descending;\n        readonly AsyncEnumerableSorter<TElement> next;\n        CancellationToken cancellationToken;\n        TKey[] keys;\n\n        internal AsyncSelectorWithCancellationEnumerableSorter(Func<TElement, CancellationToken, UniTask<TKey>> keySelector, IComparer<TKey> comparer, bool descending, AsyncEnumerableSorter<TElement> next, CancellationToken cancellationToken)\n        {\n            this.keySelector = keySelector;\n            this.comparer = comparer;\n            this.descending = descending;\n            this.next = next;\n            this.cancellationToken = cancellationToken;\n        }\n\n        internal override async UniTask ComputeKeysAsync(TElement[] elements, int count)\n        {\n            keys = new TKey[count];\n            for (int i = 0; i < count; i++) keys[i] = await keySelector(elements[i], cancellationToken);\n            if (next != null) await next.ComputeKeysAsync(elements, count);\n        }\n\n        internal override int CompareKeys(int index1, int index2)\n        {\n            int c = comparer.Compare(keys[index1], keys[index2]);\n            if (c == 0)\n            {\n                if (next == null) return index1 - index2;\n                return next.CompareKeys(index1, index2);\n            }\n            return descending ? -c : c;\n        }\n    }\n\n    internal abstract class OrderedAsyncEnumerable<TElement> : IUniTaskOrderedAsyncEnumerable<TElement>\n    {\n        protected readonly IUniTaskAsyncEnumerable<TElement> source;\n\n        public OrderedAsyncEnumerable(IUniTaskAsyncEnumerable<TElement> source)\n        {\n            this.source = source;\n        }\n\n        public IUniTaskOrderedAsyncEnumerable<TElement> CreateOrderedEnumerable<TKey>(Func<TElement, TKey> keySelector, IComparer<TKey> comparer, bool descending)\n        {\n            return new OrderedAsyncEnumerable<TElement, TKey>(source, keySelector, comparer, descending, this);\n        }\n\n        public IUniTaskOrderedAsyncEnumerable<TElement> CreateOrderedEnumerable<TKey>(Func<TElement, UniTask<TKey>> keySelector, IComparer<TKey> comparer, bool descending)\n        {\n            return new OrderedAsyncEnumerableAwait<TElement, TKey>(source, keySelector, comparer, descending, this);\n        }\n\n        public IUniTaskOrderedAsyncEnumerable<TElement> CreateOrderedEnumerable<TKey>(Func<TElement, CancellationToken, UniTask<TKey>> keySelector, IComparer<TKey> comparer, bool descending)\n        {\n            return new OrderedAsyncEnumerableAwaitWithCancellation<TElement, TKey>(source, keySelector, comparer, descending, this);\n        }\n\n        internal abstract AsyncEnumerableSorter<TElement> GetAsyncEnumerableSorter(AsyncEnumerableSorter<TElement> next, CancellationToken cancellationToken);\n\n        public IUniTaskAsyncEnumerator<TElement> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _OrderedAsyncEnumerator(this, cancellationToken);\n        }\n\n        class _OrderedAsyncEnumerator : MoveNextSource, IUniTaskAsyncEnumerator<TElement>\n        {\n            protected readonly OrderedAsyncEnumerable<TElement> parent;\n            CancellationToken cancellationToken;\n            TElement[] buffer;\n            int[] map;\n            int index;\n\n            public _OrderedAsyncEnumerator(OrderedAsyncEnumerable<TElement> parent, CancellationToken cancellationToken)\n            {\n                this.parent = parent;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TElement Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                if (map == null)\n                {\n                    completionSource.Reset();\n                    CreateSortSource().Forget();\n                    return new UniTask<bool>(this, completionSource.Version);\n                }\n\n                if (index < buffer.Length)\n                {\n                    Current = buffer[map[index++]];\n                    return CompletedTasks.True;\n                }\n                else\n                {\n                    return CompletedTasks.False;\n                }\n            }\n\n            async UniTaskVoid CreateSortSource()\n            {\n                try\n                {\n                    buffer = await parent.source.ToArrayAsync();\n                    if (buffer.Length == 0)\n                    {\n                        completionSource.TrySetResult(false);\n                        return;\n                    }\n\n                    var sorter = parent.GetAsyncEnumerableSorter(null, cancellationToken);\n                    map = await sorter.SortAsync(buffer, buffer.Length);\n                    sorter = null;\n\n                    // set first value\n                    Current = buffer[map[index++]];\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                completionSource.TrySetResult(true);\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                return default;\n            }\n        }\n    }\n\n    internal class OrderedAsyncEnumerable<TElement, TKey> : OrderedAsyncEnumerable<TElement>\n    {\n        readonly Func<TElement, TKey> keySelector;\n        readonly IComparer<TKey> comparer;\n        readonly bool descending;\n        readonly OrderedAsyncEnumerable<TElement> parent;\n\n        public OrderedAsyncEnumerable(IUniTaskAsyncEnumerable<TElement> source, Func<TElement, TKey> keySelector, IComparer<TKey> comparer, bool descending, OrderedAsyncEnumerable<TElement> parent)\n            : base(source)\n        {\n            this.keySelector = keySelector;\n            this.comparer = comparer;\n            this.descending = descending;\n            this.parent = parent;\n        }\n\n        internal override AsyncEnumerableSorter<TElement> GetAsyncEnumerableSorter(AsyncEnumerableSorter<TElement> next, CancellationToken cancellationToken)\n        {\n            AsyncEnumerableSorter<TElement> sorter = new SyncSelectorAsyncEnumerableSorter<TElement, TKey>(keySelector, comparer, descending, next);\n            if (parent != null) sorter = parent.GetAsyncEnumerableSorter(sorter, cancellationToken);\n            return sorter;\n        }\n    }\n\n    internal class OrderedAsyncEnumerableAwait<TElement, TKey> : OrderedAsyncEnumerable<TElement>\n    {\n        readonly Func<TElement, UniTask<TKey>> keySelector;\n        readonly IComparer<TKey> comparer;\n        readonly bool descending;\n        readonly OrderedAsyncEnumerable<TElement> parent;\n\n        public OrderedAsyncEnumerableAwait(IUniTaskAsyncEnumerable<TElement> source, Func<TElement, UniTask<TKey>> keySelector, IComparer<TKey> comparer, bool descending, OrderedAsyncEnumerable<TElement> parent)\n            : base(source)\n        {\n            this.keySelector = keySelector;\n            this.comparer = comparer;\n            this.descending = descending;\n            this.parent = parent;\n        }\n\n        internal override AsyncEnumerableSorter<TElement> GetAsyncEnumerableSorter(AsyncEnumerableSorter<TElement> next, CancellationToken cancellationToken)\n        {\n            AsyncEnumerableSorter<TElement> sorter = new AsyncSelectorEnumerableSorter<TElement, TKey>(keySelector, comparer, descending, next);\n            if (parent != null) sorter = parent.GetAsyncEnumerableSorter(sorter, cancellationToken);\n            return sorter;\n        }\n    }\n\n    internal class OrderedAsyncEnumerableAwaitWithCancellation<TElement, TKey> : OrderedAsyncEnumerable<TElement>\n    {\n        readonly Func<TElement, CancellationToken, UniTask<TKey>> keySelector;\n        readonly IComparer<TKey> comparer;\n        readonly bool descending;\n        readonly OrderedAsyncEnumerable<TElement> parent;\n\n        public OrderedAsyncEnumerableAwaitWithCancellation(IUniTaskAsyncEnumerable<TElement> source, Func<TElement, CancellationToken, UniTask<TKey>> keySelector, IComparer<TKey> comparer, bool descending, OrderedAsyncEnumerable<TElement> parent)\n            : base(source)\n        {\n            this.keySelector = keySelector;\n            this.comparer = comparer;\n            this.descending = descending;\n            this.parent = parent;\n        }\n\n        internal override AsyncEnumerableSorter<TElement> GetAsyncEnumerableSorter(AsyncEnumerableSorter<TElement> next, CancellationToken cancellationToken)\n        {\n            AsyncEnumerableSorter<TElement> sorter = new AsyncSelectorWithCancellationEnumerableSorter<TElement, TKey>(keySelector, comparer, descending, next, cancellationToken);\n            if (parent != null) sorter = parent.GetAsyncEnumerableSorter(sorter, cancellationToken);\n            return sorter;\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/OrderBy.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 413883ceff8546143bdf200aafa4b8f7\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Pairwise.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<(TSource, TSource)> Pairwise<TSource>(this IUniTaskAsyncEnumerable<TSource> source)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new Pairwise<TSource>(source);\n        }\n    }\n\n    internal sealed class Pairwise<TSource> : IUniTaskAsyncEnumerable<(TSource, TSource)>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n\n        public Pairwise(IUniTaskAsyncEnumerable<TSource> source)\n        {\n            this.source = source;\n        }\n\n        public IUniTaskAsyncEnumerator<(TSource, TSource)> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Pairwise(source, cancellationToken);\n        }\n\n        sealed class _Pairwise : MoveNextSource, IUniTaskAsyncEnumerator<(TSource, TSource)>\n        {\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n\n            TSource prev;\n            bool isFirst;\n\n            public _Pairwise(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public (TSource, TSource) Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                if (enumerator == null)\n                {\n                    isFirst = true;\n                    enumerator = source.GetAsyncEnumerator(cancellationToken);\n                }\n\n                completionSource.Reset();\n                SourceMoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        MoveNextCore(this);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                }\n            }\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_Pairwise)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        if (self.isFirst)\n                        {\n                            self.isFirst = false;\n                            self.prev = self.enumerator.Current;\n                            self.SourceMoveNext(); // run again. okay to use recursive(only one more).\n                        }\n                        else\n                        {\n                            var p = self.prev;\n                            self.prev = self.enumerator.Current;\n                            self.Current = (p, self.prev);\n                            self.completionSource.TrySetResult(true);\n                        }\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Pairwise.cs.meta",
    "content": "fileFormatVersion: 2\nguid: cddbf051d2a88f549986c468b23214af\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Publish.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IConnectableUniTaskAsyncEnumerable<TSource> Publish<TSource>(this IUniTaskAsyncEnumerable<TSource> source)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new Publish<TSource>(source);\n        }\n    }\n\n    internal sealed class Publish<TSource> : IConnectableUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly CancellationTokenSource cancellationTokenSource;\n\n        TriggerEvent<TSource> trigger;\n        IUniTaskAsyncEnumerator<TSource> enumerator;\n        IDisposable connectedDisposable;\n        bool isCompleted;\n\n        public Publish(IUniTaskAsyncEnumerable<TSource> source)\n        {\n            this.source = source;\n            this.cancellationTokenSource = new CancellationTokenSource();\n        }\n\n        public IDisposable Connect()\n        {\n            if (connectedDisposable != null) return connectedDisposable;\n\n            if (enumerator == null)\n            {\n                enumerator = source.GetAsyncEnumerator(cancellationTokenSource.Token);\n            }\n\n            ConsumeEnumerator().Forget();\n\n            connectedDisposable = new ConnectDisposable(cancellationTokenSource);\n            return connectedDisposable;\n        }\n\n        async UniTaskVoid ConsumeEnumerator()\n        {\n            try\n            {\n                try\n                {\n                    while (await enumerator.MoveNextAsync())\n                    {\n                        trigger.SetResult(enumerator.Current);\n                    }\n                    trigger.SetCompleted();\n                }\n                catch (Exception ex)\n                {\n                    trigger.SetError(ex);\n                }\n            }\n            finally\n            {\n                isCompleted = true;\n                await enumerator.DisposeAsync();\n            }\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Publish(this, cancellationToken);\n        }\n\n        sealed class ConnectDisposable : IDisposable\n        {\n            readonly CancellationTokenSource cancellationTokenSource;\n\n            public ConnectDisposable(CancellationTokenSource cancellationTokenSource)\n            {\n                this.cancellationTokenSource = cancellationTokenSource;\n            }\n\n            public void Dispose()\n            {\n                this.cancellationTokenSource.Cancel();\n            }\n        }\n\n        sealed class _Publish : MoveNextSource, IUniTaskAsyncEnumerator<TSource>, ITriggerHandler<TSource>\n        {\n            static readonly Action<object> CancelDelegate = OnCanceled;\n\n            readonly Publish<TSource> parent;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool isDisposed;\n\n            public _Publish(Publish<TSource> parent, CancellationToken cancellationToken)\n            {\n                if (cancellationToken.IsCancellationRequested) return;\n\n                this.parent = parent;\n                this.cancellationToken = cancellationToken;\n\n                if (cancellationToken.CanBeCanceled)\n                {\n                    this.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(CancelDelegate, this);\n                }\n\n                parent.trigger.Add(this);\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TSource Current { get; private set; }\n            ITriggerHandler<TSource> ITriggerHandler<TSource>.Prev { get; set; }\n            ITriggerHandler<TSource> ITriggerHandler<TSource>.Next { get; set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                if (parent.isCompleted) return CompletedTasks.False;\n\n                completionSource.Reset();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void OnCanceled(object state)\n            {\n                var self = (_Publish)state;\n                self.completionSource.TrySetCanceled(self.cancellationToken);\n                self.DisposeAsync().Forget();\n            }\n\n            public UniTask DisposeAsync()\n            {\n                if (!isDisposed)\n                {\n                    isDisposed = true;\n                    TaskTracker.RemoveTracking(this);\n                    cancellationTokenRegistration.Dispose();\n                    parent.trigger.Remove(this);\n                }\n\n                return default;\n            }\n\n            public void OnNext(TSource value)\n            {\n                Current = value;\n                completionSource.TrySetResult(true);\n            }\n\n            public void OnCanceled(CancellationToken cancellationToken)\n            {\n                completionSource.TrySetCanceled(cancellationToken);\n            }\n\n            public void OnCompleted()\n            {\n                completionSource.TrySetResult(false);\n            }\n\n            public void OnError(Exception ex)\n            {\n                completionSource.TrySetException(ex);\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Publish.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 93c684d1e88c09d4e89b79437d97b810\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Queue.cs",
    "content": "﻿using System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> Queue<TSource>(this IUniTaskAsyncEnumerable<TSource> source)\n        {\n            return new QueueOperator<TSource>(source);\n        }\n    }\n\n    internal sealed class QueueOperator<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n\n        public QueueOperator(IUniTaskAsyncEnumerable<TSource> source)\n        {\n            this.source = source;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Queue(source, cancellationToken);\n        }\n\n        sealed class _Queue : IUniTaskAsyncEnumerator<TSource>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            CancellationToken cancellationToken;\n\n            Channel<TSource> channel;\n            IUniTaskAsyncEnumerator<TSource> channelEnumerator;\n            IUniTaskAsyncEnumerator<TSource> sourceEnumerator;\n            bool channelClosed;\n\n            public _Queue(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.cancellationToken = cancellationToken;\n            }\n\n            public TSource Current => channelEnumerator.Current;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                if (sourceEnumerator == null)\n                {\n                    sourceEnumerator = source.GetAsyncEnumerator(cancellationToken);\n                    channel = Channel.CreateSingleConsumerUnbounded<TSource>();\n\n                    channelEnumerator = channel.Reader.ReadAllAsync().GetAsyncEnumerator(cancellationToken);\n\n                    ConsumeAll(this, sourceEnumerator, channel).Forget();\n                }\n\n                return channelEnumerator.MoveNextAsync();\n            }\n\n            static async UniTaskVoid ConsumeAll(_Queue self, IUniTaskAsyncEnumerator<TSource> enumerator, ChannelWriter<TSource> writer)\n            {\n                try\n                {\n                    while (await enumerator.MoveNextAsync())\n                    {\n                        writer.TryWrite(enumerator.Current);\n                    }\n                    writer.TryComplete();\n                }\n                catch (Exception ex)\n                {\n                    writer.TryComplete(ex);\n                }\n                finally\n                {\n                    self.channelClosed = true;\n                    await enumerator.DisposeAsync();\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                if (sourceEnumerator != null)\n                {\n                    await sourceEnumerator.DisposeAsync();\n                }\n                if (channelEnumerator != null)\n                {\n                    await channelEnumerator.DisposeAsync();\n                }\n\n                if (!channelClosed)\n                {\n                    channelClosed = true;\n                    channel.Writer.TryComplete(new OperationCanceledException());\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Queue.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b7ea1bcf9dbebb042bc99c7816249e02\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Range.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<int> Range(int start, int count)\n        {\n            if (count < 0) throw Error.ArgumentOutOfRange(nameof(count));\n\n            var end = (long)start + count - 1L;\n            if (end > int.MaxValue) throw Error.ArgumentOutOfRange(nameof(count));\n\n            if (count == 0) UniTaskAsyncEnumerable.Empty<int>();\n\n            return new Cysharp.Threading.Tasks.Linq.Range(start, count);\n        }\n    }\n\n    internal class Range : IUniTaskAsyncEnumerable<int>\n    {\n        readonly int start;\n        readonly int end;\n\n        public Range(int start, int count)\n        {\n            this.start = start;\n            this.end = start + count;\n        }\n\n        public IUniTaskAsyncEnumerator<int> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Range(start, end, cancellationToken);\n        }\n\n        class _Range : IUniTaskAsyncEnumerator<int>\n        {\n            readonly int start;\n            readonly int end;\n            int current;\n            CancellationToken cancellationToken;\n\n            public _Range(int start, int end, CancellationToken cancellationToken)\n            {\n                this.start = start;\n                this.end = end;\n                this.cancellationToken = cancellationToken;\n\n                this.current = start - 1;\n            }\n\n            public int Current => current;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                current++;\n\n                if (current != end)\n                {\n                    return CompletedTasks.True;\n                }\n\n                return CompletedTasks.False;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Range.cs.meta",
    "content": "fileFormatVersion: 2\nguid: d826418a813498648b10542d0a5fb173\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Repeat.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TElement> Repeat<TElement>(TElement element, int count)\n        {\n            if (count < 0) throw Error.ArgumentOutOfRange(nameof(count));\n\n            return new Repeat<TElement>(element, count);\n        }\n    }\n\n    internal class Repeat<TElement> : IUniTaskAsyncEnumerable<TElement>\n    {\n        readonly TElement element;\n        readonly int count;\n\n        public Repeat(TElement element, int count)\n        {\n            this.element = element;\n            this.count = count;\n        }\n\n        public IUniTaskAsyncEnumerator<TElement> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Repeat(element, count, cancellationToken);\n        }\n\n        class _Repeat : IUniTaskAsyncEnumerator<TElement>\n        {\n            readonly TElement element;\n            readonly int count;\n            int remaining;\n            CancellationToken cancellationToken;\n\n            public _Repeat(TElement element, int count, CancellationToken cancellationToken)\n            {\n                this.element = element;\n                this.count = count;\n                this.cancellationToken = cancellationToken;\n\n                this.remaining = count;\n            }\n\n            public TElement Current => element;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                if (remaining-- != 0)\n                {\n                    return CompletedTasks.True;\n                }\n\n                return CompletedTasks.False;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Repeat.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 3819a3925165a674d80ee848c8600379\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Return.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TValue> Return<TValue>(TValue value)\n        {\n            return new Return<TValue>(value);\n        }\n    }\n\n    internal class Return<TValue> : IUniTaskAsyncEnumerable<TValue>\n    {\n        readonly TValue value;\n\n        public Return(TValue value)\n        {\n            this.value = value;\n        }\n\n        public IUniTaskAsyncEnumerator<TValue> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Return(value, cancellationToken);\n        }\n\n        class _Return : IUniTaskAsyncEnumerator<TValue>\n        {\n            readonly TValue value;\n            CancellationToken cancellationToken;\n\n            bool called;\n\n            public _Return(TValue value, CancellationToken cancellationToken)\n            {\n                this.value = value;\n                this.cancellationToken = cancellationToken;\n                this.called = false;\n            }\n\n            public TValue Current => value;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                if (!called)\n                {\n                    called = true;\n                    return CompletedTasks.True;\n                }\n\n                return CompletedTasks.False;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Return.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 4313cd8ecf705e44f9064ce46e293c2c\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Reverse.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> Reverse<TSource>(this IUniTaskAsyncEnumerable<TSource> source)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            return new Reverse<TSource>(source);\n        }\n    }\n\n    internal sealed class Reverse<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n\n        public Reverse(IUniTaskAsyncEnumerable<TSource> source)\n        {\n            this.source = source;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Reverse(source, cancellationToken);\n        }\n\n        sealed class _Reverse : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            CancellationToken cancellationToken;\n\n            TSource[] array;\n            int index;\n\n            public _Reverse(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TSource Current { get; private set; }\n\n            // after consumed array, don't use await so allow async(not require UniTaskCompletionSourceCore).\n            public async UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                if (array == null)\n                {\n                    array = await source.ToArrayAsync(cancellationToken);\n                    index = array.Length - 1;\n                }\n\n                if (index != -1)\n                {\n                    Current = array[index];\n                    --index;\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Reverse.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b2769e65c729b4f4ca6af9826d9c7b90\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Select.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TResult> Select<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TResult> selector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(selector, nameof(selector));\n\n            return new Cysharp.Threading.Tasks.Linq.Select<TSource, TResult>(source, selector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> Select<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, TResult> selector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(selector, nameof(selector));\n\n            return new Cysharp.Threading.Tasks.Linq.SelectInt<TSource, TResult>(source, selector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> SelectAwait<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TResult>> selector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(selector, nameof(selector));\n\n            return new Cysharp.Threading.Tasks.Linq.SelectAwait<TSource, TResult>(source, selector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> SelectAwait<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, UniTask<TResult>> selector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(selector, nameof(selector));\n\n            return new Cysharp.Threading.Tasks.Linq.SelectIntAwait<TSource, TResult>(source, selector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> SelectAwaitWithCancellation<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TResult>> selector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(selector, nameof(selector));\n\n            return new Cysharp.Threading.Tasks.Linq.SelectAwaitWithCancellation<TSource, TResult>(source, selector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> SelectAwaitWithCancellation<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, CancellationToken, UniTask<TResult>> selector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(selector, nameof(selector));\n\n            return new Cysharp.Threading.Tasks.Linq.SelectIntAwaitWithCancellation<TSource, TResult>(source, selector);\n        }\n    }\n\n    internal sealed class Select<TSource, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, TResult> selector;\n\n        public Select(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TResult> selector)\n        {\n            this.source = source;\n            this.selector = selector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Select(source, selector, cancellationToken);\n        }\n\n        sealed class _Select : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, TResult> selector;\n            readonly CancellationToken cancellationToken;\n\n            int state = -1;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            Action moveNextAction;\n\n            public _Select(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TResult> selector, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.selector = selector;\n                this.cancellationToken = cancellationToken;\n                this.moveNextAction = MoveNext;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (state == -2) return default;\n\n                completionSource.Reset();\n                MoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNext()\n            {\n                try\n                {\n                    switch (state)\n                    {\n                        case -1: // init\n                            enumerator = source.GetAsyncEnumerator(cancellationToken);\n                            goto case 0;\n                        case 0:\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case 1;\n                            }\n                            else\n                            {\n                                state = 1;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case 1:\n                            if (awaiter.GetResult())\n                            {\n                                Current = selector(enumerator.Current);\n                                goto CONTINUE;\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        default:\n                            goto DONE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    state = -2;\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                state = -2;\n                completionSource.TrySetResult(false);\n                return;\n\n                CONTINUE:\n                state = 0;\n                completionSource.TrySetResult(true);\n                return;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                return enumerator.DisposeAsync();\n            }\n        }\n    }\n\n    internal sealed class SelectInt<TSource, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, int, TResult> selector;\n\n        public SelectInt(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, TResult> selector)\n        {\n            this.source = source;\n            this.selector = selector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Select(source, selector, cancellationToken);\n        }\n\n        sealed class _Select : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, int, TResult> selector;\n            readonly CancellationToken cancellationToken;\n\n            int state = -1;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            Action moveNextAction;\n            int index;\n\n            public _Select(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, TResult> selector, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.selector = selector;\n                this.cancellationToken = cancellationToken;\n                this.moveNextAction = MoveNext;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (state == -2) return default;\n\n                completionSource.Reset();\n                MoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNext()\n            {\n                try\n                {\n                    switch (state)\n                    {\n                        case -1: // init\n                            enumerator = source.GetAsyncEnumerator(cancellationToken);\n                            goto case 0;\n                        case 0:\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case 1;\n                            }\n                            else\n                            {\n                                state = 1;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case 1:\n                            if (awaiter.GetResult())\n                            {\n                                Current = selector(enumerator.Current, checked(index++));\n                                goto CONTINUE;\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        default:\n                            goto DONE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    state = -2;\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                state = -2;\n                completionSource.TrySetResult(false);\n                return;\n\n                CONTINUE:\n                state = 0;\n                completionSource.TrySetResult(true);\n                return;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                return enumerator.DisposeAsync();\n            }\n        }\n    }\n\n    internal sealed class SelectAwait<TSource, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, UniTask<TResult>> selector;\n\n        public SelectAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TResult>> selector)\n        {\n            this.source = source;\n            this.selector = selector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _SelectAwait(source, selector, cancellationToken);\n        }\n\n        sealed class _SelectAwait : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, UniTask<TResult>> selector;\n            readonly CancellationToken cancellationToken;\n\n            int state = -1;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            UniTask<TResult>.Awaiter awaiter2;\n            Action moveNextAction;\n\n            public _SelectAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TResult>> selector, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.selector = selector;\n                this.cancellationToken = cancellationToken;\n                this.moveNextAction = MoveNext;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (state == -2) return default;\n\n                completionSource.Reset();\n                MoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNext()\n            {\n                try\n                {\n                    switch (state)\n                    {\n                        case -1: // init\n                            enumerator = source.GetAsyncEnumerator(cancellationToken);\n                            goto case 0;\n                        case 0:\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case 1;\n                            }\n                            else\n                            {\n                                state = 1;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case 1:\n                            if (awaiter.GetResult())\n                            {\n                                awaiter2 = selector(enumerator.Current).GetAwaiter();\n                                if (awaiter2.IsCompleted)\n                                {\n                                    goto case 2;\n                                }\n                                else\n                                {\n                                    state = 2;\n                                    awaiter2.UnsafeOnCompleted(moveNextAction);\n                                    return;\n                                }\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        case 2:\n                            Current = awaiter2.GetResult();\n                            goto CONTINUE;\n                        default:\n                            goto DONE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    state = -2;\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                state = -2;\n                completionSource.TrySetResult(false);\n                return;\n\n                CONTINUE:\n                state = 0;\n                completionSource.TrySetResult(true);\n                return;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                return enumerator.DisposeAsync();\n            }\n        }\n    }\n\n    internal sealed class SelectIntAwait<TSource, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, int, UniTask<TResult>> selector;\n\n        public SelectIntAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, UniTask<TResult>> selector)\n        {\n            this.source = source;\n            this.selector = selector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _SelectAwait(source, selector, cancellationToken);\n        }\n\n        sealed class _SelectAwait : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, int, UniTask<TResult>> selector;\n            readonly CancellationToken cancellationToken;\n\n            int state = -1;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            UniTask<TResult>.Awaiter awaiter2;\n            Action moveNextAction;\n            int index;\n\n            public _SelectAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, UniTask<TResult>> selector, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.selector = selector;\n                this.cancellationToken = cancellationToken;\n                this.moveNextAction = MoveNext;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (state == -2) return default;\n\n                completionSource.Reset();\n                MoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNext()\n            {\n                try\n                {\n                    switch (state)\n                    {\n                        case -1: // init\n                            enumerator = source.GetAsyncEnumerator(cancellationToken);\n                            goto case 0;\n                        case 0:\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case 1;\n                            }\n                            else\n                            {\n                                state = 1;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case 1:\n                            if (awaiter.GetResult())\n                            {\n                                awaiter2 = selector(enumerator.Current, checked(index++)).GetAwaiter();\n                                if (awaiter2.IsCompleted)\n                                {\n                                    goto case 2;\n                                }\n                                else\n                                {\n                                    state = 2;\n                                    awaiter2.UnsafeOnCompleted(moveNextAction);\n                                    return;\n                                }\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        case 2:\n                            Current = awaiter2.GetResult();\n                            goto CONTINUE;\n                        default:\n                            goto DONE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    state = -2;\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                state = -2;\n                completionSource.TrySetResult(false);\n                return;\n\n                CONTINUE:\n                state = 0;\n                completionSource.TrySetResult(true);\n                return;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                return enumerator.DisposeAsync();\n            }\n        }\n    }\n\n    internal sealed class SelectAwaitWithCancellation<TSource, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, CancellationToken, UniTask<TResult>> selector;\n\n        public SelectAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TResult>> selector)\n        {\n            this.source = source;\n            this.selector = selector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _SelectAwaitWithCancellation(source, selector, cancellationToken);\n        }\n\n        sealed class _SelectAwaitWithCancellation : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, CancellationToken, UniTask<TResult>> selector;\n            readonly CancellationToken cancellationToken;\n\n            int state = -1;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            UniTask<TResult>.Awaiter awaiter2;\n            Action moveNextAction;\n\n            public _SelectAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TResult>> selector, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.selector = selector;\n                this.cancellationToken = cancellationToken;\n                this.moveNextAction = MoveNext;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (state == -2) return default;\n\n                completionSource.Reset();\n                MoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNext()\n            {\n                try\n                {\n                    switch (state)\n                    {\n                        case -1: // init\n                            enumerator = source.GetAsyncEnumerator(cancellationToken);\n                            goto case 0;\n                        case 0:\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case 1;\n                            }\n                            else\n                            {\n                                state = 1;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case 1:\n                            if (awaiter.GetResult())\n                            {\n                                awaiter2 = selector(enumerator.Current, cancellationToken).GetAwaiter();\n                                if (awaiter2.IsCompleted)\n                                {\n                                    goto case 2;\n                                }\n                                else\n                                {\n                                    state = 2;\n                                    awaiter2.UnsafeOnCompleted(moveNextAction);\n                                    return;\n                                }\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        case 2:\n                            Current = awaiter2.GetResult();\n                            goto CONTINUE;\n                        default:\n                            goto DONE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    state = -2;\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                state = -2;\n                completionSource.TrySetResult(false);\n                return;\n\n                CONTINUE:\n                state = 0;\n                completionSource.TrySetResult(true);\n                return;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                return enumerator.DisposeAsync();\n            }\n        }\n    }\n\n    internal sealed class SelectIntAwaitWithCancellation<TSource, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, int, CancellationToken, UniTask<TResult>> selector;\n\n        public SelectIntAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, CancellationToken, UniTask<TResult>> selector)\n        {\n            this.source = source;\n            this.selector = selector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _SelectAwaitWithCancellation(source, selector, cancellationToken);\n        }\n\n        sealed class _SelectAwaitWithCancellation : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, int, CancellationToken, UniTask<TResult>> selector;\n            readonly CancellationToken cancellationToken;\n\n            int state = -1;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            UniTask<TResult>.Awaiter awaiter2;\n            Action moveNextAction;\n            int index;\n\n            public _SelectAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, CancellationToken, UniTask<TResult>> selector, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.selector = selector;\n                this.cancellationToken = cancellationToken;\n                this.moveNextAction = MoveNext;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (state == -2) return default;\n\n                completionSource.Reset();\n                MoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNext()\n            {\n                try\n                {\n                    switch (state)\n                    {\n                        case -1: // init\n                            enumerator = source.GetAsyncEnumerator(cancellationToken);\n                            goto case 0;\n                        case 0:\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case 1;\n                            }\n                            else\n                            {\n                                state = 1;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case 1:\n                            if (awaiter.GetResult())\n                            {\n                                awaiter2 = selector(enumerator.Current, checked(index++), cancellationToken).GetAwaiter();\n                                if (awaiter2.IsCompleted)\n                                {\n                                    goto case 2;\n                                }\n                                else\n                                {\n                                    state = 2;\n                                    awaiter2.UnsafeOnCompleted(moveNextAction);\n                                    return;\n                                }\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        case 2:\n                            Current = awaiter2.GetResult();\n                            goto CONTINUE;\n                        default:\n                            goto DONE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    state = -2;\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                state = -2;\n                completionSource.TrySetResult(false);\n                return;\n\n                CONTINUE:\n                state = 0;\n                completionSource.TrySetResult(true);\n                return;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                return enumerator.DisposeAsync();\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Select.cs.meta",
    "content": "fileFormatVersion: 2\nguid: dc68e598ca44a134b988dfaf5e53bfba\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/SelectMany.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n\n        public static IUniTaskAsyncEnumerable<TResult> SelectMany<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, IUniTaskAsyncEnumerable<TResult>> selector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(selector, nameof(selector));\n\n            return new SelectMany<TSource, TResult, TResult>(source, selector, (x, y) => y);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> SelectMany<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, IUniTaskAsyncEnumerable<TResult>> selector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(selector, nameof(selector));\n\n            return new SelectMany<TSource, TResult, TResult>(source, selector, (x, y) => y);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> SelectMany<TSource, TCollection, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, IUniTaskAsyncEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(collectionSelector, nameof(collectionSelector));\n\n            return new SelectMany<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> SelectMany<TSource, TCollection, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, IUniTaskAsyncEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(collectionSelector, nameof(collectionSelector));\n\n            return new SelectMany<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> SelectManyAwait<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<IUniTaskAsyncEnumerable<TResult>>> selector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(selector, nameof(selector));\n\n            return new SelectManyAwait<TSource, TResult, TResult>(source, selector, (x, y) => UniTask.FromResult(y));\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> SelectManyAwait<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, UniTask<IUniTaskAsyncEnumerable<TResult>>> selector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(selector, nameof(selector));\n\n            return new SelectManyAwait<TSource, TResult, TResult>(source, selector, (x, y) => UniTask.FromResult(y));\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> SelectManyAwait<TSource, TCollection, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<IUniTaskAsyncEnumerable<TCollection>>> collectionSelector, Func<TSource, TCollection, UniTask<TResult>> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(collectionSelector, nameof(collectionSelector));\n\n            return new SelectManyAwait<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> SelectManyAwait<TSource, TCollection, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, UniTask<IUniTaskAsyncEnumerable<TCollection>>> collectionSelector, Func<TSource, TCollection, UniTask<TResult>> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(collectionSelector, nameof(collectionSelector));\n\n            return new SelectManyAwait<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> SelectManyAwaitWithCancellation<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<IUniTaskAsyncEnumerable<TResult>>> selector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(selector, nameof(selector));\n\n            return new SelectManyAwaitWithCancellation<TSource, TResult, TResult>(source, selector, (x, y, c) => UniTask.FromResult(y));\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> SelectManyAwaitWithCancellation<TSource, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, CancellationToken, UniTask<IUniTaskAsyncEnumerable<TResult>>> selector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(selector, nameof(selector));\n\n            return new SelectManyAwaitWithCancellation<TSource, TResult, TResult>(source, selector, (x, y, c) => UniTask.FromResult(y));\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> SelectManyAwaitWithCancellation<TSource, TCollection, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<IUniTaskAsyncEnumerable<TCollection>>> collectionSelector, Func<TSource, TCollection, CancellationToken, UniTask<TResult>> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(collectionSelector, nameof(collectionSelector));\n\n            return new SelectManyAwaitWithCancellation<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> SelectManyAwaitWithCancellation<TSource, TCollection, TResult>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, CancellationToken, UniTask<IUniTaskAsyncEnumerable<TCollection>>> collectionSelector, Func<TSource, TCollection, CancellationToken, UniTask<TResult>> resultSelector)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(collectionSelector, nameof(collectionSelector));\n\n            return new SelectManyAwaitWithCancellation<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);\n        }\n    }\n\n    internal sealed class SelectMany<TSource, TCollection, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, IUniTaskAsyncEnumerable<TCollection>> selector1;\n        readonly Func<TSource, int, IUniTaskAsyncEnumerable<TCollection>> selector2;\n        readonly Func<TSource, TCollection, TResult> resultSelector;\n\n        public SelectMany(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, IUniTaskAsyncEnumerable<TCollection>> selector, Func<TSource, TCollection, TResult> resultSelector)\n        {\n            this.source = source;\n            this.selector1 = selector;\n            this.selector2 = null;\n            this.resultSelector = resultSelector;\n        }\n\n        public SelectMany(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, IUniTaskAsyncEnumerable<TCollection>> selector, Func<TSource, TCollection, TResult> resultSelector)\n        {\n            this.source = source;\n            this.selector1 = null;\n            this.selector2 = selector;\n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _SelectMany(source, selector1, selector2, resultSelector, cancellationToken);\n        }\n\n        sealed class _SelectMany : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> sourceMoveNextCoreDelegate = SourceMoveNextCore;\n            static readonly Action<object> selectedSourceMoveNextCoreDelegate = SeletedSourceMoveNextCore;\n            static readonly Action<object> selectedEnumeratorDisposeAsyncCoreDelegate = SelectedEnumeratorDisposeAsyncCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n\n            readonly Func<TSource, IUniTaskAsyncEnumerable<TCollection>> selector1;\n            readonly Func<TSource, int, IUniTaskAsyncEnumerable<TCollection>> selector2;\n            readonly Func<TSource, TCollection, TResult> resultSelector;\n            CancellationToken cancellationToken;\n\n            TSource sourceCurrent;\n            int sourceIndex;\n            IUniTaskAsyncEnumerator<TSource> sourceEnumerator;\n            IUniTaskAsyncEnumerator<TCollection> selectedEnumerator;\n            UniTask<bool>.Awaiter sourceAwaiter;\n            UniTask<bool>.Awaiter selectedAwaiter;\n            UniTask.Awaiter selectedDisposeAsyncAwaiter;\n\n            public _SelectMany(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, IUniTaskAsyncEnumerable<TCollection>> selector1, Func<TSource, int, IUniTaskAsyncEnumerable<TCollection>> selector2, Func<TSource, TCollection, TResult> resultSelector, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.selector1 = selector1;\n                this.selector2 = selector2;\n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                completionSource.Reset();\n\n                // iterate selected field\n                if (selectedEnumerator != null)\n                {\n                    MoveNextSelected();\n                }\n                else\n                {\n                    // iterate source field\n                    if (sourceEnumerator == null)\n                    {\n                        sourceEnumerator = source.GetAsyncEnumerator(cancellationToken);\n                    }\n                    MoveNextSource();\n                }\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNextSource()\n            {\n                try\n                {\n                    sourceAwaiter = sourceEnumerator.MoveNextAsync().GetAwaiter();\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                if (sourceAwaiter.IsCompleted)\n                {\n                    SourceMoveNextCore(this);\n                }\n                else\n                {\n                    sourceAwaiter.SourceOnCompleted(sourceMoveNextCoreDelegate, this);\n                }\n            }\n\n            void MoveNextSelected()\n            {\n                try\n                {\n                    selectedAwaiter = selectedEnumerator.MoveNextAsync().GetAwaiter();\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                if (selectedAwaiter.IsCompleted)\n                {\n                    SeletedSourceMoveNextCore(this);\n                }\n                else\n                {\n                    selectedAwaiter.SourceOnCompleted(selectedSourceMoveNextCoreDelegate, this);\n                }\n            }\n\n            static void SourceMoveNextCore(object state)\n            {\n                var self = (_SelectMany)state;\n\n                if (self.TryGetResult(self.sourceAwaiter, out var result))\n                {\n                    if (result)\n                    {\n                        try\n                        {\n                            self.sourceCurrent = self.sourceEnumerator.Current;\n                            if (self.selector1 != null)\n                            {\n                                self.selectedEnumerator = self.selector1(self.sourceCurrent).GetAsyncEnumerator(self.cancellationToken);\n                            }\n                            else\n                            {\n                                self.selectedEnumerator = self.selector2(self.sourceCurrent, checked(self.sourceIndex++)).GetAsyncEnumerator(self.cancellationToken);\n                            }\n                        }\n                        catch (Exception ex)\n                        {\n                            self.completionSource.TrySetException(ex);\n                            return;\n                        }\n\n                        self.MoveNextSelected(); // iterated selected source.\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            static void SeletedSourceMoveNextCore(object state)\n            {\n                var self = (_SelectMany)state;\n\n                if (self.TryGetResult(self.selectedAwaiter, out var result))\n                {\n                    if (result)\n                    {\n                        try\n                        {\n                            self.Current = self.resultSelector(self.sourceCurrent, self.selectedEnumerator.Current);\n                        }\n                        catch (Exception ex)\n                        {\n                            self.completionSource.TrySetException(ex);\n                            return;\n                        }\n\n                        self.completionSource.TrySetResult(true);\n                    }\n                    else\n                    {\n                        // dispose selected source and try iterate source.\n                        try\n                        {\n                            self.selectedDisposeAsyncAwaiter = self.selectedEnumerator.DisposeAsync().GetAwaiter();\n                        }\n                        catch (Exception ex)\n                        {\n                            self.completionSource.TrySetException(ex);\n                            return;\n                        }\n                        if (self.selectedDisposeAsyncAwaiter.IsCompleted)\n                        {\n                            SelectedEnumeratorDisposeAsyncCore(self);\n                        }\n                        else\n                        {\n                            self.selectedDisposeAsyncAwaiter.SourceOnCompleted(selectedEnumeratorDisposeAsyncCoreDelegate, self);\n                        }\n                    }\n                }\n            }\n\n            static void SelectedEnumeratorDisposeAsyncCore(object state)\n            {\n                var self = (_SelectMany)state;\n\n                if (self.TryGetResult(self.selectedDisposeAsyncAwaiter))\n                {\n                    self.selectedEnumerator = null;\n                    self.selectedAwaiter = default;\n\n                    self.MoveNextSource(); // iterate next source\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (selectedEnumerator != null)\n                {\n                    await selectedEnumerator.DisposeAsync();\n                }\n                if (sourceEnumerator != null)\n                {\n                    await sourceEnumerator.DisposeAsync();\n                }\n            }\n        }\n    }\n\n    internal sealed class SelectManyAwait<TSource, TCollection, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, UniTask<IUniTaskAsyncEnumerable<TCollection>>> selector1;\n        readonly Func<TSource, int, UniTask<IUniTaskAsyncEnumerable<TCollection>>> selector2;\n        readonly Func<TSource, TCollection, UniTask<TResult>> resultSelector;\n\n        public SelectManyAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<IUniTaskAsyncEnumerable<TCollection>>> selector, Func<TSource, TCollection, UniTask<TResult>> resultSelector)\n        {\n            this.source = source;\n            this.selector1 = selector;\n            this.selector2 = null;\n            this.resultSelector = resultSelector;\n        }\n\n        public SelectManyAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, UniTask<IUniTaskAsyncEnumerable<TCollection>>> selector, Func<TSource, TCollection, UniTask<TResult>> resultSelector)\n        {\n            this.source = source;\n            this.selector1 = null;\n            this.selector2 = selector;\n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _SelectManyAwait(source, selector1, selector2, resultSelector, cancellationToken);\n        }\n\n        sealed class _SelectManyAwait : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> sourceMoveNextCoreDelegate = SourceMoveNextCore;\n            static readonly Action<object> selectedSourceMoveNextCoreDelegate = SeletedSourceMoveNextCore;\n            static readonly Action<object> selectedEnumeratorDisposeAsyncCoreDelegate = SelectedEnumeratorDisposeAsyncCore;\n            static readonly Action<object> selectorAwaitCoreDelegate = SelectorAwaitCore;\n            static readonly Action<object> resultSelectorAwaitCoreDelegate = ResultSelectorAwaitCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n\n            readonly Func<TSource, UniTask<IUniTaskAsyncEnumerable<TCollection>>> selector1;\n            readonly Func<TSource, int, UniTask<IUniTaskAsyncEnumerable<TCollection>>> selector2;\n            readonly Func<TSource, TCollection, UniTask<TResult>> resultSelector;\n            CancellationToken cancellationToken;\n\n            TSource sourceCurrent;\n            int sourceIndex;\n            IUniTaskAsyncEnumerator<TSource> sourceEnumerator;\n            IUniTaskAsyncEnumerator<TCollection> selectedEnumerator;\n            UniTask<bool>.Awaiter sourceAwaiter;\n            UniTask<bool>.Awaiter selectedAwaiter;\n            UniTask.Awaiter selectedDisposeAsyncAwaiter;\n\n            // await additional\n            UniTask<IUniTaskAsyncEnumerable<TCollection>>.Awaiter collectionSelectorAwaiter;\n            UniTask<TResult>.Awaiter resultSelectorAwaiter;\n\n            public _SelectManyAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<IUniTaskAsyncEnumerable<TCollection>>> selector1, Func<TSource, int, UniTask<IUniTaskAsyncEnumerable<TCollection>>> selector2, Func<TSource, TCollection, UniTask<TResult>> resultSelector, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.selector1 = selector1;\n                this.selector2 = selector2;\n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                completionSource.Reset();\n\n                // iterate selected field\n                if (selectedEnumerator != null)\n                {\n                    MoveNextSelected();\n                }\n                else\n                {\n                    // iterate source field\n                    if (sourceEnumerator == null)\n                    {\n                        sourceEnumerator = source.GetAsyncEnumerator(cancellationToken);\n                    }\n                    MoveNextSource();\n                }\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNextSource()\n            {\n                try\n                {\n                    sourceAwaiter = sourceEnumerator.MoveNextAsync().GetAwaiter();\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                if (sourceAwaiter.IsCompleted)\n                {\n                    SourceMoveNextCore(this);\n                }\n                else\n                {\n                    sourceAwaiter.SourceOnCompleted(sourceMoveNextCoreDelegate, this);\n                }\n            }\n\n            void MoveNextSelected()\n            {\n                try\n                {\n                    selectedAwaiter = selectedEnumerator.MoveNextAsync().GetAwaiter();\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                if (selectedAwaiter.IsCompleted)\n                {\n                    SeletedSourceMoveNextCore(this);\n                }\n                else\n                {\n                    selectedAwaiter.SourceOnCompleted(selectedSourceMoveNextCoreDelegate, this);\n                }\n            }\n\n            static void SourceMoveNextCore(object state)\n            {\n                var self = (_SelectManyAwait)state;\n\n                if (self.TryGetResult(self.sourceAwaiter, out var result))\n                {\n                    if (result)\n                    {\n                        try\n                        {\n                            self.sourceCurrent = self.sourceEnumerator.Current;\n\n                            if (self.selector1 != null)\n                            {\n                                self.collectionSelectorAwaiter = self.selector1(self.sourceCurrent).GetAwaiter();\n                            }\n                            else\n                            {\n                                self.collectionSelectorAwaiter = self.selector2(self.sourceCurrent, checked(self.sourceIndex++)).GetAwaiter();\n                            }\n\n                            if (self.collectionSelectorAwaiter.IsCompleted)\n                            {\n                                SelectorAwaitCore(self);\n                            }\n                            else\n                            {\n                                self.collectionSelectorAwaiter.SourceOnCompleted(selectorAwaitCoreDelegate, self);\n                            }\n                        }\n                        catch (Exception ex)\n                        {\n                            self.completionSource.TrySetException(ex);\n                            return;\n                        }\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            static void SeletedSourceMoveNextCore(object state)\n            {\n                var self = (_SelectManyAwait)state;\n\n                if (self.TryGetResult(self.selectedAwaiter, out var result))\n                {\n                    if (result)\n                    {\n                        try\n                        {\n                            self.resultSelectorAwaiter = self.resultSelector(self.sourceCurrent, self.selectedEnumerator.Current).GetAwaiter();\n                            if (self.resultSelectorAwaiter.IsCompleted)\n                            {\n                                ResultSelectorAwaitCore(self);\n                            }\n                            else\n                            {\n                                self.resultSelectorAwaiter.SourceOnCompleted(resultSelectorAwaitCoreDelegate, self);\n                            }\n                        }\n                        catch (Exception ex)\n                        {\n                            self.completionSource.TrySetException(ex);\n                            return;\n                        }\n                    }\n                    else\n                    {\n                        // dispose selected source and try iterate source.\n                        try\n                        {\n                            self.selectedDisposeAsyncAwaiter = self.selectedEnumerator.DisposeAsync().GetAwaiter();\n                        }\n                        catch (Exception ex)\n                        {\n                            self.completionSource.TrySetException(ex);\n                            return;\n                        }\n                        if (self.selectedDisposeAsyncAwaiter.IsCompleted)\n                        {\n                            SelectedEnumeratorDisposeAsyncCore(self);\n                        }\n                        else\n                        {\n                            self.selectedDisposeAsyncAwaiter.SourceOnCompleted(selectedEnumeratorDisposeAsyncCoreDelegate, self);\n                        }\n                    }\n                }\n            }\n\n            static void SelectedEnumeratorDisposeAsyncCore(object state)\n            {\n                var self = (_SelectManyAwait)state;\n\n                if (self.TryGetResult(self.selectedDisposeAsyncAwaiter))\n                {\n                    self.selectedEnumerator = null;\n                    self.selectedAwaiter = default;\n\n                    self.MoveNextSource(); // iterate next source\n                }\n            }\n\n            static void SelectorAwaitCore(object state)\n            {\n                var self = (_SelectManyAwait)state;\n\n                if (self.TryGetResult(self.collectionSelectorAwaiter, out var result))\n                {\n                    self.selectedEnumerator = result.GetAsyncEnumerator(self.cancellationToken);\n                    self.MoveNextSelected(); // iterated selected source.\n                }\n            }\n\n            static void ResultSelectorAwaitCore(object state)\n            {\n                var self = (_SelectManyAwait)state;\n\n                if (self.TryGetResult(self.resultSelectorAwaiter, out var result))\n                {\n                    self.Current = result;\n                    self.completionSource.TrySetResult(true);\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (selectedEnumerator != null)\n                {\n                    await selectedEnumerator.DisposeAsync();\n                }\n                if (sourceEnumerator != null)\n                {\n                    await sourceEnumerator.DisposeAsync();\n                }\n            }\n        }\n    }\n\n    internal sealed class SelectManyAwaitWithCancellation<TSource, TCollection, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, CancellationToken, UniTask<IUniTaskAsyncEnumerable<TCollection>>> selector1;\n        readonly Func<TSource, int, CancellationToken, UniTask<IUniTaskAsyncEnumerable<TCollection>>> selector2;\n        readonly Func<TSource, TCollection, CancellationToken, UniTask<TResult>> resultSelector;\n\n        public SelectManyAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<IUniTaskAsyncEnumerable<TCollection>>> selector, Func<TSource, TCollection, CancellationToken, UniTask<TResult>> resultSelector)\n        {\n            this.source = source;\n            this.selector1 = selector;\n            this.selector2 = null;\n            this.resultSelector = resultSelector;\n        }\n\n        public SelectManyAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, CancellationToken, UniTask<IUniTaskAsyncEnumerable<TCollection>>> selector, Func<TSource, TCollection, CancellationToken, UniTask<TResult>> resultSelector)\n        {\n            this.source = source;\n            this.selector1 = null;\n            this.selector2 = selector;\n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _SelectManyAwaitWithCancellation(source, selector1, selector2, resultSelector, cancellationToken);\n        }\n\n        sealed class _SelectManyAwaitWithCancellation : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> sourceMoveNextCoreDelegate = SourceMoveNextCore;\n            static readonly Action<object> selectedSourceMoveNextCoreDelegate = SeletedSourceMoveNextCore;\n            static readonly Action<object> selectedEnumeratorDisposeAsyncCoreDelegate = SelectedEnumeratorDisposeAsyncCore;\n            static readonly Action<object> selectorAwaitCoreDelegate = SelectorAwaitCore;\n            static readonly Action<object> resultSelectorAwaitCoreDelegate = ResultSelectorAwaitCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n\n            readonly Func<TSource, CancellationToken, UniTask<IUniTaskAsyncEnumerable<TCollection>>> selector1;\n            readonly Func<TSource, int, CancellationToken, UniTask<IUniTaskAsyncEnumerable<TCollection>>> selector2;\n            readonly Func<TSource, TCollection, CancellationToken, UniTask<TResult>> resultSelector;\n            CancellationToken cancellationToken;\n\n            TSource sourceCurrent;\n            int sourceIndex;\n            IUniTaskAsyncEnumerator<TSource> sourceEnumerator;\n            IUniTaskAsyncEnumerator<TCollection> selectedEnumerator;\n            UniTask<bool>.Awaiter sourceAwaiter;\n            UniTask<bool>.Awaiter selectedAwaiter;\n            UniTask.Awaiter selectedDisposeAsyncAwaiter;\n\n            // await additional\n            UniTask<IUniTaskAsyncEnumerable<TCollection>>.Awaiter collectionSelectorAwaiter;\n            UniTask<TResult>.Awaiter resultSelectorAwaiter;\n\n            public _SelectManyAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<IUniTaskAsyncEnumerable<TCollection>>> selector1, Func<TSource, int, CancellationToken, UniTask<IUniTaskAsyncEnumerable<TCollection>>> selector2, Func<TSource, TCollection, CancellationToken, UniTask<TResult>> resultSelector, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.selector1 = selector1;\n                this.selector2 = selector2;\n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                completionSource.Reset();\n\n                // iterate selected field\n                if (selectedEnumerator != null)\n                {\n                    MoveNextSelected();\n                }\n                else\n                {\n                    // iterate source field\n                    if (sourceEnumerator == null)\n                    {\n                        sourceEnumerator = source.GetAsyncEnumerator(cancellationToken);\n                    }\n                    MoveNextSource();\n                }\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNextSource()\n            {\n                try\n                {\n                    sourceAwaiter = sourceEnumerator.MoveNextAsync().GetAwaiter();\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                if (sourceAwaiter.IsCompleted)\n                {\n                    SourceMoveNextCore(this);\n                }\n                else\n                {\n                    sourceAwaiter.SourceOnCompleted(sourceMoveNextCoreDelegate, this);\n                }\n            }\n\n            void MoveNextSelected()\n            {\n                try\n                {\n                    selectedAwaiter = selectedEnumerator.MoveNextAsync().GetAwaiter();\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                if (selectedAwaiter.IsCompleted)\n                {\n                    SeletedSourceMoveNextCore(this);\n                }\n                else\n                {\n                    selectedAwaiter.SourceOnCompleted(selectedSourceMoveNextCoreDelegate, this);\n                }\n            }\n\n            static void SourceMoveNextCore(object state)\n            {\n                var self = (_SelectManyAwaitWithCancellation)state;\n\n                if (self.TryGetResult(self.sourceAwaiter, out var result))\n                {\n                    if (result)\n                    {\n                        try\n                        {\n                            self.sourceCurrent = self.sourceEnumerator.Current;\n\n                            if (self.selector1 != null)\n                            {\n                                self.collectionSelectorAwaiter = self.selector1(self.sourceCurrent, self.cancellationToken).GetAwaiter();\n                            }\n                            else\n                            {\n                                self.collectionSelectorAwaiter = self.selector2(self.sourceCurrent, checked(self.sourceIndex++), self.cancellationToken).GetAwaiter();\n                            }\n\n                            if (self.collectionSelectorAwaiter.IsCompleted)\n                            {\n                                SelectorAwaitCore(self);\n                            }\n                            else\n                            {\n                                self.collectionSelectorAwaiter.SourceOnCompleted(selectorAwaitCoreDelegate, self);\n                            }\n                        }\n                        catch (Exception ex)\n                        {\n                            self.completionSource.TrySetException(ex);\n                            return;\n                        }\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            static void SeletedSourceMoveNextCore(object state)\n            {\n                var self = (_SelectManyAwaitWithCancellation)state;\n\n                if (self.TryGetResult(self.selectedAwaiter, out var result))\n                {\n                    if (result)\n                    {\n                        try\n                        {\n                            self.resultSelectorAwaiter = self.resultSelector(self.sourceCurrent, self.selectedEnumerator.Current, self.cancellationToken).GetAwaiter();\n                            if (self.resultSelectorAwaiter.IsCompleted)\n                            {\n                                ResultSelectorAwaitCore(self);\n                            }\n                            else\n                            {\n                                self.resultSelectorAwaiter.SourceOnCompleted(resultSelectorAwaitCoreDelegate, self);\n                            }\n                        }\n                        catch (Exception ex)\n                        {\n                            self.completionSource.TrySetException(ex);\n                            return;\n                        }\n                    }\n                    else\n                    {\n                        // dispose selected source and try iterate source.\n                        try\n                        {\n                            self.selectedDisposeAsyncAwaiter = self.selectedEnumerator.DisposeAsync().GetAwaiter();\n                        }\n                        catch (Exception ex)\n                        {\n                            self.completionSource.TrySetException(ex);\n                            return;\n                        }\n                        if (self.selectedDisposeAsyncAwaiter.IsCompleted)\n                        {\n                            SelectedEnumeratorDisposeAsyncCore(self);\n                        }\n                        else\n                        {\n                            self.selectedDisposeAsyncAwaiter.SourceOnCompleted(selectedEnumeratorDisposeAsyncCoreDelegate, self);\n                        }\n                    }\n                }\n            }\n\n            static void SelectedEnumeratorDisposeAsyncCore(object state)\n            {\n                var self = (_SelectManyAwaitWithCancellation)state;\n\n                if (self.TryGetResult(self.selectedDisposeAsyncAwaiter))\n                {\n                    self.selectedEnumerator = null;\n                    self.selectedAwaiter = default;\n\n                    self.MoveNextSource(); // iterate next source\n                }\n            }\n\n            static void SelectorAwaitCore(object state)\n            {\n                var self = (_SelectManyAwaitWithCancellation)state;\n\n                if (self.TryGetResult(self.collectionSelectorAwaiter, out var result))\n                {\n                    self.selectedEnumerator = result.GetAsyncEnumerator(self.cancellationToken);\n                    self.MoveNextSelected(); // iterated selected source.\n                }\n            }\n\n            static void ResultSelectorAwaitCore(object state)\n            {\n                var self = (_SelectManyAwaitWithCancellation)state;\n\n                if (self.TryGetResult(self.resultSelectorAwaiter, out var result))\n                {\n                    self.Current = result;\n                    self.completionSource.TrySetResult(true);\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (selectedEnumerator != null)\n                {\n                    await selectedEnumerator.DisposeAsync();\n                }\n                if (sourceEnumerator != null)\n                {\n                    await sourceEnumerator.DisposeAsync();\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/SelectMany.cs.meta",
    "content": "fileFormatVersion: 2\nguid: d81862f0eb12680479ccaaf2ac319d24\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/SequenceEqual.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<Boolean> SequenceEqualAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> first, IUniTaskAsyncEnumerable<TSource> second, CancellationToken cancellationToken = default)\n        {\n            return SequenceEqualAsync(first, second, EqualityComparer<TSource>.Default, cancellationToken);\n        }\n\n        public static UniTask<Boolean> SequenceEqualAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> first, IUniTaskAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(first, nameof(first));\n            Error.ThrowArgumentNullException(second, nameof(second));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return SequenceEqual.SequenceEqualAsync(first, second, comparer, cancellationToken);\n        }\n    }\n\n    internal static class SequenceEqual\n    {\n        internal static async UniTask<bool> SequenceEqualAsync<TSource>(IUniTaskAsyncEnumerable<TSource> first, IUniTaskAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken)\n        {\n            var e1 = first.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                var e2 = second.GetAsyncEnumerator(cancellationToken);\n                try\n                {\n                    while (true)\n                    {\n                        if (await e1.MoveNextAsync())\n                        {\n                            if (await e2.MoveNextAsync())\n                            {\n                                if (comparer.Equals(e1.Current, e2.Current))\n                                {\n                                    continue;\n                                }\n                                else\n                                {\n                                    return false;\n                                }\n                            }\n                            else\n                            {\n                                // e2 is finished, but e1 has value\n                                return false;\n                            }\n                        }\n                        else\n                        {\n                            // e1 is finished, e2?\n                            if (await e2.MoveNextAsync())\n                            {\n                                return false;\n                            }\n                            else\n                            {\n                                return true;\n                            }\n                        }\n                    }\n                }\n                finally\n                {\n                    if (e2 != null)\n                    {\n                        await e2.DisposeAsync();\n                    }\n                }\n            }\n            finally\n            {\n                if (e1 != null)\n                {\n                    await e1.DisposeAsync();\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/SequenceEqual.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b382772aba6128842928cdb6b2e034b0\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Single.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<TSource> SingleAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return SingleOperator.SingleAsync(source, cancellationToken, false);\n        }\n\n        public static UniTask<TSource> SingleAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return SingleOperator.SingleAsync(source, predicate, cancellationToken, false);\n        }\n\n        public static UniTask<TSource> SingleAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return SingleOperator.SingleAwaitAsync(source, predicate, cancellationToken, false);\n        }\n\n        public static UniTask<TSource> SingleAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return SingleOperator.SingleAwaitWithCancellationAsync(source, predicate, cancellationToken, false);\n        }\n\n        public static UniTask<TSource> SingleOrDefaultAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return SingleOperator.SingleAsync(source, cancellationToken, true);\n        }\n\n        public static UniTask<TSource> SingleOrDefaultAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return SingleOperator.SingleAsync(source, predicate, cancellationToken, true);\n        }\n\n        public static UniTask<TSource> SingleOrDefaultAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return SingleOperator.SingleAwaitAsync(source, predicate, cancellationToken, true);\n        }\n\n        public static UniTask<TSource> SingleOrDefaultAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return SingleOperator.SingleAwaitWithCancellationAsync(source, predicate, cancellationToken, true);\n        }\n    }\n\n    internal static class SingleOperator\n    {\n        public static async UniTask<TSource> SingleAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken, bool defaultIfEmpty)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                if (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    if (!await e.MoveNextAsync())\n                    {\n                        return v;\n                    }\n\n                    throw Error.MoreThanOneElement();\n                }\n                else\n                {\n                    if (defaultIfEmpty)\n                    {\n                        return default;\n                    }\n                    else\n                    {\n                        throw Error.NoElements();\n                    }\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTask<TSource> SingleAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate, CancellationToken cancellationToken, bool defaultIfEmpty)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                TSource value = default;\n                bool found = false;\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    if (predicate(v))\n                    {\n                        if (found)\n                        {\n                            throw Error.MoreThanOneElement();\n                        }\n                        else\n                        {\n                            found = true;\n                            value = v;\n                        }\n                    }\n                }\n\n                if (found || defaultIfEmpty)\n                {\n                    return value;\n                }\n\n                throw Error.NoElements();\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTask<TSource> SingleAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate, CancellationToken cancellationToken, bool defaultIfEmpty)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                TSource value = default;\n                bool found = false;\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    if (await predicate(v))\n                    {\n                        if (found)\n                        {\n                            throw Error.MoreThanOneElement();\n                        }\n                        else\n                        {\n                            found = true;\n                            value = v;\n                        }\n                    }\n                }\n\n                if (found || defaultIfEmpty)\n                {\n                    return value;\n                }\n\n                throw Error.NoElements();\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTask<TSource> SingleAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate, CancellationToken cancellationToken, bool defaultIfEmpty)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                TSource value = default;\n                bool found = false;\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    if (await predicate(v, cancellationToken))\n                    {\n                        if (found)\n                        {\n                            throw Error.MoreThanOneElement();\n                        }\n                        else\n                        {\n                            found = true;\n                            value = v;\n                        }\n                    }\n                }\n\n                if (found || defaultIfEmpty)\n                {\n                    return value;\n                }\n\n                throw Error.NoElements();\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Single.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 1bcd3928b90472e43a3a92c3ba708967\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Skip.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> Skip<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Int32 count)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new Skip<TSource>(source, count);\n        }\n    }\n\n    internal sealed class Skip<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly int count;\n\n        public Skip(IUniTaskAsyncEnumerable<TSource> source, int count)\n        {\n            this.source = source;\n            this.count = count;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Skip(source, count, cancellationToken);\n        }\n\n        sealed class _Skip : AsyncEnumeratorBase<TSource, TSource>\n        {\n            readonly int count;\n\n            int index;\n\n            public _Skip(IUniTaskAsyncEnumerable<TSource> source, int count, CancellationToken cancellationToken)\n                : base(source, cancellationToken)\n            {\n                this.count = count;\n            }\n\n            protected override bool TryMoveNextCore(bool sourceHasCurrent, out bool result)\n            {\n                if (sourceHasCurrent)\n                {\n                    if (count <= checked(index++))\n                    {\n                        Current = SourceCurrent;\n                        result = true;\n                        return true;\n                    }\n                    else\n                    {\n                        result = default;\n                        return false;\n                    }\n                }\n                else\n                {\n                    result = false;\n                    return true;\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Skip.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 9c46b6c7dce0cb049a73c81084c75154\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/SkipLast.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> SkipLast<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Int32 count)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            // non skip.\n            if (count <= 0)\n            {\n                return source;\n            }\n\n            return new SkipLast<TSource>(source, count);\n        }\n    }\n\n    internal sealed class SkipLast<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly int count;\n\n        public SkipLast(IUniTaskAsyncEnumerable<TSource> source, int count)\n        {\n            this.source = source;\n            this.count = count;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _SkipLast(source, count, cancellationToken);\n        }\n\n        sealed class _SkipLast : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly int count;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            Queue<TSource> queue;\n\n            bool continueNext;\n\n            public _SkipLast(IUniTaskAsyncEnumerable<TSource> source, int count, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.count = count;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                if (enumerator == null)\n                {\n                    enumerator = source.GetAsyncEnumerator(cancellationToken);\n                    queue = new Queue<TSource>();\n                }\n\n                completionSource.Reset();\n                SourceMoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n\n                    LOOP:\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        continueNext = true;\n                        MoveNextCore(this);\n                        if (continueNext)\n                        {\n                            continueNext = false;\n                            goto LOOP; // avoid recursive\n                        }\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                }\n            }\n\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_SkipLast)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        if (self.queue.Count == self.count)\n                        {\n                            self.continueNext = false;\n\n                            var deq = self.queue.Dequeue();\n                            self.Current = deq;\n                            self.queue.Enqueue(self.enumerator.Current);\n\n                            self.completionSource.TrySetResult(true);\n                        }\n                        else\n                        {\n                            self.queue.Enqueue(self.enumerator.Current);\n\n                            if (!self.continueNext)\n                            {\n                                self.SourceMoveNext();\n                            }\n                        }\n                    }\n                    else\n                    {\n                        self.continueNext = false;\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n                else\n                {\n                    self.continueNext = false;\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/SkipLast.cs.meta",
    "content": "fileFormatVersion: 2\nguid: df1d7f44d4fe7754f972c9e0b6fa72d5\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/SkipUntil.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> SkipUntil<TSource>(this IUniTaskAsyncEnumerable<TSource> source, UniTask other)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new SkipUntil<TSource>(source, other, null);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> SkipUntil<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<CancellationToken, UniTask> other)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(other));\n\n            return new SkipUntil<TSource>(source, default, other);\n        }\n    }\n\n    internal sealed class SkipUntil<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly UniTask other;\n        readonly Func<CancellationToken, UniTask> other2;\n\n        public SkipUntil(IUniTaskAsyncEnumerable<TSource> source, UniTask other, Func<CancellationToken, UniTask> other2)\n        {\n            this.source = source;\n            this.other = other;\n            this.other2 = other2;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            if (other2 != null)\n            {\n                return new _SkipUntil(source, this.other2(cancellationToken), cancellationToken);\n            }\n            else\n            {\n                return new _SkipUntil(source, this.other, cancellationToken);\n            }\n        }\n\n        sealed class _SkipUntil : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            static readonly Action<object> CancelDelegate1 = OnCanceled1;\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            CancellationToken cancellationToken1;\n\n            bool completed;\n            CancellationTokenRegistration cancellationTokenRegistration1;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            bool continueNext;\n            Exception exception;\n\n            public _SkipUntil(IUniTaskAsyncEnumerable<TSource> source, UniTask other, CancellationToken cancellationToken1)\n            {\n                this.source = source;\n                this.cancellationToken1 = cancellationToken1;\n                if (cancellationToken1.CanBeCanceled)\n                {\n                    this.cancellationTokenRegistration1 = cancellationToken1.RegisterWithoutCaptureExecutionContext(CancelDelegate1, this);\n                }\n\n                TaskTracker.TrackActiveTask(this, 3);\n                RunOther(other).Forget();\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (exception != null)\n                {\n                    return UniTask.FromException<bool>(exception);\n                }\n\n                if (cancellationToken1.IsCancellationRequested)\n                {\n                    return UniTask.FromCanceled<bool>(cancellationToken1);\n                }\n\n                if (enumerator == null)\n                {\n                    enumerator = source.GetAsyncEnumerator(cancellationToken1);\n                }\n                completionSource.Reset();\n\n                if (completed)\n                {\n                    SourceMoveNext();\n                }\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    LOOP:\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        continueNext = true;\n                        MoveNextCore(this);\n                        if (continueNext)\n                        {\n                            continueNext = false;\n                            goto LOOP;\n                        }\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                }\n            }\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_SkipUntil)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        self.Current = self.enumerator.Current;\n                        self.completionSource.TrySetResult(true);\n                        if (self.continueNext)\n                        {\n                            self.SourceMoveNext();\n                        }\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            async UniTaskVoid RunOther(UniTask other)\n            {\n                try\n                {\n                    await other;\n                    completed = true;\n                    SourceMoveNext();\n                }\n                catch (Exception ex)\n                {\n                    exception = ex;\n                    completionSource.TrySetException(ex);\n                }\n            }\n\n            static void OnCanceled1(object state)\n            {\n                var self = (_SkipUntil)state;\n                self.completionSource.TrySetCanceled(self.cancellationToken1);\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                cancellationTokenRegistration1.Dispose();\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/SkipUntil.cs.meta",
    "content": "fileFormatVersion: 2\nguid: de932d79c8d9f3841a066d05ff29edc9\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/SkipUntilCanceled.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> SkipUntilCanceled<TSource>(this IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new SkipUntilCanceled<TSource>(source, cancellationToken);\n        }\n    }\n\n    internal sealed class SkipUntilCanceled<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly CancellationToken cancellationToken;\n\n        public SkipUntilCanceled(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)\n        {\n            this.source = source;\n            this.cancellationToken = cancellationToken;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _SkipUntilCanceled(source, this.cancellationToken, cancellationToken);\n        }\n\n        sealed class _SkipUntilCanceled : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            static readonly Action<object> CancelDelegate1 = OnCanceled1;\n            static readonly Action<object> CancelDelegate2 = OnCanceled2;\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            CancellationToken cancellationToken1;\n            CancellationToken cancellationToken2;\n            CancellationTokenRegistration cancellationTokenRegistration1;\n            CancellationTokenRegistration cancellationTokenRegistration2;\n\n            int isCanceled;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            bool continueNext;\n\n            public _SkipUntilCanceled(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken1, CancellationToken cancellationToken2)\n            {\n                this.source = source;\n                this.cancellationToken1 = cancellationToken1;\n                this.cancellationToken2 = cancellationToken2;\n                if (cancellationToken1.CanBeCanceled)\n                {\n                    this.cancellationTokenRegistration1 = cancellationToken1.RegisterWithoutCaptureExecutionContext(CancelDelegate1, this);\n                }\n                if (cancellationToken1 != cancellationToken2 && cancellationToken2.CanBeCanceled)\n                {\n                    this.cancellationTokenRegistration2 = cancellationToken2.RegisterWithoutCaptureExecutionContext(CancelDelegate2, this);\n                }\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (enumerator == null)\n                {\n                    if (cancellationToken1.IsCancellationRequested) isCanceled = 1;\n                    if (cancellationToken2.IsCancellationRequested) isCanceled = 1;\n                    enumerator = source.GetAsyncEnumerator(cancellationToken2); // use only AsyncEnumerator provided token.\n                }\n                completionSource.Reset();\n\n                if (isCanceled != 0)\n                {\n                    SourceMoveNext();\n                }\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    LOOP:\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        continueNext = true;\n                        MoveNextCore(this);\n                        if (continueNext)\n                        {\n                            continueNext = false;\n                            goto LOOP;\n                        }\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                }\n            }\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_SkipUntilCanceled)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        self.Current = self.enumerator.Current;\n                        self.completionSource.TrySetResult(true);\n                        if (self.continueNext)\n                        {\n                            self.SourceMoveNext();\n                        }\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            static void OnCanceled1(object state)\n            {\n                var self = (_SkipUntilCanceled)state;\n                if (self.isCanceled == 0)\n                {\n                    if (Interlocked.Increment(ref self.isCanceled) == 1)\n                    {\n                        self.cancellationTokenRegistration2.Dispose();\n                        self.SourceMoveNext();\n                    }\n                }\n            }\n\n            static void OnCanceled2(object state)\n            {\n                var self = (_SkipUntilCanceled)state;\n                if (self.isCanceled == 0)\n                {\n                    if (Interlocked.Increment(ref self.isCanceled) == 1)\n                    {\n                        self.cancellationTokenRegistration2.Dispose();\n                        self.SourceMoveNext();\n                    }\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                cancellationTokenRegistration1.Dispose();\n                cancellationTokenRegistration2.Dispose();\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/SkipUntilCanceled.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 4b1a778aef7150d47b93a49aa1bc34ae\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/SkipWhile.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> SkipWhile<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new SkipWhile<TSource>(source, predicate);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> SkipWhile<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, Boolean> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new SkipWhileInt<TSource>(source, predicate);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> SkipWhileAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new SkipWhileAwait<TSource>(source, predicate);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> SkipWhileAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, UniTask<Boolean>> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new SkipWhileIntAwait<TSource>(source, predicate);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> SkipWhileAwaitWithCancellation<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new SkipWhileAwaitWithCancellation<TSource>(source, predicate);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> SkipWhileAwaitWithCancellation<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, CancellationToken, UniTask<Boolean>> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new SkipWhileIntAwaitWithCancellation<TSource>(source, predicate);\n        }\n    }\n\n    internal sealed class SkipWhile<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, bool> predicate;\n\n        public SkipWhile(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, bool> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _SkipWhile(source, predicate, cancellationToken);\n        }\n\n        class _SkipWhile : AsyncEnumeratorBase<TSource, TSource>\n        {\n            Func<TSource, bool> predicate;\n\n            public _SkipWhile(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, bool> predicate, CancellationToken cancellationToken)\n\n                : base(source, cancellationToken)\n            {\n                this.predicate = predicate;\n            }\n\n            protected override bool TryMoveNextCore(bool sourceHasCurrent, out bool result)\n            {\n                if (sourceHasCurrent)\n                {\n                    if (predicate == null || !predicate(SourceCurrent))\n                    {\n                        predicate = null;\n                        Current = SourceCurrent;\n                        result = true;\n                        return true;\n                    }\n                    else\n                    {\n                        result = default;\n                        return false;\n                    }\n                }\n\n                result = false;\n                return true;\n            }\n        }\n    }\n\n    internal sealed class SkipWhileInt<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, int, bool> predicate;\n\n        public SkipWhileInt(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, bool> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _SkipWhileInt(source, predicate, cancellationToken);\n        }\n\n        class _SkipWhileInt : AsyncEnumeratorBase<TSource, TSource>\n        {\n            Func<TSource, int, bool> predicate;\n            int index;\n\n            public _SkipWhileInt(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, bool> predicate, CancellationToken cancellationToken)\n\n                : base(source, cancellationToken)\n            {\n                this.predicate = predicate;\n            }\n\n            protected override bool TryMoveNextCore(bool sourceHasCurrent, out bool result)\n            {\n                if (sourceHasCurrent)\n                {\n                    if (predicate == null || !predicate(SourceCurrent, checked(index++)))\n                    {\n                        predicate = null;\n                        Current = SourceCurrent;\n                        result = true;\n                        return true;\n                    }\n                    else\n                    {\n                        result = default;\n                        return false;\n                    }\n                }\n\n                result = false;\n                return true;\n            }\n        }\n    }\n\n    internal sealed class SkipWhileAwait<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, UniTask<bool>> predicate;\n\n        public SkipWhileAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<bool>> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _SkipWhileAwait(source, predicate, cancellationToken);\n        }\n\n        class _SkipWhileAwait : AsyncEnumeratorAwaitSelectorBase<TSource, TSource, bool>\n        {\n            Func<TSource, UniTask<bool>> predicate;\n\n            public _SkipWhileAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<bool>> predicate, CancellationToken cancellationToken)\n\n                : base(source, cancellationToken)\n            {\n                this.predicate = predicate;\n            }\n\n            protected override UniTask<bool> TransformAsync(TSource sourceCurrent)\n            {\n                if (predicate == null)\n                {\n                    return CompletedTasks.False;\n                }\n\n                return predicate(sourceCurrent);\n            }\n\n            protected override bool TrySetCurrentCore(bool awaitResult, out bool terminateIteration)\n            {\n                if (!awaitResult)\n                {\n                    predicate = null;\n                    Current = SourceCurrent;\n                    terminateIteration= false;\n                    return true;\n                }\n                else\n                {\n                    terminateIteration= false;\n                    return false;\n                }\n            }\n        }\n    }\n\n    internal sealed class SkipWhileIntAwait<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, int, UniTask<bool>> predicate;\n\n        public SkipWhileIntAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, UniTask<bool>> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _SkipWhileIntAwait(source, predicate, cancellationToken);\n        }\n\n        class _SkipWhileIntAwait : AsyncEnumeratorAwaitSelectorBase<TSource, TSource, bool>\n        {\n            Func<TSource, int, UniTask<bool>> predicate;\n            int index;\n\n            public _SkipWhileIntAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, UniTask<bool>> predicate, CancellationToken cancellationToken)\n\n                : base(source, cancellationToken)\n            {\n                this.predicate = predicate;\n            }\n\n            protected override UniTask<bool> TransformAsync(TSource sourceCurrent)\n            {\n                if (predicate == null)\n                {\n                    return CompletedTasks.False;\n                }\n\n                return predicate(sourceCurrent, checked(index++));\n            }\n\n            protected override bool TrySetCurrentCore(bool awaitResult, out bool terminateIteration)\n            {\n                terminateIteration= false;\n                if (!awaitResult)\n                {\n                    predicate = null;\n                    Current = SourceCurrent;\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n        }\n    }\n\n    internal sealed class SkipWhileAwaitWithCancellation<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, CancellationToken, UniTask<bool>> predicate;\n\n        public SkipWhileAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<bool>> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _SkipWhileAwaitWithCancellation(source, predicate, cancellationToken);\n        }\n\n        class _SkipWhileAwaitWithCancellation : AsyncEnumeratorAwaitSelectorBase<TSource, TSource, bool>\n        {\n            Func<TSource, CancellationToken, UniTask<bool>> predicate;\n\n            public _SkipWhileAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<bool>> predicate, CancellationToken cancellationToken)\n\n                : base(source, cancellationToken)\n            {\n                this.predicate = predicate;\n            }\n\n            protected override UniTask<bool> TransformAsync(TSource sourceCurrent)\n            {\n                if (predicate == null)\n                {\n                    return CompletedTasks.False;\n                }\n\n                return predicate(sourceCurrent, cancellationToken);\n            }\n\n            protected override bool TrySetCurrentCore(bool awaitResult, out bool terminateIteration)\n            {\n                terminateIteration= false;\n                if (!awaitResult)\n                {\n                    predicate = null;\n                    Current = SourceCurrent;\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n        }\n    }\n\n    internal sealed class SkipWhileIntAwaitWithCancellation<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, int, CancellationToken, UniTask<bool>> predicate;\n\n        public SkipWhileIntAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, CancellationToken, UniTask<bool>> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _SkipWhileIntAwaitWithCancellation(source, predicate, cancellationToken);\n        }\n\n        class _SkipWhileIntAwaitWithCancellation : AsyncEnumeratorAwaitSelectorBase<TSource, TSource, bool>\n        {\n            Func<TSource, int, CancellationToken, UniTask<bool>> predicate;\n            int index;\n\n            public _SkipWhileIntAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, CancellationToken, UniTask<bool>> predicate, CancellationToken cancellationToken)\n\n                : base(source, cancellationToken)\n            {\n                this.predicate = predicate;\n            }\n\n            protected override UniTask<bool> TransformAsync(TSource sourceCurrent)\n            {\n                if (predicate == null)\n                {\n                    return CompletedTasks.False;\n                }\n\n                return predicate(sourceCurrent, checked(index++), cancellationToken);\n            }\n\n            protected override bool TrySetCurrentCore(bool awaitResult, out bool terminateIteration)\n            {\n                terminateIteration= false;\n                if (!awaitResult)\n                {\n                    predicate = null;\n                    Current = SourceCurrent;\n                    return true;\n                }\n                else\n                {\n                    return false;\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/SkipWhile.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 0b74b9fe361bf7148b51a29c8b2561e8\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Subscribe.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\nusing Subscribes = Cysharp.Threading.Tasks.Linq.Subscribe;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        // OnNext\n\n        public static IDisposable Subscribe<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Action<TSource> action)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(action, nameof(action));\n\n            var cts = new CancellationTokenDisposable();\n            Subscribes.SubscribeCore(source, action, Subscribes.NopError, Subscribes.NopCompleted, cts.Token).Forget();\n            return cts;\n        }\n\n        public static IDisposable Subscribe<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTaskVoid> action)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(action, nameof(action));\n\n            var cts = new CancellationTokenDisposable();\n            Subscribes.SubscribeCore(source, action, Subscribes.NopError, Subscribes.NopCompleted, cts.Token).Forget();\n            return cts;\n        }\n\n        public static IDisposable Subscribe<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTaskVoid> action)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(action, nameof(action));\n\n            var cts = new CancellationTokenDisposable();\n            Subscribes.SubscribeCore(source, action, Subscribes.NopError, Subscribes.NopCompleted, cts.Token).Forget();\n            return cts;\n        }\n\n        public static void Subscribe<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Action<TSource> action, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(action, nameof(action));\n\n            Subscribes.SubscribeCore(source, action, Subscribes.NopError, Subscribes.NopCompleted, cancellationToken).Forget();\n        }\n\n        public static void Subscribe<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTaskVoid> action, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(action, nameof(action));\n\n            Subscribes.SubscribeCore(source, action, Subscribes.NopError, Subscribes.NopCompleted, cancellationToken).Forget();\n        }\n\n        public static void Subscribe<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTaskVoid> action, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(action, nameof(action));\n\n            Subscribes.SubscribeCore(source, action, Subscribes.NopError, Subscribes.NopCompleted, cancellationToken).Forget();\n        }\n\n        public static IDisposable SubscribeAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask> onNext)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n\n            var cts = new CancellationTokenDisposable();\n            Subscribes.SubscribeAwaitCore(source, onNext, Subscribes.NopError, Subscribes.NopCompleted, cts.Token).Forget();\n            return cts;\n        }\n\n        public static void SubscribeAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask> onNext, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n\n            Subscribes.SubscribeAwaitCore(source, onNext, Subscribes.NopError, Subscribes.NopCompleted, cancellationToken).Forget();\n        }\n\n        public static IDisposable SubscribeAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask> onNext)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n\n            var cts = new CancellationTokenDisposable();\n            Subscribes.SubscribeAwaitCore(source, onNext, Subscribes.NopError, Subscribes.NopCompleted, cts.Token).Forget();\n            return cts;\n        }\n\n        public static void SubscribeAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask> onNext, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n\n            Subscribes.SubscribeAwaitCore(source, onNext, Subscribes.NopError, Subscribes.NopCompleted, cancellationToken).Forget();\n        }\n\n        // OnNext, OnError\n\n        public static IDisposable Subscribe<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n            Error.ThrowArgumentNullException(onError, nameof(onError));\n\n            var cts = new CancellationTokenDisposable();\n            Subscribes.SubscribeCore(source, onNext, onError, Subscribes.NopCompleted, cts.Token).Forget();\n            return cts;\n        }\n\n        public static IDisposable Subscribe<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTaskVoid> onNext, Action<Exception> onError)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n            Error.ThrowArgumentNullException(onError, nameof(onError));\n\n            var cts = new CancellationTokenDisposable();\n            Subscribes.SubscribeCore(source, onNext, onError, Subscribes.NopCompleted, cts.Token).Forget();\n            return cts;\n        }\n\n        public static void Subscribe<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n            Error.ThrowArgumentNullException(onError, nameof(onError));\n\n            Subscribes.SubscribeCore(source, onNext, onError, Subscribes.NopCompleted, cancellationToken).Forget();\n        }\n\n        public static void Subscribe<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTaskVoid> onNext, Action<Exception> onError, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n            Error.ThrowArgumentNullException(onError, nameof(onError));\n\n            Subscribes.SubscribeCore(source, onNext, onError, Subscribes.NopCompleted, cancellationToken).Forget();\n        }\n\n        public static IDisposable SubscribeAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask> onNext, Action<Exception> onError)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n            Error.ThrowArgumentNullException(onError, nameof(onError));\n\n            var cts = new CancellationTokenDisposable();\n            Subscribes.SubscribeAwaitCore(source, onNext, onError, Subscribes.NopCompleted, cts.Token).Forget();\n            return cts;\n        }\n\n        public static void SubscribeAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask> onNext, Action<Exception> onError, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n            Error.ThrowArgumentNullException(onError, nameof(onError));\n\n            Subscribes.SubscribeAwaitCore(source, onNext, onError, Subscribes.NopCompleted, cancellationToken).Forget();\n        }\n\n        public static IDisposable SubscribeAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask> onNext, Action<Exception> onError)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n            Error.ThrowArgumentNullException(onError, nameof(onError));\n\n            var cts = new CancellationTokenDisposable();\n            Subscribes.SubscribeAwaitCore(source, onNext, onError, Subscribes.NopCompleted, cts.Token).Forget();\n            return cts;\n        }\n\n        public static void SubscribeAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask> onNext, Action<Exception> onError, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n            Error.ThrowArgumentNullException(onError, nameof(onError));\n\n            Subscribes.SubscribeAwaitCore(source, onNext, onError, Subscribes.NopCompleted, cancellationToken).Forget();\n        }\n\n        // OnNext, OnCompleted\n\n        public static IDisposable Subscribe<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Action<TSource> onNext, Action onCompleted)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n            Error.ThrowArgumentNullException(onCompleted, nameof(onCompleted));\n\n            var cts = new CancellationTokenDisposable();\n            Subscribes.SubscribeCore(source, onNext, Subscribes.NopError, onCompleted, cts.Token).Forget();\n            return cts;\n        }\n\n        public static IDisposable Subscribe<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTaskVoid> onNext, Action onCompleted)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n            Error.ThrowArgumentNullException(onCompleted, nameof(onCompleted));\n\n            var cts = new CancellationTokenDisposable();\n            Subscribes.SubscribeCore(source, onNext, Subscribes.NopError, onCompleted, cts.Token).Forget();\n            return cts;\n        }\n\n        public static void Subscribe<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Action<TSource> onNext, Action onCompleted, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n            Error.ThrowArgumentNullException(onCompleted, nameof(onCompleted));\n\n            Subscribes.SubscribeCore(source, onNext, Subscribes.NopError, onCompleted, cancellationToken).Forget();\n        }\n\n        public static void Subscribe<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTaskVoid> onNext, Action onCompleted, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n            Error.ThrowArgumentNullException(onCompleted, nameof(onCompleted));\n\n            Subscribes.SubscribeCore(source, onNext, Subscribes.NopError, onCompleted, cancellationToken).Forget();\n        }\n\n        public static IDisposable SubscribeAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask> onNext, Action onCompleted)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n            Error.ThrowArgumentNullException(onCompleted, nameof(onCompleted));\n\n            var cts = new CancellationTokenDisposable();\n            Subscribes.SubscribeAwaitCore(source, onNext, Subscribes.NopError, onCompleted, cts.Token).Forget();\n            return cts;\n        }\n\n        public static void SubscribeAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask> onNext, Action onCompleted, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n            Error.ThrowArgumentNullException(onCompleted, nameof(onCompleted));\n\n            Subscribes.SubscribeAwaitCore(source, onNext, Subscribes.NopError, onCompleted, cancellationToken).Forget();\n        }\n\n        public static IDisposable SubscribeAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask> onNext, Action onCompleted)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n            Error.ThrowArgumentNullException(onCompleted, nameof(onCompleted));\n\n            var cts = new CancellationTokenDisposable();\n            Subscribes.SubscribeAwaitCore(source, onNext, Subscribes.NopError, onCompleted, cts.Token).Forget();\n            return cts;\n        }\n\n        public static void SubscribeAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask> onNext, Action onCompleted, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(onNext, nameof(onNext));\n            Error.ThrowArgumentNullException(onCompleted, nameof(onCompleted));\n\n            Subscribes.SubscribeAwaitCore(source, onNext, Subscribes.NopError, onCompleted, cancellationToken).Forget();\n        }\n\n        // IObserver\n\n        public static IDisposable Subscribe<TSource>(this IUniTaskAsyncEnumerable<TSource> source, IObserver<TSource> observer)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(observer, nameof(observer));\n\n            var cts = new CancellationTokenDisposable();\n            Subscribes.SubscribeCore(source, observer, cts.Token).Forget();\n            return cts;\n        }\n\n        public static void Subscribe<TSource>(this IUniTaskAsyncEnumerable<TSource> source, IObserver<TSource> observer, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(observer, nameof(observer));\n\n            Subscribes.SubscribeCore(source, observer, cancellationToken).Forget();\n        }\n    }\n\n    internal sealed class CancellationTokenDisposable : IDisposable\n    {\n        readonly CancellationTokenSource cts = new CancellationTokenSource();\n\n        public CancellationToken Token => cts.Token;\n\n        public void Dispose()\n        {\n            if (!cts.IsCancellationRequested)\n            {\n                cts.Cancel();\n            }\n        }\n    }\n\n    internal static class Subscribe\n    {\n        public static readonly Action<Exception> NopError = _ => { };\n        public static readonly Action NopCompleted = () => { };\n\n        public static async UniTaskVoid SubscribeCore<TSource>(IUniTaskAsyncEnumerable<TSource> source, Action<TSource> onNext, Action<Exception> onError, Action onCompleted, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    try\n                    {\n                        onNext(e.Current);\n                    }\n                    catch (Exception ex)\n                    {\n                        UniTaskScheduler.PublishUnobservedTaskException(ex);\n                    }\n                }\n                onCompleted();\n            }\n            catch (Exception ex)\n            {\n                if (onError == NopError)\n                {\n                    UniTaskScheduler.PublishUnobservedTaskException(ex);\n                    return;\n                }\n\n                if (ex is OperationCanceledException) return;\n\n                onError(ex);\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTaskVoid SubscribeCore<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTaskVoid> onNext, Action<Exception> onError, Action onCompleted, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    try\n                    {\n                        onNext(e.Current).Forget();\n                    }\n                    catch (Exception ex)\n                    {\n                        UniTaskScheduler.PublishUnobservedTaskException(ex);\n                    }\n                }\n                onCompleted();\n            }\n            catch (Exception ex)\n            {\n                if (onError == NopError)\n                {\n                    UniTaskScheduler.PublishUnobservedTaskException(ex);\n                    return;\n                }\n\n                if (ex is OperationCanceledException) return;\n\n                onError(ex);\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTaskVoid SubscribeCore<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTaskVoid> onNext, Action<Exception> onError, Action onCompleted, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    try\n                    {\n                        onNext(e.Current, cancellationToken).Forget();\n                    }\n                    catch (Exception ex)\n                    {\n                        UniTaskScheduler.PublishUnobservedTaskException(ex);\n                    }\n                }\n                onCompleted();\n            }\n            catch (Exception ex)\n            {\n                if (onError == NopError)\n                {\n                    UniTaskScheduler.PublishUnobservedTaskException(ex);\n                    return;\n                }\n\n                if (ex is OperationCanceledException) return;\n\n                onError(ex);\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTaskVoid SubscribeCore<TSource>(IUniTaskAsyncEnumerable<TSource> source, IObserver<TSource> observer, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    try\n                    {\n                        observer.OnNext(e.Current);\n                    }\n                    catch (Exception ex)\n                    {\n                        UniTaskScheduler.PublishUnobservedTaskException(ex);\n                    }\n                }\n                observer.OnCompleted();\n            }\n            catch (Exception ex)\n            {\n                if (ex is OperationCanceledException) return;\n\n                observer.OnError(ex);\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTaskVoid SubscribeAwaitCore<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask> onNext, Action<Exception> onError, Action onCompleted, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    try\n                    {\n                        await onNext(e.Current);\n                    }\n                    catch (Exception ex)\n                    {\n                        UniTaskScheduler.PublishUnobservedTaskException(ex);\n                    }\n                }\n                onCompleted();\n            }\n            catch (Exception ex)\n            {\n                if (onError == NopError)\n                {\n                    UniTaskScheduler.PublishUnobservedTaskException(ex);\n                    return;\n                }\n\n                if (ex is OperationCanceledException) return;\n\n                onError(ex);\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        public static async UniTaskVoid SubscribeAwaitCore<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask> onNext, Action<Exception> onError, Action onCompleted, CancellationToken cancellationToken)\n        {\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    try\n                    {\n                        await onNext(e.Current, cancellationToken);\n                    }\n                    catch (Exception ex)\n                    {\n                        UniTaskScheduler.PublishUnobservedTaskException(ex);\n                    }\n                }\n                onCompleted();\n            }\n            catch (Exception ex)\n            {\n                if (onError == NopError)\n                {\n                    UniTaskScheduler.PublishUnobservedTaskException(ex);\n                    return;\n                }\n\n                if (ex is OperationCanceledException) return;\n\n                onError(ex);\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Subscribe.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 263479eb04c189741931fc0e2f615c2d\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Sum.cs",
    "content": "﻿using System;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<Int32> SumAsync(this IUniTaskAsyncEnumerable<Int32> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Sum.SumAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Int32> SumAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int32> SumAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int32>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int32> SumAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int32>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64> SumAsync(this IUniTaskAsyncEnumerable<Int64> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Sum.SumAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Int64> SumAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int64> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64> SumAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int64>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64> SumAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int64>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single> SumAsync(this IUniTaskAsyncEnumerable<Single> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Sum.SumAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Single> SumAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Single> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single> SumAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Single>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single> SumAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Single>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double> SumAsync(this IUniTaskAsyncEnumerable<Double> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Sum.SumAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Double> SumAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Double> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double> SumAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Double>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double> SumAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Double>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal> SumAsync(this IUniTaskAsyncEnumerable<Decimal> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Sum.SumAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Decimal> SumAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Decimal> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal> SumAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Decimal>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal> SumAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Decimal>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int32?> SumAsync(this IUniTaskAsyncEnumerable<Int32?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Sum.SumAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Int32?> SumAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int32?> SumAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int32?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int32?> SumAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int32?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64?> SumAsync(this IUniTaskAsyncEnumerable<Int64?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Sum.SumAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Int64?> SumAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int64?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64?> SumAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int64?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Int64?> SumAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int64?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single?> SumAsync(this IUniTaskAsyncEnumerable<Single?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Sum.SumAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Single?> SumAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Single?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single?> SumAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Single?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Single?> SumAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Single?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double?> SumAsync(this IUniTaskAsyncEnumerable<Double?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Sum.SumAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Double?> SumAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Double?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double?> SumAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Double?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Double?> SumAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Double?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal?> SumAsync(this IUniTaskAsyncEnumerable<Decimal?> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Sum.SumAsync(source, cancellationToken);\n        }\n\n        public static UniTask<Decimal?> SumAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Decimal?> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal?> SumAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Decimal?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<Decimal?> SumAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Decimal?>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n    }\n\n    internal static class Sum\n    {\n        public static async UniTask<Int32> SumAsync(IUniTaskAsyncEnumerable<Int32> source, CancellationToken cancellationToken)\n        {\n            Int32 sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += e.Current;\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Int32> SumAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32> selector, CancellationToken cancellationToken)\n        {\n            Int32 sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += selector(e.Current);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Int32> SumAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int32>> selector, CancellationToken cancellationToken)\n        {\n            Int32 sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current));\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Int32> SumAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int32>> selector, CancellationToken cancellationToken)\n        {\n            Int32 sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current, cancellationToken));\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Int64> SumAsync(IUniTaskAsyncEnumerable<Int64> source, CancellationToken cancellationToken)\n        {\n            Int64 sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += e.Current;\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Int64> SumAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int64> selector, CancellationToken cancellationToken)\n        {\n            Int64 sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += selector(e.Current);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Int64> SumAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int64>> selector, CancellationToken cancellationToken)\n        {\n            Int64 sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current));\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Int64> SumAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int64>> selector, CancellationToken cancellationToken)\n        {\n            Int64 sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current, cancellationToken));\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Single> SumAsync(IUniTaskAsyncEnumerable<Single> source, CancellationToken cancellationToken)\n        {\n            Single sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += e.Current;\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Single> SumAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Single> selector, CancellationToken cancellationToken)\n        {\n            Single sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += selector(e.Current);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Single> SumAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Single>> selector, CancellationToken cancellationToken)\n        {\n            Single sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current));\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Single> SumAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Single>> selector, CancellationToken cancellationToken)\n        {\n            Single sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current, cancellationToken));\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Double> SumAsync(IUniTaskAsyncEnumerable<Double> source, CancellationToken cancellationToken)\n        {\n            Double sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += e.Current;\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Double> SumAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Double> selector, CancellationToken cancellationToken)\n        {\n            Double sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += selector(e.Current);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Double> SumAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Double>> selector, CancellationToken cancellationToken)\n        {\n            Double sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current));\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Double> SumAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Double>> selector, CancellationToken cancellationToken)\n        {\n            Double sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current, cancellationToken));\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Decimal> SumAsync(IUniTaskAsyncEnumerable<Decimal> source, CancellationToken cancellationToken)\n        {\n            Decimal sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += e.Current;\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Decimal> SumAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Decimal> selector, CancellationToken cancellationToken)\n        {\n            Decimal sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += selector(e.Current);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Decimal> SumAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Decimal>> selector, CancellationToken cancellationToken)\n        {\n            Decimal sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current));\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Decimal> SumAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Decimal>> selector, CancellationToken cancellationToken)\n        {\n            Decimal sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current, cancellationToken));\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Int32?> SumAsync(IUniTaskAsyncEnumerable<Int32?> source, CancellationToken cancellationToken)\n        {\n            Int32? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += e.Current.GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Int32?> SumAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32?> selector, CancellationToken cancellationToken)\n        {\n            Int32? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += selector(e.Current).GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Int32?> SumAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int32?>> selector, CancellationToken cancellationToken)\n        {\n            Int32? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current)).GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Int32?> SumAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int32?>> selector, CancellationToken cancellationToken)\n        {\n            Int32? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current, cancellationToken)).GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Int64?> SumAsync(IUniTaskAsyncEnumerable<Int64?> source, CancellationToken cancellationToken)\n        {\n            Int64? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += e.Current.GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Int64?> SumAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int64?> selector, CancellationToken cancellationToken)\n        {\n            Int64? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += selector(e.Current).GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Int64?> SumAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Int64?>> selector, CancellationToken cancellationToken)\n        {\n            Int64? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current)).GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Int64?> SumAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Int64?>> selector, CancellationToken cancellationToken)\n        {\n            Int64? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current, cancellationToken)).GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Single?> SumAsync(IUniTaskAsyncEnumerable<Single?> source, CancellationToken cancellationToken)\n        {\n            Single? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += e.Current.GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Single?> SumAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Single?> selector, CancellationToken cancellationToken)\n        {\n            Single? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += selector(e.Current).GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Single?> SumAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Single?>> selector, CancellationToken cancellationToken)\n        {\n            Single? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current)).GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Single?> SumAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Single?>> selector, CancellationToken cancellationToken)\n        {\n            Single? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current, cancellationToken)).GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Double?> SumAsync(IUniTaskAsyncEnumerable<Double?> source, CancellationToken cancellationToken)\n        {\n            Double? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += e.Current.GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Double?> SumAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Double?> selector, CancellationToken cancellationToken)\n        {\n            Double? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += selector(e.Current).GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Double?> SumAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Double?>> selector, CancellationToken cancellationToken)\n        {\n            Double? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current)).GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Double?> SumAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Double?>> selector, CancellationToken cancellationToken)\n        {\n            Double? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current, cancellationToken)).GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Decimal?> SumAsync(IUniTaskAsyncEnumerable<Decimal?> source, CancellationToken cancellationToken)\n        {\n            Decimal? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += e.Current.GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Decimal?> SumAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Decimal?> selector, CancellationToken cancellationToken)\n        {\n            Decimal? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += selector(e.Current).GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Decimal?> SumAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Decimal?>> selector, CancellationToken cancellationToken)\n        {\n            Decimal? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current)).GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<Decimal?> SumAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Decimal?>> selector, CancellationToken cancellationToken)\n        {\n            Decimal? sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current, cancellationToken)).GetValueOrDefault();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Sum.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 4149754066a21a341be58c04357061f6\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Sum.tt",
    "content": "﻿<#@ template debug=\"false\" hostspecific=\"false\" language=\"C#\" #>\n<#@ assembly name=\"System.Core\" #>\n<#@ import namespace=\"System.Linq\" #>\n<#@ import namespace=\"System.Text\" #>\n<#@ import namespace=\"System.Collections.Generic\" #>\n<#@ output extension=\".cs\" #>\n<#\n    var types = new[]\n    {\n        typeof(int),\n        typeof(long),\n        typeof(float),\n        typeof(double),\n        typeof(decimal),\n        \n        typeof(int?),\n        typeof(long?),\n        typeof(float?),\n        typeof(double?),\n        typeof(decimal?),\n    };\n\n    Func<Type, bool> IsNullable = x => x.IsGenericType;\n    Func<Type, string> TypeName = x => IsNullable(x) ? x.GetGenericArguments()[0].Name + \"?\" : x.Name;\n    Func<Type, string> WithSuffix = x => IsNullable(x) ? \".GetValueOrDefault()\" : \"\";\n#>\nusing System;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n<# foreach(var t in types) { #>\n        public static UniTask<<#= TypeName(t) #>> SumAsync(this IUniTaskAsyncEnumerable<<#= TypeName(t) #>> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Sum.SumAsync(source, cancellationToken);\n        }\n\n        public static UniTask<<#= TypeName(t) #>> SumAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, <#= TypeName(t) #>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<<#= TypeName(t) #>> SumAwaitAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<<#= TypeName(t) #>>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitAsync(source, selector, cancellationToken);\n        }\n\n        public static UniTask<<#= TypeName(t) #>> SumAwaitWithCancellationAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<<#= TypeName(t) #>>> selector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(selector));\n\n            return Sum.SumAwaitWithCancellationAsync(source, selector, cancellationToken);\n        }\n\n<# } #>\n    }\n\n    internal static class Sum\n    {\n<# foreach(var t in types) { #>\n        public static async UniTask<<#= TypeName(t) #>> SumAsync(IUniTaskAsyncEnumerable<<#= TypeName(t) #>> source, CancellationToken cancellationToken)\n        {\n            <#= TypeName(t) #> sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += e.Current<#= WithSuffix(t) #>;\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<<#= TypeName(t) #>> SumAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, <#= TypeName(t) #>> selector, CancellationToken cancellationToken)\n        {\n            <#= TypeName(t) #> sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += selector(e.Current)<#= WithSuffix(t) #>;\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<<#= TypeName(t) #>> SumAwaitAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<<#= TypeName(t) #>>> selector, CancellationToken cancellationToken)\n        {\n            <#= TypeName(t) #> sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current))<#= WithSuffix(t) #>;\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n        public static async UniTask<<#= TypeName(t) #>> SumAwaitWithCancellationAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<<#= TypeName(t) #>>> selector, CancellationToken cancellationToken)\n        {\n            <#= TypeName(t) #> sum = default;\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    sum += (await selector(e.Current, cancellationToken))<#= WithSuffix(t) #>;\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return sum;\n        }\n\n<# } #>\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Sum.tt.meta",
    "content": "fileFormatVersion: 2\nguid: b61271ca8e712494ab1ce2d10b180b6f\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Take.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> Take<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Int32 count)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new Take<TSource>(source, count);\n        }\n    }\n\n    internal sealed class Take<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly int count;\n\n        public Take(IUniTaskAsyncEnumerable<TSource> source, int count)\n        {\n            this.source = source;\n            this.count = count;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Take(source, count, cancellationToken);\n        }\n\n        sealed class _Take : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly int count;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            int index;\n\n            public _Take(IUniTaskAsyncEnumerable<TSource> source, int count, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.count = count;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                if (enumerator == null)\n                {\n                    enumerator = source.GetAsyncEnumerator(cancellationToken);\n                }\n\n                if (checked(index) >= count)\n                {\n                    return CompletedTasks.False;\n                }\n\n                completionSource.Reset();\n                SourceMoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        MoveNextCore(this);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                }\n            }\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_Take)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        self.index++;\n                        self.Current = self.enumerator.Current;\n                        self.completionSource.TrySetResult(true);\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Take.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 42f02cb84e5875b488304755d0e1383d\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/TakeLast.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> TakeLast<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Int32 count)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            // non take.\n            if (count <= 0)\n            {\n                return Empty<TSource>();\n            }\n\n            return new TakeLast<TSource>(source, count);\n        }\n    }\n\n    internal sealed class TakeLast<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly int count;\n\n        public TakeLast(IUniTaskAsyncEnumerable<TSource> source, int count)\n        {\n            this.source = source;\n            this.count = count;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _TakeLast(source, count, cancellationToken);\n        }\n\n        sealed class _TakeLast : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly int count;\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            Queue<TSource> queue;\n\n            bool iterateCompleted;\n            bool continueNext;\n\n            public _TakeLast(IUniTaskAsyncEnumerable<TSource> source, int count, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.count = count;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                if (enumerator == null)\n                {\n                    enumerator = source.GetAsyncEnumerator(cancellationToken);\n                    queue = new Queue<TSource>();\n                }\n\n                completionSource.Reset();\n                SourceMoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void SourceMoveNext()\n            {\n                if (iterateCompleted)\n                {\n                    if (queue.Count > 0)\n                    {\n                        Current = queue.Dequeue();\n                        completionSource.TrySetResult(true);\n                    }\n                    else\n                    {\n                        completionSource.TrySetResult(false);\n                    }\n\n                    return;\n                }\n\n                try\n                {\n                    LOOP:\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        continueNext = true;\n                        MoveNextCore(this);\n                        if (continueNext)\n                        {\n                            continueNext = false;\n                            goto LOOP; // avoid recursive\n                        }\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                }\n            }\n\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_TakeLast)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        if (self.queue.Count < self.count)\n                        {\n                            self.queue.Enqueue(self.enumerator.Current);\n\n                            if (!self.continueNext)\n                            {\n                                self.SourceMoveNext();\n                            }\n                        }\n                        else\n                        {\n                            self.queue.Dequeue();\n                            self.queue.Enqueue(self.enumerator.Current);\n\n                            if (!self.continueNext)\n                            {\n                                self.SourceMoveNext();\n                            }\n                        }\n                    }\n                    else\n                    {\n                        self.continueNext = false;\n                        self.iterateCompleted = true;\n                        self.SourceMoveNext();\n                    }\n                }\n                else\n                {\n                    self.continueNext = false;\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/TakeLast.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 510aa9fd35b45fc40bcdb7e59f01fd1b\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/TakeUntil.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> TakeUntil<TSource>(this IUniTaskAsyncEnumerable<TSource> source, UniTask other)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new TakeUntil<TSource>(source, other, null);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> TakeUntil<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<CancellationToken, UniTask> other)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(source, nameof(other));\n\n            return new TakeUntil<TSource>(source, default, other);\n        }\n    }\n\n    internal sealed class TakeUntil<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly UniTask other;\n        readonly Func<CancellationToken, UniTask> other2;\n\n        public TakeUntil(IUniTaskAsyncEnumerable<TSource> source, UniTask other, Func<CancellationToken, UniTask> other2)\n        {\n            this.source = source;\n            this.other = other;\n            this.other2 = other2;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            if (other2 != null)\n            {\n                return new _TakeUntil(source, this.other2(cancellationToken), cancellationToken);\n            }\n            else\n            {\n                return new _TakeUntil(source, this.other, cancellationToken);\n            }\n        }\n\n        sealed class _TakeUntil : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            static readonly Action<object> CancelDelegate1 = OnCanceled1;\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            CancellationToken cancellationToken1;\n            CancellationTokenRegistration cancellationTokenRegistration1;\n\n            bool completed;\n            Exception exception;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n\n            public _TakeUntil(IUniTaskAsyncEnumerable<TSource> source, UniTask other, CancellationToken cancellationToken1)\n            {\n                this.source = source;\n                this.cancellationToken1 = cancellationToken1;\n\n                if (cancellationToken1.CanBeCanceled)\n                {\n                    this.cancellationTokenRegistration1 = cancellationToken1.RegisterWithoutCaptureExecutionContext(CancelDelegate1, this);\n                }\n\n                TaskTracker.TrackActiveTask(this, 3);\n\n                RunOther(other).Forget();\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (completed)\n                {\n                    return CompletedTasks.False;\n                }\n\n                if (exception != null)\n                {\n                    return UniTask.FromException<bool>(exception);\n                }\n\n                if (cancellationToken1.IsCancellationRequested)\n                {\n                    return UniTask.FromCanceled<bool>(cancellationToken1);\n                }\n\n                if (enumerator == null)\n                {\n                    enumerator = source.GetAsyncEnumerator(cancellationToken1);\n                }\n\n                completionSource.Reset();\n                SourceMoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        MoveNextCore(this);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                }\n            }\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_TakeUntil)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        if (self.exception != null)\n                        {\n                            self.completionSource.TrySetException(self.exception);\n                        }\n                        else if (self.cancellationToken1.IsCancellationRequested)\n                        {\n                            self.completionSource.TrySetCanceled(self.cancellationToken1);\n                        }\n                        else\n                        {\n                            self.Current = self.enumerator.Current;\n                            self.completionSource.TrySetResult(true);\n                        }\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            async UniTaskVoid RunOther(UniTask other)\n            {\n                try\n                {\n                    await other;\n                    completed = true;\n                    completionSource.TrySetResult(false);\n                }\n                catch (Exception ex)\n                {\n                    exception = ex;\n                    completionSource.TrySetException(ex);\n                }\n            }\n\n            static void OnCanceled1(object state)\n            {\n                var self = (_TakeUntil)state;\n                self.completionSource.TrySetCanceled(self.cancellationToken1);\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                cancellationTokenRegistration1.Dispose();\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/TakeUntil.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 12bda324162f15349afefc2c152ac07f\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/TakeUntilCanceled.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> TakeUntilCanceled<TSource>(this IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new TakeUntilCanceled<TSource>(source, cancellationToken);\n        }\n    }\n\n    internal sealed class TakeUntilCanceled<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly CancellationToken cancellationToken;\n\n        public TakeUntilCanceled(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)\n        {\n            this.source = source;\n            this.cancellationToken = cancellationToken;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _TakeUntilCanceled(source, this.cancellationToken, cancellationToken);\n        }\n\n        sealed class _TakeUntilCanceled : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            static readonly Action<object> CancelDelegate1 = OnCanceled1;\n            static readonly Action<object> CancelDelegate2 = OnCanceled2;\n            static readonly Action<object> MoveNextCoreDelegate = MoveNextCore;\n\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            CancellationToken cancellationToken1;\n            CancellationToken cancellationToken2;\n            CancellationTokenRegistration cancellationTokenRegistration1;\n            CancellationTokenRegistration cancellationTokenRegistration2;\n\n            bool isCanceled;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n\n            public _TakeUntilCanceled(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken1, CancellationToken cancellationToken2)\n            {\n                this.source = source;\n                this.cancellationToken1 = cancellationToken1;\n                this.cancellationToken2 = cancellationToken2;\n\n                if (cancellationToken1.CanBeCanceled)\n                {\n                    this.cancellationTokenRegistration1 = cancellationToken1.RegisterWithoutCaptureExecutionContext(CancelDelegate1, this);\n                }\n\n                if (cancellationToken1 != cancellationToken2 && cancellationToken2.CanBeCanceled)\n                {\n                    this.cancellationTokenRegistration2 = cancellationToken2.RegisterWithoutCaptureExecutionContext(CancelDelegate2, this);\n                }\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (cancellationToken1.IsCancellationRequested) isCanceled = true;\n                if (cancellationToken2.IsCancellationRequested) isCanceled = true;\n\n                if (enumerator == null)\n                {\n                    enumerator = source.GetAsyncEnumerator(cancellationToken2); // use only AsyncEnumerator provided token.\n                }\n\n                if (isCanceled) return CompletedTasks.False;\n\n                completionSource.Reset();\n                SourceMoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void SourceMoveNext()\n            {\n                try\n                {\n                    awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        MoveNextCore(this);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(MoveNextCoreDelegate, this);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                }\n            }\n\n            static void MoveNextCore(object state)\n            {\n                var self = (_TakeUntilCanceled)state;\n\n                if (self.TryGetResult(self.awaiter, out var result))\n                {\n                    if (result)\n                    {\n                        if (self.isCanceled)\n                        {\n                            self.completionSource.TrySetResult(false);\n                        }\n                        else\n                        {\n                            self.Current = self.enumerator.Current;\n                            self.completionSource.TrySetResult(true);\n                        }\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            static void OnCanceled1(object state)\n            {\n                var self = (_TakeUntilCanceled)state;\n                if (!self.isCanceled)\n                {\n                    self.cancellationTokenRegistration2.Dispose();\n                    self.completionSource.TrySetResult(false);\n                }\n            }\n\n            static void OnCanceled2(object state)\n            {\n                var self = (_TakeUntilCanceled)state;\n                if (!self.isCanceled)\n                {\n                    self.cancellationTokenRegistration1.Dispose();\n                    self.completionSource.TrySetResult(false);\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                cancellationTokenRegistration1.Dispose();\n                cancellationTokenRegistration2.Dispose();\n                if (enumerator != null)\n                {\n                    return enumerator.DisposeAsync();\n                }\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/TakeUntilCanceled.cs.meta",
    "content": "fileFormatVersion: 2\nguid: e82f498cf3a1df04cbf646773fc11319\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/TakeWhile.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> TakeWhile<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new TakeWhile<TSource>(source, predicate);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> TakeWhile<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, Boolean> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new TakeWhileInt<TSource>(source, predicate);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> TakeWhileAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new TakeWhileAwait<TSource>(source, predicate);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> TakeWhileAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, UniTask<Boolean>> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new TakeWhileIntAwait<TSource>(source, predicate);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> TakeWhileAwaitWithCancellation<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new TakeWhileAwaitWithCancellation<TSource>(source, predicate);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> TakeWhileAwaitWithCancellation<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, CancellationToken, UniTask<Boolean>> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new TakeWhileIntAwaitWithCancellation<TSource>(source, predicate);\n        }\n    }\n\n    internal sealed class TakeWhile<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, bool> predicate;\n\n        public TakeWhile(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, bool> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _TakeWhile(source, predicate, cancellationToken);\n        }\n\n        class _TakeWhile : AsyncEnumeratorBase<TSource, TSource>\n        {\n            Func<TSource, bool> predicate;\n\n            public _TakeWhile(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, bool> predicate, CancellationToken cancellationToken)\n\n                : base(source, cancellationToken)\n            {\n                this.predicate = predicate;\n            }\n\n            protected override bool TryMoveNextCore(bool sourceHasCurrent, out bool result)\n            {\n                if (sourceHasCurrent)\n                {\n                    if (predicate(SourceCurrent))\n                    {\n                        Current = SourceCurrent;\n                        result = true;\n                        return true;\n                    }\n                }\n\n                result = false;\n                return true;\n            }\n        }\n    }\n\n    internal sealed class TakeWhileInt<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, int, bool> predicate;\n\n        public TakeWhileInt(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, bool> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _TakeWhileInt(source, predicate, cancellationToken);\n        }\n\n        class _TakeWhileInt : AsyncEnumeratorBase<TSource, TSource>\n        {\n            readonly Func<TSource, int, bool> predicate;\n            int index;\n\n            public _TakeWhileInt(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, bool> predicate, CancellationToken cancellationToken)\n\n                : base(source, cancellationToken)\n            {\n                this.predicate = predicate;\n            }\n\n            protected override bool TryMoveNextCore(bool sourceHasCurrent, out bool result)\n            {\n                if (sourceHasCurrent)\n                {\n                    if (predicate(SourceCurrent, checked(index++)))\n                    {\n                        Current = SourceCurrent;\n                        result = true;\n                        return true;\n                    }\n                }\n\n                result = false;\n                return true;\n            }\n        }\n    }\n\n    internal sealed class TakeWhileAwait<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, UniTask<bool>> predicate;\n\n        public TakeWhileAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<bool>> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _TakeWhileAwait(source, predicate, cancellationToken);\n        }\n\n        class _TakeWhileAwait : AsyncEnumeratorAwaitSelectorBase<TSource, TSource, bool>\n        {\n            Func<TSource, UniTask<bool>> predicate;\n\n            public _TakeWhileAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<bool>> predicate, CancellationToken cancellationToken)\n                : base(source, cancellationToken)\n            {\n                this.predicate = predicate;\n            }\n\n            protected override UniTask<bool> TransformAsync(TSource sourceCurrent)\n            {\n                return predicate(sourceCurrent);\n            }\n\n            protected override bool TrySetCurrentCore(bool awaitResult, out bool terminateIteration)\n            {\n                if (awaitResult)\n                {\n                    Current = SourceCurrent;\n                    terminateIteration = false;\n                    return true;\n                }\n                else\n                {\n                    terminateIteration = true;\n                    return false;\n                }\n            }\n        }\n    }\n\n    internal sealed class TakeWhileIntAwait<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, int, UniTask<bool>> predicate;\n\n        public TakeWhileIntAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, UniTask<bool>> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _TakeWhileIntAwait(source, predicate, cancellationToken);\n        }\n\n        class _TakeWhileIntAwait : AsyncEnumeratorAwaitSelectorBase<TSource, TSource, bool>\n        {\n            readonly Func<TSource, int, UniTask<bool>> predicate;\n            int index;\n\n            public _TakeWhileIntAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, UniTask<bool>> predicate, CancellationToken cancellationToken)\n                : base(source, cancellationToken)\n            {\n                this.predicate = predicate;\n            }\n\n            protected override UniTask<bool> TransformAsync(TSource sourceCurrent)\n            {\n                return predicate(sourceCurrent, checked(index++));\n            }\n\n            protected override bool TrySetCurrentCore(bool awaitResult, out bool terminateIteration)\n            {\n                if (awaitResult)\n                {\n                    Current = SourceCurrent;\n                    terminateIteration = false;\n                    return true;\n                }\n                else\n                {\n                    terminateIteration = true;\n                    return false;\n                }\n            }\n        }\n    }\n\n    internal sealed class TakeWhileAwaitWithCancellation<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, CancellationToken, UniTask<bool>> predicate;\n\n        public TakeWhileAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<bool>> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _TakeWhileAwaitWithCancellation(source, predicate, cancellationToken);\n        }\n\n        class _TakeWhileAwaitWithCancellation : AsyncEnumeratorAwaitSelectorBase<TSource, TSource, bool>\n        {\n            Func<TSource, CancellationToken, UniTask<bool>> predicate;\n\n            public _TakeWhileAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<bool>> predicate, CancellationToken cancellationToken)\n                : base(source, cancellationToken)\n            {\n                this.predicate = predicate;\n            }\n\n            protected override UniTask<bool> TransformAsync(TSource sourceCurrent)\n            {\n                return predicate(sourceCurrent, cancellationToken);\n            }\n\n            protected override bool TrySetCurrentCore(bool awaitResult, out bool terminateIteration)\n            {\n                if (awaitResult)\n                {\n                    Current = SourceCurrent;\n                    terminateIteration = false;\n                    return true;\n                }\n                else\n                {\n                    terminateIteration = true;\n                    return false;\n                }\n            }\n        }\n    }\n\n    internal sealed class TakeWhileIntAwaitWithCancellation<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, int, CancellationToken, UniTask<bool>> predicate;\n\n        public TakeWhileIntAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, CancellationToken, UniTask<bool>> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _TakeWhileIntAwaitWithCancellation(source, predicate, cancellationToken);\n        }\n\n        class _TakeWhileIntAwaitWithCancellation : AsyncEnumeratorAwaitSelectorBase<TSource, TSource, bool>\n        {\n            readonly Func<TSource, int, CancellationToken, UniTask<bool>> predicate;\n            int index;\n\n            public _TakeWhileIntAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, CancellationToken, UniTask<bool>> predicate, CancellationToken cancellationToken)\n                : base(source, cancellationToken)\n            {\n                this.predicate = predicate;\n            }\n\n            protected override UniTask<bool> TransformAsync(TSource sourceCurrent)\n            {\n                return predicate(sourceCurrent, checked(index++), cancellationToken);\n            }\n\n            protected override bool TrySetCurrentCore(bool awaitResult, out bool terminateIteration)\n            {\n                if (awaitResult)\n                {\n                    Current = SourceCurrent;\n                    terminateIteration = false;\n                    return true;\n                }\n                else\n                {\n                    terminateIteration = true;\n                    return false;\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/TakeWhile.cs.meta",
    "content": "fileFormatVersion: 2\nguid: bca55adabcc4b3141b50b8b09634f764\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Throw.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TValue> Throw<TValue>(Exception exception)\n        {\n            return new Throw<TValue>(exception);\n        }\n    }\n\n    internal class Throw<TValue> : IUniTaskAsyncEnumerable<TValue>\n    {\n        readonly Exception exception;\n\n        public Throw(Exception exception)\n        {\n            this.exception = exception;\n        }\n\n        public IUniTaskAsyncEnumerator<TValue> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Throw(exception, cancellationToken);\n        }\n\n        class _Throw : IUniTaskAsyncEnumerator<TValue>\n        {\n            readonly Exception exception;\n            CancellationToken cancellationToken;\n\n            public _Throw(Exception exception, CancellationToken cancellationToken)\n            {\n                this.exception = exception;\n                this.cancellationToken = cancellationToken;\n            }\n\n            public TValue Current => default;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                return UniTask.FromException<bool>(exception);\n            }\n\n            public UniTask DisposeAsync()\n            {\n                return default;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Throw.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 9d05a7d4f4161e549b4789e1022baae8\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ToArray.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<TSource[]> ToArrayAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Cysharp.Threading.Tasks.Linq.ToArray.ToArrayAsync(source, cancellationToken);\n        }\n    }\n\n    internal static class ToArray\n    {\n        internal static async UniTask<TSource[]> ToArrayAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)\n        {\n            var pool = ArrayPool<TSource>.Shared;\n            var array = pool.Rent(16);\n\n            TSource[] result = default;\n            IUniTaskAsyncEnumerator<TSource> e = default;\n            try\n            {\n                e = source.GetAsyncEnumerator(cancellationToken);\n                var i = 0;\n                while (await e.MoveNextAsync())\n                {\n                    ArrayPoolUtil.EnsureCapacity(ref array, i, pool);\n                    array[i++] = e.Current;\n                }\n\n                if (i == 0)\n                {\n                    result = Array.Empty<TSource>();\n                }\n                else\n                {\n                    result = new TSource[i];\n                    Array.Copy(array, result, i);\n                }\n            }\n            finally\n            {\n                pool.Return(array, clearArray: !RuntimeHelpersAbstraction.IsWellKnownNoReferenceContainsType<TSource>());\n\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return result;\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ToArray.cs.meta",
    "content": "fileFormatVersion: 2\nguid: debb010bbb1622e43b94fe70ec0133dd\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ToDictionary.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return ToDictionary.ToDictionaryAsync(source, keySelector, EqualityComparer<TKey>.Default, cancellationToken);\n        }\n\n        public static UniTask<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return ToDictionary.ToDictionaryAsync(source, keySelector, comparer, cancellationToken);\n        }\n\n        public static UniTask<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n\n            return ToDictionary.ToDictionaryAsync(source, keySelector, elementSelector, EqualityComparer<TKey>.Default, cancellationToken);\n        }\n\n        public static UniTask<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return ToDictionary.ToDictionaryAsync(source, keySelector, elementSelector, comparer, cancellationToken);\n        }\n\n        public static UniTask<Dictionary<TKey, TSource>> ToDictionaryAwaitAsync<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return ToDictionary.ToDictionaryAwaitAsync(source, keySelector, EqualityComparer<TKey>.Default, cancellationToken);\n        }\n\n        public static UniTask<Dictionary<TKey, TSource>> ToDictionaryAwaitAsync<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return ToDictionary.ToDictionaryAwaitAsync(source, keySelector, comparer, cancellationToken);\n        }\n\n        public static UniTask<Dictionary<TKey, TElement>> ToDictionaryAwaitAsync<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, Func<TSource, UniTask<TElement>> elementSelector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n\n            return ToDictionary.ToDictionaryAwaitAsync(source, keySelector, elementSelector, EqualityComparer<TKey>.Default, cancellationToken);\n        }\n\n        public static UniTask<Dictionary<TKey, TElement>> ToDictionaryAwaitAsync<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, Func<TSource, UniTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return ToDictionary.ToDictionaryAwaitAsync(source, keySelector, elementSelector, comparer, cancellationToken);\n        }\n\n        public static UniTask<Dictionary<TKey, TSource>> ToDictionaryAwaitWithCancellationAsync<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return ToDictionary.ToDictionaryAwaitWithCancellationAsync(source, keySelector, EqualityComparer<TKey>.Default, cancellationToken);\n        }\n\n        public static UniTask<Dictionary<TKey, TSource>> ToDictionaryAwaitWithCancellationAsync<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return ToDictionary.ToDictionaryAwaitWithCancellationAsync(source, keySelector, comparer, cancellationToken);\n        }\n\n        public static UniTask<Dictionary<TKey, TElement>> ToDictionaryAwaitWithCancellationAsync<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, Func<TSource, CancellationToken, UniTask<TElement>> elementSelector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n\n            return ToDictionary.ToDictionaryAwaitWithCancellationAsync(source, keySelector, elementSelector, EqualityComparer<TKey>.Default, cancellationToken);\n        }\n\n        public static UniTask<Dictionary<TKey, TElement>> ToDictionaryAwaitWithCancellationAsync<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, Func<TSource, CancellationToken, UniTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return ToDictionary.ToDictionaryAwaitWithCancellationAsync(source, keySelector, elementSelector, comparer, cancellationToken);\n        }\n    }\n\n    internal static class ToDictionary\n    {\n        internal static async UniTask<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n        {\n            var dict = new Dictionary<TKey, TSource>(comparer);\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    var key = keySelector(v);\n                    dict.Add(key, v);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return dict;\n        }\n\n        internal static async UniTask<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n        {\n            var dict = new Dictionary<TKey, TElement>(comparer);\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    var key = keySelector(v);\n                    var value = elementSelector(v);\n                    dict.Add(key, value);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return dict;\n        }\n\n        // with await\n\n        internal static async UniTask<Dictionary<TKey, TSource>> ToDictionaryAwaitAsync<TSource, TKey>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n        {\n            var dict = new Dictionary<TKey, TSource>(comparer);\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    var key = await keySelector(v);\n                    dict.Add(key, v);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return dict;\n        }\n\n        internal static async UniTask<Dictionary<TKey, TElement>> ToDictionaryAwaitAsync<TSource, TKey, TElement>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, Func<TSource, UniTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n        {\n            var dict = new Dictionary<TKey, TElement>(comparer);\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    var key = await keySelector(v);\n                    var value = await elementSelector(v);\n                    dict.Add(key, value);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return dict;\n        }\n\n        // with cancellation\n\n        internal static async UniTask<Dictionary<TKey, TSource>> ToDictionaryAwaitWithCancellationAsync<TSource, TKey>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n        {\n            var dict = new Dictionary<TKey, TSource>(comparer);\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    var key = await keySelector(v, cancellationToken);\n                    dict.Add(key, v);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return dict;\n        }\n\n        internal static async UniTask<Dictionary<TKey, TElement>> ToDictionaryAwaitWithCancellationAsync<TSource, TKey, TElement>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, Func<TSource, CancellationToken, UniTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n        {\n            var dict = new Dictionary<TKey, TElement>(comparer);\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    var v = e.Current;\n                    var key = await keySelector(v, cancellationToken);\n                    var value = await elementSelector(v, cancellationToken);\n                    dict.Add(key, value);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return dict;\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ToDictionary.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 03b109b1fe1f2df46aa56ffb26747654\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ToHashSet.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<HashSet<TSource>> ToHashSetAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Cysharp.Threading.Tasks.Linq.ToHashSet.ToHashSetAsync(source, EqualityComparer<TSource>.Default, cancellationToken);\n        }\n\n        public static UniTask<HashSet<TSource>> ToHashSetAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return Cysharp.Threading.Tasks.Linq.ToHashSet.ToHashSetAsync(source, comparer, cancellationToken);\n        }\n    }\n\n    internal static class ToHashSet\n    {\n        internal static async UniTask<HashSet<TSource>> ToHashSetAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken)\n        {\n            var set = new HashSet<TSource>(comparer);\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    set.Add(e.Current);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return set;\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ToHashSet.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 7a3e552113af96e4986805ec3c4fc80a\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ToList.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<List<TSource>> ToListAsync<TSource>(this IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return Cysharp.Threading.Tasks.Linq.ToList.ToListAsync(source, cancellationToken);\n        }\n    }\n\n    internal static class ToList\n    {\n        internal static async UniTask<List<TSource>> ToListAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)\n        {\n            var list = new List<TSource>();\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (await e.MoveNextAsync())\n                {\n                    list.Add(e.Current);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n\n            return list;\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ToList.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 3859c1b31e81d9b44b282e7d97e11635\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ToLookup.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static UniTask<ILookup<TKey, TSource>> ToLookupAsync<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return ToLookup.ToLookupAsync(source, keySelector, EqualityComparer<TKey>.Default, cancellationToken);\n        }\n\n        public static UniTask<ILookup<TKey, TSource>> ToLookupAsync<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return ToLookup.ToLookupAsync(source, keySelector, comparer, cancellationToken);\n        }\n\n        public static UniTask<ILookup<TKey, TElement>> ToLookupAsync<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n\n            return ToLookup.ToLookupAsync(source, keySelector, elementSelector, EqualityComparer<TKey>.Default, cancellationToken);\n        }\n\n        public static UniTask<ILookup<TKey, TElement>> ToLookupAsync<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return ToLookup.ToLookupAsync(source, keySelector, elementSelector, comparer, cancellationToken);\n        }\n\n        public static UniTask<ILookup<TKey, TSource>> ToLookupAwaitAsync<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return ToLookup.ToLookupAwaitAsync(source, keySelector, EqualityComparer<TKey>.Default, cancellationToken);\n        }\n\n        public static UniTask<ILookup<TKey, TSource>> ToLookupAwaitAsync<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return ToLookup.ToLookupAwaitAsync(source, keySelector, comparer, cancellationToken);\n        }\n\n        public static UniTask<ILookup<TKey, TElement>> ToLookupAwaitAsync<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, Func<TSource, UniTask<TElement>> elementSelector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n\n            return ToLookup.ToLookupAwaitAsync(source, keySelector, elementSelector, EqualityComparer<TKey>.Default, cancellationToken);\n        }\n\n        public static UniTask<ILookup<TKey, TElement>> ToLookupAwaitAsync<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, Func<TSource, UniTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return ToLookup.ToLookupAwaitAsync(source, keySelector, elementSelector, comparer, cancellationToken);\n        }\n\n        public static UniTask<ILookup<TKey, TSource>> ToLookupAwaitWithCancellationAsync<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n\n            return ToLookup.ToLookupAwaitWithCancellationAsync(source, keySelector, EqualityComparer<TKey>.Default, cancellationToken);\n        }\n\n        public static UniTask<ILookup<TKey, TSource>> ToLookupAwaitWithCancellationAsync<TSource, TKey>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return ToLookup.ToLookupAwaitWithCancellationAsync(source, keySelector, comparer, cancellationToken);\n        }\n\n        public static UniTask<ILookup<TKey, TElement>> ToLookupAwaitWithCancellationAsync<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, Func<TSource, CancellationToken, UniTask<TElement>> elementSelector, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n\n            return ToLookup.ToLookupAwaitWithCancellationAsync(source, keySelector, elementSelector, EqualityComparer<TKey>.Default, cancellationToken);\n        }\n\n        public static UniTask<ILookup<TKey, TElement>> ToLookupAwaitWithCancellationAsync<TSource, TKey, TElement>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, Func<TSource, CancellationToken, UniTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));\n            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            return ToLookup.ToLookupAwaitWithCancellationAsync(source, keySelector, elementSelector, comparer, cancellationToken);\n        }\n    }\n\n    internal static class ToLookup\n    {\n        internal static async UniTask<ILookup<TKey, TSource>> ToLookupAsync<TSource, TKey>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n        {\n            var pool = ArrayPool<TSource>.Shared;\n            var array = pool.Rent(16);\n\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                var i = 0;\n                while (await e.MoveNextAsync())\n                {\n                    ArrayPoolUtil.EnsureCapacity(ref array, i, pool);\n                    array[i++] = e.Current;\n                }\n\n                if (i == 0)\n                {\n                    return Lookup<TKey, TSource>.CreateEmpty();\n                }\n                else\n                {\n                    return Lookup<TKey, TSource>.Create(new ArraySegment<TSource>(array, 0, i), keySelector, comparer);\n                }\n            }\n            finally\n            {\n                pool.Return(array, clearArray: !RuntimeHelpersAbstraction.IsWellKnownNoReferenceContainsType<TSource>());\n\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        internal static async UniTask<ILookup<TKey, TElement>> ToLookupAsync<TSource, TKey, TElement>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n        {\n            var pool = ArrayPool<TSource>.Shared;\n            var array = pool.Rent(16);\n\n            IUniTaskAsyncEnumerator<TSource> e = default;\n            try\n            {\n                e = source.GetAsyncEnumerator(cancellationToken);\n                var i = 0;\n                while (await e.MoveNextAsync())\n                {\n                    ArrayPoolUtil.EnsureCapacity(ref array, i, pool);\n                    array[i++] = e.Current;\n                }\n\n                if (i == 0)\n                {\n                    return Lookup<TKey, TElement>.CreateEmpty();\n                }\n                else\n                {\n                    return Lookup<TKey, TElement>.Create(new ArraySegment<TSource>(array, 0, i), keySelector, elementSelector, comparer);\n                }\n            }\n            finally\n            {\n                pool.Return(array, clearArray: !RuntimeHelpersAbstraction.IsWellKnownNoReferenceContainsType<TSource>());\n\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n\n        // with await\n\n        internal static async UniTask<ILookup<TKey, TSource>> ToLookupAwaitAsync<TSource, TKey>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n        {\n            var pool = ArrayPool<TSource>.Shared;\n            var array = pool.Rent(16);\n\n            IUniTaskAsyncEnumerator<TSource> e = default;\n            try\n            {\n                e = source.GetAsyncEnumerator(cancellationToken);\n                var i = 0;\n                while (await e.MoveNextAsync())\n                {\n                    ArrayPoolUtil.EnsureCapacity(ref array, i, pool);\n                    array[i++] = e.Current;\n                }\n\n                if (i == 0)\n                {\n                    return Lookup<TKey, TSource>.CreateEmpty();\n                }\n                else\n                {\n                    return await Lookup<TKey, TSource>.CreateAsync(new ArraySegment<TSource>(array, 0, i), keySelector, comparer);\n                }\n            }\n            finally\n            {\n                pool.Return(array, clearArray: !RuntimeHelpersAbstraction.IsWellKnownNoReferenceContainsType<TSource>());\n\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        internal static async UniTask<ILookup<TKey, TElement>> ToLookupAwaitAsync<TSource, TKey, TElement>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<TKey>> keySelector, Func<TSource, UniTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n        {\n            var pool = ArrayPool<TSource>.Shared;\n            var array = pool.Rent(16);\n\n            IUniTaskAsyncEnumerator<TSource> e = default;\n            try\n            {\n                e = source.GetAsyncEnumerator(cancellationToken);\n                var i = 0;\n                while (await e.MoveNextAsync())\n                {\n                    ArrayPoolUtil.EnsureCapacity(ref array, i, pool);\n                    array[i++] = e.Current;\n                }\n\n                if (i == 0)\n                {\n                    return Lookup<TKey, TElement>.CreateEmpty();\n                }\n                else\n                {\n                    return await Lookup<TKey, TElement>.CreateAsync(new ArraySegment<TSource>(array, 0, i), keySelector, elementSelector, comparer);\n                }\n            }\n            finally\n            {\n                pool.Return(array, clearArray: !RuntimeHelpersAbstraction.IsWellKnownNoReferenceContainsType<TSource>());\n\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        // with cancellation\n\n        internal static async UniTask<ILookup<TKey, TSource>> ToLookupAwaitWithCancellationAsync<TSource, TKey>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n        {\n            var pool = ArrayPool<TSource>.Shared;\n            var array = pool.Rent(16);\n\n            IUniTaskAsyncEnumerator<TSource> e = default;\n            try\n            {\n                e = source.GetAsyncEnumerator(cancellationToken);\n                var i = 0;\n                while (await e.MoveNextAsync())\n                {\n                    ArrayPoolUtil.EnsureCapacity(ref array, i, pool);\n                    array[i++] = e.Current;\n                }\n\n                if (i == 0)\n                {\n                    return Lookup<TKey, TSource>.CreateEmpty();\n                }\n                else\n                {\n                    return await Lookup<TKey, TSource>.CreateAsync(new ArraySegment<TSource>(array, 0, i), keySelector, comparer, cancellationToken);\n                }\n            }\n            finally\n            {\n                pool.Return(array, clearArray: !RuntimeHelpersAbstraction.IsWellKnownNoReferenceContainsType<TSource>());\n\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        internal static async UniTask<ILookup<TKey, TElement>> ToLookupAwaitWithCancellationAsync<TSource, TKey, TElement>(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, Func<TSource, CancellationToken, UniTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n        {\n            var pool = ArrayPool<TSource>.Shared;\n            var array = pool.Rent(16);\n\n            IUniTaskAsyncEnumerator<TSource> e = default;\n            try\n            {\n                e = source.GetAsyncEnumerator(cancellationToken);\n                var i = 0;\n                while (await e.MoveNextAsync())\n                {\n                    ArrayPoolUtil.EnsureCapacity(ref array, i, pool);\n                    array[i++] = e.Current;\n                }\n\n                if (i == 0)\n                {\n                    return Lookup<TKey, TElement>.CreateEmpty();\n                }\n                else\n                {\n                    return await Lookup<TKey, TElement>.CreateAsync(new ArraySegment<TSource>(array, 0, i), keySelector, elementSelector, comparer, cancellationToken);\n                }\n            }\n            finally\n            {\n                pool.Return(array, clearArray: !RuntimeHelpersAbstraction.IsWellKnownNoReferenceContainsType<TSource>());\n\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        // Lookup\n\n        class Lookup<TKey, TElement> : ILookup<TKey, TElement>\n        {\n            static readonly Lookup<TKey, TElement> empty = new Lookup<TKey, TElement>(new Dictionary<TKey, Grouping<TKey, TElement>>());\n\n            // original lookup keeps order but this impl does not(dictionary not guarantee)\n            readonly Dictionary<TKey, Grouping<TKey, TElement>> dict;\n\n            Lookup(Dictionary<TKey, Grouping<TKey, TElement>> dict)\n            {\n                this.dict = dict;\n            }\n\n            public static Lookup<TKey, TElement> CreateEmpty()\n            {\n                return empty;\n            }\n\n            public static Lookup<TKey, TElement> Create(ArraySegment<TElement> source, Func<TElement, TKey> keySelector, IEqualityComparer<TKey> comparer)\n            {\n                var dict = new Dictionary<TKey, Grouping<TKey, TElement>>(comparer);\n\n                var arr = source.Array;\n                var c = source.Count;\n                for (int i = source.Offset; i < c; i++)\n                {\n                    var key = keySelector(arr[i]);\n\n                    if (!dict.TryGetValue(key, out var list))\n                    {\n                        list = new Grouping<TKey, TElement>(key);\n                        dict[key] = list;\n                    }\n\n                    list.Add(arr[i]);\n                }\n\n                return new Lookup<TKey, TElement>(dict);\n            }\n\n            public static Lookup<TKey, TElement> Create<TSource>(ArraySegment<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)\n            {\n                var dict = new Dictionary<TKey, Grouping<TKey, TElement>>(comparer);\n\n                var arr = source.Array;\n                var c = source.Count;\n                for (int i = source.Offset; i < c; i++)\n                {\n                    var key = keySelector(arr[i]);\n                    var elem = elementSelector(arr[i]);\n\n                    if (!dict.TryGetValue(key, out var list))\n                    {\n                        list = new Grouping<TKey, TElement>(key);\n                        dict[key] = list;\n                    }\n\n                    list.Add(elem);\n                }\n\n                return new Lookup<TKey, TElement>(dict);\n            }\n\n            public static async UniTask<Lookup<TKey, TElement>> CreateAsync(ArraySegment<TElement> source, Func<TElement, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer)\n            {\n                var dict = new Dictionary<TKey, Grouping<TKey, TElement>>(comparer);\n\n                var arr = source.Array;\n                var c = source.Count;\n                for (int i = source.Offset; i < c; i++)\n                {\n                    var key = await keySelector(arr[i]);\n\n                    if (!dict.TryGetValue(key, out var list))\n                    {\n                        list = new Grouping<TKey, TElement>(key);\n                        dict[key] = list;\n                    }\n\n                    list.Add(arr[i]);\n                }\n\n                return new Lookup<TKey, TElement>(dict);\n            }\n\n            public static async UniTask<Lookup<TKey, TElement>> CreateAsync<TSource>(ArraySegment<TSource> source, Func<TSource, UniTask<TKey>> keySelector, Func<TSource, UniTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer)\n            {\n                var dict = new Dictionary<TKey, Grouping<TKey, TElement>>(comparer);\n\n                var arr = source.Array;\n                var c = source.Count;\n                for (int i = source.Offset; i < c; i++)\n                {\n                    var key = await keySelector(arr[i]);\n                    var elem = await elementSelector(arr[i]);\n\n                    if (!dict.TryGetValue(key, out var list))\n                    {\n                        list = new Grouping<TKey, TElement>(key);\n                        dict[key] = list;\n                    }\n\n                    list.Add(elem);\n                }\n\n                return new Lookup<TKey, TElement>(dict);\n            }\n\n            public static async UniTask<Lookup<TKey, TElement>> CreateAsync(ArraySegment<TElement> source, Func<TElement, CancellationToken, UniTask<TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n            {\n                var dict = new Dictionary<TKey, Grouping<TKey, TElement>>(comparer);\n\n                var arr = source.Array;\n                var c = source.Count;\n                for (int i = source.Offset; i < c; i++)\n                {\n                    var key = await keySelector(arr[i], cancellationToken);\n\n                    if (!dict.TryGetValue(key, out var list))\n                    {\n                        list = new Grouping<TKey, TElement>(key);\n                        dict[key] = list;\n                    }\n\n                    list.Add(arr[i]);\n                }\n\n                return new Lookup<TKey, TElement>(dict);\n            }\n\n            public static async UniTask<Lookup<TKey, TElement>> CreateAsync<TSource>(ArraySegment<TSource> source, Func<TSource, CancellationToken, UniTask<TKey>> keySelector, Func<TSource, CancellationToken, UniTask<TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)\n            {\n                var dict = new Dictionary<TKey, Grouping<TKey, TElement>>(comparer);\n\n                var arr = source.Array;\n                var c = source.Count;\n                for (int i = source.Offset; i < c; i++)\n                {\n                    var key = await keySelector(arr[i], cancellationToken);\n                    var elem = await elementSelector(arr[i], cancellationToken);\n\n                    if (!dict.TryGetValue(key, out var list))\n                    {\n                        list = new Grouping<TKey, TElement>(key);\n                        dict[key] = list;\n                    }\n\n                    list.Add(elem);\n                }\n\n                return new Lookup<TKey, TElement>(dict);\n            }\n\n            public IEnumerable<TElement> this[TKey key] => dict.TryGetValue(key, out var g) ? g : Enumerable.Empty<TElement>();\n\n            public int Count => dict.Count;\n\n            public bool Contains(TKey key)\n            {\n                return dict.ContainsKey(key);\n            }\n\n            public IEnumerator<IGrouping<TKey, TElement>> GetEnumerator()\n            {\n                return dict.Values.GetEnumerator();\n            }\n\n            IEnumerator IEnumerable.GetEnumerator()\n            {\n                return dict.Values.GetEnumerator();\n            }\n        }\n\n        class Grouping<TKey, TElement> : IGrouping<TKey, TElement> // , IUniTaskAsyncGrouping<TKey, TElement>\n        {\n            readonly List<TElement> elements;\n\n            public TKey Key { get; private set; }\n\n            public Grouping(TKey key)\n            {\n                this.Key = key;\n                this.elements = new List<TElement>();\n            }\n\n            public void Add(TElement value)\n            {\n                elements.Add(value);\n            }\n            public IEnumerator<TElement> GetEnumerator()\n            {\n                return elements.GetEnumerator();\n            }\n\n            IEnumerator IEnumerable.GetEnumerator()\n            {\n                return elements.GetEnumerator();\n            }\n\n            public IUniTaskAsyncEnumerator<TElement> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n            {\n                return this.ToUniTaskAsyncEnumerable().GetAsyncEnumerator(cancellationToken);\n            }\n\n            public override string ToString()\n            {\n                return \"Key: \" + Key + \", Count: \" + elements.Count;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ToLookup.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 57da22563bcd6ca4aaf256d941de5cb0\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ToObservable.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IObservable<TSource> ToObservable<TSource>(this IUniTaskAsyncEnumerable<TSource> source)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new ToObservable<TSource>(source);\n        }\n    }\n\n    internal sealed class ToObservable<T> : IObservable<T>\n    {\n        readonly IUniTaskAsyncEnumerable<T> source;\n\n        public ToObservable(IUniTaskAsyncEnumerable<T> source)\n        {\n            this.source = source;\n        }\n\n        public IDisposable Subscribe(IObserver<T> observer)\n        {\n            var ctd = new CancellationTokenDisposable();\n\n            RunAsync(source, observer, ctd.Token).Forget();\n\n            return ctd;\n        }\n\n        static async UniTaskVoid RunAsync(IUniTaskAsyncEnumerable<T> src, IObserver<T> observer, CancellationToken cancellationToken)\n        {\n            // cancellationToken.IsCancellationRequested is called when Rx's Disposed.\n            // when disposed, finish silently.\n\n            var e = src.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                bool hasNext;\n\n                do\n                {\n                    try\n                    {\n                        hasNext = await e.MoveNextAsync();\n                    }\n                    catch (Exception ex)\n                    {\n                        if (cancellationToken.IsCancellationRequested)\n                        {\n                            return;\n                        }\n\n                        observer.OnError(ex);\n                        return;\n                    }\n\n                    if (hasNext)\n                    {\n                        observer.OnNext(e.Current);\n                    }\n                    else\n                    {\n                        observer.OnCompleted();\n                        return;\n                    }\n                } while (!cancellationToken.IsCancellationRequested);\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        internal sealed class CancellationTokenDisposable : IDisposable\n        {\n            readonly CancellationTokenSource cts = new CancellationTokenSource();\n\n            public CancellationToken Token => cts.Token;\n\n            public void Dispose()\n            {\n                if (!cts.IsCancellationRequested)\n                {\n                    cts.Cancel();\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ToObservable.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b4f6f48a532188e4c80b7ebe69aea3a8\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ToUniTaskAsyncEnumerable.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Runtime.ExceptionServices;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> ToUniTaskAsyncEnumerable<TSource>(this IEnumerable<TSource> source)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new ToUniTaskAsyncEnumerable<TSource>(source);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> ToUniTaskAsyncEnumerable<TSource>(this Task<TSource> source)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new ToUniTaskAsyncEnumerableTask<TSource>(source);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> ToUniTaskAsyncEnumerable<TSource>(this UniTask<TSource> source)\n        {\n            return new ToUniTaskAsyncEnumerableUniTask<TSource>(source);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> ToUniTaskAsyncEnumerable<TSource>(this IObservable<TSource> source)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n\n            return new ToUniTaskAsyncEnumerableObservable<TSource>(source);\n        }\n    }\n\n    internal class ToUniTaskAsyncEnumerable<T> : IUniTaskAsyncEnumerable<T>\n    {\n        readonly IEnumerable<T> source;\n\n        public ToUniTaskAsyncEnumerable(IEnumerable<T> source)\n        {\n            this.source = source;\n        }\n\n        public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _ToUniTaskAsyncEnumerable(source, cancellationToken);\n        }\n\n        class _ToUniTaskAsyncEnumerable : IUniTaskAsyncEnumerator<T>\n        {\n            readonly IEnumerable<T> source;\n            CancellationToken cancellationToken;\n\n            IEnumerator<T> enumerator;\n\n            public _ToUniTaskAsyncEnumerable(IEnumerable<T> source, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.cancellationToken = cancellationToken;\n            }\n\n            public T Current => enumerator.Current;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                if (enumerator == null)\n                {\n                    enumerator = source.GetEnumerator();\n                }\n\n                if (enumerator.MoveNext())\n                {\n                    return CompletedTasks.True;\n                }\n\n                return CompletedTasks.False;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                enumerator.Dispose();\n                return default;\n            }\n        }\n    }\n\n    internal class ToUniTaskAsyncEnumerableTask<T> : IUniTaskAsyncEnumerable<T>\n    {\n        readonly Task<T> source;\n\n        public ToUniTaskAsyncEnumerableTask(Task<T> source)\n        {\n            this.source = source;\n        }\n\n        public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _ToUniTaskAsyncEnumerableTask(source, cancellationToken);\n        }\n\n        class _ToUniTaskAsyncEnumerableTask : IUniTaskAsyncEnumerator<T>\n        {\n            readonly Task<T> source;\n            CancellationToken cancellationToken;\n\n            T current;\n            bool called;\n\n            public _ToUniTaskAsyncEnumerableTask(Task<T> source, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.cancellationToken = cancellationToken;\n\n                this.called = false;\n            }\n\n            public T Current => current;\n\n            public async UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                if (called)\n                {\n                    return false;\n                }\n                called = true;\n\n                current = await source;\n                return true;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                return default;\n            }\n        }\n    }\n\n    internal class ToUniTaskAsyncEnumerableUniTask<T> : IUniTaskAsyncEnumerable<T>\n    {\n        readonly UniTask<T> source;\n\n        public ToUniTaskAsyncEnumerableUniTask(UniTask<T> source)\n        {\n            this.source = source;\n        }\n\n        public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _ToUniTaskAsyncEnumerableUniTask(source, cancellationToken);\n        }\n\n        class _ToUniTaskAsyncEnumerableUniTask : IUniTaskAsyncEnumerator<T>\n        {\n            readonly UniTask<T> source;\n            CancellationToken cancellationToken;\n\n            T current;\n            bool called;\n\n            public _ToUniTaskAsyncEnumerableUniTask(UniTask<T> source, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.cancellationToken = cancellationToken;\n\n                this.called = false;\n            }\n\n            public T Current => current;\n\n            public async UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                if (called)\n                {\n                    return false;\n                }\n                called = true;\n\n                current = await source;\n                return true;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                return default;\n            }\n        }\n    }\n\n    internal class ToUniTaskAsyncEnumerableObservable<T> : IUniTaskAsyncEnumerable<T>\n    {\n        readonly IObservable<T> source;\n\n        public ToUniTaskAsyncEnumerableObservable(IObservable<T> source)\n        {\n            this.source = source;\n        }\n\n        public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _ToUniTaskAsyncEnumerableObservable(source, cancellationToken);\n        }\n\n        class _ToUniTaskAsyncEnumerableObservable : MoveNextSource, IUniTaskAsyncEnumerator<T>, IObserver<T>\n        {\n            static readonly Action<object> OnCanceledDelegate = OnCanceled;\n\n            readonly IObservable<T> source;\n            CancellationToken cancellationToken;\n\n\n            bool useCachedCurrent;\n            T current;\n            bool subscribeCompleted;\n            readonly Queue<T> queuedResult;\n            Exception error;\n            IDisposable subscription;\n            CancellationTokenRegistration cancellationTokenRegistration;\n\n            public _ToUniTaskAsyncEnumerableObservable(IObservable<T> source, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.cancellationToken = cancellationToken;\n                this.queuedResult = new Queue<T>();\n\n                if (cancellationToken.CanBeCanceled)\n                {\n                    cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(OnCanceledDelegate, this);\n                }\n            }\n\n            public T Current\n            {\n                get\n                {\n                    if (useCachedCurrent)\n                    {\n                        return current;\n                    }\n\n                    lock (queuedResult)\n                    {\n                        if (queuedResult.Count != 0)\n                        {\n                            current = queuedResult.Dequeue();\n                            useCachedCurrent = true;\n                            return current;\n                        }\n                        else\n                        {\n                            return default; // undefined.\n                        }\n                    }\n                }\n            }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                lock (queuedResult)\n                {\n                    useCachedCurrent = false;\n\n                    if (cancellationToken.IsCancellationRequested)\n                    {\n                        return UniTask.FromCanceled<bool>(cancellationToken);\n                    }\n\n                    if (subscription == null)\n                    {\n                        subscription = source.Subscribe(this);\n                    }\n\n                    if (error != null)\n                    {\n                        return UniTask.FromException<bool>(error);\n                    }\n\n                    if (queuedResult.Count != 0)\n                    {\n                        return CompletedTasks.True;\n                    }\n\n                    if (subscribeCompleted)\n                    {\n                        return CompletedTasks.False;\n                    }\n\n                    completionSource.Reset();\n                    return new UniTask<bool>(this, completionSource.Version);\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                subscription.Dispose();\n                cancellationTokenRegistration.Dispose();\n                completionSource.Reset();\n                return default;\n            }\n\n            public void OnCompleted()\n            {\n                lock (queuedResult)\n                {\n                    subscribeCompleted = true;\n                    completionSource.TrySetResult(false);\n                }\n            }\n\n            public void OnError(Exception error)\n            {\n                lock (queuedResult)\n                {\n                    this.error = error;\n                    completionSource.TrySetException(error);\n                }\n            }\n\n            public void OnNext(T value)\n            {\n                lock (queuedResult)\n                {\n                    queuedResult.Enqueue(value);\n                    completionSource.TrySetResult(true); // include callback execution, too long lock?\n                }\n            }\n\n            static void OnCanceled(object state)\n            {\n                var self = (_ToUniTaskAsyncEnumerableObservable)state;\n                lock (self.queuedResult)\n                {\n                    self.completionSource.TrySetCanceled(self.cancellationToken);\n                }\n            }\n        }\n    }\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/ToUniTaskAsyncEnumerable.cs.meta",
    "content": "fileFormatVersion: 2\nguid: d7192de2a0581ec4db62962cc1404af5\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/UniTask.Linq.asmdef",
    "content": "{\n    \"name\": \"UniTask.Linq\",\n    \"references\": [\n        \"UniTask\"\n    ],\n    \"includePlatforms\": [],\n    \"excludePlatforms\": [],\n    \"allowUnsafeCode\": false,\n    \"overrideReferences\": false,\n    \"precompiledReferences\": [],\n    \"autoReferenced\": true,\n    \"defineConstraints\": [],\n    \"versionDefines\": [],\n    \"noEngineReferences\": false\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/UniTask.Linq.asmdef.meta",
    "content": "fileFormatVersion: 2\nguid: 5c01796d064528144a599661eaab93a6\nAssemblyDefinitionImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Union.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System.Collections.Generic;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> Union<TSource>(this IUniTaskAsyncEnumerable<TSource> first, IUniTaskAsyncEnumerable<TSource> second)\n        {\n            Error.ThrowArgumentNullException(first, nameof(first));\n            Error.ThrowArgumentNullException(second, nameof(second));\n\n            return Union<TSource>(first, second, EqualityComparer<TSource>.Default);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> Union<TSource>(this IUniTaskAsyncEnumerable<TSource> first, IUniTaskAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)\n        {\n            Error.ThrowArgumentNullException(first, nameof(first));\n            Error.ThrowArgumentNullException(second, nameof(second));\n            Error.ThrowArgumentNullException(comparer, nameof(comparer));\n\n            // improv without combinate?\n            return first.Concat(second).Distinct(comparer);\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Union.cs.meta",
    "content": "fileFormatVersion: 2\nguid: ae57a55bdeba98b4f8ff234d98d7dd76\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/UnityExtensions/EveryUpdate.cs",
    "content": "﻿using System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<AsyncUnit> EveryUpdate(PlayerLoopTiming updateTiming = PlayerLoopTiming.Update, bool cancelImmediately = false)\n        {\n            return new EveryUpdate(updateTiming, cancelImmediately);\n        }\n    }\n\n    internal class EveryUpdate : IUniTaskAsyncEnumerable<AsyncUnit>\n    {\n        readonly PlayerLoopTiming updateTiming;\n        readonly bool cancelImmediately;\n\n        public EveryUpdate(PlayerLoopTiming updateTiming, bool cancelImmediately)\n        {\n            this.updateTiming = updateTiming;\n            this.cancelImmediately = cancelImmediately;\n        }\n\n        public IUniTaskAsyncEnumerator<AsyncUnit> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _EveryUpdate(updateTiming, cancellationToken, cancelImmediately);\n        }\n\n        class _EveryUpdate : MoveNextSource, IUniTaskAsyncEnumerator<AsyncUnit>, IPlayerLoopItem\n        {\n            readonly PlayerLoopTiming updateTiming;\n            readonly CancellationToken cancellationToken;\n            readonly CancellationTokenRegistration cancellationTokenRegistration;\n\n            bool disposed;\n\n            public _EveryUpdate(PlayerLoopTiming updateTiming, CancellationToken cancellationToken, bool cancelImmediately)\n            {\n                this.updateTiming = updateTiming;\n                this.cancellationToken = cancellationToken;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var source = (_EveryUpdate)state;\n                        source.completionSource.TrySetCanceled(source.cancellationToken);\n                    }, this);\n                }\n\n                TaskTracker.TrackActiveTask(this, 2);\n                PlayerLoopHelper.AddAction(updateTiming, this);\n            }\n\n            public AsyncUnit Current => default;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (disposed) return CompletedTasks.False;\n                \n                completionSource.Reset();\n\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    completionSource.TrySetCanceled(cancellationToken);\n                }\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            public UniTask DisposeAsync()\n            {\n                if (!disposed)\n                {\n                    cancellationTokenRegistration.Dispose();\n                    disposed = true;\n                    TaskTracker.RemoveTracking(this);\n                }\n                return default;\n            }\n\n            public bool MoveNext()\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    completionSource.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n                \n                if (disposed)\n                {\n                    completionSource.TrySetResult(false);\n                    return false;\n                }\n\n                completionSource.TrySetResult(true);\n                return true;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/UnityExtensions/EveryUpdate.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 00520eb52e49b5b4e8d9870d6ff1aced\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/UnityExtensions/EveryValueChanged.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TProperty> EveryValueChanged<TTarget, TProperty>(TTarget target, Func<TTarget, TProperty> propertySelector, PlayerLoopTiming monitorTiming = PlayerLoopTiming.Update, IEqualityComparer<TProperty> equalityComparer = null, bool cancelImmediately = false)\n            where TTarget : class\n        {\n            var unityObject = target as UnityEngine.Object;\n            var isUnityObject = target is UnityEngine.Object; // don't use (unityObject == null)\n\n            if (isUnityObject)\n            {\n                return new EveryValueChangedUnityObject<TTarget, TProperty>(target, propertySelector, equalityComparer ?? UnityEqualityComparer.GetDefault<TProperty>(), monitorTiming, cancelImmediately);\n            }\n            else\n            {\n                return new EveryValueChangedStandardObject<TTarget, TProperty>(target, propertySelector, equalityComparer ?? UnityEqualityComparer.GetDefault<TProperty>(), monitorTiming, cancelImmediately);\n            }\n        }\n    }\n\n    internal sealed class EveryValueChangedUnityObject<TTarget, TProperty> : IUniTaskAsyncEnumerable<TProperty>\n    {\n        readonly TTarget target;\n        readonly Func<TTarget, TProperty> propertySelector;\n        readonly IEqualityComparer<TProperty> equalityComparer;\n        readonly PlayerLoopTiming monitorTiming;\n        readonly bool cancelImmediately;\n\n        public EveryValueChangedUnityObject(TTarget target, Func<TTarget, TProperty> propertySelector, IEqualityComparer<TProperty> equalityComparer, PlayerLoopTiming monitorTiming, bool cancelImmediately)\n        {\n            this.target = target;\n            this.propertySelector = propertySelector;\n            this.equalityComparer = equalityComparer;\n            this.monitorTiming = monitorTiming;\n            this.cancelImmediately = cancelImmediately;\n        }\n\n        public IUniTaskAsyncEnumerator<TProperty> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _EveryValueChanged(target, propertySelector, equalityComparer, monitorTiming, cancellationToken, cancelImmediately);\n        }\n\n        sealed class _EveryValueChanged : MoveNextSource, IUniTaskAsyncEnumerator<TProperty>, IPlayerLoopItem\n        {\n            readonly TTarget target;\n            readonly UnityEngine.Object targetAsUnityObject;\n            readonly IEqualityComparer<TProperty> equalityComparer;\n            readonly Func<TTarget, TProperty> propertySelector;\n            readonly CancellationToken cancellationToken;\n            readonly CancellationTokenRegistration cancellationTokenRegistration;\n\n            bool first;\n            TProperty currentValue;\n            bool disposed;\n\n            public _EveryValueChanged(TTarget target, Func<TTarget, TProperty> propertySelector, IEqualityComparer<TProperty> equalityComparer, PlayerLoopTiming monitorTiming, CancellationToken cancellationToken, bool cancelImmediately)\n            {\n                this.target = target;\n                this.targetAsUnityObject = target as UnityEngine.Object;\n                this.propertySelector = propertySelector;\n                this.equalityComparer = equalityComparer;\n                this.cancellationToken = cancellationToken;\n                this.first = true;\n                \n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var source = (_EveryValueChanged)state;\n                        source.completionSource.TrySetCanceled(source.cancellationToken);\n                    }, this);\n                }\n                \n                TaskTracker.TrackActiveTask(this, 2);\n                PlayerLoopHelper.AddAction(monitorTiming, this);\n            }\n\n            public TProperty Current => currentValue;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (disposed) return CompletedTasks.False;\n\n                completionSource.Reset();\n                \n                if (cancellationToken.IsCancellationRequested)\n                {\n                    completionSource.TrySetCanceled(cancellationToken);\n                    return new UniTask<bool>(this, completionSource.Version);\n                }\n\n                if (first)\n                {\n                    first = false;\n                    if (targetAsUnityObject == null)\n                    {\n                        return CompletedTasks.False;\n                    }\n                    this.currentValue = propertySelector(target);\n                    return CompletedTasks.True;\n                }\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            public UniTask DisposeAsync()\n            {\n                if (!disposed)\n                {\n                    cancellationTokenRegistration.Dispose();\n                    disposed = true;\n                    TaskTracker.RemoveTracking(this);\n                }\n                return default;\n            }\n\n            public bool MoveNext()\n            {\n                if (disposed || targetAsUnityObject == null) \n                {\n                    completionSource.TrySetResult(false);\n                    DisposeAsync().Forget();\n                    return false;\n                }\n                \n                if (cancellationToken.IsCancellationRequested)\n                {\n                    completionSource.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n                TProperty nextValue = default(TProperty);\n                try\n                {\n                    nextValue = propertySelector(target);\n                    if (equalityComparer.Equals(currentValue, nextValue))\n                    {\n                        return true;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    DisposeAsync().Forget();\n                    return false;\n                }\n\n                currentValue = nextValue;\n                completionSource.TrySetResult(true);\n                return true;\n            }\n        }\n    }\n\n    internal sealed class EveryValueChangedStandardObject<TTarget, TProperty> : IUniTaskAsyncEnumerable<TProperty>\n        where TTarget : class\n    {\n        readonly WeakReference<TTarget> target;\n        readonly Func<TTarget, TProperty> propertySelector;\n        readonly IEqualityComparer<TProperty> equalityComparer;\n        readonly PlayerLoopTiming monitorTiming;\n        readonly bool cancelImmediately;\n\n        public EveryValueChangedStandardObject(TTarget target, Func<TTarget, TProperty> propertySelector, IEqualityComparer<TProperty> equalityComparer, PlayerLoopTiming monitorTiming, bool cancelImmediately)\n        {\n            this.target = new WeakReference<TTarget>(target, false);\n            this.propertySelector = propertySelector;\n            this.equalityComparer = equalityComparer;\n            this.monitorTiming = monitorTiming;\n            this.cancelImmediately = cancelImmediately;\n        }\n\n        public IUniTaskAsyncEnumerator<TProperty> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _EveryValueChanged(target, propertySelector, equalityComparer, monitorTiming, cancellationToken, cancelImmediately);\n        }\n\n        sealed class _EveryValueChanged : MoveNextSource, IUniTaskAsyncEnumerator<TProperty>, IPlayerLoopItem\n        {\n            readonly WeakReference<TTarget> target;\n            readonly IEqualityComparer<TProperty> equalityComparer;\n            readonly Func<TTarget, TProperty> propertySelector;\n            readonly CancellationToken cancellationToken;\n            readonly CancellationTokenRegistration cancellationTokenRegistration;\n\n            bool first;\n            TProperty currentValue;\n            bool disposed;\n\n            public _EveryValueChanged(WeakReference<TTarget> target, Func<TTarget, TProperty> propertySelector, IEqualityComparer<TProperty> equalityComparer, PlayerLoopTiming monitorTiming, CancellationToken cancellationToken, bool cancelImmediately)\n            {\n                this.target = target;\n                this.propertySelector = propertySelector;\n                this.equalityComparer = equalityComparer;\n                this.cancellationToken = cancellationToken;\n                this.first = true;\n                \n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var source = (_EveryValueChanged)state;\n                        source.completionSource.TrySetCanceled(source.cancellationToken);\n                    }, this);\n                }\n                \n                TaskTracker.TrackActiveTask(this, 2);\n                PlayerLoopHelper.AddAction(monitorTiming, this);\n            }\n\n            public TProperty Current => currentValue;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (disposed) return CompletedTasks.False;\n\n                completionSource.Reset();\n                \n                if (cancellationToken.IsCancellationRequested)\n                {\n                    completionSource.TrySetCanceled(cancellationToken);\n                    return new UniTask<bool>(this, completionSource.Version);\n                }\n                \n                if (first)\n                {\n                    first = false;\n                    if (!target.TryGetTarget(out var t))\n                    {\n                        return CompletedTasks.False;\n                    }\n                    this.currentValue = propertySelector(t);\n                    return CompletedTasks.True;\n                }\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            public UniTask DisposeAsync()\n            {\n                if (!disposed)\n                {\n                    cancellationTokenRegistration.Dispose();\n                    disposed = true;\n                    TaskTracker.RemoveTracking(this);\n                }\n                return default;\n            }\n\n            public bool MoveNext()\n            {\n                if (disposed || !target.TryGetTarget(out var t))\n                {\n                    completionSource.TrySetResult(false);\n                    DisposeAsync().Forget();\n                    return false;\n                }\n\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    completionSource.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                TProperty nextValue = default(TProperty);\n                try\n                {\n                    nextValue = propertySelector(t);\n                    if (equalityComparer.Equals(currentValue, nextValue))\n                    {\n                        return true;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    completionSource.TrySetException(ex);\n                    DisposeAsync().Forget();\n                    return false;\n                }\n\n                currentValue = nextValue;\n                completionSource.TrySetResult(true);\n                return true;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/UnityExtensions/EveryValueChanged.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 1ec39f1c41c305344854782c935ad354\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/UnityExtensions/Timer.cs",
    "content": "﻿using System;\nusing System.Threading;\nusing UnityEngine;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<AsyncUnit> Timer(TimeSpan dueTime, PlayerLoopTiming updateTiming = PlayerLoopTiming.Update, bool ignoreTimeScale = false, bool cancelImmediately = false)\n        {\n            return new Timer(dueTime, null, updateTiming, ignoreTimeScale, cancelImmediately);\n        }\n\n        public static IUniTaskAsyncEnumerable<AsyncUnit> Timer(TimeSpan dueTime, TimeSpan period, PlayerLoopTiming updateTiming = PlayerLoopTiming.Update, bool ignoreTimeScale = false, bool cancelImmediately = false)\n        {\n            return new Timer(dueTime, period, updateTiming, ignoreTimeScale, cancelImmediately);\n        }\n\n        public static IUniTaskAsyncEnumerable<AsyncUnit> Interval(TimeSpan period, PlayerLoopTiming updateTiming = PlayerLoopTiming.Update, bool ignoreTimeScale = false, bool cancelImmediately = false)\n        {\n            return new Timer(period, period, updateTiming, ignoreTimeScale, cancelImmediately);\n        }\n\n        public static IUniTaskAsyncEnumerable<AsyncUnit> TimerFrame(int dueTimeFrameCount, PlayerLoopTiming updateTiming = PlayerLoopTiming.Update, bool cancelImmediately = false)\n        {\n            if (dueTimeFrameCount < 0)\n            {\n                throw new ArgumentOutOfRangeException(\"Delay does not allow minus delayFrameCount. dueTimeFrameCount:\" + dueTimeFrameCount);\n            }\n\n            return new TimerFrame(dueTimeFrameCount, null, updateTiming, cancelImmediately);\n        }\n\n        public static IUniTaskAsyncEnumerable<AsyncUnit> TimerFrame(int dueTimeFrameCount, int periodFrameCount, PlayerLoopTiming updateTiming = PlayerLoopTiming.Update, bool cancelImmediately = false)\n        {\n            if (dueTimeFrameCount < 0)\n            {\n                throw new ArgumentOutOfRangeException(\"Delay does not allow minus delayFrameCount. dueTimeFrameCount:\" + dueTimeFrameCount);\n            }\n            if (periodFrameCount < 0)\n            {\n                throw new ArgumentOutOfRangeException(\"Delay does not allow minus periodFrameCount. periodFrameCount:\" + dueTimeFrameCount);\n            }\n\n            return new TimerFrame(dueTimeFrameCount, periodFrameCount, updateTiming, cancelImmediately);\n        }\n\n        public static IUniTaskAsyncEnumerable<AsyncUnit> IntervalFrame(int intervalFrameCount, PlayerLoopTiming updateTiming = PlayerLoopTiming.Update, bool cancelImmediately = false)\n        {\n            if (intervalFrameCount < 0)\n            {\n                throw new ArgumentOutOfRangeException(\"Delay does not allow minus intervalFrameCount. intervalFrameCount:\" + intervalFrameCount);\n            }\n            return new TimerFrame(intervalFrameCount, intervalFrameCount, updateTiming, cancelImmediately);\n        }\n    }\n\n    internal class Timer : IUniTaskAsyncEnumerable<AsyncUnit>\n    {\n        readonly PlayerLoopTiming updateTiming;\n        readonly TimeSpan dueTime;\n        readonly TimeSpan? period;\n        readonly bool ignoreTimeScale;\n        readonly bool cancelImmediately;\n\n        public Timer(TimeSpan dueTime, TimeSpan? period, PlayerLoopTiming updateTiming, bool ignoreTimeScale, bool cancelImmediately)\n        {\n            this.updateTiming = updateTiming;\n            this.dueTime = dueTime;\n            this.period = period;\n            this.ignoreTimeScale = ignoreTimeScale;\n            this.cancelImmediately = cancelImmediately;\n        }\n\n        public IUniTaskAsyncEnumerator<AsyncUnit> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Timer(dueTime, period, updateTiming, ignoreTimeScale, cancellationToken, cancelImmediately);\n        }\n\n        class _Timer : MoveNextSource, IUniTaskAsyncEnumerator<AsyncUnit>, IPlayerLoopItem\n        {\n            readonly float dueTime;\n            readonly float? period;\n            readonly PlayerLoopTiming updateTiming;\n            readonly bool ignoreTimeScale;\n            readonly CancellationToken cancellationToken;\n            readonly CancellationTokenRegistration cancellationTokenRegistration;\n\n            int initialFrame;\n            float elapsed;\n            bool dueTimePhase;\n            bool completed;\n            bool disposed;\n\n            public _Timer(TimeSpan dueTime, TimeSpan? period, PlayerLoopTiming updateTiming, bool ignoreTimeScale, CancellationToken cancellationToken, bool cancelImmediately)\n            {\n                this.dueTime = (float)dueTime.TotalSeconds;\n                this.period = (period == null) ? null : (float?)period.Value.TotalSeconds;\n\n                if (this.dueTime <= 0) this.dueTime = 0;\n                if (this.period != null)\n                {\n                    if (this.period <= 0) this.period = 1;\n                }\n\n                this.initialFrame = PlayerLoopHelper.IsMainThread ? Time.frameCount : -1;\n                this.dueTimePhase = true;\n                this.updateTiming = updateTiming;\n                this.ignoreTimeScale = ignoreTimeScale;\n                this.cancellationToken = cancellationToken;\n                \n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var source = (_Timer)state;\n                        source.completionSource.TrySetCanceled(source.cancellationToken);\n                    }, this);\n                }\n                \n                TaskTracker.TrackActiveTask(this, 2);\n                PlayerLoopHelper.AddAction(updateTiming, this);\n            }\n\n            public AsyncUnit Current => default;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                // return false instead of throw\n                if (disposed || completed) return CompletedTasks.False;\n\n                // reset value here.\n                this.elapsed = 0;\n\n                completionSource.Reset();\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    completionSource.TrySetCanceled(cancellationToken);\n                }\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            public UniTask DisposeAsync()\n            {\n                if (!disposed)\n                {\n                    cancellationTokenRegistration.Dispose();\n                    disposed = true;\n                    TaskTracker.RemoveTracking(this);\n                }\n                return default;\n            }\n\n            public bool MoveNext()\n            {\n                if (disposed)\n                {\n                    completionSource.TrySetResult(false);\n                    return false;\n                }\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    completionSource.TrySetCanceled(cancellationToken);\n                    return false;\n                }                \n\n                if (dueTimePhase)\n                {\n                    if (elapsed == 0)\n                    {\n                        // skip in initial frame.\n                        if (initialFrame == Time.frameCount)\n                        {\n                            return true;\n                        }\n                    }\n\n                    elapsed += (ignoreTimeScale) ? UnityEngine.Time.unscaledDeltaTime : UnityEngine.Time.deltaTime;\n\n                    if (elapsed >= dueTime)\n                    {\n                        dueTimePhase = false;\n                        completionSource.TrySetResult(true);\n                    }\n                }\n                else\n                {\n                    if (period == null)\n                    {\n                        completed = true;\n                        completionSource.TrySetResult(false);\n                        return false;\n                    }\n\n                    elapsed += (ignoreTimeScale) ? UnityEngine.Time.unscaledDeltaTime : UnityEngine.Time.deltaTime;\n\n                    if (elapsed >= period)\n                    {\n                        completionSource.TrySetResult(true);\n                    }\n                }\n\n                return true;\n            }\n        }\n    }\n\n    internal class TimerFrame : IUniTaskAsyncEnumerable<AsyncUnit>\n    {\n        readonly PlayerLoopTiming updateTiming;\n        readonly int dueTimeFrameCount;\n        readonly int? periodFrameCount;\n        readonly bool cancelImmediately;\n\n        public TimerFrame(int dueTimeFrameCount, int? periodFrameCount, PlayerLoopTiming updateTiming, bool cancelImmediately)\n        {\n            this.updateTiming = updateTiming;\n            this.dueTimeFrameCount = dueTimeFrameCount;\n            this.periodFrameCount = periodFrameCount;\n            this.cancelImmediately = cancelImmediately;\n        }\n\n        public IUniTaskAsyncEnumerator<AsyncUnit> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _TimerFrame(dueTimeFrameCount, periodFrameCount, updateTiming, cancellationToken, cancelImmediately);\n        }\n\n        class _TimerFrame : MoveNextSource, IUniTaskAsyncEnumerator<AsyncUnit>, IPlayerLoopItem\n        {\n            readonly int dueTimeFrameCount;\n            readonly int? periodFrameCount;\n            readonly CancellationToken cancellationToken;\n            readonly CancellationTokenRegistration cancellationTokenRegistration;\n\n            int initialFrame;\n            int currentFrame;\n            bool dueTimePhase;\n            bool completed;\n            bool disposed;\n\n            public _TimerFrame(int dueTimeFrameCount, int? periodFrameCount, PlayerLoopTiming updateTiming, CancellationToken cancellationToken, bool cancelImmediately)\n            {\n                if (dueTimeFrameCount <= 0) dueTimeFrameCount = 0;\n                if (periodFrameCount != null)\n                {\n                    if (periodFrameCount <= 0) periodFrameCount = 1;\n                }\n\n                this.initialFrame = PlayerLoopHelper.IsMainThread ? Time.frameCount : -1;\n                this.dueTimePhase = true;\n                this.dueTimeFrameCount = dueTimeFrameCount;\n                this.periodFrameCount = periodFrameCount;\n                this.cancellationToken = cancellationToken;\n                \n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var source = (_TimerFrame)state;\n                        source.completionSource.TrySetCanceled(source.cancellationToken);\n                    }, this);\n                }\n\n                TaskTracker.TrackActiveTask(this, 2);\n                PlayerLoopHelper.AddAction(updateTiming, this);\n            }\n\n            public AsyncUnit Current => default;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (disposed || completed) return CompletedTasks.False;\n\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    completionSource.TrySetCanceled(cancellationToken);\n                }\n\n                // reset value here.\n                this.currentFrame = 0;\n                completionSource.Reset();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            public UniTask DisposeAsync()\n            {\n                if (!disposed)\n                {\n                    cancellationTokenRegistration.Dispose();\n                    disposed = true;\n                    TaskTracker.RemoveTracking(this);\n                }\n                return default;\n            }\n\n            public bool MoveNext()\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    completionSource.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n                if (disposed)\n                {\n                    completionSource.TrySetResult(false);\n                    return false;\n                }\n\n                if (dueTimePhase)\n                {\n                    if (currentFrame == 0)\n                    {\n                        if (dueTimeFrameCount == 0)\n                        {\n                            dueTimePhase = false;\n                            completionSource.TrySetResult(true);\n                            return true;\n                        }\n\n                        // skip in initial frame.\n                        if (initialFrame == Time.frameCount)\n                        {\n                            return true;\n                        }\n                    }\n\n                    if (++currentFrame >= dueTimeFrameCount)\n                    {\n                        dueTimePhase = false;\n                        completionSource.TrySetResult(true);\n                    }\n                    else\n                    {\n                    }\n                }\n                else\n                {\n                    if (periodFrameCount == null)\n                    {\n                        completed = true;\n                        completionSource.TrySetResult(false);\n                        return false;\n                    }\n\n                    if (++currentFrame >= periodFrameCount)\n                    {\n                        completionSource.TrySetResult(true);\n                    }\n                }\n\n                return true;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/UnityExtensions/Timer.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 382caacde439855418709c641e4d7b04\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/UnityExtensions.meta",
    "content": "fileFormatVersion: 2\nguid: 669f5459819f7284ca1b35f4d55fe226\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Where.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n        public static IUniTaskAsyncEnumerable<TSource> Where<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Boolean> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new Where<TSource>(source, predicate);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> Where<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, Boolean> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new WhereInt<TSource>(source, predicate);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> WhereAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<Boolean>> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new WhereAwait<TSource>(source, predicate);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> WhereAwait<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, UniTask<Boolean>> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new WhereIntAwait<TSource>(source, predicate);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> WhereAwaitWithCancellation<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<Boolean>> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new WhereAwaitWithCancellation<TSource>(source, predicate);\n        }\n\n        public static IUniTaskAsyncEnumerable<TSource> WhereAwaitWithCancellation<TSource>(this IUniTaskAsyncEnumerable<TSource> source, Func<TSource, Int32, CancellationToken, UniTask<Boolean>> predicate)\n        {\n            Error.ThrowArgumentNullException(source, nameof(source));\n            Error.ThrowArgumentNullException(predicate, nameof(predicate));\n\n            return new WhereIntAwaitWithCancellation<TSource>(source, predicate);\n        }\n    }\n\n    internal sealed class Where<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, bool> predicate;\n\n        public Where(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, bool> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Where(source, predicate, cancellationToken);\n        }\n\n        sealed class _Where : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, bool> predicate;\n            readonly CancellationToken cancellationToken;\n\n            int state = -1;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            Action moveNextAction;\n\n            public _Where(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, bool> predicate, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.predicate = predicate;\n                this.cancellationToken = cancellationToken;\n                this.moveNextAction = MoveNext;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (state == -2) return default;\n\n                completionSource.Reset();\n                MoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNext()\n            {\n                REPEAT:\n                try\n                {\n                    switch (state)\n                    {\n                        case -1: // init\n                            enumerator = source.GetAsyncEnumerator(cancellationToken);\n                            goto case 0;\n                        case 0:\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case 1;\n                            }\n                            else\n                            {\n                                state = 1;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case 1:\n                            if (awaiter.GetResult())\n                            {\n                                Current = enumerator.Current;\n                                if (predicate(Current))\n                                {\n                                    goto CONTINUE;\n                                }\n                                else\n                                {\n                                    state = 0;\n                                    goto REPEAT;\n                                }\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        default:\n                            goto DONE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    state = -2;\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                state = -2;\n                completionSource.TrySetResult(false);\n                return;\n\n                CONTINUE:\n                state = 0;\n                completionSource.TrySetResult(true);\n                return;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                return enumerator.DisposeAsync();\n            }\n        }\n    }\n\n    internal sealed class WhereInt<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, int, bool> predicate;\n\n        public WhereInt(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, bool> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Where(source, predicate, cancellationToken);\n        }\n\n        sealed class _Where : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, int, bool> predicate;\n            readonly CancellationToken cancellationToken;\n\n            int state = -1;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            Action moveNextAction;\n            int index;\n\n            public _Where(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, bool> predicate, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.predicate = predicate;\n                this.cancellationToken = cancellationToken;\n                this.moveNextAction = MoveNext;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (state == -2) return default;\n\n                completionSource.Reset();\n                MoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNext()\n            {\n                REPEAT:\n                try\n                {\n                    switch (state)\n                    {\n                        case -1: // init\n                            enumerator = source.GetAsyncEnumerator(cancellationToken);\n                            goto case 0;\n                        case 0:\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case 1;\n                            }\n                            else\n                            {\n                                state = 1;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case 1:\n                            if (awaiter.GetResult())\n                            {\n                                Current = enumerator.Current;\n                                if (predicate(Current, checked(index++)))\n                                {\n                                    goto CONTINUE;\n                                }\n                                else\n                                {\n                                    state = 0;\n                                    goto REPEAT;\n                                }\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        default:\n                            goto DONE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    state = -2;\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                state = -2;\n                completionSource.TrySetResult(false);\n                return;\n\n                CONTINUE:\n                state = 0;\n                completionSource.TrySetResult(true);\n                return;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                return enumerator.DisposeAsync();\n            }\n        }\n    }\n\n    internal sealed class WhereAwait<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, UniTask<bool>> predicate;\n\n        public WhereAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<bool>> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _WhereAwait(source, predicate, cancellationToken);\n        }\n\n        sealed class _WhereAwait : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, UniTask<bool>> predicate;\n            readonly CancellationToken cancellationToken;\n\n            int state = -1;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            UniTask<bool>.Awaiter awaiter2;\n            Action moveNextAction;\n\n            public _WhereAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, UniTask<bool>> predicate, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.predicate = predicate;\n                this.cancellationToken = cancellationToken;\n                this.moveNextAction = MoveNext;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (state == -2) return default;\n\n                completionSource.Reset();\n                MoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNext()\n            {\n                REPEAT:\n                try\n                {\n                    switch (state)\n                    {\n                        case -1: // init\n                            enumerator = source.GetAsyncEnumerator(cancellationToken);\n                            goto case 0;\n                        case 0:\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case 1;\n                            }\n                            else\n                            {\n                                state = 1;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case 1:\n                            if (awaiter.GetResult())\n                            {\n                                Current = enumerator.Current;\n\n                                awaiter2 = predicate(Current).GetAwaiter();\n                                if (awaiter2.IsCompleted)\n                                {\n                                    goto case 2;\n                                }\n                                else\n                                {\n                                    state = 2;\n                                    awaiter2.UnsafeOnCompleted(moveNextAction);\n                                    return;\n                                }\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        case 2:\n                            if (awaiter2.GetResult())\n                            {\n                                goto CONTINUE;\n                            }\n                            else\n                            {\n                                state = 0;\n                                goto REPEAT;\n                            }\n                        default:\n                            goto DONE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    state = -2;\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                state = -2;\n                completionSource.TrySetResult(false);\n                return;\n\n                CONTINUE:\n                state = 0;\n                completionSource.TrySetResult(true);\n                return;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                return enumerator.DisposeAsync();\n            }\n        }\n    }\n\n    internal sealed class WhereIntAwait<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, int, UniTask<bool>> predicate;\n\n        public WhereIntAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, UniTask<bool>> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _WhereAwait(source, predicate, cancellationToken);\n        }\n\n        sealed class _WhereAwait : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, int, UniTask<bool>> predicate;\n            readonly CancellationToken cancellationToken;\n\n            int state = -1;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            UniTask<bool>.Awaiter awaiter2;\n            Action moveNextAction;\n            int index;\n\n            public _WhereAwait(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, UniTask<bool>> predicate, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.predicate = predicate;\n                this.cancellationToken = cancellationToken;\n                this.moveNextAction = MoveNext;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (state == -2) return default;\n\n                completionSource.Reset();\n                MoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNext()\n            {\n                REPEAT:\n                try\n                {\n                    switch (state)\n                    {\n                        case -1: // init\n                            enumerator = source.GetAsyncEnumerator(cancellationToken);\n                            goto case 0;\n                        case 0:\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case 1;\n                            }\n                            else\n                            {\n                                state = 1;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case 1:\n                            if (awaiter.GetResult())\n                            {\n                                Current = enumerator.Current;\n\n                                awaiter2 = predicate(Current, checked(index++)).GetAwaiter();\n                                if (awaiter2.IsCompleted)\n                                {\n                                    goto case 2;\n                                }\n                                else\n                                {\n                                    state = 2;\n                                    awaiter2.UnsafeOnCompleted(moveNextAction);\n                                    return;\n                                }\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        case 2:\n                            if (awaiter2.GetResult())\n                            {\n                                goto CONTINUE;\n                            }\n                            else\n                            {\n                                state = 0;\n                                goto REPEAT;\n                            }\n                        default:\n                            goto DONE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    state = -2;\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                state = -2;\n                completionSource.TrySetResult(false);\n                return;\n\n                CONTINUE:\n                state = 0;\n                completionSource.TrySetResult(true);\n                return;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                return enumerator.DisposeAsync();\n            }\n        }\n    }\n\n    internal sealed class WhereAwaitWithCancellation<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, CancellationToken, UniTask<bool>> predicate;\n\n        public WhereAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<bool>> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _WhereAwaitWithCancellation(source, predicate, cancellationToken);\n        }\n\n        sealed class _WhereAwaitWithCancellation : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, CancellationToken, UniTask<bool>> predicate;\n            readonly CancellationToken cancellationToken;\n\n            int state = -1;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            UniTask<bool>.Awaiter awaiter2;\n            Action moveNextAction;\n\n            public _WhereAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, UniTask<bool>> predicate, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.predicate = predicate;\n                this.cancellationToken = cancellationToken;\n                this.moveNextAction = MoveNext;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (state == -2) return default;\n\n                completionSource.Reset();\n                MoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNext()\n            {\n                REPEAT:\n                try\n                {\n                    switch (state)\n                    {\n                        case -1: // init\n                            enumerator = source.GetAsyncEnumerator(cancellationToken);\n                            goto case 0;\n                        case 0:\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case 1;\n                            }\n                            else\n                            {\n                                state = 1;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case 1:\n                            if (awaiter.GetResult())\n                            {\n                                Current = enumerator.Current;\n\n                                awaiter2 = predicate(Current, cancellationToken).GetAwaiter();\n                                if (awaiter2.IsCompleted)\n                                {\n                                    goto case 2;\n                                }\n                                else\n                                {\n                                    state = 2;\n                                    awaiter2.UnsafeOnCompleted(moveNextAction);\n                                    return;\n                                }\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        case 2:\n                            if (awaiter2.GetResult())\n                            {\n                                goto CONTINUE;\n                            }\n                            else\n                            {\n                                state = 0;\n                                goto REPEAT;\n                            }\n                        default:\n                            goto DONE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    state = -2;\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                state = -2;\n                completionSource.TrySetResult(false);\n                return;\n\n                CONTINUE:\n                state = 0;\n                completionSource.TrySetResult(true);\n                return;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                return enumerator.DisposeAsync();\n            }\n        }\n    }\n\n    internal sealed class WhereIntAwaitWithCancellation<TSource> : IUniTaskAsyncEnumerable<TSource>\n    {\n        readonly IUniTaskAsyncEnumerable<TSource> source;\n        readonly Func<TSource, int, CancellationToken, UniTask<bool>> predicate;\n\n        public WhereIntAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, CancellationToken, UniTask<bool>> predicate)\n        {\n            this.source = source;\n            this.predicate = predicate;\n        }\n\n        public IUniTaskAsyncEnumerator<TSource> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _WhereAwaitWithCancellation(source, predicate, cancellationToken);\n        }\n\n        sealed class _WhereAwaitWithCancellation : MoveNextSource, IUniTaskAsyncEnumerator<TSource>\n        {\n            readonly IUniTaskAsyncEnumerable<TSource> source;\n            readonly Func<TSource, int, CancellationToken, UniTask<bool>> predicate;\n            readonly CancellationToken cancellationToken;\n\n            int state = -1;\n            IUniTaskAsyncEnumerator<TSource> enumerator;\n            UniTask<bool>.Awaiter awaiter;\n            UniTask<bool>.Awaiter awaiter2;\n            Action moveNextAction;\n            int index;\n\n            public _WhereAwaitWithCancellation(IUniTaskAsyncEnumerable<TSource> source, Func<TSource, int, CancellationToken, UniTask<bool>> predicate, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.predicate = predicate;\n                this.cancellationToken = cancellationToken;\n                this.moveNextAction = MoveNext;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TSource Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                if (state == -2) return default;\n\n                completionSource.Reset();\n                MoveNext();\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void MoveNext()\n            {\n                REPEAT:\n                try\n                {\n                    switch (state)\n                    {\n                        case -1: // init\n                            enumerator = source.GetAsyncEnumerator(cancellationToken);\n                            goto case 0;\n                        case 0:\n                            awaiter = enumerator.MoveNextAsync().GetAwaiter();\n                            if (awaiter.IsCompleted)\n                            {\n                                goto case 1;\n                            }\n                            else\n                            {\n                                state = 1;\n                                awaiter.UnsafeOnCompleted(moveNextAction);\n                                return;\n                            }\n                        case 1:\n                            if (awaiter.GetResult())\n                            {\n                                Current = enumerator.Current;\n\n                                awaiter2 = predicate(Current, checked(index++), cancellationToken).GetAwaiter();\n                                if (awaiter2.IsCompleted)\n                                {\n                                    goto case 2;\n                                }\n                                else\n                                {\n                                    state = 2;\n                                    awaiter2.UnsafeOnCompleted(moveNextAction);\n                                    return;\n                                }\n                            }\n                            else\n                            {\n                                goto DONE;\n                            }\n                        case 2:\n                            if (awaiter2.GetResult())\n                            {\n                                goto CONTINUE;\n                            }\n                            else\n                            {\n                                state = 0;\n                                goto REPEAT;\n                            }\n                        default:\n                            goto DONE;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    state = -2;\n                    completionSource.TrySetException(ex);\n                    return;\n                }\n\n                DONE:\n                state = -2;\n                completionSource.TrySetResult(false);\n                return;\n\n                CONTINUE:\n                state = 0;\n                completionSource.TrySetResult(true);\n                return;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                return enumerator.DisposeAsync();\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Where.cs.meta",
    "content": "fileFormatVersion: 2\nguid: d882a3238d9535e4e8ce1ad3291eb7fb\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Zip.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks.Linq\n{\n    public static partial class UniTaskAsyncEnumerable\n    {\n\n        public static IUniTaskAsyncEnumerable<(TFirst First, TSecond Second)> Zip<TFirst, TSecond>(this IUniTaskAsyncEnumerable<TFirst> first, IUniTaskAsyncEnumerable<TSecond> second)\n        {\n            Error.ThrowArgumentNullException(first, nameof(first));\n            Error.ThrowArgumentNullException(second, nameof(second));\n\n            return Zip(first, second, (x, y) => (x, y));\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> Zip<TFirst, TSecond, TResult>(this IUniTaskAsyncEnumerable<TFirst> first, IUniTaskAsyncEnumerable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector)\n        {\n            Error.ThrowArgumentNullException(first, nameof(first));\n            Error.ThrowArgumentNullException(second, nameof(second));\n            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));\n\n            return new Zip<TFirst, TSecond, TResult>(first, second, resultSelector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> ZipAwait<TFirst, TSecond, TResult>(this IUniTaskAsyncEnumerable<TFirst> first, IUniTaskAsyncEnumerable<TSecond> second, Func<TFirst, TSecond, UniTask<TResult>> selector)\n        {\n            Error.ThrowArgumentNullException(first, nameof(first));\n            Error.ThrowArgumentNullException(second, nameof(second));\n            Error.ThrowArgumentNullException(selector, nameof(selector));\n\n            return new ZipAwait<TFirst, TSecond, TResult>(first, second, selector);\n        }\n\n        public static IUniTaskAsyncEnumerable<TResult> ZipAwaitWithCancellation<TFirst, TSecond, TResult>(this IUniTaskAsyncEnumerable<TFirst> first, IUniTaskAsyncEnumerable<TSecond> second, Func<TFirst, TSecond, CancellationToken, UniTask<TResult>> selector)\n        {\n            Error.ThrowArgumentNullException(first, nameof(first));\n            Error.ThrowArgumentNullException(second, nameof(second));\n            Error.ThrowArgumentNullException(selector, nameof(selector));\n\n            return new ZipAwaitWithCancellation<TFirst, TSecond, TResult>(first, second, selector);\n        }\n    }\n\n    internal sealed class Zip<TFirst, TSecond, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TFirst> first;\n        readonly IUniTaskAsyncEnumerable<TSecond> second;\n        readonly Func<TFirst, TSecond, TResult> resultSelector;\n\n        public Zip(IUniTaskAsyncEnumerable<TFirst> first, IUniTaskAsyncEnumerable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector)\n        {\n            this.first = first;\n            this.second = second;\n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _Zip(first, second, resultSelector, cancellationToken);\n        }\n\n        sealed class _Zip : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> firstMoveNextCoreDelegate = FirstMoveNextCore;\n            static readonly Action<object> secondMoveNextCoreDelegate = SecondMoveNextCore;\n\n            readonly IUniTaskAsyncEnumerable<TFirst> first;\n            readonly IUniTaskAsyncEnumerable<TSecond> second;\n            readonly Func<TFirst, TSecond, TResult> resultSelector;\n\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<TFirst> firstEnumerator;\n            IUniTaskAsyncEnumerator<TSecond> secondEnumerator;\n\n            UniTask<bool>.Awaiter firstAwaiter;\n            UniTask<bool>.Awaiter secondAwaiter;\n\n            public _Zip(IUniTaskAsyncEnumerable<TFirst> first, IUniTaskAsyncEnumerable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector, CancellationToken cancellationToken)\n            {\n                this.first = first;\n                this.second = second;\n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                completionSource.Reset();\n\n                if (firstEnumerator == null)\n                {\n                    firstEnumerator = first.GetAsyncEnumerator(cancellationToken);\n                    secondEnumerator = second.GetAsyncEnumerator(cancellationToken);\n                }\n\n                firstAwaiter = firstEnumerator.MoveNextAsync().GetAwaiter();\n\n                if (firstAwaiter.IsCompleted)\n                {\n                    FirstMoveNextCore(this);\n                }\n                else\n                {\n                    firstAwaiter.SourceOnCompleted(firstMoveNextCoreDelegate, this);\n                }\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void FirstMoveNextCore(object state)\n            {\n                var self = (_Zip)state;\n\n                if (self.TryGetResult(self.firstAwaiter, out var result))\n                {\n                    if (result)\n                    {\n                        try\n                        {\n                            self.secondAwaiter = self.secondEnumerator.MoveNextAsync().GetAwaiter();\n                        }\n                        catch (Exception ex)\n                        {\n                            self.completionSource.TrySetException(ex);\n                            return;\n                        }\n\n                        if (self.secondAwaiter.IsCompleted)\n                        {\n                            SecondMoveNextCore(self);\n                        }\n                        else\n                        {\n                            self.secondAwaiter.SourceOnCompleted(secondMoveNextCoreDelegate, self);\n                        }\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            static void SecondMoveNextCore(object state)\n            {\n                var self = (_Zip)state;\n\n                if (self.TryGetResult(self.secondAwaiter, out var result))\n                {\n                    if (result)\n                    {\n                        try\n                        {\n                            self.Current = self.resultSelector(self.firstEnumerator.Current, self.secondEnumerator.Current);\n                        }\n                        catch (Exception ex)\n                        {\n                            self.completionSource.TrySetException(ex);\n                        }\n\n                        if (self.cancellationToken.IsCancellationRequested)\n                        {\n                            self.completionSource.TrySetCanceled(self.cancellationToken);\n                        }\n                        else\n                        {\n                            self.completionSource.TrySetResult(true);\n                        }\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (firstEnumerator != null)\n                {\n                    await firstEnumerator.DisposeAsync();\n                }\n                if (secondEnumerator != null)\n                {\n                    await secondEnumerator.DisposeAsync();\n                }\n            }\n        }\n    }\n\n    internal sealed class ZipAwait<TFirst, TSecond, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TFirst> first;\n        readonly IUniTaskAsyncEnumerable<TSecond> second;\n        readonly Func<TFirst, TSecond, UniTask<TResult>> resultSelector;\n\n        public ZipAwait(IUniTaskAsyncEnumerable<TFirst> first, IUniTaskAsyncEnumerable<TSecond> second, Func<TFirst, TSecond, UniTask<TResult>> resultSelector)\n        {\n            this.first = first;\n            this.second = second;\n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _ZipAwait(first, second, resultSelector, cancellationToken);\n        }\n\n        sealed class _ZipAwait : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> firstMoveNextCoreDelegate = FirstMoveNextCore;\n            static readonly Action<object> secondMoveNextCoreDelegate = SecondMoveNextCore;\n            static readonly Action<object> resultAwaitCoreDelegate = ResultAwaitCore;\n\n            readonly IUniTaskAsyncEnumerable<TFirst> first;\n            readonly IUniTaskAsyncEnumerable<TSecond> second;\n            readonly Func<TFirst, TSecond, UniTask<TResult>> resultSelector;\n\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<TFirst> firstEnumerator;\n            IUniTaskAsyncEnumerator<TSecond> secondEnumerator;\n\n            UniTask<bool>.Awaiter firstAwaiter;\n            UniTask<bool>.Awaiter secondAwaiter;\n            UniTask<TResult>.Awaiter resultAwaiter;\n\n            public _ZipAwait(IUniTaskAsyncEnumerable<TFirst> first, IUniTaskAsyncEnumerable<TSecond> second, Func<TFirst, TSecond, UniTask<TResult>> resultSelector, CancellationToken cancellationToken)\n            {\n                this.first = first;\n                this.second = second;\n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                completionSource.Reset();\n\n                if (firstEnumerator == null)\n                {\n                    firstEnumerator = first.GetAsyncEnumerator(cancellationToken);\n                    secondEnumerator = second.GetAsyncEnumerator(cancellationToken);\n                }\n\n                firstAwaiter = firstEnumerator.MoveNextAsync().GetAwaiter();\n\n                if (firstAwaiter.IsCompleted)\n                {\n                    FirstMoveNextCore(this);\n                }\n                else\n                {\n                    firstAwaiter.SourceOnCompleted(firstMoveNextCoreDelegate, this);\n                }\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void FirstMoveNextCore(object state)\n            {\n                var self = (_ZipAwait)state;\n\n                if (self.TryGetResult(self.firstAwaiter, out var result))\n                {\n                    if (result)\n                    {\n                        try\n                        {\n                            self.secondAwaiter = self.secondEnumerator.MoveNextAsync().GetAwaiter();\n                        }\n                        catch (Exception ex)\n                        {\n                            self.completionSource.TrySetException(ex);\n                            return;\n                        }\n\n                        if (self.secondAwaiter.IsCompleted)\n                        {\n                            SecondMoveNextCore(self);\n                        }\n                        else\n                        {\n                            self.secondAwaiter.SourceOnCompleted(secondMoveNextCoreDelegate, self);\n                        }\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            static void SecondMoveNextCore(object state)\n            {\n                var self = (_ZipAwait)state;\n\n                if (self.TryGetResult(self.secondAwaiter, out var result))\n                {\n                    if (result)\n                    {\n                        try\n                        {\n                            self.resultAwaiter = self.resultSelector(self.firstEnumerator.Current, self.secondEnumerator.Current).GetAwaiter();\n                            if (self.resultAwaiter.IsCompleted)\n                            {\n                                ResultAwaitCore(self);\n                            }\n                            else\n                            {\n                                self.resultAwaiter.SourceOnCompleted(resultAwaitCoreDelegate, self);\n                            }\n                        }\n                        catch (Exception ex)\n                        {\n                            self.completionSource.TrySetException(ex);\n                        }\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            static void ResultAwaitCore(object state)\n            {\n                var self = (_ZipAwait)state;\n\n                if (self.TryGetResult(self.resultAwaiter, out var result))\n                {\n                    self.Current = result;\n\n                    if (self.cancellationToken.IsCancellationRequested)\n                    {\n                        self.completionSource.TrySetCanceled(self.cancellationToken);\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(true);\n                    }\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (firstEnumerator != null)\n                {\n                    await firstEnumerator.DisposeAsync();\n                }\n                if (secondEnumerator != null)\n                {\n                    await secondEnumerator.DisposeAsync();\n                }\n            }\n        }\n    }\n\n    internal sealed class ZipAwaitWithCancellation<TFirst, TSecond, TResult> : IUniTaskAsyncEnumerable<TResult>\n    {\n        readonly IUniTaskAsyncEnumerable<TFirst> first;\n        readonly IUniTaskAsyncEnumerable<TSecond> second;\n        readonly Func<TFirst, TSecond, CancellationToken, UniTask<TResult>> resultSelector;\n\n        public ZipAwaitWithCancellation(IUniTaskAsyncEnumerable<TFirst> first, IUniTaskAsyncEnumerable<TSecond> second, Func<TFirst, TSecond, CancellationToken, UniTask<TResult>> resultSelector)\n        {\n            this.first = first;\n            this.second = second;\n            this.resultSelector = resultSelector;\n        }\n\n        public IUniTaskAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new _ZipAwaitWithCancellation(first, second, resultSelector, cancellationToken);\n        }\n\n        sealed class _ZipAwaitWithCancellation : MoveNextSource, IUniTaskAsyncEnumerator<TResult>\n        {\n            static readonly Action<object> firstMoveNextCoreDelegate = FirstMoveNextCore;\n            static readonly Action<object> secondMoveNextCoreDelegate = SecondMoveNextCore;\n            static readonly Action<object> resultAwaitCoreDelegate = ResultAwaitCore;\n\n            readonly IUniTaskAsyncEnumerable<TFirst> first;\n            readonly IUniTaskAsyncEnumerable<TSecond> second;\n            readonly Func<TFirst, TSecond, CancellationToken, UniTask<TResult>> resultSelector;\n\n            CancellationToken cancellationToken;\n\n            IUniTaskAsyncEnumerator<TFirst> firstEnumerator;\n            IUniTaskAsyncEnumerator<TSecond> secondEnumerator;\n\n            UniTask<bool>.Awaiter firstAwaiter;\n            UniTask<bool>.Awaiter secondAwaiter;\n            UniTask<TResult>.Awaiter resultAwaiter;\n\n            public _ZipAwaitWithCancellation(IUniTaskAsyncEnumerable<TFirst> first, IUniTaskAsyncEnumerable<TSecond> second, Func<TFirst, TSecond, CancellationToken, UniTask<TResult>> resultSelector, CancellationToken cancellationToken)\n            {\n                this.first = first;\n                this.second = second;\n                this.resultSelector = resultSelector;\n                this.cancellationToken = cancellationToken;\n                TaskTracker.TrackActiveTask(this, 3);\n            }\n\n            public TResult Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                completionSource.Reset();\n\n                if (firstEnumerator == null)\n                {\n                    firstEnumerator = first.GetAsyncEnumerator(cancellationToken);\n                    secondEnumerator = second.GetAsyncEnumerator(cancellationToken);\n                }\n\n                firstAwaiter = firstEnumerator.MoveNextAsync().GetAwaiter();\n\n                if (firstAwaiter.IsCompleted)\n                {\n                    FirstMoveNextCore(this);\n                }\n                else\n                {\n                    firstAwaiter.SourceOnCompleted(firstMoveNextCoreDelegate, this);\n                }\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            static void FirstMoveNextCore(object state)\n            {\n                var self = (_ZipAwaitWithCancellation)state;\n\n                if (self.TryGetResult(self.firstAwaiter, out var result))\n                {\n                    if (result)\n                    {\n                        try\n                        {\n                            self.secondAwaiter = self.secondEnumerator.MoveNextAsync().GetAwaiter();\n                        }\n                        catch (Exception ex)\n                        {\n                            self.completionSource.TrySetException(ex);\n                            return;\n                        }\n\n                        if (self.secondAwaiter.IsCompleted)\n                        {\n                            SecondMoveNextCore(self);\n                        }\n                        else\n                        {\n                            self.secondAwaiter.SourceOnCompleted(secondMoveNextCoreDelegate, self);\n                        }\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            static void SecondMoveNextCore(object state)\n            {\n                var self = (_ZipAwaitWithCancellation)state;\n\n                if (self.TryGetResult(self.secondAwaiter, out var result))\n                {\n                    if (result)\n                    {\n                        try\n                        {\n                            self.resultAwaiter = self.resultSelector(self.firstEnumerator.Current, self.secondEnumerator.Current, self.cancellationToken).GetAwaiter();\n                            if (self.resultAwaiter.IsCompleted)\n                            {\n                                ResultAwaitCore(self);\n                            }\n                            else\n                            {\n                                self.resultAwaiter.SourceOnCompleted(resultAwaitCoreDelegate, self);\n                            }\n                        }\n                        catch (Exception ex)\n                        {\n                            self.completionSource.TrySetException(ex);\n                        }\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(false);\n                    }\n                }\n            }\n\n            static void ResultAwaitCore(object state)\n            {\n                var self = (_ZipAwaitWithCancellation)state;\n\n                if (self.TryGetResult(self.resultAwaiter, out var result))\n                {\n                    self.Current = result;\n\n                    if (self.cancellationToken.IsCancellationRequested)\n                    {\n                        self.completionSource.TrySetCanceled(self.cancellationToken);\n                    }\n                    else\n                    {\n                        self.completionSource.TrySetResult(true);\n                    }\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                TaskTracker.RemoveTracking(this);\n                if (firstEnumerator != null)\n                {\n                    await firstEnumerator.DisposeAsync();\n                }\n                if (secondEnumerator != null)\n                {\n                    await secondEnumerator.DisposeAsync();\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq/Zip.cs.meta",
    "content": "fileFormatVersion: 2\nguid: acc1acff153e347418f0f30b1c535994\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Linq.meta",
    "content": "fileFormatVersion: 2\nguid: 4cc94a232b1c1154b8084bdda29c3484\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/MoveNextSource.cs",
    "content": "﻿using System;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public abstract class MoveNextSource : IUniTaskSource<bool>\n    {\n        protected UniTaskCompletionSourceCore<bool> completionSource;\n\n        public bool GetResult(short token)\n        {\n            return completionSource.GetResult(token);\n        }\n\n        public UniTaskStatus GetStatus(short token)\n        {\n            return completionSource.GetStatus(token);\n        }\n\n        public void OnCompleted(Action<object> continuation, object state, short token)\n        {\n            completionSource.OnCompleted(continuation, state, token);\n        }\n\n        public UniTaskStatus UnsafeGetStatus()\n        {\n            return completionSource.UnsafeGetStatus();\n        }\n\n        void IUniTaskSource.GetResult(short token)\n        {\n            completionSource.GetResult(token);\n        }\n\n        protected bool TryGetResult<T>(UniTask<T>.Awaiter awaiter, out T result)\n        {\n            try\n            {\n                result = awaiter.GetResult();\n                return true;\n            }\n            catch (Exception ex)\n            {\n                completionSource.TrySetException(ex);\n                result = default;\n                return false;\n            }\n        }\n\n        protected bool TryGetResult(UniTask.Awaiter awaiter)\n        {\n            try\n            {\n                awaiter.GetResult();\n                return true;\n            }\n            catch (Exception ex)\n            {\n                completionSource.TrySetException(ex);\n                return false;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/MoveNextSource.cs.meta",
    "content": "fileFormatVersion: 2\nguid: dc4c5dc2a5f246e4f8df44cab735826c\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/PlayerLoopHelper.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Linq;\nusing UnityEngine;\nusing Cysharp.Threading.Tasks.Internal;\nusing System.Threading;\n\n#if UNITY_2019_3_OR_NEWER\nusing UnityEngine.LowLevel;\nusing PlayerLoopType = UnityEngine.PlayerLoop;\n#else\nusing UnityEngine.Experimental.LowLevel;\nusing PlayerLoopType = UnityEngine.Experimental.PlayerLoop;\n#endif\n\n#if UNITY_EDITOR\nusing UnityEditor;\n#endif\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static class UniTaskLoopRunners\n    {\n        public struct UniTaskLoopRunnerInitialization { };\n        public struct UniTaskLoopRunnerEarlyUpdate { };\n        public struct UniTaskLoopRunnerFixedUpdate { };\n        public struct UniTaskLoopRunnerPreUpdate { };\n        public struct UniTaskLoopRunnerUpdate { };\n        public struct UniTaskLoopRunnerPreLateUpdate { };\n        public struct UniTaskLoopRunnerPostLateUpdate { };\n\n        // Last\n\n        public struct UniTaskLoopRunnerLastInitialization { };\n        public struct UniTaskLoopRunnerLastEarlyUpdate { };\n        public struct UniTaskLoopRunnerLastFixedUpdate { };\n        public struct UniTaskLoopRunnerLastPreUpdate { };\n        public struct UniTaskLoopRunnerLastUpdate { };\n        public struct UniTaskLoopRunnerLastPreLateUpdate { };\n        public struct UniTaskLoopRunnerLastPostLateUpdate { };\n\n        // Yield\n\n        public struct UniTaskLoopRunnerYieldInitialization { };\n        public struct UniTaskLoopRunnerYieldEarlyUpdate { };\n        public struct UniTaskLoopRunnerYieldFixedUpdate { };\n        public struct UniTaskLoopRunnerYieldPreUpdate { };\n        public struct UniTaskLoopRunnerYieldUpdate { };\n        public struct UniTaskLoopRunnerYieldPreLateUpdate { };\n        public struct UniTaskLoopRunnerYieldPostLateUpdate { };\n\n        // Yield Last\n\n        public struct UniTaskLoopRunnerLastYieldInitialization { };\n        public struct UniTaskLoopRunnerLastYieldEarlyUpdate { };\n        public struct UniTaskLoopRunnerLastYieldFixedUpdate { };\n        public struct UniTaskLoopRunnerLastYieldPreUpdate { };\n        public struct UniTaskLoopRunnerLastYieldUpdate { };\n        public struct UniTaskLoopRunnerLastYieldPreLateUpdate { };\n        public struct UniTaskLoopRunnerLastYieldPostLateUpdate { };\n\n#if UNITY_2020_2_OR_NEWER\n        public struct UniTaskLoopRunnerTimeUpdate { };\n        public struct UniTaskLoopRunnerLastTimeUpdate { };\n        public struct UniTaskLoopRunnerYieldTimeUpdate { };\n        public struct UniTaskLoopRunnerLastYieldTimeUpdate { };\n#endif\n    }\n\n    public enum PlayerLoopTiming\n    {\n        Initialization = 0,\n        LastInitialization = 1,\n\n        EarlyUpdate = 2,\n        LastEarlyUpdate = 3,\n\n        FixedUpdate = 4,\n        LastFixedUpdate = 5,\n\n        PreUpdate = 6,\n        LastPreUpdate = 7,\n\n        Update = 8,\n        LastUpdate = 9,\n\n        PreLateUpdate = 10,\n        LastPreLateUpdate = 11,\n\n        PostLateUpdate = 12,\n        LastPostLateUpdate = 13,\n\n#if UNITY_2020_2_OR_NEWER\n        // Unity 2020.2 added TimeUpdate https://docs.unity3d.com/2020.2/Documentation/ScriptReference/PlayerLoop.TimeUpdate.html\n        TimeUpdate = 14,\n        LastTimeUpdate = 15,\n#endif\n    }\n\n    [Flags]\n    public enum InjectPlayerLoopTimings\n    {\n        /// <summary>\n        /// Preset: All loops(default).\n        /// </summary>\n        All =\n            Initialization | LastInitialization |\n            EarlyUpdate | LastEarlyUpdate |\n            FixedUpdate | LastFixedUpdate |\n            PreUpdate | LastPreUpdate |\n            Update | LastUpdate |\n            PreLateUpdate | LastPreLateUpdate |\n            PostLateUpdate | LastPostLateUpdate\n#if UNITY_2020_2_OR_NEWER\n            | TimeUpdate | LastTimeUpdate,\n#else\n            ,\n#endif\n\n        /// <summary>\n        /// Preset: All without last except LastPostLateUpdate.\n        /// </summary>\n        Standard =\n            Initialization |\n            EarlyUpdate |\n            FixedUpdate |\n            PreUpdate |\n            Update |\n            PreLateUpdate |\n            PostLateUpdate | LastPostLateUpdate\n#if UNITY_2020_2_OR_NEWER\n            | TimeUpdate\n#endif\n            ,\n\n        /// <summary>\n        /// Preset: Minimum pattern, Update | FixedUpdate | LastPostLateUpdate\n        /// </summary>\n        Minimum =\n            Update | FixedUpdate | LastPostLateUpdate,\n\n        // PlayerLoopTiming\n\n        Initialization = 1,\n        LastInitialization = 2,\n\n        EarlyUpdate = 4,\n        LastEarlyUpdate = 8,\n\n        FixedUpdate = 16,\n        LastFixedUpdate = 32,\n\n        PreUpdate = 64,\n        LastPreUpdate = 128,\n\n        Update = 256,\n        LastUpdate = 512,\n\n        PreLateUpdate = 1024,\n        LastPreLateUpdate = 2048,\n\n        PostLateUpdate = 4096,\n        LastPostLateUpdate = 8192\n\n#if UNITY_2020_2_OR_NEWER\n        ,\n        // Unity 2020.2 added TimeUpdate https://docs.unity3d.com/2020.2/Documentation/ScriptReference/PlayerLoop.TimeUpdate.html\n        TimeUpdate = 16384,\n        LastTimeUpdate = 32768\n#endif\n    }\n\n    public interface IPlayerLoopItem\n    {\n        bool MoveNext();\n    }\n\n    public static class PlayerLoopHelper\n    {\n        static readonly ContinuationQueue ThrowMarkerContinuationQueue = new ContinuationQueue(PlayerLoopTiming.Initialization);\n        static readonly PlayerLoopRunner ThrowMarkerPlayerLoopRunner = new PlayerLoopRunner(PlayerLoopTiming.Initialization);\n\n        public static SynchronizationContext UnitySynchronizationContext => unitySynchronizationContext;\n        public static int MainThreadId => mainThreadId;\n        internal static string ApplicationDataPath => applicationDataPath;\n\n        public static bool IsMainThread => Thread.CurrentThread.ManagedThreadId == mainThreadId;\n\n        static int mainThreadId;\n        static string applicationDataPath;\n        static SynchronizationContext unitySynchronizationContext;\n        static ContinuationQueue[] yielders;\n        static PlayerLoopRunner[] runners;\n        internal static bool IsEditorApplicationQuitting { get; private set; }\n        static PlayerLoopSystem[] InsertRunner(PlayerLoopSystem loopSystem,\n            bool injectOnFirst,\n            Type loopRunnerYieldType, ContinuationQueue cq,\n            Type loopRunnerType, PlayerLoopRunner runner)\n        {\n\n#if UNITY_EDITOR\n            EditorApplication.playModeStateChanged += (state) =>\n            {\n                if (state == PlayModeStateChange.EnteredEditMode || state == PlayModeStateChange.ExitingEditMode)\n                {\n                    IsEditorApplicationQuitting = true;\n                    // run rest action before clear.\n                    if (runner != null)\n                    {\n                        runner.Run();\n                        runner.Clear();\n                    }\n                    if (cq != null)\n                    {\n                        cq.Run();\n                        cq.Clear();\n                    }\n                    IsEditorApplicationQuitting = false;\n                }\n            };\n#endif\n\n            var yieldLoop = new PlayerLoopSystem\n            {\n                type = loopRunnerYieldType,\n                updateDelegate = cq.Run\n            };\n\n            var runnerLoop = new PlayerLoopSystem\n            {\n                type = loopRunnerType,\n                updateDelegate = runner.Run\n            };\n\n            // Remove items from previous initializations.\n            var source = RemoveRunner(loopSystem, loopRunnerYieldType, loopRunnerType);\n            var dest = new PlayerLoopSystem[source.Length + 2];\n\n            Array.Copy(source, 0, dest, injectOnFirst ? 2 : 0, source.Length);\n            if (injectOnFirst)\n            {\n                dest[0] = yieldLoop;\n                dest[1] = runnerLoop;\n            }\n            else\n            {\n                dest[dest.Length - 2] = yieldLoop;\n                dest[dest.Length - 1] = runnerLoop;\n            }\n\n            return dest;\n        }\n\n        static PlayerLoopSystem[] RemoveRunner(PlayerLoopSystem loopSystem, Type loopRunnerYieldType, Type loopRunnerType)\n        {\n            return loopSystem.subSystemList\n                .Where(ls => ls.type != loopRunnerYieldType && ls.type != loopRunnerType)\n                .ToArray();\n        }\n\n        static PlayerLoopSystem[] InsertUniTaskSynchronizationContext(PlayerLoopSystem loopSystem)\n        {\n            var loop = new PlayerLoopSystem\n            {\n                type = typeof(UniTaskSynchronizationContext),\n                updateDelegate = UniTaskSynchronizationContext.Run\n            };\n\n            // Remove items from previous initializations.\n            var source = loopSystem.subSystemList\n                .Where(ls => ls.type != typeof(UniTaskSynchronizationContext))\n                .ToArray();\n\n            var dest = new System.Collections.Generic.List<PlayerLoopSystem>(source);\n\n            var index = dest.FindIndex(x => x.type.Name == \"ScriptRunDelayedTasks\");\n            if (index == -1)\n            {\n                index = dest.FindIndex(x => x.type.Name == \"UniTaskLoopRunnerUpdate\");\n            }\n\n            dest.Insert(index + 1, loop);\n\n            return dest.ToArray();\n        }\n\n#if UNITY_2020_1_OR_NEWER\n\t\t[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]\n#else\n\t\t[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]\n#endif\n        static void Init()\n        {\n            // capture default(unity) sync-context.\n            unitySynchronizationContext = SynchronizationContext.Current;\n            mainThreadId = Thread.CurrentThread.ManagedThreadId;\n            try\n            {\n                applicationDataPath = Application.dataPath;\n            }\n            catch { }\n\n#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER\n            // When domain reload is disabled, re-initialization is required when entering play mode; \n            // otherwise, pending tasks will leak between play mode sessions.\n            var domainReloadDisabled = UnityEditor.EditorSettings.enterPlayModeOptionsEnabled &&\n                UnityEditor.EditorSettings.enterPlayModeOptions.HasFlag(UnityEditor.EnterPlayModeOptions.DisableDomainReload);\n            if (!domainReloadDisabled && runners != null) return;\n#else\n            if (runners != null) return; // already initialized\n#endif\n\n            var playerLoop =\n#if UNITY_2019_3_OR_NEWER\n                PlayerLoop.GetCurrentPlayerLoop();\n#else\n                PlayerLoop.GetDefaultPlayerLoop();\n#endif\n\n            Initialize(ref playerLoop);\n        }\n\n\n#if UNITY_EDITOR\n\n        [InitializeOnLoadMethod]\n        static void InitOnEditor()\n        {\n            // Execute the play mode init method\n            Init();\n\n            // register an Editor update delegate, used to forcing playerLoop update\n            EditorApplication.update += ForceEditorPlayerLoopUpdate;\n        }\n\n        private static void ForceEditorPlayerLoopUpdate()\n        {\n            if (EditorApplication.isPlayingOrWillChangePlaymode || EditorApplication.isCompiling || EditorApplication.isUpdating)\n            {\n                // Not in Edit mode, don't interfere\n                return;\n            }\n\n            // EditorApplication.QueuePlayerLoopUpdate causes performance issue, don't call directly.\n            // EditorApplication.QueuePlayerLoopUpdate();\n\n            if (yielders != null)\n            {\n                foreach (var item in yielders)\n                {\n                    if (item != null) item.Run();\n                }\n            }\n\n            if (runners != null)\n            {\n                foreach (var item in runners)\n                {\n                    if (item != null) item.Run();\n                }\n            }\n\n            UniTaskSynchronizationContext.Run();\n        }\n\n#endif\n\n        private static int FindLoopSystemIndex(PlayerLoopSystem[] playerLoopList, Type systemType)\n        {\n            for (int i = 0; i < playerLoopList.Length; i++)\n            {\n                if (playerLoopList[i].type == systemType)\n                {\n                    return i;\n                }\n            }\n\n            throw new Exception(\"Target PlayerLoopSystem does not found. Type:\" + systemType.FullName);\n        }\n\n        static void InsertLoop(PlayerLoopSystem[] copyList, InjectPlayerLoopTimings injectTimings, Type loopType, InjectPlayerLoopTimings targetTimings,\n            int index, bool injectOnFirst, Type loopRunnerYieldType, Type loopRunnerType, PlayerLoopTiming playerLoopTiming)\n        {\n            var i = FindLoopSystemIndex(copyList, loopType);\n            if ((injectTimings & targetTimings) == targetTimings)\n            {\n                copyList[i].subSystemList = InsertRunner(copyList[i], injectOnFirst,\n                    loopRunnerYieldType, yielders[index] = new ContinuationQueue(playerLoopTiming),\n                    loopRunnerType, runners[index] = new PlayerLoopRunner(playerLoopTiming));\n            }\n            else\n            {\n                copyList[i].subSystemList = RemoveRunner(copyList[i], loopRunnerYieldType, loopRunnerType);\n            }\n        }\n\n        public static void Initialize(ref PlayerLoopSystem playerLoop, InjectPlayerLoopTimings injectTimings = InjectPlayerLoopTimings.All)\n        {\n#if UNITY_2020_2_OR_NEWER\n            yielders = new ContinuationQueue[16];\n            runners = new PlayerLoopRunner[16];\n#else\n            yielders = new ContinuationQueue[14];\n            runners = new PlayerLoopRunner[14];\n#endif\n\n            var copyList = playerLoop.subSystemList.ToArray();\n\n            // Initialization\n            InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.Initialization),\n                InjectPlayerLoopTimings.Initialization, 0, true,\n                typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldInitialization), typeof(UniTaskLoopRunners.UniTaskLoopRunnerInitialization), PlayerLoopTiming.Initialization);\n\n            InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.Initialization),\n                InjectPlayerLoopTimings.LastInitialization, 1, false,\n                typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldInitialization), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastInitialization), PlayerLoopTiming.LastInitialization);\n\n            // EarlyUpdate\n            InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.EarlyUpdate),\n                InjectPlayerLoopTimings.EarlyUpdate, 2, true,\n                typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldEarlyUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerEarlyUpdate), PlayerLoopTiming.EarlyUpdate);\n\n            InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.EarlyUpdate),\n                InjectPlayerLoopTimings.LastEarlyUpdate, 3, false,\n                typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldEarlyUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastEarlyUpdate), PlayerLoopTiming.LastEarlyUpdate);\n\n            // FixedUpdate\n            InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.FixedUpdate),\n                InjectPlayerLoopTimings.FixedUpdate, 4, true,\n                typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldFixedUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerFixedUpdate), PlayerLoopTiming.FixedUpdate);\n\n            InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.FixedUpdate),\n                InjectPlayerLoopTimings.LastFixedUpdate, 5, false,\n                typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldFixedUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastFixedUpdate), PlayerLoopTiming.LastFixedUpdate);\n\n            // PreUpdate\n            InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PreUpdate),\n                InjectPlayerLoopTimings.PreUpdate, 6, true,\n                typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPreUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerPreUpdate), PlayerLoopTiming.PreUpdate);\n\n            InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PreUpdate),\n                InjectPlayerLoopTimings.LastPreUpdate, 7, false,\n                typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldPreUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastPreUpdate), PlayerLoopTiming.LastPreUpdate);\n\n            // Update\n            InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.Update),\n                InjectPlayerLoopTimings.Update, 8, true,\n                typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerUpdate), PlayerLoopTiming.Update);\n\n            InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.Update),\n                InjectPlayerLoopTimings.LastUpdate, 9, false,\n                typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastUpdate), PlayerLoopTiming.LastUpdate);\n\n            // PreLateUpdate\n            InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PreLateUpdate),\n                InjectPlayerLoopTimings.PreLateUpdate, 10, true,\n                typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPreLateUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerPreLateUpdate), PlayerLoopTiming.PreLateUpdate);\n\n            InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PreLateUpdate),\n                InjectPlayerLoopTimings.LastPreLateUpdate, 11, false,\n                typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldPreLateUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastPreLateUpdate), PlayerLoopTiming.LastPreLateUpdate);\n\n            // PostLateUpdate\n            InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PostLateUpdate),\n                InjectPlayerLoopTimings.PostLateUpdate, 12, true,\n                typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPostLateUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerPostLateUpdate), PlayerLoopTiming.PostLateUpdate);\n\n            InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PostLateUpdate),\n                InjectPlayerLoopTimings.LastPostLateUpdate, 13, false,\n                typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldPostLateUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastPostLateUpdate), PlayerLoopTiming.LastPostLateUpdate);\n\n#if UNITY_2020_2_OR_NEWER\n            // TimeUpdate\n            InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.TimeUpdate),\n                InjectPlayerLoopTimings.TimeUpdate, 14, true,\n                typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldTimeUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerTimeUpdate), PlayerLoopTiming.TimeUpdate);\n\n            InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.TimeUpdate),\n                InjectPlayerLoopTimings.LastTimeUpdate, 15, false,\n                typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldTimeUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastTimeUpdate), PlayerLoopTiming.LastTimeUpdate);\n#endif\n\n            // Insert UniTaskSynchronizationContext to Update loop\n            var i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.Update));\n            copyList[i].subSystemList = InsertUniTaskSynchronizationContext(copyList[i]);\n\n            playerLoop.subSystemList = copyList;\n            PlayerLoop.SetPlayerLoop(playerLoop);\n        }\n\n        public static void AddAction(PlayerLoopTiming timing, IPlayerLoopItem action)\n        {\n            var runner = runners[(int)timing];\n            if (runner == null)\n            {\n                ThrowInvalidLoopTiming(timing);\n            }\n            runner.AddAction(action);\n        }\n\n        static void ThrowInvalidLoopTiming(PlayerLoopTiming playerLoopTiming)\n        {\n            throw new InvalidOperationException(\"Target playerLoopTiming is not injected. Please check PlayerLoopHelper.Initialize. PlayerLoopTiming:\" + playerLoopTiming);\n        }\n\n        public static void AddContinuation(PlayerLoopTiming timing, Action continuation)\n        {\n            var q = yielders[(int)timing];\n            if (q == null)\n            {\n                ThrowInvalidLoopTiming(timing);\n            }\n            q.Enqueue(continuation);\n        }\n\n        // Diagnostics helper\n\n#if UNITY_2019_3_OR_NEWER\n\n        public static void DumpCurrentPlayerLoop()\n        {\n            var playerLoop = UnityEngine.LowLevel.PlayerLoop.GetCurrentPlayerLoop();\n\n            var sb = new System.Text.StringBuilder();\n            sb.AppendLine($\"PlayerLoop List\");\n            foreach (var header in playerLoop.subSystemList)\n            {\n                sb.AppendFormat(\"------{0}------\", header.type.Name);\n                sb.AppendLine();\n                \n                if (header.subSystemList is null) \n                {\n                    sb.AppendFormat(\"{0} has no subsystems!\", header.ToString());\n                    sb.AppendLine();\n                    continue;\n                }\n\n                foreach (var subSystem in header.subSystemList)\n                {\n                    sb.AppendFormat(\"{0}\", subSystem.type.Name);\n                    sb.AppendLine();\n\n                    if (subSystem.subSystemList != null)\n                    {\n                        UnityEngine.Debug.LogWarning(\"More Subsystem:\" + subSystem.subSystemList.Length);\n                    }\n                }\n            }\n\n            UnityEngine.Debug.Log(sb.ToString());\n        }\n\n        public static bool IsInjectedUniTaskPlayerLoop()\n        {\n            var playerLoop = UnityEngine.LowLevel.PlayerLoop.GetCurrentPlayerLoop();\n\n            foreach (var header in playerLoop.subSystemList)\n            {\n                if (header.subSystemList is null) \n                { \n                    continue;\n                }\n                \n                foreach (var subSystem in header.subSystemList)\n                {\n                    if (subSystem.type == typeof(UniTaskLoopRunners.UniTaskLoopRunnerInitialization))\n                    {\n                        return true;\n                    }\n                }\n            }\n\n            return false;\n        }\n\n#endif\n\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/PlayerLoopHelper.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 15fb5b85042f19640b973ce651795aca\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/PlayerLoopTimer.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System.Threading;\nusing System;\nusing Cysharp.Threading.Tasks.Internal;\nusing UnityEngine;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public abstract class PlayerLoopTimer : IDisposable, IPlayerLoopItem\n    {\n        readonly CancellationToken cancellationToken;\n        readonly Action<object> timerCallback;\n        readonly object state;\n        readonly PlayerLoopTiming playerLoopTiming;\n        readonly bool periodic;\n\n        bool isRunning;\n        bool tryStop;\n        bool isDisposed;\n\n        protected PlayerLoopTimer(bool periodic, PlayerLoopTiming playerLoopTiming, CancellationToken cancellationToken, Action<object> timerCallback, object state)\n        {\n            this.periodic = periodic;\n            this.playerLoopTiming = playerLoopTiming;\n            this.cancellationToken = cancellationToken;\n            this.timerCallback = timerCallback;\n            this.state = state;\n        }\n\n        public static PlayerLoopTimer Create(TimeSpan interval, bool periodic, DelayType delayType, PlayerLoopTiming playerLoopTiming, CancellationToken cancellationToken, Action<object> timerCallback, object state)\n        {\n#if UNITY_EDITOR\n            // force use Realtime.\n            if (PlayerLoopHelper.IsMainThread && !UnityEditor.EditorApplication.isPlaying)\n            {\n                delayType = DelayType.Realtime;\n            }\n#endif\n\n            switch (delayType)\n            {\n                case DelayType.UnscaledDeltaTime:\n                    return new IgnoreTimeScalePlayerLoopTimer(interval, periodic, playerLoopTiming, cancellationToken, timerCallback, state);\n                case DelayType.Realtime:\n                    return new RealtimePlayerLoopTimer(interval, periodic, playerLoopTiming, cancellationToken, timerCallback, state);\n                case DelayType.DeltaTime:\n                default:\n                    return new DeltaTimePlayerLoopTimer(interval, periodic, playerLoopTiming, cancellationToken, timerCallback, state);\n            }\n        }\n\n        public static PlayerLoopTimer StartNew(TimeSpan interval, bool periodic, DelayType delayType, PlayerLoopTiming playerLoopTiming, CancellationToken cancellationToken, Action<object> timerCallback, object state)\n        {\n            var timer = Create(interval, periodic, delayType, playerLoopTiming, cancellationToken, timerCallback, state);\n            timer.Restart();\n            return timer;\n        }\n\n        /// <summary>\n        /// Restart(Reset and Start) timer.\n        /// </summary>\n        public void Restart()\n        {\n            if (isDisposed) throw new ObjectDisposedException(null);\n\n            ResetCore(null); // init state\n            if (!isRunning)\n            {\n                isRunning = true;\n                PlayerLoopHelper.AddAction(playerLoopTiming, this);\n            }\n            tryStop = false;\n        }\n\n        /// <summary>\n        /// Restart(Reset and Start) and change interval.\n        /// </summary>\n        public void Restart(TimeSpan interval)\n        {\n            if (isDisposed) throw new ObjectDisposedException(null);\n\n            ResetCore(interval); // init state\n            if (!isRunning)\n            {\n                isRunning = true;\n                PlayerLoopHelper.AddAction(playerLoopTiming, this);\n            }\n            tryStop = false;\n        }\n\n        /// <summary>\n        /// Stop timer.\n        /// </summary>\n        public void Stop()\n        {\n            tryStop = true;\n        }\n\n        protected abstract void ResetCore(TimeSpan? newInterval);\n\n        public void Dispose()\n        {\n            isDisposed = true;\n        }\n\n        bool IPlayerLoopItem.MoveNext()\n        {\n            if (isDisposed)\n            {\n                isRunning = false;\n                return false;\n            }\n            if (tryStop)\n            {\n                isRunning = false;\n                return false;\n            }\n            if (cancellationToken.IsCancellationRequested)\n            {\n                isRunning = false;\n                return false;\n            }\n\n            if (!MoveNextCore())\n            {\n                timerCallback(state);\n\n                if (periodic)\n                {\n                    ResetCore(null);\n                    return true;\n                }\n                else\n                {\n                    isRunning = false;\n                    return false;\n                }\n            }\n\n            return true;\n        }\n\n        protected abstract bool MoveNextCore();\n    }\n\n    sealed class DeltaTimePlayerLoopTimer : PlayerLoopTimer\n    {\n        int initialFrame;\n        float elapsed;\n        float interval;\n\n        public DeltaTimePlayerLoopTimer(TimeSpan interval, bool periodic, PlayerLoopTiming playerLoopTiming, CancellationToken cancellationToken, Action<object> timerCallback, object state)\n            : base(periodic, playerLoopTiming, cancellationToken, timerCallback, state)\n        {\n            ResetCore(interval);\n        }\n\n        protected override bool MoveNextCore()\n        {\n            if (elapsed == 0.0f)\n            {\n                if (initialFrame == Time.frameCount)\n                {\n                    return true;\n                }\n            }\n\n            elapsed += Time.deltaTime;\n            if (elapsed >= interval)\n            {\n                return false;\n            }\n\n            return true;\n        }\n\n        protected override void ResetCore(TimeSpan? interval)\n        {\n            this.elapsed = 0.0f;\n            this.initialFrame = PlayerLoopHelper.IsMainThread ? Time.frameCount : -1;\n            if (interval != null)\n            {\n                this.interval = (float)interval.Value.TotalSeconds;\n            }\n        }\n    }\n\n    sealed class IgnoreTimeScalePlayerLoopTimer : PlayerLoopTimer\n    {\n        int initialFrame;\n        float elapsed;\n        float interval;\n\n        public IgnoreTimeScalePlayerLoopTimer(TimeSpan interval, bool periodic, PlayerLoopTiming playerLoopTiming, CancellationToken cancellationToken, Action<object> timerCallback, object state)\n            : base(periodic, playerLoopTiming, cancellationToken, timerCallback, state)\n        {\n            ResetCore(interval);\n        }\n\n        protected override bool MoveNextCore()\n        {\n            if (elapsed == 0.0f)\n            {\n                if (initialFrame == Time.frameCount)\n                {\n                    return true;\n                }\n            }\n\n            elapsed += Time.unscaledDeltaTime;\n            if (elapsed >= interval)\n            {\n                return false;\n            }\n\n            return true;\n        }\n\n        protected override void ResetCore(TimeSpan? interval)\n        {\n            this.elapsed = 0.0f;\n            this.initialFrame = PlayerLoopHelper.IsMainThread ? Time.frameCount : -1;\n            if (interval != null)\n            {\n                this.interval = (float)interval.Value.TotalSeconds;\n            }\n        }\n    }\n\n    sealed class RealtimePlayerLoopTimer : PlayerLoopTimer\n    {\n        ValueStopwatch stopwatch;\n        long intervalTicks;\n\n        public RealtimePlayerLoopTimer(TimeSpan interval, bool periodic, PlayerLoopTiming playerLoopTiming, CancellationToken cancellationToken, Action<object> timerCallback, object state)\n            : base(periodic, playerLoopTiming, cancellationToken, timerCallback, state)\n        {\n            ResetCore(interval);\n        }\n\n        protected override bool MoveNextCore()\n        {\n            if (stopwatch.ElapsedTicks >= intervalTicks)\n            {\n                return false;\n            }\n\n            return true;\n        }\n\n        protected override void ResetCore(TimeSpan? interval)\n        {\n            this.stopwatch = ValueStopwatch.StartNew();\n            if (interval != null)\n            {\n                this.intervalTicks = interval.Value.Ticks;\n            }\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/PlayerLoopTimer.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 57095a17fdca7ee4380450910afc7f26\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Progress.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks\n{\n    /// <summary>\n    /// Lightweight IProgress[T] factory.\n    /// </summary>\n    public static class Progress\n    {\n        public static IProgress<T> Create<T>(Action<T> handler)\n        {\n            if (handler == null) return NullProgress<T>.Instance;\n            return new AnonymousProgress<T>(handler);\n        }\n\n        public static IProgress<T> CreateOnlyValueChanged<T>(Action<T> handler, IEqualityComparer<T> comparer = null)\n        {\n            if (handler == null) return NullProgress<T>.Instance;\n#if UNITY_2018_3_OR_NEWER\n            return new OnlyValueChangedProgress<T>(handler, comparer ?? UnityEqualityComparer.GetDefault<T>());\n#else\n            return new OnlyValueChangedProgress<T>(handler, comparer ?? EqualityComparer<T>.Default);\n#endif\n        }\n\n        sealed class NullProgress<T> : IProgress<T>\n        {\n            public static readonly IProgress<T> Instance = new NullProgress<T>();\n\n            NullProgress()\n            {\n\n            }\n\n            public void Report(T value)\n            {\n            }\n        }\n\n        sealed class AnonymousProgress<T> : IProgress<T>\n        {\n            readonly Action<T> action;\n\n            public AnonymousProgress(Action<T> action)\n            {\n                this.action = action;\n            }\n\n            public void Report(T value)\n            {\n                action(value);\n            }\n        }\n\n        sealed class OnlyValueChangedProgress<T> : IProgress<T>\n        {\n            readonly Action<T> action;\n            readonly IEqualityComparer<T> comparer;\n            bool isFirstCall;\n            T latestValue;\n\n            public OnlyValueChangedProgress(Action<T> action, IEqualityComparer<T> comparer)\n            {\n                this.action = action;\n                this.comparer = comparer;\n                this.isFirstCall = true;\n            }\n\n            public void Report(T value)\n            {\n                if (isFirstCall)\n                {\n                    isFirstCall = false;\n                }\n                else if (comparer.Equals(value, latestValue))\n                {\n                    return;\n                }\n\n                latestValue = value;\n                action(value);\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Progress.cs.meta",
    "content": "fileFormatVersion: 2\nguid: e3377e2ae934ed54fb8fd5388e2d9eb9\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/TaskPool.cs",
    "content": "﻿using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    // internally used but public, allow to user create custom operator with pooling.\n\n    public static class TaskPool\n    {\n        internal static int MaxPoolSize;\n\n        // avoid to use ConcurrentDictionary for safety of WebGL build.\n        static Dictionary<Type, Func<int>> sizes = new Dictionary<Type, Func<int>>();\n\n        static TaskPool()\n        {\n            try\n            {\n                var value = Environment.GetEnvironmentVariable(\"UNITASK_MAX_POOLSIZE\");\n                if (value != null)\n                {\n                    if (int.TryParse(value, out var size))\n                    {\n                        MaxPoolSize = size;\n                        return;\n                    }\n                }\n            }\n            catch { }\n\n            MaxPoolSize = int.MaxValue;\n        }\n\n        public static void SetMaxPoolSize(int maxPoolSize)\n        {\n            MaxPoolSize = maxPoolSize;\n        }\n\n        public static IEnumerable<(Type, int)> GetCacheSizeInfo()\n        {\n            lock (sizes)\n            {\n                foreach (var item in sizes)\n                {\n                    yield return (item.Key, item.Value());\n                }\n            }\n        }\n\n        public static void RegisterSizeGetter(Type type, Func<int> getSize)\n        {\n            lock (sizes)\n            {\n                sizes[type] = getSize;\n            }\n        }\n    }\n\n    public interface ITaskPoolNode<T>\n    {\n        ref T NextNode { get; }\n    }\n\n    // mutable struct, don't mark readonly.\n    [StructLayout(LayoutKind.Auto)]\n    public struct TaskPool<T>\n        where T : class, ITaskPoolNode<T>\n    {\n        int gate;\n        int size;\n        T root;\n\n        public int Size => size;\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public bool TryPop(out T result)\n        {\n            if (Interlocked.CompareExchange(ref gate, 1, 0) == 0)\n            {\n                var v = root;\n                if (!(v is null))\n                {\n                    ref var nextNode = ref v.NextNode;\n                    root = nextNode;\n                    nextNode = null;\n                    size--;\n                    result = v;\n                    Volatile.Write(ref gate, 0);\n                    return true;\n                }\n\n                Volatile.Write(ref gate, 0);\n            }\n            result = default;\n            return false;\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public bool TryPush(T item)\n        {\n            if (Interlocked.CompareExchange(ref gate, 1, 0) == 0)\n            {\n                if (size < TaskPool.MaxPoolSize)\n                {\n                    item.NextNode = root;\n                    root = item;\n                    size++;\n                    Volatile.Write(ref gate, 0);\n                    return true;\n                }\n                else\n                {\n                    Volatile.Write(ref gate, 0);\n                }\n            }\n            return false;\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/TaskPool.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 19f4e6575150765449cc99f25f06f25f\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/TimeoutController.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    // CancellationTokenSource itself can not reuse but CancelAfter(Timeout.InfiniteTimeSpan) allows reuse if did not reach timeout.\n    // Similar discussion:\n    // https://github.com/dotnet/runtime/issues/4694\n    // https://github.com/dotnet/runtime/issues/48492\n    // This TimeoutController emulate similar implementation, using CancelAfterSlim; to achieve zero allocation timeout.\n\n    public sealed class TimeoutController : IDisposable\n    {\n        readonly static Action<object> CancelCancellationTokenSourceStateDelegate = new Action<object>(CancelCancellationTokenSourceState);\n\n        static void CancelCancellationTokenSourceState(object state)\n        {\n            var cts = (CancellationTokenSource)state;\n            cts.Cancel();\n        }\n\n        CancellationTokenSource timeoutSource;\n        CancellationTokenSource linkedSource;\n        PlayerLoopTimer timer;\n        bool isDisposed;\n\n        readonly DelayType delayType;\n        readonly PlayerLoopTiming delayTiming;\n        readonly CancellationTokenSource originalLinkCancellationTokenSource;\n\n        public TimeoutController(DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update)\n        {\n            this.timeoutSource = new CancellationTokenSource();\n            this.originalLinkCancellationTokenSource = null;\n            this.linkedSource = null;\n            this.delayType = delayType;\n            this.delayTiming = delayTiming;\n        }\n\n        public TimeoutController(CancellationTokenSource linkCancellationTokenSource, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update)\n        {\n            this.timeoutSource = new CancellationTokenSource();\n            this.originalLinkCancellationTokenSource = linkCancellationTokenSource;\n            this.linkedSource = CancellationTokenSource.CreateLinkedTokenSource(timeoutSource.Token, linkCancellationTokenSource.Token);\n            this.delayType = delayType;\n            this.delayTiming = delayTiming;\n        }\n\n        public CancellationToken Timeout(int millisecondsTimeout)\n        {\n            return Timeout(TimeSpan.FromMilliseconds(millisecondsTimeout));\n        }\n\n        public CancellationToken Timeout(TimeSpan timeout)\n        {\n            if (originalLinkCancellationTokenSource != null && originalLinkCancellationTokenSource.IsCancellationRequested)\n            {\n                return originalLinkCancellationTokenSource.Token;\n            }\n\n            // Timeouted, create new source and timer.\n            if (timeoutSource.IsCancellationRequested)\n            {\n                timeoutSource.Dispose();\n                timeoutSource = new CancellationTokenSource();\n                if (linkedSource != null)\n                {\n                    this.linkedSource.Cancel();\n                    this.linkedSource.Dispose();\n                    this.linkedSource = CancellationTokenSource.CreateLinkedTokenSource(timeoutSource.Token, originalLinkCancellationTokenSource.Token);\n                }\n\n                timer?.Dispose();\n                timer = null;\n            }\n\n            var useSource = (linkedSource != null) ? linkedSource : timeoutSource;\n            var token = useSource.Token;\n            if (timer == null)\n            {\n                // Timer complete => timeoutSource.Cancel() -> linkedSource will be canceled.\n                // (linked)token is canceled => stop timer\n                timer = PlayerLoopTimer.StartNew(timeout, false, delayType, delayTiming, token, CancelCancellationTokenSourceStateDelegate, timeoutSource);\n            }\n            else\n            {\n                timer.Restart(timeout);\n            }\n\n            return token;\n        }\n\n        public bool IsTimeout()\n        {\n            return timeoutSource.IsCancellationRequested;\n        }\n\n        public void Reset()\n        {\n            timer?.Stop();\n        }\n\n        public void Dispose()\n        {\n            if (isDisposed) return;\n\n            try\n            {\n                // stop timer.\n                timer?.Dispose();\n\n                // cancel and dispose.\n                timeoutSource.Cancel();\n                timeoutSource.Dispose();\n                if (linkedSource != null)\n                {\n                    linkedSource.Cancel();\n                    linkedSource.Dispose();\n                }\n            }\n            finally\n            {\n                isDisposed = true;\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/TimeoutController.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 6347ab34d2db6d744a654e8d62d96b96\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/TriggerEvent.cs",
    "content": "﻿using System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public interface ITriggerHandler<T>\n    {\n        void OnNext(T value);\n        void OnError(Exception ex);\n        void OnCompleted();\n        void OnCanceled(CancellationToken cancellationToken);\n\n        // set/get from TriggerEvent<T>\n        ITriggerHandler<T> Prev { get; set; }\n        ITriggerHandler<T> Next { get; set; }\n    }\n\n    // be careful to use, itself is struct.\n    public struct TriggerEvent<T>\n    {\n        ITriggerHandler<T> head; // head.prev is last\n        ITriggerHandler<T> iteratingHead;\n        ITriggerHandler<T> iteratingNode;\n\n        void LogError(Exception ex)\n        {\n#if UNITY_2018_3_OR_NEWER\n            UnityEngine.Debug.LogException(ex);\n#else\n            Console.WriteLine(ex);\n#endif\n        }\n\n        public void SetResult(T value)\n        {\n            if (iteratingNode != null)\n            {\n                throw new InvalidOperationException(\"Can not trigger itself in iterating.\");\n            }\n\n            var h = head;\n            while (h != null)\n            {\n                iteratingNode = h;\n\n                try\n                {\n                    h.OnNext(value);\n                }\n                catch (Exception ex)\n                {\n                    LogError(ex);\n                    Remove(h);\n                }\n\n                // If `h` itself is removed by OnNext, h.Next is null.\n                // Therefore, instead of looking at h.Next, the `iteratingNode` reference itself is replaced.\n                h = h == iteratingNode ? h.Next : iteratingNode;\n            }\n\n            iteratingNode = null;\n            if (iteratingHead != null)\n            {\n                Add(iteratingHead);\n                iteratingHead = null;\n            }\n        }\n\n        public void SetCanceled(CancellationToken cancellationToken)\n        {\n            if (iteratingNode != null)\n            {\n                throw new InvalidOperationException(\"Can not trigger itself in iterating.\");\n            }\n\n            var h = head;\n            while (h != null)\n            {\n                iteratingNode = h;\n                try\n                {\n                    h.OnCanceled(cancellationToken);\n                }\n                catch (Exception ex)\n                {\n                    LogError(ex);\n                }\n\n                var next = h == iteratingNode ? h.Next : iteratingNode;\n                iteratingNode = null;\n                Remove(h);\n                h = next;\n            }\n\n            iteratingNode = null;\n            if (iteratingHead != null)\n            {\n                Add(iteratingHead);\n                iteratingHead = null;\n            }\n        }\n\n        public void SetCompleted()\n        {\n            if (iteratingNode != null)\n            {\n                throw new InvalidOperationException(\"Can not trigger itself in iterating.\");\n            }\n\n            var h = head;\n            while (h != null)\n            {\n                iteratingNode = h;\n                try\n                {\n                    h.OnCompleted();\n                }\n                catch (Exception ex)\n                {\n                    LogError(ex);\n                }\n\n                var next = h == iteratingNode ? h.Next : iteratingNode;\n                iteratingNode = null;\n                Remove(h);\n                h = next;\n            }\n\n            iteratingNode = null;\n            if (iteratingHead != null)\n            {\n                Add(iteratingHead);\n                iteratingHead = null;\n            }\n        }\n\n        public void SetError(Exception exception)\n        {\n            if (iteratingNode != null)\n            {\n                throw new InvalidOperationException(\"Can not trigger itself in iterating.\");\n            }\n\n            var h = head;\n            while (h != null)\n            {\n                iteratingNode = h;\n                try\n                {\n                    h.OnError(exception);\n                }\n                catch (Exception ex)\n                {\n                    LogError(ex);\n                }\n\n                var next = h == iteratingNode ? h.Next : iteratingNode;\n                iteratingNode = null;\n                Remove(h);\n                h = next;\n            }\n\n            iteratingNode = null;\n            if (iteratingHead != null)\n            {\n                Add(iteratingHead);\n                iteratingHead = null;\n            }\n        }\n\n        public void Add(ITriggerHandler<T> handler)\n        {\n            if (handler == null) throw new ArgumentNullException(nameof(handler));\n\n            // zero node.\n            if (head == null)\n            {\n                head = handler;\n                return;\n            }\n\n            if (iteratingNode != null)\n            {\n                if (iteratingHead == null)\n                {\n                    iteratingHead = handler;\n                    return;\n                }\n\n                var last = iteratingHead.Prev;\n                if (last == null)\n                {\n                    // single node.\n                    iteratingHead.Prev = handler;\n                    iteratingHead.Next = handler;\n                    handler.Prev = iteratingHead;\n                }\n                else\n                {\n                    // multi node\n                    iteratingHead.Prev = handler;\n                    last.Next = handler;\n                    handler.Prev = last;\n                }\n            }\n            else\n            {\n                var last = head.Prev;\n                if (last == null)\n                {\n                    // single node.\n                    head.Prev = handler;\n                    head.Next = handler;\n                    handler.Prev = head;\n                }\n                else\n                {\n                    // multi node\n                    head.Prev = handler;\n                    last.Next = handler;\n                    handler.Prev = last;\n                }\n            }\n        }\n\n        public void Remove(ITriggerHandler<T> handler)\n        {\n            if (handler == null) throw new ArgumentNullException(nameof(handler));\n\n            var prev = handler.Prev;\n            var next = handler.Next;\n\n            if (next != null)\n            {\n                next.Prev = prev;\n            }\n\n            if (handler == head)\n            {\n                head = next;\n            }\n            // when handler is head, prev indicate last so don't use it.\n            else if (prev != null)\n            {\n                prev.Next = next;\n            }\n\n            if (handler == iteratingNode)\n            {\n                iteratingNode = next;\n            }\n            if (handler == iteratingHead)\n            {\n                iteratingHead = next;\n            }\n\n            if (head != null)\n            {\n                if (head.Prev == handler)\n                {\n                    if (prev != head)\n                    {\n                        head.Prev = prev;\n                    }\n                    else\n                    {\n                        head.Prev = null;\n                    }\n                }\n            }\n\n            if (iteratingHead != null)\n            {\n                if (iteratingHead.Prev == handler)\n                {\n                    if (prev != iteratingHead.Prev)\n                    {\n                        iteratingHead.Prev = prev;\n                    }\n                    else\n                    {\n                        iteratingHead.Prev = null;\n                    }\n                }\n            }\n\n            handler.Prev = null;\n            handler.Next = null;\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/TriggerEvent.cs.meta",
    "content": "fileFormatVersion: 2\nguid: f68b22bb8f66f5c4885f9bd3c4fc43ed\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/AsyncAwakeTrigger.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System.Threading;\nusing UnityEngine;\n\nnamespace Cysharp.Threading.Tasks.Triggers\n{\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncAwakeTrigger GetAsyncAwakeTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncAwakeTrigger>(gameObject);\n        }\n\n        public static AsyncAwakeTrigger GetAsyncAwakeTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncAwakeTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncAwakeTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        public UniTask AwakeAsync()\n        {\n            if (calledAwake) return UniTask.CompletedTask;\n\n            return ((IAsyncOneShotTrigger)new AsyncTriggerHandler<AsyncUnit>(this, true)).OneShotAsync();\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/AsyncAwakeTrigger.cs.meta",
    "content": "fileFormatVersion: 2\nguid: ef2840a2586894741a0ae211b8fd669b\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/AsyncDestroyTrigger.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System.Threading;\nusing UnityEngine;\n\nnamespace Cysharp.Threading.Tasks.Triggers\n{\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncDestroyTrigger GetAsyncDestroyTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncDestroyTrigger>(gameObject);\n        }\n\n        public static AsyncDestroyTrigger GetAsyncDestroyTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncDestroyTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncDestroyTrigger : MonoBehaviour\n    {\n        bool awakeCalled = false;\n        bool called = false;\n        CancellationTokenSource cancellationTokenSource;\n\n        public CancellationToken CancellationToken\n        {\n            get\n            {\n                if (cancellationTokenSource == null)\n                {\n                    cancellationTokenSource = new CancellationTokenSource();\n                    if (!awakeCalled)\n                    {\n                        PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, new AwakeMonitor(this));\n                    }\n                }\n                return cancellationTokenSource.Token;\n            }\n        }\n\n        void Awake()\n        {\n            awakeCalled = true;\n        }\n\n        void OnDestroy()\n        {\n            called = true;\n\n            cancellationTokenSource?.Cancel();\n            cancellationTokenSource?.Dispose();\n        }\n\n        public UniTask OnDestroyAsync()\n        {\n            if (called) return UniTask.CompletedTask;\n\n            var tcs = new UniTaskCompletionSource();\n\n            // OnDestroy = Called Cancel.\n            CancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n            {\n                var tcs2 = (UniTaskCompletionSource)state;\n                tcs2.TrySetResult();\n            }, tcs);\n\n            return tcs.Task;\n        }\n\n        class AwakeMonitor : IPlayerLoopItem\n        {\n            readonly AsyncDestroyTrigger trigger;\n\n            public AwakeMonitor(AsyncDestroyTrigger trigger)\n            {\n                this.trigger = trigger;\n            }\n\n            public bool MoveNext()\n            {\n                if (trigger.called || trigger.awakeCalled) return false;\n                if (trigger == null)\n                {\n                    trigger.OnDestroy();\n                    return false;\n                }\n                return true;\n            }\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/AsyncDestroyTrigger.cs.meta",
    "content": "fileFormatVersion: 2\nguid: f4afdcb1cbadf954ba8b1cf465429e17\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/AsyncStartTrigger.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing UnityEngine;\n\nnamespace Cysharp.Threading.Tasks.Triggers\n{\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncStartTrigger GetAsyncStartTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncStartTrigger>(gameObject);\n        }\n\n        public static AsyncStartTrigger GetAsyncStartTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncStartTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncStartTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        bool called;\n\n        void Start()\n        {\n            called = true;\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public UniTask StartAsync()\n        {\n            if (called) return UniTask.CompletedTask;\n\n            return ((IAsyncOneShotTrigger)new AsyncTriggerHandler<AsyncUnit>(this, true)).OneShotAsync();\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/AsyncStartTrigger.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b4fd0f75e54ec3d4fbcb7fc65b11646b\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/AsyncTriggerBase.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Threading;\nusing UnityEngine;\n\nnamespace Cysharp.Threading.Tasks.Triggers\n{\n    public abstract class AsyncTriggerBase<T> : MonoBehaviour, IUniTaskAsyncEnumerable<T>\n    {\n        TriggerEvent<T> triggerEvent;\n\n        internal protected bool calledAwake;\n        internal protected bool calledDestroy;\n\n        void Awake()\n        {\n            calledAwake = true;\n        }\n\n        void OnDestroy()\n        {\n            if (calledDestroy) return;\n            calledDestroy = true;\n\n            triggerEvent.SetCompleted();\n        }\n\n        internal void AddHandler(ITriggerHandler<T> handler)\n        {\n            if (!calledAwake)\n            {\n                PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, new AwakeMonitor(this));\n            }\n\n            triggerEvent.Add(handler);\n        }\n\n        internal void RemoveHandler(ITriggerHandler<T> handler)\n        {\n            if (!calledAwake)\n            {\n                PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, new AwakeMonitor(this));\n            }\n\n            triggerEvent.Remove(handler);\n        }\n\n        protected void RaiseEvent(T value)\n        {\n            triggerEvent.SetResult(value);\n        }\n\n        public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new AsyncTriggerEnumerator(this, cancellationToken);\n        }\n\n        sealed class AsyncTriggerEnumerator : MoveNextSource, IUniTaskAsyncEnumerator<T>, ITriggerHandler<T>\n        {\n            static Action<object> cancellationCallback = CancellationCallback;\n\n            readonly AsyncTriggerBase<T> parent;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration registration;\n            bool called;\n            bool isDisposed;\n\n            public AsyncTriggerEnumerator(AsyncTriggerBase<T> parent, CancellationToken cancellationToken)\n            {\n                this.parent = parent;\n                this.cancellationToken = cancellationToken;\n            }\n\n            public void OnCanceled(CancellationToken cancellationToken = default)\n            {\n                completionSource.TrySetCanceled(cancellationToken);\n            }\n\n            public void OnNext(T value)\n            {\n                Current = value;\n                completionSource.TrySetResult(true);\n            }\n\n            public void OnCompleted()\n            {\n                completionSource.TrySetResult(false);\n            }\n\n            public void OnError(Exception ex)\n            {\n                completionSource.TrySetException(ex);\n            }\n\n            static void CancellationCallback(object state)\n            {\n                var self = (AsyncTriggerEnumerator)state;\n                self.DisposeAsync().Forget(); // sync\n\n                self.completionSource.TrySetCanceled(self.cancellationToken);\n            }\n\n            public T Current { get; private set; }\n            ITriggerHandler<T> ITriggerHandler<T>.Prev { get; set; }\n            ITriggerHandler<T> ITriggerHandler<T>.Next { get; set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                if (!called)\n                {\n                    called = true;\n\n                    TaskTracker.TrackActiveTask(this, 3);\n                    parent.AddHandler(this);\n                    if (cancellationToken.CanBeCanceled)\n                    {\n                        registration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallback, this);\n                    }\n                }\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            public UniTask DisposeAsync()\n            {\n                if (!isDisposed)\n                {\n                    isDisposed = true;\n                    TaskTracker.RemoveTracking(this);\n                    registration.Dispose();\n                    parent.RemoveHandler(this);\n                }\n\n                return default;\n            }\n        }\n\n        class AwakeMonitor : IPlayerLoopItem\n        {\n            readonly AsyncTriggerBase<T> trigger;\n\n            public AwakeMonitor(AsyncTriggerBase<T> trigger)\n            {\n                this.trigger = trigger;\n            }\n\n            public bool MoveNext()\n            {\n                if (trigger.calledAwake) return false;\n                if (trigger == null)\n                {\n                    trigger.OnDestroy();\n                    return false;\n                }\n                return true;\n            }\n        }\n    }\n\n    public interface IAsyncOneShotTrigger\n    {\n        UniTask OneShotAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOneShotTrigger\n    {\n        UniTask IAsyncOneShotTrigger.OneShotAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)this, core.Version);\n        }\n    }\n\n    public sealed partial class AsyncTriggerHandler<T> : IUniTaskSource<T>, ITriggerHandler<T>, IDisposable\n    {\n        static Action<object> cancellationCallback = CancellationCallback;\n\n        readonly AsyncTriggerBase<T> trigger;\n\n        CancellationToken cancellationToken;\n        CancellationTokenRegistration registration;\n        bool isDisposed;\n        bool callOnce;\n\n        UniTaskCompletionSourceCore<T> core;\n\n        internal CancellationToken CancellationToken => cancellationToken;\n\n        ITriggerHandler<T> ITriggerHandler<T>.Prev { get; set; }\n        ITriggerHandler<T> ITriggerHandler<T>.Next { get; set; }\n\n        internal AsyncTriggerHandler(AsyncTriggerBase<T> trigger, bool callOnce)\n        {\n            if (cancellationToken.IsCancellationRequested)\n            {\n                isDisposed = true;\n                return;\n            }\n\n            this.trigger = trigger;\n            this.cancellationToken = default;\n            this.registration = default;\n            this.callOnce = callOnce;\n\n            trigger.AddHandler(this);\n\n            TaskTracker.TrackActiveTask(this, 3);\n        }\n\n        internal AsyncTriggerHandler(AsyncTriggerBase<T> trigger, CancellationToken cancellationToken, bool callOnce)\n        {\n            if (cancellationToken.IsCancellationRequested)\n            {\n                isDisposed = true;\n                return;\n            }\n\n            this.trigger = trigger;\n            this.cancellationToken = cancellationToken;\n            this.callOnce = callOnce;\n\n            trigger.AddHandler(this);\n\n            if (cancellationToken.CanBeCanceled)\n            {\n                registration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallback, this);\n            }\n\n            TaskTracker.TrackActiveTask(this, 3);\n        }\n\n        static void CancellationCallback(object state)\n        {\n            var self = (AsyncTriggerHandler<T>)state;\n            self.Dispose();\n\n            self.core.TrySetCanceled(self.cancellationToken);\n        }\n\n        public void Dispose()\n        {\n            if (!isDisposed)\n            {\n                isDisposed = true;\n                TaskTracker.RemoveTracking(this);\n                registration.Dispose();\n                trigger.RemoveHandler(this);\n            }\n        }\n\n        T IUniTaskSource<T>.GetResult(short token)\n        {\n            try\n            {\n                return core.GetResult(token);\n            }\n            finally\n            {\n                if (callOnce)\n                {\n                    Dispose();\n                }\n            }\n        }\n\n        void ITriggerHandler<T>.OnNext(T value)\n        {\n            core.TrySetResult(value);\n        }\n\n        void ITriggerHandler<T>.OnCanceled(CancellationToken cancellationToken)\n        {\n            core.TrySetCanceled(cancellationToken);\n        }\n\n        void ITriggerHandler<T>.OnCompleted()\n        {\n            core.TrySetCanceled(CancellationToken.None);\n        }\n\n        void ITriggerHandler<T>.OnError(Exception ex)\n        {\n            core.TrySetException(ex);\n        }\n\n        void IUniTaskSource.GetResult(short token)\n        {\n            ((IUniTaskSource<T>)this).GetResult(token);\n        }\n\n        UniTaskStatus IUniTaskSource.GetStatus(short token)\n        {\n            return core.GetStatus(token);\n        }\n\n        UniTaskStatus IUniTaskSource.UnsafeGetStatus()\n        {\n            return core.UnsafeGetStatus();\n        }\n\n        void IUniTaskSource.OnCompleted(Action<object> continuation, object state, short token)\n        {\n            core.OnCompleted(continuation, state, token);\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/AsyncTriggerBase.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 2c0c2bcee832c6641b25949c412f020f\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/AsyncTriggerExtensions.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System.Threading;\nusing UnityEngine;\nusing Cysharp.Threading.Tasks.Triggers;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static class UniTaskCancellationExtensions\n    {\n#if UNITY_2022_2_OR_NEWER\n\n        /// <summary>This CancellationToken is canceled when the MonoBehaviour will be destroyed.</summary>\n        public static CancellationToken GetCancellationTokenOnDestroy(this MonoBehaviour monoBehaviour)\n        {\n            return monoBehaviour.destroyCancellationToken;\n        }\n\n#endif\n\n        /// <summary>This CancellationToken is canceled when the MonoBehaviour will be destroyed.</summary>\n        public static CancellationToken GetCancellationTokenOnDestroy(this GameObject gameObject)\n        {\n            return gameObject.GetAsyncDestroyTrigger().CancellationToken;\n        }\n\n        /// <summary>This CancellationToken is canceled when the MonoBehaviour will be destroyed.</summary>\n        public static CancellationToken GetCancellationTokenOnDestroy(this Component component)\n        {\n#if UNITY_2022_2_OR_NEWER\n            if (component is MonoBehaviour mb)\n            {\n                return mb.destroyCancellationToken;\n            }\n#endif\n\n            return component.GetAsyncDestroyTrigger().CancellationToken;\n        }\n    }\n}\n\nnamespace Cysharp.Threading.Tasks.Triggers\n{\n    public static partial class AsyncTriggerExtensions\n    {\n        // Util.\n\n        static T GetOrAddComponent<T>(GameObject gameObject)\n            where T : Component\n        {\n#if UNITY_2019_2_OR_NEWER\n            if (!gameObject.TryGetComponent<T>(out var component))\n            {\n                component = gameObject.AddComponent<T>();\n            }\n#else\n            var component = gameObject.GetComponent<T>();\n            if (component == null)\n            {\n                component = gameObject.AddComponent<T>();\n            }\n#endif\n\n            return component;\n        }\n\n        // Special for single operation.\n\n        /// <summary>This function is called when the MonoBehaviour will be destroyed.</summary>\n        public static UniTask OnDestroyAsync(this GameObject gameObject)\n        {\n            return gameObject.GetAsyncDestroyTrigger().OnDestroyAsync();\n        }\n\n        /// <summary>This function is called when the MonoBehaviour will be destroyed.</summary>\n        public static UniTask OnDestroyAsync(this Component component)\n        {\n            return component.GetAsyncDestroyTrigger().OnDestroyAsync();\n        }\n\n        public static UniTask StartAsync(this GameObject gameObject)\n        {\n            return gameObject.GetAsyncStartTrigger().StartAsync();\n        }\n\n        public static UniTask StartAsync(this Component component)\n        {\n            return component.GetAsyncStartTrigger().StartAsync();\n        }\n\n        public static UniTask AwakeAsync(this GameObject gameObject)\n        {\n            return gameObject.GetAsyncAwakeTrigger().AwakeAsync();\n        }\n\n        public static UniTask AwakeAsync(this Component component)\n        {\n            return component.GetAsyncAwakeTrigger().AwakeAsync();\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/AsyncTriggerExtensions.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 59b61dbea1562a84fb7a38ae0a0a0f88\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/MonoBehaviourMessagesTriggers.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System.Threading;\nusing UnityEngine;\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\nusing UnityEngine.EventSystems;\n#endif\n\nnamespace Cysharp.Threading.Tasks.Triggers\n{\n#region FixedUpdate\n\n    public interface IAsyncFixedUpdateHandler\n    {\n        UniTask FixedUpdateAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncFixedUpdateHandler\n    {\n        UniTask IAsyncFixedUpdateHandler.FixedUpdateAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncFixedUpdateTrigger GetAsyncFixedUpdateTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncFixedUpdateTrigger>(gameObject);\n        }\n        \n        public static AsyncFixedUpdateTrigger GetAsyncFixedUpdateTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncFixedUpdateTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncFixedUpdateTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void FixedUpdate()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncFixedUpdateHandler GetFixedUpdateAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncFixedUpdateHandler GetFixedUpdateAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask FixedUpdateAsync()\n        {\n            return ((IAsyncFixedUpdateHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).FixedUpdateAsync();\n        }\n\n        public UniTask FixedUpdateAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncFixedUpdateHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).FixedUpdateAsync();\n        }\n    }\n#endregion\n\n#region LateUpdate\n\n    public interface IAsyncLateUpdateHandler\n    {\n        UniTask LateUpdateAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncLateUpdateHandler\n    {\n        UniTask IAsyncLateUpdateHandler.LateUpdateAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncLateUpdateTrigger GetAsyncLateUpdateTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncLateUpdateTrigger>(gameObject);\n        }\n        \n        public static AsyncLateUpdateTrigger GetAsyncLateUpdateTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncLateUpdateTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncLateUpdateTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void LateUpdate()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncLateUpdateHandler GetLateUpdateAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncLateUpdateHandler GetLateUpdateAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask LateUpdateAsync()\n        {\n            return ((IAsyncLateUpdateHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).LateUpdateAsync();\n        }\n\n        public UniTask LateUpdateAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncLateUpdateHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).LateUpdateAsync();\n        }\n    }\n#endregion\n\n#region AnimatorIK\n\n    public interface IAsyncOnAnimatorIKHandler\n    {\n        UniTask<int> OnAnimatorIKAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnAnimatorIKHandler\n    {\n        UniTask<int> IAsyncOnAnimatorIKHandler.OnAnimatorIKAsync()\n        {\n            core.Reset();\n            return new UniTask<int>((IUniTaskSource<int>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncAnimatorIKTrigger GetAsyncAnimatorIKTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncAnimatorIKTrigger>(gameObject);\n        }\n        \n        public static AsyncAnimatorIKTrigger GetAsyncAnimatorIKTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncAnimatorIKTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncAnimatorIKTrigger : AsyncTriggerBase<int>\n    {\n        void OnAnimatorIK(int layerIndex)\n        {\n            RaiseEvent((layerIndex));\n        }\n\n        public IAsyncOnAnimatorIKHandler GetOnAnimatorIKAsyncHandler()\n        {\n            return new AsyncTriggerHandler<int>(this, false);\n        }\n\n        public IAsyncOnAnimatorIKHandler GetOnAnimatorIKAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<int>(this, cancellationToken, false);\n        }\n\n        public UniTask<int> OnAnimatorIKAsync()\n        {\n            return ((IAsyncOnAnimatorIKHandler)new AsyncTriggerHandler<int>(this, true)).OnAnimatorIKAsync();\n        }\n\n        public UniTask<int> OnAnimatorIKAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnAnimatorIKHandler)new AsyncTriggerHandler<int>(this, cancellationToken, true)).OnAnimatorIKAsync();\n        }\n    }\n#endregion\n\n#region AnimatorMove\n\n    public interface IAsyncOnAnimatorMoveHandler\n    {\n        UniTask OnAnimatorMoveAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnAnimatorMoveHandler\n    {\n        UniTask IAsyncOnAnimatorMoveHandler.OnAnimatorMoveAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncAnimatorMoveTrigger GetAsyncAnimatorMoveTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncAnimatorMoveTrigger>(gameObject);\n        }\n        \n        public static AsyncAnimatorMoveTrigger GetAsyncAnimatorMoveTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncAnimatorMoveTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncAnimatorMoveTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnAnimatorMove()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnAnimatorMoveHandler GetOnAnimatorMoveAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnAnimatorMoveHandler GetOnAnimatorMoveAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnAnimatorMoveAsync()\n        {\n            return ((IAsyncOnAnimatorMoveHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnAnimatorMoveAsync();\n        }\n\n        public UniTask OnAnimatorMoveAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnAnimatorMoveHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnAnimatorMoveAsync();\n        }\n    }\n#endregion\n\n#region ApplicationFocus\n\n    public interface IAsyncOnApplicationFocusHandler\n    {\n        UniTask<bool> OnApplicationFocusAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnApplicationFocusHandler\n    {\n        UniTask<bool> IAsyncOnApplicationFocusHandler.OnApplicationFocusAsync()\n        {\n            core.Reset();\n            return new UniTask<bool>((IUniTaskSource<bool>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncApplicationFocusTrigger GetAsyncApplicationFocusTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncApplicationFocusTrigger>(gameObject);\n        }\n        \n        public static AsyncApplicationFocusTrigger GetAsyncApplicationFocusTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncApplicationFocusTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncApplicationFocusTrigger : AsyncTriggerBase<bool>\n    {\n        void OnApplicationFocus(bool hasFocus)\n        {\n            RaiseEvent((hasFocus));\n        }\n\n        public IAsyncOnApplicationFocusHandler GetOnApplicationFocusAsyncHandler()\n        {\n            return new AsyncTriggerHandler<bool>(this, false);\n        }\n\n        public IAsyncOnApplicationFocusHandler GetOnApplicationFocusAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<bool>(this, cancellationToken, false);\n        }\n\n        public UniTask<bool> OnApplicationFocusAsync()\n        {\n            return ((IAsyncOnApplicationFocusHandler)new AsyncTriggerHandler<bool>(this, true)).OnApplicationFocusAsync();\n        }\n\n        public UniTask<bool> OnApplicationFocusAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnApplicationFocusHandler)new AsyncTriggerHandler<bool>(this, cancellationToken, true)).OnApplicationFocusAsync();\n        }\n    }\n#endregion\n\n#region ApplicationPause\n\n    public interface IAsyncOnApplicationPauseHandler\n    {\n        UniTask<bool> OnApplicationPauseAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnApplicationPauseHandler\n    {\n        UniTask<bool> IAsyncOnApplicationPauseHandler.OnApplicationPauseAsync()\n        {\n            core.Reset();\n            return new UniTask<bool>((IUniTaskSource<bool>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncApplicationPauseTrigger GetAsyncApplicationPauseTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncApplicationPauseTrigger>(gameObject);\n        }\n        \n        public static AsyncApplicationPauseTrigger GetAsyncApplicationPauseTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncApplicationPauseTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncApplicationPauseTrigger : AsyncTriggerBase<bool>\n    {\n        void OnApplicationPause(bool pauseStatus)\n        {\n            RaiseEvent((pauseStatus));\n        }\n\n        public IAsyncOnApplicationPauseHandler GetOnApplicationPauseAsyncHandler()\n        {\n            return new AsyncTriggerHandler<bool>(this, false);\n        }\n\n        public IAsyncOnApplicationPauseHandler GetOnApplicationPauseAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<bool>(this, cancellationToken, false);\n        }\n\n        public UniTask<bool> OnApplicationPauseAsync()\n        {\n            return ((IAsyncOnApplicationPauseHandler)new AsyncTriggerHandler<bool>(this, true)).OnApplicationPauseAsync();\n        }\n\n        public UniTask<bool> OnApplicationPauseAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnApplicationPauseHandler)new AsyncTriggerHandler<bool>(this, cancellationToken, true)).OnApplicationPauseAsync();\n        }\n    }\n#endregion\n\n#region ApplicationQuit\n\n    public interface IAsyncOnApplicationQuitHandler\n    {\n        UniTask OnApplicationQuitAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnApplicationQuitHandler\n    {\n        UniTask IAsyncOnApplicationQuitHandler.OnApplicationQuitAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncApplicationQuitTrigger GetAsyncApplicationQuitTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncApplicationQuitTrigger>(gameObject);\n        }\n        \n        public static AsyncApplicationQuitTrigger GetAsyncApplicationQuitTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncApplicationQuitTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncApplicationQuitTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnApplicationQuit()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnApplicationQuitHandler GetOnApplicationQuitAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnApplicationQuitHandler GetOnApplicationQuitAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnApplicationQuitAsync()\n        {\n            return ((IAsyncOnApplicationQuitHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnApplicationQuitAsync();\n        }\n\n        public UniTask OnApplicationQuitAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnApplicationQuitHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnApplicationQuitAsync();\n        }\n    }\n#endregion\n\n#region AudioFilterRead\n\n    public interface IAsyncOnAudioFilterReadHandler\n    {\n        UniTask<(float[] data, int channels)> OnAudioFilterReadAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnAudioFilterReadHandler\n    {\n        UniTask<(float[] data, int channels)> IAsyncOnAudioFilterReadHandler.OnAudioFilterReadAsync()\n        {\n            core.Reset();\n            return new UniTask<(float[] data, int channels)>((IUniTaskSource<(float[] data, int channels)>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncAudioFilterReadTrigger GetAsyncAudioFilterReadTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncAudioFilterReadTrigger>(gameObject);\n        }\n        \n        public static AsyncAudioFilterReadTrigger GetAsyncAudioFilterReadTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncAudioFilterReadTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncAudioFilterReadTrigger : AsyncTriggerBase<(float[] data, int channels)>\n    {\n        void OnAudioFilterRead(float[] data, int channels)\n        {\n            RaiseEvent((data, channels));\n        }\n\n        public IAsyncOnAudioFilterReadHandler GetOnAudioFilterReadAsyncHandler()\n        {\n            return new AsyncTriggerHandler<(float[] data, int channels)>(this, false);\n        }\n\n        public IAsyncOnAudioFilterReadHandler GetOnAudioFilterReadAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<(float[] data, int channels)>(this, cancellationToken, false);\n        }\n\n        public UniTask<(float[] data, int channels)> OnAudioFilterReadAsync()\n        {\n            return ((IAsyncOnAudioFilterReadHandler)new AsyncTriggerHandler<(float[] data, int channels)>(this, true)).OnAudioFilterReadAsync();\n        }\n\n        public UniTask<(float[] data, int channels)> OnAudioFilterReadAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnAudioFilterReadHandler)new AsyncTriggerHandler<(float[] data, int channels)>(this, cancellationToken, true)).OnAudioFilterReadAsync();\n        }\n    }\n#endregion\n\n#region BecameInvisible\n\n    public interface IAsyncOnBecameInvisibleHandler\n    {\n        UniTask OnBecameInvisibleAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnBecameInvisibleHandler\n    {\n        UniTask IAsyncOnBecameInvisibleHandler.OnBecameInvisibleAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncBecameInvisibleTrigger GetAsyncBecameInvisibleTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncBecameInvisibleTrigger>(gameObject);\n        }\n        \n        public static AsyncBecameInvisibleTrigger GetAsyncBecameInvisibleTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncBecameInvisibleTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncBecameInvisibleTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnBecameInvisible()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnBecameInvisibleHandler GetOnBecameInvisibleAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnBecameInvisibleHandler GetOnBecameInvisibleAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnBecameInvisibleAsync()\n        {\n            return ((IAsyncOnBecameInvisibleHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnBecameInvisibleAsync();\n        }\n\n        public UniTask OnBecameInvisibleAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnBecameInvisibleHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnBecameInvisibleAsync();\n        }\n    }\n#endregion\n\n#region BecameVisible\n\n    public interface IAsyncOnBecameVisibleHandler\n    {\n        UniTask OnBecameVisibleAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnBecameVisibleHandler\n    {\n        UniTask IAsyncOnBecameVisibleHandler.OnBecameVisibleAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncBecameVisibleTrigger GetAsyncBecameVisibleTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncBecameVisibleTrigger>(gameObject);\n        }\n        \n        public static AsyncBecameVisibleTrigger GetAsyncBecameVisibleTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncBecameVisibleTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncBecameVisibleTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnBecameVisible()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnBecameVisibleHandler GetOnBecameVisibleAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnBecameVisibleHandler GetOnBecameVisibleAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnBecameVisibleAsync()\n        {\n            return ((IAsyncOnBecameVisibleHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnBecameVisibleAsync();\n        }\n\n        public UniTask OnBecameVisibleAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnBecameVisibleHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnBecameVisibleAsync();\n        }\n    }\n#endregion\n\n#region BeforeTransformParentChanged\n\n    public interface IAsyncOnBeforeTransformParentChangedHandler\n    {\n        UniTask OnBeforeTransformParentChangedAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnBeforeTransformParentChangedHandler\n    {\n        UniTask IAsyncOnBeforeTransformParentChangedHandler.OnBeforeTransformParentChangedAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncBeforeTransformParentChangedTrigger GetAsyncBeforeTransformParentChangedTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncBeforeTransformParentChangedTrigger>(gameObject);\n        }\n        \n        public static AsyncBeforeTransformParentChangedTrigger GetAsyncBeforeTransformParentChangedTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncBeforeTransformParentChangedTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncBeforeTransformParentChangedTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnBeforeTransformParentChanged()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnBeforeTransformParentChangedHandler GetOnBeforeTransformParentChangedAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnBeforeTransformParentChangedHandler GetOnBeforeTransformParentChangedAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnBeforeTransformParentChangedAsync()\n        {\n            return ((IAsyncOnBeforeTransformParentChangedHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnBeforeTransformParentChangedAsync();\n        }\n\n        public UniTask OnBeforeTransformParentChangedAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnBeforeTransformParentChangedHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnBeforeTransformParentChangedAsync();\n        }\n    }\n#endregion\n\n#region OnCanvasGroupChanged\n\n    public interface IAsyncOnCanvasGroupChangedHandler\n    {\n        UniTask OnCanvasGroupChangedAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnCanvasGroupChangedHandler\n    {\n        UniTask IAsyncOnCanvasGroupChangedHandler.OnCanvasGroupChangedAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncOnCanvasGroupChangedTrigger GetAsyncOnCanvasGroupChangedTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncOnCanvasGroupChangedTrigger>(gameObject);\n        }\n        \n        public static AsyncOnCanvasGroupChangedTrigger GetAsyncOnCanvasGroupChangedTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncOnCanvasGroupChangedTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncOnCanvasGroupChangedTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnCanvasGroupChanged()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnCanvasGroupChangedHandler GetOnCanvasGroupChangedAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnCanvasGroupChangedHandler GetOnCanvasGroupChangedAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnCanvasGroupChangedAsync()\n        {\n            return ((IAsyncOnCanvasGroupChangedHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnCanvasGroupChangedAsync();\n        }\n\n        public UniTask OnCanvasGroupChangedAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnCanvasGroupChangedHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnCanvasGroupChangedAsync();\n        }\n    }\n#endregion\n\n#region CollisionEnter\n#if !UNITY_2019_1_OR_NEWER || UNITASK_PHYSICS_SUPPORT\n\n    public interface IAsyncOnCollisionEnterHandler\n    {\n        UniTask<Collision> OnCollisionEnterAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnCollisionEnterHandler\n    {\n        UniTask<Collision> IAsyncOnCollisionEnterHandler.OnCollisionEnterAsync()\n        {\n            core.Reset();\n            return new UniTask<Collision>((IUniTaskSource<Collision>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncCollisionEnterTrigger GetAsyncCollisionEnterTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncCollisionEnterTrigger>(gameObject);\n        }\n        \n        public static AsyncCollisionEnterTrigger GetAsyncCollisionEnterTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncCollisionEnterTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncCollisionEnterTrigger : AsyncTriggerBase<Collision>\n    {\n        void OnCollisionEnter(Collision coll)\n        {\n            RaiseEvent((coll));\n        }\n\n        public IAsyncOnCollisionEnterHandler GetOnCollisionEnterAsyncHandler()\n        {\n            return new AsyncTriggerHandler<Collision>(this, false);\n        }\n\n        public IAsyncOnCollisionEnterHandler GetOnCollisionEnterAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<Collision>(this, cancellationToken, false);\n        }\n\n        public UniTask<Collision> OnCollisionEnterAsync()\n        {\n            return ((IAsyncOnCollisionEnterHandler)new AsyncTriggerHandler<Collision>(this, true)).OnCollisionEnterAsync();\n        }\n\n        public UniTask<Collision> OnCollisionEnterAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnCollisionEnterHandler)new AsyncTriggerHandler<Collision>(this, cancellationToken, true)).OnCollisionEnterAsync();\n        }\n    }\n#endif\n#endregion\n\n#region CollisionEnter2D\n#if !UNITY_2019_1_OR_NEWER || UNITASK_PHYSICS2D_SUPPORT\n\n    public interface IAsyncOnCollisionEnter2DHandler\n    {\n        UniTask<Collision2D> OnCollisionEnter2DAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnCollisionEnter2DHandler\n    {\n        UniTask<Collision2D> IAsyncOnCollisionEnter2DHandler.OnCollisionEnter2DAsync()\n        {\n            core.Reset();\n            return new UniTask<Collision2D>((IUniTaskSource<Collision2D>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncCollisionEnter2DTrigger GetAsyncCollisionEnter2DTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncCollisionEnter2DTrigger>(gameObject);\n        }\n        \n        public static AsyncCollisionEnter2DTrigger GetAsyncCollisionEnter2DTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncCollisionEnter2DTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncCollisionEnter2DTrigger : AsyncTriggerBase<Collision2D>\n    {\n        void OnCollisionEnter2D(Collision2D coll)\n        {\n            RaiseEvent((coll));\n        }\n\n        public IAsyncOnCollisionEnter2DHandler GetOnCollisionEnter2DAsyncHandler()\n        {\n            return new AsyncTriggerHandler<Collision2D>(this, false);\n        }\n\n        public IAsyncOnCollisionEnter2DHandler GetOnCollisionEnter2DAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<Collision2D>(this, cancellationToken, false);\n        }\n\n        public UniTask<Collision2D> OnCollisionEnter2DAsync()\n        {\n            return ((IAsyncOnCollisionEnter2DHandler)new AsyncTriggerHandler<Collision2D>(this, true)).OnCollisionEnter2DAsync();\n        }\n\n        public UniTask<Collision2D> OnCollisionEnter2DAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnCollisionEnter2DHandler)new AsyncTriggerHandler<Collision2D>(this, cancellationToken, true)).OnCollisionEnter2DAsync();\n        }\n    }\n#endif\n#endregion\n\n#region CollisionExit\n#if !UNITY_2019_1_OR_NEWER || UNITASK_PHYSICS_SUPPORT\n\n    public interface IAsyncOnCollisionExitHandler\n    {\n        UniTask<Collision> OnCollisionExitAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnCollisionExitHandler\n    {\n        UniTask<Collision> IAsyncOnCollisionExitHandler.OnCollisionExitAsync()\n        {\n            core.Reset();\n            return new UniTask<Collision>((IUniTaskSource<Collision>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncCollisionExitTrigger GetAsyncCollisionExitTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncCollisionExitTrigger>(gameObject);\n        }\n        \n        public static AsyncCollisionExitTrigger GetAsyncCollisionExitTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncCollisionExitTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncCollisionExitTrigger : AsyncTriggerBase<Collision>\n    {\n        void OnCollisionExit(Collision coll)\n        {\n            RaiseEvent((coll));\n        }\n\n        public IAsyncOnCollisionExitHandler GetOnCollisionExitAsyncHandler()\n        {\n            return new AsyncTriggerHandler<Collision>(this, false);\n        }\n\n        public IAsyncOnCollisionExitHandler GetOnCollisionExitAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<Collision>(this, cancellationToken, false);\n        }\n\n        public UniTask<Collision> OnCollisionExitAsync()\n        {\n            return ((IAsyncOnCollisionExitHandler)new AsyncTriggerHandler<Collision>(this, true)).OnCollisionExitAsync();\n        }\n\n        public UniTask<Collision> OnCollisionExitAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnCollisionExitHandler)new AsyncTriggerHandler<Collision>(this, cancellationToken, true)).OnCollisionExitAsync();\n        }\n    }\n#endif\n#endregion\n\n#region CollisionExit2D\n#if !UNITY_2019_1_OR_NEWER || UNITASK_PHYSICS2D_SUPPORT\n\n    public interface IAsyncOnCollisionExit2DHandler\n    {\n        UniTask<Collision2D> OnCollisionExit2DAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnCollisionExit2DHandler\n    {\n        UniTask<Collision2D> IAsyncOnCollisionExit2DHandler.OnCollisionExit2DAsync()\n        {\n            core.Reset();\n            return new UniTask<Collision2D>((IUniTaskSource<Collision2D>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncCollisionExit2DTrigger GetAsyncCollisionExit2DTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncCollisionExit2DTrigger>(gameObject);\n        }\n        \n        public static AsyncCollisionExit2DTrigger GetAsyncCollisionExit2DTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncCollisionExit2DTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncCollisionExit2DTrigger : AsyncTriggerBase<Collision2D>\n    {\n        void OnCollisionExit2D(Collision2D coll)\n        {\n            RaiseEvent((coll));\n        }\n\n        public IAsyncOnCollisionExit2DHandler GetOnCollisionExit2DAsyncHandler()\n        {\n            return new AsyncTriggerHandler<Collision2D>(this, false);\n        }\n\n        public IAsyncOnCollisionExit2DHandler GetOnCollisionExit2DAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<Collision2D>(this, cancellationToken, false);\n        }\n\n        public UniTask<Collision2D> OnCollisionExit2DAsync()\n        {\n            return ((IAsyncOnCollisionExit2DHandler)new AsyncTriggerHandler<Collision2D>(this, true)).OnCollisionExit2DAsync();\n        }\n\n        public UniTask<Collision2D> OnCollisionExit2DAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnCollisionExit2DHandler)new AsyncTriggerHandler<Collision2D>(this, cancellationToken, true)).OnCollisionExit2DAsync();\n        }\n    }\n#endif\n#endregion\n\n#region CollisionStay\n#if !UNITY_2019_1_OR_NEWER || UNITASK_PHYSICS_SUPPORT\n\n    public interface IAsyncOnCollisionStayHandler\n    {\n        UniTask<Collision> OnCollisionStayAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnCollisionStayHandler\n    {\n        UniTask<Collision> IAsyncOnCollisionStayHandler.OnCollisionStayAsync()\n        {\n            core.Reset();\n            return new UniTask<Collision>((IUniTaskSource<Collision>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncCollisionStayTrigger GetAsyncCollisionStayTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncCollisionStayTrigger>(gameObject);\n        }\n        \n        public static AsyncCollisionStayTrigger GetAsyncCollisionStayTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncCollisionStayTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncCollisionStayTrigger : AsyncTriggerBase<Collision>\n    {\n        void OnCollisionStay(Collision coll)\n        {\n            RaiseEvent((coll));\n        }\n\n        public IAsyncOnCollisionStayHandler GetOnCollisionStayAsyncHandler()\n        {\n            return new AsyncTriggerHandler<Collision>(this, false);\n        }\n\n        public IAsyncOnCollisionStayHandler GetOnCollisionStayAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<Collision>(this, cancellationToken, false);\n        }\n\n        public UniTask<Collision> OnCollisionStayAsync()\n        {\n            return ((IAsyncOnCollisionStayHandler)new AsyncTriggerHandler<Collision>(this, true)).OnCollisionStayAsync();\n        }\n\n        public UniTask<Collision> OnCollisionStayAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnCollisionStayHandler)new AsyncTriggerHandler<Collision>(this, cancellationToken, true)).OnCollisionStayAsync();\n        }\n    }\n#endif\n#endregion\n\n#region CollisionStay2D\n#if !UNITY_2019_1_OR_NEWER || UNITASK_PHYSICS2D_SUPPORT\n\n    public interface IAsyncOnCollisionStay2DHandler\n    {\n        UniTask<Collision2D> OnCollisionStay2DAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnCollisionStay2DHandler\n    {\n        UniTask<Collision2D> IAsyncOnCollisionStay2DHandler.OnCollisionStay2DAsync()\n        {\n            core.Reset();\n            return new UniTask<Collision2D>((IUniTaskSource<Collision2D>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncCollisionStay2DTrigger GetAsyncCollisionStay2DTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncCollisionStay2DTrigger>(gameObject);\n        }\n        \n        public static AsyncCollisionStay2DTrigger GetAsyncCollisionStay2DTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncCollisionStay2DTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncCollisionStay2DTrigger : AsyncTriggerBase<Collision2D>\n    {\n        void OnCollisionStay2D(Collision2D coll)\n        {\n            RaiseEvent((coll));\n        }\n\n        public IAsyncOnCollisionStay2DHandler GetOnCollisionStay2DAsyncHandler()\n        {\n            return new AsyncTriggerHandler<Collision2D>(this, false);\n        }\n\n        public IAsyncOnCollisionStay2DHandler GetOnCollisionStay2DAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<Collision2D>(this, cancellationToken, false);\n        }\n\n        public UniTask<Collision2D> OnCollisionStay2DAsync()\n        {\n            return ((IAsyncOnCollisionStay2DHandler)new AsyncTriggerHandler<Collision2D>(this, true)).OnCollisionStay2DAsync();\n        }\n\n        public UniTask<Collision2D> OnCollisionStay2DAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnCollisionStay2DHandler)new AsyncTriggerHandler<Collision2D>(this, cancellationToken, true)).OnCollisionStay2DAsync();\n        }\n    }\n#endif\n#endregion\n\n#region ControllerColliderHit\n#if !UNITY_2019_1_OR_NEWER || UNITASK_PHYSICS_SUPPORT\n\n    public interface IAsyncOnControllerColliderHitHandler\n    {\n        UniTask<ControllerColliderHit> OnControllerColliderHitAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnControllerColliderHitHandler\n    {\n        UniTask<ControllerColliderHit> IAsyncOnControllerColliderHitHandler.OnControllerColliderHitAsync()\n        {\n            core.Reset();\n            return new UniTask<ControllerColliderHit>((IUniTaskSource<ControllerColliderHit>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncControllerColliderHitTrigger GetAsyncControllerColliderHitTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncControllerColliderHitTrigger>(gameObject);\n        }\n        \n        public static AsyncControllerColliderHitTrigger GetAsyncControllerColliderHitTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncControllerColliderHitTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncControllerColliderHitTrigger : AsyncTriggerBase<ControllerColliderHit>\n    {\n        void OnControllerColliderHit(ControllerColliderHit hit)\n        {\n            RaiseEvent((hit));\n        }\n\n        public IAsyncOnControllerColliderHitHandler GetOnControllerColliderHitAsyncHandler()\n        {\n            return new AsyncTriggerHandler<ControllerColliderHit>(this, false);\n        }\n\n        public IAsyncOnControllerColliderHitHandler GetOnControllerColliderHitAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<ControllerColliderHit>(this, cancellationToken, false);\n        }\n\n        public UniTask<ControllerColliderHit> OnControllerColliderHitAsync()\n        {\n            return ((IAsyncOnControllerColliderHitHandler)new AsyncTriggerHandler<ControllerColliderHit>(this, true)).OnControllerColliderHitAsync();\n        }\n\n        public UniTask<ControllerColliderHit> OnControllerColliderHitAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnControllerColliderHitHandler)new AsyncTriggerHandler<ControllerColliderHit>(this, cancellationToken, true)).OnControllerColliderHitAsync();\n        }\n    }\n#endif\n#endregion\n\n#region Disable\n\n    public interface IAsyncOnDisableHandler\n    {\n        UniTask OnDisableAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnDisableHandler\n    {\n        UniTask IAsyncOnDisableHandler.OnDisableAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncDisableTrigger GetAsyncDisableTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncDisableTrigger>(gameObject);\n        }\n        \n        public static AsyncDisableTrigger GetAsyncDisableTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncDisableTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncDisableTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnDisable()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnDisableHandler GetOnDisableAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnDisableHandler GetOnDisableAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnDisableAsync()\n        {\n            return ((IAsyncOnDisableHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnDisableAsync();\n        }\n\n        public UniTask OnDisableAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnDisableHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnDisableAsync();\n        }\n    }\n#endregion\n\n#region DrawGizmos\n\n    public interface IAsyncOnDrawGizmosHandler\n    {\n        UniTask OnDrawGizmosAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnDrawGizmosHandler\n    {\n        UniTask IAsyncOnDrawGizmosHandler.OnDrawGizmosAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncDrawGizmosTrigger GetAsyncDrawGizmosTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncDrawGizmosTrigger>(gameObject);\n        }\n        \n        public static AsyncDrawGizmosTrigger GetAsyncDrawGizmosTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncDrawGizmosTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncDrawGizmosTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnDrawGizmos()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnDrawGizmosHandler GetOnDrawGizmosAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnDrawGizmosHandler GetOnDrawGizmosAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnDrawGizmosAsync()\n        {\n            return ((IAsyncOnDrawGizmosHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnDrawGizmosAsync();\n        }\n\n        public UniTask OnDrawGizmosAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnDrawGizmosHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnDrawGizmosAsync();\n        }\n    }\n#endregion\n\n#region DrawGizmosSelected\n\n    public interface IAsyncOnDrawGizmosSelectedHandler\n    {\n        UniTask OnDrawGizmosSelectedAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnDrawGizmosSelectedHandler\n    {\n        UniTask IAsyncOnDrawGizmosSelectedHandler.OnDrawGizmosSelectedAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncDrawGizmosSelectedTrigger GetAsyncDrawGizmosSelectedTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncDrawGizmosSelectedTrigger>(gameObject);\n        }\n        \n        public static AsyncDrawGizmosSelectedTrigger GetAsyncDrawGizmosSelectedTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncDrawGizmosSelectedTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncDrawGizmosSelectedTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnDrawGizmosSelected()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnDrawGizmosSelectedHandler GetOnDrawGizmosSelectedAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnDrawGizmosSelectedHandler GetOnDrawGizmosSelectedAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnDrawGizmosSelectedAsync()\n        {\n            return ((IAsyncOnDrawGizmosSelectedHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnDrawGizmosSelectedAsync();\n        }\n\n        public UniTask OnDrawGizmosSelectedAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnDrawGizmosSelectedHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnDrawGizmosSelectedAsync();\n        }\n    }\n#endregion\n\n#region Enable\n\n    public interface IAsyncOnEnableHandler\n    {\n        UniTask OnEnableAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnEnableHandler\n    {\n        UniTask IAsyncOnEnableHandler.OnEnableAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncEnableTrigger GetAsyncEnableTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncEnableTrigger>(gameObject);\n        }\n        \n        public static AsyncEnableTrigger GetAsyncEnableTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncEnableTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncEnableTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnEnable()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnEnableHandler GetOnEnableAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnEnableHandler GetOnEnableAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnEnableAsync()\n        {\n            return ((IAsyncOnEnableHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnEnableAsync();\n        }\n\n        public UniTask OnEnableAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnEnableHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnEnableAsync();\n        }\n    }\n#endregion\n\n#region GUI\n\n    public interface IAsyncOnGUIHandler\n    {\n        UniTask OnGUIAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnGUIHandler\n    {\n        UniTask IAsyncOnGUIHandler.OnGUIAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncGUITrigger GetAsyncGUITrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncGUITrigger>(gameObject);\n        }\n        \n        public static AsyncGUITrigger GetAsyncGUITrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncGUITrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncGUITrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnGUI()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnGUIHandler GetOnGUIAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnGUIHandler GetOnGUIAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnGUIAsync()\n        {\n            return ((IAsyncOnGUIHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnGUIAsync();\n        }\n\n        public UniTask OnGUIAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnGUIHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnGUIAsync();\n        }\n    }\n#endregion\n\n#region JointBreak\n#if !UNITY_2019_1_OR_NEWER || UNITASK_PHYSICS_SUPPORT\n\n    public interface IAsyncOnJointBreakHandler\n    {\n        UniTask<float> OnJointBreakAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnJointBreakHandler\n    {\n        UniTask<float> IAsyncOnJointBreakHandler.OnJointBreakAsync()\n        {\n            core.Reset();\n            return new UniTask<float>((IUniTaskSource<float>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncJointBreakTrigger GetAsyncJointBreakTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncJointBreakTrigger>(gameObject);\n        }\n        \n        public static AsyncJointBreakTrigger GetAsyncJointBreakTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncJointBreakTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncJointBreakTrigger : AsyncTriggerBase<float>\n    {\n        void OnJointBreak(float breakForce)\n        {\n            RaiseEvent((breakForce));\n        }\n\n        public IAsyncOnJointBreakHandler GetOnJointBreakAsyncHandler()\n        {\n            return new AsyncTriggerHandler<float>(this, false);\n        }\n\n        public IAsyncOnJointBreakHandler GetOnJointBreakAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<float>(this, cancellationToken, false);\n        }\n\n        public UniTask<float> OnJointBreakAsync()\n        {\n            return ((IAsyncOnJointBreakHandler)new AsyncTriggerHandler<float>(this, true)).OnJointBreakAsync();\n        }\n\n        public UniTask<float> OnJointBreakAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnJointBreakHandler)new AsyncTriggerHandler<float>(this, cancellationToken, true)).OnJointBreakAsync();\n        }\n    }\n#endif\n#endregion\n\n#region JointBreak2D\n#if !UNITY_2019_1_OR_NEWER || UNITASK_PHYSICS2D_SUPPORT\n\n    public interface IAsyncOnJointBreak2DHandler\n    {\n        UniTask<Joint2D> OnJointBreak2DAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnJointBreak2DHandler\n    {\n        UniTask<Joint2D> IAsyncOnJointBreak2DHandler.OnJointBreak2DAsync()\n        {\n            core.Reset();\n            return new UniTask<Joint2D>((IUniTaskSource<Joint2D>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncJointBreak2DTrigger GetAsyncJointBreak2DTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncJointBreak2DTrigger>(gameObject);\n        }\n        \n        public static AsyncJointBreak2DTrigger GetAsyncJointBreak2DTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncJointBreak2DTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncJointBreak2DTrigger : AsyncTriggerBase<Joint2D>\n    {\n        void OnJointBreak2D(Joint2D brokenJoint)\n        {\n            RaiseEvent((brokenJoint));\n        }\n\n        public IAsyncOnJointBreak2DHandler GetOnJointBreak2DAsyncHandler()\n        {\n            return new AsyncTriggerHandler<Joint2D>(this, false);\n        }\n\n        public IAsyncOnJointBreak2DHandler GetOnJointBreak2DAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<Joint2D>(this, cancellationToken, false);\n        }\n\n        public UniTask<Joint2D> OnJointBreak2DAsync()\n        {\n            return ((IAsyncOnJointBreak2DHandler)new AsyncTriggerHandler<Joint2D>(this, true)).OnJointBreak2DAsync();\n        }\n\n        public UniTask<Joint2D> OnJointBreak2DAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnJointBreak2DHandler)new AsyncTriggerHandler<Joint2D>(this, cancellationToken, true)).OnJointBreak2DAsync();\n        }\n    }\n#endif\n#endregion\n\n#region MouseDown\n#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO)\n\n    public interface IAsyncOnMouseDownHandler\n    {\n        UniTask OnMouseDownAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnMouseDownHandler\n    {\n        UniTask IAsyncOnMouseDownHandler.OnMouseDownAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncMouseDownTrigger GetAsyncMouseDownTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncMouseDownTrigger>(gameObject);\n        }\n        \n        public static AsyncMouseDownTrigger GetAsyncMouseDownTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncMouseDownTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncMouseDownTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnMouseDown()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnMouseDownHandler GetOnMouseDownAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnMouseDownHandler GetOnMouseDownAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnMouseDownAsync()\n        {\n            return ((IAsyncOnMouseDownHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnMouseDownAsync();\n        }\n\n        public UniTask OnMouseDownAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnMouseDownHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnMouseDownAsync();\n        }\n    }\n#endif\n#endregion\n\n#region MouseDrag\n#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO)\n\n    public interface IAsyncOnMouseDragHandler\n    {\n        UniTask OnMouseDragAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnMouseDragHandler\n    {\n        UniTask IAsyncOnMouseDragHandler.OnMouseDragAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncMouseDragTrigger GetAsyncMouseDragTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncMouseDragTrigger>(gameObject);\n        }\n        \n        public static AsyncMouseDragTrigger GetAsyncMouseDragTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncMouseDragTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncMouseDragTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnMouseDrag()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnMouseDragHandler GetOnMouseDragAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnMouseDragHandler GetOnMouseDragAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnMouseDragAsync()\n        {\n            return ((IAsyncOnMouseDragHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnMouseDragAsync();\n        }\n\n        public UniTask OnMouseDragAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnMouseDragHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnMouseDragAsync();\n        }\n    }\n#endif\n#endregion\n\n#region MouseEnter\n#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO)\n\n    public interface IAsyncOnMouseEnterHandler\n    {\n        UniTask OnMouseEnterAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnMouseEnterHandler\n    {\n        UniTask IAsyncOnMouseEnterHandler.OnMouseEnterAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncMouseEnterTrigger GetAsyncMouseEnterTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncMouseEnterTrigger>(gameObject);\n        }\n        \n        public static AsyncMouseEnterTrigger GetAsyncMouseEnterTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncMouseEnterTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncMouseEnterTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnMouseEnter()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnMouseEnterHandler GetOnMouseEnterAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnMouseEnterHandler GetOnMouseEnterAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnMouseEnterAsync()\n        {\n            return ((IAsyncOnMouseEnterHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnMouseEnterAsync();\n        }\n\n        public UniTask OnMouseEnterAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnMouseEnterHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnMouseEnterAsync();\n        }\n    }\n#endif\n#endregion\n\n#region MouseExit\n#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO)\n\n    public interface IAsyncOnMouseExitHandler\n    {\n        UniTask OnMouseExitAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnMouseExitHandler\n    {\n        UniTask IAsyncOnMouseExitHandler.OnMouseExitAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncMouseExitTrigger GetAsyncMouseExitTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncMouseExitTrigger>(gameObject);\n        }\n        \n        public static AsyncMouseExitTrigger GetAsyncMouseExitTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncMouseExitTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncMouseExitTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnMouseExit()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnMouseExitHandler GetOnMouseExitAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnMouseExitHandler GetOnMouseExitAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnMouseExitAsync()\n        {\n            return ((IAsyncOnMouseExitHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnMouseExitAsync();\n        }\n\n        public UniTask OnMouseExitAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnMouseExitHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnMouseExitAsync();\n        }\n    }\n#endif\n#endregion\n\n#region MouseOver\n#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO)\n\n    public interface IAsyncOnMouseOverHandler\n    {\n        UniTask OnMouseOverAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnMouseOverHandler\n    {\n        UniTask IAsyncOnMouseOverHandler.OnMouseOverAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncMouseOverTrigger GetAsyncMouseOverTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncMouseOverTrigger>(gameObject);\n        }\n        \n        public static AsyncMouseOverTrigger GetAsyncMouseOverTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncMouseOverTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncMouseOverTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnMouseOver()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnMouseOverHandler GetOnMouseOverAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnMouseOverHandler GetOnMouseOverAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnMouseOverAsync()\n        {\n            return ((IAsyncOnMouseOverHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnMouseOverAsync();\n        }\n\n        public UniTask OnMouseOverAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnMouseOverHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnMouseOverAsync();\n        }\n    }\n#endif\n#endregion\n\n#region MouseUp\n#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO)\n\n    public interface IAsyncOnMouseUpHandler\n    {\n        UniTask OnMouseUpAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnMouseUpHandler\n    {\n        UniTask IAsyncOnMouseUpHandler.OnMouseUpAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncMouseUpTrigger GetAsyncMouseUpTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncMouseUpTrigger>(gameObject);\n        }\n        \n        public static AsyncMouseUpTrigger GetAsyncMouseUpTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncMouseUpTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncMouseUpTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnMouseUp()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnMouseUpHandler GetOnMouseUpAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnMouseUpHandler GetOnMouseUpAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnMouseUpAsync()\n        {\n            return ((IAsyncOnMouseUpHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnMouseUpAsync();\n        }\n\n        public UniTask OnMouseUpAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnMouseUpHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnMouseUpAsync();\n        }\n    }\n#endif\n#endregion\n\n#region MouseUpAsButton\n#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO)\n\n    public interface IAsyncOnMouseUpAsButtonHandler\n    {\n        UniTask OnMouseUpAsButtonAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnMouseUpAsButtonHandler\n    {\n        UniTask IAsyncOnMouseUpAsButtonHandler.OnMouseUpAsButtonAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncMouseUpAsButtonTrigger GetAsyncMouseUpAsButtonTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncMouseUpAsButtonTrigger>(gameObject);\n        }\n        \n        public static AsyncMouseUpAsButtonTrigger GetAsyncMouseUpAsButtonTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncMouseUpAsButtonTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncMouseUpAsButtonTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnMouseUpAsButton()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnMouseUpAsButtonHandler GetOnMouseUpAsButtonAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnMouseUpAsButtonHandler GetOnMouseUpAsButtonAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnMouseUpAsButtonAsync()\n        {\n            return ((IAsyncOnMouseUpAsButtonHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnMouseUpAsButtonAsync();\n        }\n\n        public UniTask OnMouseUpAsButtonAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnMouseUpAsButtonHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnMouseUpAsButtonAsync();\n        }\n    }\n#endif\n#endregion\n\n#region ParticleCollision\n\n    public interface IAsyncOnParticleCollisionHandler\n    {\n        UniTask<GameObject> OnParticleCollisionAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnParticleCollisionHandler\n    {\n        UniTask<GameObject> IAsyncOnParticleCollisionHandler.OnParticleCollisionAsync()\n        {\n            core.Reset();\n            return new UniTask<GameObject>((IUniTaskSource<GameObject>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncParticleCollisionTrigger GetAsyncParticleCollisionTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncParticleCollisionTrigger>(gameObject);\n        }\n        \n        public static AsyncParticleCollisionTrigger GetAsyncParticleCollisionTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncParticleCollisionTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncParticleCollisionTrigger : AsyncTriggerBase<GameObject>\n    {\n        void OnParticleCollision(GameObject other)\n        {\n            RaiseEvent((other));\n        }\n\n        public IAsyncOnParticleCollisionHandler GetOnParticleCollisionAsyncHandler()\n        {\n            return new AsyncTriggerHandler<GameObject>(this, false);\n        }\n\n        public IAsyncOnParticleCollisionHandler GetOnParticleCollisionAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<GameObject>(this, cancellationToken, false);\n        }\n\n        public UniTask<GameObject> OnParticleCollisionAsync()\n        {\n            return ((IAsyncOnParticleCollisionHandler)new AsyncTriggerHandler<GameObject>(this, true)).OnParticleCollisionAsync();\n        }\n\n        public UniTask<GameObject> OnParticleCollisionAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnParticleCollisionHandler)new AsyncTriggerHandler<GameObject>(this, cancellationToken, true)).OnParticleCollisionAsync();\n        }\n    }\n#endregion\n\n#region ParticleSystemStopped\n\n    public interface IAsyncOnParticleSystemStoppedHandler\n    {\n        UniTask OnParticleSystemStoppedAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnParticleSystemStoppedHandler\n    {\n        UniTask IAsyncOnParticleSystemStoppedHandler.OnParticleSystemStoppedAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncParticleSystemStoppedTrigger GetAsyncParticleSystemStoppedTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncParticleSystemStoppedTrigger>(gameObject);\n        }\n        \n        public static AsyncParticleSystemStoppedTrigger GetAsyncParticleSystemStoppedTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncParticleSystemStoppedTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncParticleSystemStoppedTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnParticleSystemStopped()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnParticleSystemStoppedHandler GetOnParticleSystemStoppedAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnParticleSystemStoppedHandler GetOnParticleSystemStoppedAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnParticleSystemStoppedAsync()\n        {\n            return ((IAsyncOnParticleSystemStoppedHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnParticleSystemStoppedAsync();\n        }\n\n        public UniTask OnParticleSystemStoppedAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnParticleSystemStoppedHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnParticleSystemStoppedAsync();\n        }\n    }\n#endregion\n\n#region ParticleTrigger\n\n    public interface IAsyncOnParticleTriggerHandler\n    {\n        UniTask OnParticleTriggerAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnParticleTriggerHandler\n    {\n        UniTask IAsyncOnParticleTriggerHandler.OnParticleTriggerAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncParticleTriggerTrigger GetAsyncParticleTriggerTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncParticleTriggerTrigger>(gameObject);\n        }\n        \n        public static AsyncParticleTriggerTrigger GetAsyncParticleTriggerTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncParticleTriggerTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncParticleTriggerTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnParticleTrigger()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnParticleTriggerHandler GetOnParticleTriggerAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnParticleTriggerHandler GetOnParticleTriggerAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnParticleTriggerAsync()\n        {\n            return ((IAsyncOnParticleTriggerHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnParticleTriggerAsync();\n        }\n\n        public UniTask OnParticleTriggerAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnParticleTriggerHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnParticleTriggerAsync();\n        }\n    }\n#endregion\n\n#region ParticleUpdateJobScheduled\n#if UNITY_2019_3_OR_NEWER && (!UNITY_2019_1_OR_NEWER || UNITASK_PARTICLESYSTEM_SUPPORT)\n\n    public interface IAsyncOnParticleUpdateJobScheduledHandler\n    {\n        UniTask<UnityEngine.ParticleSystemJobs.ParticleSystemJobData> OnParticleUpdateJobScheduledAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnParticleUpdateJobScheduledHandler\n    {\n        UniTask<UnityEngine.ParticleSystemJobs.ParticleSystemJobData> IAsyncOnParticleUpdateJobScheduledHandler.OnParticleUpdateJobScheduledAsync()\n        {\n            core.Reset();\n            return new UniTask<UnityEngine.ParticleSystemJobs.ParticleSystemJobData>((IUniTaskSource<UnityEngine.ParticleSystemJobs.ParticleSystemJobData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncParticleUpdateJobScheduledTrigger GetAsyncParticleUpdateJobScheduledTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncParticleUpdateJobScheduledTrigger>(gameObject);\n        }\n        \n        public static AsyncParticleUpdateJobScheduledTrigger GetAsyncParticleUpdateJobScheduledTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncParticleUpdateJobScheduledTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncParticleUpdateJobScheduledTrigger : AsyncTriggerBase<UnityEngine.ParticleSystemJobs.ParticleSystemJobData>\n    {\n        void OnParticleUpdateJobScheduled(UnityEngine.ParticleSystemJobs.ParticleSystemJobData particles)\n        {\n            RaiseEvent((particles));\n        }\n\n        public IAsyncOnParticleUpdateJobScheduledHandler GetOnParticleUpdateJobScheduledAsyncHandler()\n        {\n            return new AsyncTriggerHandler<UnityEngine.ParticleSystemJobs.ParticleSystemJobData>(this, false);\n        }\n\n        public IAsyncOnParticleUpdateJobScheduledHandler GetOnParticleUpdateJobScheduledAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<UnityEngine.ParticleSystemJobs.ParticleSystemJobData>(this, cancellationToken, false);\n        }\n\n        public UniTask<UnityEngine.ParticleSystemJobs.ParticleSystemJobData> OnParticleUpdateJobScheduledAsync()\n        {\n            return ((IAsyncOnParticleUpdateJobScheduledHandler)new AsyncTriggerHandler<UnityEngine.ParticleSystemJobs.ParticleSystemJobData>(this, true)).OnParticleUpdateJobScheduledAsync();\n        }\n\n        public UniTask<UnityEngine.ParticleSystemJobs.ParticleSystemJobData> OnParticleUpdateJobScheduledAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnParticleUpdateJobScheduledHandler)new AsyncTriggerHandler<UnityEngine.ParticleSystemJobs.ParticleSystemJobData>(this, cancellationToken, true)).OnParticleUpdateJobScheduledAsync();\n        }\n    }\n#endif\n#endregion\n\n#region PostRender\n\n    public interface IAsyncOnPostRenderHandler\n    {\n        UniTask OnPostRenderAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnPostRenderHandler\n    {\n        UniTask IAsyncOnPostRenderHandler.OnPostRenderAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncPostRenderTrigger GetAsyncPostRenderTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncPostRenderTrigger>(gameObject);\n        }\n        \n        public static AsyncPostRenderTrigger GetAsyncPostRenderTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncPostRenderTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncPostRenderTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnPostRender()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnPostRenderHandler GetOnPostRenderAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnPostRenderHandler GetOnPostRenderAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnPostRenderAsync()\n        {\n            return ((IAsyncOnPostRenderHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnPostRenderAsync();\n        }\n\n        public UniTask OnPostRenderAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnPostRenderHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnPostRenderAsync();\n        }\n    }\n#endregion\n\n#region PreCull\n\n    public interface IAsyncOnPreCullHandler\n    {\n        UniTask OnPreCullAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnPreCullHandler\n    {\n        UniTask IAsyncOnPreCullHandler.OnPreCullAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncPreCullTrigger GetAsyncPreCullTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncPreCullTrigger>(gameObject);\n        }\n        \n        public static AsyncPreCullTrigger GetAsyncPreCullTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncPreCullTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncPreCullTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnPreCull()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnPreCullHandler GetOnPreCullAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnPreCullHandler GetOnPreCullAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnPreCullAsync()\n        {\n            return ((IAsyncOnPreCullHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnPreCullAsync();\n        }\n\n        public UniTask OnPreCullAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnPreCullHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnPreCullAsync();\n        }\n    }\n#endregion\n\n#region PreRender\n\n    public interface IAsyncOnPreRenderHandler\n    {\n        UniTask OnPreRenderAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnPreRenderHandler\n    {\n        UniTask IAsyncOnPreRenderHandler.OnPreRenderAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncPreRenderTrigger GetAsyncPreRenderTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncPreRenderTrigger>(gameObject);\n        }\n        \n        public static AsyncPreRenderTrigger GetAsyncPreRenderTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncPreRenderTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncPreRenderTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnPreRender()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnPreRenderHandler GetOnPreRenderAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnPreRenderHandler GetOnPreRenderAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnPreRenderAsync()\n        {\n            return ((IAsyncOnPreRenderHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnPreRenderAsync();\n        }\n\n        public UniTask OnPreRenderAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnPreRenderHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnPreRenderAsync();\n        }\n    }\n#endregion\n\n#region RectTransformDimensionsChange\n\n    public interface IAsyncOnRectTransformDimensionsChangeHandler\n    {\n        UniTask OnRectTransformDimensionsChangeAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnRectTransformDimensionsChangeHandler\n    {\n        UniTask IAsyncOnRectTransformDimensionsChangeHandler.OnRectTransformDimensionsChangeAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncRectTransformDimensionsChangeTrigger GetAsyncRectTransformDimensionsChangeTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncRectTransformDimensionsChangeTrigger>(gameObject);\n        }\n        \n        public static AsyncRectTransformDimensionsChangeTrigger GetAsyncRectTransformDimensionsChangeTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncRectTransformDimensionsChangeTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncRectTransformDimensionsChangeTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnRectTransformDimensionsChange()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnRectTransformDimensionsChangeHandler GetOnRectTransformDimensionsChangeAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnRectTransformDimensionsChangeHandler GetOnRectTransformDimensionsChangeAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnRectTransformDimensionsChangeAsync()\n        {\n            return ((IAsyncOnRectTransformDimensionsChangeHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnRectTransformDimensionsChangeAsync();\n        }\n\n        public UniTask OnRectTransformDimensionsChangeAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnRectTransformDimensionsChangeHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnRectTransformDimensionsChangeAsync();\n        }\n    }\n#endregion\n\n#region RectTransformRemoved\n\n    public interface IAsyncOnRectTransformRemovedHandler\n    {\n        UniTask OnRectTransformRemovedAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnRectTransformRemovedHandler\n    {\n        UniTask IAsyncOnRectTransformRemovedHandler.OnRectTransformRemovedAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncRectTransformRemovedTrigger GetAsyncRectTransformRemovedTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncRectTransformRemovedTrigger>(gameObject);\n        }\n        \n        public static AsyncRectTransformRemovedTrigger GetAsyncRectTransformRemovedTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncRectTransformRemovedTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncRectTransformRemovedTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnRectTransformRemoved()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnRectTransformRemovedHandler GetOnRectTransformRemovedAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnRectTransformRemovedHandler GetOnRectTransformRemovedAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnRectTransformRemovedAsync()\n        {\n            return ((IAsyncOnRectTransformRemovedHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnRectTransformRemovedAsync();\n        }\n\n        public UniTask OnRectTransformRemovedAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnRectTransformRemovedHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnRectTransformRemovedAsync();\n        }\n    }\n#endregion\n\n#region RenderImage\n\n    public interface IAsyncOnRenderImageHandler\n    {\n        UniTask<(RenderTexture source, RenderTexture destination)> OnRenderImageAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnRenderImageHandler\n    {\n        UniTask<(RenderTexture source, RenderTexture destination)> IAsyncOnRenderImageHandler.OnRenderImageAsync()\n        {\n            core.Reset();\n            return new UniTask<(RenderTexture source, RenderTexture destination)>((IUniTaskSource<(RenderTexture source, RenderTexture destination)>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncRenderImageTrigger GetAsyncRenderImageTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncRenderImageTrigger>(gameObject);\n        }\n        \n        public static AsyncRenderImageTrigger GetAsyncRenderImageTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncRenderImageTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncRenderImageTrigger : AsyncTriggerBase<(RenderTexture source, RenderTexture destination)>\n    {\n        void OnRenderImage(RenderTexture source, RenderTexture destination)\n        {\n            RaiseEvent((source, destination));\n        }\n\n        public IAsyncOnRenderImageHandler GetOnRenderImageAsyncHandler()\n        {\n            return new AsyncTriggerHandler<(RenderTexture source, RenderTexture destination)>(this, false);\n        }\n\n        public IAsyncOnRenderImageHandler GetOnRenderImageAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<(RenderTexture source, RenderTexture destination)>(this, cancellationToken, false);\n        }\n\n        public UniTask<(RenderTexture source, RenderTexture destination)> OnRenderImageAsync()\n        {\n            return ((IAsyncOnRenderImageHandler)new AsyncTriggerHandler<(RenderTexture source, RenderTexture destination)>(this, true)).OnRenderImageAsync();\n        }\n\n        public UniTask<(RenderTexture source, RenderTexture destination)> OnRenderImageAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnRenderImageHandler)new AsyncTriggerHandler<(RenderTexture source, RenderTexture destination)>(this, cancellationToken, true)).OnRenderImageAsync();\n        }\n    }\n#endregion\n\n#region RenderObject\n\n    public interface IAsyncOnRenderObjectHandler\n    {\n        UniTask OnRenderObjectAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnRenderObjectHandler\n    {\n        UniTask IAsyncOnRenderObjectHandler.OnRenderObjectAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncRenderObjectTrigger GetAsyncRenderObjectTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncRenderObjectTrigger>(gameObject);\n        }\n        \n        public static AsyncRenderObjectTrigger GetAsyncRenderObjectTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncRenderObjectTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncRenderObjectTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnRenderObject()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnRenderObjectHandler GetOnRenderObjectAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnRenderObjectHandler GetOnRenderObjectAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnRenderObjectAsync()\n        {\n            return ((IAsyncOnRenderObjectHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnRenderObjectAsync();\n        }\n\n        public UniTask OnRenderObjectAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnRenderObjectHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnRenderObjectAsync();\n        }\n    }\n#endregion\n\n#region ServerInitialized\n\n    public interface IAsyncOnServerInitializedHandler\n    {\n        UniTask OnServerInitializedAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnServerInitializedHandler\n    {\n        UniTask IAsyncOnServerInitializedHandler.OnServerInitializedAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncServerInitializedTrigger GetAsyncServerInitializedTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncServerInitializedTrigger>(gameObject);\n        }\n        \n        public static AsyncServerInitializedTrigger GetAsyncServerInitializedTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncServerInitializedTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncServerInitializedTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnServerInitialized()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnServerInitializedHandler GetOnServerInitializedAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnServerInitializedHandler GetOnServerInitializedAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnServerInitializedAsync()\n        {\n            return ((IAsyncOnServerInitializedHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnServerInitializedAsync();\n        }\n\n        public UniTask OnServerInitializedAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnServerInitializedHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnServerInitializedAsync();\n        }\n    }\n#endregion\n\n#region TransformChildrenChanged\n\n    public interface IAsyncOnTransformChildrenChangedHandler\n    {\n        UniTask OnTransformChildrenChangedAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnTransformChildrenChangedHandler\n    {\n        UniTask IAsyncOnTransformChildrenChangedHandler.OnTransformChildrenChangedAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncTransformChildrenChangedTrigger GetAsyncTransformChildrenChangedTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncTransformChildrenChangedTrigger>(gameObject);\n        }\n        \n        public static AsyncTransformChildrenChangedTrigger GetAsyncTransformChildrenChangedTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncTransformChildrenChangedTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncTransformChildrenChangedTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnTransformChildrenChanged()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnTransformChildrenChangedHandler GetOnTransformChildrenChangedAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnTransformChildrenChangedHandler GetOnTransformChildrenChangedAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnTransformChildrenChangedAsync()\n        {\n            return ((IAsyncOnTransformChildrenChangedHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnTransformChildrenChangedAsync();\n        }\n\n        public UniTask OnTransformChildrenChangedAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnTransformChildrenChangedHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnTransformChildrenChangedAsync();\n        }\n    }\n#endregion\n\n#region TransformParentChanged\n\n    public interface IAsyncOnTransformParentChangedHandler\n    {\n        UniTask OnTransformParentChangedAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnTransformParentChangedHandler\n    {\n        UniTask IAsyncOnTransformParentChangedHandler.OnTransformParentChangedAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncTransformParentChangedTrigger GetAsyncTransformParentChangedTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncTransformParentChangedTrigger>(gameObject);\n        }\n        \n        public static AsyncTransformParentChangedTrigger GetAsyncTransformParentChangedTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncTransformParentChangedTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncTransformParentChangedTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnTransformParentChanged()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnTransformParentChangedHandler GetOnTransformParentChangedAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnTransformParentChangedHandler GetOnTransformParentChangedAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnTransformParentChangedAsync()\n        {\n            return ((IAsyncOnTransformParentChangedHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnTransformParentChangedAsync();\n        }\n\n        public UniTask OnTransformParentChangedAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnTransformParentChangedHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnTransformParentChangedAsync();\n        }\n    }\n#endregion\n\n#region TriggerEnter\n#if !UNITY_2019_1_OR_NEWER || UNITASK_PHYSICS_SUPPORT\n\n    public interface IAsyncOnTriggerEnterHandler\n    {\n        UniTask<Collider> OnTriggerEnterAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnTriggerEnterHandler\n    {\n        UniTask<Collider> IAsyncOnTriggerEnterHandler.OnTriggerEnterAsync()\n        {\n            core.Reset();\n            return new UniTask<Collider>((IUniTaskSource<Collider>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncTriggerEnterTrigger GetAsyncTriggerEnterTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncTriggerEnterTrigger>(gameObject);\n        }\n        \n        public static AsyncTriggerEnterTrigger GetAsyncTriggerEnterTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncTriggerEnterTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncTriggerEnterTrigger : AsyncTriggerBase<Collider>\n    {\n        void OnTriggerEnter(Collider other)\n        {\n            RaiseEvent((other));\n        }\n\n        public IAsyncOnTriggerEnterHandler GetOnTriggerEnterAsyncHandler()\n        {\n            return new AsyncTriggerHandler<Collider>(this, false);\n        }\n\n        public IAsyncOnTriggerEnterHandler GetOnTriggerEnterAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<Collider>(this, cancellationToken, false);\n        }\n\n        public UniTask<Collider> OnTriggerEnterAsync()\n        {\n            return ((IAsyncOnTriggerEnterHandler)new AsyncTriggerHandler<Collider>(this, true)).OnTriggerEnterAsync();\n        }\n\n        public UniTask<Collider> OnTriggerEnterAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnTriggerEnterHandler)new AsyncTriggerHandler<Collider>(this, cancellationToken, true)).OnTriggerEnterAsync();\n        }\n    }\n#endif\n#endregion\n\n#region TriggerEnter2D\n#if !UNITY_2019_1_OR_NEWER || UNITASK_PHYSICS2D_SUPPORT\n\n    public interface IAsyncOnTriggerEnter2DHandler\n    {\n        UniTask<Collider2D> OnTriggerEnter2DAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnTriggerEnter2DHandler\n    {\n        UniTask<Collider2D> IAsyncOnTriggerEnter2DHandler.OnTriggerEnter2DAsync()\n        {\n            core.Reset();\n            return new UniTask<Collider2D>((IUniTaskSource<Collider2D>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncTriggerEnter2DTrigger GetAsyncTriggerEnter2DTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncTriggerEnter2DTrigger>(gameObject);\n        }\n        \n        public static AsyncTriggerEnter2DTrigger GetAsyncTriggerEnter2DTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncTriggerEnter2DTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncTriggerEnter2DTrigger : AsyncTriggerBase<Collider2D>\n    {\n        void OnTriggerEnter2D(Collider2D other)\n        {\n            RaiseEvent((other));\n        }\n\n        public IAsyncOnTriggerEnter2DHandler GetOnTriggerEnter2DAsyncHandler()\n        {\n            return new AsyncTriggerHandler<Collider2D>(this, false);\n        }\n\n        public IAsyncOnTriggerEnter2DHandler GetOnTriggerEnter2DAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<Collider2D>(this, cancellationToken, false);\n        }\n\n        public UniTask<Collider2D> OnTriggerEnter2DAsync()\n        {\n            return ((IAsyncOnTriggerEnter2DHandler)new AsyncTriggerHandler<Collider2D>(this, true)).OnTriggerEnter2DAsync();\n        }\n\n        public UniTask<Collider2D> OnTriggerEnter2DAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnTriggerEnter2DHandler)new AsyncTriggerHandler<Collider2D>(this, cancellationToken, true)).OnTriggerEnter2DAsync();\n        }\n    }\n#endif\n#endregion\n\n#region TriggerExit\n#if !UNITY_2019_1_OR_NEWER || UNITASK_PHYSICS_SUPPORT\n\n    public interface IAsyncOnTriggerExitHandler\n    {\n        UniTask<Collider> OnTriggerExitAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnTriggerExitHandler\n    {\n        UniTask<Collider> IAsyncOnTriggerExitHandler.OnTriggerExitAsync()\n        {\n            core.Reset();\n            return new UniTask<Collider>((IUniTaskSource<Collider>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncTriggerExitTrigger GetAsyncTriggerExitTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncTriggerExitTrigger>(gameObject);\n        }\n        \n        public static AsyncTriggerExitTrigger GetAsyncTriggerExitTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncTriggerExitTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncTriggerExitTrigger : AsyncTriggerBase<Collider>\n    {\n        void OnTriggerExit(Collider other)\n        {\n            RaiseEvent((other));\n        }\n\n        public IAsyncOnTriggerExitHandler GetOnTriggerExitAsyncHandler()\n        {\n            return new AsyncTriggerHandler<Collider>(this, false);\n        }\n\n        public IAsyncOnTriggerExitHandler GetOnTriggerExitAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<Collider>(this, cancellationToken, false);\n        }\n\n        public UniTask<Collider> OnTriggerExitAsync()\n        {\n            return ((IAsyncOnTriggerExitHandler)new AsyncTriggerHandler<Collider>(this, true)).OnTriggerExitAsync();\n        }\n\n        public UniTask<Collider> OnTriggerExitAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnTriggerExitHandler)new AsyncTriggerHandler<Collider>(this, cancellationToken, true)).OnTriggerExitAsync();\n        }\n    }\n#endif\n#endregion\n\n#region TriggerExit2D\n#if !UNITY_2019_1_OR_NEWER || UNITASK_PHYSICS2D_SUPPORT\n\n    public interface IAsyncOnTriggerExit2DHandler\n    {\n        UniTask<Collider2D> OnTriggerExit2DAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnTriggerExit2DHandler\n    {\n        UniTask<Collider2D> IAsyncOnTriggerExit2DHandler.OnTriggerExit2DAsync()\n        {\n            core.Reset();\n            return new UniTask<Collider2D>((IUniTaskSource<Collider2D>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncTriggerExit2DTrigger GetAsyncTriggerExit2DTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncTriggerExit2DTrigger>(gameObject);\n        }\n        \n        public static AsyncTriggerExit2DTrigger GetAsyncTriggerExit2DTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncTriggerExit2DTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncTriggerExit2DTrigger : AsyncTriggerBase<Collider2D>\n    {\n        void OnTriggerExit2D(Collider2D other)\n        {\n            RaiseEvent((other));\n        }\n\n        public IAsyncOnTriggerExit2DHandler GetOnTriggerExit2DAsyncHandler()\n        {\n            return new AsyncTriggerHandler<Collider2D>(this, false);\n        }\n\n        public IAsyncOnTriggerExit2DHandler GetOnTriggerExit2DAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<Collider2D>(this, cancellationToken, false);\n        }\n\n        public UniTask<Collider2D> OnTriggerExit2DAsync()\n        {\n            return ((IAsyncOnTriggerExit2DHandler)new AsyncTriggerHandler<Collider2D>(this, true)).OnTriggerExit2DAsync();\n        }\n\n        public UniTask<Collider2D> OnTriggerExit2DAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnTriggerExit2DHandler)new AsyncTriggerHandler<Collider2D>(this, cancellationToken, true)).OnTriggerExit2DAsync();\n        }\n    }\n#endif\n#endregion\n\n#region TriggerStay\n#if !UNITY_2019_1_OR_NEWER || UNITASK_PHYSICS_SUPPORT\n\n    public interface IAsyncOnTriggerStayHandler\n    {\n        UniTask<Collider> OnTriggerStayAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnTriggerStayHandler\n    {\n        UniTask<Collider> IAsyncOnTriggerStayHandler.OnTriggerStayAsync()\n        {\n            core.Reset();\n            return new UniTask<Collider>((IUniTaskSource<Collider>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncTriggerStayTrigger GetAsyncTriggerStayTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncTriggerStayTrigger>(gameObject);\n        }\n        \n        public static AsyncTriggerStayTrigger GetAsyncTriggerStayTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncTriggerStayTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncTriggerStayTrigger : AsyncTriggerBase<Collider>\n    {\n        void OnTriggerStay(Collider other)\n        {\n            RaiseEvent((other));\n        }\n\n        public IAsyncOnTriggerStayHandler GetOnTriggerStayAsyncHandler()\n        {\n            return new AsyncTriggerHandler<Collider>(this, false);\n        }\n\n        public IAsyncOnTriggerStayHandler GetOnTriggerStayAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<Collider>(this, cancellationToken, false);\n        }\n\n        public UniTask<Collider> OnTriggerStayAsync()\n        {\n            return ((IAsyncOnTriggerStayHandler)new AsyncTriggerHandler<Collider>(this, true)).OnTriggerStayAsync();\n        }\n\n        public UniTask<Collider> OnTriggerStayAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnTriggerStayHandler)new AsyncTriggerHandler<Collider>(this, cancellationToken, true)).OnTriggerStayAsync();\n        }\n    }\n#endif\n#endregion\n\n#region TriggerStay2D\n#if !UNITY_2019_1_OR_NEWER || UNITASK_PHYSICS2D_SUPPORT\n\n    public interface IAsyncOnTriggerStay2DHandler\n    {\n        UniTask<Collider2D> OnTriggerStay2DAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnTriggerStay2DHandler\n    {\n        UniTask<Collider2D> IAsyncOnTriggerStay2DHandler.OnTriggerStay2DAsync()\n        {\n            core.Reset();\n            return new UniTask<Collider2D>((IUniTaskSource<Collider2D>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncTriggerStay2DTrigger GetAsyncTriggerStay2DTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncTriggerStay2DTrigger>(gameObject);\n        }\n        \n        public static AsyncTriggerStay2DTrigger GetAsyncTriggerStay2DTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncTriggerStay2DTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncTriggerStay2DTrigger : AsyncTriggerBase<Collider2D>\n    {\n        void OnTriggerStay2D(Collider2D other)\n        {\n            RaiseEvent((other));\n        }\n\n        public IAsyncOnTriggerStay2DHandler GetOnTriggerStay2DAsyncHandler()\n        {\n            return new AsyncTriggerHandler<Collider2D>(this, false);\n        }\n\n        public IAsyncOnTriggerStay2DHandler GetOnTriggerStay2DAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<Collider2D>(this, cancellationToken, false);\n        }\n\n        public UniTask<Collider2D> OnTriggerStay2DAsync()\n        {\n            return ((IAsyncOnTriggerStay2DHandler)new AsyncTriggerHandler<Collider2D>(this, true)).OnTriggerStay2DAsync();\n        }\n\n        public UniTask<Collider2D> OnTriggerStay2DAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnTriggerStay2DHandler)new AsyncTriggerHandler<Collider2D>(this, cancellationToken, true)).OnTriggerStay2DAsync();\n        }\n    }\n#endif\n#endregion\n\n#region Validate\n\n    public interface IAsyncOnValidateHandler\n    {\n        UniTask OnValidateAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnValidateHandler\n    {\n        UniTask IAsyncOnValidateHandler.OnValidateAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncValidateTrigger GetAsyncValidateTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncValidateTrigger>(gameObject);\n        }\n        \n        public static AsyncValidateTrigger GetAsyncValidateTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncValidateTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncValidateTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnValidate()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnValidateHandler GetOnValidateAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnValidateHandler GetOnValidateAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnValidateAsync()\n        {\n            return ((IAsyncOnValidateHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnValidateAsync();\n        }\n\n        public UniTask OnValidateAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnValidateHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnValidateAsync();\n        }\n    }\n#endregion\n\n#region WillRenderObject\n\n    public interface IAsyncOnWillRenderObjectHandler\n    {\n        UniTask OnWillRenderObjectAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnWillRenderObjectHandler\n    {\n        UniTask IAsyncOnWillRenderObjectHandler.OnWillRenderObjectAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncWillRenderObjectTrigger GetAsyncWillRenderObjectTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncWillRenderObjectTrigger>(gameObject);\n        }\n        \n        public static AsyncWillRenderObjectTrigger GetAsyncWillRenderObjectTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncWillRenderObjectTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncWillRenderObjectTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void OnWillRenderObject()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncOnWillRenderObjectHandler GetOnWillRenderObjectAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncOnWillRenderObjectHandler GetOnWillRenderObjectAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask OnWillRenderObjectAsync()\n        {\n            return ((IAsyncOnWillRenderObjectHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).OnWillRenderObjectAsync();\n        }\n\n        public UniTask OnWillRenderObjectAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnWillRenderObjectHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).OnWillRenderObjectAsync();\n        }\n    }\n#endregion\n\n#region Reset\n\n    public interface IAsyncResetHandler\n    {\n        UniTask ResetAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncResetHandler\n    {\n        UniTask IAsyncResetHandler.ResetAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncResetTrigger GetAsyncResetTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncResetTrigger>(gameObject);\n        }\n        \n        public static AsyncResetTrigger GetAsyncResetTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncResetTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncResetTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void Reset()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncResetHandler GetResetAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncResetHandler GetResetAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask ResetAsync()\n        {\n            return ((IAsyncResetHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).ResetAsync();\n        }\n\n        public UniTask ResetAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncResetHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).ResetAsync();\n        }\n    }\n#endregion\n\n#region Update\n\n    public interface IAsyncUpdateHandler\n    {\n        UniTask UpdateAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncUpdateHandler\n    {\n        UniTask IAsyncUpdateHandler.UpdateAsync()\n        {\n            core.Reset();\n            return new UniTask((IUniTaskSource)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncUpdateTrigger GetAsyncUpdateTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncUpdateTrigger>(gameObject);\n        }\n        \n        public static AsyncUpdateTrigger GetAsyncUpdateTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncUpdateTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncUpdateTrigger : AsyncTriggerBase<AsyncUnit>\n    {\n        void Update()\n        {\n            RaiseEvent(AsyncUnit.Default);\n        }\n\n        public IAsyncUpdateHandler GetUpdateAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, false);\n        }\n\n        public IAsyncUpdateHandler GetUpdateAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, false);\n        }\n\n        public UniTask UpdateAsync()\n        {\n            return ((IAsyncUpdateHandler)new AsyncTriggerHandler<AsyncUnit>(this, true)).UpdateAsync();\n        }\n\n        public UniTask UpdateAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncUpdateHandler)new AsyncTriggerHandler<AsyncUnit>(this, cancellationToken, true)).UpdateAsync();\n        }\n    }\n#endregion\n\n#region BeginDrag\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n\n    public interface IAsyncOnBeginDragHandler\n    {\n        UniTask<PointerEventData> OnBeginDragAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnBeginDragHandler\n    {\n        UniTask<PointerEventData> IAsyncOnBeginDragHandler.OnBeginDragAsync()\n        {\n            core.Reset();\n            return new UniTask<PointerEventData>((IUniTaskSource<PointerEventData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncBeginDragTrigger GetAsyncBeginDragTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncBeginDragTrigger>(gameObject);\n        }\n        \n        public static AsyncBeginDragTrigger GetAsyncBeginDragTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncBeginDragTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncBeginDragTrigger : AsyncTriggerBase<PointerEventData>, IBeginDragHandler\n    {\n        void IBeginDragHandler.OnBeginDrag(PointerEventData eventData)\n        {\n            RaiseEvent((eventData));\n        }\n\n        public IAsyncOnBeginDragHandler GetOnBeginDragAsyncHandler()\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, false);\n        }\n\n        public IAsyncOnBeginDragHandler GetOnBeginDragAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, false);\n        }\n\n        public UniTask<PointerEventData> OnBeginDragAsync()\n        {\n            return ((IAsyncOnBeginDragHandler)new AsyncTriggerHandler<PointerEventData>(this, true)).OnBeginDragAsync();\n        }\n\n        public UniTask<PointerEventData> OnBeginDragAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnBeginDragHandler)new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, true)).OnBeginDragAsync();\n        }\n    }\n#endif\n#endregion\n\n#region Cancel\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n\n    public interface IAsyncOnCancelHandler\n    {\n        UniTask<BaseEventData> OnCancelAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnCancelHandler\n    {\n        UniTask<BaseEventData> IAsyncOnCancelHandler.OnCancelAsync()\n        {\n            core.Reset();\n            return new UniTask<BaseEventData>((IUniTaskSource<BaseEventData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncCancelTrigger GetAsyncCancelTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncCancelTrigger>(gameObject);\n        }\n        \n        public static AsyncCancelTrigger GetAsyncCancelTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncCancelTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncCancelTrigger : AsyncTriggerBase<BaseEventData>, ICancelHandler\n    {\n        void ICancelHandler.OnCancel(BaseEventData eventData)\n        {\n            RaiseEvent((eventData));\n        }\n\n        public IAsyncOnCancelHandler GetOnCancelAsyncHandler()\n        {\n            return new AsyncTriggerHandler<BaseEventData>(this, false);\n        }\n\n        public IAsyncOnCancelHandler GetOnCancelAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<BaseEventData>(this, cancellationToken, false);\n        }\n\n        public UniTask<BaseEventData> OnCancelAsync()\n        {\n            return ((IAsyncOnCancelHandler)new AsyncTriggerHandler<BaseEventData>(this, true)).OnCancelAsync();\n        }\n\n        public UniTask<BaseEventData> OnCancelAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnCancelHandler)new AsyncTriggerHandler<BaseEventData>(this, cancellationToken, true)).OnCancelAsync();\n        }\n    }\n#endif\n#endregion\n\n#region Deselect\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n\n    public interface IAsyncOnDeselectHandler\n    {\n        UniTask<BaseEventData> OnDeselectAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnDeselectHandler\n    {\n        UniTask<BaseEventData> IAsyncOnDeselectHandler.OnDeselectAsync()\n        {\n            core.Reset();\n            return new UniTask<BaseEventData>((IUniTaskSource<BaseEventData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncDeselectTrigger GetAsyncDeselectTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncDeselectTrigger>(gameObject);\n        }\n        \n        public static AsyncDeselectTrigger GetAsyncDeselectTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncDeselectTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncDeselectTrigger : AsyncTriggerBase<BaseEventData>, IDeselectHandler\n    {\n        void IDeselectHandler.OnDeselect(BaseEventData eventData)\n        {\n            RaiseEvent((eventData));\n        }\n\n        public IAsyncOnDeselectHandler GetOnDeselectAsyncHandler()\n        {\n            return new AsyncTriggerHandler<BaseEventData>(this, false);\n        }\n\n        public IAsyncOnDeselectHandler GetOnDeselectAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<BaseEventData>(this, cancellationToken, false);\n        }\n\n        public UniTask<BaseEventData> OnDeselectAsync()\n        {\n            return ((IAsyncOnDeselectHandler)new AsyncTriggerHandler<BaseEventData>(this, true)).OnDeselectAsync();\n        }\n\n        public UniTask<BaseEventData> OnDeselectAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnDeselectHandler)new AsyncTriggerHandler<BaseEventData>(this, cancellationToken, true)).OnDeselectAsync();\n        }\n    }\n#endif\n#endregion\n\n#region Drag\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n\n    public interface IAsyncOnDragHandler\n    {\n        UniTask<PointerEventData> OnDragAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnDragHandler\n    {\n        UniTask<PointerEventData> IAsyncOnDragHandler.OnDragAsync()\n        {\n            core.Reset();\n            return new UniTask<PointerEventData>((IUniTaskSource<PointerEventData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncDragTrigger GetAsyncDragTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncDragTrigger>(gameObject);\n        }\n        \n        public static AsyncDragTrigger GetAsyncDragTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncDragTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncDragTrigger : AsyncTriggerBase<PointerEventData>, IDragHandler\n    {\n        void IDragHandler.OnDrag(PointerEventData eventData)\n        {\n            RaiseEvent((eventData));\n        }\n\n        public IAsyncOnDragHandler GetOnDragAsyncHandler()\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, false);\n        }\n\n        public IAsyncOnDragHandler GetOnDragAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, false);\n        }\n\n        public UniTask<PointerEventData> OnDragAsync()\n        {\n            return ((IAsyncOnDragHandler)new AsyncTriggerHandler<PointerEventData>(this, true)).OnDragAsync();\n        }\n\n        public UniTask<PointerEventData> OnDragAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnDragHandler)new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, true)).OnDragAsync();\n        }\n    }\n#endif\n#endregion\n\n#region Drop\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n\n    public interface IAsyncOnDropHandler\n    {\n        UniTask<PointerEventData> OnDropAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnDropHandler\n    {\n        UniTask<PointerEventData> IAsyncOnDropHandler.OnDropAsync()\n        {\n            core.Reset();\n            return new UniTask<PointerEventData>((IUniTaskSource<PointerEventData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncDropTrigger GetAsyncDropTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncDropTrigger>(gameObject);\n        }\n        \n        public static AsyncDropTrigger GetAsyncDropTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncDropTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncDropTrigger : AsyncTriggerBase<PointerEventData>, IDropHandler\n    {\n        void IDropHandler.OnDrop(PointerEventData eventData)\n        {\n            RaiseEvent((eventData));\n        }\n\n        public IAsyncOnDropHandler GetOnDropAsyncHandler()\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, false);\n        }\n\n        public IAsyncOnDropHandler GetOnDropAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, false);\n        }\n\n        public UniTask<PointerEventData> OnDropAsync()\n        {\n            return ((IAsyncOnDropHandler)new AsyncTriggerHandler<PointerEventData>(this, true)).OnDropAsync();\n        }\n\n        public UniTask<PointerEventData> OnDropAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnDropHandler)new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, true)).OnDropAsync();\n        }\n    }\n#endif\n#endregion\n\n#region EndDrag\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n\n    public interface IAsyncOnEndDragHandler\n    {\n        UniTask<PointerEventData> OnEndDragAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnEndDragHandler\n    {\n        UniTask<PointerEventData> IAsyncOnEndDragHandler.OnEndDragAsync()\n        {\n            core.Reset();\n            return new UniTask<PointerEventData>((IUniTaskSource<PointerEventData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncEndDragTrigger GetAsyncEndDragTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncEndDragTrigger>(gameObject);\n        }\n        \n        public static AsyncEndDragTrigger GetAsyncEndDragTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncEndDragTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncEndDragTrigger : AsyncTriggerBase<PointerEventData>, IEndDragHandler\n    {\n        void IEndDragHandler.OnEndDrag(PointerEventData eventData)\n        {\n            RaiseEvent((eventData));\n        }\n\n        public IAsyncOnEndDragHandler GetOnEndDragAsyncHandler()\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, false);\n        }\n\n        public IAsyncOnEndDragHandler GetOnEndDragAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, false);\n        }\n\n        public UniTask<PointerEventData> OnEndDragAsync()\n        {\n            return ((IAsyncOnEndDragHandler)new AsyncTriggerHandler<PointerEventData>(this, true)).OnEndDragAsync();\n        }\n\n        public UniTask<PointerEventData> OnEndDragAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnEndDragHandler)new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, true)).OnEndDragAsync();\n        }\n    }\n#endif\n#endregion\n\n#region InitializePotentialDrag\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n\n    public interface IAsyncOnInitializePotentialDragHandler\n    {\n        UniTask<PointerEventData> OnInitializePotentialDragAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnInitializePotentialDragHandler\n    {\n        UniTask<PointerEventData> IAsyncOnInitializePotentialDragHandler.OnInitializePotentialDragAsync()\n        {\n            core.Reset();\n            return new UniTask<PointerEventData>((IUniTaskSource<PointerEventData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncInitializePotentialDragTrigger GetAsyncInitializePotentialDragTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncInitializePotentialDragTrigger>(gameObject);\n        }\n        \n        public static AsyncInitializePotentialDragTrigger GetAsyncInitializePotentialDragTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncInitializePotentialDragTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncInitializePotentialDragTrigger : AsyncTriggerBase<PointerEventData>, IInitializePotentialDragHandler\n    {\n        void IInitializePotentialDragHandler.OnInitializePotentialDrag(PointerEventData eventData)\n        {\n            RaiseEvent((eventData));\n        }\n\n        public IAsyncOnInitializePotentialDragHandler GetOnInitializePotentialDragAsyncHandler()\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, false);\n        }\n\n        public IAsyncOnInitializePotentialDragHandler GetOnInitializePotentialDragAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, false);\n        }\n\n        public UniTask<PointerEventData> OnInitializePotentialDragAsync()\n        {\n            return ((IAsyncOnInitializePotentialDragHandler)new AsyncTriggerHandler<PointerEventData>(this, true)).OnInitializePotentialDragAsync();\n        }\n\n        public UniTask<PointerEventData> OnInitializePotentialDragAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnInitializePotentialDragHandler)new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, true)).OnInitializePotentialDragAsync();\n        }\n    }\n#endif\n#endregion\n\n#region Move\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n\n    public interface IAsyncOnMoveHandler\n    {\n        UniTask<AxisEventData> OnMoveAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnMoveHandler\n    {\n        UniTask<AxisEventData> IAsyncOnMoveHandler.OnMoveAsync()\n        {\n            core.Reset();\n            return new UniTask<AxisEventData>((IUniTaskSource<AxisEventData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncMoveTrigger GetAsyncMoveTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncMoveTrigger>(gameObject);\n        }\n        \n        public static AsyncMoveTrigger GetAsyncMoveTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncMoveTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncMoveTrigger : AsyncTriggerBase<AxisEventData>, IMoveHandler\n    {\n        void IMoveHandler.OnMove(AxisEventData eventData)\n        {\n            RaiseEvent((eventData));\n        }\n\n        public IAsyncOnMoveHandler GetOnMoveAsyncHandler()\n        {\n            return new AsyncTriggerHandler<AxisEventData>(this, false);\n        }\n\n        public IAsyncOnMoveHandler GetOnMoveAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<AxisEventData>(this, cancellationToken, false);\n        }\n\n        public UniTask<AxisEventData> OnMoveAsync()\n        {\n            return ((IAsyncOnMoveHandler)new AsyncTriggerHandler<AxisEventData>(this, true)).OnMoveAsync();\n        }\n\n        public UniTask<AxisEventData> OnMoveAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnMoveHandler)new AsyncTriggerHandler<AxisEventData>(this, cancellationToken, true)).OnMoveAsync();\n        }\n    }\n#endif\n#endregion\n\n#region PointerClick\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n\n    public interface IAsyncOnPointerClickHandler\n    {\n        UniTask<PointerEventData> OnPointerClickAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnPointerClickHandler\n    {\n        UniTask<PointerEventData> IAsyncOnPointerClickHandler.OnPointerClickAsync()\n        {\n            core.Reset();\n            return new UniTask<PointerEventData>((IUniTaskSource<PointerEventData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncPointerClickTrigger GetAsyncPointerClickTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncPointerClickTrigger>(gameObject);\n        }\n        \n        public static AsyncPointerClickTrigger GetAsyncPointerClickTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncPointerClickTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncPointerClickTrigger : AsyncTriggerBase<PointerEventData>, IPointerClickHandler\n    {\n        void IPointerClickHandler.OnPointerClick(PointerEventData eventData)\n        {\n            RaiseEvent((eventData));\n        }\n\n        public IAsyncOnPointerClickHandler GetOnPointerClickAsyncHandler()\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, false);\n        }\n\n        public IAsyncOnPointerClickHandler GetOnPointerClickAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, false);\n        }\n\n        public UniTask<PointerEventData> OnPointerClickAsync()\n        {\n            return ((IAsyncOnPointerClickHandler)new AsyncTriggerHandler<PointerEventData>(this, true)).OnPointerClickAsync();\n        }\n\n        public UniTask<PointerEventData> OnPointerClickAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnPointerClickHandler)new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, true)).OnPointerClickAsync();\n        }\n    }\n#endif\n#endregion\n\n#region PointerDown\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n\n    public interface IAsyncOnPointerDownHandler\n    {\n        UniTask<PointerEventData> OnPointerDownAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnPointerDownHandler\n    {\n        UniTask<PointerEventData> IAsyncOnPointerDownHandler.OnPointerDownAsync()\n        {\n            core.Reset();\n            return new UniTask<PointerEventData>((IUniTaskSource<PointerEventData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncPointerDownTrigger GetAsyncPointerDownTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncPointerDownTrigger>(gameObject);\n        }\n        \n        public static AsyncPointerDownTrigger GetAsyncPointerDownTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncPointerDownTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncPointerDownTrigger : AsyncTriggerBase<PointerEventData>, IPointerDownHandler\n    {\n        void IPointerDownHandler.OnPointerDown(PointerEventData eventData)\n        {\n            RaiseEvent((eventData));\n        }\n\n        public IAsyncOnPointerDownHandler GetOnPointerDownAsyncHandler()\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, false);\n        }\n\n        public IAsyncOnPointerDownHandler GetOnPointerDownAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, false);\n        }\n\n        public UniTask<PointerEventData> OnPointerDownAsync()\n        {\n            return ((IAsyncOnPointerDownHandler)new AsyncTriggerHandler<PointerEventData>(this, true)).OnPointerDownAsync();\n        }\n\n        public UniTask<PointerEventData> OnPointerDownAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnPointerDownHandler)new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, true)).OnPointerDownAsync();\n        }\n    }\n#endif\n#endregion\n\n#region PointerEnter\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n\n    public interface IAsyncOnPointerEnterHandler\n    {\n        UniTask<PointerEventData> OnPointerEnterAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnPointerEnterHandler\n    {\n        UniTask<PointerEventData> IAsyncOnPointerEnterHandler.OnPointerEnterAsync()\n        {\n            core.Reset();\n            return new UniTask<PointerEventData>((IUniTaskSource<PointerEventData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncPointerEnterTrigger GetAsyncPointerEnterTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncPointerEnterTrigger>(gameObject);\n        }\n        \n        public static AsyncPointerEnterTrigger GetAsyncPointerEnterTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncPointerEnterTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncPointerEnterTrigger : AsyncTriggerBase<PointerEventData>, IPointerEnterHandler\n    {\n        void IPointerEnterHandler.OnPointerEnter(PointerEventData eventData)\n        {\n            RaiseEvent((eventData));\n        }\n\n        public IAsyncOnPointerEnterHandler GetOnPointerEnterAsyncHandler()\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, false);\n        }\n\n        public IAsyncOnPointerEnterHandler GetOnPointerEnterAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, false);\n        }\n\n        public UniTask<PointerEventData> OnPointerEnterAsync()\n        {\n            return ((IAsyncOnPointerEnterHandler)new AsyncTriggerHandler<PointerEventData>(this, true)).OnPointerEnterAsync();\n        }\n\n        public UniTask<PointerEventData> OnPointerEnterAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnPointerEnterHandler)new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, true)).OnPointerEnterAsync();\n        }\n    }\n#endif\n#endregion\n\n#region PointerExit\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n\n    public interface IAsyncOnPointerExitHandler\n    {\n        UniTask<PointerEventData> OnPointerExitAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnPointerExitHandler\n    {\n        UniTask<PointerEventData> IAsyncOnPointerExitHandler.OnPointerExitAsync()\n        {\n            core.Reset();\n            return new UniTask<PointerEventData>((IUniTaskSource<PointerEventData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncPointerExitTrigger GetAsyncPointerExitTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncPointerExitTrigger>(gameObject);\n        }\n        \n        public static AsyncPointerExitTrigger GetAsyncPointerExitTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncPointerExitTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncPointerExitTrigger : AsyncTriggerBase<PointerEventData>, IPointerExitHandler\n    {\n        void IPointerExitHandler.OnPointerExit(PointerEventData eventData)\n        {\n            RaiseEvent((eventData));\n        }\n\n        public IAsyncOnPointerExitHandler GetOnPointerExitAsyncHandler()\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, false);\n        }\n\n        public IAsyncOnPointerExitHandler GetOnPointerExitAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, false);\n        }\n\n        public UniTask<PointerEventData> OnPointerExitAsync()\n        {\n            return ((IAsyncOnPointerExitHandler)new AsyncTriggerHandler<PointerEventData>(this, true)).OnPointerExitAsync();\n        }\n\n        public UniTask<PointerEventData> OnPointerExitAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnPointerExitHandler)new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, true)).OnPointerExitAsync();\n        }\n    }\n#endif\n#endregion\n\n#region PointerUp\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n\n    public interface IAsyncOnPointerUpHandler\n    {\n        UniTask<PointerEventData> OnPointerUpAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnPointerUpHandler\n    {\n        UniTask<PointerEventData> IAsyncOnPointerUpHandler.OnPointerUpAsync()\n        {\n            core.Reset();\n            return new UniTask<PointerEventData>((IUniTaskSource<PointerEventData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncPointerUpTrigger GetAsyncPointerUpTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncPointerUpTrigger>(gameObject);\n        }\n        \n        public static AsyncPointerUpTrigger GetAsyncPointerUpTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncPointerUpTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncPointerUpTrigger : AsyncTriggerBase<PointerEventData>, IPointerUpHandler\n    {\n        void IPointerUpHandler.OnPointerUp(PointerEventData eventData)\n        {\n            RaiseEvent((eventData));\n        }\n\n        public IAsyncOnPointerUpHandler GetOnPointerUpAsyncHandler()\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, false);\n        }\n\n        public IAsyncOnPointerUpHandler GetOnPointerUpAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, false);\n        }\n\n        public UniTask<PointerEventData> OnPointerUpAsync()\n        {\n            return ((IAsyncOnPointerUpHandler)new AsyncTriggerHandler<PointerEventData>(this, true)).OnPointerUpAsync();\n        }\n\n        public UniTask<PointerEventData> OnPointerUpAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnPointerUpHandler)new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, true)).OnPointerUpAsync();\n        }\n    }\n#endif\n#endregion\n\n#region Scroll\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n\n    public interface IAsyncOnScrollHandler\n    {\n        UniTask<PointerEventData> OnScrollAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnScrollHandler\n    {\n        UniTask<PointerEventData> IAsyncOnScrollHandler.OnScrollAsync()\n        {\n            core.Reset();\n            return new UniTask<PointerEventData>((IUniTaskSource<PointerEventData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncScrollTrigger GetAsyncScrollTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncScrollTrigger>(gameObject);\n        }\n        \n        public static AsyncScrollTrigger GetAsyncScrollTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncScrollTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncScrollTrigger : AsyncTriggerBase<PointerEventData>, IScrollHandler\n    {\n        void IScrollHandler.OnScroll(PointerEventData eventData)\n        {\n            RaiseEvent((eventData));\n        }\n\n        public IAsyncOnScrollHandler GetOnScrollAsyncHandler()\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, false);\n        }\n\n        public IAsyncOnScrollHandler GetOnScrollAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, false);\n        }\n\n        public UniTask<PointerEventData> OnScrollAsync()\n        {\n            return ((IAsyncOnScrollHandler)new AsyncTriggerHandler<PointerEventData>(this, true)).OnScrollAsync();\n        }\n\n        public UniTask<PointerEventData> OnScrollAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnScrollHandler)new AsyncTriggerHandler<PointerEventData>(this, cancellationToken, true)).OnScrollAsync();\n        }\n    }\n#endif\n#endregion\n\n#region Select\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n\n    public interface IAsyncOnSelectHandler\n    {\n        UniTask<BaseEventData> OnSelectAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnSelectHandler\n    {\n        UniTask<BaseEventData> IAsyncOnSelectHandler.OnSelectAsync()\n        {\n            core.Reset();\n            return new UniTask<BaseEventData>((IUniTaskSource<BaseEventData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncSelectTrigger GetAsyncSelectTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncSelectTrigger>(gameObject);\n        }\n        \n        public static AsyncSelectTrigger GetAsyncSelectTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncSelectTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncSelectTrigger : AsyncTriggerBase<BaseEventData>, ISelectHandler\n    {\n        void ISelectHandler.OnSelect(BaseEventData eventData)\n        {\n            RaiseEvent((eventData));\n        }\n\n        public IAsyncOnSelectHandler GetOnSelectAsyncHandler()\n        {\n            return new AsyncTriggerHandler<BaseEventData>(this, false);\n        }\n\n        public IAsyncOnSelectHandler GetOnSelectAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<BaseEventData>(this, cancellationToken, false);\n        }\n\n        public UniTask<BaseEventData> OnSelectAsync()\n        {\n            return ((IAsyncOnSelectHandler)new AsyncTriggerHandler<BaseEventData>(this, true)).OnSelectAsync();\n        }\n\n        public UniTask<BaseEventData> OnSelectAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnSelectHandler)new AsyncTriggerHandler<BaseEventData>(this, cancellationToken, true)).OnSelectAsync();\n        }\n    }\n#endif\n#endregion\n\n#region Submit\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n\n    public interface IAsyncOnSubmitHandler\n    {\n        UniTask<BaseEventData> OnSubmitAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnSubmitHandler\n    {\n        UniTask<BaseEventData> IAsyncOnSubmitHandler.OnSubmitAsync()\n        {\n            core.Reset();\n            return new UniTask<BaseEventData>((IUniTaskSource<BaseEventData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncSubmitTrigger GetAsyncSubmitTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncSubmitTrigger>(gameObject);\n        }\n        \n        public static AsyncSubmitTrigger GetAsyncSubmitTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncSubmitTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncSubmitTrigger : AsyncTriggerBase<BaseEventData>, ISubmitHandler\n    {\n        void ISubmitHandler.OnSubmit(BaseEventData eventData)\n        {\n            RaiseEvent((eventData));\n        }\n\n        public IAsyncOnSubmitHandler GetOnSubmitAsyncHandler()\n        {\n            return new AsyncTriggerHandler<BaseEventData>(this, false);\n        }\n\n        public IAsyncOnSubmitHandler GetOnSubmitAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<BaseEventData>(this, cancellationToken, false);\n        }\n\n        public UniTask<BaseEventData> OnSubmitAsync()\n        {\n            return ((IAsyncOnSubmitHandler)new AsyncTriggerHandler<BaseEventData>(this, true)).OnSubmitAsync();\n        }\n\n        public UniTask<BaseEventData> OnSubmitAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnSubmitHandler)new AsyncTriggerHandler<BaseEventData>(this, cancellationToken, true)).OnSubmitAsync();\n        }\n    }\n#endif\n#endregion\n\n#region UpdateSelected\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n\n    public interface IAsyncOnUpdateSelectedHandler\n    {\n        UniTask<BaseEventData> OnUpdateSelectedAsync();\n    }\n\n    public partial class AsyncTriggerHandler<T> : IAsyncOnUpdateSelectedHandler\n    {\n        UniTask<BaseEventData> IAsyncOnUpdateSelectedHandler.OnUpdateSelectedAsync()\n        {\n            core.Reset();\n            return new UniTask<BaseEventData>((IUniTaskSource<BaseEventData>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static AsyncUpdateSelectedTrigger GetAsyncUpdateSelectedTrigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<AsyncUpdateSelectedTrigger>(gameObject);\n        }\n        \n        public static AsyncUpdateSelectedTrigger GetAsyncUpdateSelectedTrigger(this Component component)\n        {\n            return component.gameObject.GetAsyncUpdateSelectedTrigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class AsyncUpdateSelectedTrigger : AsyncTriggerBase<BaseEventData>, IUpdateSelectedHandler\n    {\n        void IUpdateSelectedHandler.OnUpdateSelected(BaseEventData eventData)\n        {\n            RaiseEvent((eventData));\n        }\n\n        public IAsyncOnUpdateSelectedHandler GetOnUpdateSelectedAsyncHandler()\n        {\n            return new AsyncTriggerHandler<BaseEventData>(this, false);\n        }\n\n        public IAsyncOnUpdateSelectedHandler GetOnUpdateSelectedAsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<BaseEventData>(this, cancellationToken, false);\n        }\n\n        public UniTask<BaseEventData> OnUpdateSelectedAsync()\n        {\n            return ((IAsyncOnUpdateSelectedHandler)new AsyncTriggerHandler<BaseEventData>(this, true)).OnUpdateSelectedAsync();\n        }\n\n        public UniTask<BaseEventData> OnUpdateSelectedAsync(CancellationToken cancellationToken)\n        {\n            return ((IAsyncOnUpdateSelectedHandler)new AsyncTriggerHandler<BaseEventData>(this, cancellationToken, true)).OnUpdateSelectedAsync();\n        }\n    }\n#endif\n#endregion\n\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/MonoBehaviourMessagesTriggers.cs.meta",
    "content": "fileFormatVersion: 2\nguid: c30655636c35c3d4da44064af3d2d9a7\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/MonoBehaviourMessagesTriggers.tt",
    "content": "﻿<#@ template debug=\"false\" hostspecific=\"false\" language=\"C#\" #>\n<#@ assembly name=\"System.Core\" #>\n<#@ import namespace=\"System.Linq\" #>\n<#@ import namespace=\"System.Text\" #>\n<#@ import namespace=\"System.Collections.Generic\" #>\n<#@ output extension=\".cs\" #>\n<#\n    var empty = new (string, string)[0];\n\n    var triggers = new (string triggerName, string methodName, string returnType, string handlerInterface, (string argType, string argName)[] arguments)[]\n    {\n        (\"AnimatorIK\", \"OnAnimatorIK\", \"int\", null, new []{ (\"int\", \"layerIndex\") }),\n        (\"AnimatorMove\", \"OnAnimatorMove\", \"AsyncUnit\", null, empty),\n        (\"OnCanvasGroupChanged\", \"OnCanvasGroupChanged\", \"AsyncUnit\", null, empty ),\n        (\"CollisionEnter2D\", \"OnCollisionEnter2D\", \"Collision2D\", null, new []{ (\"Collision2D\", \"coll\") }),\n        (\"CollisionExit2D\", \"OnCollisionExit2D\", \"Collision2D\", null, new []{ (\"Collision2D\", \"coll\") }),\n        (\"CollisionStay2D\", \"OnCollisionStay2D\", \"Collision2D\", null, new []{ (\"Collision2D\", \"coll\") }),\n        (\"CollisionEnter\", \"OnCollisionEnter\", \"Collision\", null, new []{ (\"Collision\", \"coll\") }),\n        (\"CollisionExit\", \"OnCollisionExit\", \"Collision\", null, new []{ (\"Collision\", \"coll\") }),\n        (\"CollisionStay\", \"OnCollisionStay\", \"Collision\", null, new []{ (\"Collision\", \"coll\") }),\n        (\"Enable\", \"OnEnable\", \"AsyncUnit\", null, empty),\n        (\"Disable\", \"OnDisable\", \"AsyncUnit\", null, empty),\n        (\"JointBreak\", \"OnJointBreak\", \"float\", null, new []{ (\"float\", \"breakForce\") }),\n        (\"JointBreak2D\", \"OnJointBreak2D\", \"Joint2D\", null, new []{ (\"Joint2D\", \"brokenJoint\") }),\n        (\"Update\", \"Update\", \"AsyncUnit\", null, empty),\n        (\"FixedUpdate\", \"FixedUpdate\", \"AsyncUnit\", null, empty),\n        (\"LateUpdate\", \"LateUpdate\", \"AsyncUnit\", null, empty),\n        \n        (\"ParticleCollision\", \"OnParticleCollision\", \"GameObject\", null, new []{ (\"GameObject\", \"other\") }),\n        (\"RectTransformDimensionsChange\", \"OnRectTransformDimensionsChange\", \"AsyncUnit\", null, empty),\n        (\"RectTransformRemoved\", \"OnRectTransformRemoved\", \"AsyncUnit\", null, empty),\n        (\"BeforeTransformParentChanged\", \"OnBeforeTransformParentChanged\", \"AsyncUnit\", null, empty),\n        (\"TransformParentChanged\", \"OnTransformParentChanged\", \"AsyncUnit\", null, empty),\n        (\"TransformChildrenChanged\", \"OnTransformChildrenChanged\", \"AsyncUnit\", null, empty),\n        (\"TriggerEnter2D\", \"OnTriggerEnter2D\", \"Collider2D\", null, new []{ (\"Collider2D\", \"other\") }),\n        (\"TriggerExit2D\", \"OnTriggerExit2D\", \"Collider2D\", null, new []{ (\"Collider2D\", \"other\") }),\n        (\"TriggerStay2D\", \"OnTriggerStay2D\", \"Collider2D\", null, new []{ (\"Collider2D\", \"other\") }),\n        (\"TriggerEnter\", \"OnTriggerEnter\", \"Collider\", null, new []{ (\"Collider\", \"other\") }),\n        (\"TriggerExit\", \"OnTriggerExit\", \"Collider\", null, new []{ (\"Collider\", \"other\") }),\n        (\"TriggerStay\", \"OnTriggerStay\", \"Collider\", null, new []{ (\"Collider\", \"other\") }),\n        (\"BecameInvisible\", \"OnBecameInvisible\", \"AsyncUnit\", null, empty),\n        (\"BecameVisible\", \"OnBecameVisible\", \"AsyncUnit\", null, empty),\n        \n        // Mouse... #if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO)\n        (\"MouseDown\", \"OnMouseDown\", \"AsyncUnit\", null, empty),\n        (\"MouseDrag\", \"OnMouseDrag\", \"AsyncUnit\", null, empty),\n        (\"MouseEnter\", \"OnMouseEnter\", \"AsyncUnit\", null, empty),\n        (\"MouseExit\", \"OnMouseExit\", \"AsyncUnit\", null, empty),\n        (\"MouseOver\", \"OnMouseOver\", \"AsyncUnit\", null, empty),\n        (\"MouseUp\", \"OnMouseUp\", \"AsyncUnit\", null, empty),\n        (\"MouseUpAsButton\", \"OnMouseUpAsButton\", \"AsyncUnit\", null, empty),\n\n        // new in v2\n        (\"ApplicationFocus\", \"OnApplicationFocus\", \"bool\", null, new []{(\"bool\", \"hasFocus\") }),\n        (\"ApplicationPause\", \"OnApplicationPause\", \"bool\", null, new []{(\"bool\", \"pauseStatus\") }),\n        (\"ApplicationQuit\", \"OnApplicationQuit\", \"AsyncUnit\", null, empty),\n        (\"AudioFilterRead\", \"OnAudioFilterRead\", \"(float[] data, int channels)\", null, new[]{(\"float[]\", \"data\"), (\"int\", \"channels\")}),\n        (\"ControllerColliderHit\", \"OnControllerColliderHit\", \"ControllerColliderHit\", null, new[]{(\"ControllerColliderHit\", \"hit\")}),\n        (\"DrawGizmos\", \"OnDrawGizmos\", \"AsyncUnit\", null, empty),\n        (\"DrawGizmosSelected\", \"OnDrawGizmosSelected\", \"AsyncUnit\", null, empty),\n        (\"GUI\", \"OnGUI\", \"AsyncUnit\", null, empty),\n        (\"ParticleSystemStopped\", \"OnParticleSystemStopped\", \"AsyncUnit\", null, empty),\n        (\"ParticleTrigger\", \"OnParticleTrigger\", \"AsyncUnit\", null, empty),\n        (\"PostRender\", \"OnPostRender\", \"AsyncUnit\", null, empty),\n        (\"PreCull\", \"OnPreCull\", \"AsyncUnit\", null, empty),\n        (\"PreRender\", \"OnPreRender\", \"AsyncUnit\", null, empty),\n        (\"RenderImage\", \"OnRenderImage\", \"(RenderTexture source, RenderTexture destination)\", null, new[]{(\"RenderTexture\", \"source\"), (\"RenderTexture\", \"destination\")}),\n        (\"RenderObject\", \"OnRenderObject\", \"AsyncUnit\", null, empty),\n        (\"ServerInitialized\", \"OnServerInitialized\", \"AsyncUnit\", null, empty),\n        (\"Validate\", \"OnValidate\", \"AsyncUnit\", null, empty),\n        (\"WillRenderObject\", \"OnWillRenderObject\", \"AsyncUnit\", null, empty),\n        (\"Reset\", \"Reset\", \"AsyncUnit\", null, empty),\n\n        // uGUI\n        (\"BeginDrag\", \"OnBeginDrag\", \"PointerEventData\", \"IBeginDragHandler\", new []{ (\"PointerEventData\", \"eventData\") }),\n        (\"Cancel\", \"OnCancel\", \"BaseEventData\", \"ICancelHandler\", new []{ (\"BaseEventData\", \"eventData\") }),\n        (\"Deselect\", \"OnDeselect\", \"BaseEventData\", \"IDeselectHandler\", new []{ (\"BaseEventData\", \"eventData\") }),\n        (\"Drag\", \"OnDrag\", \"PointerEventData\", \"IDragHandler\", new []{ (\"PointerEventData\", \"eventData\") }),\n        (\"Drop\", \"OnDrop\", \"PointerEventData\", \"IDropHandler\", new []{ (\"PointerEventData\", \"eventData\") }),\n        (\"EndDrag\", \"OnEndDrag\", \"PointerEventData\", \"IEndDragHandler\", new []{ (\"PointerEventData\", \"eventData\") }),\n        (\"InitializePotentialDrag\", \"OnInitializePotentialDrag\", \"PointerEventData\", \"IInitializePotentialDragHandler\", new []{ (\"PointerEventData\", \"eventData\") }),\n        (\"Move\", \"OnMove\", \"AxisEventData\", \"IMoveHandler\", new []{ (\"AxisEventData\", \"eventData\") }),\n        (\"PointerClick\", \"OnPointerClick\", \"PointerEventData\", \"IPointerClickHandler\", new []{ (\"PointerEventData\", \"eventData\") }),\n        (\"PointerDown\", \"OnPointerDown\", \"PointerEventData\", \"IPointerDownHandler\", new []{ (\"PointerEventData\", \"eventData\") }),\n        (\"PointerEnter\", \"OnPointerEnter\", \"PointerEventData\", \"IPointerEnterHandler\", new []{ (\"PointerEventData\", \"eventData\") }),\n        (\"PointerExit\", \"OnPointerExit\", \"PointerEventData\", \"IPointerExitHandler\", new []{ (\"PointerEventData\", \"eventData\") }),\n        (\"PointerUp\", \"OnPointerUp\", \"PointerEventData\", \"IPointerUpHandler\", new []{ (\"PointerEventData\", \"eventData\") }),\n        (\"Scroll\", \"OnScroll\", \"PointerEventData\", \"IScrollHandler\", new []{ (\"PointerEventData\", \"eventData\") }),\n        (\"Select\", \"OnSelect\", \"BaseEventData\", \"ISelectHandler\", new []{ (\"BaseEventData\", \"eventData\") }),\n        (\"Submit\", \"OnSubmit\", \"BaseEventData\", \"ISubmitHandler\", new []{ (\"BaseEventData\", \"eventData\") }),\n        (\"UpdateSelected\", \"OnUpdateSelected\", \"BaseEventData\", \"IUpdateSelectedHandler\", new []{ (\"BaseEventData\", \"eventData\") }),\n\n        // 2019.3\n        (\"ParticleUpdateJobScheduled\", \"OnParticleUpdateJobScheduled\", \"UnityEngine.ParticleSystemJobs.ParticleSystemJobData\", null, new[]{(\"UnityEngine.ParticleSystemJobs.ParticleSystemJobData\", \"particles\")}),\n\n        // Oneshot\n        // Awake, Start, Destroy\n    };\n\n    triggers = triggers.OrderBy(x => x.handlerInterface != null).ThenBy(x => x.handlerInterface != null ? x.handlerInterface : x.methodName).ToArray();\n\n    Func<string, string> ToInterfaceName = x => $\"IAsync{x}Handler\";\n    Func<string, string> ToUniTaskName = x => x == \"AsyncUnit\" ? \"UniTask\" : $\"UniTask<{x}>\";\n    Func<string, string> ToCastUniTasSourceType = x => x == \"AsyncUnit\" ? \"IUniTaskSource\" : $\"IUniTaskSource<{x}>\";\n    Func<string, string> OnInvokeSuffix = x => x == \"AsyncUnit\" ? \".AsUniTask()\" : $\"\";\n    Func<(string argType, string argName)[], string> BuildMethodArgument = x => string.Join(\", \", x.Select(y => y.argType + \" \" + y.argName));\n    Func<(string argType, string argName)[], string> BuildResultParameter = x => x.Length == 0 ? \"AsyncUnit.Default\" : \"(\" + string.Join(\", \", x.Select(y => y.argName)) + \")\";\n\n    Func<string, bool> IsParticleSystem = x => x == \"ParticleUpdateJobScheduled\";\n    Func<string, bool> IsMouseTrigger = x => x.StartsWith(\"Mouse\");\n    Func<string, string> RequirePhysicsModule = x => (x.StartsWith(\"Collision\") || x.StartsWith(\"Collider\") || x.StartsWith(\"ControllerCollider\") || x.StartsWith(\"Joint\") || x.StartsWith(\"Trigger\"))\n        ? (x.Contains(\"2D\") ? \"UNITASK_PHYSICS2D_SUPPORT\" : \"UNITASK_PHYSICS_SUPPORT\") \n        : null;\n    Func<string, bool> IsUguiSystem = x => x != null;\n#>\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System.Threading;\nusing UnityEngine;\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\nusing UnityEngine.EventSystems;\n#endif\n\nnamespace Cysharp.Threading.Tasks.Triggers\n{\n<# foreach(var t in triggers) { #>\n#region <#= t.triggerName #>\n<# if(IsUguiSystem(t.handlerInterface)) { #>\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n<# } #>\n<# if(IsParticleSystem(t.triggerName)) { #>\n#if UNITY_2019_3_OR_NEWER && (!UNITY_2019_1_OR_NEWER || UNITASK_PARTICLESYSTEM_SUPPORT)\n<# } #>\n<# if(IsMouseTrigger(t.triggerName)) { #>\n#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO)\n<# } #>\n<# if(RequirePhysicsModule(t.triggerName) != null) { #>\n#if !UNITY_2019_1_OR_NEWER || <#= RequirePhysicsModule(t.triggerName) #>\n<# } #>\n\n    public interface <#= ToInterfaceName(t.methodName) #>\n    {\n        <#= ToUniTaskName(t.returnType) #> <#= t.methodName #>Async();\n    }\n\n    public partial class AsyncTriggerHandler<T> : <#= ToInterfaceName(t.methodName) #>\n    {\n        <#= ToUniTaskName(t.returnType) #> <#= ToInterfaceName(t.methodName) #>.<#= t.methodName #>Async()\n        {\n            core.Reset();\n            return new <#= ToUniTaskName(t.returnType) #>((<#= ToCastUniTasSourceType(t.returnType) #>)(object)this, core.Version);\n        }\n    }\n\n    public static partial class AsyncTriggerExtensions\n    {\n        public static Async<#= t.triggerName #>Trigger GetAsync<#= t.triggerName #>Trigger(this GameObject gameObject)\n        {\n            return GetOrAddComponent<Async<#= t.triggerName #>Trigger>(gameObject);\n        }\n        \n        public static Async<#= t.triggerName #>Trigger GetAsync<#= t.triggerName #>Trigger(this Component component)\n        {\n            return component.gameObject.GetAsync<#= t.triggerName #>Trigger();\n        }\n    }\n\n    [DisallowMultipleComponent]\n    public sealed class Async<#= t.triggerName #>Trigger : AsyncTriggerBase<<#= t.returnType #>><#= (t.handlerInterface == null) ? \"\" : $\", {t.handlerInterface}\" #>\n    {\n        void <#= (t.handlerInterface == null) ? \"\" : $\"{t.handlerInterface}.\" #><#= t.methodName #>(<#= BuildMethodArgument(t.arguments) #>)\n        {\n            RaiseEvent(<#= BuildResultParameter(t.arguments) #>);\n        }\n\n        public <#= ToInterfaceName(t.methodName) #> Get<#= t.methodName #>AsyncHandler()\n        {\n            return new AsyncTriggerHandler<<#= t.returnType #>>(this, false);\n        }\n\n        public <#= ToInterfaceName(t.methodName) #> Get<#= t.methodName #>AsyncHandler(CancellationToken cancellationToken)\n        {\n            return new AsyncTriggerHandler<<#= t.returnType #>>(this, cancellationToken, false);\n        }\n\n        public <#= ToUniTaskName(t.returnType) #> <#= t.methodName #>Async()\n        {\n            return ((<#= ToInterfaceName(t.methodName) #>)new AsyncTriggerHandler<<#= t.returnType #>>(this, true)).<#= t.methodName #>Async();\n        }\n\n        public <#= ToUniTaskName(t.returnType) #> <#= t.methodName #>Async(CancellationToken cancellationToken)\n        {\n            return ((<#= ToInterfaceName(t.methodName) #>)new AsyncTriggerHandler<<#= t.returnType #>>(this, cancellationToken, true)).<#= t.methodName #>Async();\n        }\n    }\n<# if(IsUguiSystem(t.handlerInterface)) { #>\n#endif\n<# } #>\n<# if(RequirePhysicsModule(t.triggerName) != null) { #>\n#endif\n<# } #>\n<# if(IsParticleSystem(t.triggerName) || IsMouseTrigger(t.triggerName)) { #>\n#endif\n<# } #>\n#endregion\n\n<# } #>\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers/MonoBehaviourMessagesTriggers.tt.meta",
    "content": "fileFormatVersion: 2\nguid: 3ca26d0cd9373354c8cd147490f32c8e\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/Triggers.meta",
    "content": "fileFormatVersion: 2\nguid: 85c0c768ced512e42b24021b3258b669\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.AsValueTask.cs",
    "content": "﻿#pragma warning disable 0649\n\n#if UNITASK_NETCORE || UNITY_2022_3_OR_NEWER\n#define SUPPORT_VALUETASK\n#endif\n\n#if SUPPORT_VALUETASK\n\nusing System;\nusing System.Threading.Tasks;\nusing System.Threading.Tasks.Sources;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static class UniTaskValueTaskExtensions\n    {\n        public static ValueTask AsValueTask(this in UniTask task)\n        {\n#if (UNITASK_NETCORE && NETSTANDARD2_0)\n            return new ValueTask(new UniTaskValueTaskSource(task), 0);\n#else\n            return task;\n#endif\n        }\n\n        public static ValueTask<T> AsValueTask<T>(this in UniTask<T> task)\n        {\n#if (UNITASK_NETCORE && NETSTANDARD2_0)\n            return new ValueTask<T>(new UniTaskValueTaskSource<T>(task), 0);\n#else\n            return task;\n#endif\n        }\n\n        public static async UniTask<T> AsUniTask<T>(this ValueTask<T> task)\n        {\n            return await task;\n        }\n\n        public static async UniTask AsUniTask(this ValueTask task)\n        {\n            await task;\n        }\n\n#if (UNITASK_NETCORE && NETSTANDARD2_0)\n\n        class UniTaskValueTaskSource : IValueTaskSource\n        {\n            readonly UniTask task;\n            readonly UniTask.Awaiter awaiter;\n\n            public UniTaskValueTaskSource(UniTask task)\n            {\n                this.task = task;\n                this.awaiter = task.GetAwaiter();\n            }\n\n            public void GetResult(short token)\n            {\n                awaiter.GetResult();\n            }\n\n            public ValueTaskSourceStatus GetStatus(short token)\n            {\n                return (ValueTaskSourceStatus)task.Status;\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token, ValueTaskSourceOnCompletedFlags flags)\n            {\n                awaiter.SourceOnCompleted(continuation, state);\n            }\n        }\n\n        class UniTaskValueTaskSource<T> : IValueTaskSource<T>\n        {\n            readonly UniTask<T> task;\n            readonly UniTask<T>.Awaiter awaiter;\n\n            public UniTaskValueTaskSource(UniTask<T> task)\n            {\n                this.task = task;\n                this.awaiter = task.GetAwaiter();\n            }\n\n            public T GetResult(short token)\n            {\n                return awaiter.GetResult();\n            }\n\n            public ValueTaskSourceStatus GetStatus(short token)\n            {\n                return (ValueTaskSourceStatus)task.Status;\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token, ValueTaskSourceOnCompletedFlags flags)\n            {\n                awaiter.SourceOnCompleted(continuation, state);\n            }\n        }\n\n#endif\n    }\n}\n#endif\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.AsValueTask.cs.meta",
    "content": "fileFormatVersion: 2\nguid: d38f0478933be42d895c37b862540a1c\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.Bridge.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Collections;\n\nnamespace Cysharp.Threading.Tasks\n{\n    // UnityEngine Bridges.\n\n    public partial struct UniTask\n    {\n        public static IEnumerator ToCoroutine(Func<UniTask> taskFactory)\n        {\n            return taskFactory().ToCoroutine();\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.Bridge.cs.meta",
    "content": "fileFormatVersion: 2\nguid: bd6beac8e0ebd264e9ba246c39429c72\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.Delay.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\nusing UnityEngine;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public enum DelayType\n    {\n        /// <summary>use Time.deltaTime.</summary>\n        DeltaTime,\n        /// <summary>Ignore timescale, use Time.unscaledDeltaTime.</summary>\n        UnscaledDeltaTime,\n        /// <summary>use Stopwatch.GetTimestamp().</summary>\n        Realtime\n    }\n\n    public partial struct UniTask\n    {\n        public static YieldAwaitable Yield()\n        {\n            // optimized for single continuation\n            return new YieldAwaitable(PlayerLoopTiming.Update);\n        }\n\n        public static YieldAwaitable Yield(PlayerLoopTiming timing)\n        {\n            // optimized for single continuation\n            return new YieldAwaitable(timing);\n        }\n\n        public static UniTask Yield(CancellationToken cancellationToken, bool cancelImmediately = false)\n        {\n            return new UniTask(YieldPromise.Create(PlayerLoopTiming.Update, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n        public static UniTask Yield(PlayerLoopTiming timing, CancellationToken cancellationToken, bool cancelImmediately = false)\n        {\n            return new UniTask(YieldPromise.Create(timing, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n        /// <summary>\n        /// Similar as UniTask.Yield but guaranteed run on next frame.\n        /// </summary>\n        public static UniTask NextFrame()\n        {\n            return new UniTask(NextFramePromise.Create(PlayerLoopTiming.Update, CancellationToken.None, false, out var token), token);\n        }\n\n        /// <summary>\n        /// Similar as UniTask.Yield but guaranteed run on next frame.\n        /// </summary>\n        public static UniTask NextFrame(PlayerLoopTiming timing)\n        {\n            return new UniTask(NextFramePromise.Create(timing, CancellationToken.None, false, out var token), token);\n        }\n\n        /// <summary>\n        /// Similar as UniTask.Yield but guaranteed run on next frame.\n        /// </summary>\n        public static UniTask NextFrame(CancellationToken cancellationToken, bool cancelImmediately = false)\n        {\n            return new UniTask(NextFramePromise.Create(PlayerLoopTiming.Update, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n        /// <summary>\n        /// Similar as UniTask.Yield but guaranteed run on next frame.\n        /// </summary>\n        public static UniTask NextFrame(PlayerLoopTiming timing, CancellationToken cancellationToken, bool cancelImmediately = false)\n        {\n            return new UniTask(NextFramePromise.Create(timing, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n#if UNITY_2023_1_OR_NEWER\n        public static async UniTask WaitForEndOfFrame(CancellationToken cancellationToken = default)\n        {\n            await Awaitable.EndOfFrameAsync(cancellationToken);\n        }\n#else        \n        [Obsolete(\"Use WaitForEndOfFrame(MonoBehaviour) instead or UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate). Equivalent for coroutine's WaitForEndOfFrame requires MonoBehaviour(runner of Coroutine).\")]\n        public static YieldAwaitable WaitForEndOfFrame()\n        {\n            return UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate);\n        }\n\n        [Obsolete(\"Use WaitForEndOfFrame(MonoBehaviour) instead or UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate). Equivalent for coroutine's WaitForEndOfFrame requires MonoBehaviour(runner of Coroutine).\")]\n        public static UniTask WaitForEndOfFrame(CancellationToken cancellationToken, bool cancelImmediately = false)\n        {\n            return UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate, cancellationToken, cancelImmediately);\n        }\n#endif        \n\n        public static UniTask WaitForEndOfFrame(MonoBehaviour coroutineRunner)\n        {\n            var source = WaitForEndOfFramePromise.Create(coroutineRunner, CancellationToken.None, false, out var token);\n            return new UniTask(source, token);\n        }\n\n        public static UniTask WaitForEndOfFrame(MonoBehaviour coroutineRunner, CancellationToken cancellationToken, bool cancelImmediately = false)\n        {\n            var source = WaitForEndOfFramePromise.Create(coroutineRunner, cancellationToken, cancelImmediately, out var token);\n            return new UniTask(source, token);\n        }\n\n        /// <summary>\n        /// Same as UniTask.Yield(PlayerLoopTiming.LastFixedUpdate).\n        /// </summary>\n        public static YieldAwaitable WaitForFixedUpdate()\n        {\n            // use LastFixedUpdate instead of FixedUpdate\n            // https://github.com/Cysharp/UniTask/issues/377\n            return UniTask.Yield(PlayerLoopTiming.LastFixedUpdate);\n        }\n\n        /// <summary>\n        /// Same as UniTask.Yield(PlayerLoopTiming.LastFixedUpdate, cancellationToken).\n        /// </summary>\n        public static UniTask WaitForFixedUpdate(CancellationToken cancellationToken, bool cancelImmediately = false)\n        {\n            return UniTask.Yield(PlayerLoopTiming.LastFixedUpdate, cancellationToken, cancelImmediately);\n        }\n\n\t\tpublic static UniTask WaitForSeconds(float duration, bool ignoreTimeScale = false, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n\t\t{\n\t\t\treturn Delay(Mathf.RoundToInt(1000 * duration), ignoreTimeScale, delayTiming, cancellationToken, cancelImmediately);\n\t\t}\n\n\t\tpublic static UniTask WaitForSeconds(int duration, bool ignoreTimeScale = false, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n\t\t{\n\t\t\treturn Delay(1000 * duration, ignoreTimeScale, delayTiming, cancellationToken, cancelImmediately);\n\t\t}\n\n\t\tpublic static UniTask DelayFrame(int delayFrameCount, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            if (delayFrameCount < 0)\n            {\n                throw new ArgumentOutOfRangeException(\"Delay does not allow minus delayFrameCount. delayFrameCount:\" + delayFrameCount);\n            }\n\n            return new UniTask(DelayFramePromise.Create(delayFrameCount, delayTiming, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n        public static UniTask Delay(int millisecondsDelay, bool ignoreTimeScale = false, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            var delayTimeSpan = TimeSpan.FromMilliseconds(millisecondsDelay);\n            return Delay(delayTimeSpan, ignoreTimeScale, delayTiming, cancellationToken, cancelImmediately);\n        }\n\n        public static UniTask Delay(TimeSpan delayTimeSpan, bool ignoreTimeScale = false, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            var delayType = ignoreTimeScale ? DelayType.UnscaledDeltaTime : DelayType.DeltaTime;\n            return Delay(delayTimeSpan, delayType, delayTiming, cancellationToken, cancelImmediately);\n        }\n\n        public static UniTask Delay(int millisecondsDelay, DelayType delayType, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            var delayTimeSpan = TimeSpan.FromMilliseconds(millisecondsDelay);\n            return Delay(delayTimeSpan, delayType, delayTiming, cancellationToken, cancelImmediately);\n        }\n\n        public static UniTask Delay(TimeSpan delayTimeSpan, DelayType delayType, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            if (delayTimeSpan < TimeSpan.Zero)\n            {\n                throw new ArgumentOutOfRangeException(\"Delay does not allow minus delayTimeSpan. delayTimeSpan:\" + delayTimeSpan);\n            }\n\n#if UNITY_EDITOR\n            // force use Realtime.\n            if (PlayerLoopHelper.IsMainThread && !UnityEditor.EditorApplication.isPlaying)\n            {\n                delayType = DelayType.Realtime;\n            }\n#endif\n\n            switch (delayType)\n            {\n                case DelayType.UnscaledDeltaTime:\n                    {\n                        return new UniTask(DelayIgnoreTimeScalePromise.Create(delayTimeSpan, delayTiming, cancellationToken, cancelImmediately, out var token), token);\n                    }\n                case DelayType.Realtime:\n                    {\n                        return new UniTask(DelayRealtimePromise.Create(delayTimeSpan, delayTiming, cancellationToken, cancelImmediately, out var token), token);\n                    }\n                case DelayType.DeltaTime:\n                default:\n                    {\n                        return new UniTask(DelayPromise.Create(delayTimeSpan, delayTiming, cancellationToken, cancelImmediately, out var token), token);\n                    }\n            }\n        }\n\n        sealed class YieldPromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<YieldPromise>\n        {\n            static TaskPool<YieldPromise> pool;\n            YieldPromise nextNode;\n            public ref YieldPromise NextNode => ref nextNode;\n\n            static YieldPromise()\n            {\n                TaskPool.RegisterSizeGetter(typeof(YieldPromise), () => pool.Size);\n            }\n\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n            UniTaskCompletionSourceCore<object> core;\n\n            YieldPromise()\n            {\n            }\n\n            public static IUniTaskSource Create(PlayerLoopTiming timing, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new YieldPromise();\n                }\n\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n                \n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var promise = (YieldPromise)state;\n                        promise.core.TrySetCanceled(promise.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public void GetResult(short token)\n            {\n                try\n                {\n                    core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                core.TrySetResult(null);\n                return false;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n        }\n\n        sealed class NextFramePromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<NextFramePromise>\n        {\n            static TaskPool<NextFramePromise> pool;\n            NextFramePromise nextNode;\n            public ref NextFramePromise NextNode => ref nextNode;\n\n            static NextFramePromise()\n            {\n                TaskPool.RegisterSizeGetter(typeof(NextFramePromise), () => pool.Size);\n            }\n\n            int frameCount;\n            UniTaskCompletionSourceCore<AsyncUnit> core;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n\n            NextFramePromise()\n            {\n            }\n\n            public static IUniTaskSource Create(PlayerLoopTiming timing, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new NextFramePromise();\n                }\n\n                result.frameCount = PlayerLoopHelper.IsMainThread ? Time.frameCount : -1;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var promise = (NextFramePromise)state;\n                        promise.core.TrySetCanceled(promise.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public void GetResult(short token)\n            {\n                try\n                {\n                    core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (frameCount == Time.frameCount)\n                {\n                    return true;\n                }\n\n                core.TrySetResult(AsyncUnit.Default);\n                return false;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                return pool.TryPush(this);\n            }\n        }\n\n        sealed class WaitForEndOfFramePromise : IUniTaskSource, ITaskPoolNode<WaitForEndOfFramePromise>, System.Collections.IEnumerator\n        {\n            static TaskPool<WaitForEndOfFramePromise> pool;\n            WaitForEndOfFramePromise nextNode;\n            public ref WaitForEndOfFramePromise NextNode => ref nextNode;\n\n            static WaitForEndOfFramePromise()\n            {\n                TaskPool.RegisterSizeGetter(typeof(WaitForEndOfFramePromise), () => pool.Size);\n            }\n\n            UniTaskCompletionSourceCore<object> core;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n\n            WaitForEndOfFramePromise()\n            {\n            }\n\n            public static IUniTaskSource Create(MonoBehaviour coroutineRunner, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new WaitForEndOfFramePromise();\n                }\n\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var promise = (WaitForEndOfFramePromise)state;\n                        promise.core.TrySetCanceled(promise.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                coroutineRunner.StartCoroutine(result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public void GetResult(short token)\n            {\n                try\n                {\n                    core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                Reset(); // Reset Enumerator\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                return pool.TryPush(this);\n            }\n\n            // Coroutine Runner implementation\n\n            static readonly WaitForEndOfFrame waitForEndOfFrameYieldInstruction = new WaitForEndOfFrame();\n            bool isFirst = true;\n\n            object IEnumerator.Current => waitForEndOfFrameYieldInstruction;\n\n            bool IEnumerator.MoveNext()\n            {\n                if (isFirst)\n                {\n                    isFirst = false;\n                    return true; // start WaitForEndOfFrame\n                }\n\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                core.TrySetResult(null);\n                return false;\n            }\n\n            public void Reset()\n            {\n                isFirst = true;\n            }\n        }\n\n        sealed class DelayFramePromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<DelayFramePromise>\n        {\n            static TaskPool<DelayFramePromise> pool;\n            DelayFramePromise nextNode;\n            public ref DelayFramePromise NextNode => ref nextNode;\n\n            static DelayFramePromise()\n            {\n                TaskPool.RegisterSizeGetter(typeof(DelayFramePromise), () => pool.Size);\n            }\n\n            int initialFrame;\n            int delayFrameCount;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n\n            int currentFrameCount;\n            UniTaskCompletionSourceCore<AsyncUnit> core;\n\n            DelayFramePromise()\n            {\n            }\n\n            public static IUniTaskSource Create(int delayFrameCount, PlayerLoopTiming timing, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new DelayFramePromise();\n                }\n\n                result.delayFrameCount = delayFrameCount;\n                result.cancellationToken = cancellationToken;\n                result.initialFrame = PlayerLoopHelper.IsMainThread ? Time.frameCount : -1;\n                result.cancelImmediately = cancelImmediately;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var promise = (DelayFramePromise)state;\n                        promise.core.TrySetCanceled(promise.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public void GetResult(short token)\n            {\n                try\n                {\n                    core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (currentFrameCount == 0)\n                {\n                    if (delayFrameCount == 0) // same as Yield\n                    {\n                        core.TrySetResult(AsyncUnit.Default);\n                        return false;\n                    }\n\n                    // skip in initial frame.\n                    if (initialFrame == Time.frameCount)\n                    {\n#if UNITY_EDITOR\n                        // force use Realtime.\n                        if (PlayerLoopHelper.IsMainThread && !UnityEditor.EditorApplication.isPlaying)\n                        {\n                            //goto ++currentFrameCount\n                        }\n                        else\n                        {\n                            return true;\n                        }\n#else\n                        return true;\n#endif\n                    }\n                }\n\n                if (++currentFrameCount >= delayFrameCount)\n                {\n                    core.TrySetResult(AsyncUnit.Default);\n                    return false;\n                }\n\n                return true;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                currentFrameCount = default;\n                delayFrameCount = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n        }\n\n        sealed class DelayPromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<DelayPromise>\n        {\n            static TaskPool<DelayPromise> pool;\n            DelayPromise nextNode;\n            public ref DelayPromise NextNode => ref nextNode;\n\n            static DelayPromise()\n            {\n                TaskPool.RegisterSizeGetter(typeof(DelayPromise), () => pool.Size);\n            }\n\n            int initialFrame;\n            float delayTimeSpan;\n            float elapsed;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n\n            UniTaskCompletionSourceCore<object> core;\n\n            DelayPromise()\n            {\n            }\n\n            public static IUniTaskSource Create(TimeSpan delayTimeSpan, PlayerLoopTiming timing, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new DelayPromise();\n                }\n\n                result.elapsed = 0.0f;\n                result.delayTimeSpan = (float)delayTimeSpan.TotalSeconds;\n                result.cancellationToken = cancellationToken;\n                result.initialFrame = PlayerLoopHelper.IsMainThread ? Time.frameCount : -1;\n                result.cancelImmediately = cancelImmediately;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var promise = (DelayPromise)state;\n                        promise.core.TrySetCanceled(promise.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public void GetResult(short token)\n            {\n                try\n                {\n                    core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (elapsed == 0.0f)\n                {\n                    if (initialFrame == Time.frameCount)\n                    {\n                        return true;\n                    }\n                }\n\n                elapsed += Time.deltaTime;\n                if (elapsed >= delayTimeSpan)\n                {\n                    core.TrySetResult(null);\n                    return false;\n                }\n\n                return true;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                delayTimeSpan = default;\n                elapsed = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n        }\n\n        sealed class DelayIgnoreTimeScalePromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<DelayIgnoreTimeScalePromise>\n        {\n            static TaskPool<DelayIgnoreTimeScalePromise> pool;\n            DelayIgnoreTimeScalePromise nextNode;\n            public ref DelayIgnoreTimeScalePromise NextNode => ref nextNode;\n\n            static DelayIgnoreTimeScalePromise()\n            {\n                TaskPool.RegisterSizeGetter(typeof(DelayIgnoreTimeScalePromise), () => pool.Size);\n            }\n\n            float delayFrameTimeSpan;\n            float elapsed;\n            int initialFrame;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n\n            UniTaskCompletionSourceCore<object> core;\n\n            DelayIgnoreTimeScalePromise()\n            {\n            }\n\n            public static IUniTaskSource Create(TimeSpan delayFrameTimeSpan, PlayerLoopTiming timing, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new DelayIgnoreTimeScalePromise();\n                }\n\n                result.elapsed = 0.0f;\n                result.delayFrameTimeSpan = (float)delayFrameTimeSpan.TotalSeconds;\n                result.initialFrame = PlayerLoopHelper.IsMainThread ? Time.frameCount : -1;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var promise = (DelayIgnoreTimeScalePromise)state;\n                        promise.core.TrySetCanceled(promise.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public void GetResult(short token)\n            {\n                try\n                {\n                    core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (elapsed == 0.0f)\n                {\n                    if (initialFrame == Time.frameCount)\n                    {\n                        return true;\n                    }\n                }\n\n                elapsed += Time.unscaledDeltaTime;\n                if (elapsed >= delayFrameTimeSpan)\n                {\n                    core.TrySetResult(null);\n                    return false;\n                }\n\n                return true;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                delayFrameTimeSpan = default;\n                elapsed = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n        }\n\n        sealed class DelayRealtimePromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<DelayRealtimePromise>\n        {\n            static TaskPool<DelayRealtimePromise> pool;\n            DelayRealtimePromise nextNode;\n            public ref DelayRealtimePromise NextNode => ref nextNode;\n\n            static DelayRealtimePromise()\n            {\n                TaskPool.RegisterSizeGetter(typeof(DelayRealtimePromise), () => pool.Size);\n            }\n\n            long delayTimeSpanTicks;\n            ValueStopwatch stopwatch;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n\n            UniTaskCompletionSourceCore<AsyncUnit> core;\n\n            DelayRealtimePromise()\n            {\n            }\n\n            public static IUniTaskSource Create(TimeSpan delayTimeSpan, PlayerLoopTiming timing, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new DelayRealtimePromise();\n                }\n\n                result.stopwatch = ValueStopwatch.StartNew();\n                result.delayTimeSpanTicks = delayTimeSpan.Ticks;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var promise = (DelayRealtimePromise)state;\n                        promise.core.TrySetCanceled(promise.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public void GetResult(short token)\n            {\n                try\n                {\n                    core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (stopwatch.IsInvalid)\n                {\n                    core.TrySetResult(AsyncUnit.Default);\n                    return false;\n                }\n\n                if (stopwatch.ElapsedTicks >= delayTimeSpanTicks)\n                {\n                    core.TrySetResult(AsyncUnit.Default);\n                    return false;\n                }\n\n                return true;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                stopwatch = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n        }\n    }\n\n    public readonly struct YieldAwaitable\n    {\n        readonly PlayerLoopTiming timing;\n\n        public YieldAwaitable(PlayerLoopTiming timing)\n        {\n            this.timing = timing;\n        }\n\n        public Awaiter GetAwaiter()\n        {\n            return new Awaiter(timing);\n        }\n\n        public UniTask ToUniTask()\n        {\n            return UniTask.Yield(timing, CancellationToken.None);\n        }\n\n        public readonly struct Awaiter : ICriticalNotifyCompletion\n        {\n            readonly PlayerLoopTiming timing;\n\n            public Awaiter(PlayerLoopTiming timing)\n            {\n                this.timing = timing;\n            }\n\n            public bool IsCompleted => false;\n\n            public void GetResult() { }\n\n            public void OnCompleted(Action continuation)\n            {\n                PlayerLoopHelper.AddContinuation(timing, continuation);\n            }\n\n            public void UnsafeOnCompleted(Action continuation)\n            {\n                PlayerLoopHelper.AddContinuation(timing, continuation);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.Delay.cs.meta",
    "content": "fileFormatVersion: 2\nguid: ecff7972251de0848b2c0fa89bbd3489\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.Factory.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.ExceptionServices;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public partial struct UniTask\n    {\n        static readonly UniTask CanceledUniTask = new Func<UniTask>(() =>\n        {\n            return new UniTask(new CanceledResultSource(CancellationToken.None), 0);\n        })();\n\n        static class CanceledUniTaskCache<T>\n        {\n            public static readonly UniTask<T> Task;\n\n            static CanceledUniTaskCache()\n            {\n                Task = new UniTask<T>(new CanceledResultSource<T>(CancellationToken.None), 0);\n            }\n        }\n\n        public static readonly UniTask CompletedTask = new UniTask();\n\n        public static UniTask FromException(Exception ex)\n        {\n            if (ex is OperationCanceledException oce)\n            {\n                return FromCanceled(oce.CancellationToken);\n            }\n\n            return new UniTask(new ExceptionResultSource(ex), 0);\n        }\n\n        public static UniTask<T> FromException<T>(Exception ex)\n        {\n            if (ex is OperationCanceledException oce)\n            {\n                return FromCanceled<T>(oce.CancellationToken);\n            }\n\n            return new UniTask<T>(new ExceptionResultSource<T>(ex), 0);\n        }\n\n        public static UniTask<T> FromResult<T>(T value)\n        {\n            return new UniTask<T>(value);\n        }\n\n        public static UniTask FromCanceled(CancellationToken cancellationToken = default)\n        {\n            if (cancellationToken == CancellationToken.None)\n            {\n                return CanceledUniTask;\n            }\n            else\n            {\n                return new UniTask(new CanceledResultSource(cancellationToken), 0);\n            }\n        }\n\n        public static UniTask<T> FromCanceled<T>(CancellationToken cancellationToken = default)\n        {\n            if (cancellationToken == CancellationToken.None)\n            {\n                return CanceledUniTaskCache<T>.Task;\n            }\n            else\n            {\n                return new UniTask<T>(new CanceledResultSource<T>(cancellationToken), 0);\n            }\n        }\n\n        public static UniTask Create(Func<UniTask> factory)\n        {\n            return factory();\n        }\n\n        public static UniTask Create(Func<CancellationToken, UniTask> factory, CancellationToken cancellationToken)\n        {\n            return factory(cancellationToken);\n        }\n\n        public static UniTask Create<T>(T state, Func<T, UniTask> factory)\n        {\n            return factory(state);\n        }\n\n        public static UniTask<T> Create<T>(Func<UniTask<T>> factory)\n        {\n            return factory();\n        }\n\n        public static AsyncLazy Lazy(Func<UniTask> factory)\n        {\n            return new AsyncLazy(factory);\n        }\n\n        public static AsyncLazy<T> Lazy<T>(Func<UniTask<T>> factory)\n        {\n            return new AsyncLazy<T>(factory);\n        }\n\n        /// <summary>\n        /// helper of fire and forget void action.\n        /// </summary>\n        public static void Void(Func<UniTaskVoid> asyncAction)\n        {\n            asyncAction().Forget();\n        }\n\n        /// <summary>\n        /// helper of fire and forget void action.\n        /// </summary>\n        public static void Void(Func<CancellationToken, UniTaskVoid> asyncAction, CancellationToken cancellationToken)\n        {\n            asyncAction(cancellationToken).Forget();\n        }\n\n        /// <summary>\n        /// helper of fire and forget void action.\n        /// </summary>\n        public static void Void<T>(Func<T, UniTaskVoid> asyncAction, T state)\n        {\n            asyncAction(state).Forget();\n        }\n\n        /// <summary>\n        /// helper of create add UniTaskVoid to delegate.\n        /// For example: FooAction = UniTask.Action(async () => { /* */ })\n        /// </summary>\n        public static Action Action(Func<UniTaskVoid> asyncAction)\n        {\n            return () => asyncAction().Forget();\n        }\n\n        /// <summary>\n        /// helper of create add UniTaskVoid to delegate.\n        /// </summary>\n        public static Action Action(Func<CancellationToken, UniTaskVoid> asyncAction, CancellationToken cancellationToken)\n        {\n            return () => asyncAction(cancellationToken).Forget();\n        }\n\n        /// <summary>\n        /// helper of create add UniTaskVoid to delegate.\n        /// </summary>\n        public static Action Action<T>(T state, Func<T, UniTaskVoid> asyncAction)\n        {\n            return () => asyncAction(state).Forget();\n        }\n\n#if UNITY_2018_3_OR_NEWER\n\n        /// <summary>\n        /// Create async void(UniTaskVoid) UnityAction.\n        /// For example: onClick.AddListener(UniTask.UnityAction(async () => { /* */ } ))\n        /// </summary>\n        public static UnityEngine.Events.UnityAction UnityAction(Func<UniTaskVoid> asyncAction)\n        {\n            return () => asyncAction().Forget();\n        }\n\n        /// <summary>\n        /// Create async void(UniTaskVoid) UnityAction.\n        /// For example: onClick.AddListener(UniTask.UnityAction(FooAsync, this.GetCancellationTokenOnDestroy()))\n        /// </summary>\n        public static UnityEngine.Events.UnityAction UnityAction(Func<CancellationToken, UniTaskVoid> asyncAction, CancellationToken cancellationToken)\n        {\n            return () => asyncAction(cancellationToken).Forget();\n        }\n\n        /// <summary>\n        /// Create async void(UniTaskVoid) UnityAction.\n        /// For example: onClick.AddListener(UniTask.UnityAction(FooAsync, Argument))\n        /// </summary>\n        public static UnityEngine.Events.UnityAction UnityAction<T>(T state, Func<T, UniTaskVoid> asyncAction)\n        {\n            return () => asyncAction(state).Forget();\n        }\n\n        /// <summary>\n        /// Create async void(UniTaskVoid) UnityAction.\n        /// For example: onClick.AddListener(UniTask.UnityAction(async (T arg) => { /* */ } ))\n        /// </summary>\n        public static UnityEngine.Events.UnityAction<T> UnityAction<T>(Func<T, UniTaskVoid> asyncAction)\n        {\n            return (arg) => asyncAction(arg).Forget();\n        }\n\n        /// <summary>\n        /// Create async void(UniTaskVoid) UnityAction.\n        /// For example: onClick.AddListener(UniTask.UnityAction(async (T0 arg0, T1 arg1) => { /* */ } ))\n        /// </summary>\n        public static UnityEngine.Events.UnityAction<T0, T1> UnityAction<T0, T1>(Func<T0, T1, UniTaskVoid> asyncAction)\n        {\n            return (arg0, arg1) => asyncAction(arg0, arg1).Forget();\n        }\n\n        /// <summary>\n        /// Create async void(UniTaskVoid) UnityAction.\n        /// For example: onClick.AddListener(UniTask.UnityAction(async (T0 arg0, T1 arg1, T2 arg2) => { /* */ } ))\n        /// </summary>\n        public static UnityEngine.Events.UnityAction<T0, T1, T2> UnityAction<T0, T1, T2>(Func<T0, T1, T2, UniTaskVoid> asyncAction)\n        {\n            return (arg0, arg1, arg2) => asyncAction(arg0, arg1, arg2).Forget();\n        }\n\n        /// <summary>\n        /// Create async void(UniTaskVoid) UnityAction.\n        /// For example: onClick.AddListener(UniTask.UnityAction(async (T0 arg0, T1 arg1, T2 arg2, T3 arg3) => { /* */ } ))\n        /// </summary>\n        public static UnityEngine.Events.UnityAction<T0, T1, T2, T3> UnityAction<T0, T1, T2, T3>(Func<T0, T1, T2, T3, UniTaskVoid> asyncAction)\n        {\n            return (arg0, arg1, arg2, arg3) => asyncAction(arg0, arg1, arg2, arg3).Forget();\n        }\n\n        // <summary>\n        /// Create async void(UniTaskVoid) UnityAction.\n        /// For example: onClick.AddListener(UniTask.UnityAction(async (T arg, CancellationToken cancellationToken) => { /* */ } ))\n        /// </summary>\n        public static UnityEngine.Events.UnityAction<T> UnityAction<T>(Func<T, CancellationToken, UniTaskVoid> asyncAction, CancellationToken cancellationToken)\n        {\n            return (arg) => asyncAction(arg, cancellationToken).Forget();\n        }\n\n        /// <summary>\n        /// Create async void(UniTaskVoid) UnityAction.\n        /// For example: onClick.AddListener(UniTask.UnityAction(async (T0 arg0, T1 arg1, CancellationToken cancellationToken) => { /* */ } ))\n        /// </summary>\n        public static UnityEngine.Events.UnityAction<T0, T1> UnityAction<T0, T1>(Func<T0, T1, CancellationToken, UniTaskVoid> asyncAction, CancellationToken cancellationToken)\n        {\n            return (arg0, arg1) => asyncAction(arg0, arg1, cancellationToken).Forget();\n        }\n\n        /// <summary>\n        /// Create async void(UniTaskVoid) UnityAction.\n        /// For example: onClick.AddListener(UniTask.UnityAction(async (T0 arg0, T1 arg1, T2 arg2, CancellationToken cancellationToken) => { /* */ } ))\n        /// </summary>\n        public static UnityEngine.Events.UnityAction<T0, T1, T2> UnityAction<T0, T1, T2>(Func<T0, T1, T2, CancellationToken, UniTaskVoid> asyncAction, CancellationToken cancellationToken)\n        {\n            return (arg0, arg1, arg2) => asyncAction(arg0, arg1, arg2, cancellationToken).Forget();\n        }\n\n        /// <summary>\n        /// Create async void(UniTaskVoid) UnityAction.\n        /// For example: onClick.AddListener(UniTask.UnityAction(async (T0 arg0, T1 arg1, T2 arg2, T3 arg3, CancellationToken cancellationToken) => { /* */ } ))\n        /// </summary>\n        public static UnityEngine.Events.UnityAction<T0, T1, T2, T3> UnityAction<T0, T1, T2, T3>(Func<T0, T1, T2, T3, CancellationToken, UniTaskVoid> asyncAction, CancellationToken cancellationToken)\n        {\n            return (arg0, arg1, arg2, arg3) => asyncAction(arg0, arg1, arg2, arg3, cancellationToken).Forget();\n        }\n\n#endif\n\n        /// <summary>\n        /// Defer the task creation just before call await.\n        /// </summary>\n        public static UniTask Defer(Func<UniTask> factory)\n        {\n            return new UniTask(new DeferPromise(factory), 0);\n        }\n\n        /// <summary>\n        /// Defer the task creation just before call await.\n        /// </summary>\n        public static UniTask<T> Defer<T>(Func<UniTask<T>> factory)\n        {\n            return new UniTask<T>(new DeferPromise<T>(factory), 0);\n        }\n\n        /// <summary>\n        /// Defer the task creation just before call await.\n        /// </summary>\n        public static UniTask Defer<TState>(TState state, Func<TState, UniTask> factory)\n        {\n            return new UniTask(new DeferPromiseWithState<TState>(state, factory), 0);\n        }\n\n        /// <summary>\n        /// Defer the task creation just before call await.\n        /// </summary>\n        public static UniTask<TResult> Defer<TState, TResult>(TState state, Func<TState, UniTask<TResult>> factory)\n        {\n            return new UniTask<TResult>(new DeferPromiseWithState<TState, TResult>(state, factory), 0);\n        }\n\n        /// <summary>\n        /// Never complete.\n        /// </summary>\n        public static UniTask Never(CancellationToken cancellationToken)\n        {\n            return new UniTask<AsyncUnit>(new NeverPromise<AsyncUnit>(cancellationToken), 0);\n        }\n\n        /// <summary>\n        /// Never complete.\n        /// </summary>\n        public static UniTask<T> Never<T>(CancellationToken cancellationToken)\n        {\n            return new UniTask<T>(new NeverPromise<T>(cancellationToken), 0);\n        }\n\n        sealed class ExceptionResultSource : IUniTaskSource\n        {\n            readonly ExceptionDispatchInfo exception;\n            bool calledGet;\n\n            public ExceptionResultSource(Exception exception)\n            {\n                this.exception = ExceptionDispatchInfo.Capture(exception);\n            }\n\n            public void GetResult(short token)\n            {\n                if (!calledGet)\n                {\n                    calledGet = true;\n                    GC.SuppressFinalize(this);\n                }\n                exception.Throw();\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return UniTaskStatus.Faulted;\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return UniTaskStatus.Faulted;\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                continuation(state);\n            }\n\n            ~ExceptionResultSource()\n            {\n                if (!calledGet)\n                {\n                    UniTaskScheduler.PublishUnobservedTaskException(exception.SourceException);\n                }\n            }\n        }\n\n        sealed class ExceptionResultSource<T> : IUniTaskSource<T>\n        {\n            readonly ExceptionDispatchInfo exception;\n            bool calledGet;\n\n            public ExceptionResultSource(Exception exception)\n            {\n                this.exception = ExceptionDispatchInfo.Capture(exception);\n            }\n\n            public T GetResult(short token)\n            {\n                if (!calledGet)\n                {\n                    calledGet = true;\n                    GC.SuppressFinalize(this);\n                }\n                exception.Throw();\n                return default;\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                if (!calledGet)\n                {\n                    calledGet = true;\n                    GC.SuppressFinalize(this);\n                }\n                exception.Throw();\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return UniTaskStatus.Faulted;\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return UniTaskStatus.Faulted;\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                continuation(state);\n            }\n\n            ~ExceptionResultSource()\n            {\n                if (!calledGet)\n                {\n                    UniTaskScheduler.PublishUnobservedTaskException(exception.SourceException);\n                }\n            }\n        }\n\n        sealed class CanceledResultSource : IUniTaskSource\n        {\n            readonly CancellationToken cancellationToken;\n\n            public CanceledResultSource(CancellationToken cancellationToken)\n            {\n                this.cancellationToken = cancellationToken;\n            }\n\n            public void GetResult(short token)\n            {\n                throw new OperationCanceledException(cancellationToken);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return UniTaskStatus.Canceled;\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return UniTaskStatus.Canceled;\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                continuation(state);\n            }\n        }\n\n        sealed class CanceledResultSource<T> : IUniTaskSource<T>\n        {\n            readonly CancellationToken cancellationToken;\n\n            public CanceledResultSource(CancellationToken cancellationToken)\n            {\n                this.cancellationToken = cancellationToken;\n            }\n\n            public T GetResult(short token)\n            {\n                throw new OperationCanceledException(cancellationToken);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                throw new OperationCanceledException(cancellationToken);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return UniTaskStatus.Canceled;\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return UniTaskStatus.Canceled;\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                continuation(state);\n            }\n        }\n\n        sealed class DeferPromise : IUniTaskSource\n        {\n            Func<UniTask> factory;\n            UniTask task;\n            UniTask.Awaiter awaiter;\n\n            public DeferPromise(Func<UniTask> factory)\n            {\n                this.factory = factory;\n            }\n\n            public void GetResult(short token)\n            {\n                awaiter.GetResult();\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                var f = Interlocked.Exchange(ref factory, null);\n                if (f != null)\n                {\n                    task = f();\n                    awaiter = task.GetAwaiter();\n                }\n\n                return task.Status;\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                awaiter.SourceOnCompleted(continuation, state);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return task.Status;\n            }\n        }\n\n        sealed class DeferPromise<T> : IUniTaskSource<T>\n        {\n            Func<UniTask<T>> factory;\n            UniTask<T> task;\n            UniTask<T>.Awaiter awaiter;\n\n            public DeferPromise(Func<UniTask<T>> factory)\n            {\n                this.factory = factory;\n            }\n\n            public T GetResult(short token)\n            {\n                return awaiter.GetResult();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                awaiter.GetResult();\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                var f = Interlocked.Exchange(ref factory, null);\n                if (f != null)\n                {\n                    task = f();\n                    awaiter = task.GetAwaiter();\n                }\n\n                return task.Status;\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                awaiter.SourceOnCompleted(continuation, state);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return task.Status;\n            }\n        }\n\n        sealed class DeferPromiseWithState<TState> : IUniTaskSource\n        {\n            Func<TState, UniTask> factory;\n            TState argument;\n            UniTask task;\n            UniTask.Awaiter awaiter;\n\n            public DeferPromiseWithState(TState argument, Func<TState, UniTask> factory)\n            {\n                this.argument = argument;\n                this.factory = factory;\n            }\n\n            public void GetResult(short token)\n            {\n                awaiter.GetResult();\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                var f = Interlocked.Exchange(ref factory, null);\n                if (f != null)\n                {\n                    task = f(argument);\n                    awaiter = task.GetAwaiter();\n                }\n\n                return task.Status;\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                awaiter.SourceOnCompleted(continuation, state);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return task.Status;\n            }\n        }\n\n        sealed class DeferPromiseWithState<TState, TResult> : IUniTaskSource<TResult>\n        {\n            Func<TState, UniTask<TResult>> factory;\n            TState argument;\n            UniTask<TResult> task;\n            UniTask<TResult>.Awaiter awaiter;\n\n            public DeferPromiseWithState(TState argument, Func<TState, UniTask<TResult>> factory)\n            {\n                this.argument = argument;\n                this.factory = factory;\n            }\n\n            public TResult GetResult(short token)\n            {\n                return awaiter.GetResult();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                awaiter.GetResult();\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                var f = Interlocked.Exchange(ref factory, null);\n                if (f != null)\n                {\n                    task = f(argument);\n                    awaiter = task.GetAwaiter();\n                }\n\n                return task.Status;\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                awaiter.SourceOnCompleted(continuation, state);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return task.Status;\n            }\n        }\n\n        sealed class NeverPromise<T> : IUniTaskSource<T>\n        {\n            static readonly Action<object> cancellationCallback = CancellationCallback;\n\n            CancellationToken cancellationToken;\n            UniTaskCompletionSourceCore<T> core;\n\n            public NeverPromise(CancellationToken cancellationToken)\n            {\n                this.cancellationToken = cancellationToken;\n                if (this.cancellationToken.CanBeCanceled)\n                {\n                    this.cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallback, this);\n                }\n            }\n\n            static void CancellationCallback(object state)\n            {\n                var self = (NeverPromise<T>)state;\n                self.core.TrySetCanceled(self.cancellationToken);\n            }\n\n            public T GetResult(short token)\n            {\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                core.GetResult(token);\n            }\n        }\n    }\n\n    internal static class CompletedTasks\n    {\n        public static readonly UniTask<AsyncUnit> AsyncUnit = UniTask.FromResult(Cysharp.Threading.Tasks.AsyncUnit.Default);\n        public static readonly UniTask<bool> True = UniTask.FromResult(true);\n        public static readonly UniTask<bool> False = UniTask.FromResult(false);\n        public static readonly UniTask<int> Zero = UniTask.FromResult(0);\n        public static readonly UniTask<int> MinusOne = UniTask.FromResult(-1);\n        public static readonly UniTask<int> One = UniTask.FromResult(1);\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.Factory.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 4e12b66d6b9bd7845b04a594cbe386b4\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.Run.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public partial struct UniTask\n    {\n        #region OBSOLETE_RUN\n\n        [Obsolete(\"UniTask.Run is similar as Task.Run, it uses ThreadPool. For equivalent behaviour, use UniTask.RunOnThreadPool instead. If you don't want to use ThreadPool, you can use UniTask.Void(async void) or UniTask.Create(async UniTask) too.\")]\n        public static UniTask Run(Action action, bool configureAwait = true, CancellationToken cancellationToken = default)\n        {\n            return RunOnThreadPool(action, configureAwait, cancellationToken);\n        }\n\n        [Obsolete(\"UniTask.Run is similar as Task.Run, it uses ThreadPool. For equivalent behaviour, use UniTask.RunOnThreadPool instead. If you don't want to use ThreadPool, you can use UniTask.Void(async void) or UniTask.Create(async UniTask) too.\")]\n        public static UniTask Run(Action<object> action, object state, bool configureAwait = true, CancellationToken cancellationToken = default)\n        {\n            return RunOnThreadPool(action, state, configureAwait, cancellationToken);\n        }\n\n        [Obsolete(\"UniTask.Run is similar as Task.Run, it uses ThreadPool. For equivalent behaviour, use UniTask.RunOnThreadPool instead. If you don't want to use ThreadPool, you can use UniTask.Void(async void) or UniTask.Create(async UniTask) too.\")]\n        public static UniTask Run(Func<UniTask> action, bool configureAwait = true, CancellationToken cancellationToken = default)\n        {\n            return RunOnThreadPool(action, configureAwait, cancellationToken);\n        }\n\n        [Obsolete(\"UniTask.Run is similar as Task.Run, it uses ThreadPool. For equivalent behaviour, use UniTask.RunOnThreadPool instead. If you don't want to use ThreadPool, you can use UniTask.Void(async void) or UniTask.Create(async UniTask) too.\")]\n        public static UniTask Run(Func<object, UniTask> action, object state, bool configureAwait = true, CancellationToken cancellationToken = default)\n        {\n            return RunOnThreadPool(action, state, configureAwait, cancellationToken);\n        }\n\n        [Obsolete(\"UniTask.Run is similar as Task.Run, it uses ThreadPool. For equivalent behaviour, use UniTask.RunOnThreadPool instead. If you don't want to use ThreadPool, you can use UniTask.Void(async void) or UniTask.Create(async UniTask) too.\")]\n        public static UniTask<T> Run<T>(Func<T> func, bool configureAwait = true, CancellationToken cancellationToken = default)\n        {\n            return RunOnThreadPool(func, configureAwait, cancellationToken);\n        }\n\n        [Obsolete(\"UniTask.Run is similar as Task.Run, it uses ThreadPool. For equivalent behaviour, use UniTask.RunOnThreadPool instead. If you don't want to use ThreadPool, you can use UniTask.Void(async void) or UniTask.Create(async UniTask) too.\")]\n        public static UniTask<T> Run<T>(Func<UniTask<T>> func, bool configureAwait = true, CancellationToken cancellationToken = default)\n        {\n            return RunOnThreadPool(func, configureAwait, cancellationToken);\n        }\n\n        [Obsolete(\"UniTask.Run is similar as Task.Run, it uses ThreadPool. For equivalent behaviour, use UniTask.RunOnThreadPool instead. If you don't want to use ThreadPool, you can use UniTask.Void(async void) or UniTask.Create(async UniTask) too.\")]\n        public static UniTask<T> Run<T>(Func<object, T> func, object state, bool configureAwait = true, CancellationToken cancellationToken = default)\n        {\n            return RunOnThreadPool(func, state, configureAwait, cancellationToken);\n        }\n\n        [Obsolete(\"UniTask.Run is similar as Task.Run, it uses ThreadPool. For equivalent behaviour, use UniTask.RunOnThreadPool instead. If you don't want to use ThreadPool, you can use UniTask.Void(async void) or UniTask.Create(async UniTask) too.\")]\n        public static UniTask<T> Run<T>(Func<object, UniTask<T>> func, object state, bool configureAwait = true, CancellationToken cancellationToken = default)\n        {\n            return RunOnThreadPool(func, state, configureAwait, cancellationToken);\n        }\n\n        #endregion\n\n        /// <summary>Run action on the threadPool and return to main thread if configureAwait = true.</summary>\n        public static async UniTask RunOnThreadPool(Action action, bool configureAwait = true, CancellationToken cancellationToken = default)\n        {\n            cancellationToken.ThrowIfCancellationRequested();\n\n            await UniTask.SwitchToThreadPool();\n\n            cancellationToken.ThrowIfCancellationRequested();\n\n            if (configureAwait)\n            {\n                try\n                {\n                    action();\n                }\n                finally\n                {\n                    await UniTask.Yield();\n                }\n            }\n            else\n            {\n                action();\n            }\n\n            cancellationToken.ThrowIfCancellationRequested();\n        }\n\n        /// <summary>Run action on the threadPool and return to main thread if configureAwait = true.</summary>\n        public static async UniTask RunOnThreadPool(Action<object> action, object state, bool configureAwait = true, CancellationToken cancellationToken = default)\n        {\n            cancellationToken.ThrowIfCancellationRequested();\n\n            await UniTask.SwitchToThreadPool();\n\n            cancellationToken.ThrowIfCancellationRequested();\n\n            if (configureAwait)\n            {\n                try\n                {\n                    action(state);\n                }\n                finally\n                {\n                    await UniTask.Yield();\n                }\n            }\n            else\n            {\n                action(state);\n            }\n\n            cancellationToken.ThrowIfCancellationRequested();\n        }\n\n        /// <summary>Run action on the threadPool and return to main thread if configureAwait = true.</summary>\n        public static async UniTask RunOnThreadPool(Func<UniTask> action, bool configureAwait = true, CancellationToken cancellationToken = default)\n        {\n            cancellationToken.ThrowIfCancellationRequested();\n\n            await UniTask.SwitchToThreadPool();\n\n            cancellationToken.ThrowIfCancellationRequested();\n\n            if (configureAwait)\n            {\n                try\n                {\n                    await action();\n                }\n                finally\n                {\n                    await UniTask.Yield();\n                }\n            }\n            else\n            {\n                await action();\n            }\n\n            cancellationToken.ThrowIfCancellationRequested();\n        }\n\n        /// <summary>Run action on the threadPool and return to main thread if configureAwait = true.</summary>\n        public static async UniTask RunOnThreadPool(Func<object, UniTask> action, object state, bool configureAwait = true, CancellationToken cancellationToken = default)\n        {\n            cancellationToken.ThrowIfCancellationRequested();\n\n            await UniTask.SwitchToThreadPool();\n\n            cancellationToken.ThrowIfCancellationRequested();\n\n            if (configureAwait)\n            {\n                try\n                {\n                    await action(state);\n                }\n                finally\n                {\n                    await UniTask.Yield();\n                }\n            }\n            else\n            {\n                await action(state);\n            }\n\n            cancellationToken.ThrowIfCancellationRequested();\n        }\n\n        /// <summary>Run action on the threadPool and return to main thread if configureAwait = true.</summary>\n        public static async UniTask<T> RunOnThreadPool<T>(Func<T> func, bool configureAwait = true, CancellationToken cancellationToken = default)\n        {\n            cancellationToken.ThrowIfCancellationRequested();\n\n            await UniTask.SwitchToThreadPool();\n\n            cancellationToken.ThrowIfCancellationRequested();\n\n            if (configureAwait)\n            {\n                try\n                {\n                    return func();\n                }\n                finally\n                {\n                    await UniTask.Yield();\n                    cancellationToken.ThrowIfCancellationRequested();\n                }\n            }\n            else\n            {\n                return func();\n            }\n        }\n\n        /// <summary>Run action on the threadPool and return to main thread if configureAwait = true.</summary>\n        public static async UniTask<T> RunOnThreadPool<T>(Func<UniTask<T>> func, bool configureAwait = true, CancellationToken cancellationToken = default)\n        {\n            cancellationToken.ThrowIfCancellationRequested();\n\n            await UniTask.SwitchToThreadPool();\n\n            cancellationToken.ThrowIfCancellationRequested();\n\n            if (configureAwait)\n            {\n                try\n                {\n                    return await func();\n                }\n                finally\n                {\n                    cancellationToken.ThrowIfCancellationRequested();\n                    await UniTask.Yield();\n                    cancellationToken.ThrowIfCancellationRequested();\n                }\n            }\n            else\n            {\n                var result = await func();\n                cancellationToken.ThrowIfCancellationRequested();\n                return result;\n            }\n        }\n\n        /// <summary>Run action on the threadPool and return to main thread if configureAwait = true.</summary>\n        public static async UniTask<T> RunOnThreadPool<T>(Func<object, T> func, object state, bool configureAwait = true, CancellationToken cancellationToken = default)\n        {\n            cancellationToken.ThrowIfCancellationRequested();\n\n            await UniTask.SwitchToThreadPool();\n\n            cancellationToken.ThrowIfCancellationRequested();\n\n            if (configureAwait)\n            {\n                try\n                {\n                    return func(state);\n                }\n                finally\n                {\n                    await UniTask.Yield();\n                    cancellationToken.ThrowIfCancellationRequested();\n                }\n            }\n            else\n            {\n                return func(state);\n            }\n        }\n\n        /// <summary>Run action on the threadPool and return to main thread if configureAwait = true.</summary>\n        public static async UniTask<T> RunOnThreadPool<T>(Func<object, UniTask<T>> func, object state, bool configureAwait = true, CancellationToken cancellationToken = default)\n        {\n            cancellationToken.ThrowIfCancellationRequested();\n\n            await UniTask.SwitchToThreadPool();\n\n            cancellationToken.ThrowIfCancellationRequested();\n\n            if (configureAwait)\n            {\n                try\n                {\n                    return await func(state);\n                }\n                finally\n                {\n                    cancellationToken.ThrowIfCancellationRequested();\n                    await UniTask.Yield();\n                    cancellationToken.ThrowIfCancellationRequested();\n                }\n            }\n            else\n            {\n                var result = await func(state);\n                cancellationToken.ThrowIfCancellationRequested();\n                return result;\n            }\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.Run.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 8473162fc285a5f44bcca90f7da073e7\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.Threading.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public partial struct UniTask\n    {\n#if UNITY_2018_3_OR_NEWER\n\n        /// <summary>\n        /// If running on mainthread, do nothing. Otherwise, same as UniTask.Yield(PlayerLoopTiming.Update).\n        /// </summary>\n        public static SwitchToMainThreadAwaitable SwitchToMainThread(CancellationToken cancellationToken = default)\n        {\n            return new SwitchToMainThreadAwaitable(PlayerLoopTiming.Update, cancellationToken);\n        }\n\n        /// <summary>\n        /// If running on mainthread, do nothing. Otherwise, same as UniTask.Yield(timing).\n        /// </summary>\n        public static SwitchToMainThreadAwaitable SwitchToMainThread(PlayerLoopTiming timing, CancellationToken cancellationToken = default)\n        {\n            return new SwitchToMainThreadAwaitable(timing, cancellationToken);\n        }\n\n        /// <summary>\n        /// Return to mainthread(same as await SwitchToMainThread) after using scope is closed.\n        /// </summary>\n        public static ReturnToMainThread ReturnToMainThread(CancellationToken cancellationToken = default)\n        {\n            return new ReturnToMainThread(PlayerLoopTiming.Update, cancellationToken);\n        }\n\n        /// <summary>\n        /// Return to mainthread(same as await SwitchToMainThread) after using scope is closed.\n        /// </summary>\n        public static ReturnToMainThread ReturnToMainThread(PlayerLoopTiming timing, CancellationToken cancellationToken = default)\n        {\n            return new ReturnToMainThread(timing, cancellationToken);\n        }\n\n        /// <summary>\n        /// Queue the action to PlayerLoop.\n        /// </summary>\n        public static void Post(Action action, PlayerLoopTiming timing = PlayerLoopTiming.Update)\n        {\n            PlayerLoopHelper.AddContinuation(timing, action);\n        }\n\n#endif\n\n        public static SwitchToThreadPoolAwaitable SwitchToThreadPool()\n        {\n            return new SwitchToThreadPoolAwaitable();\n        }\n\n        /// <summary>\n        /// Note: use SwitchToThreadPool is recommended.\n        /// </summary>\n        public static SwitchToTaskPoolAwaitable SwitchToTaskPool()\n        {\n            return new SwitchToTaskPoolAwaitable();\n        }\n\n        public static SwitchToSynchronizationContextAwaitable SwitchToSynchronizationContext(SynchronizationContext synchronizationContext, CancellationToken cancellationToken = default)\n        {\n            Error.ThrowArgumentNullException(synchronizationContext, nameof(synchronizationContext));\n            return new SwitchToSynchronizationContextAwaitable(synchronizationContext, cancellationToken);\n        }\n\n        public static ReturnToSynchronizationContext ReturnToSynchronizationContext(SynchronizationContext synchronizationContext, CancellationToken cancellationToken = default)\n        {\n            return new ReturnToSynchronizationContext(synchronizationContext, false, cancellationToken);\n        }\n\n        public static ReturnToSynchronizationContext ReturnToCurrentSynchronizationContext(bool dontPostWhenSameContext = true, CancellationToken cancellationToken = default)\n        {\n            return new ReturnToSynchronizationContext(SynchronizationContext.Current, dontPostWhenSameContext, cancellationToken);\n        }\n    }\n\n#if UNITY_2018_3_OR_NEWER\n\n    public struct SwitchToMainThreadAwaitable\n    {\n        readonly PlayerLoopTiming playerLoopTiming;\n        readonly CancellationToken cancellationToken;\n\n        public SwitchToMainThreadAwaitable(PlayerLoopTiming playerLoopTiming, CancellationToken cancellationToken)\n        {\n            this.playerLoopTiming = playerLoopTiming;\n            this.cancellationToken = cancellationToken;\n        }\n\n        public Awaiter GetAwaiter() => new Awaiter(playerLoopTiming, cancellationToken);\n\n        public struct Awaiter : ICriticalNotifyCompletion\n        {\n            readonly PlayerLoopTiming playerLoopTiming;\n            readonly CancellationToken cancellationToken;\n\n            public Awaiter(PlayerLoopTiming playerLoopTiming, CancellationToken cancellationToken)\n            {\n                this.playerLoopTiming = playerLoopTiming;\n                this.cancellationToken = cancellationToken;\n            }\n\n            public bool IsCompleted\n            {\n                get\n                {\n                    var currentThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId;\n                    if (PlayerLoopHelper.MainThreadId == currentThreadId)\n                    {\n                        return true; // run immediate.\n                    }\n                    else\n                    {\n                        return false; // register continuation.\n                    }\n                }\n            }\n\n            public void GetResult() { cancellationToken.ThrowIfCancellationRequested(); }\n\n            public void OnCompleted(Action continuation)\n            {\n                PlayerLoopHelper.AddContinuation(playerLoopTiming, continuation);\n            }\n\n            public void UnsafeOnCompleted(Action continuation)\n            {\n                PlayerLoopHelper.AddContinuation(playerLoopTiming, continuation);\n            }\n        }\n    }\n\n    public struct ReturnToMainThread\n    {\n        readonly PlayerLoopTiming playerLoopTiming;\n        readonly CancellationToken cancellationToken;\n\n        public ReturnToMainThread(PlayerLoopTiming playerLoopTiming, CancellationToken cancellationToken)\n        {\n            this.playerLoopTiming = playerLoopTiming;\n            this.cancellationToken = cancellationToken;\n        }\n\n        public Awaiter DisposeAsync()\n        {\n            return new Awaiter(playerLoopTiming, cancellationToken); // run immediate.\n        }\n\n        public readonly struct Awaiter : ICriticalNotifyCompletion\n        {\n            readonly PlayerLoopTiming timing;\n            readonly CancellationToken cancellationToken;\n\n            public Awaiter(PlayerLoopTiming timing, CancellationToken cancellationToken)\n            {\n                this.timing = timing;\n                this.cancellationToken = cancellationToken;\n            }\n\n            public Awaiter GetAwaiter() => this;\n\n            public bool IsCompleted => PlayerLoopHelper.MainThreadId == System.Threading.Thread.CurrentThread.ManagedThreadId;\n\n            public void GetResult() { cancellationToken.ThrowIfCancellationRequested(); }\n\n            public void OnCompleted(Action continuation)\n            {\n                PlayerLoopHelper.AddContinuation(timing, continuation);\n            }\n\n            public void UnsafeOnCompleted(Action continuation)\n            {\n                PlayerLoopHelper.AddContinuation(timing, continuation);\n            }\n        }\n    }\n\n#endif\n\n    public struct SwitchToThreadPoolAwaitable\n    {\n        public Awaiter GetAwaiter() => new Awaiter();\n\n        public struct Awaiter : ICriticalNotifyCompletion\n        {\n            static readonly WaitCallback switchToCallback = Callback;\n\n            public bool IsCompleted => false;\n            public void GetResult() { }\n\n            public void OnCompleted(Action continuation)\n            {\n                ThreadPool.QueueUserWorkItem(switchToCallback, continuation);\n            }\n\n            public void UnsafeOnCompleted(Action continuation)\n            {\n#if NETCOREAPP3_1\n                ThreadPool.UnsafeQueueUserWorkItem(ThreadPoolWorkItem.Create(continuation), false);\n#else\n                ThreadPool.UnsafeQueueUserWorkItem(switchToCallback, continuation);\n#endif\n            }\n\n            static void Callback(object state)\n            {\n                var continuation = (Action)state;\n                continuation();\n            }\n        }\n\n#if NETCOREAPP3_1\n\n        sealed class ThreadPoolWorkItem : IThreadPoolWorkItem, ITaskPoolNode<ThreadPoolWorkItem>\n        {\n            static TaskPool<ThreadPoolWorkItem> pool;\n            ThreadPoolWorkItem nextNode;\n            public ref ThreadPoolWorkItem NextNode => ref nextNode;\n\n            static ThreadPoolWorkItem()\n            {\n                TaskPool.RegisterSizeGetter(typeof(ThreadPoolWorkItem), () => pool.Size);\n            }\n\n            Action continuation;\n\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            public static ThreadPoolWorkItem Create(Action continuation)\n            {\n                if (!pool.TryPop(out var item))\n                {\n                    item = new ThreadPoolWorkItem();\n                }\n\n                item.continuation = continuation;\n                return item;\n            }\n\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            public void Execute()\n            {\n                var call = continuation;\n                continuation = null;\n                if (call != null)\n                {\n                    pool.TryPush(this);\n                    call.Invoke();\n                }\n            }\n        }\n\n#endif\n    }\n\n    public struct SwitchToTaskPoolAwaitable\n    {\n        public Awaiter GetAwaiter() => new Awaiter();\n\n        public struct Awaiter : ICriticalNotifyCompletion\n        {\n            static readonly Action<object> switchToCallback = Callback;\n\n            public bool IsCompleted => false;\n            public void GetResult() { }\n\n            public void OnCompleted(Action continuation)\n            {\n                Task.Factory.StartNew(switchToCallback, continuation, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);\n            }\n\n            public void UnsafeOnCompleted(Action continuation)\n            {\n                Task.Factory.StartNew(switchToCallback, continuation, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);\n            }\n\n            static void Callback(object state)\n            {\n                var continuation = (Action)state;\n                continuation();\n            }\n        }\n    }\n\n    public struct SwitchToSynchronizationContextAwaitable\n    {\n        readonly SynchronizationContext synchronizationContext;\n        readonly CancellationToken cancellationToken;\n\n        public SwitchToSynchronizationContextAwaitable(SynchronizationContext synchronizationContext, CancellationToken cancellationToken)\n        {\n            this.synchronizationContext = synchronizationContext;\n            this.cancellationToken = cancellationToken;\n        }\n\n        public Awaiter GetAwaiter() => new Awaiter(synchronizationContext, cancellationToken);\n\n        public struct Awaiter : ICriticalNotifyCompletion\n        {\n            static readonly SendOrPostCallback switchToCallback = Callback;\n            readonly SynchronizationContext synchronizationContext;\n            readonly CancellationToken cancellationToken;\n\n            public Awaiter(SynchronizationContext synchronizationContext, CancellationToken cancellationToken)\n            {\n                this.synchronizationContext = synchronizationContext;\n                this.cancellationToken = cancellationToken;\n            }\n\n            public bool IsCompleted => false;\n            public void GetResult() { cancellationToken.ThrowIfCancellationRequested(); }\n\n            public void OnCompleted(Action continuation)\n            {\n                synchronizationContext.Post(switchToCallback, continuation);\n            }\n\n            public void UnsafeOnCompleted(Action continuation)\n            {\n                synchronizationContext.Post(switchToCallback, continuation);\n            }\n\n            static void Callback(object state)\n            {\n                var continuation = (Action)state;\n                continuation();\n            }\n        }\n    }\n\n    public struct ReturnToSynchronizationContext\n    {\n        readonly SynchronizationContext syncContext;\n        readonly bool dontPostWhenSameContext;\n        readonly CancellationToken cancellationToken;\n\n        public ReturnToSynchronizationContext(SynchronizationContext syncContext, bool dontPostWhenSameContext, CancellationToken cancellationToken)\n        {\n            this.syncContext = syncContext;\n            this.dontPostWhenSameContext = dontPostWhenSameContext;\n            this.cancellationToken = cancellationToken;\n        }\n\n        public Awaiter DisposeAsync()\n        {\n            return new Awaiter(syncContext, dontPostWhenSameContext, cancellationToken);\n        }\n\n        public struct Awaiter : ICriticalNotifyCompletion\n        {\n            static readonly SendOrPostCallback switchToCallback = Callback;\n\n            readonly SynchronizationContext synchronizationContext;\n            readonly bool dontPostWhenSameContext;\n            readonly CancellationToken cancellationToken;\n\n            public Awaiter(SynchronizationContext synchronizationContext, bool dontPostWhenSameContext, CancellationToken cancellationToken)\n            {\n                this.synchronizationContext = synchronizationContext;\n                this.dontPostWhenSameContext = dontPostWhenSameContext;\n                this.cancellationToken = cancellationToken;\n            }\n\n            public Awaiter GetAwaiter() => this;\n\n            public bool IsCompleted\n            {\n                get\n                {\n                    if (!dontPostWhenSameContext) return false;\n\n                    var current = SynchronizationContext.Current;\n                    if (current == synchronizationContext)\n                    {\n                        return true;\n                    }\n                    else\n                    {\n                        return false;\n                    }\n                }\n            }\n\n            public void GetResult() { cancellationToken.ThrowIfCancellationRequested(); }\n\n            public void OnCompleted(Action continuation)\n            {\n                synchronizationContext.Post(switchToCallback, continuation);\n            }\n\n            public void UnsafeOnCompleted(Action continuation)\n            {\n                synchronizationContext.Post(switchToCallback, continuation);\n            }\n\n            static void Callback(object state)\n            {\n                var continuation = (Action)state;\n                continuation();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.Threading.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 4132ea600454134439fa2c7eb931b5e6\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.WaitUntil.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public partial struct UniTask\n    {\n        public static UniTask WaitUntil(Func<bool> predicate, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            return new UniTask(WaitUntilPromise.Create(predicate, timing, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n        public static UniTask WaitUntil<T>(T state, Func<T, bool> predicate, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            return new UniTask(WaitUntilPromise<T>.Create(state, predicate, timing, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n        public static UniTask WaitWhile(Func<bool> predicate, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            return new UniTask(WaitWhilePromise.Create(predicate, timing, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n        public static UniTask WaitWhile<T>(T state, Func<T, bool> predicate, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            return new UniTask(WaitWhilePromise<T>.Create(state, predicate, timing, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n        public static UniTask WaitUntilCanceled(CancellationToken cancellationToken, PlayerLoopTiming timing = PlayerLoopTiming.Update, bool completeImmediately = false)\n        {\n            return new UniTask(WaitUntilCanceledPromise.Create(cancellationToken, timing, completeImmediately, out var token), token);\n        }\n\n        public static UniTask<U> WaitUntilValueChanged<T, U>(T target, Func<T, U> monitorFunction, PlayerLoopTiming monitorTiming = PlayerLoopTiming.Update, IEqualityComparer<U> equalityComparer = null, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n          where T : class\n        {\n            var unityObject = target as UnityEngine.Object;\n            var isUnityObject = target is UnityEngine.Object; // don't use (unityObject == null)\n\n            return new UniTask<U>(isUnityObject\n                ? WaitUntilValueChangedUnityObjectPromise<T, U>.Create(target, monitorFunction, equalityComparer, monitorTiming, cancellationToken, cancelImmediately, out var token)\n                : WaitUntilValueChangedStandardObjectPromise<T, U>.Create(target, monitorFunction, equalityComparer, monitorTiming, cancellationToken, cancelImmediately, out token), token);\n        }\n\n        sealed class WaitUntilPromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<WaitUntilPromise>\n        {\n            static TaskPool<WaitUntilPromise> pool;\n            WaitUntilPromise nextNode;\n            public ref WaitUntilPromise NextNode => ref nextNode;\n\n            static WaitUntilPromise()\n            {\n                TaskPool.RegisterSizeGetter(typeof(WaitUntilPromise), () => pool.Size);\n            }\n\n            Func<bool> predicate;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n\n            UniTaskCompletionSourceCore<object> core;\n\n            WaitUntilPromise()\n            {\n            }\n\n            public static IUniTaskSource Create(Func<bool> predicate, PlayerLoopTiming timing, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new WaitUntilPromise();\n                }\n\n                result.predicate = predicate;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var promise = (WaitUntilPromise)state;\n                        promise.core.TrySetCanceled(promise.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public void GetResult(short token)\n            {\n                try\n                {\n                    core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                try\n                {\n                    if (!predicate())\n                    {\n                        return true;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    core.TrySetException(ex);\n                    return false;\n                }\n\n                core.TrySetResult(null);\n                return false;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                predicate = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n        }\n\n        sealed class WaitUntilPromise<T> : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<WaitUntilPromise<T>>\n        {\n            static TaskPool<WaitUntilPromise<T>> pool;\n            WaitUntilPromise<T> nextNode;\n            public ref WaitUntilPromise<T> NextNode => ref nextNode;\n\n            static WaitUntilPromise()\n            {\n                TaskPool.RegisterSizeGetter(typeof(WaitUntilPromise<T>), () => pool.Size);\n            }\n\n            Func<T, bool> predicate;\n            T argument;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n\n            UniTaskCompletionSourceCore<object> core;\n\n            WaitUntilPromise()\n            {\n            }\n\n            public static IUniTaskSource Create(T argument, Func<T, bool> predicate, PlayerLoopTiming timing, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new WaitUntilPromise<T>();\n                }\n\n                result.predicate = predicate;\n                result.argument = argument;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var promise = (WaitUntilPromise<T>)state;\n                        promise.core.TrySetCanceled(promise.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public void GetResult(short token)\n            {\n                try\n                {\n                    core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                try\n                {\n                    if (!predicate(argument))\n                    {\n                        return true;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    core.TrySetException(ex);\n                    return false;\n                }\n\n                core.TrySetResult(null);\n                return false;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                predicate = default;\n                argument = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n        }\n\n        sealed class WaitWhilePromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<WaitWhilePromise>\n        {\n            static TaskPool<WaitWhilePromise> pool;\n            WaitWhilePromise nextNode;\n            public ref WaitWhilePromise NextNode => ref nextNode;\n\n            static WaitWhilePromise()\n            {\n                TaskPool.RegisterSizeGetter(typeof(WaitWhilePromise), () => pool.Size);\n            }\n\n            Func<bool> predicate;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n\n            UniTaskCompletionSourceCore<object> core;\n\n            WaitWhilePromise()\n            {\n            }\n\n            public static IUniTaskSource Create(Func<bool> predicate, PlayerLoopTiming timing, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new WaitWhilePromise();\n                }\n\n                result.predicate = predicate;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var promise = (WaitWhilePromise)state;\n                        promise.core.TrySetCanceled(promise.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public void GetResult(short token)\n            {\n                try\n                {\n                    core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                try\n                {\n                    if (predicate())\n                    {\n                        return true;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    core.TrySetException(ex);\n                    return false;\n                }\n\n                core.TrySetResult(null);\n                return false;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                predicate = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n        }\n\n        sealed class WaitWhilePromise<T> : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<WaitWhilePromise<T>>\n        {\n            static TaskPool<WaitWhilePromise<T>> pool;\n            WaitWhilePromise<T> nextNode;\n            public ref WaitWhilePromise<T> NextNode => ref nextNode;\n\n            static WaitWhilePromise()\n            {\n                TaskPool.RegisterSizeGetter(typeof(WaitWhilePromise<T>), () => pool.Size);\n            }\n\n            Func<T, bool> predicate;\n            T argument;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n\n            UniTaskCompletionSourceCore<object> core;\n\n            WaitWhilePromise()\n            {\n            }\n\n            public static IUniTaskSource Create(T argument, Func<T, bool> predicate, PlayerLoopTiming timing, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new WaitWhilePromise<T>();\n                }\n\n                result.predicate = predicate;\n                result.argument = argument;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var promise = (WaitWhilePromise<T>)state;\n                        promise.core.TrySetCanceled(promise.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public void GetResult(short token)\n            {\n                try\n                {\n                    core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                try\n                {\n                    if (predicate(argument))\n                    {\n                        return true;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    core.TrySetException(ex);\n                    return false;\n                }\n\n                core.TrySetResult(null);\n                return false;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                predicate = default;\n                argument = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n        }\n\n        sealed class WaitUntilCanceledPromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<WaitUntilCanceledPromise>\n        {\n            static TaskPool<WaitUntilCanceledPromise> pool;\n            WaitUntilCanceledPromise nextNode;\n            public ref WaitUntilCanceledPromise NextNode => ref nextNode;\n\n            static WaitUntilCanceledPromise()\n            {\n                TaskPool.RegisterSizeGetter(typeof(WaitUntilCanceledPromise), () => pool.Size);\n            }\n\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n\n            UniTaskCompletionSourceCore<object> core;\n\n            WaitUntilCanceledPromise()\n            {\n            }\n\n            public static IUniTaskSource Create(CancellationToken cancellationToken, PlayerLoopTiming timing, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new WaitUntilCanceledPromise();\n                }\n\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var promise = (WaitUntilCanceledPromise)state;\n                        promise.core.TrySetResult(null);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public void GetResult(short token)\n            {\n                try\n                {\n                    core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetResult(null);\n                    return false;\n                }\n\n                return true;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n        }\n\n        // where T : UnityEngine.Object, can not add constraint\n        sealed class WaitUntilValueChangedUnityObjectPromise<T, U> : IUniTaskSource<U>, IPlayerLoopItem, ITaskPoolNode<WaitUntilValueChangedUnityObjectPromise<T, U>>\n        {\n            static TaskPool<WaitUntilValueChangedUnityObjectPromise<T, U>> pool;\n            WaitUntilValueChangedUnityObjectPromise<T, U> nextNode;\n            public ref WaitUntilValueChangedUnityObjectPromise<T, U> NextNode => ref nextNode;\n\n            static WaitUntilValueChangedUnityObjectPromise()\n            {\n                TaskPool.RegisterSizeGetter(typeof(WaitUntilValueChangedUnityObjectPromise<T, U>), () => pool.Size);\n            }\n\n            T target;\n            UnityEngine.Object targetAsUnityObject;\n            U currentValue;\n            Func<T, U> monitorFunction;\n            IEqualityComparer<U> equalityComparer;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n\n            UniTaskCompletionSourceCore<U> core;\n\n            WaitUntilValueChangedUnityObjectPromise()\n            {\n            }\n\n            public static IUniTaskSource<U> Create(T target, Func<T, U> monitorFunction, IEqualityComparer<U> equalityComparer, PlayerLoopTiming timing, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource<U>.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new WaitUntilValueChangedUnityObjectPromise<T, U>();\n                }\n\n                result.target = target;\n                result.targetAsUnityObject = target as UnityEngine.Object;\n                result.monitorFunction = monitorFunction;\n                result.currentValue = monitorFunction(target);\n                result.equalityComparer = equalityComparer ?? UnityEqualityComparer.GetDefault<U>();\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var promise = (WaitUntilValueChangedUnityObjectPromise<T, U>)state;\n                        promise.core.TrySetCanceled(promise.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public U GetResult(short token)\n            {\n                try\n                {\n                    return core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (cancellationToken.IsCancellationRequested || targetAsUnityObject == null) // destroyed = cancel.\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                U nextValue = default(U);\n                try\n                {\n                    nextValue = monitorFunction(target);\n                    if (equalityComparer.Equals(currentValue, nextValue))\n                    {\n                        return true;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    core.TrySetException(ex);\n                    return false;\n                }\n\n                core.TrySetResult(nextValue);\n                return false;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                target = default;\n                currentValue = default;\n                monitorFunction = default;\n                equalityComparer = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n        }\n\n        sealed class WaitUntilValueChangedStandardObjectPromise<T, U> : IUniTaskSource<U>, IPlayerLoopItem, ITaskPoolNode<WaitUntilValueChangedStandardObjectPromise<T, U>>\n            where T : class\n        {\n            static TaskPool<WaitUntilValueChangedStandardObjectPromise<T, U>> pool;\n            WaitUntilValueChangedStandardObjectPromise<T, U> nextNode;\n            public ref WaitUntilValueChangedStandardObjectPromise<T, U> NextNode => ref nextNode;\n\n            static WaitUntilValueChangedStandardObjectPromise()\n            {\n                TaskPool.RegisterSizeGetter(typeof(WaitUntilValueChangedStandardObjectPromise<T, U>), () => pool.Size);\n            }\n\n            WeakReference<T> target;\n            U currentValue;\n            Func<T, U> monitorFunction;\n            IEqualityComparer<U> equalityComparer;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n\n            UniTaskCompletionSourceCore<U> core;\n\n            WaitUntilValueChangedStandardObjectPromise()\n            {\n            }\n\n            public static IUniTaskSource<U> Create(T target, Func<T, U> monitorFunction, IEqualityComparer<U> equalityComparer, PlayerLoopTiming timing, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource<U>.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new WaitUntilValueChangedStandardObjectPromise<T, U>();\n                }\n\n                result.target = new WeakReference<T>(target, false); // wrap in WeakReference.\n                result.monitorFunction = monitorFunction;\n                result.currentValue = monitorFunction(target);\n                result.equalityComparer = equalityComparer ?? UnityEqualityComparer.GetDefault<U>();\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var promise = (WaitUntilValueChangedStandardObjectPromise<T, U>)state;\n                        promise.core.TrySetCanceled(promise.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public U GetResult(short token)\n            {\n                try\n                {\n                    return core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (cancellationToken.IsCancellationRequested || !target.TryGetTarget(out var t)) // doesn't find = cancel.\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                U nextValue = default(U);\n                try\n                {\n                    nextValue = monitorFunction(t);\n                    if (equalityComparer.Equals(currentValue, nextValue))\n                    {\n                        return true;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    core.TrySetException(ex);\n                    return false;\n                }\n\n                core.TrySetResult(nextValue);\n                return false;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                target = default;\n                currentValue = default;\n                monitorFunction = default;\n                equalityComparer = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.WaitUntil.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 87c9c533491903a4288536b5ac173db8\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.WhenAll.Generated.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\nusing System;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.ExceptionServices;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public partial struct UniTask\n    {\n        \n        public static UniTask<(T1, T2)> WhenAll<T1, T2>(UniTask<T1> task1, UniTask<T2> task2)\n        {\n            if (task1.Status.IsCompletedSuccessfully() && task2.Status.IsCompletedSuccessfully())\n            {\n                return new UniTask<(T1, T2)>((task1.GetAwaiter().GetResult(), task2.GetAwaiter().GetResult()));\n            }\n\n            return new UniTask<(T1, T2)>(new WhenAllPromise<T1, T2>(task1, task2), 0);\n        }\n\n        sealed class WhenAllPromise<T1, T2> : IUniTaskSource<(T1, T2)>\n        {\n            T1 t1 = default;\n            T2 t2 = default;\n            int completedCount;\n            UniTaskCompletionSourceCore<(T1, T2)> core;\n\n            public WhenAllPromise(UniTask<T1> task1, UniTask<T2> task2)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAllPromise<T1, T2> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t1 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 2)\n                {\n                    self.core.TrySetResult((self.t1, self.t2));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAllPromise<T1, T2> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t2 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 2)\n                {\n                    self.core.TrySetResult((self.t1, self.t2));\n                }\n            }\n\n\n            public (T1, T2) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n        }\n        \n        public static UniTask<(T1, T2, T3)> WhenAll<T1, T2, T3>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3)\n        {\n            if (task1.Status.IsCompletedSuccessfully() && task2.Status.IsCompletedSuccessfully() && task3.Status.IsCompletedSuccessfully())\n            {\n                return new UniTask<(T1, T2, T3)>((task1.GetAwaiter().GetResult(), task2.GetAwaiter().GetResult(), task3.GetAwaiter().GetResult()));\n            }\n\n            return new UniTask<(T1, T2, T3)>(new WhenAllPromise<T1, T2, T3>(task1, task2, task3), 0);\n        }\n\n        sealed class WhenAllPromise<T1, T2, T3> : IUniTaskSource<(T1, T2, T3)>\n        {\n            T1 t1 = default;\n            T2 t2 = default;\n            T3 t3 = default;\n            int completedCount;\n            UniTaskCompletionSourceCore<(T1, T2, T3)> core;\n\n            public WhenAllPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAllPromise<T1, T2, T3> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t1 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 3)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAllPromise<T1, T2, T3> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t2 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 3)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAllPromise<T1, T2, T3> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t3 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 3)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3));\n                }\n            }\n\n\n            public (T1, T2, T3) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n        }\n        \n        public static UniTask<(T1, T2, T3, T4)> WhenAll<T1, T2, T3, T4>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4)\n        {\n            if (task1.Status.IsCompletedSuccessfully() && task2.Status.IsCompletedSuccessfully() && task3.Status.IsCompletedSuccessfully() && task4.Status.IsCompletedSuccessfully())\n            {\n                return new UniTask<(T1, T2, T3, T4)>((task1.GetAwaiter().GetResult(), task2.GetAwaiter().GetResult(), task3.GetAwaiter().GetResult(), task4.GetAwaiter().GetResult()));\n            }\n\n            return new UniTask<(T1, T2, T3, T4)>(new WhenAllPromise<T1, T2, T3, T4>(task1, task2, task3, task4), 0);\n        }\n\n        sealed class WhenAllPromise<T1, T2, T3, T4> : IUniTaskSource<(T1, T2, T3, T4)>\n        {\n            T1 t1 = default;\n            T2 t2 = default;\n            T3 t3 = default;\n            T4 t4 = default;\n            int completedCount;\n            UniTaskCompletionSourceCore<(T1, T2, T3, T4)> core;\n\n            public WhenAllPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAllPromise<T1, T2, T3, T4> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t1 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 4)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAllPromise<T1, T2, T3, T4> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t2 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 4)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAllPromise<T1, T2, T3, T4> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t3 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 4)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAllPromise<T1, T2, T3, T4> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t4 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 4)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4));\n                }\n            }\n\n\n            public (T1, T2, T3, T4) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n        }\n        \n        public static UniTask<(T1, T2, T3, T4, T5)> WhenAll<T1, T2, T3, T4, T5>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5)\n        {\n            if (task1.Status.IsCompletedSuccessfully() && task2.Status.IsCompletedSuccessfully() && task3.Status.IsCompletedSuccessfully() && task4.Status.IsCompletedSuccessfully() && task5.Status.IsCompletedSuccessfully())\n            {\n                return new UniTask<(T1, T2, T3, T4, T5)>((task1.GetAwaiter().GetResult(), task2.GetAwaiter().GetResult(), task3.GetAwaiter().GetResult(), task4.GetAwaiter().GetResult(), task5.GetAwaiter().GetResult()));\n            }\n\n            return new UniTask<(T1, T2, T3, T4, T5)>(new WhenAllPromise<T1, T2, T3, T4, T5>(task1, task2, task3, task4, task5), 0);\n        }\n\n        sealed class WhenAllPromise<T1, T2, T3, T4, T5> : IUniTaskSource<(T1, T2, T3, T4, T5)>\n        {\n            T1 t1 = default;\n            T2 t2 = default;\n            T3 t3 = default;\n            T4 t4 = default;\n            T5 t5 = default;\n            int completedCount;\n            UniTaskCompletionSourceCore<(T1, T2, T3, T4, T5)> core;\n\n            public WhenAllPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAllPromise<T1, T2, T3, T4, T5> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t1 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 5)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAllPromise<T1, T2, T3, T4, T5> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t2 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 5)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAllPromise<T1, T2, T3, T4, T5> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t3 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 5)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAllPromise<T1, T2, T3, T4, T5> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t4 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 5)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAllPromise<T1, T2, T3, T4, T5> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t5 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 5)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5));\n                }\n            }\n\n\n            public (T1, T2, T3, T4, T5) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n        }\n        \n        public static UniTask<(T1, T2, T3, T4, T5, T6)> WhenAll<T1, T2, T3, T4, T5, T6>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6)\n        {\n            if (task1.Status.IsCompletedSuccessfully() && task2.Status.IsCompletedSuccessfully() && task3.Status.IsCompletedSuccessfully() && task4.Status.IsCompletedSuccessfully() && task5.Status.IsCompletedSuccessfully() && task6.Status.IsCompletedSuccessfully())\n            {\n                return new UniTask<(T1, T2, T3, T4, T5, T6)>((task1.GetAwaiter().GetResult(), task2.GetAwaiter().GetResult(), task3.GetAwaiter().GetResult(), task4.GetAwaiter().GetResult(), task5.GetAwaiter().GetResult(), task6.GetAwaiter().GetResult()));\n            }\n\n            return new UniTask<(T1, T2, T3, T4, T5, T6)>(new WhenAllPromise<T1, T2, T3, T4, T5, T6>(task1, task2, task3, task4, task5, task6), 0);\n        }\n\n        sealed class WhenAllPromise<T1, T2, T3, T4, T5, T6> : IUniTaskSource<(T1, T2, T3, T4, T5, T6)>\n        {\n            T1 t1 = default;\n            T2 t2 = default;\n            T3 t3 = default;\n            T4 t4 = default;\n            T5 t5 = default;\n            T6 t6 = default;\n            int completedCount;\n            UniTaskCompletionSourceCore<(T1, T2, T3, T4, T5, T6)> core;\n\n            public WhenAllPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAllPromise<T1, T2, T3, T4, T5, T6> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t1 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 6)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAllPromise<T1, T2, T3, T4, T5, T6> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t2 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 6)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAllPromise<T1, T2, T3, T4, T5, T6> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t3 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 6)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAllPromise<T1, T2, T3, T4, T5, T6> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t4 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 6)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAllPromise<T1, T2, T3, T4, T5, T6> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t5 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 6)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAllPromise<T1, T2, T3, T4, T5, T6> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t6 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 6)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6));\n                }\n            }\n\n\n            public (T1, T2, T3, T4, T5, T6) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n        }\n        \n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7)> WhenAll<T1, T2, T3, T4, T5, T6, T7>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7)\n        {\n            if (task1.Status.IsCompletedSuccessfully() && task2.Status.IsCompletedSuccessfully() && task3.Status.IsCompletedSuccessfully() && task4.Status.IsCompletedSuccessfully() && task5.Status.IsCompletedSuccessfully() && task6.Status.IsCompletedSuccessfully() && task7.Status.IsCompletedSuccessfully())\n            {\n                return new UniTask<(T1, T2, T3, T4, T5, T6, T7)>((task1.GetAwaiter().GetResult(), task2.GetAwaiter().GetResult(), task3.GetAwaiter().GetResult(), task4.GetAwaiter().GetResult(), task5.GetAwaiter().GetResult(), task6.GetAwaiter().GetResult(), task7.GetAwaiter().GetResult()));\n            }\n\n            return new UniTask<(T1, T2, T3, T4, T5, T6, T7)>(new WhenAllPromise<T1, T2, T3, T4, T5, T6, T7>(task1, task2, task3, task4, task5, task6, task7), 0);\n        }\n\n        sealed class WhenAllPromise<T1, T2, T3, T4, T5, T6, T7> : IUniTaskSource<(T1, T2, T3, T4, T5, T6, T7)>\n        {\n            T1 t1 = default;\n            T2 t2 = default;\n            T3 t3 = default;\n            T4 t4 = default;\n            T5 t5 = default;\n            T6 t6 = default;\n            T7 t7 = default;\n            int completedCount;\n            UniTaskCompletionSourceCore<(T1, T2, T3, T4, T5, T6, T7)> core;\n\n            public WhenAllPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t1 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 7)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t2 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 7)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t3 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 7)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t4 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 7)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t5 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 7)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t6 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 7)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t7 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 7)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7));\n                }\n            }\n\n\n            public (T1, T2, T3, T4, T5, T6, T7) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n        }\n        \n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8)\n        {\n            if (task1.Status.IsCompletedSuccessfully() && task2.Status.IsCompletedSuccessfully() && task3.Status.IsCompletedSuccessfully() && task4.Status.IsCompletedSuccessfully() && task5.Status.IsCompletedSuccessfully() && task6.Status.IsCompletedSuccessfully() && task7.Status.IsCompletedSuccessfully() && task8.Status.IsCompletedSuccessfully())\n            {\n                return new UniTask<(T1, T2, T3, T4, T5, T6, T7, T8)>((task1.GetAwaiter().GetResult(), task2.GetAwaiter().GetResult(), task3.GetAwaiter().GetResult(), task4.GetAwaiter().GetResult(), task5.GetAwaiter().GetResult(), task6.GetAwaiter().GetResult(), task7.GetAwaiter().GetResult(), task8.GetAwaiter().GetResult()));\n            }\n\n            return new UniTask<(T1, T2, T3, T4, T5, T6, T7, T8)>(new WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8>(task1, task2, task3, task4, task5, task6, task7, task8), 0);\n        }\n\n        sealed class WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8> : IUniTaskSource<(T1, T2, T3, T4, T5, T6, T7, T8)>\n        {\n            T1 t1 = default;\n            T2 t2 = default;\n            T3 t3 = default;\n            T4 t4 = default;\n            T5 t5 = default;\n            T6 t6 = default;\n            T7 t7 = default;\n            T8 t8 = default;\n            int completedCount;\n            UniTaskCompletionSourceCore<(T1, T2, T3, T4, T5, T6, T7, T8)> core;\n\n            public WhenAllPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task8.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT8(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8>, UniTask<T8>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT8(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t1 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 8)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t2 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 8)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t3 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 8)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t4 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 8)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t5 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 8)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t6 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 8)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t7 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 8)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8));\n                }\n            }\n\n            static void TryInvokeContinuationT8(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8> self, in UniTask<T8>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t8 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 8)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8));\n                }\n            }\n\n\n            public (T1, T2, T3, T4, T5, T6, T7, T8) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n        }\n        \n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9)\n        {\n            if (task1.Status.IsCompletedSuccessfully() && task2.Status.IsCompletedSuccessfully() && task3.Status.IsCompletedSuccessfully() && task4.Status.IsCompletedSuccessfully() && task5.Status.IsCompletedSuccessfully() && task6.Status.IsCompletedSuccessfully() && task7.Status.IsCompletedSuccessfully() && task8.Status.IsCompletedSuccessfully() && task9.Status.IsCompletedSuccessfully())\n            {\n                return new UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9)>((task1.GetAwaiter().GetResult(), task2.GetAwaiter().GetResult(), task3.GetAwaiter().GetResult(), task4.GetAwaiter().GetResult(), task5.GetAwaiter().GetResult(), task6.GetAwaiter().GetResult(), task7.GetAwaiter().GetResult(), task8.GetAwaiter().GetResult(), task9.GetAwaiter().GetResult()));\n            }\n\n            return new UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9)>(new WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>(task1, task2, task3, task4, task5, task6, task7, task8, task9), 0);\n        }\n\n        sealed class WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> : IUniTaskSource<(T1, T2, T3, T4, T5, T6, T7, T8, T9)>\n        {\n            T1 t1 = default;\n            T2 t2 = default;\n            T3 t3 = default;\n            T4 t4 = default;\n            T5 t5 = default;\n            T6 t6 = default;\n            T7 t7 = default;\n            T8 t8 = default;\n            T9 t9 = default;\n            int completedCount;\n            UniTaskCompletionSourceCore<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> core;\n\n            public WhenAllPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task8.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT8(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T8>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT8(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task9.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT9(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T9>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT9(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t1 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 9)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t2 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 9)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t3 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 9)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t4 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 9)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t5 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 9)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t6 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 9)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t7 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 9)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9));\n                }\n            }\n\n            static void TryInvokeContinuationT8(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T8>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t8 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 9)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9));\n                }\n            }\n\n            static void TryInvokeContinuationT9(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T9>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t9 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 9)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9));\n                }\n            }\n\n\n            public (T1, T2, T3, T4, T5, T6, T7, T8, T9) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n        }\n        \n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10)\n        {\n            if (task1.Status.IsCompletedSuccessfully() && task2.Status.IsCompletedSuccessfully() && task3.Status.IsCompletedSuccessfully() && task4.Status.IsCompletedSuccessfully() && task5.Status.IsCompletedSuccessfully() && task6.Status.IsCompletedSuccessfully() && task7.Status.IsCompletedSuccessfully() && task8.Status.IsCompletedSuccessfully() && task9.Status.IsCompletedSuccessfully() && task10.Status.IsCompletedSuccessfully())\n            {\n                return new UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)>((task1.GetAwaiter().GetResult(), task2.GetAwaiter().GetResult(), task3.GetAwaiter().GetResult(), task4.GetAwaiter().GetResult(), task5.GetAwaiter().GetResult(), task6.GetAwaiter().GetResult(), task7.GetAwaiter().GetResult(), task8.GetAwaiter().GetResult(), task9.GetAwaiter().GetResult(), task10.GetAwaiter().GetResult()));\n            }\n\n            return new UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)>(new WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(task1, task2, task3, task4, task5, task6, task7, task8, task9, task10), 0);\n        }\n\n        sealed class WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> : IUniTaskSource<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)>\n        {\n            T1 t1 = default;\n            T2 t2 = default;\n            T3 t3 = default;\n            T4 t4 = default;\n            T5 t5 = default;\n            T6 t6 = default;\n            T7 t7 = default;\n            T8 t8 = default;\n            T9 t9 = default;\n            T10 t10 = default;\n            int completedCount;\n            UniTaskCompletionSourceCore<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)> core;\n\n            public WhenAllPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task8.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT8(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T8>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT8(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task9.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT9(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T9>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT9(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task10.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT10(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T10>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT10(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t1 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 10)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t2 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 10)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t3 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 10)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t4 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 10)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t5 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 10)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t6 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 10)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t7 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 10)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10));\n                }\n            }\n\n            static void TryInvokeContinuationT8(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T8>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t8 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 10)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10));\n                }\n            }\n\n            static void TryInvokeContinuationT9(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T9>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t9 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 10)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10));\n                }\n            }\n\n            static void TryInvokeContinuationT10(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T10>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t10 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 10)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10));\n                }\n            }\n\n\n            public (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n        }\n        \n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11)\n        {\n            if (task1.Status.IsCompletedSuccessfully() && task2.Status.IsCompletedSuccessfully() && task3.Status.IsCompletedSuccessfully() && task4.Status.IsCompletedSuccessfully() && task5.Status.IsCompletedSuccessfully() && task6.Status.IsCompletedSuccessfully() && task7.Status.IsCompletedSuccessfully() && task8.Status.IsCompletedSuccessfully() && task9.Status.IsCompletedSuccessfully() && task10.Status.IsCompletedSuccessfully() && task11.Status.IsCompletedSuccessfully())\n            {\n                return new UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)>((task1.GetAwaiter().GetResult(), task2.GetAwaiter().GetResult(), task3.GetAwaiter().GetResult(), task4.GetAwaiter().GetResult(), task5.GetAwaiter().GetResult(), task6.GetAwaiter().GetResult(), task7.GetAwaiter().GetResult(), task8.GetAwaiter().GetResult(), task9.GetAwaiter().GetResult(), task10.GetAwaiter().GetResult(), task11.GetAwaiter().GetResult()));\n            }\n\n            return new UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)>(new WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(task1, task2, task3, task4, task5, task6, task7, task8, task9, task10, task11), 0);\n        }\n\n        sealed class WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> : IUniTaskSource<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)>\n        {\n            T1 t1 = default;\n            T2 t2 = default;\n            T3 t3 = default;\n            T4 t4 = default;\n            T5 t5 = default;\n            T6 t6 = default;\n            T7 t7 = default;\n            T8 t8 = default;\n            T9 t9 = default;\n            T10 t10 = default;\n            T11 t11 = default;\n            int completedCount;\n            UniTaskCompletionSourceCore<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)> core;\n\n            public WhenAllPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task8.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT8(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T8>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT8(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task9.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT9(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T9>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT9(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task10.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT10(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T10>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT10(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task11.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT11(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T11>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT11(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t1 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 11)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t2 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 11)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t3 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 11)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t4 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 11)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t5 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 11)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t6 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 11)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t7 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 11)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11));\n                }\n            }\n\n            static void TryInvokeContinuationT8(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T8>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t8 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 11)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11));\n                }\n            }\n\n            static void TryInvokeContinuationT9(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T9>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t9 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 11)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11));\n                }\n            }\n\n            static void TryInvokeContinuationT10(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T10>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t10 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 11)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11));\n                }\n            }\n\n            static void TryInvokeContinuationT11(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T11>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t11 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 11)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11));\n                }\n            }\n\n\n            public (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n        }\n        \n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12)\n        {\n            if (task1.Status.IsCompletedSuccessfully() && task2.Status.IsCompletedSuccessfully() && task3.Status.IsCompletedSuccessfully() && task4.Status.IsCompletedSuccessfully() && task5.Status.IsCompletedSuccessfully() && task6.Status.IsCompletedSuccessfully() && task7.Status.IsCompletedSuccessfully() && task8.Status.IsCompletedSuccessfully() && task9.Status.IsCompletedSuccessfully() && task10.Status.IsCompletedSuccessfully() && task11.Status.IsCompletedSuccessfully() && task12.Status.IsCompletedSuccessfully())\n            {\n                return new UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)>((task1.GetAwaiter().GetResult(), task2.GetAwaiter().GetResult(), task3.GetAwaiter().GetResult(), task4.GetAwaiter().GetResult(), task5.GetAwaiter().GetResult(), task6.GetAwaiter().GetResult(), task7.GetAwaiter().GetResult(), task8.GetAwaiter().GetResult(), task9.GetAwaiter().GetResult(), task10.GetAwaiter().GetResult(), task11.GetAwaiter().GetResult(), task12.GetAwaiter().GetResult()));\n            }\n\n            return new UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)>(new WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(task1, task2, task3, task4, task5, task6, task7, task8, task9, task10, task11, task12), 0);\n        }\n\n        sealed class WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> : IUniTaskSource<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)>\n        {\n            T1 t1 = default;\n            T2 t2 = default;\n            T3 t3 = default;\n            T4 t4 = default;\n            T5 t5 = default;\n            T6 t6 = default;\n            T7 t7 = default;\n            T8 t8 = default;\n            T9 t9 = default;\n            T10 t10 = default;\n            T11 t11 = default;\n            T12 t12 = default;\n            int completedCount;\n            UniTaskCompletionSourceCore<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)> core;\n\n            public WhenAllPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task8.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT8(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T8>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT8(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task9.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT9(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T9>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT9(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task10.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT10(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T10>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT10(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task11.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT11(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T11>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT11(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task12.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT12(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T12>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT12(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t1 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 12)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t2 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 12)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t3 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 12)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t4 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 12)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t5 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 12)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t6 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 12)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t7 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 12)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12));\n                }\n            }\n\n            static void TryInvokeContinuationT8(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T8>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t8 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 12)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12));\n                }\n            }\n\n            static void TryInvokeContinuationT9(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T9>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t9 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 12)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12));\n                }\n            }\n\n            static void TryInvokeContinuationT10(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T10>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t10 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 12)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12));\n                }\n            }\n\n            static void TryInvokeContinuationT11(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T11>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t11 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 12)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12));\n                }\n            }\n\n            static void TryInvokeContinuationT12(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T12>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t12 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 12)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12));\n                }\n            }\n\n\n            public (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n        }\n        \n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13)\n        {\n            if (task1.Status.IsCompletedSuccessfully() && task2.Status.IsCompletedSuccessfully() && task3.Status.IsCompletedSuccessfully() && task4.Status.IsCompletedSuccessfully() && task5.Status.IsCompletedSuccessfully() && task6.Status.IsCompletedSuccessfully() && task7.Status.IsCompletedSuccessfully() && task8.Status.IsCompletedSuccessfully() && task9.Status.IsCompletedSuccessfully() && task10.Status.IsCompletedSuccessfully() && task11.Status.IsCompletedSuccessfully() && task12.Status.IsCompletedSuccessfully() && task13.Status.IsCompletedSuccessfully())\n            {\n                return new UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)>((task1.GetAwaiter().GetResult(), task2.GetAwaiter().GetResult(), task3.GetAwaiter().GetResult(), task4.GetAwaiter().GetResult(), task5.GetAwaiter().GetResult(), task6.GetAwaiter().GetResult(), task7.GetAwaiter().GetResult(), task8.GetAwaiter().GetResult(), task9.GetAwaiter().GetResult(), task10.GetAwaiter().GetResult(), task11.GetAwaiter().GetResult(), task12.GetAwaiter().GetResult(), task13.GetAwaiter().GetResult()));\n            }\n\n            return new UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)>(new WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(task1, task2, task3, task4, task5, task6, task7, task8, task9, task10, task11, task12, task13), 0);\n        }\n\n        sealed class WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> : IUniTaskSource<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)>\n        {\n            T1 t1 = default;\n            T2 t2 = default;\n            T3 t3 = default;\n            T4 t4 = default;\n            T5 t5 = default;\n            T6 t6 = default;\n            T7 t7 = default;\n            T8 t8 = default;\n            T9 t9 = default;\n            T10 t10 = default;\n            T11 t11 = default;\n            T12 t12 = default;\n            T13 t13 = default;\n            int completedCount;\n            UniTaskCompletionSourceCore<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)> core;\n\n            public WhenAllPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task8.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT8(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T8>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT8(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task9.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT9(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T9>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT9(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task10.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT10(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T10>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT10(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task11.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT11(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T11>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT11(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task12.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT12(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T12>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT12(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task13.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT13(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T13>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT13(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t1 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 13)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t2 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 13)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t3 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 13)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t4 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 13)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t5 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 13)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t6 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 13)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t7 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 13)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13));\n                }\n            }\n\n            static void TryInvokeContinuationT8(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T8>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t8 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 13)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13));\n                }\n            }\n\n            static void TryInvokeContinuationT9(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T9>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t9 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 13)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13));\n                }\n            }\n\n            static void TryInvokeContinuationT10(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T10>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t10 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 13)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13));\n                }\n            }\n\n            static void TryInvokeContinuationT11(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T11>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t11 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 13)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13));\n                }\n            }\n\n            static void TryInvokeContinuationT12(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T12>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t12 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 13)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13));\n                }\n            }\n\n            static void TryInvokeContinuationT13(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T13>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t13 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 13)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13));\n                }\n            }\n\n\n            public (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n        }\n        \n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14)\n        {\n            if (task1.Status.IsCompletedSuccessfully() && task2.Status.IsCompletedSuccessfully() && task3.Status.IsCompletedSuccessfully() && task4.Status.IsCompletedSuccessfully() && task5.Status.IsCompletedSuccessfully() && task6.Status.IsCompletedSuccessfully() && task7.Status.IsCompletedSuccessfully() && task8.Status.IsCompletedSuccessfully() && task9.Status.IsCompletedSuccessfully() && task10.Status.IsCompletedSuccessfully() && task11.Status.IsCompletedSuccessfully() && task12.Status.IsCompletedSuccessfully() && task13.Status.IsCompletedSuccessfully() && task14.Status.IsCompletedSuccessfully())\n            {\n                return new UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)>((task1.GetAwaiter().GetResult(), task2.GetAwaiter().GetResult(), task3.GetAwaiter().GetResult(), task4.GetAwaiter().GetResult(), task5.GetAwaiter().GetResult(), task6.GetAwaiter().GetResult(), task7.GetAwaiter().GetResult(), task8.GetAwaiter().GetResult(), task9.GetAwaiter().GetResult(), task10.GetAwaiter().GetResult(), task11.GetAwaiter().GetResult(), task12.GetAwaiter().GetResult(), task13.GetAwaiter().GetResult(), task14.GetAwaiter().GetResult()));\n            }\n\n            return new UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)>(new WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(task1, task2, task3, task4, task5, task6, task7, task8, task9, task10, task11, task12, task13, task14), 0);\n        }\n\n        sealed class WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> : IUniTaskSource<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)>\n        {\n            T1 t1 = default;\n            T2 t2 = default;\n            T3 t3 = default;\n            T4 t4 = default;\n            T5 t5 = default;\n            T6 t6 = default;\n            T7 t7 = default;\n            T8 t8 = default;\n            T9 t9 = default;\n            T10 t10 = default;\n            T11 t11 = default;\n            T12 t12 = default;\n            T13 t13 = default;\n            T14 t14 = default;\n            int completedCount;\n            UniTaskCompletionSourceCore<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)> core;\n\n            public WhenAllPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task8.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT8(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T8>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT8(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task9.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT9(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T9>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT9(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task10.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT10(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T10>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT10(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task11.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT11(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T11>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT11(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task12.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT12(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T12>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT12(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task13.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT13(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T13>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT13(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task14.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT14(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T14>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT14(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t1 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 14)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t2 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 14)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t3 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 14)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t4 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 14)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t5 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 14)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t6 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 14)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t7 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 14)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14));\n                }\n            }\n\n            static void TryInvokeContinuationT8(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T8>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t8 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 14)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14));\n                }\n            }\n\n            static void TryInvokeContinuationT9(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T9>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t9 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 14)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14));\n                }\n            }\n\n            static void TryInvokeContinuationT10(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T10>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t10 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 14)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14));\n                }\n            }\n\n            static void TryInvokeContinuationT11(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T11>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t11 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 14)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14));\n                }\n            }\n\n            static void TryInvokeContinuationT12(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T12>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t12 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 14)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14));\n                }\n            }\n\n            static void TryInvokeContinuationT13(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T13>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t13 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 14)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14));\n                }\n            }\n\n            static void TryInvokeContinuationT14(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T14>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t14 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 14)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14));\n                }\n            }\n\n\n            public (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n        }\n        \n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14, UniTask<T15> task15)\n        {\n            if (task1.Status.IsCompletedSuccessfully() && task2.Status.IsCompletedSuccessfully() && task3.Status.IsCompletedSuccessfully() && task4.Status.IsCompletedSuccessfully() && task5.Status.IsCompletedSuccessfully() && task6.Status.IsCompletedSuccessfully() && task7.Status.IsCompletedSuccessfully() && task8.Status.IsCompletedSuccessfully() && task9.Status.IsCompletedSuccessfully() && task10.Status.IsCompletedSuccessfully() && task11.Status.IsCompletedSuccessfully() && task12.Status.IsCompletedSuccessfully() && task13.Status.IsCompletedSuccessfully() && task14.Status.IsCompletedSuccessfully() && task15.Status.IsCompletedSuccessfully())\n            {\n                return new UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)>((task1.GetAwaiter().GetResult(), task2.GetAwaiter().GetResult(), task3.GetAwaiter().GetResult(), task4.GetAwaiter().GetResult(), task5.GetAwaiter().GetResult(), task6.GetAwaiter().GetResult(), task7.GetAwaiter().GetResult(), task8.GetAwaiter().GetResult(), task9.GetAwaiter().GetResult(), task10.GetAwaiter().GetResult(), task11.GetAwaiter().GetResult(), task12.GetAwaiter().GetResult(), task13.GetAwaiter().GetResult(), task14.GetAwaiter().GetResult(), task15.GetAwaiter().GetResult()));\n            }\n\n            return new UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)>(new WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(task1, task2, task3, task4, task5, task6, task7, task8, task9, task10, task11, task12, task13, task14, task15), 0);\n        }\n\n        sealed class WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> : IUniTaskSource<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)>\n        {\n            T1 t1 = default;\n            T2 t2 = default;\n            T3 t3 = default;\n            T4 t4 = default;\n            T5 t5 = default;\n            T6 t6 = default;\n            T7 t7 = default;\n            T8 t8 = default;\n            T9 t9 = default;\n            T10 t10 = default;\n            T11 t11 = default;\n            T12 t12 = default;\n            T13 t13 = default;\n            T14 t14 = default;\n            T15 t15 = default;\n            int completedCount;\n            UniTaskCompletionSourceCore<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)> core;\n\n            public WhenAllPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14, UniTask<T15> task15)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task8.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT8(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T8>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT8(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task9.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT9(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T9>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT9(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task10.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT10(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T10>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT10(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task11.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT11(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T11>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT11(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task12.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT12(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T12>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT12(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task13.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT13(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T13>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT13(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task14.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT14(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T14>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT14(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task15.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT15(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T15>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT15(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t1 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 15)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14, self.t15));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t2 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 15)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14, self.t15));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t3 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 15)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14, self.t15));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t4 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 15)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14, self.t15));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t5 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 15)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14, self.t15));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t6 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 15)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14, self.t15));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t7 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 15)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14, self.t15));\n                }\n            }\n\n            static void TryInvokeContinuationT8(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T8>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t8 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 15)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14, self.t15));\n                }\n            }\n\n            static void TryInvokeContinuationT9(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T9>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t9 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 15)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14, self.t15));\n                }\n            }\n\n            static void TryInvokeContinuationT10(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T10>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t10 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 15)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14, self.t15));\n                }\n            }\n\n            static void TryInvokeContinuationT11(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T11>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t11 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 15)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14, self.t15));\n                }\n            }\n\n            static void TryInvokeContinuationT12(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T12>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t12 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 15)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14, self.t15));\n                }\n            }\n\n            static void TryInvokeContinuationT13(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T13>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t13 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 15)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14, self.t15));\n                }\n            }\n\n            static void TryInvokeContinuationT14(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T14>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t14 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 15)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14, self.t15));\n                }\n            }\n\n            static void TryInvokeContinuationT15(WhenAllPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T15>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t15 = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == 15)\n                {\n                    self.core.TrySetResult((self.t1, self.t2, self.t3, self.t4, self.t5, self.t6, self.t7, self.t8, self.t9, self.t10, self.t11, self.t12, self.t13, self.t14, self.t15));\n                }\n            }\n\n\n            public (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.WhenAll.Generated.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 5110117231c8a6d4095fd0cbd3f4c142\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.WhenAll.Generated.tt",
    "content": "﻿<#@ template debug=\"false\" hostspecific=\"false\" language=\"C#\" #>\n<#@ assembly name=\"System.Core\" #>\n<#@ import namespace=\"System.Linq\" #>\n<#@ import namespace=\"System.Text\" #>\n<#@ import namespace=\"System.Collections.Generic\" #>\n<#@ output extension=\".cs\" #>\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\nusing System;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.ExceptionServices;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public partial struct UniTask\n    {\n<# for(var i = 2; i <= 15; i++ ) {\n    var range = Enumerable.Range(1, i);\n    var t = string.Join(\", \", range.Select(x => \"T\" + x));\n    var args = string.Join(\", \", range.Select(x => $\"UniTask<T{x}> task{x}\"));\n    var targs = string.Join(\", \", range.Select(x => $\"task{x}\"));\n    var tresult = string.Join(\", \", range.Select(x => $\"task{x}.GetAwaiter().GetResult()\"));\n    var completedSuccessfullyAnd = string.Join(\" && \", range.Select(x => $\"task{x}.Status.IsCompletedSuccessfully()\"));\n    var tfield = string.Join(\", \", range.Select(x => $\"self.t{x}\"));\n#>\n        \n        public static UniTask<(<#= t #>)> WhenAll<<#= t #>>(<#= args #>)\n        {\n            if (<#= completedSuccessfullyAnd #>)\n            {\n                return new UniTask<(<#= t #>)>((<#= tresult #>));\n            }\n\n            return new UniTask<(<#= t #>)>(new WhenAllPromise<<#= t #>>(<#= targs #>), 0);\n        }\n\n        sealed class WhenAllPromise<<#= t #>> : IUniTaskSource<(<#= t #>)>\n        {\n<# for(var j = 1; j <= i; j++) { #>\n            T<#= j #> t<#= j #> = default;\n<# } #>\n            int completedCount;\n            UniTaskCompletionSourceCore<(<#= t #>)> core;\n\n            public WhenAllPromise(<#= args #>)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n<# for(var j = 1; j <= i; j++) { #>\n                {\n                    var awaiter = task<#= j #>.GetAwaiter();\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT<#= j #>(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<<#= t #>>, UniTask<T<#= j #>>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT<#= j #>(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n<# } #>\n            }\n\n<# for(var j = 1; j <= i; j++) { #>\n            static void TryInvokeContinuationT<#= j #>(WhenAllPromise<<#= t #>> self, in UniTask<T<#= j #>>.Awaiter awaiter)\n            {\n                try\n                {\n                    self.t<#= j #> = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n                \n                if (Interlocked.Increment(ref self.completedCount) == <#= i #>)\n                {\n                    self.core.TrySetResult((<#= tfield #>));\n                }\n            }\n\n<# } #>\n\n            public (<#= t #>) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n        }\n<# } #>\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.WhenAll.Generated.tt.meta",
    "content": "fileFormatVersion: 2\nguid: 2c2ecfd98ee1b9a4c9fae1b398c32d75\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.WhenAll.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public partial struct UniTask\n    {\n        public static UniTask<T[]> WhenAll<T>(params UniTask<T>[] tasks)\n        {\n            if (tasks.Length == 0)\n            {\n                return UniTask.FromResult(Array.Empty<T>());\n            }\n\n            return new UniTask<T[]>(new WhenAllPromise<T>(tasks, tasks.Length), 0);\n        }\n\n        public static UniTask<T[]> WhenAll<T>(IEnumerable<UniTask<T>> tasks)\n        {\n            using (var span = ArrayPoolUtil.Materialize(tasks))\n            {\n                var promise = new WhenAllPromise<T>(span.Array, span.Length); // consumed array in constructor.\n                return new UniTask<T[]>(promise, 0);\n            }\n        }\n\n        public static UniTask WhenAll(params UniTask[] tasks)\n        {\n            if (tasks.Length == 0)\n            {\n                return UniTask.CompletedTask;\n            }\n\n            return new UniTask(new WhenAllPromise(tasks, tasks.Length), 0);\n        }\n\n        public static UniTask WhenAll(IEnumerable<UniTask> tasks)\n        {\n            using (var span = ArrayPoolUtil.Materialize(tasks))\n            {\n                var promise = new WhenAllPromise(span.Array, span.Length); // consumed array in constructor.\n                return new UniTask(promise, 0);\n            }\n        }\n\n        sealed class WhenAllPromise<T> : IUniTaskSource<T[]>\n        {\n            T[] result;\n            int completeCount;\n            UniTaskCompletionSourceCore<T[]> core; // don't reset(called after GetResult, will invoke TrySetException.)\n\n            public WhenAllPromise(UniTask<T>[] tasks, int tasksLength)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completeCount = 0;\n\n                if (tasksLength == 0)\n                {\n                    this.result = Array.Empty<T>();\n                    core.TrySetResult(result);\n                    return;\n                }\n\n                this.result = new T[tasksLength];\n\n                for (int i = 0; i < tasksLength; i++)\n                {\n                    UniTask<T>.Awaiter awaiter;\n                    try\n                    {\n                        awaiter = tasks[i].GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        core.TrySetException(ex);\n                        continue;\n                    }\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuation(this, awaiter, i);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise<T>, UniTask<T>.Awaiter, int>)state)\n                            {\n                                TryInvokeContinuation(t.Item1, t.Item2, t.Item3);\n                            }\n                        }, StateTuple.Create(this, awaiter, i));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuation(WhenAllPromise<T> self, in UniTask<T>.Awaiter awaiter, int i)\n            {\n                try\n                {\n                    self.result[i] = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completeCount) == self.result.Length)\n                {\n                    self.core.TrySetResult(self.result);\n                }\n            }\n\n            public T[] GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n        }\n\n        sealed class WhenAllPromise : IUniTaskSource\n        {\n            int completeCount;\n            int tasksLength;\n            UniTaskCompletionSourceCore<AsyncUnit> core; // don't reset(called after GetResult, will invoke TrySetException.)\n\n            public WhenAllPromise(UniTask[] tasks, int tasksLength)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.tasksLength = tasksLength;\n                this.completeCount = 0;\n\n                if (tasksLength == 0)\n                {\n                    core.TrySetResult(AsyncUnit.Default);\n                    return;\n                }\n\n                for (int i = 0; i < tasksLength; i++)\n                {\n                    UniTask.Awaiter awaiter;\n                    try\n                    {\n                        awaiter = tasks[i].GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        core.TrySetException(ex);\n                        continue;\n                    }\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuation(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAllPromise, UniTask.Awaiter>)state)\n                            {\n                                TryInvokeContinuation(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuation(WhenAllPromise self, in UniTask.Awaiter awaiter)\n            {\n                try\n                {\n                    awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completeCount) == self.tasksLength)\n                {\n                    self.core.TrySetResult(AsyncUnit.Default);\n                }\n            }\n\n            public void GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.WhenAll.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 355997a305ba64248822eec34998a1a0\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.WhenAny.Generated.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\nusing System;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.ExceptionServices;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public partial struct UniTask\n    {\n        public static UniTask<(int winArgumentIndex, T1 result1, T2 result2)> WhenAny<T1, T2>(UniTask<T1> task1, UniTask<T2> task2)\n        {\n            return new UniTask<(int winArgumentIndex, T1 result1, T2 result2)>(new WhenAnyPromise<T1, T2>(task1, task2), 0);\n        }\n\n        sealed class WhenAnyPromise<T1, T2> : IUniTaskSource<(int, T1 result1, T2 result2)>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<(int, T1 result1, T2 result2)> core;\n\n            public WhenAnyPromise(UniTask<T1> task1, UniTask<T2> task2)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAnyPromise<T1, T2> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                T1 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((0, result, default));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAnyPromise<T1, T2> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                T2 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((1, default, result));\n                }\n            }\n\n\n            public (int, T1 result1, T2 result2) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n        public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3)> WhenAny<T1, T2, T3>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3)\n        {\n            return new UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3)>(new WhenAnyPromise<T1, T2, T3>(task1, task2, task3), 0);\n        }\n\n        sealed class WhenAnyPromise<T1, T2, T3> : IUniTaskSource<(int, T1 result1, T2 result2, T3 result3)>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<(int, T1 result1, T2 result2, T3 result3)> core;\n\n            public WhenAnyPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAnyPromise<T1, T2, T3> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                T1 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((0, result, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAnyPromise<T1, T2, T3> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                T2 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((1, default, result, default));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAnyPromise<T1, T2, T3> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                T3 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((2, default, default, result));\n                }\n            }\n\n\n            public (int, T1 result1, T2 result2, T3 result3) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n        public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4)> WhenAny<T1, T2, T3, T4>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4)\n        {\n            return new UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4)>(new WhenAnyPromise<T1, T2, T3, T4>(task1, task2, task3, task4), 0);\n        }\n\n        sealed class WhenAnyPromise<T1, T2, T3, T4> : IUniTaskSource<(int, T1 result1, T2 result2, T3 result3, T4 result4)>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<(int, T1 result1, T2 result2, T3 result3, T4 result4)> core;\n\n            public WhenAnyPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAnyPromise<T1, T2, T3, T4> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                T1 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((0, result, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAnyPromise<T1, T2, T3, T4> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                T2 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((1, default, result, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAnyPromise<T1, T2, T3, T4> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                T3 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((2, default, default, result, default));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAnyPromise<T1, T2, T3, T4> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                T4 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((3, default, default, default, result));\n                }\n            }\n\n\n            public (int, T1 result1, T2 result2, T3 result3, T4 result4) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n        public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5)> WhenAny<T1, T2, T3, T4, T5>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5)\n        {\n            return new UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5)>(new WhenAnyPromise<T1, T2, T3, T4, T5>(task1, task2, task3, task4, task5), 0);\n        }\n\n        sealed class WhenAnyPromise<T1, T2, T3, T4, T5> : IUniTaskSource<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5)>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5)> core;\n\n            public WhenAnyPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAnyPromise<T1, T2, T3, T4, T5> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                T1 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((0, result, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAnyPromise<T1, T2, T3, T4, T5> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                T2 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((1, default, result, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAnyPromise<T1, T2, T3, T4, T5> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                T3 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((2, default, default, result, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAnyPromise<T1, T2, T3, T4, T5> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                T4 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((3, default, default, default, result, default));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAnyPromise<T1, T2, T3, T4, T5> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                T5 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((4, default, default, default, default, result));\n                }\n            }\n\n\n            public (int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n        public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6)> WhenAny<T1, T2, T3, T4, T5, T6>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6)\n        {\n            return new UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6)>(new WhenAnyPromise<T1, T2, T3, T4, T5, T6>(task1, task2, task3, task4, task5, task6), 0);\n        }\n\n        sealed class WhenAnyPromise<T1, T2, T3, T4, T5, T6> : IUniTaskSource<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6)>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6)> core;\n\n            public WhenAnyPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAnyPromise<T1, T2, T3, T4, T5, T6> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                T1 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((0, result, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAnyPromise<T1, T2, T3, T4, T5, T6> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                T2 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((1, default, result, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAnyPromise<T1, T2, T3, T4, T5, T6> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                T3 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((2, default, default, result, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAnyPromise<T1, T2, T3, T4, T5, T6> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                T4 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((3, default, default, default, result, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAnyPromise<T1, T2, T3, T4, T5, T6> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                T5 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((4, default, default, default, default, result, default));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAnyPromise<T1, T2, T3, T4, T5, T6> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                T6 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((5, default, default, default, default, default, result));\n                }\n            }\n\n\n            public (int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n        public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7)> WhenAny<T1, T2, T3, T4, T5, T6, T7>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7)\n        {\n            return new UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7)>(new WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7>(task1, task2, task3, task4, task5, task6, task7), 0);\n        }\n\n        sealed class WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7> : IUniTaskSource<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7)>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7)> core;\n\n            public WhenAnyPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                T1 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((0, result, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                T2 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((1, default, result, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                T3 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((2, default, default, result, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                T4 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((3, default, default, default, result, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                T5 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((4, default, default, default, default, result, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                T6 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((5, default, default, default, default, default, result, default));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                T7 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((6, default, default, default, default, default, default, result));\n                }\n            }\n\n\n            public (int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n        public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8)\n        {\n            return new UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8)>(new WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8>(task1, task2, task3, task4, task5, task6, task7, task8), 0);\n        }\n\n        sealed class WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8> : IUniTaskSource<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8)>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8)> core;\n\n            public WhenAnyPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task8.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT8(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8>, UniTask<T8>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT8(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                T1 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((0, result, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                T2 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((1, default, result, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                T3 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((2, default, default, result, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                T4 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((3, default, default, default, result, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                T5 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((4, default, default, default, default, result, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                T6 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((5, default, default, default, default, default, result, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                T7 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((6, default, default, default, default, default, default, result, default));\n                }\n            }\n\n            static void TryInvokeContinuationT8(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8> self, in UniTask<T8>.Awaiter awaiter)\n            {\n                T8 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((7, default, default, default, default, default, default, default, result));\n                }\n            }\n\n\n            public (int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n        public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9)\n        {\n            return new UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9)>(new WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>(task1, task2, task3, task4, task5, task6, task7, task8, task9), 0);\n        }\n\n        sealed class WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> : IUniTaskSource<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9)>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9)> core;\n\n            public WhenAnyPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task8.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT8(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T8>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT8(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task9.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT9(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9>, UniTask<T9>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT9(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                T1 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((0, result, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                T2 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((1, default, result, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                T3 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((2, default, default, result, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                T4 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((3, default, default, default, result, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                T5 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((4, default, default, default, default, result, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                T6 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((5, default, default, default, default, default, result, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                T7 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((6, default, default, default, default, default, default, result, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT8(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T8>.Awaiter awaiter)\n            {\n                T8 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((7, default, default, default, default, default, default, default, result, default));\n                }\n            }\n\n            static void TryInvokeContinuationT9(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9> self, in UniTask<T9>.Awaiter awaiter)\n            {\n                T9 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((8, default, default, default, default, default, default, default, default, result));\n                }\n            }\n\n\n            public (int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n        public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10)\n        {\n            return new UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10)>(new WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(task1, task2, task3, task4, task5, task6, task7, task8, task9, task10), 0);\n        }\n\n        sealed class WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> : IUniTaskSource<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10)>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10)> core;\n\n            public WhenAnyPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task8.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT8(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T8>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT8(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task9.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT9(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T9>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT9(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task10.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT10(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, UniTask<T10>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT10(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                T1 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((0, result, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                T2 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((1, default, result, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                T3 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((2, default, default, result, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                T4 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((3, default, default, default, result, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                T5 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((4, default, default, default, default, result, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                T6 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((5, default, default, default, default, default, result, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                T7 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((6, default, default, default, default, default, default, result, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT8(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T8>.Awaiter awaiter)\n            {\n                T8 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((7, default, default, default, default, default, default, default, result, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT9(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T9>.Awaiter awaiter)\n            {\n                T9 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((8, default, default, default, default, default, default, default, default, result, default));\n                }\n            }\n\n            static void TryInvokeContinuationT10(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> self, in UniTask<T10>.Awaiter awaiter)\n            {\n                T10 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((9, default, default, default, default, default, default, default, default, default, result));\n                }\n            }\n\n\n            public (int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n        public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11)\n        {\n            return new UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11)>(new WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(task1, task2, task3, task4, task5, task6, task7, task8, task9, task10, task11), 0);\n        }\n\n        sealed class WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> : IUniTaskSource<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11)>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11)> core;\n\n            public WhenAnyPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task8.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT8(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T8>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT8(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task9.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT9(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T9>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT9(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task10.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT10(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T10>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT10(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task11.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT11(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, UniTask<T11>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT11(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                T1 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((0, result, default, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                T2 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((1, default, result, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                T3 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((2, default, default, result, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                T4 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((3, default, default, default, result, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                T5 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((4, default, default, default, default, result, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                T6 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((5, default, default, default, default, default, result, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                T7 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((6, default, default, default, default, default, default, result, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT8(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T8>.Awaiter awaiter)\n            {\n                T8 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((7, default, default, default, default, default, default, default, result, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT9(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T9>.Awaiter awaiter)\n            {\n                T9 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((8, default, default, default, default, default, default, default, default, result, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT10(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T10>.Awaiter awaiter)\n            {\n                T10 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((9, default, default, default, default, default, default, default, default, default, result, default));\n                }\n            }\n\n            static void TryInvokeContinuationT11(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> self, in UniTask<T11>.Awaiter awaiter)\n            {\n                T11 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((10, default, default, default, default, default, default, default, default, default, default, result));\n                }\n            }\n\n\n            public (int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n        public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12)\n        {\n            return new UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12)>(new WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(task1, task2, task3, task4, task5, task6, task7, task8, task9, task10, task11, task12), 0);\n        }\n\n        sealed class WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> : IUniTaskSource<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12)>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12)> core;\n\n            public WhenAnyPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task8.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT8(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T8>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT8(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task9.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT9(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T9>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT9(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task10.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT10(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T10>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT10(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task11.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT11(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T11>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT11(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task12.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT12(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, UniTask<T12>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT12(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                T1 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((0, result, default, default, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                T2 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((1, default, result, default, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                T3 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((2, default, default, result, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                T4 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((3, default, default, default, result, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                T5 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((4, default, default, default, default, result, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                T6 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((5, default, default, default, default, default, result, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                T7 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((6, default, default, default, default, default, default, result, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT8(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T8>.Awaiter awaiter)\n            {\n                T8 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((7, default, default, default, default, default, default, default, result, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT9(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T9>.Awaiter awaiter)\n            {\n                T9 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((8, default, default, default, default, default, default, default, default, result, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT10(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T10>.Awaiter awaiter)\n            {\n                T10 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((9, default, default, default, default, default, default, default, default, default, result, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT11(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T11>.Awaiter awaiter)\n            {\n                T11 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((10, default, default, default, default, default, default, default, default, default, default, result, default));\n                }\n            }\n\n            static void TryInvokeContinuationT12(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> self, in UniTask<T12>.Awaiter awaiter)\n            {\n                T12 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((11, default, default, default, default, default, default, default, default, default, default, default, result));\n                }\n            }\n\n\n            public (int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n        public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13)\n        {\n            return new UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13)>(new WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(task1, task2, task3, task4, task5, task6, task7, task8, task9, task10, task11, task12, task13), 0);\n        }\n\n        sealed class WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> : IUniTaskSource<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13)>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13)> core;\n\n            public WhenAnyPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task8.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT8(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T8>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT8(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task9.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT9(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T9>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT9(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task10.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT10(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T10>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT10(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task11.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT11(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T11>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT11(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task12.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT12(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T12>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT12(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task13.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT13(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, UniTask<T13>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT13(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                T1 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((0, result, default, default, default, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                T2 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((1, default, result, default, default, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                T3 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((2, default, default, result, default, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                T4 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((3, default, default, default, result, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                T5 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((4, default, default, default, default, result, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                T6 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((5, default, default, default, default, default, result, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                T7 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((6, default, default, default, default, default, default, result, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT8(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T8>.Awaiter awaiter)\n            {\n                T8 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((7, default, default, default, default, default, default, default, result, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT9(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T9>.Awaiter awaiter)\n            {\n                T9 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((8, default, default, default, default, default, default, default, default, result, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT10(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T10>.Awaiter awaiter)\n            {\n                T10 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((9, default, default, default, default, default, default, default, default, default, result, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT11(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T11>.Awaiter awaiter)\n            {\n                T11 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((10, default, default, default, default, default, default, default, default, default, default, result, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT12(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T12>.Awaiter awaiter)\n            {\n                T12 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((11, default, default, default, default, default, default, default, default, default, default, default, result, default));\n                }\n            }\n\n            static void TryInvokeContinuationT13(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> self, in UniTask<T13>.Awaiter awaiter)\n            {\n                T13 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((12, default, default, default, default, default, default, default, default, default, default, default, default, result));\n                }\n            }\n\n\n            public (int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n        public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13, T14 result14)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14)\n        {\n            return new UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13, T14 result14)>(new WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(task1, task2, task3, task4, task5, task6, task7, task8, task9, task10, task11, task12, task13, task14), 0);\n        }\n\n        sealed class WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> : IUniTaskSource<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13, T14 result14)>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13, T14 result14)> core;\n\n            public WhenAnyPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task8.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT8(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T8>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT8(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task9.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT9(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T9>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT9(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task10.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT10(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T10>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT10(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task11.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT11(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T11>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT11(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task12.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT12(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T12>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT12(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task13.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT13(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T13>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT13(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task14.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT14(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, UniTask<T14>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT14(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                T1 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((0, result, default, default, default, default, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                T2 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((1, default, result, default, default, default, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                T3 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((2, default, default, result, default, default, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                T4 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((3, default, default, default, result, default, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                T5 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((4, default, default, default, default, result, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                T6 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((5, default, default, default, default, default, result, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                T7 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((6, default, default, default, default, default, default, result, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT8(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T8>.Awaiter awaiter)\n            {\n                T8 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((7, default, default, default, default, default, default, default, result, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT9(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T9>.Awaiter awaiter)\n            {\n                T9 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((8, default, default, default, default, default, default, default, default, result, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT10(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T10>.Awaiter awaiter)\n            {\n                T10 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((9, default, default, default, default, default, default, default, default, default, result, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT11(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T11>.Awaiter awaiter)\n            {\n                T11 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((10, default, default, default, default, default, default, default, default, default, default, result, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT12(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T12>.Awaiter awaiter)\n            {\n                T12 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((11, default, default, default, default, default, default, default, default, default, default, default, result, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT13(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T13>.Awaiter awaiter)\n            {\n                T13 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((12, default, default, default, default, default, default, default, default, default, default, default, default, result, default));\n                }\n            }\n\n            static void TryInvokeContinuationT14(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> self, in UniTask<T14>.Awaiter awaiter)\n            {\n                T14 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((13, default, default, default, default, default, default, default, default, default, default, default, default, default, result));\n                }\n            }\n\n\n            public (int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13, T14 result14) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n        public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13, T14 result14, T15 result15)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14, UniTask<T15> task15)\n        {\n            return new UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13, T14 result14, T15 result15)>(new WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(task1, task2, task3, task4, task5, task6, task7, task8, task9, task10, task11, task12, task13, task14, task15), 0);\n        }\n\n        sealed class WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> : IUniTaskSource<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13, T14 result14, T15 result15)>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<(int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13, T14 result14, T15 result15)> core;\n\n            public WhenAnyPromise(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14, UniTask<T15> task15)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n                {\n                    var awaiter = task1.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT1(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T1>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT1(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task2.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT2(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T2>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT2(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task3.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT3(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T3>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT3(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task4.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT4(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T4>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT4(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task5.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT5(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T5>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT5(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task6.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT6(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T6>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT6(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task7.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT7(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T7>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT7(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task8.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT8(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T8>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT8(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task9.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT9(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T9>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT9(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task10.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT10(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T10>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT10(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task11.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT11(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T11>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT11(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task12.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT12(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T12>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT12(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task13.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT13(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T13>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT13(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task14.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT14(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T14>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT14(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                {\n                    var awaiter = task15.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT15(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, UniTask<T15>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT15(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuationT1(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T1>.Awaiter awaiter)\n            {\n                T1 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((0, result, default, default, default, default, default, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT2(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T2>.Awaiter awaiter)\n            {\n                T2 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((1, default, result, default, default, default, default, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT3(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T3>.Awaiter awaiter)\n            {\n                T3 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((2, default, default, result, default, default, default, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT4(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T4>.Awaiter awaiter)\n            {\n                T4 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((3, default, default, default, result, default, default, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT5(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T5>.Awaiter awaiter)\n            {\n                T5 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((4, default, default, default, default, result, default, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT6(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T6>.Awaiter awaiter)\n            {\n                T6 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((5, default, default, default, default, default, result, default, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT7(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T7>.Awaiter awaiter)\n            {\n                T7 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((6, default, default, default, default, default, default, result, default, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT8(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T8>.Awaiter awaiter)\n            {\n                T8 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((7, default, default, default, default, default, default, default, result, default, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT9(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T9>.Awaiter awaiter)\n            {\n                T9 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((8, default, default, default, default, default, default, default, default, result, default, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT10(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T10>.Awaiter awaiter)\n            {\n                T10 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((9, default, default, default, default, default, default, default, default, default, result, default, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT11(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T11>.Awaiter awaiter)\n            {\n                T11 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((10, default, default, default, default, default, default, default, default, default, default, result, default, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT12(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T12>.Awaiter awaiter)\n            {\n                T12 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((11, default, default, default, default, default, default, default, default, default, default, default, result, default, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT13(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T13>.Awaiter awaiter)\n            {\n                T13 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((12, default, default, default, default, default, default, default, default, default, default, default, default, result, default, default));\n                }\n            }\n\n            static void TryInvokeContinuationT14(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T14>.Awaiter awaiter)\n            {\n                T14 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((13, default, default, default, default, default, default, default, default, default, default, default, default, default, result, default));\n                }\n            }\n\n            static void TryInvokeContinuationT15(WhenAnyPromise<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> self, in UniTask<T15>.Awaiter awaiter)\n            {\n                T15 result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((14, default, default, default, default, default, default, default, default, default, default, default, default, default, default, result));\n                }\n            }\n\n\n            public (int, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13, T14 result14, T15 result15) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.WhenAny.Generated.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 13d604ac281570c4eac9962429f19ca9\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.WhenAny.Generated.tt",
    "content": "﻿<#@ template debug=\"false\" hostspecific=\"false\" language=\"C#\" #>\n<#@ assembly name=\"System.Core\" #>\n<#@ import namespace=\"System.Linq\" #>\n<#@ import namespace=\"System.Text\" #>\n<#@ import namespace=\"System.Collections.Generic\" #>\n<#@ output extension=\".cs\" #>\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\nusing System;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.ExceptionServices;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public partial struct UniTask\n    {\n<# for(var i = 2; i <= 15; i++ ) {\n    var range = Enumerable.Range(1, i);\n    var t = string.Join(\", \", range.Select(x => \"T\" + x));\n    var args = string.Join(\", \", range.Select(x => $\"UniTask<T{x}> task{x}\"));\n    var targs = string.Join(\", \", range.Select(x => $\"task{x}\"));\n    var tresult = string.Join(\", \", range.Select(x => $\"task{x}.GetAwaiter().GetResult()\"));\n    var tBool = string.Join(\", \", range.Select(x => $\"T{x} result{x}\"));\n    var tfield = string.Join(\", \", range.Select(x => $\"self.t{x}\"));\n    Func<int, string> getResult = j => string.Join(\", \", range.Select(x => (x == j) ? \"result\" : \"default\"));\n#>\n        public static UniTask<(int winArgumentIndex, <#= tBool #>)> WhenAny<<#= t #>>(<#= args #>)\n        {\n            return new UniTask<(int winArgumentIndex, <#= tBool #>)>(new WhenAnyPromise<<#= t #>>(<#= targs #>), 0);\n        }\n\n        sealed class WhenAnyPromise<<#= t #>> : IUniTaskSource<(int, <#= tBool #>)>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<(int, <#= tBool #>)> core;\n\n            public WhenAnyPromise(<#= args #>)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                this.completedCount = 0;\n<# for(var j = 1; j <= i; j++) { #>\n                {\n                    var awaiter = task<#= j #>.GetAwaiter();\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuationT<#= j #>(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<<#= t #>>, UniTask<T<#= j #>>.Awaiter>)state)\n                            {\n                                TryInvokeContinuationT<#= j #>(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n<# } #>\n            }\n\n<# for(var j = 1; j <= i; j++) { #>\n            static void TryInvokeContinuationT<#= j #>(WhenAnyPromise<<#= t #>> self, in UniTask<T<#= j #>>.Awaiter awaiter)\n            {\n                T<#= j #> result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((<#= j - 1 #>, <#= getResult(j) #>));\n                }\n            }\n\n<# } #>\n\n            public (int, <#= tBool #>) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n<# } #>\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.WhenAny.Generated.tt.meta",
    "content": "fileFormatVersion: 2\nguid: 71c2c0bce7543454c8ef545083e18170\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.WhenAny.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public partial struct UniTask\n    {\n        public static UniTask<(bool hasResultLeft, T result)> WhenAny<T>(UniTask<T> leftTask, UniTask rightTask)\n        {\n            return new UniTask<(bool, T)>(new WhenAnyLRPromise<T>(leftTask, rightTask), 0);\n        }\n\n        public static UniTask<(int winArgumentIndex, T result)> WhenAny<T>(params UniTask<T>[] tasks)\n        {\n            return new UniTask<(int, T)>(new WhenAnyPromise<T>(tasks, tasks.Length), 0);\n        }\n\n        public static UniTask<(int winArgumentIndex, T result)> WhenAny<T>(IEnumerable<UniTask<T>> tasks)\n        {\n            using (var span = ArrayPoolUtil.Materialize(tasks))\n            {\n                return new UniTask<(int, T)>(new WhenAnyPromise<T>(span.Array, span.Length), 0);\n            }\n        }\n\n        /// <summary>Return value is winArgumentIndex</summary>\n        public static UniTask<int> WhenAny(params UniTask[] tasks)\n        {\n            return new UniTask<int>(new WhenAnyPromise(tasks, tasks.Length), 0);\n        }\n\n        /// <summary>Return value is winArgumentIndex</summary>\n        public static UniTask<int> WhenAny(IEnumerable<UniTask> tasks)\n        {\n            using (var span = ArrayPoolUtil.Materialize(tasks))\n            {\n                return new UniTask<int>(new WhenAnyPromise(span.Array, span.Length), 0);\n            }\n        }\n\n        sealed class WhenAnyLRPromise<T> : IUniTaskSource<(bool, T)>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<(bool, T)> core;\n\n            public WhenAnyLRPromise(UniTask<T> leftTask, UniTask rightTask)\n            {\n                TaskTracker.TrackActiveTask(this, 3);\n\n                {\n                    UniTask<T>.Awaiter awaiter;\n                    try\n                    {\n                        awaiter = leftTask.GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        core.TrySetException(ex);\n                        goto RIGHT;\n                    }\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryLeftInvokeContinuation(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyLRPromise<T>, UniTask<T>.Awaiter>)state)\n                            {\n                                TryLeftInvokeContinuation(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n                RIGHT:\n                {\n                    UniTask.Awaiter awaiter;\n                    try\n                    {\n                        awaiter = rightTask.GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        core.TrySetException(ex);\n                        return;\n                    }\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryRightInvokeContinuation(this, awaiter);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyLRPromise<T>, UniTask.Awaiter>)state)\n                            {\n                                TryRightInvokeContinuation(t.Item1, t.Item2);\n                            }\n                        }, StateTuple.Create(this, awaiter));\n                    }\n                }\n            }\n\n            static void TryLeftInvokeContinuation(WhenAnyLRPromise<T> self, in UniTask<T>.Awaiter awaiter)\n            {\n                T result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((true, result));\n                }\n            }\n\n            static void TryRightInvokeContinuation(WhenAnyLRPromise<T> self, in UniTask.Awaiter awaiter)\n            {\n                try\n                {\n                    awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((false, default));\n                }\n            }\n\n            public (bool, T) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n\n        sealed class WhenAnyPromise<T> : IUniTaskSource<(int, T)>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<(int, T)> core;\n\n            public WhenAnyPromise(UniTask<T>[] tasks, int tasksLength)\n            {\n                if (tasksLength == 0)\n                {\n                    throw new ArgumentException(\"The tasks argument contains no tasks.\");\n                }\n\n                TaskTracker.TrackActiveTask(this, 3);\n\n                for (int i = 0; i < tasksLength; i++)\n                {\n                    UniTask<T>.Awaiter awaiter;\n                    try\n                    {\n                        awaiter = tasks[i].GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        core.TrySetException(ex);\n                        continue; // consume others.\n                    }\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuation(this, awaiter, i);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise<T>, UniTask<T>.Awaiter, int>)state)\n                            {\n                                TryInvokeContinuation(t.Item1, t.Item2, t.Item3);\n                            }\n                        }, StateTuple.Create(this, awaiter, i));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuation(WhenAnyPromise<T> self, in UniTask<T>.Awaiter awaiter, int i)\n            {\n                T result;\n                try\n                {\n                    result = awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult((i, result));\n                }\n            }\n\n            public (int, T) GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n        sealed class WhenAnyPromise : IUniTaskSource<int>\n        {\n            int completedCount;\n            UniTaskCompletionSourceCore<int> core;\n\n            public WhenAnyPromise(UniTask[] tasks, int tasksLength)\n            {\n                if (tasksLength == 0)\n                {\n                    throw new ArgumentException(\"The tasks argument contains no tasks.\");\n                }\n\n                TaskTracker.TrackActiveTask(this, 3);\n\n                for (int i = 0; i < tasksLength; i++)\n                {\n                    UniTask.Awaiter awaiter;\n                    try\n                    {\n                        awaiter = tasks[i].GetAwaiter();\n                    }\n                    catch (Exception ex)\n                    {\n                        core.TrySetException(ex);\n                        continue; // consume others.\n                    }\n\n                    if (awaiter.IsCompleted)\n                    {\n                        TryInvokeContinuation(this, awaiter, i);\n                    }\n                    else\n                    {\n                        awaiter.SourceOnCompleted(state =>\n                        {\n                            using (var t = (StateTuple<WhenAnyPromise, UniTask.Awaiter, int>)state)\n                            {\n                                TryInvokeContinuation(t.Item1, t.Item2, t.Item3);\n                            }\n                        }, StateTuple.Create(this, awaiter, i));\n                    }\n                }\n            }\n\n            static void TryInvokeContinuation(WhenAnyPromise self, in UniTask.Awaiter awaiter, int i)\n            {\n                try\n                {\n                    awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    self.core.TrySetException(ex);\n                    return;\n                }\n\n                if (Interlocked.Increment(ref self.completedCount) == 1)\n                {\n                    self.core.TrySetResult(i);\n                }\n            }\n\n            public int GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                GC.SuppressFinalize(this);\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.WhenAny.cs.meta",
    "content": "fileFormatVersion: 2\nguid: c32578978c37eaf41bdd90e1b034637d\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.WhenEach.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Generic;\nusing System.Runtime.ExceptionServices;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public partial struct UniTask\n    {\n        public static IUniTaskAsyncEnumerable<WhenEachResult<T>> WhenEach<T>(IEnumerable<UniTask<T>> tasks)\n        {\n            return new WhenEachEnumerable<T>(tasks);\n        }\n\n        public static IUniTaskAsyncEnumerable<WhenEachResult<T>> WhenEach<T>(params UniTask<T>[] tasks)\n        {\n            return new WhenEachEnumerable<T>(tasks);\n        }\n    }\n\n    public readonly struct WhenEachResult<T>\n    {\n        public T Result { get; }\n        public Exception Exception { get; }\n\n        //[MemberNotNullWhen(false, nameof(Exception))]\n        public bool IsCompletedSuccessfully => Exception == null;\n\n        //[MemberNotNullWhen(true, nameof(Exception))]\n        public bool IsFaulted => Exception != null;\n\n        public WhenEachResult(T result)\n        {\n            this.Result = result;\n            this.Exception = null;\n        }\n\n        public WhenEachResult(Exception exception)\n        {\n            if (exception == null) throw new ArgumentNullException(nameof(exception));\n            this.Result = default;\n            this.Exception = exception;\n        }\n\n        public void TryThrow()\n        {\n            if (IsFaulted)\n            {\n                ExceptionDispatchInfo.Capture(Exception).Throw();\n            }\n        }\n\n        public T GetResult()\n        {\n            if (IsFaulted)\n            {\n                ExceptionDispatchInfo.Capture(Exception).Throw();\n            }\n            return Result;\n        }\n\n        public override string ToString()\n        {\n            if (IsCompletedSuccessfully)\n            {\n                return Result?.ToString() ?? \"\";\n            }\n            else\n            {\n                return $\"Exception{{{Exception.Message}}}\";\n            }\n        }\n    }\n\n    internal enum WhenEachState : byte\n    {\n        NotRunning,\n        Running,\n        Completed\n    }\n\n    internal sealed class WhenEachEnumerable<T> : IUniTaskAsyncEnumerable<WhenEachResult<T>>\n    {\n        IEnumerable<UniTask<T>> source;\n\n        public WhenEachEnumerable(IEnumerable<UniTask<T>> source)\n        {\n            this.source = source;\n        }\n\n        public IUniTaskAsyncEnumerator<WhenEachResult<T>> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new Enumerator(source, cancellationToken);\n        }\n\n        sealed class Enumerator : IUniTaskAsyncEnumerator<WhenEachResult<T>>\n        {\n            readonly IEnumerable<UniTask<T>> source;\n            CancellationToken cancellationToken;\n\n            Channel<WhenEachResult<T>> channel;\n            IUniTaskAsyncEnumerator<WhenEachResult<T>> channelEnumerator;\n            int completeCount;\n            WhenEachState state;\n\n            public Enumerator(IEnumerable<UniTask<T>> source, CancellationToken cancellationToken)\n            {\n                this.source = source;\n                this.cancellationToken = cancellationToken;\n            }\n\n            public WhenEachResult<T> Current => channelEnumerator.Current;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                if (state == WhenEachState.NotRunning)\n                {\n                    state = WhenEachState.Running;\n                    channel = Channel.CreateSingleConsumerUnbounded<WhenEachResult<T>>();\n                    channelEnumerator = channel.Reader.ReadAllAsync().GetAsyncEnumerator(cancellationToken);\n\n                    if (source is UniTask<T>[] array)\n                    {\n                        ConsumeAll(this, array, array.Length);\n                    }\n                    else\n                    {\n                        using (var rentArray = ArrayPoolUtil.Materialize(source))\n                        {\n                            ConsumeAll(this, rentArray.Array, rentArray.Length);\n                        }\n                    }\n                }\n\n                return channelEnumerator.MoveNextAsync();\n            }\n\n            static void ConsumeAll(Enumerator self, UniTask<T>[] array, int length)\n            {\n                for (int i = 0; i < length; i++)\n                {\n                    RunWhenEachTask(self, array[i], length).Forget();\n                }\n            }\n\n            static async UniTaskVoid RunWhenEachTask(Enumerator self, UniTask<T> task, int length)\n            {\n                try\n                {\n                    var result = await task;\n                    self.channel.Writer.TryWrite(new WhenEachResult<T>(result));\n                }\n                catch (Exception ex)\n                {\n                    self.channel.Writer.TryWrite(new WhenEachResult<T>(ex));\n                }\n\n                if (Interlocked.Increment(ref self.completeCount) == length)\n                {\n                    self.state = WhenEachState.Completed;\n                    self.channel.Writer.TryComplete();\n                }\n            }\n\n            public async UniTask DisposeAsync()\n            {\n                if (channelEnumerator != null)\n                {\n                    await channelEnumerator.DisposeAsync();\n                }\n\n                if (state != WhenEachState.Completed)\n                {\n                    state = WhenEachState.Completed;\n                    channel.Writer.TryComplete(new OperationCanceledException());\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.WhenEach.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 7cac24fdda5112047a1cd3dd66b542c4\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.asmdef",
    "content": "{\n    \"name\": \"UniTask\",\n    \"rootNamespace\": \"\",\n    \"references\": [],\n    \"includePlatforms\": [],\n    \"excludePlatforms\": [],\n    \"allowUnsafeCode\": false,\n    \"overrideReferences\": false,\n    \"precompiledReferences\": [],\n    \"autoReferenced\": true,\n    \"defineConstraints\": [],\n    \"versionDefines\": [\n        {\n            \"name\": \"com.unity.modules.assetbundle\",\n            \"expression\": \"\",\n            \"define\": \"UNITASK_ASSETBUNDLE_SUPPORT\"\n        },\n        {\n            \"name\": \"com.unity.modules.physics\",\n            \"expression\": \"\",\n            \"define\": \"UNITASK_PHYSICS_SUPPORT\"\n        },\n        {\n            \"name\": \"com.unity.modules.physics2d\",\n            \"expression\": \"\",\n            \"define\": \"UNITASK_PHYSICS2D_SUPPORT\"\n        },\n        {\n            \"name\": \"com.unity.modules.particlesystem\",\n            \"expression\": \"\",\n            \"define\": \"UNITASK_PARTICLESYSTEM_SUPPORT\"\n        },\n        {\n            \"name\": \"com.unity.ugui\",\n            \"expression\": \"\",\n            \"define\": \"UNITASK_UGUI_SUPPORT\"\n        },\n        {\n            \"name\": \"com.unity.modules.unitywebrequest\",\n            \"expression\": \"\",\n            \"define\": \"UNITASK_WEBREQUEST_SUPPORT\"\n        }\n    ],\n    \"noEngineReferences\": false\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.asmdef.meta",
    "content": "fileFormatVersion: 2\nguid: f51ebe6a0ceec4240a699833d6309b23\nAssemblyDefinitionImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n#pragma warning disable CS0436\n\n#if UNITASK_NETCORE || UNITY_2022_3_OR_NEWER\n#define SUPPORT_VALUETASK\n#endif\n\nusing Cysharp.Threading.Tasks.CompilerServices;\nusing System;\nusing System.Diagnostics;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.ExceptionServices;\nusing System.Runtime.InteropServices;\n\nnamespace Cysharp.Threading.Tasks\n{\n    internal static class AwaiterActions\n    {\n        internal static readonly Action<object> InvokeContinuationDelegate = Continuation;\n\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        static void Continuation(object state)\n        {\n            ((Action)state).Invoke();\n        }\n    }\n\n    /// <summary>\n    /// Lightweight unity specified task-like object.\n    /// </summary>\n    [AsyncMethodBuilder(typeof(AsyncUniTaskMethodBuilder))]\n    [StructLayout(LayoutKind.Auto)]\n    public readonly partial struct UniTask\n    {\n        readonly IUniTaskSource source;\n        readonly short token;\n\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public UniTask(IUniTaskSource source, short token)\n        {\n            this.source = source;\n            this.token = token;\n        }\n\n        public UniTaskStatus Status\n        {\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            get\n            {\n                if (source == null) return UniTaskStatus.Succeeded;\n                return source.GetStatus(token);\n            }\n        }\n\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public Awaiter GetAwaiter()\n        {\n            return new Awaiter(this);\n        }\n\n        /// <summary>\n        /// returns (bool IsCanceled) instead of throws OperationCanceledException.\n        /// </summary>\n        public UniTask<bool> SuppressCancellationThrow()\n        {\n            var status = Status;\n            if (status == UniTaskStatus.Succeeded) return CompletedTasks.False;\n            if (status == UniTaskStatus.Canceled) return CompletedTasks.True;\n            return new UniTask<bool>(new IsCanceledSource(source), token);\n        }\n\n#if SUPPORT_VALUETASK\n\n        public static implicit operator System.Threading.Tasks.ValueTask(in UniTask self)\n        {\n            if (self.source == null)\n            {\n                return default;\n            }\n\n#if (UNITASK_NETCORE && NETSTANDARD2_0)\n            return self.AsValueTask();\n#else\n            return new System.Threading.Tasks.ValueTask(self.source, self.token);\n#endif\n        }\n\n#endif\n\n        public override string ToString()\n        {\n            if (source == null) return \"()\";\n            return \"(\" + source.UnsafeGetStatus() + \")\";\n        }\n\n        /// <summary>\n        /// Memoizing inner IValueTaskSource. The result UniTask can await multiple.\n        /// </summary>\n        public UniTask Preserve()\n        {\n            if (source == null)\n            {\n                return this;\n            }\n            else\n            {\n                return new UniTask(new MemoizeSource(source), token);\n            }\n        }\n\n        public UniTask<AsyncUnit> AsAsyncUnitUniTask()\n        {\n            if (this.source == null) return CompletedTasks.AsyncUnit;\n\n            var status = this.source.GetStatus(this.token);\n            if (status.IsCompletedSuccessfully())\n            {\n                this.source.GetResult(this.token);\n                return CompletedTasks.AsyncUnit;\n            }\n            else if (this.source is IUniTaskSource<AsyncUnit> asyncUnitSource)\n            {\n                return new UniTask<AsyncUnit>(asyncUnitSource, this.token);\n            }\n\n            return new UniTask<AsyncUnit>(new AsyncUnitSource(this.source), this.token);\n        }\n\n        sealed class AsyncUnitSource : IUniTaskSource<AsyncUnit>\n        {\n            readonly IUniTaskSource source;\n\n            public AsyncUnitSource(IUniTaskSource source)\n            {\n                this.source = source;\n            }\n\n            public AsyncUnit GetResult(short token)\n            {\n                source.GetResult(token);\n                return AsyncUnit.Default;\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return source.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                source.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return source.UnsafeGetStatus();\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n        }\n\n        sealed class IsCanceledSource : IUniTaskSource<bool>\n        {\n            readonly IUniTaskSource source;\n\n            public IsCanceledSource(IUniTaskSource source)\n            {\n                this.source = source;\n            }\n\n            public bool GetResult(short token)\n            {\n                if (source.GetStatus(token) == UniTaskStatus.Canceled)\n                {\n                    return true;\n                }\n\n                source.GetResult(token);\n                return false;\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return source.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return source.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                source.OnCompleted(continuation, state, token);\n            }\n        }\n\n        sealed class MemoizeSource : IUniTaskSource\n        {\n            IUniTaskSource source;\n            ExceptionDispatchInfo exception;\n            UniTaskStatus status;\n\n            public MemoizeSource(IUniTaskSource source)\n            {\n                this.source = source;\n            }\n\n            public void GetResult(short token)\n            {\n                if (source == null)\n                {\n                    if (exception != null)\n                    {\n                        exception.Throw();\n                    }\n                }\n                else\n                {\n                    try\n                    {\n                        source.GetResult(token);\n                        status = UniTaskStatus.Succeeded;\n                    }\n                    catch (Exception ex)\n                    {\n                        exception = ExceptionDispatchInfo.Capture(ex);\n                        if (ex is OperationCanceledException)\n                        {\n                            status = UniTaskStatus.Canceled;\n                        }\n                        else\n                        {\n                            status = UniTaskStatus.Faulted;\n                        }\n                        throw;\n                    }\n                    finally\n                    {\n                        source = null;\n                    }\n                }\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                if (source == null)\n                {\n                    return status;\n                }\n\n                return source.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                if (source == null)\n                {\n                    continuation(state);\n                }\n                else\n                {\n                    source.OnCompleted(continuation, state, token);\n                }\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                if (source == null)\n                {\n                    return status;\n                }\n\n                return source.UnsafeGetStatus();\n            }\n        }\n\n        public readonly struct Awaiter : ICriticalNotifyCompletion\n        {\n            readonly UniTask task;\n\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            public Awaiter(in UniTask task)\n            {\n                this.task = task;\n            }\n\n            public bool IsCompleted\n            {\n                [DebuggerHidden]\n                [MethodImpl(MethodImplOptions.AggressiveInlining)]\n                get\n                {\n                    return task.Status.IsCompleted();\n                }\n            }\n\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            public void GetResult()\n            {\n                if (task.source == null) return;\n                task.source.GetResult(task.token);\n            }\n\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            public void OnCompleted(Action continuation)\n            {\n                if (task.source == null)\n                {\n                    continuation();\n                }\n                else\n                {\n                    task.source.OnCompleted(AwaiterActions.InvokeContinuationDelegate, continuation, task.token);\n                }\n            }\n\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            public void UnsafeOnCompleted(Action continuation)\n            {\n                if (task.source == null)\n                {\n                    continuation();\n                }\n                else\n                {\n                    task.source.OnCompleted(AwaiterActions.InvokeContinuationDelegate, continuation, task.token);\n                }\n            }\n\n            /// <summary>\n            /// If register manually continuation, you can use it instead of for compiler OnCompleted methods.\n            /// </summary>\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            public void SourceOnCompleted(Action<object> continuation, object state)\n            {\n                if (task.source == null)\n                {\n                    continuation(state);\n                }\n                else\n                {\n                    task.source.OnCompleted(continuation, state, task.token);\n                }\n            }\n        }\n    }\n\n    /// <summary>\n    /// Lightweight unity specified task-like object.\n    /// </summary>\n    [AsyncMethodBuilder(typeof(AsyncUniTaskMethodBuilder<>))]\n    [StructLayout(LayoutKind.Auto)]\n    public readonly struct UniTask<T>\n    {\n        readonly IUniTaskSource<T> source;\n        readonly T result;\n        readonly short token;\n\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public UniTask(T result)\n        {\n            this.source = default;\n            this.token = default;\n            this.result = result;\n        }\n\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public UniTask(IUniTaskSource<T> source, short token)\n        {\n            this.source = source;\n            this.token = token;\n            this.result = default;\n        }\n\n        public UniTaskStatus Status\n        {\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            get\n            {\n                return (source == null) ? UniTaskStatus.Succeeded : source.GetStatus(token);\n            }\n        }\n\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public Awaiter GetAwaiter()\n        {\n            return new Awaiter(this);\n        }\n\n        /// <summary>\n        /// Memoizing inner IValueTaskSource. The result UniTask can await multiple.\n        /// </summary>\n        public UniTask<T> Preserve()\n        {\n            if (source == null)\n            {\n                return this;\n            }\n            else\n            {\n                return new UniTask<T>(new MemoizeSource(source), token);\n            }\n        }\n\n        public UniTask AsUniTask()\n        {\n            if (this.source == null) return UniTask.CompletedTask;\n\n            var status = this.source.GetStatus(this.token);\n            if (status.IsCompletedSuccessfully())\n            {\n                this.source.GetResult(this.token);\n                return UniTask.CompletedTask;\n            }\n\n            // Converting UniTask<T> -> UniTask is zero overhead.\n            return new UniTask(this.source, this.token);\n        }\n\n        public static implicit operator UniTask(UniTask<T> self)\n        {\n            return self.AsUniTask();\n        }\n\n#if SUPPORT_VALUETASK\n\n        public static implicit operator System.Threading.Tasks.ValueTask<T>(in UniTask<T> self)\n        {\n            if (self.source == null)\n            {\n                return new System.Threading.Tasks.ValueTask<T>(self.result);\n            }\n\n#if (UNITASK_NETCORE && NETSTANDARD2_0)\n            return self.AsValueTask();\n#else\n            return new System.Threading.Tasks.ValueTask<T>(self.source, self.token);\n#endif\n        }\n\n#endif\n\n        /// <summary>\n        /// returns (bool IsCanceled, T Result) instead of throws OperationCanceledException.\n        /// </summary>\n        public UniTask<(bool IsCanceled, T Result)> SuppressCancellationThrow()\n        {\n            if (source == null)\n            {\n                return new UniTask<(bool IsCanceled, T Result)>((false, result));\n            }\n\n            return new UniTask<(bool, T)>(new IsCanceledSource(source), token);\n        }\n\n        public override string ToString()\n        {\n            return (this.source == null) ? result?.ToString()\n                 : \"(\" + this.source.UnsafeGetStatus() + \")\";\n        }\n\n        sealed class IsCanceledSource : IUniTaskSource<(bool, T)>\n        {\n            readonly IUniTaskSource<T> source;\n\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            public IsCanceledSource(IUniTaskSource<T> source)\n            {\n                this.source = source;\n            }\n\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            public (bool, T) GetResult(short token)\n            {\n                if (source.GetStatus(token) == UniTaskStatus.Canceled)\n                {\n                    return (true, default);\n                }\n\n                var result = source.GetResult(token);\n                return (false, result);\n            }\n\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            public UniTaskStatus GetStatus(short token)\n            {\n                return source.GetStatus(token);\n            }\n\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return source.UnsafeGetStatus();\n            }\n\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                source.OnCompleted(continuation, state, token);\n            }\n        }\n\n        sealed class MemoizeSource : IUniTaskSource<T>\n        {\n            IUniTaskSource<T> source;\n            T result;\n            ExceptionDispatchInfo exception;\n            UniTaskStatus status;\n\n            public MemoizeSource(IUniTaskSource<T> source)\n            {\n                this.source = source;\n            }\n\n            public T GetResult(short token)\n            {\n                if (source == null)\n                {\n                    if (exception != null)\n                    {\n                        exception.Throw();\n                    }\n                    return result;\n                }\n                else\n                {\n                    try\n                    {\n                        result = source.GetResult(token);\n                        status = UniTaskStatus.Succeeded;\n                        return result;\n                    }\n                    catch (Exception ex)\n                    {\n                        exception = ExceptionDispatchInfo.Capture(ex);\n                        if (ex is OperationCanceledException)\n                        {\n                            status = UniTaskStatus.Canceled;\n                        }\n                        else\n                        {\n                            status = UniTaskStatus.Faulted;\n                        }\n                        throw;\n                    }\n                    finally\n                    {\n                        source = null;\n                    }\n                }\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                if (source == null)\n                {\n                    return status;\n                }\n\n                return source.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                if (source == null)\n                {\n                    continuation(state);\n                }\n                else\n                {\n                    source.OnCompleted(continuation, state, token);\n                }\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                if (source == null)\n                {\n                    return status;\n                }\n\n                return source.UnsafeGetStatus();\n            }\n        }\n\n        public readonly struct Awaiter : ICriticalNotifyCompletion\n        {\n            readonly UniTask<T> task;\n\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            public Awaiter(in UniTask<T> task)\n            {\n                this.task = task;\n            }\n\n            public bool IsCompleted\n            {\n                [DebuggerHidden]\n                [MethodImpl(MethodImplOptions.AggressiveInlining)]\n                get\n                {\n                    return task.Status.IsCompleted();\n                }\n            }\n\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            public T GetResult()\n            {\n                var s = task.source;\n                if (s == null)\n                {\n                    return task.result;\n                }\n                else\n                {\n                    return s.GetResult(task.token);\n                }\n            }\n\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            public void OnCompleted(Action continuation)\n            {\n                var s = task.source;\n                if (s == null)\n                {\n                    continuation();\n                }\n                else\n                {\n                    s.OnCompleted(AwaiterActions.InvokeContinuationDelegate, continuation, task.token);\n                }\n            }\n\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            public void UnsafeOnCompleted(Action continuation)\n            {\n                var s = task.source;\n                if (s == null)\n                {\n                    continuation();\n                }\n                else\n                {\n                    s.OnCompleted(AwaiterActions.InvokeContinuationDelegate, continuation, task.token);\n                }\n            }\n\n            /// <summary>\n            /// If register manually continuation, you can use it instead of for compiler OnCompleted methods.\n            /// </summary>\n            [DebuggerHidden]\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            public void SourceOnCompleted(Action<object> continuation, object state)\n            {\n                var s = task.source;\n                if (s == null)\n                {\n                    continuation(state);\n                }\n                else\n                {\n                    s.OnCompleted(continuation, state, task.token);\n                }\n            }\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTask.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 8947adf23181ff04db73829df217ca94\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskCompletionSource.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.ExceptionServices;\nusing System.Runtime.InteropServices;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public interface IResolvePromise\n    {\n        bool TrySetResult();\n    }\n\n    public interface IResolvePromise<T>\n    {\n        bool TrySetResult(T value);\n    }\n\n    public interface IRejectPromise\n    {\n        bool TrySetException(Exception exception);\n    }\n\n    public interface ICancelPromise\n    {\n        bool TrySetCanceled(CancellationToken cancellationToken = default);\n    }\n\n    public interface IPromise<T> : IResolvePromise<T>, IRejectPromise, ICancelPromise\n    {\n    }\n\n    public interface IPromise : IResolvePromise, IRejectPromise, ICancelPromise\n    {\n    }\n\n    internal class ExceptionHolder\n    {\n        ExceptionDispatchInfo exception;\n        bool calledGet = false;\n\n        public ExceptionHolder(ExceptionDispatchInfo exception)\n        {\n            this.exception = exception;\n        }\n\n        public ExceptionDispatchInfo GetException()\n        {\n            if (!calledGet)\n            {\n                calledGet = true;\n                GC.SuppressFinalize(this);\n            }\n            return exception;\n        }\n\n        ~ExceptionHolder()\n        {\n            if (!calledGet)\n            {\n                UniTaskScheduler.PublishUnobservedTaskException(exception.SourceException);\n            }\n        }\n    }\n\n    [StructLayout(LayoutKind.Auto)]\n    public struct UniTaskCompletionSourceCore<TResult>\n    {\n        // Struct Size: TResult + (8 + 2 + 1 + 1 + 8 + 8)\n\n        TResult result;\n        object error; // ExceptionHolder or OperationCanceledException\n        short version;\n        bool hasUnhandledError;\n        int completedCount; // 0: completed == false\n        Action<object> continuation;\n        object continuationState;\n\n        [DebuggerHidden]\n        public void Reset()\n        {\n            ReportUnhandledError();\n\n            unchecked\n            {\n                version += 1; // incr version.\n            }\n            completedCount = 0;\n            result = default;\n            error = null;\n            hasUnhandledError = false;\n            continuation = null;\n            continuationState = null;\n        }\n\n        void ReportUnhandledError()\n        {\n            if (hasUnhandledError)\n            {\n                try\n                {\n                    if (error is OperationCanceledException oc)\n                    {\n                        UniTaskScheduler.PublishUnobservedTaskException(oc);\n                    }\n                    else if (error is ExceptionHolder e)\n                    {\n                        UniTaskScheduler.PublishUnobservedTaskException(e.GetException().SourceException);\n                    }\n                }\n                catch\n                {\n                }\n            }\n        }\n\n        internal void MarkHandled()\n        {\n            hasUnhandledError = false;\n        }\n\n        /// <summary>Completes with a successful result.</summary>\n        /// <param name=\"result\">The result.</param>\n        [DebuggerHidden]\n        public bool TrySetResult(TResult result)\n        {\n            if (Interlocked.Increment(ref completedCount) == 1)\n            {\n                // setup result\n                this.result = result;\n\n                if (continuation != null || Interlocked.CompareExchange(ref this.continuation, UniTaskCompletionSourceCoreShared.s_sentinel, null) != null)\n                {\n                    continuation(continuationState);\n                }\n                return true;\n            }\n\n            return false;\n        }\n\n        /// <summary>Completes with an error.</summary>\n        /// <param name=\"error\">The exception.</param>\n        [DebuggerHidden]\n        public bool TrySetException(Exception error)\n        {\n            if (Interlocked.Increment(ref completedCount) == 1)\n            {\n                // setup result\n                this.hasUnhandledError = true;\n                if (error is OperationCanceledException)\n                {\n                    this.error = error;\n                }\n                else\n                {\n                    this.error = new ExceptionHolder(ExceptionDispatchInfo.Capture(error));\n                }\n\n                if (continuation != null || Interlocked.CompareExchange(ref this.continuation, UniTaskCompletionSourceCoreShared.s_sentinel, null) != null)\n                {\n                    continuation(continuationState);\n                }\n                return true;\n            }\n\n            return false;\n        }\n\n        [DebuggerHidden]\n        public bool TrySetCanceled(CancellationToken cancellationToken = default)\n        {\n            if (Interlocked.Increment(ref completedCount) == 1)\n            {\n                // setup result\n                this.hasUnhandledError = true;\n                this.error = new OperationCanceledException(cancellationToken);\n\n                if (continuation != null || Interlocked.CompareExchange(ref this.continuation, UniTaskCompletionSourceCoreShared.s_sentinel, null) != null)\n                {\n                    continuation(continuationState);\n                }\n                return true;\n            }\n\n            return false;\n        }\n\n        /// <summary>Gets the operation version.</summary>\n        [DebuggerHidden]\n        public short Version => version;\n\n        /// <summary>Gets the status of the operation.</summary>\n        /// <param name=\"token\">Opaque value that was provided to the <see cref=\"UniTask\"/>'s constructor.</param>\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public UniTaskStatus GetStatus(short token)\n        {\n            ValidateToken(token);\n            return (continuation == null || (completedCount == 0)) ? UniTaskStatus.Pending\n                 : (error == null) ? UniTaskStatus.Succeeded\n                 : (error is OperationCanceledException) ? UniTaskStatus.Canceled\n                 : UniTaskStatus.Faulted;\n        }\n\n        /// <summary>Gets the status of the operation without token validation.</summary>\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public UniTaskStatus UnsafeGetStatus()\n        {\n            return (continuation == null || (completedCount == 0)) ? UniTaskStatus.Pending\n                 : (error == null) ? UniTaskStatus.Succeeded\n                 : (error is OperationCanceledException) ? UniTaskStatus.Canceled\n                 : UniTaskStatus.Faulted;\n        }\n\n        /// <summary>Gets the result of the operation.</summary>\n        /// <param name=\"token\">Opaque value that was provided to the <see cref=\"UniTask\"/>'s constructor.</param>\n        // [StackTraceHidden]\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public TResult GetResult(short token)\n        {\n            ValidateToken(token);\n            if (completedCount == 0)\n            {\n                throw new InvalidOperationException(\"Not yet completed, UniTask only allow to use await.\");\n            }\n\n            if (error != null)\n            {\n                hasUnhandledError = false;\n                if (error is OperationCanceledException oce)\n                {\n                    throw oce;\n                }\n                else if (error is ExceptionHolder eh)\n                {\n                    eh.GetException().Throw();\n                }\n\n                throw new InvalidOperationException(\"Critical: invalid exception type was held.\");\n            }\n\n            return result;\n        }\n\n        /// <summary>Schedules the continuation action for this operation.</summary>\n        /// <param name=\"continuation\">The continuation to invoke when the operation has completed.</param>\n        /// <param name=\"state\">The state object to pass to <paramref name=\"continuation\"/> when it's invoked.</param>\n        /// <param name=\"token\">Opaque value that was provided to the <see cref=\"UniTask\"/>'s constructor.</param>\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void OnCompleted(Action<object> continuation, object state, short token /*, ValueTaskSourceOnCompletedFlags flags */)\n        {\n            if (continuation == null)\n            {\n                throw new ArgumentNullException(nameof(continuation));\n            }\n            ValidateToken(token);\n\n            /* no use ValueTaskSourceOnCOmpletedFlags, always no capture ExecutionContext and SynchronizationContext. */\n\n            /*\n                PatternA: GetStatus=Pending => OnCompleted => TrySet*** => GetResult\n                PatternB: TrySet*** => GetStatus=!Pending => GetResult\n                PatternC: GetStatus=Pending => TrySet/OnCompleted(race condition) => GetResult\n                C.1: win OnCompleted -> TrySet invoke saved continuation\n                C.2: win TrySet -> should invoke continuation here.\n            */\n\n            // not set continuation yet.\n            object oldContinuation = this.continuation;\n            if (oldContinuation == null)\n            {\n                continuationState = state;\n                oldContinuation = Interlocked.CompareExchange(ref this.continuation, continuation, null);\n            }\n\n            if (oldContinuation != null)\n            {\n                // already running continuation in TrySet.\n                // It will cause call OnCompleted multiple time, invalid.\n                if (!ReferenceEquals(oldContinuation, UniTaskCompletionSourceCoreShared.s_sentinel))\n                {\n                    throw new InvalidOperationException(\"Already continuation registered, can not await twice or get Status after await.\");\n                }\n\n                continuation(state);\n            }\n        }\n\n        [DebuggerHidden]\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        private void ValidateToken(short token)\n        {\n            if (token != version)\n            {\n                throw new InvalidOperationException(\"Token version is not matched, can not await twice or get Status after await.\");\n            }\n        }\n    }\n\n    internal static class UniTaskCompletionSourceCoreShared // separated out of generic to avoid unnecessary duplication\n    {\n        internal static readonly Action<object> s_sentinel = CompletionSentinel;\n\n        private static void CompletionSentinel(object _) // named method to aid debugging\n        {\n            throw new InvalidOperationException(\"The sentinel delegate should never be invoked.\");\n        }\n    }\n\n    public class AutoResetUniTaskCompletionSource : IUniTaskSource, ITaskPoolNode<AutoResetUniTaskCompletionSource>, IPromise\n    {\n        static TaskPool<AutoResetUniTaskCompletionSource> pool;\n        AutoResetUniTaskCompletionSource nextNode;\n        public ref AutoResetUniTaskCompletionSource NextNode => ref nextNode;\n\n        static AutoResetUniTaskCompletionSource()\n        {\n            TaskPool.RegisterSizeGetter(typeof(AutoResetUniTaskCompletionSource), () => pool.Size);\n        }\n\n        UniTaskCompletionSourceCore<AsyncUnit> core;\n        short version;\n\n        AutoResetUniTaskCompletionSource()\n        {\n        }\n\n        [DebuggerHidden]\n        public static AutoResetUniTaskCompletionSource Create()\n        {\n            if (!pool.TryPop(out var result))\n            {\n                result = new AutoResetUniTaskCompletionSource();\n            }\n            result.version = result.core.Version;\n            TaskTracker.TrackActiveTask(result, 2);\n            return result;\n        }\n\n        [DebuggerHidden]\n        public static AutoResetUniTaskCompletionSource CreateFromCanceled(CancellationToken cancellationToken, out short token)\n        {\n            var source = Create();\n            source.TrySetCanceled(cancellationToken);\n            token = source.core.Version;\n            return source;\n        }\n\n        [DebuggerHidden]\n        public static AutoResetUniTaskCompletionSource CreateFromException(Exception exception, out short token)\n        {\n            var source = Create();\n            source.TrySetException(exception);\n            token = source.core.Version;\n            return source;\n        }\n\n        [DebuggerHidden]\n        public static AutoResetUniTaskCompletionSource CreateCompleted(out short token)\n        {\n            var source = Create();\n            source.TrySetResult();\n            token = source.core.Version;\n            return source;\n        }\n\n        public UniTask Task\n        {\n            [DebuggerHidden]\n            get\n            {\n                return new UniTask(this, core.Version);\n            }\n        }\n\n        [DebuggerHidden]\n        public bool TrySetResult()\n        {\n            return version == core.Version && core.TrySetResult(AsyncUnit.Default);\n        }\n\n        [DebuggerHidden]\n        public bool TrySetCanceled(CancellationToken cancellationToken = default)\n        {\n            return version == core.Version && core.TrySetCanceled(cancellationToken);\n        }\n\n        [DebuggerHidden]\n        public bool TrySetException(Exception exception)\n        {\n            return version == core.Version && core.TrySetException(exception);\n        }\n\n        [DebuggerHidden]\n        public void GetResult(short token)\n        {\n            try\n            {\n                core.GetResult(token);\n            }\n            finally\n            {\n                TryReturn();\n            }\n        }\n\n        [DebuggerHidden]\n        public UniTaskStatus GetStatus(short token)\n        {\n            return core.GetStatus(token);\n        }\n\n        [DebuggerHidden]\n        public UniTaskStatus UnsafeGetStatus()\n        {\n            return core.UnsafeGetStatus();\n        }\n\n        [DebuggerHidden]\n        public void OnCompleted(Action<object> continuation, object state, short token)\n        {\n            core.OnCompleted(continuation, state, token);\n        }\n\n        [DebuggerHidden]\n        bool TryReturn()\n        {\n            TaskTracker.RemoveTracking(this);\n            core.Reset();\n            return pool.TryPush(this);\n        }\n    }\n\n    public class AutoResetUniTaskCompletionSource<T> : IUniTaskSource<T>, ITaskPoolNode<AutoResetUniTaskCompletionSource<T>>, IPromise<T>\n    {\n        static TaskPool<AutoResetUniTaskCompletionSource<T>> pool;\n        AutoResetUniTaskCompletionSource<T> nextNode;\n        public ref AutoResetUniTaskCompletionSource<T> NextNode => ref nextNode;\n\n        static AutoResetUniTaskCompletionSource()\n        {\n            TaskPool.RegisterSizeGetter(typeof(AutoResetUniTaskCompletionSource<T>), () => pool.Size);\n        }\n\n        UniTaskCompletionSourceCore<T> core;\n        short version;\n\n        AutoResetUniTaskCompletionSource()\n        {\n        }\n\n        [DebuggerHidden]\n        public static AutoResetUniTaskCompletionSource<T> Create()\n        {\n            if (!pool.TryPop(out var result))\n            {\n                result = new AutoResetUniTaskCompletionSource<T>();\n            }\n            result.version = result.core.Version;\n            TaskTracker.TrackActiveTask(result, 2);\n            return result;\n        }\n\n        [DebuggerHidden]\n        public static AutoResetUniTaskCompletionSource<T> CreateFromCanceled(CancellationToken cancellationToken, out short token)\n        {\n            var source = Create();\n            source.TrySetCanceled(cancellationToken);\n            token = source.core.Version;\n            return source;\n        }\n\n        [DebuggerHidden]\n        public static AutoResetUniTaskCompletionSource<T> CreateFromException(Exception exception, out short token)\n        {\n            var source = Create();\n            source.TrySetException(exception);\n            token = source.core.Version;\n            return source;\n        }\n\n        [DebuggerHidden]\n        public static AutoResetUniTaskCompletionSource<T> CreateFromResult(T result, out short token)\n        {\n            var source = Create();\n            source.TrySetResult(result);\n            token = source.core.Version;\n            return source;\n        }\n\n        public UniTask<T> Task\n        {\n            [DebuggerHidden]\n            get\n            {\n                return new UniTask<T>(this, core.Version);\n            }\n        }\n\n        [DebuggerHidden]\n        public bool TrySetResult(T result)\n        {\n            return version == core.Version && core.TrySetResult(result);\n        }\n\n        [DebuggerHidden]\n        public bool TrySetCanceled(CancellationToken cancellationToken = default)\n        {\n            return version == core.Version && core.TrySetCanceled(cancellationToken);\n        }\n\n        [DebuggerHidden]\n        public bool TrySetException(Exception exception)\n        {\n            return version == core.Version && core.TrySetException(exception);\n        }\n\n        [DebuggerHidden]\n        public T GetResult(short token)\n        {\n            try\n            {\n                return core.GetResult(token);\n            }\n            finally\n            {\n                TryReturn();\n            }\n        }\n\n        [DebuggerHidden]\n        void IUniTaskSource.GetResult(short token)\n        {\n            GetResult(token);\n        }\n\n        [DebuggerHidden]\n        public UniTaskStatus GetStatus(short token)\n        {\n            return core.GetStatus(token);\n        }\n\n        [DebuggerHidden]\n        public UniTaskStatus UnsafeGetStatus()\n        {\n            return core.UnsafeGetStatus();\n        }\n\n        [DebuggerHidden]\n        public void OnCompleted(Action<object> continuation, object state, short token)\n        {\n            core.OnCompleted(continuation, state, token);\n        }\n\n        [DebuggerHidden]\n        bool TryReturn()\n        {\n            TaskTracker.RemoveTracking(this);\n            core.Reset();\n            return pool.TryPush(this);\n        }\n    }\n\n    public class UniTaskCompletionSource : IUniTaskSource, IPromise\n    {\n        CancellationToken cancellationToken;\n        ExceptionHolder exception;\n        object gate;\n        Action<object> singleContinuation;\n        object singleState;\n        List<(Action<object>, object)> secondaryContinuationList;\n\n        int intStatus; // UniTaskStatus\n        bool handled = false;\n\n        public UniTaskCompletionSource()\n        {\n            TaskTracker.TrackActiveTask(this, 2);\n        }\n\n        [DebuggerHidden]\n        internal void MarkHandled()\n        {\n            if (!handled)\n            {\n                handled = true;\n                TaskTracker.RemoveTracking(this);\n            }\n        }\n\n        public UniTask Task\n        {\n            [DebuggerHidden]\n            get\n            {\n                return new UniTask(this, 0);\n            }\n        }\n\n        [DebuggerHidden]\n        public bool TrySetResult()\n        {\n            return TrySignalCompletion(UniTaskStatus.Succeeded);\n        }\n\n        [DebuggerHidden]\n        public bool TrySetCanceled(CancellationToken cancellationToken = default)\n        {\n            if (UnsafeGetStatus() != UniTaskStatus.Pending) return false;\n\n            this.cancellationToken = cancellationToken;\n            return TrySignalCompletion(UniTaskStatus.Canceled);\n        }\n\n        [DebuggerHidden]\n        public bool TrySetException(Exception exception)\n        {\n            if (exception is OperationCanceledException oce)\n            {\n                return TrySetCanceled(oce.CancellationToken);\n            }\n\n            if (UnsafeGetStatus() != UniTaskStatus.Pending) return false;\n\n            this.exception = new ExceptionHolder(ExceptionDispatchInfo.Capture(exception));\n            return TrySignalCompletion(UniTaskStatus.Faulted);\n        }\n\n        [DebuggerHidden]\n        public void GetResult(short token)\n        {\n            MarkHandled();\n\n            var status = (UniTaskStatus)intStatus;\n            switch (status)\n            {\n                case UniTaskStatus.Succeeded:\n                    return;\n                case UniTaskStatus.Faulted:\n                    exception.GetException().Throw();\n                    return;\n                case UniTaskStatus.Canceled:\n                    throw new OperationCanceledException(cancellationToken);\n                default:\n                case UniTaskStatus.Pending:\n                    throw new InvalidOperationException(\"not yet completed.\");\n            }\n        }\n\n        [DebuggerHidden]\n        public UniTaskStatus GetStatus(short token)\n        {\n            return (UniTaskStatus)intStatus;\n        }\n\n        [DebuggerHidden]\n        public UniTaskStatus UnsafeGetStatus()\n        {\n            return (UniTaskStatus)intStatus;\n        }\n\n        [DebuggerHidden]\n        public void OnCompleted(Action<object> continuation, object state, short token)\n        {\n            if (gate == null)\n            {\n                Interlocked.CompareExchange(ref gate, new object(), null);\n            }\n\n            var lockGate = Thread.VolatileRead(ref gate);\n            lock (lockGate) // wait TrySignalCompletion, after status is not pending.\n            {\n                if ((UniTaskStatus)intStatus != UniTaskStatus.Pending)\n                {\n                    continuation(state);\n                    return;\n                }\n\n                if (singleContinuation == null)\n                {\n                    singleContinuation = continuation;\n                    singleState = state;\n                }\n                else\n                {\n                    if (secondaryContinuationList == null)\n                    {\n                        secondaryContinuationList = new List<(Action<object>, object)>();\n                    }\n                    secondaryContinuationList.Add((continuation, state));\n                }\n            }\n        }\n\n        [DebuggerHidden]\n        bool TrySignalCompletion(UniTaskStatus status)\n        {\n            if (Interlocked.CompareExchange(ref intStatus, (int)status, (int)UniTaskStatus.Pending) == (int)UniTaskStatus.Pending)\n            {\n                if (gate == null)\n                {\n                    Interlocked.CompareExchange(ref gate, new object(), null);\n                }\n\n                var lockGate = Thread.VolatileRead(ref gate);\n                lock (lockGate) // wait OnCompleted.\n                {\n                    if (singleContinuation != null)\n                    {\n                        try\n                        {\n                            singleContinuation(singleState);\n                        }\n                        catch (Exception ex)\n                        {\n                            UniTaskScheduler.PublishUnobservedTaskException(ex);\n                        }\n                    }\n\n                    if (secondaryContinuationList != null)\n                    {\n                        foreach (var (c, state) in secondaryContinuationList)\n                        {\n                            try\n                            {\n                                c(state);\n                            }\n                            catch (Exception ex)\n                            {\n                                UniTaskScheduler.PublishUnobservedTaskException(ex);\n                            }\n                        }\n                    }\n\n                    singleContinuation = null;\n                    singleState = null;\n                    secondaryContinuationList = null;\n                }\n                return true;\n            }\n            return false;\n        }\n    }\n\n    public class UniTaskCompletionSource<T> : IUniTaskSource<T>, IPromise<T>\n    {\n        CancellationToken cancellationToken;\n        T result;\n        ExceptionHolder exception;\n        object gate;\n        Action<object> singleContinuation;\n        object singleState;\n        List<(Action<object>, object)> secondaryContinuationList;\n\n        int intStatus; // UniTaskStatus\n        bool handled = false;\n\n        public UniTaskCompletionSource()\n        {\n            TaskTracker.TrackActiveTask(this, 2);\n        }\n\n        [DebuggerHidden]\n        internal void MarkHandled()\n        {\n            if (!handled)\n            {\n                handled = true;\n                TaskTracker.RemoveTracking(this);\n            }\n        }\n\n        public UniTask<T> Task\n        {\n            [DebuggerHidden]\n            get\n            {\n                return new UniTask<T>(this, 0);\n            }\n        }\n\n        [DebuggerHidden]\n        public bool TrySetResult(T result)\n        {\n            if (UnsafeGetStatus() != UniTaskStatus.Pending) return false;\n\n            this.result = result;\n            return TrySignalCompletion(UniTaskStatus.Succeeded);\n        }\n\n        [DebuggerHidden]\n        public bool TrySetCanceled(CancellationToken cancellationToken = default)\n        {\n            if (UnsafeGetStatus() != UniTaskStatus.Pending) return false;\n\n            this.cancellationToken = cancellationToken;\n            return TrySignalCompletion(UniTaskStatus.Canceled);\n        }\n\n        [DebuggerHidden]\n        public bool TrySetException(Exception exception)\n        {\n            if (exception is OperationCanceledException oce)\n            {\n                return TrySetCanceled(oce.CancellationToken);\n            }\n\n            if (UnsafeGetStatus() != UniTaskStatus.Pending) return false;\n\n            this.exception = new ExceptionHolder(ExceptionDispatchInfo.Capture(exception));\n            return TrySignalCompletion(UniTaskStatus.Faulted);\n        }\n\n        [DebuggerHidden]\n        public T GetResult(short token)\n        {\n            MarkHandled();\n\n            var status = (UniTaskStatus)intStatus;\n            switch (status)\n            {\n                case UniTaskStatus.Succeeded:\n                    return result;\n                case UniTaskStatus.Faulted:\n                    exception.GetException().Throw();\n                    return default;\n                case UniTaskStatus.Canceled:\n                    throw new OperationCanceledException(cancellationToken);\n                default:\n                case UniTaskStatus.Pending:\n                    throw new InvalidOperationException(\"not yet completed.\");\n            }\n        }\n\n        [DebuggerHidden]\n        void IUniTaskSource.GetResult(short token)\n        {\n            GetResult(token);\n        }\n\n        [DebuggerHidden]\n        public UniTaskStatus GetStatus(short token)\n        {\n            return (UniTaskStatus)intStatus;\n        }\n\n        [DebuggerHidden]\n        public UniTaskStatus UnsafeGetStatus()\n        {\n            return (UniTaskStatus)intStatus;\n        }\n\n        [DebuggerHidden]\n        public void OnCompleted(Action<object> continuation, object state, short token)\n        {\n            if (gate == null)\n            {\n                Interlocked.CompareExchange(ref gate, new object(), null);\n            }\n\n            var lockGate = Thread.VolatileRead(ref gate);\n            lock (lockGate) // wait TrySignalCompletion, after status is not pending.\n            {\n                if ((UniTaskStatus)intStatus != UniTaskStatus.Pending)\n                {\n                    continuation(state);\n                    return;\n                }\n\n                if (singleContinuation == null)\n                {\n                    singleContinuation = continuation;\n                    singleState = state;\n                }\n                else\n                {\n                    if (secondaryContinuationList == null)\n                    {\n                        secondaryContinuationList = new List<(Action<object>, object)>();\n                    }\n                    secondaryContinuationList.Add((continuation, state));\n                }\n            }\n        }\n\n        [DebuggerHidden]\n        bool TrySignalCompletion(UniTaskStatus status)\n        {\n            if (Interlocked.CompareExchange(ref intStatus, (int)status, (int)UniTaskStatus.Pending) == (int)UniTaskStatus.Pending)\n            {\n                if (gate == null)\n                {\n                    Interlocked.CompareExchange(ref gate, new object(), null);\n                }\n\n                var lockGate = Thread.VolatileRead(ref gate);\n                lock (lockGate) // wait OnCompleted.\n                {\n                    if (singleContinuation != null)\n                    {\n                        try\n                        {\n                            singleContinuation(singleState);\n                        }\n                        catch (Exception ex)\n                        {\n                            UniTaskScheduler.PublishUnobservedTaskException(ex);\n                        }\n                    }\n\n                    if (secondaryContinuationList != null)\n                    {\n                        foreach (var (c, state) in secondaryContinuationList)\n                        {\n                            try\n                            {\n                                c(state);\n                            }\n                            catch (Exception ex)\n                            {\n                                UniTaskScheduler.PublishUnobservedTaskException(ex);\n                            }\n                        }\n                    }\n\n                    singleContinuation = null;\n                    singleState = null;\n                    secondaryContinuationList = null;\n                }\n                return true;\n            }\n            return false;\n        }\n   }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskCompletionSource.cs.meta",
    "content": "fileFormatVersion: 2\nguid: ed03524d09e7eb24a9fb9137198feb84\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.Shorthand.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\nusing System.Collections.Generic;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static partial class UniTaskExtensions\n    {\n        // shorthand of WhenAll\n    \n        public static UniTask.Awaiter GetAwaiter(this UniTask[] tasks)\n        {\n            return UniTask.WhenAll(tasks).GetAwaiter();\n        }\n\n        public static UniTask.Awaiter GetAwaiter(this IEnumerable<UniTask> tasks)\n        {\n            return UniTask.WhenAll(tasks).GetAwaiter();\n        }\n\n        public static UniTask<T[]>.Awaiter GetAwaiter<T>(this UniTask<T>[] tasks)\n        {\n            return UniTask.WhenAll(tasks).GetAwaiter();\n        }\n\n        public static UniTask<T[]>.Awaiter GetAwaiter<T>(this IEnumerable<UniTask<T>> tasks)\n        {\n            return UniTask.WhenAll(tasks).GetAwaiter();\n        }\n\n        public static UniTask<(T1, T2)>.Awaiter GetAwaiter<T1, T2>(this (UniTask<T1> task1, UniTask<T2> task2) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2).GetAwaiter();\n        }\n\n        public static UniTask<(T1, T2, T3)>.Awaiter GetAwaiter<T1, T2, T3>(this (UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3).GetAwaiter();\n        }\n\n        public static UniTask<(T1, T2, T3, T4)>.Awaiter GetAwaiter<T1, T2, T3, T4>(this (UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4).GetAwaiter();\n        }\n\n        public static UniTask<(T1, T2, T3, T4, T5)>.Awaiter GetAwaiter<T1, T2, T3, T4, T5>(this (UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5).GetAwaiter();\n        }\n\n        public static UniTask<(T1, T2, T3, T4, T5, T6)>.Awaiter GetAwaiter<T1, T2, T3, T4, T5, T6>(this (UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6).GetAwaiter();\n        }\n\n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7)>.Awaiter GetAwaiter<T1, T2, T3, T4, T5, T6, T7>(this (UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7).GetAwaiter();\n        }\n\n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8)>.Awaiter GetAwaiter<T1, T2, T3, T4, T5, T6, T7, T8>(this (UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7, tasks.Item8).GetAwaiter();\n        }\n\n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9)>.Awaiter GetAwaiter<T1, T2, T3, T4, T5, T6, T7, T8, T9>(this (UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7, tasks.Item8, tasks.Item9).GetAwaiter();\n        }\n\n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)>.Awaiter GetAwaiter<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this (UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7, tasks.Item8, tasks.Item9, tasks.Item10).GetAwaiter();\n        }\n\n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)>.Awaiter GetAwaiter<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this (UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7, tasks.Item8, tasks.Item9, tasks.Item10, tasks.Item11).GetAwaiter();\n        }\n\n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)>.Awaiter GetAwaiter<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this (UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7, tasks.Item8, tasks.Item9, tasks.Item10, tasks.Item11, tasks.Item12).GetAwaiter();\n        }\n\n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)>.Awaiter GetAwaiter<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(this (UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7, tasks.Item8, tasks.Item9, tasks.Item10, tasks.Item11, tasks.Item12, tasks.Item13).GetAwaiter();\n        }\n\n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)>.Awaiter GetAwaiter<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(this (UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7, tasks.Item8, tasks.Item9, tasks.Item10, tasks.Item11, tasks.Item12, tasks.Item13, tasks.Item14).GetAwaiter();\n        }\n\n        public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)>.Awaiter GetAwaiter<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(this (UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14, UniTask<T15> task15) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7, tasks.Item8, tasks.Item9, tasks.Item10, tasks.Item11, tasks.Item12, tasks.Item13, tasks.Item14, tasks.Item15).GetAwaiter();\n        }\n\n\n\n        public static UniTask.Awaiter GetAwaiter(this (UniTask task1, UniTask task2) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2).GetAwaiter();\n        }\n\n\n        public static UniTask.Awaiter GetAwaiter(this (UniTask task1, UniTask task2, UniTask task3) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3).GetAwaiter();\n        }\n\n\n        public static UniTask.Awaiter GetAwaiter(this (UniTask task1, UniTask task2, UniTask task3, UniTask task4) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4).GetAwaiter();\n        }\n\n\n        public static UniTask.Awaiter GetAwaiter(this (UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5).GetAwaiter();\n        }\n\n\n        public static UniTask.Awaiter GetAwaiter(this (UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6).GetAwaiter();\n        }\n\n\n        public static UniTask.Awaiter GetAwaiter(this (UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6, UniTask task7) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7).GetAwaiter();\n        }\n\n\n        public static UniTask.Awaiter GetAwaiter(this (UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6, UniTask task7, UniTask task8) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7, tasks.Item8).GetAwaiter();\n        }\n\n\n        public static UniTask.Awaiter GetAwaiter(this (UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6, UniTask task7, UniTask task8, UniTask task9) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7, tasks.Item8, tasks.Item9).GetAwaiter();\n        }\n\n\n        public static UniTask.Awaiter GetAwaiter(this (UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6, UniTask task7, UniTask task8, UniTask task9, UniTask task10) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7, tasks.Item8, tasks.Item9, tasks.Item10).GetAwaiter();\n        }\n\n\n        public static UniTask.Awaiter GetAwaiter(this (UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6, UniTask task7, UniTask task8, UniTask task9, UniTask task10, UniTask task11) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7, tasks.Item8, tasks.Item9, tasks.Item10, tasks.Item11).GetAwaiter();\n        }\n\n\n        public static UniTask.Awaiter GetAwaiter(this (UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6, UniTask task7, UniTask task8, UniTask task9, UniTask task10, UniTask task11, UniTask task12) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7, tasks.Item8, tasks.Item9, tasks.Item10, tasks.Item11, tasks.Item12).GetAwaiter();\n        }\n\n\n        public static UniTask.Awaiter GetAwaiter(this (UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6, UniTask task7, UniTask task8, UniTask task9, UniTask task10, UniTask task11, UniTask task12, UniTask task13) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7, tasks.Item8, tasks.Item9, tasks.Item10, tasks.Item11, tasks.Item12, tasks.Item13).GetAwaiter();\n        }\n\n\n        public static UniTask.Awaiter GetAwaiter(this (UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6, UniTask task7, UniTask task8, UniTask task9, UniTask task10, UniTask task11, UniTask task12, UniTask task13, UniTask task14) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7, tasks.Item8, tasks.Item9, tasks.Item10, tasks.Item11, tasks.Item12, tasks.Item13, tasks.Item14).GetAwaiter();\n        }\n\n\n        public static UniTask.Awaiter GetAwaiter(this (UniTask task1, UniTask task2, UniTask task3, UniTask task4, UniTask task5, UniTask task6, UniTask task7, UniTask task8, UniTask task9, UniTask task10, UniTask task11, UniTask task12, UniTask task13, UniTask task14, UniTask task15) tasks)\n        {\n            return UniTask.WhenAll(tasks.Item1, tasks.Item2, tasks.Item3, tasks.Item4, tasks.Item5, tasks.Item6, tasks.Item7, tasks.Item8, tasks.Item9, tasks.Item10, tasks.Item11, tasks.Item12, tasks.Item13, tasks.Item14, tasks.Item15).GetAwaiter();\n        }\n\n\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.Shorthand.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 4b4ff020f73dc6d4b8ebd4760d61fb43\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.Shorthand.tt",
    "content": "﻿<#@ template debug=\"false\" hostspecific=\"false\" language=\"C#\" #>\n<#@ assembly name=\"System.Core\" #>\n<#@ import namespace=\"System.Linq\" #>\n<#@ import namespace=\"System.Text\" #>\n<#@ import namespace=\"System.Collections.Generic\" #>\n<#@ output extension=\".cs\" #>\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\nusing System.Collections.Generic;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static partial class UniTaskExtensions\n    {\n        // shorthand of WhenAll\n    \n        public static UniTask.Awaiter GetAwaiter(this UniTask[] tasks)\n        {\n            return UniTask.WhenAll(tasks).GetAwaiter();\n        }\n\n        public static UniTask.Awaiter GetAwaiter(this IEnumerable<UniTask> tasks)\n        {\n            return UniTask.WhenAll(tasks).GetAwaiter();\n        }\n\n        public static UniTask<T[]>.Awaiter GetAwaiter<T>(this UniTask<T>[] tasks)\n        {\n            return UniTask.WhenAll(tasks).GetAwaiter();\n        }\n\n        public static UniTask<T[]>.Awaiter GetAwaiter<T>(this IEnumerable<UniTask<T>> tasks)\n        {\n            return UniTask.WhenAll(tasks).GetAwaiter();\n        }\n\n<# for(var i = 2; i <= 15; i++ ) {\n    var range = Enumerable.Range(1, i);\n    var t = string.Join(\", \", range.Select(x => \"T\" + x));\n    var args = string.Join(\", \", range.Select(x => $\"UniTask<T{x}> task{x}\"));\n    var titems = string.Join(\", \", range.Select(x => $\"tasks.Item{x}\"));\n#>\n        public static UniTask<(<#= t #>)>.Awaiter GetAwaiter<<#= t #>>(this (<#= args #>) tasks)\n        {\n            return UniTask.WhenAll(<#= titems #>).GetAwaiter();\n        }\n\n<# } #>\n\n<# for(var i = 2; i <= 15; i++ ) {\n    var range = Enumerable.Range(1, i);\n    var args = string.Join(\", \", range.Select(x => $\"UniTask task{x}\"));\n    var titems = string.Join(\", \", range.Select(x => $\"tasks.Item{x}\"));\n#>\n\n        public static UniTask.Awaiter GetAwaiter(this (<#= args #>) tasks)\n        {\n            return UniTask.WhenAll(<#= titems #>).GetAwaiter();\n        }\n\n<# } #>\n\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.Shorthand.tt.meta",
    "content": "fileFormatVersion: 2\nguid: 9a75b5d7e55a5a34fb6476586df37c72\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Collections;\nusing System.Runtime.ExceptionServices;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static partial class UniTaskExtensions\n    {\n        /// <summary>\n        /// Convert Task[T] -> UniTask[T].\n        /// </summary>\n        public static UniTask<T> AsUniTask<T>(this Task<T> task, bool useCurrentSynchronizationContext = true)\n        {\n            var promise = new UniTaskCompletionSource<T>();\n\n            task.ContinueWith((x, state) =>\n            {\n                var p = (UniTaskCompletionSource<T>)state;\n\n                switch (x.Status)\n                {\n                    case TaskStatus.Canceled:\n                        p.TrySetCanceled();\n                        break;\n                    case TaskStatus.Faulted:\n                        p.TrySetException(x.Exception.InnerException ?? x.Exception);\n                        break;\n                    case TaskStatus.RanToCompletion:\n                        p.TrySetResult(x.Result);\n                        break;\n                    default:\n                        throw new NotSupportedException();\n                }\n            }, promise, useCurrentSynchronizationContext ? TaskScheduler.FromCurrentSynchronizationContext() : TaskScheduler.Current);\n\n            return promise.Task;\n        }\n\n        /// <summary>\n        /// Convert Task -> UniTask.\n        /// </summary>\n        public static UniTask AsUniTask(this Task task, bool useCurrentSynchronizationContext = true)\n        {\n            var promise = new UniTaskCompletionSource();\n\n            task.ContinueWith((x, state) =>\n            {\n                var p = (UniTaskCompletionSource)state;\n\n                switch (x.Status)\n                {\n                    case TaskStatus.Canceled:\n                        p.TrySetCanceled();\n                        break;\n                    case TaskStatus.Faulted:\n                        p.TrySetException(x.Exception.InnerException ?? x.Exception);\n                        break;\n                    case TaskStatus.RanToCompletion:\n                        p.TrySetResult();\n                        break;\n                    default:\n                        throw new NotSupportedException();\n                }\n            }, promise, useCurrentSynchronizationContext ? TaskScheduler.FromCurrentSynchronizationContext() : TaskScheduler.Current);\n\n            return promise.Task;\n        }\n\n        public static Task<T> AsTask<T>(this UniTask<T> task)\n        {\n            try\n            {\n                UniTask<T>.Awaiter awaiter;\n                try\n                {\n                    awaiter = task.GetAwaiter();\n                }\n                catch (Exception ex)\n                {\n                    return Task.FromException<T>(ex);\n                }\n\n                if (awaiter.IsCompleted)\n                {\n                    try\n                    {\n                        var result = awaiter.GetResult();\n                        return Task.FromResult(result);\n                    }\n                    catch (Exception ex)\n                    {\n                        return Task.FromException<T>(ex);\n                    }\n                }\n\n                var tcs = new TaskCompletionSource<T>();\n\n                awaiter.SourceOnCompleted(state =>\n                {\n                    using (var tuple = (StateTuple<TaskCompletionSource<T>, UniTask<T>.Awaiter>)state)\n                    {\n                        var (inTcs, inAwaiter) = tuple;\n                        try\n                        {\n                            var result = inAwaiter.GetResult();\n                            inTcs.SetResult(result);\n                        }\n                        catch (Exception ex)\n                        {\n                            inTcs.SetException(ex);\n                        }\n                    }\n                }, StateTuple.Create(tcs, awaiter));\n\n                return tcs.Task;\n            }\n            catch (Exception ex)\n            {\n                return Task.FromException<T>(ex);\n            }\n        }\n\n        public static Task AsTask(this UniTask task)\n        {\n            try\n            {\n                UniTask.Awaiter awaiter;\n                try\n                {\n                    awaiter = task.GetAwaiter();\n                }\n                catch (Exception ex)\n                {\n                    return Task.FromException(ex);\n                }\n\n                if (awaiter.IsCompleted)\n                {\n                    try\n                    {\n                        awaiter.GetResult(); // check token valid on Succeeded\n                        return Task.CompletedTask;\n                    }\n                    catch (Exception ex)\n                    {\n                        return Task.FromException(ex);\n                    }\n                }\n\n                var tcs = new TaskCompletionSource<object>();\n\n                awaiter.SourceOnCompleted(state =>\n                {\n                    using (var tuple = (StateTuple<TaskCompletionSource<object>, UniTask.Awaiter>)state)\n                    {\n                        var (inTcs, inAwaiter) = tuple;\n                        try\n                        {\n                            inAwaiter.GetResult();\n                            inTcs.SetResult(null);\n                        }\n                        catch (Exception ex)\n                        {\n                            inTcs.SetException(ex);\n                        }\n                    }\n                }, StateTuple.Create(tcs, awaiter));\n\n                return tcs.Task;\n            }\n            catch (Exception ex)\n            {\n                return Task.FromException(ex);\n            }\n        }\n\n        public static AsyncLazy ToAsyncLazy(this UniTask task)\n        {\n            return new AsyncLazy(task);\n        }\n\n        public static AsyncLazy<T> ToAsyncLazy<T>(this UniTask<T> task)\n        {\n            return new AsyncLazy<T>(task);\n        }\n\n        /// <summary>\n        /// Ignore task result when cancel raised first.\n        /// </summary>\n        public static UniTask AttachExternalCancellation(this UniTask task, CancellationToken cancellationToken)\n        {\n            if (!cancellationToken.CanBeCanceled)\n            {\n                return task;\n            }\n\n            if (cancellationToken.IsCancellationRequested)\n            {\n                task.Forget();\n                return UniTask.FromCanceled(cancellationToken);\n            }\n\n            if (task.Status.IsCompleted())\n            {\n                return task;\n            }\n\n            return new UniTask(new AttachExternalCancellationSource(task, cancellationToken), 0);\n        }\n\n        /// <summary>\n        /// Ignore task result when cancel raised first.\n        /// </summary>\n        public static UniTask<T> AttachExternalCancellation<T>(this UniTask<T> task, CancellationToken cancellationToken)\n        {\n            if (!cancellationToken.CanBeCanceled)\n            {\n                return task;\n            }\n\n            if (cancellationToken.IsCancellationRequested)\n            {\n                task.Forget();\n                return UniTask.FromCanceled<T>(cancellationToken);\n            }\n\n            if (task.Status.IsCompleted())\n            {\n                return task;\n            }\n\n            return new UniTask<T>(new AttachExternalCancellationSource<T>(task, cancellationToken), 0);\n        }\n\n        sealed class AttachExternalCancellationSource : IUniTaskSource\n        {\n            static readonly Action<object> cancellationCallbackDelegate = CancellationCallback;\n\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration tokenRegistration;\n            UniTaskCompletionSourceCore<AsyncUnit> core;\n\n            public AttachExternalCancellationSource(UniTask task, CancellationToken cancellationToken)\n            {\n                this.cancellationToken = cancellationToken;\n                this.tokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallbackDelegate, this);\n                RunTask(task).Forget();\n            }\n\n            async UniTaskVoid RunTask(UniTask task)\n            {\n                try\n                {\n                    await task;\n                    core.TrySetResult(AsyncUnit.Default);\n                }\n                catch (Exception ex)\n                {\n                    core.TrySetException(ex);\n                }\n                finally\n                {\n                    tokenRegistration.Dispose();\n                }\n            }\n\n            static void CancellationCallback(object state)\n            {\n                var self = (AttachExternalCancellationSource)state;\n                self.core.TrySetCanceled(self.cancellationToken);\n            }\n\n            public void GetResult(short token)\n            {\n                core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n        }\n\n        sealed class AttachExternalCancellationSource<T> : IUniTaskSource<T>\n        {\n            static readonly Action<object> cancellationCallbackDelegate = CancellationCallback;\n\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration tokenRegistration;\n            UniTaskCompletionSourceCore<T> core;\n\n            public AttachExternalCancellationSource(UniTask<T> task, CancellationToken cancellationToken)\n            {\n                this.cancellationToken = cancellationToken;\n                this.tokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallbackDelegate, this);\n                RunTask(task).Forget();\n            }\n\n            async UniTaskVoid RunTask(UniTask<T> task)\n            {\n                try\n                {\n                    core.TrySetResult(await task);\n                }\n                catch (Exception ex)\n                {\n                    core.TrySetException(ex);\n                }\n                finally\n                {\n                    tokenRegistration.Dispose();\n                }\n            }\n\n            static void CancellationCallback(object state)\n            {\n                var self = (AttachExternalCancellationSource<T>)state;\n                self.core.TrySetCanceled(self.cancellationToken);\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                core.GetResult(token);\n            }\n\n            public T GetResult(short token)\n            {\n                return core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n        }\n\n#if UNITY_2018_3_OR_NEWER\n\n        public static IEnumerator ToCoroutine<T>(this UniTask<T> task, Action<T> resultHandler = null, Action<Exception> exceptionHandler = null)\n        {\n            return new ToCoroutineEnumerator<T>(task, resultHandler, exceptionHandler);\n        }\n\n        public static IEnumerator ToCoroutine(this UniTask task, Action<Exception> exceptionHandler = null)\n        {\n            return new ToCoroutineEnumerator(task, exceptionHandler);\n        }\n\n        public static async UniTask Timeout(this UniTask task, TimeSpan timeout, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming timeoutCheckTiming = PlayerLoopTiming.Update, CancellationTokenSource taskCancellationTokenSource = null)\n        {\n            var delayCancellationTokenSource = new CancellationTokenSource();\n            var timeoutTask = UniTask.Delay(timeout, delayType, timeoutCheckTiming, delayCancellationTokenSource.Token).SuppressCancellationThrow();\n\n            int winArgIndex;\n            bool taskResultIsCanceled;\n            try\n            {\n                (winArgIndex, taskResultIsCanceled, _) = await UniTask.WhenAny(task.SuppressCancellationThrow(), timeoutTask);\n            }\n            catch\n            {\n                delayCancellationTokenSource.Cancel();\n                delayCancellationTokenSource.Dispose();\n                throw;\n            }\n\n            // timeout\n            if (winArgIndex == 1)\n            {\n                if (taskCancellationTokenSource != null)\n                {\n                    taskCancellationTokenSource.Cancel();\n                    taskCancellationTokenSource.Dispose();\n                }\n\n                throw new TimeoutException(\"Exceed Timeout:\" + timeout);\n            }\n            else\n            {\n                delayCancellationTokenSource.Cancel();\n                delayCancellationTokenSource.Dispose();\n            }\n\n            if (taskResultIsCanceled)\n            {\n                Error.ThrowOperationCanceledException();\n            }\n        }\n\n        public static async UniTask<T> Timeout<T>(this UniTask<T> task, TimeSpan timeout, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming timeoutCheckTiming = PlayerLoopTiming.Update, CancellationTokenSource taskCancellationTokenSource = null)\n        {\n            var delayCancellationTokenSource = new CancellationTokenSource();\n            var timeoutTask = UniTask.Delay(timeout, delayType, timeoutCheckTiming, delayCancellationTokenSource.Token).SuppressCancellationThrow();\n\n            int winArgIndex;\n            (bool IsCanceled, T Result) taskResult;\n            try\n            {\n                (winArgIndex, taskResult, _) = await UniTask.WhenAny(task.SuppressCancellationThrow(), timeoutTask);\n            }\n            catch\n            {\n                delayCancellationTokenSource.Cancel();\n                delayCancellationTokenSource.Dispose();\n                throw;\n            }\n\n            // timeout\n            if (winArgIndex == 1)\n            {\n                if (taskCancellationTokenSource != null)\n                {\n                    taskCancellationTokenSource.Cancel();\n                    taskCancellationTokenSource.Dispose();\n                }\n\n                throw new TimeoutException(\"Exceed Timeout:\" + timeout);\n            }\n            else\n            {\n                delayCancellationTokenSource.Cancel();\n                delayCancellationTokenSource.Dispose();\n            }\n\n            if (taskResult.IsCanceled)\n            {\n                Error.ThrowOperationCanceledException();\n            }\n\n            return taskResult.Result;\n        }\n\n        /// <summary>\n        /// Timeout with suppress OperationCanceledException. Returns (bool, IsCanceled).\n        /// </summary>\n        public static async UniTask<bool> TimeoutWithoutException(this UniTask task, TimeSpan timeout, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming timeoutCheckTiming = PlayerLoopTiming.Update, CancellationTokenSource taskCancellationTokenSource = null)\n        {\n            var delayCancellationTokenSource = new CancellationTokenSource();\n            var timeoutTask = UniTask.Delay(timeout, delayType, timeoutCheckTiming, delayCancellationTokenSource.Token).SuppressCancellationThrow();\n\n            int winArgIndex;\n            bool taskResultIsCanceled;\n            try\n            {\n                (winArgIndex, taskResultIsCanceled, _) = await UniTask.WhenAny(task.SuppressCancellationThrow(), timeoutTask);\n            }\n            catch\n            {\n                delayCancellationTokenSource.Cancel();\n                delayCancellationTokenSource.Dispose();\n                return true;\n            }\n\n            // timeout\n            if (winArgIndex == 1)\n            {\n                if (taskCancellationTokenSource != null)\n                {\n                    taskCancellationTokenSource.Cancel();\n                    taskCancellationTokenSource.Dispose();\n                }\n\n                return true;\n            }\n            else\n            {\n                delayCancellationTokenSource.Cancel();\n                delayCancellationTokenSource.Dispose();\n            }\n\n            if (taskResultIsCanceled)\n            {\n                return true;\n            }\n\n            return false;\n        }\n\n        /// <summary>\n        /// Timeout with suppress OperationCanceledException. Returns (bool IsTimeout, T Result).\n        /// </summary>\n        public static async UniTask<(bool IsTimeout, T Result)> TimeoutWithoutException<T>(this UniTask<T> task, TimeSpan timeout, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming timeoutCheckTiming = PlayerLoopTiming.Update, CancellationTokenSource taskCancellationTokenSource = null)\n        {\n            var delayCancellationTokenSource = new CancellationTokenSource();\n            var timeoutTask = UniTask.Delay(timeout, delayType, timeoutCheckTiming, delayCancellationTokenSource.Token).SuppressCancellationThrow();\n\n            int winArgIndex;\n            (bool IsCanceled, T Result) taskResult;\n            try\n            {\n                (winArgIndex, taskResult, _) = await UniTask.WhenAny(task.SuppressCancellationThrow(), timeoutTask);\n            }\n            catch\n            {\n                delayCancellationTokenSource.Cancel();\n                delayCancellationTokenSource.Dispose();\n                return (true, default);\n            }\n\n            // timeout\n            if (winArgIndex == 1)\n            {\n                if (taskCancellationTokenSource != null)\n                {\n                    taskCancellationTokenSource.Cancel();\n                    taskCancellationTokenSource.Dispose();\n                }\n\n                return (true, default);\n            }\n            else\n            {\n                delayCancellationTokenSource.Cancel();\n                delayCancellationTokenSource.Dispose();\n            }\n\n            if (taskResult.IsCanceled)\n            {\n                return (true, default);\n            }\n\n            return (false, taskResult.Result);\n        }\n\n#endif\n\n        public static void Forget(this UniTask task)\n        {\n            var awaiter = task.GetAwaiter();\n            if (awaiter.IsCompleted)\n            {\n                try\n                {\n                    awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    UniTaskScheduler.PublishUnobservedTaskException(ex);\n                }\n            }\n            else\n            {\n                awaiter.SourceOnCompleted(state =>\n                {\n                    using (var t = (StateTuple<UniTask.Awaiter>)state)\n                    {\n                        try\n                        {\n                            t.Item1.GetResult();\n                        }\n                        catch (Exception ex)\n                        {\n                            UniTaskScheduler.PublishUnobservedTaskException(ex);\n                        }\n                    }\n                }, StateTuple.Create(awaiter));\n            }\n        }\n\n        public static void Forget(this UniTask task, Action<Exception> exceptionHandler, bool handleExceptionOnMainThread = true)\n        {\n            if (exceptionHandler == null)\n            {\n                Forget(task);\n            }\n            else\n            {\n                ForgetCoreWithCatch(task, exceptionHandler, handleExceptionOnMainThread).Forget();\n            }\n        }\n\n        static async UniTaskVoid ForgetCoreWithCatch(UniTask task, Action<Exception> exceptionHandler, bool handleExceptionOnMainThread)\n        {\n            try\n            {\n                await task;\n            }\n            catch (Exception ex)\n            {\n                try\n                {\n                    if (handleExceptionOnMainThread)\n                    {\n#if UNITY_2018_3_OR_NEWER\n                        await UniTask.SwitchToMainThread();\n#endif\n                    }\n                    exceptionHandler(ex);\n                }\n                catch (Exception ex2)\n                {\n                    UniTaskScheduler.PublishUnobservedTaskException(ex2);\n                }\n            }\n        }\n\n        public static void Forget<T>(this UniTask<T> task)\n        {\n            var awaiter = task.GetAwaiter();\n            if (awaiter.IsCompleted)\n            {\n                try\n                {\n                    awaiter.GetResult();\n                }\n                catch (Exception ex)\n                {\n                    UniTaskScheduler.PublishUnobservedTaskException(ex);\n                }\n            }\n            else\n            {\n                awaiter.SourceOnCompleted(state =>\n                {\n                    using (var t = (StateTuple<UniTask<T>.Awaiter>)state)\n                    {\n                        try\n                        {\n                            t.Item1.GetResult();\n                        }\n                        catch (Exception ex)\n                        {\n                            UniTaskScheduler.PublishUnobservedTaskException(ex);\n                        }\n                    }\n                }, StateTuple.Create(awaiter));\n            }\n        }\n\n        public static void Forget<T>(this UniTask<T> task, Action<Exception> exceptionHandler, bool handleExceptionOnMainThread = true)\n        {\n            if (exceptionHandler == null)\n            {\n                task.Forget();\n            }\n            else\n            {\n                ForgetCoreWithCatch(task, exceptionHandler, handleExceptionOnMainThread).Forget();\n            }\n        }\n\n        static async UniTaskVoid ForgetCoreWithCatch<T>(UniTask<T> task, Action<Exception> exceptionHandler, bool handleExceptionOnMainThread)\n        {\n            try\n            {\n                await task;\n            }\n            catch (Exception ex)\n            {\n                try\n                {\n                    if (handleExceptionOnMainThread)\n                    {\n#if UNITY_2018_3_OR_NEWER\n                        await UniTask.SwitchToMainThread();\n#endif\n                    }\n                    exceptionHandler(ex);\n                }\n                catch (Exception ex2)\n                {\n                    UniTaskScheduler.PublishUnobservedTaskException(ex2);\n                }\n            }\n        }\n\n        public static async UniTask ContinueWith<T>(this UniTask<T> task, Action<T> continuationFunction)\n        {\n            continuationFunction(await task);\n        }\n\n        public static async UniTask ContinueWith<T>(this UniTask<T> task, Func<T, UniTask> continuationFunction)\n        {\n            await continuationFunction(await task);\n        }\n\n        public static async UniTask<TR> ContinueWith<T, TR>(this UniTask<T> task, Func<T, TR> continuationFunction)\n        {\n            return continuationFunction(await task);\n        }\n\n        public static async UniTask<TR> ContinueWith<T, TR>(this UniTask<T> task, Func<T, UniTask<TR>> continuationFunction)\n        {\n            return await continuationFunction(await task);\n        }\n\n        public static async UniTask ContinueWith(this UniTask task, Action continuationFunction)\n        {\n            await task;\n            continuationFunction();\n        }\n\n        public static async UniTask ContinueWith(this UniTask task, Func<UniTask> continuationFunction)\n        {\n            await task;\n            await continuationFunction();\n        }\n\n        public static async UniTask<T> ContinueWith<T>(this UniTask task, Func<T> continuationFunction)\n        {\n            await task;\n            return continuationFunction();\n        }\n\n        public static async UniTask<T> ContinueWith<T>(this UniTask task, Func<UniTask<T>> continuationFunction)\n        {\n            await task;\n            return await continuationFunction();\n        }\n\n        public static async UniTask<T> Unwrap<T>(this UniTask<UniTask<T>> task)\n        {\n            return await await task;\n        }\n\n        public static async UniTask Unwrap(this UniTask<UniTask> task)\n        {\n            await await task;\n        }\n\n        public static async UniTask<T> Unwrap<T>(this Task<UniTask<T>> task)\n        {\n            return await await task;\n        }\n\n        public static async UniTask<T> Unwrap<T>(this Task<UniTask<T>> task, bool continueOnCapturedContext)\n        {\n            return await await task.ConfigureAwait(continueOnCapturedContext);\n        }\n\n        public static async UniTask Unwrap(this Task<UniTask> task)\n        {\n            await await task;\n        }\n\n        public static async UniTask Unwrap(this Task<UniTask> task, bool continueOnCapturedContext)\n        {\n            await await task.ConfigureAwait(continueOnCapturedContext);\n        }\n\n        public static async UniTask<T> Unwrap<T>(this UniTask<Task<T>> task)\n        {\n            return await await task;\n        }\n\n        public static async UniTask<T> Unwrap<T>(this UniTask<Task<T>> task, bool continueOnCapturedContext)\n        {\n            return await (await task).ConfigureAwait(continueOnCapturedContext);\n        }\n\n        public static async UniTask Unwrap(this UniTask<Task> task)\n        {\n            await await task;\n        }\n\n        public static async UniTask Unwrap(this UniTask<Task> task, bool continueOnCapturedContext)\n        {\n            await (await task).ConfigureAwait(continueOnCapturedContext);\n        }\n\n#if UNITY_2018_3_OR_NEWER\n\n        sealed class ToCoroutineEnumerator : IEnumerator\n        {\n            bool completed;\n            UniTask task;\n            Action<Exception> exceptionHandler = null;\n            bool isStarted = false;\n            ExceptionDispatchInfo exception;\n\n            public ToCoroutineEnumerator(UniTask task, Action<Exception> exceptionHandler)\n            {\n                completed = false;\n                this.exceptionHandler = exceptionHandler;\n                this.task = task;\n            }\n\n            async UniTaskVoid RunTask(UniTask task)\n            {\n                try\n                {\n                    await task;\n                }\n                catch (Exception ex)\n                {\n                    if (exceptionHandler != null)\n                    {\n                        exceptionHandler(ex);\n                    }\n                    else\n                    {\n                        this.exception = ExceptionDispatchInfo.Capture(ex);\n                    }\n                }\n                finally\n                {\n                    completed = true;\n                }\n            }\n\n            public object Current => null;\n\n            public bool MoveNext()\n            {\n                if (!isStarted)\n                {\n                    isStarted = true;\n                    RunTask(task).Forget();\n                }\n\n                if (exception != null)\n                {\n                    exception.Throw();\n                    return false;\n                }\n\n                return !completed;\n            }\n\n            void IEnumerator.Reset()\n            {\n            }\n        }\n\n        sealed class ToCoroutineEnumerator<T> : IEnumerator\n        {\n            bool completed;\n            Action<T> resultHandler = null;\n            Action<Exception> exceptionHandler = null;\n            bool isStarted = false;\n            UniTask<T> task;\n            object current = null;\n            ExceptionDispatchInfo exception;\n\n            public ToCoroutineEnumerator(UniTask<T> task, Action<T> resultHandler, Action<Exception> exceptionHandler)\n            {\n                completed = false;\n                this.task = task;\n                this.resultHandler = resultHandler;\n                this.exceptionHandler = exceptionHandler;\n            }\n\n            async UniTaskVoid RunTask(UniTask<T> task)\n            {\n                try\n                {\n                    var value = await task;\n                    current = value; // boxed if T is struct...\n                    if (resultHandler != null)\n                    {\n                        resultHandler(value);\n                    }\n                }\n                catch (Exception ex)\n                {\n                    if (exceptionHandler != null)\n                    {\n                        exceptionHandler(ex);\n                    }\n                    else\n                    {\n                        this.exception = ExceptionDispatchInfo.Capture(ex);\n                    }\n                }\n                finally\n                {\n                    completed = true;\n                }\n            }\n\n            public object Current => current;\n\n            public bool MoveNext()\n            {\n                if (!isStarted)\n                {\n                    isStarted = true;\n                    RunTask(task).Forget();\n                }\n\n                if (exception != null)\n                {\n                    exception.Throw();\n                    return false;\n                }\n\n                return !completed;\n            }\n\n            void IEnumerator.Reset()\n            {\n            }\n        }\n\n#endif\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 05460c617dae1e440861a7438535389f\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskObservableExtensions.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Runtime.ExceptionServices;\nusing System.Threading;\nusing Cysharp.Threading.Tasks.Internal;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static class UniTaskObservableExtensions\n    {\n        public static UniTask<T> ToUniTask<T>(this IObservable<T> source, bool useFirstValue = false, CancellationToken cancellationToken = default)\n        {\n            var promise = new UniTaskCompletionSource<T>();\n            var disposable = new SingleAssignmentDisposable();\n\n            var observer = useFirstValue\n                ? (IObserver<T>)new FirstValueToUniTaskObserver<T>(promise, disposable, cancellationToken)\n                : (IObserver<T>)new ToUniTaskObserver<T>(promise, disposable, cancellationToken);\n\n            try\n            {\n                disposable.Disposable = source.Subscribe(observer);\n            }\n            catch (Exception ex)\n            {\n                promise.TrySetException(ex);\n            }\n\n            return promise.Task;\n        }\n\n        public static IObservable<T> ToObservable<T>(this UniTask<T> task)\n        {\n            if (task.Status.IsCompleted())\n            {\n                try\n                {\n                    return new ReturnObservable<T>(task.GetAwaiter().GetResult());\n                }\n                catch (Exception ex)\n                {\n                    return new ThrowObservable<T>(ex);\n                }\n            }\n\n            var subject = new AsyncSubject<T>();\n            Fire(subject, task).Forget();\n            return subject;\n        }\n\n        /// <summary>\n        /// Ideally returns IObservabl[Unit] is best but Cysharp.Threading.Tasks does not have Unit so return AsyncUnit instead.\n        /// </summary>\n        public static IObservable<AsyncUnit> ToObservable(this UniTask task)\n        {\n            if (task.Status.IsCompleted())\n            {\n                try\n                {\n                    task.GetAwaiter().GetResult();\n                    return new ReturnObservable<AsyncUnit>(AsyncUnit.Default);\n                }\n                catch (Exception ex)\n                {\n                    return new ThrowObservable<AsyncUnit>(ex);\n                }\n            }\n\n            var subject = new AsyncSubject<AsyncUnit>();\n            Fire(subject, task).Forget();\n            return subject;\n        }\n\n        static async UniTaskVoid Fire<T>(AsyncSubject<T> subject, UniTask<T> task)\n        {\n            T value;\n            try\n            {\n                value = await task;\n            }\n            catch (Exception ex)\n            {\n                subject.OnError(ex);\n                return;\n            }\n\n            subject.OnNext(value);\n            subject.OnCompleted();\n        }\n\n        static async UniTaskVoid Fire(AsyncSubject<AsyncUnit> subject, UniTask task)\n        {\n            try\n            {\n                await task;\n            }\n            catch (Exception ex)\n            {\n                subject.OnError(ex);\n                return;\n            }\n\n            subject.OnNext(AsyncUnit.Default);\n            subject.OnCompleted();\n        }\n\n        class ToUniTaskObserver<T> : IObserver<T>\n        {\n            static readonly Action<object> callback = OnCanceled;\n\n            readonly UniTaskCompletionSource<T> promise;\n            readonly SingleAssignmentDisposable disposable;\n            readonly CancellationToken cancellationToken;\n            readonly CancellationTokenRegistration registration;\n\n            bool hasValue;\n            T latestValue;\n\n            public ToUniTaskObserver(UniTaskCompletionSource<T> promise, SingleAssignmentDisposable disposable, CancellationToken cancellationToken)\n            {\n                this.promise = promise;\n                this.disposable = disposable;\n                this.cancellationToken = cancellationToken;\n\n                if (this.cancellationToken.CanBeCanceled)\n                {\n                    this.registration = this.cancellationToken.RegisterWithoutCaptureExecutionContext(callback, this);\n                }\n            }\n\n            static void OnCanceled(object state)\n            {\n                var self = (ToUniTaskObserver<T>)state;\n                self.disposable.Dispose();\n                self.promise.TrySetCanceled(self.cancellationToken);\n            }\n\n            public void OnNext(T value)\n            {\n                hasValue = true;\n                latestValue = value;\n            }\n\n            public void OnError(Exception error)\n            {\n                try\n                {\n                    promise.TrySetException(error);\n                }\n                finally\n                {\n                    registration.Dispose();\n                    disposable.Dispose();\n                }\n            }\n\n            public void OnCompleted()\n            {\n                try\n                {\n                    if (hasValue)\n                    {\n                        promise.TrySetResult(latestValue);\n                    }\n                    else\n                    {\n                        promise.TrySetException(new InvalidOperationException(\"Sequence has no elements\"));\n                    }\n                }\n                finally\n                {\n                    registration.Dispose();\n                    disposable.Dispose();\n                }\n            }\n        }\n\n        class FirstValueToUniTaskObserver<T> : IObserver<T>\n        {\n            static readonly Action<object> callback = OnCanceled;\n\n            readonly UniTaskCompletionSource<T> promise;\n            readonly SingleAssignmentDisposable disposable;\n            readonly CancellationToken cancellationToken;\n            readonly CancellationTokenRegistration registration;\n\n            bool hasValue;\n\n            public FirstValueToUniTaskObserver(UniTaskCompletionSource<T> promise, SingleAssignmentDisposable disposable, CancellationToken cancellationToken)\n            {\n                this.promise = promise;\n                this.disposable = disposable;\n                this.cancellationToken = cancellationToken;\n\n                if (this.cancellationToken.CanBeCanceled)\n                {\n                    this.registration = this.cancellationToken.RegisterWithoutCaptureExecutionContext(callback, this);\n                }\n            }\n\n            static void OnCanceled(object state)\n            {\n                var self = (FirstValueToUniTaskObserver<T>)state;\n                self.disposable.Dispose();\n                self.promise.TrySetCanceled(self.cancellationToken);\n            }\n\n            public void OnNext(T value)\n            {\n                hasValue = true;\n                try\n                {\n                    promise.TrySetResult(value);\n                }\n                finally\n                {\n                    registration.Dispose();\n                    disposable.Dispose();\n                }\n            }\n\n            public void OnError(Exception error)\n            {\n                try\n                {\n                    promise.TrySetException(error);\n                }\n                finally\n                {\n                    registration.Dispose();\n                    disposable.Dispose();\n                }\n            }\n\n            public void OnCompleted()\n            {\n                try\n                {\n                    if (!hasValue)\n                    {\n                        promise.TrySetException(new InvalidOperationException(\"Sequence has no elements\"));\n                    }\n                }\n                finally\n                {\n                    registration.Dispose();\n                    disposable.Dispose();\n                }\n            }\n        }\n\n        class ReturnObservable<T> : IObservable<T>\n        {\n            readonly T value;\n\n            public ReturnObservable(T value)\n            {\n                this.value = value;\n            }\n\n            public IDisposable Subscribe(IObserver<T> observer)\n            {\n                observer.OnNext(value);\n                observer.OnCompleted();\n                return EmptyDisposable.Instance;\n            }\n        }\n\n        class ThrowObservable<T> : IObservable<T>\n        {\n            readonly Exception value;\n\n            public ThrowObservable(Exception value)\n            {\n                this.value = value;\n            }\n\n            public IDisposable Subscribe(IObserver<T> observer)\n            {\n                observer.OnError(value);\n                return EmptyDisposable.Instance;\n            }\n        }\n    }\n}\n\nnamespace Cysharp.Threading.Tasks.Internal\n{\n    // Bridges for Rx.\n\n    internal class EmptyDisposable : IDisposable\n    {\n        public static EmptyDisposable Instance = new EmptyDisposable();\n\n        EmptyDisposable()\n        {\n\n        }\n\n        public void Dispose()\n        {\n        }\n    }\n\n    internal sealed class SingleAssignmentDisposable : IDisposable\n    {\n        readonly object gate = new object();\n        IDisposable current;\n        bool disposed;\n\n        public bool IsDisposed { get { lock (gate) { return disposed; } } }\n\n        public IDisposable Disposable\n        {\n            get\n            {\n                return current;\n            }\n            set\n            {\n                var old = default(IDisposable);\n                bool alreadyDisposed;\n                lock (gate)\n                {\n                    alreadyDisposed = disposed;\n                    old = current;\n                    if (!alreadyDisposed)\n                    {\n                        if (value == null) return;\n                        current = value;\n                    }\n                }\n\n                if (alreadyDisposed && value != null)\n                {\n                    value.Dispose();\n                    return;\n                }\n\n                if (old != null) throw new InvalidOperationException(\"Disposable is already set\");\n            }\n        }\n\n\n        public void Dispose()\n        {\n            IDisposable old = null;\n\n            lock (gate)\n            {\n                if (!disposed)\n                {\n                    disposed = true;\n                    old = current;\n                    current = null;\n                }\n            }\n\n            if (old != null) old.Dispose();\n        }\n    }\n\n    internal sealed class AsyncSubject<T> : IObservable<T>, IObserver<T>\n    {\n        object observerLock = new object();\n\n        T lastValue;\n        bool hasValue;\n        bool isStopped;\n        bool isDisposed;\n        Exception lastError;\n        IObserver<T> outObserver = EmptyObserver<T>.Instance;\n\n        public T Value\n        {\n            get\n            {\n                ThrowIfDisposed();\n                if (!isStopped) throw new InvalidOperationException(\"AsyncSubject is not completed yet\");\n                if (lastError != null) ExceptionDispatchInfo.Capture(lastError).Throw();\n                return lastValue;\n            }\n        }\n\n        public bool HasObservers\n        {\n            get\n            {\n                return !(outObserver is EmptyObserver<T>) && !isStopped && !isDisposed;\n            }\n        }\n\n        public bool IsCompleted { get { return isStopped; } }\n\n        public void OnCompleted()\n        {\n            IObserver<T> old;\n            T v;\n            bool hv;\n            lock (observerLock)\n            {\n                ThrowIfDisposed();\n                if (isStopped) return;\n\n                old = outObserver;\n                outObserver = EmptyObserver<T>.Instance;\n                isStopped = true;\n                v = lastValue;\n                hv = hasValue;\n            }\n\n            if (hv)\n            {\n                old.OnNext(v);\n                old.OnCompleted();\n            }\n            else\n            {\n                old.OnCompleted();\n            }\n        }\n\n        public void OnError(Exception error)\n        {\n            if (error == null) throw new ArgumentNullException(\"error\");\n\n            IObserver<T> old;\n            lock (observerLock)\n            {\n                ThrowIfDisposed();\n                if (isStopped) return;\n\n                old = outObserver;\n                outObserver = EmptyObserver<T>.Instance;\n                isStopped = true;\n                lastError = error;\n            }\n\n            old.OnError(error);\n        }\n\n        public void OnNext(T value)\n        {\n            lock (observerLock)\n            {\n                ThrowIfDisposed();\n                if (isStopped) return;\n\n                this.hasValue = true;\n                this.lastValue = value;\n            }\n        }\n\n        public IDisposable Subscribe(IObserver<T> observer)\n        {\n            if (observer == null) throw new ArgumentNullException(\"observer\");\n\n            var ex = default(Exception);\n            var v = default(T);\n            var hv = false;\n\n            lock (observerLock)\n            {\n                ThrowIfDisposed();\n                if (!isStopped)\n                {\n                    var listObserver = outObserver as ListObserver<T>;\n                    if (listObserver != null)\n                    {\n                        outObserver = listObserver.Add(observer);\n                    }\n                    else\n                    {\n                        var current = outObserver;\n                        if (current is EmptyObserver<T>)\n                        {\n                            outObserver = observer;\n                        }\n                        else\n                        {\n                            outObserver = new ListObserver<T>(new ImmutableList<IObserver<T>>(new[] { current, observer }));\n                        }\n                    }\n\n                    return new Subscription(this, observer);\n                }\n\n                ex = lastError;\n                v = lastValue;\n                hv = hasValue;\n            }\n\n            if (ex != null)\n            {\n                observer.OnError(ex);\n            }\n            else if (hv)\n            {\n                observer.OnNext(v);\n                observer.OnCompleted();\n            }\n            else\n            {\n                observer.OnCompleted();\n            }\n\n            return EmptyDisposable.Instance;\n        }\n\n        public void Dispose()\n        {\n            lock (observerLock)\n            {\n                isDisposed = true;\n                outObserver = DisposedObserver<T>.Instance;\n                lastError = null;\n                lastValue = default(T);\n            }\n        }\n\n        void ThrowIfDisposed()\n        {\n            if (isDisposed) throw new ObjectDisposedException(\"\");\n        }\n        \n        class Subscription : IDisposable\n        {\n            readonly object gate = new object();\n            AsyncSubject<T> parent;\n            IObserver<T> unsubscribeTarget;\n\n            public Subscription(AsyncSubject<T> parent, IObserver<T> unsubscribeTarget)\n            {\n                this.parent = parent;\n                this.unsubscribeTarget = unsubscribeTarget;\n            }\n\n            public void Dispose()\n            {\n                lock (gate)\n                {\n                    if (parent != null)\n                    {\n                        lock (parent.observerLock)\n                        {\n                            var listObserver = parent.outObserver as ListObserver<T>;\n                            if (listObserver != null)\n                            {\n                                parent.outObserver = listObserver.Remove(unsubscribeTarget);\n                            }\n                            else\n                            {\n                                parent.outObserver = EmptyObserver<T>.Instance;\n                            }\n\n                            unsubscribeTarget = null;\n                            parent = null;\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    internal class ListObserver<T> : IObserver<T>\n    {\n        private readonly ImmutableList<IObserver<T>> _observers;\n\n        public ListObserver(ImmutableList<IObserver<T>> observers)\n        {\n            _observers = observers;\n        }\n\n        public void OnCompleted()\n        {\n            var targetObservers = _observers.Data;\n            for (int i = 0; i < targetObservers.Length; i++)\n            {\n                targetObservers[i].OnCompleted();\n            }\n        }\n\n        public void OnError(Exception error)\n        {\n            var targetObservers = _observers.Data;\n            for (int i = 0; i < targetObservers.Length; i++)\n            {\n                targetObservers[i].OnError(error);\n            }\n        }\n\n        public void OnNext(T value)\n        {\n            var targetObservers = _observers.Data;\n            for (int i = 0; i < targetObservers.Length; i++)\n            {\n                targetObservers[i].OnNext(value);\n            }\n        }\n\n        internal IObserver<T> Add(IObserver<T> observer)\n        {\n            return new ListObserver<T>(_observers.Add(observer));\n        }\n\n        internal IObserver<T> Remove(IObserver<T> observer)\n        {\n            var i = Array.IndexOf(_observers.Data, observer);\n            if (i < 0)\n                return this;\n\n            if (_observers.Data.Length == 2)\n            {\n                return _observers.Data[1 - i];\n            }\n            else\n            {\n                return new ListObserver<T>(_observers.Remove(observer));\n            }\n        }\n    }\n\n    internal class EmptyObserver<T> : IObserver<T>\n    {\n        public static readonly EmptyObserver<T> Instance = new EmptyObserver<T>();\n\n        EmptyObserver()\n        {\n\n        }\n\n        public void OnCompleted()\n        {\n        }\n\n        public void OnError(Exception error)\n        {\n        }\n\n        public void OnNext(T value)\n        {\n        }\n    }\n\n    internal class ThrowObserver<T> : IObserver<T>\n    {\n        public static readonly ThrowObserver<T> Instance = new ThrowObserver<T>();\n\n        ThrowObserver()\n        {\n\n        }\n\n        public void OnCompleted()\n        {\n        }\n\n        public void OnError(Exception error)\n        {\n            ExceptionDispatchInfo.Capture(error).Throw();\n        }\n\n        public void OnNext(T value)\n        {\n        }\n    }\n\n    internal class DisposedObserver<T> : IObserver<T>\n    {\n        public static readonly DisposedObserver<T> Instance = new DisposedObserver<T>();\n\n        DisposedObserver()\n        {\n\n        }\n\n        public void OnCompleted()\n        {\n            throw new ObjectDisposedException(\"\");\n        }\n\n        public void OnError(Exception error)\n        {\n            throw new ObjectDisposedException(\"\");\n        }\n\n        public void OnNext(T value)\n        {\n            throw new ObjectDisposedException(\"\");\n        }\n    }\n\n    internal class ImmutableList<T>\n    {\n        public static readonly ImmutableList<T> Empty = new ImmutableList<T>();\n\n        T[] data;\n\n        public T[] Data\n        {\n            get { return data; }\n        }\n\n        ImmutableList()\n        {\n            data = new T[0];\n        }\n\n        public ImmutableList(T[] data)\n        {\n            this.data = data;\n        }\n\n        public ImmutableList<T> Add(T value)\n        {\n            var newData = new T[data.Length + 1];\n            Array.Copy(data, newData, data.Length);\n            newData[data.Length] = value;\n            return new ImmutableList<T>(newData);\n        }\n\n        public ImmutableList<T> Remove(T value)\n        {\n            var i = IndexOf(value);\n            if (i < 0) return this;\n\n            var length = data.Length;\n            if (length == 1) return Empty;\n\n            var newData = new T[length - 1];\n\n            Array.Copy(data, 0, newData, 0, i);\n            Array.Copy(data, i + 1, newData, i, length - i - 1);\n\n            return new ImmutableList<T>(newData);\n        }\n\n        public int IndexOf(T value)\n        {\n            for (var i = 0; i < data.Length; ++i)\n            {\n                // ImmutableList only use for IObserver(no worry for boxed)\n                if (object.Equals(data[i], value)) return i;\n            }\n            return -1;\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskObservableExtensions.cs.meta",
    "content": "fileFormatVersion: 2\nguid: eaea262a5ad393d419c15b3b2901d664\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskScheduler.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    // UniTask has no scheduler like TaskScheduler.\n    // Only handle unobserved exception.\n\n    public static class UniTaskScheduler\n    {\n        public static event Action<Exception> UnobservedTaskException;\n\n        /// <summary>\n        /// Propagate OperationCanceledException to UnobservedTaskException when true. Default is false.\n        /// </summary>\n        public static bool PropagateOperationCanceledException = false;\n\n#if UNITY_2018_3_OR_NEWER\n\n        /// <summary>\n        /// Write log type when catch unobserved exception and not registered UnobservedTaskException. Default is Exception.\n        /// </summary>\n        public static UnityEngine.LogType UnobservedExceptionWriteLogType = UnityEngine.LogType.Exception;\n\n        /// <summary>\n        /// Dispatch exception event to Unity MainThread. Default is true.\n        /// </summary>\n        public static bool DispatchUnityMainThread = true;\n        \n        // cache delegate.\n        static readonly SendOrPostCallback handleExceptionInvoke = InvokeUnobservedTaskException;\n\n        static void InvokeUnobservedTaskException(object state)\n        {\n            UnobservedTaskException((Exception)state);\n        }\n#endif\n\n        internal static void PublishUnobservedTaskException(Exception ex)\n        {\n            if (ex != null)\n            {\n                if (!PropagateOperationCanceledException && ex is OperationCanceledException)\n                {\n                    return;\n                }\n\n                if (UnobservedTaskException != null)\n                {\n#if UNITY_2018_3_OR_NEWER\n                    if (!DispatchUnityMainThread || Thread.CurrentThread.ManagedThreadId == PlayerLoopHelper.MainThreadId)\n                    {\n                        // allows inlining call.\n                        UnobservedTaskException.Invoke(ex);\n                    }\n                    else\n                    {\n                        // Post to MainThread.\n                        PlayerLoopHelper.UnitySynchronizationContext.Post(handleExceptionInvoke, ex);\n                    }\n#else\n                    UnobservedTaskException.Invoke(ex);\n#endif\n                }\n                else\n                {\n#if UNITY_2018_3_OR_NEWER\n                    string msg = null;\n                    if (UnobservedExceptionWriteLogType != UnityEngine.LogType.Exception)\n                    {\n                        msg = \"UnobservedTaskException: \" + ex.ToString();\n                    }\n                    switch (UnobservedExceptionWriteLogType)\n                    {\n                        case UnityEngine.LogType.Error:\n                            UnityEngine.Debug.LogError(msg);\n                            break;\n                        case UnityEngine.LogType.Assert:\n                            UnityEngine.Debug.LogAssertion(msg);\n                            break;\n                        case UnityEngine.LogType.Warning:\n                            UnityEngine.Debug.LogWarning(msg);\n                            break;\n                        case UnityEngine.LogType.Log:\n                            UnityEngine.Debug.Log(msg);\n                            break;\n                        case UnityEngine.LogType.Exception:\n                            UnityEngine.Debug.LogException(ex);\n                            break;\n                        default:\n                            break;\n                    }\n#else\n                    Console.WriteLine(\"UnobservedTaskException: \" + ex.ToString());\n#endif\n                }\n            }\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskScheduler.cs.meta",
    "content": "fileFormatVersion: 2\nguid: d6cad69921702d5488d96b5ef30df1b0\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskSynchronizationContext.cs",
    "content": "﻿using System;\nusing System.Runtime.InteropServices;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public class UniTaskSynchronizationContext : SynchronizationContext\n    {\n        const int MaxArrayLength = 0X7FEFFFFF;\n        const int InitialSize = 16;\n\n        static SpinLock gate = new SpinLock(false);\n        static bool dequing = false;\n\n        static int actionListCount = 0;\n        static Callback[] actionList = new Callback[InitialSize];\n\n        static int waitingListCount = 0;\n        static Callback[] waitingList = new Callback[InitialSize];\n\n        static int opCount;\n\n        public override void Send(SendOrPostCallback d, object state)\n        {\n            d(state);\n        }\n\n        public override void Post(SendOrPostCallback d, object state)\n        {\n            bool lockTaken = false;\n            try\n            {\n                gate.Enter(ref lockTaken);\n\n                if (dequing)\n                {\n                    // Ensure Capacity\n                    if (waitingList.Length == waitingListCount)\n                    {\n                        var newLength = waitingListCount * 2;\n                        if ((uint)newLength > MaxArrayLength) newLength = MaxArrayLength;\n\n                        var newArray = new Callback[newLength];\n                        Array.Copy(waitingList, newArray, waitingListCount);\n                        waitingList = newArray;\n                    }\n                    waitingList[waitingListCount] = new Callback(d, state);\n                    waitingListCount++;\n                }\n                else\n                {\n                    // Ensure Capacity\n                    if (actionList.Length == actionListCount)\n                    {\n                        var newLength = actionListCount * 2;\n                        if ((uint)newLength > MaxArrayLength) newLength = MaxArrayLength;\n\n                        var newArray = new Callback[newLength];\n                        Array.Copy(actionList, newArray, actionListCount);\n                        actionList = newArray;\n                    }\n                    actionList[actionListCount] = new Callback(d, state);\n                    actionListCount++;\n                }\n            }\n            finally\n            {\n                if (lockTaken) gate.Exit(false);\n            }\n        }\n\n        public override void OperationStarted()\n        {\n            Interlocked.Increment(ref opCount);\n        }\n\n        public override void OperationCompleted()\n        {\n            Interlocked.Decrement(ref opCount);\n        }\n\n        public override SynchronizationContext CreateCopy()\n        {\n            return this;\n        }\n\n        // delegate entrypoint.\n        internal static void Run()\n        {\n            {\n                bool lockTaken = false;\n                try\n                {\n                    gate.Enter(ref lockTaken);\n                    if (actionListCount == 0) return;\n                    dequing = true;\n                }\n                finally\n                {\n                    if (lockTaken) gate.Exit(false);\n                }\n            }\n\n            for (int i = 0; i < actionListCount; i++)\n            {\n                var action = actionList[i];\n                actionList[i] = default;\n                action.Invoke();\n            }\n\n            {\n                bool lockTaken = false;\n                try\n                {\n                    gate.Enter(ref lockTaken);\n                    dequing = false;\n\n                    var swapTempActionList = actionList;\n\n                    actionListCount = waitingListCount;\n                    actionList = waitingList;\n\n                    waitingListCount = 0;\n                    waitingList = swapTempActionList;\n                }\n                finally\n                {\n                    if (lockTaken) gate.Exit(false);\n                }\n            }\n        }\n\n        [StructLayout(LayoutKind.Auto)]\n        readonly struct Callback\n        {\n            readonly SendOrPostCallback callback;\n            readonly object state;\n\n            public Callback(SendOrPostCallback callback, object state)\n            {\n                this.callback = callback;\n                this.state = state;\n            }\n\n            public void Invoke()\n            {\n                try\n                {\n                    callback(state);\n                }\n                catch (Exception ex)\n                {\n                    UnityEngine.Debug.LogException(ex);\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskSynchronizationContext.cs.meta",
    "content": "fileFormatVersion: 2\nguid: abf3aae9813db2849bce518f8596e920\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskVoid.cs",
    "content": "﻿#pragma warning disable CS1591\n#pragma warning disable CS0436\n\nusing System;\nusing System.Diagnostics;\nusing System.Runtime.CompilerServices;\nusing Cysharp.Threading.Tasks.CompilerServices;\n\nnamespace Cysharp.Threading.Tasks\n{\n    [AsyncMethodBuilder(typeof(AsyncUniTaskVoidMethodBuilder))]\n    public readonly struct UniTaskVoid\n    {\n        public void Forget()\n        {\n        }\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskVoid.cs.meta",
    "content": "fileFormatVersion: 2\nguid: e9f28cd922179634d863011548f89ae7\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.AssetBundleRequestAllAssets.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\n#if UNITY_2018_4 || UNITY_2019_4_OR_NEWER\n#if UNITASK_ASSETBUNDLE_SUPPORT\n\nusing Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\nusing UnityEngine;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static partial class UnityAsyncExtensions\n    {\n        public static AssetBundleRequestAllAssetsAwaiter AwaitForAllAssets(this AssetBundleRequest asyncOperation)\n        {\n            Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));\n            return new AssetBundleRequestAllAssetsAwaiter(asyncOperation);\n        }\n\n        public static UniTask<UnityEngine.Object[]> AwaitForAllAssets(this AssetBundleRequest asyncOperation, CancellationToken cancellationToken)\n        {\n            return AwaitForAllAssets(asyncOperation, null, PlayerLoopTiming.Update, cancellationToken: cancellationToken);\n        }\n\n        public static UniTask<UnityEngine.Object[]> AwaitForAllAssets(this AssetBundleRequest asyncOperation, CancellationToken cancellationToken, bool cancelImmediately)\n        {\n            return AwaitForAllAssets(asyncOperation, progress: null, cancellationToken: cancellationToken, cancelImmediately: cancelImmediately);\n        }\n\n        public static UniTask<UnityEngine.Object[]> AwaitForAllAssets(this AssetBundleRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));\n            if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<UnityEngine.Object[]>(cancellationToken);\n            if (asyncOperation.isDone) return UniTask.FromResult(asyncOperation.allAssets);\n            return new UniTask<UnityEngine.Object[]>(AssetBundleRequestAllAssetsConfiguredSource.Create(asyncOperation, timing, progress, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n        public struct AssetBundleRequestAllAssetsAwaiter : ICriticalNotifyCompletion\n        {\n            AssetBundleRequest asyncOperation;\n            Action<AsyncOperation> continuationAction;\n\n            public AssetBundleRequestAllAssetsAwaiter(AssetBundleRequest asyncOperation)\n            {\n                this.asyncOperation = asyncOperation;\n                this.continuationAction = null;\n            }\n\n            public AssetBundleRequestAllAssetsAwaiter GetAwaiter()\n            {\n                return this;\n            }\n\n            public bool IsCompleted => asyncOperation.isDone;\n\n            public UnityEngine.Object[] GetResult()\n            {\n                if (continuationAction != null)\n                {\n                    asyncOperation.completed -= continuationAction;\n                    continuationAction = null;\n                    var result = asyncOperation.allAssets;\n                    asyncOperation = null;\n                    return result;\n                }\n                else\n                {\n                    var result = asyncOperation.allAssets;\n                    asyncOperation = null;\n                    return result;\n                }\n            }\n\n            public void OnCompleted(Action continuation)\n            {\n                UnsafeOnCompleted(continuation);\n            }\n\n            public void UnsafeOnCompleted(Action continuation)\n            {\n                Error.ThrowWhenContinuationIsAlreadyRegistered(continuationAction);\n                continuationAction = PooledDelegate<AsyncOperation>.Create(continuation);\n                asyncOperation.completed += continuationAction;\n            }\n        }\n\n        sealed class AssetBundleRequestAllAssetsConfiguredSource : IUniTaskSource<UnityEngine.Object[]>, IPlayerLoopItem, ITaskPoolNode<AssetBundleRequestAllAssetsConfiguredSource>\n        {\n            static TaskPool<AssetBundleRequestAllAssetsConfiguredSource> pool;\n            AssetBundleRequestAllAssetsConfiguredSource nextNode;\n            public ref AssetBundleRequestAllAssetsConfiguredSource NextNode => ref nextNode;\n\n            static AssetBundleRequestAllAssetsConfiguredSource()\n            {\n                TaskPool.RegisterSizeGetter(typeof(AssetBundleRequestAllAssetsConfiguredSource), () => pool.Size);\n            }\n\n            AssetBundleRequest asyncOperation;\n            IProgress<float> progress;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n            bool completed;\n\n            UniTaskCompletionSourceCore<UnityEngine.Object[]> core;\n\n            Action<AsyncOperation> continuationAction;\n\n            AssetBundleRequestAllAssetsConfiguredSource()\n            {\n                continuationAction = Continuation;\n            }\n\n            public static IUniTaskSource<UnityEngine.Object[]> Create(AssetBundleRequest asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource<UnityEngine.Object[]>.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new AssetBundleRequestAllAssetsConfiguredSource();\n                }\n\n                result.asyncOperation = asyncOperation;\n                result.progress = progress;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n                result.completed = false;\n\n                asyncOperation.completed += result.continuationAction;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var source = (AssetBundleRequestAllAssetsConfiguredSource)state;\n                        source.core.TrySetCanceled(source.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public UnityEngine.Object[] GetResult(short token)\n            {\n                try\n                {\n                    return core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                // Already completed \n                if (completed || asyncOperation == null)\n                {\n                    return false;\n                }\n                \n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (progress != null)\n                {\n                    progress.Report(asyncOperation.progress);\n                }\n\n                if (asyncOperation.isDone)\n                {\n                    core.TrySetResult(asyncOperation.allAssets);\n                    return false;\n                }\n\n                return true;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                asyncOperation = default;\n                progress = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n            \n            void Continuation(AsyncOperation _)\n            {\n                if (completed)\n                {\n                    return;\n                }\n                \n                completed = true;\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                }\n                else\n                {\n                    core.TrySetResult(asyncOperation.allAssets);\n                }\n            }\n        }\n    }\n}\n\n#endif\n#endif"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.AssetBundleRequestAllAssets.cs.meta",
    "content": "fileFormatVersion: 2\nguid: e9147caba40da434da95b39709c13784\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.AsyncGPUReadback.cs",
    "content": "﻿ #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Threading;\nusing UnityEngine.Rendering;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static partial class UnityAsyncExtensions\n    {\n        #region AsyncGPUReadbackRequest\n\n        public static UniTask<AsyncGPUReadbackRequest>.Awaiter GetAwaiter(this AsyncGPUReadbackRequest asyncOperation)\n        {\n            return ToUniTask(asyncOperation).GetAwaiter();\n        }\n\n        public static UniTask<AsyncGPUReadbackRequest> WithCancellation(this AsyncGPUReadbackRequest asyncOperation, CancellationToken cancellationToken)\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken);\n        }\n\n        public static UniTask<AsyncGPUReadbackRequest> WithCancellation(this AsyncGPUReadbackRequest asyncOperation, CancellationToken cancellationToken, bool cancelImmediately)\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken, cancelImmediately: cancelImmediately);\n        }\n\n        public static UniTask<AsyncGPUReadbackRequest> ToUniTask(this AsyncGPUReadbackRequest asyncOperation, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            if (asyncOperation.done) return UniTask.FromResult(asyncOperation);\n            return new UniTask<AsyncGPUReadbackRequest>(AsyncGPUReadbackRequestAwaiterConfiguredSource.Create(asyncOperation, timing, cancellationToken, cancelImmediately, out var token), token);\n        }\n        \n        sealed class AsyncGPUReadbackRequestAwaiterConfiguredSource : IUniTaskSource<AsyncGPUReadbackRequest>, IPlayerLoopItem, ITaskPoolNode<AsyncGPUReadbackRequestAwaiterConfiguredSource>\n        {\n            static TaskPool<AsyncGPUReadbackRequestAwaiterConfiguredSource> pool;\n            AsyncGPUReadbackRequestAwaiterConfiguredSource nextNode;\n            public ref AsyncGPUReadbackRequestAwaiterConfiguredSource NextNode => ref nextNode;\n\n            static AsyncGPUReadbackRequestAwaiterConfiguredSource()\n            {\n                TaskPool.RegisterSizeGetter(typeof(AsyncGPUReadbackRequestAwaiterConfiguredSource), () => pool.Size);\n            }\n\n            AsyncGPUReadbackRequest asyncOperation;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n            UniTaskCompletionSourceCore<AsyncGPUReadbackRequest> core;\n\n            AsyncGPUReadbackRequestAwaiterConfiguredSource()\n            {\n            }\n\n            public static IUniTaskSource<AsyncGPUReadbackRequest> Create(AsyncGPUReadbackRequest asyncOperation, PlayerLoopTiming timing, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource<AsyncGPUReadbackRequest>.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new AsyncGPUReadbackRequestAwaiterConfiguredSource();\n                }\n\n                result.asyncOperation = asyncOperation;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n                \n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var promise = (AsyncGPUReadbackRequestAwaiterConfiguredSource)state;\n                        promise.core.TrySetCanceled(promise.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public AsyncGPUReadbackRequest GetResult(short token)\n            {\n                try\n                {\n                    return core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (asyncOperation.hasError)\n                {\n                    core.TrySetException(new Exception(\"AsyncGPUReadbackRequest.hasError = true\"));\n                    return false;\n                }\n\n                if (asyncOperation.done)\n                {\n                    core.TrySetResult(asyncOperation);\n                    return false;\n                }\n\n                return true;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                asyncOperation = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n        }\n\n        #endregion\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.AsyncGPUReadback.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 98f5fedb44749ab4688674d79126b46a\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.AsyncInstantiate.cs",
    "content": "﻿// AsyncInstantiateOperation was added since Unity 2022.3.20 / 2023.3.0b7\n#if UNITY_2022_3 && !(UNITY_2022_3_0 || UNITY_2022_3_1 || UNITY_2022_3_2 || UNITY_2022_3_3 || UNITY_2022_3_4 || UNITY_2022_3_5 || UNITY_2022_3_6 || UNITY_2022_3_7 || UNITY_2022_3_8 || UNITY_2022_3_9 || UNITY_2022_3_10 || UNITY_2022_3_11 || UNITY_2022_3_12 || UNITY_2022_3_13 || UNITY_2022_3_14 || UNITY_2022_3_15 || UNITY_2022_3_16 || UNITY_2022_3_17 || UNITY_2022_3_18 || UNITY_2022_3_19)\n#define UNITY_2022_SUPPORT\n#endif\n\n#if UNITY_2022_SUPPORT || UNITY_2023_3_OR_NEWER\n\nusing Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Threading;\nusing UnityEngine;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static class AsyncInstantiateOperationExtensions\n    {\n        // AsyncInstantiateOperation<T> has GetAwaiter so no need to impl\n        // public static UniTask<T[]>.Awaiter GetAwaiter<T>(this AsyncInstantiateOperation<T> operation) where T : Object\n\n        public static UniTask<UnityEngine.Object[]> WithCancellation<T>(this AsyncInstantiateOperation asyncOperation, CancellationToken cancellationToken)\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken);\n        }\n\n        public static UniTask<UnityEngine.Object[]> WithCancellation<T>(this AsyncInstantiateOperation asyncOperation, CancellationToken cancellationToken, bool cancelImmediately)\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken, cancelImmediately: cancelImmediately);\n        }\n\n        public static UniTask<UnityEngine.Object[]> ToUniTask(this AsyncInstantiateOperation asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));\n            if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<UnityEngine.Object[]>(cancellationToken);\n            if (asyncOperation.isDone) return UniTask.FromResult(asyncOperation.Result);\n            return new UniTask<UnityEngine.Object[]>(AsyncInstantiateOperationConfiguredSource.Create(asyncOperation, timing, progress, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n        public static UniTask<T[]> WithCancellation<T>(this AsyncInstantiateOperation<T> asyncOperation, CancellationToken cancellationToken)\n            where T : UnityEngine.Object\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken);\n        }\n\n        public static UniTask<T[]> WithCancellation<T>(this AsyncInstantiateOperation<T> asyncOperation, CancellationToken cancellationToken, bool cancelImmediately)\n            where T : UnityEngine.Object\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken, cancelImmediately: cancelImmediately);\n        }\n\n        public static UniTask<T[]> ToUniTask<T>(this AsyncInstantiateOperation<T> asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n            where T : UnityEngine.Object\n        {\n            Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));\n            if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<T[]>(cancellationToken);\n            if (asyncOperation.isDone) return UniTask.FromResult(asyncOperation.Result);\n            return new UniTask<T[]>(AsyncInstantiateOperationConfiguredSource<T>.Create(asyncOperation, timing, progress, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n        sealed class AsyncInstantiateOperationConfiguredSource : IUniTaskSource<UnityEngine.Object[]>, IPlayerLoopItem, ITaskPoolNode<AsyncInstantiateOperationConfiguredSource>\n        {\n            static TaskPool<AsyncInstantiateOperationConfiguredSource> pool;\n            AsyncInstantiateOperationConfiguredSource nextNode;\n            public ref AsyncInstantiateOperationConfiguredSource NextNode => ref nextNode;\n\n            static AsyncInstantiateOperationConfiguredSource()\n            {\n                TaskPool.RegisterSizeGetter(typeof(AsyncInstantiateOperationConfiguredSource), () => pool.Size);\n            }\n\n            AsyncInstantiateOperation asyncOperation;\n            IProgress<float> progress;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n            bool completed;\n\n            UniTaskCompletionSourceCore<UnityEngine.Object[]> core;\n\n            Action<AsyncOperation> continuationAction;\n\n            AsyncInstantiateOperationConfiguredSource()\n            {\n                continuationAction = Continuation;\n            }\n\n            public static IUniTaskSource<UnityEngine.Object[]> Create(AsyncInstantiateOperation asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource<UnityEngine.Object[]>.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new AsyncInstantiateOperationConfiguredSource();\n                }\n\n                result.asyncOperation = asyncOperation;\n                result.progress = progress;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n                result.completed = false;\n\n                asyncOperation.completed += result.continuationAction;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var source = (AsyncInstantiateOperationConfiguredSource)state;\n                        source.core.TrySetCanceled(source.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public UnityEngine.Object[] GetResult(short token)\n            {\n                try\n                {\n                    return core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                // Already completed\n                if (completed || asyncOperation == null)\n                {\n                    return false;\n                }\n\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (progress != null)\n                {\n                    progress.Report(asyncOperation.progress);\n                }\n\n                if (asyncOperation.isDone)\n                {\n                    core.TrySetResult(asyncOperation.Result);\n                    return false;\n                }\n\n                return true;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                asyncOperation.completed -= continuationAction;\n                asyncOperation = default;\n                progress = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n\n            void Continuation(AsyncOperation _)\n            {\n                if (completed)\n                {\n                    return;\n                }\n                completed = true;\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                }\n                else\n                {\n                    core.TrySetResult(asyncOperation.Result);\n                }\n            }\n        }\n\n        sealed class AsyncInstantiateOperationConfiguredSource<T> : IUniTaskSource<T[]>, IPlayerLoopItem, ITaskPoolNode<AsyncInstantiateOperationConfiguredSource<T>>\n            where T : UnityEngine.Object\n        {\n            static TaskPool<AsyncInstantiateOperationConfiguredSource<T>> pool;\n            AsyncInstantiateOperationConfiguredSource<T> nextNode;\n            public ref AsyncInstantiateOperationConfiguredSource<T> NextNode => ref nextNode;\n\n            static AsyncInstantiateOperationConfiguredSource()\n            {\n                TaskPool.RegisterSizeGetter(typeof(AsyncInstantiateOperationConfiguredSource<T>), () => pool.Size);\n            }\n\n            AsyncInstantiateOperation<T> asyncOperation;\n            IProgress<float> progress;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n            bool completed;\n\n            UniTaskCompletionSourceCore<T[]> core;\n\n            Action<AsyncOperation> continuationAction;\n\n            AsyncInstantiateOperationConfiguredSource()\n            {\n                continuationAction = Continuation;\n            }\n\n            public static IUniTaskSource<T[]> Create(AsyncInstantiateOperation<T> asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource<T[]>.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new AsyncInstantiateOperationConfiguredSource<T>();\n                }\n\n                result.asyncOperation = asyncOperation;\n                result.progress = progress;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n                result.completed = false;\n\n                asyncOperation.completed += result.continuationAction;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var source = (AsyncInstantiateOperationConfiguredSource<T>)state;\n                        source.core.TrySetCanceled(source.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public T[] GetResult(short token)\n            {\n                try\n                {\n                    return core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                // Already completed\n                if (completed || asyncOperation == null)\n                {\n                    return false;\n                }\n\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (progress != null)\n                {\n                    progress.Report(asyncOperation.progress);\n                }\n\n                if (asyncOperation.isDone)\n                {\n                    core.TrySetResult(asyncOperation.Result);\n                    return false;\n                }\n\n                return true;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                asyncOperation.completed -= continuationAction;\n                asyncOperation = default;\n                progress = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n\n            void Continuation(AsyncOperation _)\n            {\n                if (completed)\n                {\n                    return;\n                }\n                completed = true;\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                }\n                else\n                {\n                    core.TrySetResult(asyncOperation.Result);\n                }\n            }\n        }\n    }\n}\n\n#endif"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.AsyncInstantiate.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 8321f4244edfdcd4798b4fcc92a736c9\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.Jobs.cs",
    "content": "﻿#if ENABLE_MANAGED_JOBS\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Threading;\nusing Unity.Jobs;\nusing UnityEngine;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static partial class UnityAsyncExtensions\n    {\n        public static async UniTask WaitAsync(this JobHandle jobHandle, PlayerLoopTiming waitTiming, CancellationToken cancellationToken = default)\n        {\n            await UniTask.Yield(waitTiming);\n            jobHandle.Complete();\n            cancellationToken.ThrowIfCancellationRequested(); // call cancel after Complete.\n        }\n\n        public static UniTask.Awaiter GetAwaiter(this JobHandle jobHandle)\n        {\n            var handler = JobHandlePromise.Create(jobHandle, out var token);\n            {\n                PlayerLoopHelper.AddAction(PlayerLoopTiming.EarlyUpdate, handler);\n                PlayerLoopHelper.AddAction(PlayerLoopTiming.PreUpdate, handler);\n                PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, handler);\n                PlayerLoopHelper.AddAction(PlayerLoopTiming.PreLateUpdate, handler);\n                PlayerLoopHelper.AddAction(PlayerLoopTiming.PostLateUpdate, handler);\n            }\n\n            return new UniTask(handler, token).GetAwaiter();\n        }\n\n        // can not pass CancellationToken because can't handle JobHandle's Complete and NativeArray.Dispose.\n\n        public static UniTask ToUniTask(this JobHandle jobHandle, PlayerLoopTiming waitTiming)\n        {\n            var handler = JobHandlePromise.Create(jobHandle, out var token);\n            {\n                PlayerLoopHelper.AddAction(waitTiming, handler);\n            }\n\n            return new UniTask(handler, token);\n        }\n\n        sealed class JobHandlePromise : IUniTaskSource, IPlayerLoopItem\n        {\n            JobHandle jobHandle;\n\n            UniTaskCompletionSourceCore<AsyncUnit> core;\n\n            // Cancellation is not supported.\n            public static JobHandlePromise Create(JobHandle jobHandle, out short token)\n            {\n                // not use pool.\n                var result = new JobHandlePromise();\n\n                result.jobHandle = jobHandle;\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public void GetResult(short token)\n            {\n                TaskTracker.RemoveTracking(this);\n                core.GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                if (jobHandle.IsCompleted | PlayerLoopHelper.IsEditorApplicationQuitting)\n                {\n                    jobHandle.Complete();\n                    core.TrySetResult(AsyncUnit.Default);\n                    return false;\n                }\n\n                return true;\n            }\n        }\n    }\n}\n\n#endif"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.Jobs.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 30979a768fbd4b94f8694eee8a305c99\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.MonoBehaviour.cs",
    "content": "﻿using System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static partial class UnityAsyncExtensions\n    {\n        public static UniTask StartAsyncCoroutine(this UnityEngine.MonoBehaviour monoBehaviour, Func<CancellationToken, UniTask> asyncCoroutine)\n        {\n            var token = monoBehaviour.GetCancellationTokenOnDestroy();\n            return asyncCoroutine(token);\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.MonoBehaviour.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 2edd588bb09eb0a4695d039d6a1f02b2\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\nusing UnityEngine;\nusing Cysharp.Threading.Tasks.Internal;\n#if ENABLE_UNITYWEBREQUEST && (!UNITY_2019_1_OR_NEWER || UNITASK_WEBREQUEST_SUPPORT)\nusing UnityEngine.Networking;\n#endif\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static partial class UnityAsyncExtensions\n    {\n        #region AsyncOperation\n\n#if !UNITY_2023_1_OR_NEWER\n        // from Unity2023.1.0a15, AsyncOperationAwaitableExtensions.GetAwaiter is defined in UnityEngine.\n        public static AsyncOperationAwaiter GetAwaiter(this AsyncOperation asyncOperation)\n        {\n            Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));\n            return new AsyncOperationAwaiter(asyncOperation);\n        }\n#endif\n\n        public static UniTask WithCancellation(this AsyncOperation asyncOperation, CancellationToken cancellationToken)\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken);\n        }\n\n        public static UniTask WithCancellation(this AsyncOperation asyncOperation, CancellationToken cancellationToken, bool cancelImmediately)\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken, cancelImmediately: cancelImmediately);\n        }\n\n        public static UniTask ToUniTask(this AsyncOperation asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));\n            if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled(cancellationToken);\n            if (asyncOperation.isDone) return UniTask.CompletedTask;\n            return new UniTask(AsyncOperationConfiguredSource.Create(asyncOperation, timing, progress, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n        public struct AsyncOperationAwaiter : ICriticalNotifyCompletion\n        {\n            AsyncOperation asyncOperation;\n            Action<AsyncOperation> continuationAction;\n\n            public AsyncOperationAwaiter(AsyncOperation asyncOperation)\n            {\n                this.asyncOperation = asyncOperation;\n                this.continuationAction = null;\n            }\n\n            public bool IsCompleted => asyncOperation.isDone;\n\n            public void GetResult()\n            {\n                if (continuationAction != null)\n                {\n                    asyncOperation.completed -= continuationAction;\n                    continuationAction = null;\n                    asyncOperation = null;\n                }\n                else\n                {\n                    asyncOperation = null;\n                }\n            }\n\n            public void OnCompleted(Action continuation)\n            {\n                UnsafeOnCompleted(continuation);\n            }\n\n            public void UnsafeOnCompleted(Action continuation)\n            {\n                Error.ThrowWhenContinuationIsAlreadyRegistered(continuationAction);\n                continuationAction = PooledDelegate<AsyncOperation>.Create(continuation);\n                asyncOperation.completed += continuationAction;\n            }\n        }\n\n        sealed class AsyncOperationConfiguredSource : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<AsyncOperationConfiguredSource>\n        {\n            static TaskPool<AsyncOperationConfiguredSource> pool;\n            AsyncOperationConfiguredSource nextNode;\n            public ref AsyncOperationConfiguredSource NextNode => ref nextNode;\n\n            static AsyncOperationConfiguredSource()\n            {\n                TaskPool.RegisterSizeGetter(typeof(AsyncOperationConfiguredSource), () => pool.Size);\n            }\n\n            AsyncOperation asyncOperation;\n            IProgress<float> progress;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n            bool completed;\n\n            UniTaskCompletionSourceCore<AsyncUnit> core;\n\n            Action<AsyncOperation> continuationAction;\n\n            AsyncOperationConfiguredSource()\n            {\n                continuationAction = Continuation;\n            }\n\n            public static IUniTaskSource Create(AsyncOperation asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new AsyncOperationConfiguredSource();\n                }\n\n                result.asyncOperation = asyncOperation;\n                result.progress = progress;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n                result.completed = false;\n                \n                asyncOperation.completed += result.continuationAction;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var source = (AsyncOperationConfiguredSource)state;\n                        source.core.TrySetCanceled(source.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public void GetResult(short token)\n            {\n                try\n                {\n                    core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                // Already completed\n                if (completed || asyncOperation == null)\n                {\n                    return false;\n                }\n\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (progress != null)\n                {\n                    progress.Report(asyncOperation.progress);\n                }\n\n                if (asyncOperation.isDone)\n                {\n                    core.TrySetResult(AsyncUnit.Default);\n                    return false;\n                }\n\n                return true;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                asyncOperation.completed -= continuationAction;\n                asyncOperation = default;\n                progress = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n\n            void Continuation(AsyncOperation _)\n            {\n                if (completed)\n                {\n                    return;\n                }\n                completed = true;\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                }\n                else\n                {\n                    core.TrySetResult(AsyncUnit.Default);\n                }\n            }\n        }\n\n        #endregion\n\n        #region ResourceRequest\n\n        public static ResourceRequestAwaiter GetAwaiter(this ResourceRequest asyncOperation)\n        {\n            Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));\n            return new ResourceRequestAwaiter(asyncOperation);\n        }\n\n        public static UniTask<UnityEngine.Object> WithCancellation(this ResourceRequest asyncOperation, CancellationToken cancellationToken)\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken);\n        }\n\n        public static UniTask<UnityEngine.Object> WithCancellation(this ResourceRequest asyncOperation, CancellationToken cancellationToken, bool cancelImmediately)\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken, cancelImmediately: cancelImmediately);\n        }\n\n        public static UniTask<UnityEngine.Object> ToUniTask(this ResourceRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));\n            if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<UnityEngine.Object>(cancellationToken);\n            if (asyncOperation.isDone) return UniTask.FromResult(asyncOperation.asset);\n            return new UniTask<UnityEngine.Object>(ResourceRequestConfiguredSource.Create(asyncOperation, timing, progress, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n        public struct ResourceRequestAwaiter : ICriticalNotifyCompletion\n        {\n            ResourceRequest asyncOperation;\n            Action<AsyncOperation> continuationAction;\n\n            public ResourceRequestAwaiter(ResourceRequest asyncOperation)\n            {\n                this.asyncOperation = asyncOperation;\n                this.continuationAction = null;\n            }\n\n            public bool IsCompleted => asyncOperation.isDone;\n\n            public UnityEngine.Object GetResult()\n            {\n                if (continuationAction != null)\n                {\n                    asyncOperation.completed -= continuationAction;\n                    continuationAction = null;\n                    var result = asyncOperation.asset;\n                    asyncOperation = null;\n                    return result;\n                }\n                else\n                {\n                    var result = asyncOperation.asset;\n                    asyncOperation = null;\n                    return result;\n                }\n            }\n\n            public void OnCompleted(Action continuation)\n            {\n                UnsafeOnCompleted(continuation);\n            }\n\n            public void UnsafeOnCompleted(Action continuation)\n            {\n                Error.ThrowWhenContinuationIsAlreadyRegistered(continuationAction);\n                continuationAction = PooledDelegate<AsyncOperation>.Create(continuation);\n                asyncOperation.completed += continuationAction;\n            }\n        }\n\n        sealed class ResourceRequestConfiguredSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<ResourceRequestConfiguredSource>\n        {\n            static TaskPool<ResourceRequestConfiguredSource> pool;\n            ResourceRequestConfiguredSource nextNode;\n            public ref ResourceRequestConfiguredSource NextNode => ref nextNode;\n\n            static ResourceRequestConfiguredSource()\n            {\n                TaskPool.RegisterSizeGetter(typeof(ResourceRequestConfiguredSource), () => pool.Size);\n            }\n\n            ResourceRequest asyncOperation;\n            IProgress<float> progress;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n            bool completed;\n\n            UniTaskCompletionSourceCore<UnityEngine.Object> core;\n\n            Action<AsyncOperation> continuationAction;\n\n            ResourceRequestConfiguredSource()\n            {\n                continuationAction = Continuation;\n            }\n\n            public static IUniTaskSource<UnityEngine.Object> Create(ResourceRequest asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource<UnityEngine.Object>.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new ResourceRequestConfiguredSource();\n                }\n\n                result.asyncOperation = asyncOperation;\n                result.progress = progress;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n                result.completed = false;\n                \n                asyncOperation.completed += result.continuationAction;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var source = (ResourceRequestConfiguredSource)state;\n                        source.core.TrySetCanceled(source.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public UnityEngine.Object GetResult(short token)\n            {\n                try\n                {\n                    return core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                // Already completed\n                if (completed || asyncOperation == null)\n                {\n                    return false;\n                }\n\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (progress != null)\n                {\n                    progress.Report(asyncOperation.progress);\n                }\n\n                if (asyncOperation.isDone)\n                {\n                    core.TrySetResult(asyncOperation.asset);\n                    return false;\n                }\n\n                return true;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                asyncOperation.completed -= continuationAction;\n                asyncOperation = default;\n                progress = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n\n            void Continuation(AsyncOperation _)\n            {\n                if (completed)\n                {\n                    return;\n                }\n                completed = true;\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                }\n                else\n                {\n                    core.TrySetResult(asyncOperation.asset);\n                }\n            }\n        }\n\n        #endregion\n\n#if UNITASK_ASSETBUNDLE_SUPPORT\n        #region AssetBundleRequest\n\n        public static AssetBundleRequestAwaiter GetAwaiter(this AssetBundleRequest asyncOperation)\n        {\n            Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));\n            return new AssetBundleRequestAwaiter(asyncOperation);\n        }\n\n        public static UniTask<UnityEngine.Object> WithCancellation(this AssetBundleRequest asyncOperation, CancellationToken cancellationToken)\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken);\n        }\n\n        public static UniTask<UnityEngine.Object> WithCancellation(this AssetBundleRequest asyncOperation, CancellationToken cancellationToken, bool cancelImmediately)\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken, cancelImmediately: cancelImmediately);\n        }\n\n        public static UniTask<UnityEngine.Object> ToUniTask(this AssetBundleRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));\n            if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<UnityEngine.Object>(cancellationToken);\n            if (asyncOperation.isDone) return UniTask.FromResult(asyncOperation.asset);\n            return new UniTask<UnityEngine.Object>(AssetBundleRequestConfiguredSource.Create(asyncOperation, timing, progress, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n        public struct AssetBundleRequestAwaiter : ICriticalNotifyCompletion\n        {\n            AssetBundleRequest asyncOperation;\n            Action<AsyncOperation> continuationAction;\n\n            public AssetBundleRequestAwaiter(AssetBundleRequest asyncOperation)\n            {\n                this.asyncOperation = asyncOperation;\n                this.continuationAction = null;\n            }\n\n            public bool IsCompleted => asyncOperation.isDone;\n\n            public UnityEngine.Object GetResult()\n            {\n                if (continuationAction != null)\n                {\n                    asyncOperation.completed -= continuationAction;\n                    continuationAction = null;\n                    var result = asyncOperation.asset;\n                    asyncOperation = null;\n                    return result;\n                }\n                else\n                {\n                    var result = asyncOperation.asset;\n                    asyncOperation = null;\n                    return result;\n                }\n            }\n\n            public void OnCompleted(Action continuation)\n            {\n                UnsafeOnCompleted(continuation);\n            }\n\n            public void UnsafeOnCompleted(Action continuation)\n            {\n                Error.ThrowWhenContinuationIsAlreadyRegistered(continuationAction);\n                continuationAction = PooledDelegate<AsyncOperation>.Create(continuation);\n                asyncOperation.completed += continuationAction;\n            }\n        }\n\n        sealed class AssetBundleRequestConfiguredSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<AssetBundleRequestConfiguredSource>\n        {\n            static TaskPool<AssetBundleRequestConfiguredSource> pool;\n            AssetBundleRequestConfiguredSource nextNode;\n            public ref AssetBundleRequestConfiguredSource NextNode => ref nextNode;\n\n            static AssetBundleRequestConfiguredSource()\n            {\n                TaskPool.RegisterSizeGetter(typeof(AssetBundleRequestConfiguredSource), () => pool.Size);\n            }\n\n            AssetBundleRequest asyncOperation;\n            IProgress<float> progress;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n            bool completed;\n\n            UniTaskCompletionSourceCore<UnityEngine.Object> core;\n\n            Action<AsyncOperation> continuationAction;\n\n            AssetBundleRequestConfiguredSource()\n            {\n                continuationAction = Continuation;\n            }\n\n            public static IUniTaskSource<UnityEngine.Object> Create(AssetBundleRequest asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource<UnityEngine.Object>.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new AssetBundleRequestConfiguredSource();\n                }\n\n                result.asyncOperation = asyncOperation;\n                result.progress = progress;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n                result.completed = false;\n                \n                asyncOperation.completed += result.continuationAction;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var source = (AssetBundleRequestConfiguredSource)state;\n                        source.core.TrySetCanceled(source.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public UnityEngine.Object GetResult(short token)\n            {\n                try\n                {\n                    return core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                // Already completed\n                if (completed || asyncOperation == null)\n                {\n                    return false;\n                }\n\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (progress != null)\n                {\n                    progress.Report(asyncOperation.progress);\n                }\n\n                if (asyncOperation.isDone)\n                {\n                    core.TrySetResult(asyncOperation.asset);\n                    return false;\n                }\n\n                return true;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                asyncOperation.completed -= continuationAction;\n                asyncOperation = default;\n                progress = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n\n            void Continuation(AsyncOperation _)\n            {\n                if (completed)\n                {\n                    return;\n                }\n                completed = true;\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                }\n                else\n                {\n                    core.TrySetResult(asyncOperation.asset);\n                }\n            }\n        }\n\n        #endregion\n#endif\n\n#if UNITASK_ASSETBUNDLE_SUPPORT\n        #region AssetBundleCreateRequest\n\n        public static AssetBundleCreateRequestAwaiter GetAwaiter(this AssetBundleCreateRequest asyncOperation)\n        {\n            Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));\n            return new AssetBundleCreateRequestAwaiter(asyncOperation);\n        }\n\n        public static UniTask<AssetBundle> WithCancellation(this AssetBundleCreateRequest asyncOperation, CancellationToken cancellationToken)\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken);\n        }\n\n        public static UniTask<AssetBundle> WithCancellation(this AssetBundleCreateRequest asyncOperation, CancellationToken cancellationToken, bool cancelImmediately)\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken, cancelImmediately: cancelImmediately);\n        }\n\n        public static UniTask<AssetBundle> ToUniTask(this AssetBundleCreateRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));\n            if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<AssetBundle>(cancellationToken);\n            if (asyncOperation.isDone) return UniTask.FromResult(asyncOperation.assetBundle);\n            return new UniTask<AssetBundle>(AssetBundleCreateRequestConfiguredSource.Create(asyncOperation, timing, progress, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n        public struct AssetBundleCreateRequestAwaiter : ICriticalNotifyCompletion\n        {\n            AssetBundleCreateRequest asyncOperation;\n            Action<AsyncOperation> continuationAction;\n\n            public AssetBundleCreateRequestAwaiter(AssetBundleCreateRequest asyncOperation)\n            {\n                this.asyncOperation = asyncOperation;\n                this.continuationAction = null;\n            }\n\n            public bool IsCompleted => asyncOperation.isDone;\n\n            public AssetBundle GetResult()\n            {\n                if (continuationAction != null)\n                {\n                    asyncOperation.completed -= continuationAction;\n                    continuationAction = null;\n                    var result = asyncOperation.assetBundle;\n                    asyncOperation = null;\n                    return result;\n                }\n                else\n                {\n                    var result = asyncOperation.assetBundle;\n                    asyncOperation = null;\n                    return result;\n                }\n            }\n\n            public void OnCompleted(Action continuation)\n            {\n                UnsafeOnCompleted(continuation);\n            }\n\n            public void UnsafeOnCompleted(Action continuation)\n            {\n                Error.ThrowWhenContinuationIsAlreadyRegistered(continuationAction);\n                continuationAction = PooledDelegate<AsyncOperation>.Create(continuation);\n                asyncOperation.completed += continuationAction;\n            }\n        }\n\n        sealed class AssetBundleCreateRequestConfiguredSource : IUniTaskSource<AssetBundle>, IPlayerLoopItem, ITaskPoolNode<AssetBundleCreateRequestConfiguredSource>\n        {\n            static TaskPool<AssetBundleCreateRequestConfiguredSource> pool;\n            AssetBundleCreateRequestConfiguredSource nextNode;\n            public ref AssetBundleCreateRequestConfiguredSource NextNode => ref nextNode;\n\n            static AssetBundleCreateRequestConfiguredSource()\n            {\n                TaskPool.RegisterSizeGetter(typeof(AssetBundleCreateRequestConfiguredSource), () => pool.Size);\n            }\n\n            AssetBundleCreateRequest asyncOperation;\n            IProgress<float> progress;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n            bool completed;\n\n            UniTaskCompletionSourceCore<AssetBundle> core;\n\n            Action<AsyncOperation> continuationAction;\n\n            AssetBundleCreateRequestConfiguredSource()\n            {\n                continuationAction = Continuation;\n            }\n\n            public static IUniTaskSource<AssetBundle> Create(AssetBundleCreateRequest asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource<AssetBundle>.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new AssetBundleCreateRequestConfiguredSource();\n                }\n\n                result.asyncOperation = asyncOperation;\n                result.progress = progress;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n                result.completed = false;\n                \n                asyncOperation.completed += result.continuationAction;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var source = (AssetBundleCreateRequestConfiguredSource)state;\n                        source.core.TrySetCanceled(source.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public AssetBundle GetResult(short token)\n            {\n                try\n                {\n                    return core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                // Already completed\n                if (completed || asyncOperation == null)\n                {\n                    return false;\n                }\n\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (progress != null)\n                {\n                    progress.Report(asyncOperation.progress);\n                }\n\n                if (asyncOperation.isDone)\n                {\n                    core.TrySetResult(asyncOperation.assetBundle);\n                    return false;\n                }\n\n                return true;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                asyncOperation.completed -= continuationAction;\n                asyncOperation = default;\n                progress = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n\n            void Continuation(AsyncOperation _)\n            {\n                if (completed)\n                {\n                    return;\n                }\n                completed = true;\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                }\n                else\n                {\n                    core.TrySetResult(asyncOperation.assetBundle);\n                }\n            }\n        }\n\n        #endregion\n#endif\n\n#if ENABLE_UNITYWEBREQUEST && (!UNITY_2019_1_OR_NEWER || UNITASK_WEBREQUEST_SUPPORT)\n        #region UnityWebRequestAsyncOperation\n\n        public static UnityWebRequestAsyncOperationAwaiter GetAwaiter(this UnityWebRequestAsyncOperation asyncOperation)\n        {\n            Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));\n            return new UnityWebRequestAsyncOperationAwaiter(asyncOperation);\n        }\n\n        public static UniTask<UnityWebRequest> WithCancellation(this UnityWebRequestAsyncOperation asyncOperation, CancellationToken cancellationToken)\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken);\n        }\n\n        public static UniTask<UnityWebRequest> WithCancellation(this UnityWebRequestAsyncOperation asyncOperation, CancellationToken cancellationToken, bool cancelImmediately)\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken, cancelImmediately: cancelImmediately);\n        }\n\n        public static UniTask<UnityWebRequest> ToUniTask(this UnityWebRequestAsyncOperation asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));\n            if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<UnityWebRequest>(cancellationToken);\n            if (asyncOperation.isDone)\n            {\n                if (asyncOperation.webRequest.IsError())\n                {\n                    return UniTask.FromException<UnityWebRequest>(new UnityWebRequestException(asyncOperation.webRequest));\n                }\n                return UniTask.FromResult(asyncOperation.webRequest);\n            }\n            return new UniTask<UnityWebRequest>(UnityWebRequestAsyncOperationConfiguredSource.Create(asyncOperation, timing, progress, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n        public struct UnityWebRequestAsyncOperationAwaiter : ICriticalNotifyCompletion\n        {\n            UnityWebRequestAsyncOperation asyncOperation;\n            Action<AsyncOperation> continuationAction;\n\n            public UnityWebRequestAsyncOperationAwaiter(UnityWebRequestAsyncOperation asyncOperation)\n            {\n                this.asyncOperation = asyncOperation;\n                this.continuationAction = null;\n            }\n\n            public bool IsCompleted => asyncOperation.isDone;\n\n            public UnityWebRequest GetResult()\n            {\n                if (continuationAction != null)\n                {\n                    asyncOperation.completed -= continuationAction;\n                    continuationAction = null;\n                    var result = asyncOperation.webRequest;\n                    asyncOperation = null;\n                    if (result.IsError())\n                    {\n                        throw new UnityWebRequestException(result);\n                    }\n                    return result;\n                }\n                else\n                {\n                    var result = asyncOperation.webRequest;\n                    asyncOperation = null;\n                    if (result.IsError())\n                    {\n                        throw new UnityWebRequestException(result);\n                    }\n                    return result;\n                }\n            }\n\n            public void OnCompleted(Action continuation)\n            {\n                UnsafeOnCompleted(continuation);\n            }\n\n            public void UnsafeOnCompleted(Action continuation)\n            {\n                Error.ThrowWhenContinuationIsAlreadyRegistered(continuationAction);\n                continuationAction = PooledDelegate<AsyncOperation>.Create(continuation);\n                asyncOperation.completed += continuationAction;\n            }\n        }\n\n        sealed class UnityWebRequestAsyncOperationConfiguredSource : IUniTaskSource<UnityWebRequest>, IPlayerLoopItem, ITaskPoolNode<UnityWebRequestAsyncOperationConfiguredSource>\n        {\n            static TaskPool<UnityWebRequestAsyncOperationConfiguredSource> pool;\n            UnityWebRequestAsyncOperationConfiguredSource nextNode;\n            public ref UnityWebRequestAsyncOperationConfiguredSource NextNode => ref nextNode;\n\n            static UnityWebRequestAsyncOperationConfiguredSource()\n            {\n                TaskPool.RegisterSizeGetter(typeof(UnityWebRequestAsyncOperationConfiguredSource), () => pool.Size);\n            }\n\n            UnityWebRequestAsyncOperation asyncOperation;\n            IProgress<float> progress;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n            bool completed;\n\n            UniTaskCompletionSourceCore<UnityWebRequest> core;\n\n            Action<AsyncOperation> continuationAction;\n\n            UnityWebRequestAsyncOperationConfiguredSource()\n            {\n                continuationAction = Continuation;\n            }\n\n            public static IUniTaskSource<UnityWebRequest> Create(UnityWebRequestAsyncOperation asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource<UnityWebRequest>.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new UnityWebRequestAsyncOperationConfiguredSource();\n                }\n\n                result.asyncOperation = asyncOperation;\n                result.progress = progress;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n                result.completed = false;\n                \n                asyncOperation.completed += result.continuationAction;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var source = (UnityWebRequestAsyncOperationConfiguredSource)state;\n                        source.asyncOperation.webRequest.Abort();\n                        source.core.TrySetCanceled(source.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public UnityWebRequest GetResult(short token)\n            {\n                try\n                {\n                    return core.GetResult(token);\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                    else\n                    {\n                        TaskTracker.RemoveTracking(this);\n                    }\n                }\n            }\n\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                // Already completed\n                if (completed || asyncOperation == null)\n                {\n                    return false;\n                }\n\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    asyncOperation.webRequest.Abort();\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (progress != null)\n                {\n                    progress.Report(asyncOperation.progress);\n                }\n\n                if (asyncOperation.isDone)\n                {\n                    if (asyncOperation.webRequest.IsError())\n                    {\n                        core.TrySetException(new UnityWebRequestException(asyncOperation.webRequest));\n                    }\n                    else\n                    {\n                        core.TrySetResult(asyncOperation.webRequest);\n                    }\n                    return false;\n                }\n\n                return true;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                asyncOperation.completed -= continuationAction;\n                asyncOperation = default;\n                progress = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n\n            void Continuation(AsyncOperation _)\n            {\n                if (completed)\n                {\n                    return;\n                }\n                completed = true;\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                }\n                else if (asyncOperation.webRequest.IsError())\n                {\n                    core.TrySetException(new UnityWebRequestException(asyncOperation.webRequest));\n                }\n                else\n                {\n                    core.TrySetResult(asyncOperation.webRequest);\n                }\n            }\n        }\n\n        #endregion\n#endif\n\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 8cc7fd65dd1433e419be4764aeb51391\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.tt",
    "content": "﻿<#@ template debug=\"false\" hostspecific=\"false\" language=\"C#\" #>\n<#@ assembly name=\"System.Core\" #>\n<#@ import namespace=\"System.Linq\" #>\n<#@ import namespace=\"System.Text\" #>\n<#@ import namespace=\"System.Collections.Generic\" #>\n<#@ output extension=\".cs\" #>\n<#\n    var types = new (string typeName, string returnType, string returnField)[]\n    {\n        (\"AsyncOperation\", \"void\", null),\n        (\"ResourceRequest\", \"UnityEngine.Object\", \"asset\"),\n        (\"AssetBundleRequest\", \"UnityEngine.Object\", \"asset\"), // allAssets?\n        (\"AssetBundleCreateRequest\", \"AssetBundle\", \"assetBundle\"),\n        (\"UnityWebRequestAsyncOperation\", \"UnityWebRequest\", \"webRequest\") // -> #if ENABLE_UNITYWEBREQUEST && (!UNITY_2019_1_OR_NEWER || UNITASK_WEBREQUEST_SUPPORT)\n    };\n\n    Func<string, string> ToUniTaskReturnType = x => (x == \"void\") ? \"UniTask\" : $\"UniTask<{x}>\";\n    Func<string, string> ToIUniTaskSourceReturnType = x => (x == \"void\") ? \"IUniTaskSource\" : $\"IUniTaskSource<{x}>\";\n    Func<(string typeName, string returnType, string returnField), bool> IsAsyncOperationBase = x => x.typeName == \"AsyncOperation\";\n    Func<(string typeName, string returnType, string returnField), bool> IsUnityWebRequest = x => x.returnType == \"UnityWebRequest\";\n    Func<(string typeName, string returnType, string returnField), bool> IsAssetBundleModule = x => x.typeName == \"AssetBundleRequest\" || x.typeName == \"AssetBundleCreateRequest\";\n    Func<(string typeName, string returnType, string returnField), bool> IsVoid = x => x.returnType == \"void\";\n#>\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing System;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\nusing UnityEngine;\nusing Cysharp.Threading.Tasks.Internal;\n#if ENABLE_UNITYWEBREQUEST && (!UNITY_2019_1_OR_NEWER || UNITASK_WEBREQUEST_SUPPORT)\nusing UnityEngine.Networking;\n#endif\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static partial class UnityAsyncExtensions\n    {\n<# foreach(var t in types) { #>\n<# if(IsUnityWebRequest(t)) { #>\n#if ENABLE_UNITYWEBREQUEST && (!UNITY_2019_1_OR_NEWER || UNITASK_WEBREQUEST_SUPPORT)\n<# } else if(IsAssetBundleModule(t)) { #>\n#if UNITASK_ASSETBUNDLE_SUPPORT\n<# } #>\n        #region <#= t.typeName #>\n\n<# if (IsAsyncOperationBase(t))  { #>\n#if !UNITY_2023_1_OR_NEWER\n        // from Unity2023.1.0a15, AsyncOperationAwaitableExtensions.GetAwaiter is defined in UnityEngine.\n<# } #>\n        public static <#= t.typeName #>Awaiter GetAwaiter(this <#= t.typeName #> asyncOperation)\n        {\n            Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));\n            return new <#= t.typeName #>Awaiter(asyncOperation);\n        }\n<# if (IsAsyncOperationBase(t))  { #>\n#endif\n<# } #>\n\n        public static <#= ToUniTaskReturnType(t.returnType) #> WithCancellation(this <#= t.typeName #> asyncOperation, CancellationToken cancellationToken)\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken);\n        }\n\n        public static <#= ToUniTaskReturnType(t.returnType) #> WithCancellation(this <#= t.typeName #> asyncOperation, CancellationToken cancellationToken, bool cancelImmediately)\n        {\n            return ToUniTask(asyncOperation, cancellationToken: cancellationToken, cancelImmediately: cancelImmediately);\n        }\n\n        public static <#= ToUniTaskReturnType(t.returnType) #> ToUniTask(this <#= t.typeName #> asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false)\n        {\n            Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));\n            if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<#= IsVoid(t) ? \"\" : \"<\" + t.returnType + \">\" #>(cancellationToken);\n<# if(IsUnityWebRequest(t)) { #>\n            if (asyncOperation.isDone)\n            {\n                if (asyncOperation.webRequest.IsError())\n                {\n                    return UniTask.FromException<UnityWebRequest>(new UnityWebRequestException(asyncOperation.webRequest));\n                }\n                return UniTask.FromResult(asyncOperation.webRequest);\n            }\n<# } else { #>\n            if (asyncOperation.isDone) return <#= IsVoid(t) ? \"UniTask.CompletedTask\" : $\"UniTask.FromResult(asyncOperation.{t.returnField})\" #>;\n<# } #>\n            return new <#= ToUniTaskReturnType(t.returnType) #>(<#= t.typeName #>ConfiguredSource.Create(asyncOperation, timing, progress, cancellationToken, cancelImmediately, out var token), token);\n        }\n\n        public struct <#= t.typeName #>Awaiter : ICriticalNotifyCompletion\n        {\n            <#= t.typeName #> asyncOperation;\n            Action<AsyncOperation> continuationAction;\n\n            public <#= t.typeName #>Awaiter(<#= t.typeName #> asyncOperation)\n            {\n                this.asyncOperation = asyncOperation;\n                this.continuationAction = null;\n            }\n\n            public bool IsCompleted => asyncOperation.isDone;\n\n            public <#= t.returnType #> GetResult()\n            {\n                if (continuationAction != null)\n                {\n                    asyncOperation.completed -= continuationAction;\n                    continuationAction = null;\n<# if (!IsVoid(t)) { #>\n                    var result = <#= $\"asyncOperation.{t.returnField}\" #>;\n                    asyncOperation = null;\n<# if(IsUnityWebRequest(t)) { #>\n                    if (result.IsError())\n                    {\n                        throw new UnityWebRequestException(result);\n                    }\n<# } #>\n                    return result;\n<# } else { #>\n                    asyncOperation = null;\n<# } #>\n                }\n                else\n                {\n<# if (!IsVoid(t)) { #>\n                    var result = <#= $\"asyncOperation.{t.returnField}\" #>;\n                    asyncOperation = null;\n<# if(IsUnityWebRequest(t)) { #>\n                    if (result.IsError())\n                    {\n                        throw new UnityWebRequestException(result);\n                    }\n<# } #>\n                    return result;\n<# } else { #>\n                    asyncOperation = null;\n<# } #>\n                }\n            }\n\n            public void OnCompleted(Action continuation)\n            {\n                UnsafeOnCompleted(continuation);\n            }\n\n            public void UnsafeOnCompleted(Action continuation)\n            {\n                Error.ThrowWhenContinuationIsAlreadyRegistered(continuationAction);\n                continuationAction = PooledDelegate<AsyncOperation>.Create(continuation);\n                asyncOperation.completed += continuationAction;\n            }\n        }\n\n        sealed class <#= t.typeName #>ConfiguredSource : <#= ToIUniTaskSourceReturnType(t.returnType) #>, IPlayerLoopItem, ITaskPoolNode<<#= t.typeName #>ConfiguredSource>\n        {\n            static TaskPool<<#= t.typeName #>ConfiguredSource> pool;\n            <#= t.typeName #>ConfiguredSource nextNode;\n            public ref <#= t.typeName #>ConfiguredSource NextNode => ref nextNode;\n\n            static <#= t.typeName #>ConfiguredSource()\n            {\n                TaskPool.RegisterSizeGetter(typeof(<#= t.typeName #>ConfiguredSource), () => pool.Size);\n            }\n\n            <#= t.typeName #> asyncOperation;\n            IProgress<float> progress;\n            CancellationToken cancellationToken;\n            CancellationTokenRegistration cancellationTokenRegistration;\n            bool cancelImmediately;\n            bool completed;\n\n            UniTaskCompletionSourceCore<<#= IsVoid(t) ? \"AsyncUnit\" : t.returnType #>> core;\n\n            Action<AsyncOperation> continuationAction;\n\n            <#= t.typeName #>ConfiguredSource()\n            {\n                continuationAction = Continuation;\n            }\n\n            public static <#= ToIUniTaskSourceReturnType(t.returnType) #> Create(<#= t.typeName #> asyncOperation, PlayerLoopTiming timing, IProgress<float> progress, CancellationToken cancellationToken, bool cancelImmediately, out short token)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return AutoResetUniTaskCompletionSource<#= IsVoid(t) ? \"\" : $\"<{t.returnType}>\" #>.CreateFromCanceled(cancellationToken, out token);\n                }\n\n                if (!pool.TryPop(out var result))\n                {\n                    result = new <#= t.typeName #>ConfiguredSource();\n                }\n\n                result.asyncOperation = asyncOperation;\n                result.progress = progress;\n                result.cancellationToken = cancellationToken;\n                result.cancelImmediately = cancelImmediately;\n                result.completed = false;\n                \n                asyncOperation.completed += result.continuationAction;\n\n                if (cancelImmediately && cancellationToken.CanBeCanceled)\n                {\n                    result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>\n                    {\n                        var source = (<#= t.typeName #>ConfiguredSource)state;\n<# if(IsUnityWebRequest(t)) { #>\n                        source.asyncOperation.webRequest.Abort();\n<# } #>\n                        source.core.TrySetCanceled(source.cancellationToken);\n                    }, result);\n                }\n\n                TaskTracker.TrackActiveTask(result, 3);\n\n                PlayerLoopHelper.AddAction(timing, result);\n\n                token = result.core.Version;\n                return result;\n            }\n\n            public <#= t.returnType #> GetResult(short token)\n            {\n                try\n                {\n<# if (!IsVoid(t)) { #>\n                    return core.GetResult(token);\n<# } else { #>\n                    core.GetResult(token);\n<# } #>\n                }\n                finally\n                {\n                    if (!(cancelImmediately && cancellationToken.IsCancellationRequested))\n                    {\n                        TryReturn();\n                    }\n                }\n            }\n\n<# if (!IsVoid(t)) { #>\n            void IUniTaskSource.GetResult(short token)\n            {\n                GetResult(token);\n            }\n<# } #>\n\n            public UniTaskStatus GetStatus(short token)\n            {\n                return core.GetStatus(token);\n            }\n\n            public UniTaskStatus UnsafeGetStatus()\n            {\n                return core.UnsafeGetStatus();\n            }\n\n            public void OnCompleted(Action<object> continuation, object state, short token)\n            {\n                core.OnCompleted(continuation, state, token);\n            }\n\n            public bool MoveNext()\n            {\n                // Already completed\n                if (completed || asyncOperation == null)\n                {\n                    return false;\n                }\n\n                if (cancellationToken.IsCancellationRequested)\n                {\n<# if(IsUnityWebRequest(t)) { #>\n                    asyncOperation.webRequest.Abort();\n<# } #>\n                    core.TrySetCanceled(cancellationToken);\n                    return false;\n                }\n\n                if (progress != null)\n                {\n                    progress.Report(asyncOperation.progress);\n                }\n\n                if (asyncOperation.isDone)\n                {\n<# if(IsUnityWebRequest(t)) { #>\n                    if (asyncOperation.webRequest.IsError())\n                    {\n                        core.TrySetException(new UnityWebRequestException(asyncOperation.webRequest));\n                    }\n                    else\n                    {\n                        core.TrySetResult(asyncOperation.webRequest);\n                    }\n<# } else { #>\n                    core.TrySetResult(<#= IsVoid(t) ? \"AsyncUnit.Default\" : $\"asyncOperation.{t.returnField}\" #>);\n<# } #>\n                    return false;\n                }\n\n                return true;\n            }\n\n            bool TryReturn()\n            {\n                TaskTracker.RemoveTracking(this);\n                core.Reset();\n                asyncOperation.completed -= continuationAction;\n                asyncOperation = default;\n                progress = default;\n                cancellationToken = default;\n                cancellationTokenRegistration.Dispose();\n                cancelImmediately = default;\n                return pool.TryPush(this);\n            }\n\n            void Continuation(AsyncOperation _)\n            {\n                if (completed)\n                {\n                    return;\n                }\n                completed = true;\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    core.TrySetCanceled(cancellationToken);\n                }\n<# if(IsUnityWebRequest(t)) { #>\n                else if (asyncOperation.webRequest.IsError())\n                {\n                    core.TrySetException(new UnityWebRequestException(asyncOperation.webRequest));\n                }\n                else\n                {\n                    core.TrySetResult(asyncOperation.webRequest);\n                }\n<# } else { #>\n                else\n                {\n                    core.TrySetResult(<#= IsVoid(t) ? \"AsyncUnit.Default\" : $\"asyncOperation.{t.returnField}\" #>);\n                }\n<# } #>\n            }\n        }\n\n        #endregion\n<# if(IsUnityWebRequest(t) || IsAssetBundleModule(t)) { #>\n#endif\n<# } #>\n\n<# } #>\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.tt.meta",
    "content": "fileFormatVersion: 2\nguid: b1053c85b3f0794488b10e6de53e9c02\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.uGUI.cs",
    "content": "﻿#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\nusing System;\nusing System.Threading;\nusing UnityEngine;\nusing UnityEngine.Events;\nusing UnityEngine.UI;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static partial class UnityAsyncExtensions\n    {\n        public static AsyncUnityEventHandler GetAsyncEventHandler(this UnityEvent unityEvent, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler(unityEvent, cancellationToken, false);\n        }\n\n        public static UniTask OnInvokeAsync(this UnityEvent unityEvent, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler(unityEvent, cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<AsyncUnit> OnInvokeAsAsyncEnumerable(this UnityEvent unityEvent, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable(unityEvent, cancellationToken);\n        }\n\n        public static AsyncUnityEventHandler<T> GetAsyncEventHandler<T>(this UnityEvent<T> unityEvent, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<T>(unityEvent, cancellationToken, false);\n        }\n\n        public static UniTask<T> OnInvokeAsync<T>(this UnityEvent<T> unityEvent, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<T>(unityEvent, cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<T> OnInvokeAsAsyncEnumerable<T>(this UnityEvent<T> unityEvent, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable<T>(unityEvent, cancellationToken);\n        }\n\n        public static IAsyncClickEventHandler GetAsyncClickEventHandler(this Button button)\n        {\n            return new AsyncUnityEventHandler(button.onClick, button.GetCancellationTokenOnDestroy(), false);\n        }\n\n        public static IAsyncClickEventHandler GetAsyncClickEventHandler(this Button button, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler(button.onClick, cancellationToken, false);\n        }\n\n        public static UniTask OnClickAsync(this Button button)\n        {\n            return new AsyncUnityEventHandler(button.onClick, button.GetCancellationTokenOnDestroy(), true).OnInvokeAsync();\n        }\n\n        public static UniTask OnClickAsync(this Button button, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler(button.onClick, cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<AsyncUnit> OnClickAsAsyncEnumerable(this Button button)\n        {\n            return new UnityEventHandlerAsyncEnumerable(button.onClick, button.GetCancellationTokenOnDestroy());\n        }\n\n        public static IUniTaskAsyncEnumerable<AsyncUnit> OnClickAsAsyncEnumerable(this Button button, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable(button.onClick, cancellationToken);\n        }\n\n        public static IAsyncValueChangedEventHandler<bool> GetAsyncValueChangedEventHandler(this Toggle toggle)\n        {\n            return new AsyncUnityEventHandler<bool>(toggle.onValueChanged, toggle.GetCancellationTokenOnDestroy(), false);\n        }\n\n        public static IAsyncValueChangedEventHandler<bool> GetAsyncValueChangedEventHandler(this Toggle toggle, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<bool>(toggle.onValueChanged, cancellationToken, false);\n        }\n\n        public static UniTask<bool> OnValueChangedAsync(this Toggle toggle)\n        {\n            return new AsyncUnityEventHandler<bool>(toggle.onValueChanged, toggle.GetCancellationTokenOnDestroy(), true).OnInvokeAsync();\n        }\n\n        public static UniTask<bool> OnValueChangedAsync(this Toggle toggle, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<bool>(toggle.onValueChanged, cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<bool> OnValueChangedAsAsyncEnumerable(this Toggle toggle)\n        {\n            return new UnityEventHandlerAsyncEnumerable<bool>(toggle.onValueChanged, toggle.GetCancellationTokenOnDestroy());\n        }\n\n        public static IUniTaskAsyncEnumerable<bool> OnValueChangedAsAsyncEnumerable(this Toggle toggle, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable<bool>(toggle.onValueChanged, cancellationToken);\n        }\n\n        public static IAsyncValueChangedEventHandler<float> GetAsyncValueChangedEventHandler(this Scrollbar scrollbar)\n        {\n            return new AsyncUnityEventHandler<float>(scrollbar.onValueChanged, scrollbar.GetCancellationTokenOnDestroy(), false);\n        }\n\n        public static IAsyncValueChangedEventHandler<float> GetAsyncValueChangedEventHandler(this Scrollbar scrollbar, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<float>(scrollbar.onValueChanged, cancellationToken, false);\n        }\n\n        public static UniTask<float> OnValueChangedAsync(this Scrollbar scrollbar)\n        {\n            return new AsyncUnityEventHandler<float>(scrollbar.onValueChanged, scrollbar.GetCancellationTokenOnDestroy(), true).OnInvokeAsync();\n        }\n\n        public static UniTask<float> OnValueChangedAsync(this Scrollbar scrollbar, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<float>(scrollbar.onValueChanged, cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<float> OnValueChangedAsAsyncEnumerable(this Scrollbar scrollbar)\n        {\n            return new UnityEventHandlerAsyncEnumerable<float>(scrollbar.onValueChanged, scrollbar.GetCancellationTokenOnDestroy());\n        }\n\n        public static IUniTaskAsyncEnumerable<float> OnValueChangedAsAsyncEnumerable(this Scrollbar scrollbar, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable<float>(scrollbar.onValueChanged, cancellationToken);\n        }\n\n        public static IAsyncValueChangedEventHandler<Vector2> GetAsyncValueChangedEventHandler(this ScrollRect scrollRect)\n        {\n            return new AsyncUnityEventHandler<Vector2>(scrollRect.onValueChanged, scrollRect.GetCancellationTokenOnDestroy(), false);\n        }\n\n        public static IAsyncValueChangedEventHandler<Vector2> GetAsyncValueChangedEventHandler(this ScrollRect scrollRect, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<Vector2>(scrollRect.onValueChanged, cancellationToken, false);\n        }\n\n        public static UniTask<Vector2> OnValueChangedAsync(this ScrollRect scrollRect)\n        {\n            return new AsyncUnityEventHandler<Vector2>(scrollRect.onValueChanged, scrollRect.GetCancellationTokenOnDestroy(), true).OnInvokeAsync();\n        }\n\n        public static UniTask<Vector2> OnValueChangedAsync(this ScrollRect scrollRect, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<Vector2>(scrollRect.onValueChanged, cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<Vector2> OnValueChangedAsAsyncEnumerable(this ScrollRect scrollRect)\n        {\n            return new UnityEventHandlerAsyncEnumerable<Vector2>(scrollRect.onValueChanged, scrollRect.GetCancellationTokenOnDestroy());\n        }\n\n        public static IUniTaskAsyncEnumerable<Vector2> OnValueChangedAsAsyncEnumerable(this ScrollRect scrollRect, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable<Vector2>(scrollRect.onValueChanged, cancellationToken);\n        }\n\n        public static IAsyncValueChangedEventHandler<float> GetAsyncValueChangedEventHandler(this Slider slider)\n        {\n            return new AsyncUnityEventHandler<float>(slider.onValueChanged, slider.GetCancellationTokenOnDestroy(), false);\n        }\n\n        public static IAsyncValueChangedEventHandler<float> GetAsyncValueChangedEventHandler(this Slider slider, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<float>(slider.onValueChanged, cancellationToken, false);\n        }\n\n        public static UniTask<float> OnValueChangedAsync(this Slider slider)\n        {\n            return new AsyncUnityEventHandler<float>(slider.onValueChanged, slider.GetCancellationTokenOnDestroy(), true).OnInvokeAsync();\n        }\n\n        public static UniTask<float> OnValueChangedAsync(this Slider slider, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<float>(slider.onValueChanged, cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<float> OnValueChangedAsAsyncEnumerable(this Slider slider)\n        {\n            return new UnityEventHandlerAsyncEnumerable<float>(slider.onValueChanged, slider.GetCancellationTokenOnDestroy());\n        }\n\n        public static IUniTaskAsyncEnumerable<float> OnValueChangedAsAsyncEnumerable(this Slider slider, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable<float>(slider.onValueChanged, cancellationToken);\n        }\n\n        public static IAsyncEndEditEventHandler<string> GetAsyncEndEditEventHandler(this InputField inputField)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onEndEdit, inputField.GetCancellationTokenOnDestroy(), false);\n        }\n\n        public static IAsyncEndEditEventHandler<string> GetAsyncEndEditEventHandler(this InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onEndEdit, cancellationToken, false);\n        }\n\n        public static UniTask<string> OnEndEditAsync(this InputField inputField)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onEndEdit, inputField.GetCancellationTokenOnDestroy(), true).OnInvokeAsync();\n        }\n\n        public static UniTask<string> OnEndEditAsync(this InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onEndEdit, cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<string> OnEndEditAsAsyncEnumerable(this InputField inputField)\n        {\n            return new UnityEventHandlerAsyncEnumerable<string>(inputField.onEndEdit, inputField.GetCancellationTokenOnDestroy());\n        }\n\n        public static IUniTaskAsyncEnumerable<string> OnEndEditAsAsyncEnumerable(this InputField inputField, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable<string>(inputField.onEndEdit, cancellationToken);\n        }\n\n        public static IAsyncValueChangedEventHandler<string> GetAsyncValueChangedEventHandler(this InputField inputField)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onValueChanged, inputField.GetCancellationTokenOnDestroy(), false);\n        }\n\n        public static IAsyncValueChangedEventHandler<string> GetAsyncValueChangedEventHandler(this InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onValueChanged, cancellationToken, false);\n        }\n\n        public static UniTask<string> OnValueChangedAsync(this InputField inputField)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onValueChanged, inputField.GetCancellationTokenOnDestroy(), true).OnInvokeAsync();\n        }\n\n        public static UniTask<string> OnValueChangedAsync(this InputField inputField, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<string>(inputField.onValueChanged, cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<string> OnValueChangedAsAsyncEnumerable(this InputField inputField)\n        {\n            return new UnityEventHandlerAsyncEnumerable<string>(inputField.onValueChanged, inputField.GetCancellationTokenOnDestroy());\n        }\n\n        public static IUniTaskAsyncEnumerable<string> OnValueChangedAsAsyncEnumerable(this InputField inputField, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable<string>(inputField.onValueChanged, cancellationToken);\n        }\n\n        public static IAsyncValueChangedEventHandler<int> GetAsyncValueChangedEventHandler(this Dropdown dropdown)\n        {\n            return new AsyncUnityEventHandler<int>(dropdown.onValueChanged, dropdown.GetCancellationTokenOnDestroy(), false);\n        }\n\n        public static IAsyncValueChangedEventHandler<int> GetAsyncValueChangedEventHandler(this Dropdown dropdown, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<int>(dropdown.onValueChanged, cancellationToken, false);\n        }\n\n        public static UniTask<int> OnValueChangedAsync(this Dropdown dropdown)\n        {\n            return new AsyncUnityEventHandler<int>(dropdown.onValueChanged, dropdown.GetCancellationTokenOnDestroy(), true).OnInvokeAsync();\n        }\n\n        public static UniTask<int> OnValueChangedAsync(this Dropdown dropdown, CancellationToken cancellationToken)\n        {\n            return new AsyncUnityEventHandler<int>(dropdown.onValueChanged, cancellationToken, true).OnInvokeAsync();\n        }\n\n        public static IUniTaskAsyncEnumerable<int> OnValueChangedAsAsyncEnumerable(this Dropdown dropdown)\n        {\n            return new UnityEventHandlerAsyncEnumerable<int>(dropdown.onValueChanged, dropdown.GetCancellationTokenOnDestroy());\n        }\n\n        public static IUniTaskAsyncEnumerable<int> OnValueChangedAsAsyncEnumerable(this Dropdown dropdown, CancellationToken cancellationToken)\n        {\n            return new UnityEventHandlerAsyncEnumerable<int>(dropdown.onValueChanged, cancellationToken);\n        }\n    }\n\n    public interface IAsyncClickEventHandler : IDisposable\n    {\n        UniTask OnClickAsync();\n    }\n\n    public interface IAsyncValueChangedEventHandler<T> : IDisposable\n    {\n        UniTask<T> OnValueChangedAsync();\n    }\n\n    public interface IAsyncEndEditEventHandler<T> : IDisposable\n    {\n        UniTask<T> OnEndEditAsync();\n    }\n\n    // for TMP_PRO\n\n    public interface IAsyncEndTextSelectionEventHandler<T> : IDisposable\n    {\n        UniTask<T> OnEndTextSelectionAsync();\n    }\n\n    public interface IAsyncTextSelectionEventHandler<T> : IDisposable\n    {\n        UniTask<T> OnTextSelectionAsync();\n    }\n\n    public interface IAsyncDeselectEventHandler<T> : IDisposable\n    {\n        UniTask<T> OnDeselectAsync();\n    }\n\n    public interface IAsyncSelectEventHandler<T> : IDisposable\n    {\n        UniTask<T> OnSelectAsync();\n    }\n\n    public interface IAsyncSubmitEventHandler<T> : IDisposable\n    {\n        UniTask<T> OnSubmitAsync();\n    }\n\n    internal class TextSelectionEventConverter : UnityEvent<(string, int, int)>, IDisposable\n    {\n        readonly UnityEvent<string, int, int> innerEvent;\n        readonly UnityAction<string, int, int> invokeDelegate;\n\n\n        public TextSelectionEventConverter(UnityEvent<string, int, int> unityEvent)\n        {\n            this.innerEvent = unityEvent;\n            this.invokeDelegate = InvokeCore;\n\n            innerEvent.AddListener(invokeDelegate);\n        }\n\n        void InvokeCore(string item1, int item2, int item3)\n        {\n            Invoke((item1, item2, item3));\n        }\n\n        public void Dispose()\n        {\n            innerEvent.RemoveListener(invokeDelegate);\n        }\n    }\n\n    public class AsyncUnityEventHandler : IUniTaskSource, IDisposable, IAsyncClickEventHandler\n    {\n        static Action<object> cancellationCallback = CancellationCallback;\n\n        readonly UnityAction action;\n        readonly UnityEvent unityEvent;\n\n        CancellationToken cancellationToken;\n        CancellationTokenRegistration registration;\n        bool isDisposed;\n        bool callOnce;\n\n        UniTaskCompletionSourceCore<AsyncUnit> core;\n\n        public AsyncUnityEventHandler(UnityEvent unityEvent, CancellationToken cancellationToken, bool callOnce)\n        {\n            this.cancellationToken = cancellationToken;\n            if (cancellationToken.IsCancellationRequested)\n            {\n                isDisposed = true;\n                return;\n            }\n\n            this.action = Invoke;\n            this.unityEvent = unityEvent;\n            this.callOnce = callOnce;\n\n            unityEvent.AddListener(action);\n\n            if (cancellationToken.CanBeCanceled)\n            {\n                registration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallback, this);\n            }\n\n            TaskTracker.TrackActiveTask(this, 3);\n        }\n\n        public UniTask OnInvokeAsync()\n        {\n            core.Reset();\n            if (isDisposed)\n            {\n                core.TrySetCanceled(this.cancellationToken);\n            }\n            return new UniTask(this, core.Version);\n        }\n\n        void Invoke()\n        {\n            core.TrySetResult(AsyncUnit.Default);\n        }\n\n        static void CancellationCallback(object state)\n        {\n            var self = (AsyncUnityEventHandler)state;\n            self.Dispose();\n        }\n\n        public void Dispose()\n        {\n            if (!isDisposed)\n            {\n                isDisposed = true;\n                TaskTracker.RemoveTracking(this);\n                registration.Dispose();\n                if (unityEvent != null)\n                {\n                    unityEvent.RemoveListener(action);\n                }\n                core.TrySetCanceled(cancellationToken);\n            }\n        }\n\n        UniTask IAsyncClickEventHandler.OnClickAsync()\n        {\n            return OnInvokeAsync();\n        }\n\n        void IUniTaskSource.GetResult(short token)\n        {\n            try\n            {\n                core.GetResult(token);\n            }\n            finally\n            {\n                if (callOnce)\n                {\n                    Dispose();\n                }\n            }\n        }\n\n        UniTaskStatus IUniTaskSource.GetStatus(short token)\n        {\n            return core.GetStatus(token);\n        }\n\n        UniTaskStatus IUniTaskSource.UnsafeGetStatus()\n        {\n            return core.UnsafeGetStatus();\n        }\n\n        void IUniTaskSource.OnCompleted(Action<object> continuation, object state, short token)\n        {\n            core.OnCompleted(continuation, state, token);\n        }\n    }\n\n    public class AsyncUnityEventHandler<T> : IUniTaskSource<T>, IDisposable, IAsyncValueChangedEventHandler<T>, IAsyncEndEditEventHandler<T>\n        , IAsyncEndTextSelectionEventHandler<T>, IAsyncTextSelectionEventHandler<T>, IAsyncDeselectEventHandler<T>, IAsyncSelectEventHandler<T>, IAsyncSubmitEventHandler<T>\n    {\n        static Action<object> cancellationCallback = CancellationCallback;\n\n        readonly UnityAction<T> action;\n        readonly UnityEvent<T> unityEvent;\n\n        CancellationToken cancellationToken;\n        CancellationTokenRegistration registration;\n        bool isDisposed;\n        bool callOnce;\n\n        UniTaskCompletionSourceCore<T> core;\n\n        public AsyncUnityEventHandler(UnityEvent<T> unityEvent, CancellationToken cancellationToken, bool callOnce)\n        {\n            this.cancellationToken = cancellationToken;\n            if (cancellationToken.IsCancellationRequested)\n            {\n                isDisposed = true;\n                return;\n            }\n\n            this.action = Invoke;\n            this.unityEvent = unityEvent;\n            this.callOnce = callOnce;\n\n            unityEvent.AddListener(action);\n\n            if (cancellationToken.CanBeCanceled)\n            {\n                registration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallback, this);\n            }\n\n            TaskTracker.TrackActiveTask(this, 3);\n        }\n\n        public UniTask<T> OnInvokeAsync()\n        {\n            core.Reset();\n            if (isDisposed)\n            {\n                core.TrySetCanceled(this.cancellationToken);\n            }\n            return new UniTask<T>(this, core.Version);\n        }\n\n        void Invoke(T result)\n        {\n            core.TrySetResult(result);\n        }\n\n        static void CancellationCallback(object state)\n        {\n            var self = (AsyncUnityEventHandler<T>)state;\n            self.Dispose();\n        }\n\n        public void Dispose()\n        {\n            if (!isDisposed)\n            {\n                isDisposed = true;\n                TaskTracker.RemoveTracking(this);\n                registration.Dispose();\n                if (unityEvent != null)\n                {\n                    // Dispose inner delegate for TextSelectionEventConverter\n                    if (unityEvent is IDisposable disp)\n                    {\n                        disp.Dispose();\n                    }\n\n                    unityEvent.RemoveListener(action);\n                }\n\n                core.TrySetCanceled();\n            }\n        }\n\n        UniTask<T> IAsyncValueChangedEventHandler<T>.OnValueChangedAsync()\n        {\n            return OnInvokeAsync();\n        }\n\n        UniTask<T> IAsyncEndEditEventHandler<T>.OnEndEditAsync()\n        {\n            return OnInvokeAsync();\n        }\n\n        UniTask<T> IAsyncEndTextSelectionEventHandler<T>.OnEndTextSelectionAsync()\n        {\n            return OnInvokeAsync();\n        }\n\n        UniTask<T> IAsyncTextSelectionEventHandler<T>.OnTextSelectionAsync()\n        {\n            return OnInvokeAsync();\n        }\n\n        UniTask<T> IAsyncDeselectEventHandler<T>.OnDeselectAsync()\n        {\n            return OnInvokeAsync();\n        }\n\n        UniTask<T> IAsyncSelectEventHandler<T>.OnSelectAsync()\n        {\n            return OnInvokeAsync();\n        }\n\n        UniTask<T> IAsyncSubmitEventHandler<T>.OnSubmitAsync()\n        {\n            return OnInvokeAsync();\n        }\n\n        T IUniTaskSource<T>.GetResult(short token)\n        {\n            try\n            {\n                return core.GetResult(token);\n            }\n            finally\n            {\n                if (callOnce)\n                {\n                    Dispose();\n                }\n            }\n        }\n\n        void IUniTaskSource.GetResult(short token)\n        {\n            ((IUniTaskSource<T>)this).GetResult(token);\n        }\n\n        UniTaskStatus IUniTaskSource.GetStatus(short token)\n        {\n            return core.GetStatus(token);\n        }\n\n        UniTaskStatus IUniTaskSource.UnsafeGetStatus()\n        {\n            return core.UnsafeGetStatus();\n        }\n\n        void IUniTaskSource.OnCompleted(Action<object> continuation, object state, short token)\n        {\n            core.OnCompleted(continuation, state, token);\n        }\n    }\n\n    public class UnityEventHandlerAsyncEnumerable : IUniTaskAsyncEnumerable<AsyncUnit>\n    {\n        readonly UnityEvent unityEvent;\n        readonly CancellationToken cancellationToken1;\n\n        public UnityEventHandlerAsyncEnumerable(UnityEvent unityEvent, CancellationToken cancellationToken)\n        {\n            this.unityEvent = unityEvent;\n            this.cancellationToken1 = cancellationToken;\n        }\n\n        public IUniTaskAsyncEnumerator<AsyncUnit> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            if (this.cancellationToken1 == cancellationToken)\n            {\n                return new UnityEventHandlerAsyncEnumerator(unityEvent, this.cancellationToken1, CancellationToken.None);\n            }\n            else\n            {\n                return new UnityEventHandlerAsyncEnumerator(unityEvent, this.cancellationToken1, cancellationToken);\n            }\n        }\n\n        class UnityEventHandlerAsyncEnumerator : MoveNextSource, IUniTaskAsyncEnumerator<AsyncUnit>\n        {\n            static readonly Action<object> cancel1 = OnCanceled1;\n            static readonly Action<object> cancel2 = OnCanceled2;\n\n            readonly UnityEvent unityEvent;\n            CancellationToken cancellationToken1;\n            CancellationToken cancellationToken2;\n\n            UnityAction unityAction;\n            CancellationTokenRegistration registration1;\n            CancellationTokenRegistration registration2;\n            bool isDisposed;\n\n            public UnityEventHandlerAsyncEnumerator(UnityEvent unityEvent, CancellationToken cancellationToken1, CancellationToken cancellationToken2)\n            {\n                this.unityEvent = unityEvent;\n                this.cancellationToken1 = cancellationToken1;\n                this.cancellationToken2 = cancellationToken2;\n            }\n\n            public AsyncUnit Current => default;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken1.ThrowIfCancellationRequested();\n                cancellationToken2.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                if (unityAction == null)\n                {\n                    unityAction = Invoke;\n\n                    TaskTracker.TrackActiveTask(this, 3);\n                    unityEvent.AddListener(unityAction);\n                    if (cancellationToken1.CanBeCanceled)\n                    {\n                        registration1 = cancellationToken1.RegisterWithoutCaptureExecutionContext(cancel1, this);\n                    }\n                    if (cancellationToken2.CanBeCanceled)\n                    {\n                        registration2 = cancellationToken2.RegisterWithoutCaptureExecutionContext(cancel2, this);\n                    }\n                }\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void Invoke()\n            {\n                completionSource.TrySetResult(true);\n            }\n\n            static void OnCanceled1(object state)\n            {\n                var self = (UnityEventHandlerAsyncEnumerator)state;\n                try\n                {\n                    self.completionSource.TrySetCanceled(self.cancellationToken1);\n                }\n                finally\n                {\n                    self.DisposeAsync().Forget();\n                }\n            }\n\n            static void OnCanceled2(object state)\n            {\n                var self = (UnityEventHandlerAsyncEnumerator)state;\n                try\n                {\n                    self.completionSource.TrySetCanceled(self.cancellationToken2);\n                }\n                finally\n                {\n                    self.DisposeAsync().Forget();\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                if (!isDisposed)\n                {\n                    isDisposed = true;\n                    TaskTracker.RemoveTracking(this);\n                    registration1.Dispose();\n                    registration2.Dispose();\n                    unityEvent.RemoveListener(unityAction);\n\n                    completionSource.TrySetCanceled();\n                }\n\n                return default;\n            }\n        }\n    }\n\n    public class UnityEventHandlerAsyncEnumerable<T> : IUniTaskAsyncEnumerable<T>\n    {\n        readonly UnityEvent<T> unityEvent;\n        readonly CancellationToken cancellationToken1;\n\n        public UnityEventHandlerAsyncEnumerable(UnityEvent<T> unityEvent, CancellationToken cancellationToken)\n        {\n            this.unityEvent = unityEvent;\n            this.cancellationToken1 = cancellationToken;\n        }\n\n        public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            if (this.cancellationToken1 == cancellationToken)\n            {\n                return new UnityEventHandlerAsyncEnumerator(unityEvent, this.cancellationToken1, CancellationToken.None);\n            }\n            else\n            {\n                return new UnityEventHandlerAsyncEnumerator(unityEvent, this.cancellationToken1, cancellationToken);\n            }\n        }\n\n        class UnityEventHandlerAsyncEnumerator : MoveNextSource, IUniTaskAsyncEnumerator<T>\n        {\n            static readonly Action<object> cancel1 = OnCanceled1;\n            static readonly Action<object> cancel2 = OnCanceled2;\n\n            readonly UnityEvent<T> unityEvent;\n            CancellationToken cancellationToken1;\n            CancellationToken cancellationToken2;\n\n            UnityAction<T> unityAction;\n            CancellationTokenRegistration registration1;\n            CancellationTokenRegistration registration2;\n            bool isDisposed;\n\n            public UnityEventHandlerAsyncEnumerator(UnityEvent<T> unityEvent, CancellationToken cancellationToken1, CancellationToken cancellationToken2)\n            {\n                this.unityEvent = unityEvent;\n                this.cancellationToken1 = cancellationToken1;\n                this.cancellationToken2 = cancellationToken2;\n            }\n\n            public T Current { get; private set; }\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken1.ThrowIfCancellationRequested();\n                cancellationToken2.ThrowIfCancellationRequested();\n                completionSource.Reset();\n\n                if (unityAction == null)\n                {\n                    unityAction = Invoke;\n\n                    TaskTracker.TrackActiveTask(this, 3);\n                    unityEvent.AddListener(unityAction);\n                    if (cancellationToken1.CanBeCanceled)\n                    {\n                        registration1 = cancellationToken1.RegisterWithoutCaptureExecutionContext(cancel1, this);\n                    }\n                    if (cancellationToken2.CanBeCanceled)\n                    {\n                        registration2 = cancellationToken2.RegisterWithoutCaptureExecutionContext(cancel2, this);\n                    }\n                }\n\n                return new UniTask<bool>(this, completionSource.Version);\n            }\n\n            void Invoke(T value)\n            {\n                Current = value;\n                completionSource.TrySetResult(true);\n            }\n\n            static void OnCanceled1(object state)\n            {\n                var self = (UnityEventHandlerAsyncEnumerator)state;\n                try\n                {\n                    self.completionSource.TrySetCanceled(self.cancellationToken1);\n                }\n                finally\n                {\n                    self.DisposeAsync().Forget();\n                }\n            }\n\n            static void OnCanceled2(object state)\n            {\n                var self = (UnityEventHandlerAsyncEnumerator)state;\n                try\n                {\n                    self.completionSource.TrySetCanceled(self.cancellationToken2);\n                }\n                finally\n                {\n                    self.DisposeAsync().Forget();\n                }\n            }\n\n            public UniTask DisposeAsync()\n            {\n                if (!isDisposed)\n                {\n                    isDisposed = true;\n                    TaskTracker.RemoveTracking(this);\n                    registration1.Dispose();\n                    registration2.Dispose();\n                    if (unityEvent is IDisposable disp)\n                    {\n                        disp.Dispose();\n                    }\n                    unityEvent.RemoveListener(unityAction);\n\n                    completionSource.TrySetCanceled();\n                }\n\n                return default;\n            }\n        }\n    }\n}\n\n#endif\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.uGUI.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 6804799fba2376d4099561d176101aff\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAwaitableExtensions.cs",
    "content": "#if UNITY_2023_1_OR_NEWER\nnamespace Cysharp.Threading.Tasks\n{\n    public static class UnityAwaitableExtensions\n    {\n        public static async UniTask AsUniTask(this UnityEngine.Awaitable awaitable)\n        {\n            await awaitable;\n        }\n        \n        public static async UniTask<T> AsUniTask<T>(this UnityEngine.Awaitable<T> awaitable)\n        {\n            return await awaitable;\n        }\n    }\n}\n#endif\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityAwaitableExtensions.cs.meta",
    "content": "fileFormatVersion: 2\nguid: c29533c9e4284dee914b71a6579ea274\ntimeCreated: 1698895807"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityBindingExtensions.cs",
    "content": "﻿using System;\nusing System.Threading;\nusing UnityEngine;\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\nusing UnityEngine.UI;\n#endif\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static class UnityBindingExtensions\n    {\n#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT\n        // <string> -> Text\n\n        public static void BindTo(this IUniTaskAsyncEnumerable<string> source, UnityEngine.UI.Text text, bool rebindOnError = true)\n        {\n            BindToCore(source, text, text.GetCancellationTokenOnDestroy(), rebindOnError).Forget();\n        }\n\n        public static void BindTo(this IUniTaskAsyncEnumerable<string> source, UnityEngine.UI.Text text, CancellationToken cancellationToken, bool rebindOnError = true)\n        {\n            BindToCore(source, text, cancellationToken, rebindOnError).Forget();\n        }\n\n        static async UniTaskVoid BindToCore(IUniTaskAsyncEnumerable<string> source, UnityEngine.UI.Text text, CancellationToken cancellationToken, bool rebindOnError)\n        {\n            var repeat = false;\n            BIND_AGAIN:\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (true)\n                {\n                    bool moveNext;\n                    try\n                    {\n                        moveNext = await e.MoveNextAsync();\n                        repeat = false;\n                    }\n                    catch (Exception ex)\n                    {\n                        if (ex is OperationCanceledException) return;\n\n                        if (rebindOnError && !repeat)\n                        {\n                            repeat = true;\n                            goto BIND_AGAIN;\n                        }\n                        else\n                        {\n                            throw;\n                        }\n                    }\n\n                    if (!moveNext) return;\n\n                    text.text = e.Current;\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        // <T> -> Text\n\n        public static void BindTo<T>(this IUniTaskAsyncEnumerable<T> source, UnityEngine.UI.Text text, bool rebindOnError = true)\n        {\n            BindToCore(source, text, text.GetCancellationTokenOnDestroy(), rebindOnError).Forget();\n        }\n\n        public static void BindTo<T>(this IUniTaskAsyncEnumerable<T> source, UnityEngine.UI.Text text, CancellationToken cancellationToken, bool rebindOnError = true)\n        {\n            BindToCore(source, text, cancellationToken, rebindOnError).Forget();\n        }\n\n        public static void BindTo<T>(this AsyncReactiveProperty<T> source, UnityEngine.UI.Text text, bool rebindOnError = true)\n        {\n            BindToCore(source, text, text.GetCancellationTokenOnDestroy(), rebindOnError).Forget();\n        }\n\n        static async UniTaskVoid BindToCore<T>(IUniTaskAsyncEnumerable<T> source, UnityEngine.UI.Text text, CancellationToken cancellationToken, bool rebindOnError)\n        {\n            var repeat = false;\n            BIND_AGAIN:\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (true)\n                {\n                    bool moveNext;\n                    try\n                    {\n                        moveNext = await e.MoveNextAsync();\n                        repeat = false;\n                    }\n                    catch (Exception ex)\n                    {\n                        if (ex is OperationCanceledException) return;\n\n                        if (rebindOnError && !repeat)\n                        {\n                            repeat = true;\n                            goto BIND_AGAIN;\n                        }\n                        else\n                        {\n                            throw;\n                        }\n                    }\n\n                    if (!moveNext) return;\n\n                    text.text = e.Current.ToString();\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n\n        // <bool> -> Selectable\n\n        public static void BindTo(this IUniTaskAsyncEnumerable<bool> source, Selectable selectable, bool rebindOnError = true)\n        {\n            BindToCore(source, selectable, selectable.GetCancellationTokenOnDestroy(), rebindOnError).Forget();\n        }\n\n        public static void BindTo(this IUniTaskAsyncEnumerable<bool> source, Selectable selectable, CancellationToken cancellationToken, bool rebindOnError = true)\n        {\n            BindToCore(source, selectable, cancellationToken, rebindOnError).Forget();\n        }\n\n        static async UniTaskVoid BindToCore(IUniTaskAsyncEnumerable<bool> source, Selectable selectable, CancellationToken cancellationToken, bool rebindOnError)\n        {\n            var repeat = false;\n            BIND_AGAIN:\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (true)\n                {\n                    bool moveNext;\n                    try\n                    {\n                        moveNext = await e.MoveNextAsync();\n                        repeat = false;\n                    }\n                    catch (Exception ex)\n                    {\n                        if (ex is OperationCanceledException) return;\n\n                        if (rebindOnError && !repeat)\n                        {\n                            repeat = true;\n                            goto BIND_AGAIN;\n                        }\n                        else\n                        {\n                            throw;\n                        }\n                    }\n\n                    if (!moveNext) return;\n\n\n                    selectable.interactable = e.Current;\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n#endif\n\n        // <T> -> Action\n\n        public static void BindTo<TSource, TObject>(this IUniTaskAsyncEnumerable<TSource> source, TObject monoBehaviour, Action<TObject, TSource> bindAction, bool rebindOnError = true)\n            where TObject : MonoBehaviour\n        {\n            BindToCore(source, monoBehaviour, bindAction, monoBehaviour.GetCancellationTokenOnDestroy(), rebindOnError).Forget();\n        }\n\n        public static void BindTo<TSource, TObject>(this IUniTaskAsyncEnumerable<TSource> source, TObject bindTarget, Action<TObject, TSource> bindAction, CancellationToken cancellationToken, bool rebindOnError = true)\n        {\n            BindToCore(source, bindTarget, bindAction, cancellationToken, rebindOnError).Forget();\n        }\n\n        static async UniTaskVoid BindToCore<TSource, TObject>(IUniTaskAsyncEnumerable<TSource> source, TObject bindTarget, Action<TObject, TSource> bindAction, CancellationToken cancellationToken, bool rebindOnError)\n        {\n            var repeat = false;\n            BIND_AGAIN:\n            var e = source.GetAsyncEnumerator(cancellationToken);\n            try\n            {\n                while (true)\n                {\n                    bool moveNext;\n                    try\n                    {\n                        moveNext = await e.MoveNextAsync();\n                        repeat = false;\n                    }\n                    catch (Exception ex)\n                    {\n                        if (ex is OperationCanceledException) return;\n\n                        if (rebindOnError && !repeat)\n                        {\n                            repeat = true;\n                            goto BIND_AGAIN;\n                        }\n                        else\n                        {\n                            throw;\n                        }\n                    }\n\n                    if (!moveNext) return;\n\n                    bindAction(bindTarget, e.Current);\n                }\n            }\n            finally\n            {\n                if (e != null)\n                {\n                    await e.DisposeAsync();\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityBindingExtensions.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 090b20e3528552b4a8d751f7df525c2b\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityWebRequestException.cs",
    "content": "#if ENABLE_UNITYWEBREQUEST && (!UNITY_2019_1_OR_NEWER || UNITASK_WEBREQUEST_SUPPORT)\n\nusing System;\nusing System.Collections.Generic;\nusing UnityEngine.Networking;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public class UnityWebRequestException : Exception\n    {\n        public UnityWebRequest UnityWebRequest { get; }\n#if UNITY_2020_2_OR_NEWER\n        public UnityWebRequest.Result Result { get; }\n#else\n        public bool IsNetworkError { get; }\n        public bool IsHttpError { get; }\n#endif\n        public string Error { get; }\n        public string Text { get; }\n        public long ResponseCode { get; }\n        public Dictionary<string, string> ResponseHeaders { get; }\n\n        string msg;\n\n        public UnityWebRequestException(UnityWebRequest unityWebRequest)\n        {\n            this.UnityWebRequest = unityWebRequest;\n#if UNITY_2020_2_OR_NEWER\n            this.Result = unityWebRequest.result;\n#else\n            this.IsNetworkError = unityWebRequest.isNetworkError;\n            this.IsHttpError = unityWebRequest.isHttpError;\n#endif\n            this.Error = unityWebRequest.error;\n            this.ResponseCode = unityWebRequest.responseCode;\n            if (UnityWebRequest.downloadHandler != null)\n            {\n                if (unityWebRequest.downloadHandler is DownloadHandlerBuffer dhb)\n                {\n                    this.Text = dhb.text;\n                }\n            }\n            this.ResponseHeaders = unityWebRequest.GetResponseHeaders();\n        }\n\n        public override string Message\n        {\n            get\n            {\n                if (msg == null)\n                {\n                    if(!string.IsNullOrWhiteSpace(Text))\n                    {\n                        msg = Error + Environment.NewLine + Text;\n                    }\n                    else\n                    {\n                        msg = Error;\n                    }\n                }\n                return msg;\n            }\n        }\n    }\n}\n\n#endif"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/UnityWebRequestException.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 013a499e522703a42962a779b4d9850c\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/_InternalVisibleTo.cs",
    "content": "﻿using System.Runtime.CompilerServices;\n\n[assembly: InternalsVisibleTo(\"UniTask.Linq\")]\n[assembly: InternalsVisibleTo(\"UniTask.Addressables\")]\n[assembly: InternalsVisibleTo(\"UniTask.DOTween\")]\n[assembly: InternalsVisibleTo(\"UniTask.TextMeshPro\")]"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime/_InternalVisibleTo.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 8507e97eb606fad4b99c6edf92e19cb8\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/Runtime.meta",
    "content": "fileFormatVersion: 2\nguid: aa765154468d4b34eb34304100d39e64\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/package.json",
    "content": "{\n    \"name\": \"com.cysharp.unitask\",\n    \"displayName\": \"UniTask\",\n    \"author\": { \"name\": \"Cysharp, Inc.\", \"url\": \"https://cysharp.co.jp/en/\" },\n    \"version\": \"2.5.10\",\n    \"unity\": \"2018.4\",\n    \"description\": \"Provides an efficient async/await integration to Unity.\",\n    \"keywords\": [ \"async/await\", \"async\", \"Task\", \"UniTask\" ],\n    \"license\": \"MIT\",\n    \"category\": \"Task\",\n    \"dependencies\": {}\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask/package.json.meta",
    "content": "fileFormatVersion: 2\nguid: d1a9a71f68bb0d04db91ddaa3329abf9\nTextScriptImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins/UniTask.meta",
    "content": "fileFormatVersion: 2\nguid: 4929ac1f6fcfe944a99529b6fb5bd9ef\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Plugins.meta",
    "content": "fileFormatVersion: 2\nguid: b42c9a22c4f7bc7448ed60496a4dc359\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Scenes/EditorTest1.cs",
    "content": "﻿#if UNITY_EDITOR\n\nusing System;\nusing Cysharp.Threading.Tasks;\nusing UnityEditor;\nusing UnityEngine;\n\npublic class Test1\n{\n    [MenuItem(\"Test/Test1\")]\n    public static async UniTaskVoid TestFunc()\n    {\n        await DoSomeThing();\n        //string[] scenes = new string[]\n        //{\n        //    \"Assets/Scenes/SandboxMain.unity\",\n        //};\n\n        //try\n        //{\n        //    Debug.Log(\"Build Begin\");\n        //    BuildPipeline.BuildPlayer(scenes, Application.dataPath + \"../target\", BuildTarget.StandaloneWindows, BuildOptions.CompressWithLz4);\n        //    Debug.Log(\"Build After\");\n        //}\n        //catch (Exception e)\n        //{\n        //    Debug.LogError(e.Message);\n        //}\n    }\n\n    public static async UniTask DoSomeThing()\n    {\n        Debug.Log(\"Dosomething\");\n        await UniTask.Delay(1500, DelayType.DeltaTime);\n        Debug.Log(\"Dosomething 2\");\n        await UniTask.Delay(1000, DelayType.DeltaTime);\n        Debug.Log(\"Dosomething 3\");\n        Debug.Log(\"and Quit.\");\n\n        Environment.Exit(0);\n    }\n}\n\n#endif"
  },
  {
    "path": "src/UniTask/Assets/Scenes/EditorTest1.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 48003021292963e48b2493e915dca5ac\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Scenes/ExceptionExamples.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing System;\nusing System.Collections.Generic;\nusing UnityEngine;\n// using UnityEngine.AddressableAssets;\n\n/*UNniTastWhenAnyTester*/\n\n[ExecuteInEditMode]\npublic class ExceptionExamples : MonoBehaviour\n{\n    public bool apply = false;\n\n    private async UniTaskVoid Update()\n    {\n        if (apply)\n        {\n            apply = false;\n            await LaunchTasksAndDetectWhenAnyDone(5);\n        }\n    }\n\n    private async UniTask LaunchTasksAndDetectWhenAnyDone(int nbTasks)\n    {\n        List<UniTask<int>> sleeptasks = new List<UniTask<int>>();\n        for (int i = 0; i < nbTasks; i++)\n        {\n            sleeptasks.Add(SleepAndReturnTrue(i).ToAsyncLazy().Task);\n        }\n        while (sleeptasks.Count > 0)\n        {\n            Debug.Log(DateTime.Now.ToString() + \" waiting for \" + sleeptasks.Count + \" tasks...\");\n            try\n            {\n                (int index, int taskID) = await UniTask.WhenAny(sleeptasks);\n                Debug.Log(DateTime.Now.ToString() + \" Sleep task \" + taskID + \" done\");\n                sleeptasks.RemoveAt(index);\n            }\n            catch\n            {\n                throw;\n                //Debug.Log(\"Error: \" + e.Message);\n                //return;\n            }\n        }\n    }\n\n    private async UniTask<int> SleepAndReturnTrue(int taskIndex)\n    {\n        await UniTask.Delay(100);\n        return taskIndex;\n    }\n\n    //void AddressablesTest()\n    //{\n    //    Addressables.ClearDependencyCacheAsync(\"key\", true);\n    //}\n}"
  },
  {
    "path": "src/UniTask/Assets/Scenes/ExceptionExamples.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 329ff620b32b4ef4abdc99884242ee67\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Scenes/ExceptionExamples.unity",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!29 &1\nOcclusionCullingSettings:\n  m_ObjectHideFlags: 0\n  serializedVersion: 2\n  m_OcclusionBakeSettings:\n    smallestOccluder: 5\n    smallestHole: 0.25\n    backfaceThreshold: 100\n  m_SceneGUID: 00000000000000000000000000000000\n  m_OcclusionCullingData: {fileID: 0}\n--- !u!104 &2\nRenderSettings:\n  m_ObjectHideFlags: 0\n  serializedVersion: 9\n  m_Fog: 0\n  m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}\n  m_FogMode: 3\n  m_FogDensity: 0.01\n  m_LinearFogStart: 0\n  m_LinearFogEnd: 300\n  m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}\n  m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}\n  m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}\n  m_AmbientIntensity: 1\n  m_AmbientMode: 3\n  m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}\n  m_SkyboxMaterial: {fileID: 0}\n  m_HaloStrength: 0.5\n  m_FlareStrength: 1\n  m_FlareFadeSpeed: 3\n  m_HaloTexture: {fileID: 0}\n  m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}\n  m_DefaultReflectionMode: 0\n  m_DefaultReflectionResolution: 128\n  m_ReflectionBounces: 1\n  m_ReflectionIntensity: 1\n  m_CustomReflection: {fileID: 0}\n  m_Sun: {fileID: 0}\n  m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}\n  m_UseRadianceAmbientProbe: 0\n--- !u!157 &3\nLightmapSettings:\n  m_ObjectHideFlags: 0\n  serializedVersion: 11\n  m_GIWorkflowMode: 1\n  m_GISettings:\n    serializedVersion: 2\n    m_BounceScale: 1\n    m_IndirectOutputScale: 1\n    m_AlbedoBoost: 1\n    m_EnvironmentLightingMode: 0\n    m_EnableBakedLightmaps: 0\n    m_EnableRealtimeLightmaps: 0\n  m_LightmapEditorSettings:\n    serializedVersion: 12\n    m_Resolution: 2\n    m_BakeResolution: 40\n    m_AtlasSize: 1024\n    m_AO: 0\n    m_AOMaxDistance: 1\n    m_CompAOExponent: 1\n    m_CompAOExponentDirect: 0\n    m_ExtractAmbientOcclusion: 0\n    m_Padding: 2\n    m_LightmapParameters: {fileID: 0}\n    m_LightmapsBakeMode: 1\n    m_TextureCompression: 1\n    m_FinalGather: 0\n    m_FinalGatherFiltering: 1\n    m_FinalGatherRayCount: 256\n    m_ReflectionCompression: 2\n    m_MixedBakeMode: 2\n    m_BakeBackend: 1\n    m_PVRSampling: 1\n    m_PVRDirectSampleCount: 32\n    m_PVRSampleCount: 512\n    m_PVRBounces: 2\n    m_PVREnvironmentSampleCount: 256\n    m_PVREnvironmentReferencePointCount: 2048\n    m_PVRFilteringMode: 1\n    m_PVRDenoiserTypeDirect: 1\n    m_PVRDenoiserTypeIndirect: 1\n    m_PVRDenoiserTypeAO: 1\n    m_PVRFilterTypeDirect: 0\n    m_PVRFilterTypeIndirect: 0\n    m_PVRFilterTypeAO: 0\n    m_PVREnvironmentMIS: 1\n    m_PVRCulling: 1\n    m_PVRFilteringGaussRadiusDirect: 1\n    m_PVRFilteringGaussRadiusIndirect: 5\n    m_PVRFilteringGaussRadiusAO: 2\n    m_PVRFilteringAtrousPositionSigmaDirect: 0.5\n    m_PVRFilteringAtrousPositionSigmaIndirect: 2\n    m_PVRFilteringAtrousPositionSigmaAO: 1\n    m_ExportTrainingData: 0\n    m_TrainingDataDestination: TrainingData\n    m_LightProbeSampleCountMultiplier: 4\n  m_LightingDataAsset: {fileID: 0}\n  m_UseShadowmask: 1\n--- !u!196 &4\nNavMeshSettings:\n  serializedVersion: 2\n  m_ObjectHideFlags: 0\n  m_BuildSettings:\n    serializedVersion: 2\n    agentTypeID: 0\n    agentRadius: 0.5\n    agentHeight: 2\n    agentSlope: 45\n    agentClimb: 0.4\n    ledgeDropHeight: 0\n    maxJumpAcrossDistance: 0\n    minRegionArea: 2\n    manualCellSize: 0\n    cellSize: 0.16666667\n    manualTileSize: 0\n    tileSize: 256\n    accuratePlacement: 0\n    debug:\n      m_Flags: 0\n  m_NavMeshData: {fileID: 0}\n--- !u!1 &542336983\nGameObject:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  serializedVersion: 6\n  m_Component:\n  - component: {fileID: 542336986}\n  - component: {fileID: 542336985}\n  - component: {fileID: 542336984}\n  m_Layer: 0\n  m_Name: EventSystem\n  m_TagString: Untagged\n  m_Icon: {fileID: 0}\n  m_NavMeshLayer: 0\n  m_StaticEditorFlags: 0\n  m_IsActive: 1\n--- !u!114 &542336984\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 542336983}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_HorizontalAxis: Horizontal\n  m_VerticalAxis: Vertical\n  m_SubmitButton: Submit\n  m_CancelButton: Cancel\n  m_InputActionsPerSecond: 10\n  m_RepeatDelay: 0.5\n  m_ForceModuleActive: 0\n--- !u!114 &542336985\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 542336983}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_FirstSelected: {fileID: 0}\n  m_sendNavigationEvents: 1\n  m_DragThreshold: 10\n--- !u!4 &542336986\nTransform:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 542336983}\n  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}\n  m_LocalPosition: {x: 0, y: 0, z: 0}\n  m_LocalScale: {x: 1, y: 1, z: 1}\n  m_Children: []\n  m_Father: {fileID: 0}\n  m_RootOrder: 1\n  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}\n--- !u!1 &730559310\nGameObject:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  serializedVersion: 6\n  m_Component:\n  - component: {fileID: 730559311}\n  - component: {fileID: 730559313}\n  - component: {fileID: 730559312}\n  m_Layer: 5\n  m_Name: Text\n  m_TagString: Untagged\n  m_Icon: {fileID: 0}\n  m_NavMeshLayer: 0\n  m_StaticEditorFlags: 0\n  m_IsActive: 1\n--- !u!224 &730559311\nRectTransform:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 730559310}\n  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}\n  m_LocalPosition: {x: 0, y: 0, z: 0}\n  m_LocalScale: {x: 1, y: 1, z: 1}\n  m_Children: []\n  m_Father: {fileID: 1587363385}\n  m_RootOrder: 0\n  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}\n  m_AnchorMin: {x: 0, y: 0}\n  m_AnchorMax: {x: 1, y: 1}\n  m_AnchoredPosition: {x: 0, y: 0}\n  m_SizeDelta: {x: 0, y: 0}\n  m_Pivot: {x: 0.5, y: 0.5}\n--- !u!114 &730559312\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 730559310}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_Material: {fileID: 0}\n  m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}\n  m_RaycastTarget: 1\n  m_OnCullStateChanged:\n    m_PersistentCalls:\n      m_Calls: []\n  m_FontData:\n    m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}\n    m_FontSize: 14\n    m_FontStyle: 0\n    m_BestFit: 0\n    m_MinSize: 10\n    m_MaxSize: 40\n    m_Alignment: 4\n    m_AlignByGeometry: 0\n    m_RichText: 1\n    m_HorizontalOverflow: 0\n    m_VerticalOverflow: 0\n    m_LineSpacing: 1\n  m_Text: Button\n--- !u!222 &730559313\nCanvasRenderer:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 730559310}\n  m_CullTransparentMesh: 0\n--- !u!1 &735985614\nGameObject:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  serializedVersion: 6\n  m_Component:\n  - component: {fileID: 735985618}\n  - component: {fileID: 735985617}\n  - component: {fileID: 735985616}\n  - component: {fileID: 735985615}\n  m_Layer: 0\n  m_Name: Main Camera\n  m_TagString: MainCamera\n  m_Icon: {fileID: 0}\n  m_NavMeshLayer: 0\n  m_StaticEditorFlags: 0\n  m_IsActive: 1\n--- !u!114 &735985615\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 735985614}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: 329ff620b32b4ef4abdc99884242ee67, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  ButtonTest: {fileID: 1587363386}\n--- !u!81 &735985616\nAudioListener:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 735985614}\n  m_Enabled: 1\n--- !u!20 &735985617\nCamera:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 735985614}\n  m_Enabled: 1\n  serializedVersion: 2\n  m_ClearFlags: 1\n  m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}\n  m_projectionMatrixMode: 1\n  m_GateFitMode: 2\n  m_FOVAxisMode: 0\n  m_SensorSize: {x: 36, y: 24}\n  m_LensShift: {x: 0, y: 0}\n  m_FocalLength: 50\n  m_NormalizedViewPortRect:\n    serializedVersion: 2\n    x: 0\n    y: 0\n    width: 1\n    height: 1\n  near clip plane: 0.3\n  far clip plane: 1000\n  field of view: 60\n  orthographic: 1\n  orthographic size: 5\n  m_Depth: -1\n  m_CullingMask:\n    serializedVersion: 2\n    m_Bits: 4294967295\n  m_RenderingPath: -1\n  m_TargetTexture: {fileID: 0}\n  m_TargetDisplay: 0\n  m_TargetEye: 3\n  m_HDR: 1\n  m_AllowMSAA: 1\n  m_AllowDynamicResolution: 0\n  m_ForceIntoRT: 0\n  m_OcclusionCulling: 1\n  m_StereoConvergence: 10\n  m_StereoSeparation: 0.022\n--- !u!4 &735985618\nTransform:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 735985614}\n  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}\n  m_LocalPosition: {x: 0, y: 0, z: -10}\n  m_LocalScale: {x: 1, y: 1, z: 1}\n  m_Children:\n  - {fileID: 1323586517}\n  m_Father: {fileID: 0}\n  m_RootOrder: 0\n  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}\n--- !u!1 &1323586516\nGameObject:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  serializedVersion: 6\n  m_Component:\n  - component: {fileID: 1323586517}\n  - component: {fileID: 1323586520}\n  - component: {fileID: 1323586519}\n  - component: {fileID: 1323586518}\n  m_Layer: 5\n  m_Name: Canvas\n  m_TagString: Untagged\n  m_Icon: {fileID: 0}\n  m_NavMeshLayer: 0\n  m_StaticEditorFlags: 0\n  m_IsActive: 1\n--- !u!224 &1323586517\nRectTransform:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 1323586516}\n  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}\n  m_LocalPosition: {x: 0, y: 0, z: 0}\n  m_LocalScale: {x: 0, y: 0, z: 0}\n  m_Children:\n  - {fileID: 1587363385}\n  m_Father: {fileID: 735985618}\n  m_RootOrder: 0\n  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}\n  m_AnchorMin: {x: 0, y: 0}\n  m_AnchorMax: {x: 0, y: 0}\n  m_AnchoredPosition: {x: 0, y: 0}\n  m_SizeDelta: {x: 0, y: 0}\n  m_Pivot: {x: 0, y: 0}\n--- !u!114 &1323586518\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 1323586516}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_IgnoreReversedGraphics: 1\n  m_BlockingObjects: 0\n  m_BlockingMask:\n    serializedVersion: 2\n    m_Bits: 4294967295\n--- !u!114 &1323586519\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 1323586516}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_UiScaleMode: 0\n  m_ReferencePixelsPerUnit: 100\n  m_ScaleFactor: 1\n  m_ReferenceResolution: {x: 800, y: 600}\n  m_ScreenMatchMode: 0\n  m_MatchWidthOrHeight: 0\n  m_PhysicalUnit: 3\n  m_FallbackScreenDPI: 96\n  m_DefaultSpriteDPI: 96\n  m_DynamicPixelsPerUnit: 1\n--- !u!223 &1323586520\nCanvas:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 1323586516}\n  m_Enabled: 1\n  serializedVersion: 3\n  m_RenderMode: 0\n  m_Camera: {fileID: 0}\n  m_PlaneDistance: 100\n  m_PixelPerfect: 0\n  m_ReceivesEvents: 1\n  m_OverrideSorting: 0\n  m_OverridePixelPerfect: 0\n  m_SortingBucketNormalizedSize: 0\n  m_AdditionalShaderChannelsFlag: 0\n  m_SortingLayerID: 0\n  m_SortingOrder: 0\n  m_TargetDisplay: 0\n--- !u!1 &1587363384\nGameObject:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  serializedVersion: 6\n  m_Component:\n  - component: {fileID: 1587363385}\n  - component: {fileID: 1587363388}\n  - component: {fileID: 1587363387}\n  - component: {fileID: 1587363386}\n  m_Layer: 5\n  m_Name: Button\n  m_TagString: Untagged\n  m_Icon: {fileID: 0}\n  m_NavMeshLayer: 0\n  m_StaticEditorFlags: 0\n  m_IsActive: 1\n--- !u!224 &1587363385\nRectTransform:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 1587363384}\n  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}\n  m_LocalPosition: {x: 0, y: 0, z: 0}\n  m_LocalScale: {x: 1, y: 1, z: 1}\n  m_Children:\n  - {fileID: 730559311}\n  m_Father: {fileID: 1323586517}\n  m_RootOrder: 0\n  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}\n  m_AnchorMin: {x: 0.5, y: 0.5}\n  m_AnchorMax: {x: 0.5, y: 0.5}\n  m_AnchoredPosition: {x: 0, y: 0}\n  m_SizeDelta: {x: 160, y: 30}\n  m_Pivot: {x: 0.5, y: 0.5}\n--- !u!114 &1587363386\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 1587363384}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_Navigation:\n    m_Mode: 3\n    m_SelectOnUp: {fileID: 0}\n    m_SelectOnDown: {fileID: 0}\n    m_SelectOnLeft: {fileID: 0}\n    m_SelectOnRight: {fileID: 0}\n  m_Transition: 1\n  m_Colors:\n    m_NormalColor: {r: 1, g: 1, b: 1, a: 1}\n    m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}\n    m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}\n    m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}\n    m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}\n    m_ColorMultiplier: 1\n    m_FadeDuration: 0.1\n  m_SpriteState:\n    m_HighlightedSprite: {fileID: 0}\n    m_PressedSprite: {fileID: 0}\n    m_SelectedSprite: {fileID: 0}\n    m_DisabledSprite: {fileID: 0}\n  m_AnimationTriggers:\n    m_NormalTrigger: Normal\n    m_HighlightedTrigger: Highlighted\n    m_PressedTrigger: Pressed\n    m_SelectedTrigger: Selected\n    m_DisabledTrigger: Disabled\n  m_Interactable: 1\n  m_TargetGraphic: {fileID: 1587363387}\n  m_OnClick:\n    m_PersistentCalls:\n      m_Calls: []\n--- !u!114 &1587363387\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 1587363384}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_Material: {fileID: 0}\n  m_Color: {r: 1, g: 1, b: 1, a: 1}\n  m_RaycastTarget: 1\n  m_OnCullStateChanged:\n    m_PersistentCalls:\n      m_Calls: []\n  m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}\n  m_Type: 1\n  m_PreserveAspect: 0\n  m_FillCenter: 1\n  m_FillMethod: 4\n  m_FillAmount: 1\n  m_FillClockwise: 1\n  m_FillOrigin: 0\n  m_UseSpriteMesh: 0\n  m_PixelsPerUnitMultiplier: 1\n--- !u!222 &1587363388\nCanvasRenderer:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 1587363384}\n  m_CullTransparentMesh: 0\n"
  },
  {
    "path": "src/UniTask/Assets/Scenes/ExceptionExamples.unity.meta",
    "content": "fileFormatVersion: 2\nguid: b5fed17e3ece238439bc796d8747df5d\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Scenes/MiddlewareSample.cs",
    "content": "﻿//using Cysharp.Threading.Tasks;\n//using System;\n//using System.Collections.Generic;\n//using System.Diagnostics;\n//using System.Linq;\n//using System.Text;\n//using System.Threading;\n//using System.Threading.Tasks;\n//using UnityEngine;\n//using UnityEngine.Networking;\n//using UnityEngine.SceneManagement;\n//using UnityEngine.UI;\n\n//namespace Cysharp.Threading.Tasks.Sample\n//{\n//    //public class Sample2\n//    //{\n//    //    public Sample2()\n//    //    {\n//    //        // デコレーターの詰まったClientを生成（これは一度作ったらフィールドに保存可）\n//    //        var client = new NetworkClient(\"http://localhost\", TimeSpan.FromSeconds(10),\n//    //            new QueueRequestDecorator(),\n//    //            new LoggingDecorator(),\n//    //            new AppendTokenDecorator(),\n//    //            new SetupHeaderDecorator());\n\n\n//    //        await client.PostAsync(\"/User/Register\", new { Id = 100 });\n\n\n//    //    }\n//    //}\n\n\n//    public class ReturnToTitleDecorator : IAsyncDecorator\n//    {\n//        public async UniTask<ResponseContext> SendAsync(RequestContext context, CancellationToken cancellationToken, Func<RequestContext, CancellationToken, UniTask<ResponseContext>> next)\n//        {\n//            try\n//            {\n//                return await next(context, cancellationToken);\n//            }\n//            catch (Exception ex)\n//            {\n//                if (ex is OperationCanceledException)\n//                {\n//                    // キャンセルはきっと想定されている処理なのでそのまんまスルー（呼び出し側でOperationCanceledExceptionとして飛んでいく)\n//                    throw;\n//                }\n\n//                if (ex is UnityWebRequestException uwe)\n//                {\n//                    // ステータスコードを使って、タイトルに戻す例外です、とかリトライさせる例外です、とかハンドリングさせると便利\n//                    // if (uwe.ResponseCode) { }...\n//                }\n\n//                // サーバー例外のMessageを直接出すなんて乱暴なことはデバッグ時だけですよ勿論。\n//                var result = await MessageDialog.ShowAsync(ex.Message);\n\n//                // OK か Cancelかで分岐するなら。今回はボタン一個、OKのみの想定なので無視\n//                // if (result == DialogResult.Ok) { }...\n\n//                // シーン呼び出しはawaitしないこと！awaitして正常終了しちゃうと、この通信の呼び出し元に処理が戻って続行してしまいます\n//                // のでForget。\n//                SceneManager.LoadSceneAsync(\"TitleScene\").ToUniTask().Forget();\n\n\n//                // そしてOperationCanceledExceptionを投げて、この通信の呼び出し元の処理はキャンセル扱いにして終了させる\n//                throw new OperationCanceledException();\n//            }\n//        }\n//    }\n\n//    public enum DialogResult\n//    {\n//        Ok,\n//        Cancel\n//    }\n\n//    public static class MessageDialog\n//    {\n//        public static async UniTask<DialogResult> ShowAsync(string message)\n//        {\n//            // (例えば)Prefabで作っておいたダイアログを生成する\n//            var view = await Resources.LoadAsync(\"Prefabs/Dialog\");\n\n//            // Ok, Cancelボタンのどちらかが押されるのを待機\n//            return await (view as GameObject).GetComponent<MessageDialogView>().ClickResult;\n//        }\n//    }\n\n//    public class MessageDialogView : MonoBehaviour\n//    {\n//        [SerializeField] Button okButton = default;\n//        [SerializeField] Button closeButton = default;\n\n//        UniTaskCompletionSource<DialogResult> taskCompletion;\n\n//        // これでどちらかが押されるまで無限に待つを表現\n//        public UniTask<DialogResult> ClickResult => taskCompletion.Task;\n\n//        private void Start()\n//        {\n//            taskCompletion = new UniTaskCompletionSource<DialogResult>();\n\n//            okButton.onClick.AddListener(() =>\n//            {\n//                taskCompletion.TrySetResult(DialogResult.Ok);\n//            });\n\n//            closeButton.onClick.AddListener(() =>\n//            {\n//                taskCompletion.TrySetResult(DialogResult.Cancel);\n//            });\n//        }\n\n//        // もしボタンが押されずに消滅した場合にネンノタメ。\n//        private void OnDestroy()\n//        {\n//            taskCompletion.TrySetResult(DialogResult.Cancel);\n//        }\n//    }\n\n//    public class MockDecorator : IAsyncDecorator\n//    {\n//        Dictionary<string, object> mock;\n\n//        // Pathと型を1:1にして事前定義したオブジェクトを返す辞書を渡す\n//        public MockDecorator(Dictionary<string, object> mock)\n//        {\n//            this.mock = mock;\n//        }\n\n//        public UniTask<ResponseContext> SendAsync(RequestContext context, CancellationToken cancellationToken, Func<RequestContext, CancellationToken, UniTask<ResponseContext>> next)\n//        {\n//            if (mock.TryGetValue(context.Path, out var value))\n//            {\n//                // 一致したものがあればそれを返す（実際の通信は行わない）\n//                return new UniTask<ResponseContext>(new ResponseContext(value));\n//            }\n//            else\n//            {\n//                return next(context, cancellationToken);\n//            }\n//        }\n//    }\n\n//    //public class LoggingDecorator : IAsyncDecorator\n//    //{\n//    //    public async UniTask<ResponseContext> SendAsync(RequestContext context, CancellationToken cancellationToken, Func<RequestContext, CancellationToken, UniTask<ResponseContext>> next)\n//    //    {\n//    //        var sw = Stopwatch.StartNew();\n//    //        try\n//    //        {\n//    //            UnityEngine.Debug.Log(\"Start Network Request:\" + context.Path);\n\n//    //            var response = await next(context, cancellationToken);\n\n//    //            UnityEngine.Debug.Log($\"Complete Network Request: {context.Path} , Elapsed: {sw.Elapsed}, Size: {response.GetRawData().Length}\");\n\n//    //            return response;\n//    //        }\n//    //        catch (Exception ex)\n//    //        {\n//    //            if (ex is OperationCanceledException)\n//    //            {\n//    //                UnityEngine.Debug.Log(\"Request Canceled:\" + context.Path);\n//    //            }\n//    //            else if (ex is TimeoutException)\n//    //            {\n//    //                UnityEngine.Debug.Log(\"Request Timeout:\" + context.Path);\n//    //            }\n//    //            else if (ex is UnityWebRequestException webex)\n//    //            {\n//    //                if (webex.IsHttpError)\n//    //                {\n//    //                    UnityEngine.Debug.Log($\"Request HttpError: {context.Path} Code:{webex.ResponseCode} Message:{webex.Message}\");\n//    //                }\n//    //                else if (webex.IsNetworkError)\n//    //                {\n//    //                    UnityEngine.Debug.Log($\"Request NetworkError: {context.Path} Code:{webex.ResponseCode} Message:{webex.Message}\");\n//    //                }\n//    //            }\n//    //            throw;\n//    //        }\n//    //        finally\n//    //        {\n//    //            /* log other */\n//    //        }\n//    //    }\n//    //}\n\n//    public class SetupHeaderDecorator : IAsyncDecorator\n//    {\n//        public async UniTask<ResponseContext> SendAsync(RequestContext context, CancellationToken cancellationToken, Func<RequestContext, CancellationToken, UniTask<ResponseContext>> next)\n//        {\n//            context.RequestHeaders[\"x-app-timestamp\"] = context.Timestamp.ToString();\n//            context.RequestHeaders[\"x-user-id\"] = \"132141411\"; // どこかから持ってくる\n//            context.RequestHeaders[\"x-access-token\"] = \"fafafawfafewaea\"; // どこかから持ってくる2\n\n//            var respsonse = await next(context, cancellationToken);\n\n//            var nextToken = respsonse.ResponseHeaders[\"token\"];\n//            // UserProfile.Token = nextToken; // どこかにセットするということにする\n\n//            return respsonse;\n//        }\n//    }\n\n\n//    public class AppendTokenDecorator : IAsyncDecorator\n//    {\n//        public async UniTask<ResponseContext> SendAsync(RequestContext context, CancellationToken cancellationToken, Func<RequestContext, CancellationToken, UniTask<ResponseContext>> next)\n//        {\n//            string token = \"token\"; // どっかから取ってくるということにする\n//            RETRY:\n//            try\n//            {\n//                context.RequestHeaders[\"x-access-token\"] = token;\n//                return await next(context, cancellationToken);\n//            }\n//            catch (UnityWebRequestException ex)\n//            {\n//                // 例えば700はTokenを再取得してください的な意味だったとする\n//                if (ex.ResponseCode == 700)\n//                {\n//                    // 別口でTokenを取得します的な処理\n//                    var newToken = await new NetworkClient(context.BasePath, context.Timeout).PostAsync<string>(\"/Auth/GetToken\", \"access_token\", cancellationToken);\n//                    context.Reset(this);\n//                    goto RETRY;\n//                }\n\n//                goto RETRY;\n//            }\n//        }\n//    }\n\n//    public class QueueRequestDecorator : IAsyncDecorator\n//    {\n//        readonly Queue<(UniTaskCompletionSource<ResponseContext>, RequestContext, CancellationToken, Func<RequestContext, CancellationToken, UniTask<ResponseContext>>)> q = new Queue<(UniTaskCompletionSource<ResponseContext>, RequestContext, CancellationToken, Func<RequestContext, CancellationToken, UniTask<ResponseContext>>)>();\n//        bool running;\n\n//        public async UniTask<ResponseContext> SendAsync(RequestContext context, CancellationToken cancellationToken, Func<RequestContext, CancellationToken, UniTask<ResponseContext>> next)\n//        {\n//            if (q.Count == 0)\n//            {\n//                return await next(context, cancellationToken);\n//            }\n//            else\n//            {\n//                var completionSource = new UniTaskCompletionSource<ResponseContext>();\n//                q.Enqueue((completionSource, context, cancellationToken, next));\n//                if (!running)\n//                {\n//                    Run().Forget();\n//                }\n//                return await completionSource.Task;\n//            }\n//        }\n\n//        async UniTaskVoid Run()\n//        {\n//            running = true;\n//            try\n//            {\n//                while (q.Count != 0)\n//                {\n//                    var (tcs, context, cancellationToken, next) = q.Dequeue();\n//                    try\n//                    {\n//                        var response = await next(context, cancellationToken);\n//                        tcs.TrySetResult(response);\n//                    }\n//                    catch (Exception ex)\n//                    {\n//                        tcs.TrySetException(ex);\n//                    }\n//                }\n//            }\n//            finally\n//            {\n//                running = false;\n//            }\n//        }\n//    }\n\n\n//    public class RequestContext\n//    {\n//        int decoratorIndex;\n//        readonly IAsyncDecorator[] decorators;\n//        Dictionary<string, string> headers;\n\n//        public string BasePath { get; }\n//        public string Path { get; }\n//        public object Value { get; }\n//        public TimeSpan Timeout { get; }\n//        public DateTimeOffset Timestamp { get; private set; }\n\n//        public IDictionary<string, string> RequestHeaders\n//        {\n//            get\n//            {\n//                if (headers == null)\n//                {\n//                    headers = new Dictionary<string, string>();\n//                }\n//                return headers;\n//            }\n//        }\n\n//        public RequestContext(string basePath, string path, object value, TimeSpan timeout, IAsyncDecorator[] filters)\n//        {\n//            this.decoratorIndex = -1;\n//            this.decorators = filters;\n//            this.BasePath = basePath;\n//            this.Path = path;\n//            this.Value = value;\n//            this.Timeout = timeout;\n//            this.Timestamp = DateTimeOffset.UtcNow;\n//        }\n\n//        internal Dictionary<string, string> GetRawHeaders() => headers;\n//        internal IAsyncDecorator GetNextDecorator() => decorators[++decoratorIndex];\n\n//        public void Reset(IAsyncDecorator currentFilter)\n//        {\n//            decoratorIndex = Array.IndexOf(decorators, currentFilter);\n//            if (headers != null)\n//            {\n//                headers.Clear();\n//            }\n//            Timestamp = DateTimeOffset.UtcNow;\n//        }\n//    }\n\n//    public class ResponseContext\n//    {\n//        bool hasValue;\n//        object value;\n//        readonly byte[] bytes;\n\n//        public long StatusCode { get; }\n//        public Dictionary<string, string> ResponseHeaders { get; }\n\n//        public ResponseContext(object value, Dictionary<string, string> header = null)\n//        {\n//            this.hasValue = true;\n//            this.value = value;\n//            this.StatusCode = 200;\n//            this.ResponseHeaders = (header ?? new Dictionary<string, string>());\n//        }\n\n//        public ResponseContext(byte[] bytes, long statusCode, Dictionary<string, string> responseHeaders)\n//        {\n//            this.hasValue = false;\n//            this.bytes = bytes;\n//            this.StatusCode = statusCode;\n//            this.ResponseHeaders = responseHeaders;\n//        }\n\n//        public byte[] GetRawData() => bytes;\n\n//        public T GetResponseAs<T>()\n//        {\n//            if (hasValue)\n//            {\n//                return (T)value;\n//            }\n\n//            value = JsonUtility.FromJson<T>(Encoding.UTF8.GetString(bytes));\n//            hasValue = true;\n//            return (T)value;\n//        }\n//    }\n\n//    public interface IAsyncDecorator\n//    {\n//        UniTask<ResponseContext> SendAsync(RequestContext context, CancellationToken cancellationToken, Func<RequestContext, CancellationToken, UniTask<ResponseContext>> next);\n//    }\n\n\n//    public class NetworkClient : IAsyncDecorator\n//    {\n//        readonly Func<RequestContext, CancellationToken, UniTask<ResponseContext>> next;\n//        readonly IAsyncDecorator[] decorators;\n//        readonly TimeSpan timeout;\n//        readonly IProgress<float> progress;\n//        readonly string basePath;\n\n//        public NetworkClient(string basePath, TimeSpan timeout, params IAsyncDecorator[] decorators)\n//            : this(basePath, timeout, null, decorators)\n//        {\n//        }\n\n//        public NetworkClient(string basePath, TimeSpan timeout, IProgress<float> progress, params IAsyncDecorator[] decorators)\n//        {\n//            this.next = InvokeRecursive; // setup delegate\n\n//            this.basePath = basePath;\n//            this.timeout = timeout;\n//            this.progress = progress;\n//            this.decorators = new IAsyncDecorator[decorators.Length + 1];\n//            Array.Copy(decorators, this.decorators, decorators.Length);\n//            this.decorators[this.decorators.Length - 1] = this;\n//        }\n\n//        public async UniTask<T> PostAsync<T>(string path, T value, CancellationToken cancellationToken = default)\n//        {\n//            var request = new RequestContext(basePath, path, value, timeout, decorators);\n//            var response = await InvokeRecursive(request, cancellationToken);\n//            return response.GetResponseAs<T>();\n//        }\n\n\n//        UniTask<ResponseContext> InvokeRecursive(RequestContext context, CancellationToken cancellationToken)\n//        {\n//            return context.GetNextDecorator().SendAsync(context, cancellationToken, next); // マジカル再帰処理\n//        }\n\n//        async UniTask<ResponseContext> IAsyncDecorator.SendAsync(RequestContext context, CancellationToken cancellationToken, Func<RequestContext, CancellationToken, UniTask<ResponseContext>> _)\n//        {\n//            // Postしか興味ないからPostにしかしないよ！\n//            // パフォーマンスを最大限にしたい場合はuploadHandler, downloadHandlerをカスタマイズすること\n\n//            // JSONでbodyに送るというパラメータで送るという雑設定。\n//            var data = JsonUtility.ToJson(context.Value);\n//            var formData = new Dictionary<string, string> { { \"body\", data } };\n\n//            using (var req = UnityWebRequest.Post(basePath + context.Path, formData))\n//            {\n//                var header = context.GetRawHeaders();\n//                if (header != null)\n//                {\n//                    foreach (var item in header)\n//                    {\n//                        req.SetRequestHeader(item.Key, item.Value);\n//                    }\n//                }\n\n//                // Timeout処理はCancellationTokenSourceのCancelAfterSlim(UniTask拡張)を使ってサクッと処理\n//                var linkToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);\n//                linkToken.CancelAfterSlim(timeout);\n//                try\n//                {\n//                    // 完了待ちや終了処理はUniTaskの拡張自体に丸投げ\n//                    await req.SendWebRequest().ToUniTask(progress: progress, cancellationToken: linkToken.Token);\n//                }\n//                catch (OperationCanceledException)\n//                {\n//                    // 元キャンセレーションソースがキャンセルしてなければTimeoutによるものと判定\n//                    if (!cancellationToken.IsCancellationRequested)\n//                    {\n//                        throw new TimeoutException();\n//                    }\n//                }\n//                finally\n//                {\n//                    // Timeoutに引っかからなかった場合にてるのでCancelAfterSlimの裏で回ってるループをこれで終わらせとく\n//                    if (!linkToken.IsCancellationRequested)\n//                    {\n//                        linkToken.Cancel();\n//                    }\n//                }\n\n//                // UnityWebRequestを先にDisposeしちゃうので先に必要なものを取得しておく（性能的には無駄なのでパフォーマンスを最大限にしたい場合は更に一工夫を）\n//                return new ResponseContext(req.downloadHandler.data, req.responseCode, req.GetResponseHeaders());\n//            }\n//        }\n//    }\n//}"
  },
  {
    "path": "src/UniTask/Assets/Scenes/MiddlewareSample.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 7fc39a4b35a8db44592cddc0b365942f\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Scenes/SandboxMain.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing System.Linq;\nusing Cysharp.Threading.Tasks.Linq;\nusing Cysharp.Threading.Tasks.Triggers;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Unity.Collections;\nusing Unity.Jobs;\nusing UnityEngine;\nusing UnityEngine.LowLevel;\nusing UnityEngine.Networking;\nusing UnityEngine.UI;\nusing UnityEngine.SceneManagement;\nusing UnityEngine.Rendering;\nusing System.IO;\nusing System.Linq.Expressions;\nusing UnityEngine.Events;\n\n\n\n// using DG.Tweening;\n\n\n\npublic struct MyJob : IJob\n{\n    public int loopCount;\n    public NativeArray<int> inOut;\n    public int result;\n\n    public void Execute()\n    {\n        result = 0;\n        for (int i = 0; i < loopCount; i++)\n        {\n            result++;\n        }\n        inOut[0] = result;\n    }\n}\n\npublic enum MyEnum\n{\n    A, B, C\n}\n\n\npublic class SimplePresenter\n{\n    // View\n    public UnityEngine.UI.InputField Input;\n\n\n    // Presenter\n\n\n    public SimplePresenter()\n    {\n        //Input.OnValueChangedAsAsyncEnumerable()\n        //   .Queue()\n        //   .SelectAwait(async x =>\n        //   {\n        //       await UniTask.Delay(TimeSpan.FromSeconds(1));\n        //       return x;\n        //   })\n        //   .Select(x=> x.ToUpper())\n        //   .BindTo(\n\n\n\n    }\n\n}\n\n\n\n\n\n\n\npublic static partial class UnityUIComponentExtensions\n{\n\n}\n\n\n\n\npublic class AsyncMessageBroker<T> : IDisposable\n{\n    Channel<T> channel;\n\n    IConnectableUniTaskAsyncEnumerable<T> multicastSource;\n    IDisposable connection;\n\n    public AsyncMessageBroker()\n    {\n        channel = Channel.CreateSingleConsumerUnbounded<T>();\n        multicastSource = channel.Reader.ReadAllAsync().Publish();\n        connection = multicastSource.Connect();\n    }\n\n    public void Publish(T value)\n    {\n        channel.Writer.TryWrite(value);\n    }\n\n    public IUniTaskAsyncEnumerable<T> Subscribe()\n    {\n        return multicastSource;\n    }\n\n    public void Dispose()\n    {\n        channel.Writer.TryComplete();\n        connection.Dispose();\n    }\n}\npublic class WhenEachTest\n{\n    public async UniTask Each()\n    {\n        var a = Delay(1, 3000);\n        var b = Delay(2, 1000);\n        var c = Delay(3, 2000);\n\n        var l = new List<int>();\n        await foreach (var item in UniTask.WhenEach(a, b, c))\n        {\n            Debug.Log(item.Result);\n        }\n    }\n\n    async UniTask<int> Delay(int id, int sleep)\n    {\n        await UniTask.Delay(sleep);\n        return id;\n    }\n\n}\n\npublic class SandboxMain : MonoBehaviour\n{\n    public Camera mycamera;\n\n    public Button okButton;\n    public Button cancelButton;\n\n\n    CancellationTokenSource cts;\n\n    public AsyncReactiveProperty<int> RP1;\n\n\n    UniTaskCompletionSource ucs;\n    async UniTask<int> FooAsync()\n    {\n\n        // use F10, will crash.\n        var loop = int.Parse(\"9\");\n        await UniTask.DelayFrame(loop);\n\n        Debug.Log(\"OK\");\n        await UniTask.DelayFrame(loop);\n\n        Debug.Log(\"Again\");\n\n\n        // var foo = InstantiateAsync<SandboxMain>(this).ToUniTask();\n\n\n\n\n\n        // var tako = await foo;\n\n\n        //UnityAction action;\n        \n\n        return 10;\n    }\n\n\n\n\n\n    public class Model\n    {\n        // State<int> Hp { get; }\n\n\n\n\n        public Model()\n        {\n            // hp = new AsyncReactiveProperty<int>();\n\n\n\n\n\n\n\n\n\n            //setHp = Hp.GetSetter();\n        }\n\n        void Increment(int value)\n        {\n\n\n            // setHp(Hp.Value += value);\n        }\n    }\n\n\n\n    public Text text;\n    public Button button;\n\n\n\n\n\n    async UniTask RunStandardDelayAsync()\n    {\n\n\n\n        UnityEngine.Debug.Log(\"DEB\");\n\n        await UniTask.DelayFrame(30);\n\n        UnityEngine.Debug.Log(\"DEB END\");\n    }\n\n    async UniTask RunJobAsync()\n    {\n        var job = new MyJob() { loopCount = 999, inOut = new NativeArray<int>(1, Allocator.TempJob) };\n        try\n        {\n            JobHandle.ScheduleBatchedJobs();\n\n            var scheduled = job.Schedule();\n\n            UnityEngine.Debug.Log(\"OK\");\n            await scheduled; // .ConfigureAwait(PlayerLoopTiming.Update); // .WaitAsync(PlayerLoopTiming.Update);\n            UnityEngine.Debug.Log(\"OK2\");\n        }\n        finally\n        {\n            job.inOut.Dispose();\n        }\n    }\n\n\n    async UniTaskVoid Update2()\n    {\n\n\n\n\n\n\n        UnityEngine.Debug.Log(\"async linq!\");\n\n        await UniTaskAsyncEnumerable.Range(1, 10)\n            .Where(x => x % 2 == 0)\n            .Select(x => x * x)\n            .ForEachAsync(x =>\n            {\n                UnityEngine.Debug.Log(x);\n            });\n\n        UnityEngine.Debug.Log(\"done\");\n\n\n    }\n    private async UniTaskVoid HogeAsync()\n    {\n        // await is not over\n        await UniTaskAsyncEnumerable\n            .TimerFrame(10)\n            .ForEachAwaitAsync(async _ =>\n            // .ForEachAsync(_ =>\n            {\n                await UniTask.Delay(1000);\n                Debug.Log(Time.time);\n            });\n\n        Debug.Log(\"Done\");\n    }\n\n    public int MyProperty { get; set; }\n\n    public class MyClass\n    {\n        public int MyProperty { get; set; }\n    }\n\n    async Task Test1()\n    {\n        // var r = await TcsAsync(\"https://bing.com/\");\n        await Task.Yield();\n        Debug.Log(\"TASKASYNC\");\n    }\n\n    //async UniTaskVoid Test2()\n    //{\n    //    try\n    //    {\n    //        //var cts = new CancellationTokenSource();\n    //        //var r = UniAsync(\"https://bing.com/\", cts.Token);\n    //        //cts.Cancel();\n    //        //await r;\n    //        Debug.Log(\"SendWebRequestDone:\" + PlayerLoopInfo.CurrentLoopType);\n\n\n    //        //        var foo = await UnityWebRequest.Get(\"https://bing.com/\").SendWebRequest();\n    //        //          foo.downloadHandler.text;\n    //        //\n    //        _ = await UnityWebRequest.Get(\"https://bing.com/\").SendWebRequest().WithCancellation(CancellationToken.None);\n    //        Debug.Log(\"SendWebRequestWithCancellationDone:\" + PlayerLoopInfo.CurrentLoopType);\n    //    }\n    //    catch\n    //    {\n    //        Debug.Log(\"Canceled\");\n    //    }\n    //}\n\n    IEnumerator Test3(string url)\n    {\n        var req = UnityWebRequest.Get(url).SendWebRequest();\n        yield return req;\n        Debug.Log(\"COROUTINE\");\n    }\n\n    //static async Task<UnityWebRequest> TcsAsync(string url)\n    //{\n    //    var req = await UnityWebRequest.Get(url).SendWebRequest();\n    //    return req;\n    //}\n\n    //static async UniTask<UnityWebRequest> UniAsync(string url, CancellationToken cancellationToken)\n    //{\n    //    var req = await UnityWebRequest.Get(url).SendWebRequest().WithCancellation(cancellationToken);\n    //    return req;\n    //}\n\n    async Task<int> Test()\n    {\n        await Task.Yield();\n        return 10;\n    }\n\n    async UniTask<int> Ex()\n    {\n        await UniTask.Yield();\n        //throw new Exception();\n        await UniTask.Delay(TimeSpan.FromSeconds(15));\n        return 0;\n    }\n\n    IEnumerator CoroutineRun()\n    {\n        UnityEngine.Debug.Log(\"Before Coroutine yield return null,\" + Time.frameCount + \", \" + PlayerLoopInfo.CurrentLoopType);\n        yield return null;\n        UnityEngine.Debug.Log(\"After Coroutine yield return null,\" + Time.frameCount + \", \" + PlayerLoopInfo.CurrentLoopType);\n    }\n\n    IEnumerator CoroutineRun2()\n    {\n        UnityEngine.Debug.Log(\"Before Coroutine yield return WaitForEndOfFrame,\" + Time.frameCount);\n        yield return new WaitForEndOfFrame();\n        UnityEngine.Debug.Log(\"After Coroutine yield return WaitForEndOfFrame,\" + Time.frameCount + \", \" + PlayerLoopInfo.CurrentLoopType);\n        yield return new WaitForEndOfFrame();\n        UnityEngine.Debug.Log(\"Onemore After Coroutine yield return WaitForEndOfFrame,\" + Time.frameCount + \", \" + PlayerLoopInfo.CurrentLoopType);\n    }\n\n\n    async UniTaskVoid AsyncRun()\n    {\n        UnityEngine.Debug.Log(\"Before async Yield(default),\" + Time.frameCount);\n        await UniTask.Yield();\n        UnityEngine.Debug.Log(\"After async Yield(default),\" + Time.frameCount + \", \" + PlayerLoopInfo.CurrentLoopType);\n    }\n\n    async UniTaskVoid AsyncLastUpdate()\n    {\n        UnityEngine.Debug.Log(\"Before async Yield(LastUpdate),\" + Time.frameCount);\n        await UniTask.Yield(PlayerLoopTiming.LastUpdate);\n        UnityEngine.Debug.Log(\"After async Yield(LastUpdate),\" + Time.frameCount);\n    }\n\n    async UniTaskVoid AsyncLastLast()\n    {\n        UnityEngine.Debug.Log(\"Before async Yield(LastPostLateUpdate),\" + Time.frameCount);\n        await UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate);\n        UnityEngine.Debug.Log(\"After async Yield(LastPostLateUpdate),\" + Time.frameCount);\n    }\n\n    async UniTaskVoid Yieldding()\n    {\n        await UniTask.Yield(PlayerLoopTiming.PreUpdate);\n        StartCoroutine(CoroutineRun());\n    }\n\n    async UniTaskVoid AsyncFixedUpdate()\n    {\n        while (true)\n        {\n            await UniTask.WaitForFixedUpdate();\n            Debug.Log(\"Async:\" + Time.frameCount + \", \" + PlayerLoopInfo.CurrentLoopType);\n        }\n    }\n\n    IEnumerator CoroutineFixedUpdate()\n    {\n        while (true)\n        {\n            yield return new WaitForFixedUpdate();\n            Debug.Log(\"Coroutine:\" + Time.frameCount + \", \" + PlayerLoopInfo.CurrentLoopType);\n        }\n    }\n\n    private void FixedUpdate()\n    {\n        // Debug.Log(\"FixedUpdate:\" + Time.frameCount + \", \" + PlayerLoopInfo.CurrentLoopType);\n    }\n\n    async UniTaskVoid DelayFrame3_Pre()\n    {\n        await UniTask.Yield(PlayerLoopTiming.PreUpdate);\n        Debug.Log(\"Before framecount:\" + Time.frameCount);\n        await UniTask.DelayFrame(3);\n        Debug.Log(\"After framecount:\" + Time.frameCount);\n    }\n\n    async UniTaskVoid DelayFrame3_Post()\n    {\n        await UniTask.Yield(PlayerLoopTiming.PostLateUpdate);\n        Debug.Log(\"Before framecount:\" + Time.frameCount);\n        await UniTask.DelayFrame(3);\n        Debug.Log(\"After framecount:\" + Time.frameCount);\n    }\n\n    async UniTask TestCoroutine()\n    {\n        await UniTask.Yield();\n        throw new Exception(\"foobarbaz\");\n    }\n\n    async UniTask DelayCheck()\n    {\n        await UniTask.Yield(PlayerLoopTiming.PreUpdate);\n        Debug.Log(\"before\");\n        var t = UniTask.Delay(TimeSpan.FromSeconds(1), ignoreTimeScale: false);\n\n        await t;\n        Debug.Log(\"after\");\n    }\n\n    //private async UniTaskVoid ExecuteAsync()\n    //{\n    //    var req = UnityWebRequest.Get(\"https://google.com/\");\n\n    //    var v = await req.SendWebRequest().ToUniTask();\n    //    // req.Dispose();\n    //    Debug.Log($\"{v.isDone} {v.isHttpError} {v.isNetworkError}\");\n    //    Debug.Log(v.downloadHandler.text);\n    //}\n    private async void Go()\n    {\n        await UniTask.DelayFrame(0);\n    }\n\n    async UniTask Foo()\n    {\n        await UniTask.DelayFrame(10);\n        throw new Exception(\"yeah\");\n    }\n\n\n\n\n    async void Nanika()\n    {\n        await UniTask.Yield();\n        Debug.Log(\"Here\");\n        throw new Exception();\n    }\n\n\n\n\n\n\n\n    private void Awake()\n    {\n        // PlayerLoopInfo.Inject();\n        PrepareCamera();\n    }\n\n    public IUniTaskAsyncEnumerable<int> MyEveryUpdate()\n    {\n        return UniTaskAsyncEnumerable.Create<int>(async (writer, token) =>\n        {\n            var frameCount = 0;\n            await UniTask.Yield();\n            while (!token.IsCancellationRequested)\n            {\n                await writer.YieldAsync(frameCount++); // instead of `yield return`\n                await UniTask.Yield();\n            }\n        });\n    }\n\n    async void RunStandardTaskAsync()\n    {\n        Debug.Log(\"Wait 3 seconds\");\n        await Task.Delay(TimeSpan.FromSeconds(3));\n\n        Debug.Log(\"Current SyncContext:\" + SynchronizationContext.Current.GetType().FullName);\n    }\n\n\n    async UniTask QuitCheck()\n    {\n        try\n        {\n            await UniTask.Delay(TimeSpan.FromMinutes(1), cancellationToken: quitSource.Token);\n        }\n        finally\n        {\n            Debug.Log(\"End QuitCheck async\");\n        }\n    }\n\n    CancellationTokenSource quitSource = new CancellationTokenSource();\n\n\n    IEnumerator TestCor()\n    {\n        Debug.Log(\"start cor\");\n        yield return null;\n        yield return new WaitForEndOfFrame();\n        Debug.Log(\"end cor\");\n    }\n\n    IEnumerator LastYieldCore()\n    {\n        Debug.Log(\"YieldBegin:\" + Time.frameCount);\n        yield return new WaitForEndOfFrame();\n        Debug.Log(\"YieldEnd:\" + Time.frameCount);\n    }\n\n    private static async UniTask TestAsync(CancellationToken ct)\n    {\n        Debug.Log(\"TestAsync Start.\");\n        var count = 0;\n        while (!ct.IsCancellationRequested)\n        {\n            try\n            {\n                Debug.Log($\"TestAsync try count:{++count}\");\n                var task1 = new WaitUntil(() => UnityEngine.Random.Range(0, 10) == 0).ToUniTask();\n                var task2 = new WaitUntil(() => UnityEngine.Random.Range(0, 10) == 0).ToUniTask();\n                var task3 = new WaitUntil(() => UnityEngine.Random.Range(0, 10) == 0).ToUniTask();\n\n                await UniTask.WhenAny(task1, task2, task3);\n            }\n            catch (Exception e)\n            {\n                Debug.LogError(e);\n                return;\n\n\n            }\n        }\n        Debug.Log(\"TestAsync Finished.\");\n    }\n\n\n\n\n    async UniTaskVoid Start()\n    {\n        await new WhenEachTest().Each();\n\n\n        // UniTask.Delay(TimeSpan.FromSeconds(1)).TimeoutWithoutException\n\n\n        var currentLoop = PlayerLoop.GetDefaultPlayerLoop();\n        PlayerLoopHelper.Initialize(ref currentLoop, InjectPlayerLoopTimings.Minimum); // minimum is Update | FixedUpdate | LastPostLateUpdate\n\n\n\n        \n\n\n        // TestAsync(cts.Token).Forget();\n\n        okButton.onClick.AddListener(UniTask.UnityAction(async () =>\n        {\n            await UniTask.WaitForEndOfFrame(this);\n            var texture = new Texture2D(Screen.width, Screen.height);\n            texture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);\n            texture.Apply();\n\n            var jpg = texture.EncodeToJPG();\n            File.WriteAllBytes(\"testscreencapture.jpg\", jpg);\n            Debug.Log(\"ok?\");\n\n            //var texture = ScreenCapture.CaptureScreenshotAsTexture();\n            //if (texture == null)\n            //{\n            //    Debug.Log(\"fail\");\n            //}\n            //else\n            //{\n            //    var jpg = texture.EncodeToJPG();\n            //    File.WriteAllBytes(\"testscreencapture.jpg\", jpg);\n            //    Debug.Log(\"ok?\");\n            //}\n        }));\n\n        cancelButton.onClick.AddListener(UniTask.UnityAction(async () =>\n        {\n            //clickCancelSource.Cancel();\n\n            //RunCheck(PlayerLoopTiming.Initialization).Forget();\n            //RunCheck(PlayerLoopTiming.LastInitialization).Forget();\n            //RunCheck(PlayerLoopTiming.EarlyUpdate).Forget();\n            //RunCheck(PlayerLoopTiming.LastEarlyUpdate).Forget();\n            //RunCheck(PlayerLoopTiming.FixedUpdate).Forget();\n            //RunCheck(PlayerLoopTiming.LastFixedUpdate).Forget();\n            //RunCheck(PlayerLoopTiming.PreUpdate).Forget();\n            //RunCheck(PlayerLoopTiming.LastPreUpdate).Forget();\n            //RunCheck(PlayerLoopTiming.Update).Forget();\n            //RunCheck(PlayerLoopTiming.LastUpdate).Forget();\n            //RunCheck(PlayerLoopTiming.PreLateUpdate).Forget();\n            //RunCheck(PlayerLoopTiming.LastPreLateUpdate).Forget();\n            //RunCheck(PlayerLoopTiming.PostLateUpdate).Forget();\n            //RunCheck(PlayerLoopTiming.LastPostLateUpdate).Forget();\n\n            await UniTask.Yield();\n        }));\n\n        await UniTask.Yield();\n    }\n\n    async UniTaskVoid RunCheck(PlayerLoopTiming timing)\n    {\n        //await UniTask.Yield(timing);\n        //UnityEngine.Debug.Log(\"Yield:\" + timing);\n        await UniTask.DelayFrame(1, timing);\n        UnityEngine.Debug.Log(\"Delay:\" + timing);\n    }\n\n    private void Application_logMessageReceived2(string condition, string stackTrace, LogType type)\n    {\n        throw new NotImplementedException();\n    }\n\n    private void Application_logMessageReceived1(string condition, string stackTrace, LogType type)\n    {\n        throw new NotImplementedException();\n    }\n\n    async UniTaskVoid UpdateUniTask()\n    {\n        while (true)\n        {\n            await UniTask.Yield();\n            UnityEngine.Debug.Log(\"UniTaskYield:\" + PlayerLoopInfo.CurrentLoopType);\n        }\n    }\n\n\n    async UniTaskVoid ReturnToMainThreadTest()\n    {\n        var d = UniTask.ReturnToCurrentSynchronizationContext();\n        try\n        {\n            UnityEngine.Debug.Log(\"In MainThread?\" + Thread.CurrentThread.ManagedThreadId);\n            UnityEngine.Debug.Log(\"SyncContext is null?\" + (SynchronizationContext.Current == null));\n            await UniTask.SwitchToThreadPool();\n            UnityEngine.Debug.Log(\"In ThreadPool?\" + Thread.CurrentThread.ManagedThreadId);\n            UnityEngine.Debug.Log(\"SyncContext is null?\" + (SynchronizationContext.Current == null));\n        }\n        finally\n        {\n            await d.DisposeAsync();\n        }\n\n        UnityEngine.Debug.Log(\"In ThreadPool?\" + Thread.CurrentThread.ManagedThreadId);\n        UnityEngine.Debug.Log(\"SyncContext is null2\" + (SynchronizationContext.Current == null));\n    }\n\n\n    private void Update()\n    {\n        // UnityEngine.Debug.Log(\"Update:\" + PlayerLoopInfo.CurrentLoopType);\n    }\n\n    IEnumerator Coroutine()\n    {\n        try\n        {\n            while (true)\n            {\n                yield return null;\n                //UnityEngine.Debug.Log(\"Coroutine null:\" + PlayerLoopInfo.CurrentLoopType);\n            }\n        }\n        finally\n        {\n            UnityEngine.Debug.Log(\"Coroutine Finally\");\n        }\n    }\n\n    async UniTaskVoid CloseAsync(CancellationToken cancellationToken = default)\n    {\n        while (true)\n        {\n            await UniTask.Yield(PlayerLoopTiming.Update, cancellationToken);\n        }\n    }\n\n    async UniTaskVoid Running(CancellationToken ct)\n    {\n        Debug.Log(\"BEGIN\");\n        await UniTask.WaitUntilCanceled(ct);\n        Debug.Log(\"DONE\");\n    }\n\n    async UniTaskVoid WaitForChannelAsync(ChannelReader<int> reader, CancellationToken token)\n    {\n        try\n        {\n            //var result1 = await reader.ReadAsync(token);\n            //Debug.Log(result1);\n\n            await reader.ReadAllAsync().ForEachAsync(x => Debug.Log(x)/*, token*/);\n\n            Debug.Log(\"done\");\n        }\n        catch (Exception ex)\n        {\n            Debug.Log(\"here\");\n            Debug.LogException(ex);\n        }\n    }\n\n    async UniTaskVoid Go(AsyncUpdateTrigger trigger, int i, CancellationToken ct)\n    {\n        await UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate);\n        UnityEngine.Debug.Log(\"AWAIT BEFO:\" + Time.frameCount);\n        var handler = trigger.GetUpdateAsyncHandler(ct);\n\n        try\n        {\n            while (!ct.IsCancellationRequested)\n            {\n                await handler.UpdateAsync();\n                //await handler.UpdateAsync();\n                Debug.Log(\"OK:\" + i);\n            }\n        }\n        finally\n        {\n            UnityEngine.Debug.Log(\"AWAIT END:\" + Time.frameCount + \": No,\" + i);\n        }\n    }\n\n    async UniTaskVoid ClickOnce()\n    {\n        try\n        {\n            await okButton.OnClickAsync();\n            UnityEngine.Debug.Log(\"CLICKED ONCE\");\n        }\n        catch (Exception ex)\n        {\n            UnityEngine.Debug.Log(ex.ToString());\n        }\n        finally\n        {\n            UnityEngine.Debug.Log(\"END ONCE\");\n        }\n    }\n\n    async UniTaskVoid ClickForever()\n    {\n        try\n        {\n            using (var handler = okButton.GetAsyncClickEventHandler())\n            {\n                while (true)\n                {\n                    await handler.OnClickAsync();\n                    UnityEngine.Debug.Log(\"Clicked\");\n                }\n            }\n        }\n        catch (Exception ex)\n        {\n            UnityEngine.Debug.Log(ex.ToString());\n        }\n        finally\n        {\n            UnityEngine.Debug.Log(\"END\");\n        }\n    }\n\n    async UniTask SimpleAwait()\n    {\n        await UniTask.Yield();\n        await UniTask.Yield();\n        await UniTask.Yield();\n        throw new InvalidOperationException(\"bar!!!\");\n    }\n\n    IEnumerator SimpleCoroutine()\n    {\n        yield return null;\n        yield return null;\n        yield return null;\n        throw new InvalidOperationException(\"foo!!!\");\n    }\n\n    async UniTask TimingDump(PlayerLoopTiming timing)\n    {\n        while (true)\n        {\n            await UniTask.Yield(timing);\n            Debug.Log(\"PlayerLoopTiming.\" + timing);\n        }\n    }\n\n    IEnumerator CoroutineDump(string msg, YieldInstruction waitObj)\n    {\n        while (true)\n        {\n            yield return waitObj;\n            Debug.Log(msg);\n        }\n    }\n\n    //private void Update()\n    //{\n    //    Debug.Log(\"Update\");\n    //}\n\n    //private void LateUpdate()\n    //{\n    //    Debug.Log(\"LateUpdate\");\n    //}\n\n    //private void FixedUpdate()\n    //{\n    //    Debug.Log(\"FixedUpdate\");\n    //}\n\n\n    private void Application_logMessageReceived(string condition, string stackTrace, LogType type)\n    {\n        if (text != null)\n        {\n            text.text += \"\\n\" + condition;\n        }\n    }\n\n    async UniTask OuterAsync(bool b)\n    {\n        UnityEngine.Debug.Log(\"START OUTER\");\n\n        await InnerAsync(b);\n        await InnerAsync(b);\n\n        UnityEngine.Debug.Log(\"END OUTER\");\n\n        // throw new InvalidOperationException(\"NAZO ERROR!?\"); // error!?\n    }\n\n    async UniTask InnerAsync(bool b)\n    {\n        if (b)\n        {\n            UnityEngine.Debug.Log(\"Start delay:\" + Time.frameCount);\n            await UniTask.DelayFrame(60);\n            UnityEngine.Debug.Log(\"End delay:\" + Time.frameCount);\n            await UniTask.DelayFrame(60);\n            UnityEngine.Debug.Log(\"Onemore end delay:\" + Time.frameCount);\n        }\n        else\n        {\n            UnityEngine.Debug.Log(\"Empty END\");\n            throw new InvalidOperationException(\"FOOBARBAZ\");\n        }\n    }\n\n    /*\n    PlayerLoopTiming.Initialization\n    PlayerLoopTiming.LastInitialization\n    PlayerLoopTiming.EarlyUpdate\n    PlayerLoopTiming.LastEarlyUpdate\n    PlayerLoopTiming.PreUpdate\n    PlayerLoopTiming.LastPreUpdate\n    PlayerLoopTiming.Update\n    Update\n    yield null\n    yield WaitForSeconds\n    yield WWW\n    yield StartCoroutine\n    PlayerLoopTiming.LastUpdate\n    PlayerLoopTiming.PreLateUpdate\n    LateUpdate\n    PlayerLoopTiming.LastPreLateUpdate\n    PlayerLoopTiming.PostLateUpdate\n    PlayerLoopTiming.LastPostLateUpdate\n    yield WaitForEndOfFrame\n\n    // --- Physics Loop\n    PlayerLoopTiming.FixedUpdate\n    FixedUpdate\n    yield WaitForFixedUpdate\n    PlayerLoopTiming.LastFixedUpdate\n    */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n    private void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)\n    {\n        // e.SetObserved();\n        // or other custom write code.\n        UnityEngine.Debug.LogError(\"Unobserved:\" + e.Exception.ToString());\n    }\n\n\n    // GPU Screenshot Sample\n\n    void PrepareCamera()\n    {\n        //Debug.Log(\"Support AsyncGPUReadback:\" + SystemInfo.supportsAsyncGPUReadback);\n\n        //var width = 480;\n        //var height = 240;\n        //var depth = 24;\n\n        //mycamera.targetTexture = new RenderTexture(width, height, depth, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default)\n        //{\n        //    antiAliasing = 8\n        //};\n        //mycamera.enabled = true;\n\n        //myRenderTexture = new RenderTexture(width, height, depth, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default)\n        //{\n        //    antiAliasing = 8\n        //};\n    }\n\n    RenderTexture myRenderTexture;\n\n    async UniTask ShootAsync()\n    {\n        var rt = mycamera.targetTexture;\n\n\n\n        var req = await AsyncGPUReadback.Request(rt, 0);\n\n        Debug.Log(\"GPU Readback done?:\" + req.done);\n\n        var rawByteArray = req.GetData<byte>().ToArray();\n        var graphicsFormat = rt.graphicsFormat;\n        var width = (uint)rt.width;\n        var height = (uint)rt.height;\n\n        Debug.Log(\"BytesSize:\" + rawByteArray.Length);\n\n\n        var imageBytes = ImageConversion.EncodeArrayToPNG(rawByteArray, graphicsFormat, width, height);\n\n\n        File.WriteAllBytes(\"my_screenshot.png\", imageBytes); // test\n\n\n\n\n\n\n\n    }\n}\n\n\npublic class SyncContextInjecter\n{\n    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]\n    public static void Inject()\n    {\n        SynchronizationContext.SetSynchronizationContext(new UniTaskSynchronizationContext());\n    }\n}\n\n\npublic class PlayerLoopInfo\n{\n    // [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]\n    static void Init()\n    {\n        var playerLoop = UnityEngine.LowLevel.PlayerLoop.GetDefaultPlayerLoop();\n        DumpPlayerLoop(\"Default\", playerLoop);\n    }\n\n    public static void DumpPlayerLoop(string which, UnityEngine.LowLevel.PlayerLoopSystem playerLoop)\n    {\n        var sb = new StringBuilder();\n        sb.AppendLine($\"{which} PlayerLoop List\");\n        foreach (var header in playerLoop.subSystemList)\n        {\n            sb.AppendFormat(\"------{0}------\", header.type.Name);\n            sb.AppendLine();\n            foreach (var subSystem in header.subSystemList)\n            {\n                sb.AppendFormat(\"{0}.{1}\", header.type.Name, subSystem.type.Name);\n                sb.AppendLine();\n\n                if (subSystem.subSystemList != null)\n                {\n                    UnityEngine.Debug.LogWarning(\"More Subsystem:\" + subSystem.subSystemList.Length);\n                }\n            }\n        }\n\n        UnityEngine.Debug.Log(sb.ToString());\n    }\n\n    public static Type CurrentLoopType { get; private set; }\n\n    // [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]\n    public static void Inject()\n    {\n        var system = PlayerLoop.GetCurrentPlayerLoop();\n\n        for (int i = 0; i < system.subSystemList.Length; i++)\n        {\n            var loop = system.subSystemList[i].subSystemList.SelectMany(x =>\n            {\n                var t = typeof(WrapLoop<>).MakeGenericType(x.type);\n                var instance = (ILoopRunner)Activator.CreateInstance(t, x.type);\n                return new[] { new PlayerLoopSystem { type = t, updateDelegate = instance.Run }, x };\n            }).ToArray();\n\n            system.subSystemList[i].subSystemList = loop;\n        }\n\n        PlayerLoop.SetPlayerLoop(system);\n    }\n\n    interface ILoopRunner\n    {\n        void Run();\n    }\n\n    class WrapLoop<T> : ILoopRunner\n    {\n        readonly Type type;\n\n        public WrapLoop(Type type)\n        {\n            this.type = type;\n        }\n\n        public void Run()\n        {\n            CurrentLoopType = type;\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Scenes/SandboxMain.cs.meta",
    "content": "fileFormatVersion: 2\nguid: f0bc6c75abb2e0b47a25aa49bfd488ed\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Scenes/SandboxMain.unity",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!29 &1\nOcclusionCullingSettings:\n  m_ObjectHideFlags: 0\n  serializedVersion: 2\n  m_OcclusionBakeSettings:\n    smallestOccluder: 5\n    smallestHole: 0.25\n    backfaceThreshold: 100\n  m_SceneGUID: 00000000000000000000000000000000\n  m_OcclusionCullingData: {fileID: 0}\n--- !u!104 &2\nRenderSettings:\n  m_ObjectHideFlags: 0\n  serializedVersion: 10\n  m_Fog: 0\n  m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}\n  m_FogMode: 3\n  m_FogDensity: 0.01\n  m_LinearFogStart: 0\n  m_LinearFogEnd: 300\n  m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}\n  m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}\n  m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}\n  m_AmbientIntensity: 1\n  m_AmbientMode: 3\n  m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}\n  m_SkyboxMaterial: {fileID: 0}\n  m_HaloStrength: 0.5\n  m_FlareStrength: 1\n  m_FlareFadeSpeed: 3\n  m_HaloTexture: {fileID: 0}\n  m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}\n  m_DefaultReflectionMode: 0\n  m_DefaultReflectionResolution: 128\n  m_ReflectionBounces: 1\n  m_ReflectionIntensity: 1\n  m_CustomReflection: {fileID: 0}\n  m_Sun: {fileID: 0}\n  m_UseRadianceAmbientProbe: 0\n--- !u!157 &3\nLightmapSettings:\n  m_ObjectHideFlags: 0\n  serializedVersion: 12\n  m_GISettings:\n    serializedVersion: 2\n    m_BounceScale: 1\n    m_IndirectOutputScale: 1\n    m_AlbedoBoost: 1\n    m_EnvironmentLightingMode: 0\n    m_EnableBakedLightmaps: 0\n    m_EnableRealtimeLightmaps: 0\n  m_LightmapEditorSettings:\n    serializedVersion: 12\n    m_Resolution: 2\n    m_BakeResolution: 40\n    m_AtlasSize: 1024\n    m_AO: 0\n    m_AOMaxDistance: 1\n    m_CompAOExponent: 1\n    m_CompAOExponentDirect: 0\n    m_ExtractAmbientOcclusion: 0\n    m_Padding: 2\n    m_LightmapParameters: {fileID: 0}\n    m_LightmapsBakeMode: 1\n    m_TextureCompression: 1\n    m_ReflectionCompression: 2\n    m_MixedBakeMode: 2\n    m_BakeBackend: 0\n    m_PVRSampling: 1\n    m_PVRDirectSampleCount: 32\n    m_PVRSampleCount: 500\n    m_PVRBounces: 2\n    m_PVREnvironmentSampleCount: 500\n    m_PVREnvironmentReferencePointCount: 2048\n    m_PVRFilteringMode: 2\n    m_PVRDenoiserTypeDirect: 0\n    m_PVRDenoiserTypeIndirect: 0\n    m_PVRDenoiserTypeAO: 0\n    m_PVRFilterTypeDirect: 0\n    m_PVRFilterTypeIndirect: 0\n    m_PVRFilterTypeAO: 0\n    m_PVREnvironmentMIS: 0\n    m_PVRCulling: 1\n    m_PVRFilteringGaussRadiusDirect: 1\n    m_PVRFilteringGaussRadiusIndirect: 5\n    m_PVRFilteringGaussRadiusAO: 2\n    m_PVRFilteringAtrousPositionSigmaDirect: 0.5\n    m_PVRFilteringAtrousPositionSigmaIndirect: 2\n    m_PVRFilteringAtrousPositionSigmaAO: 1\n    m_ExportTrainingData: 0\n    m_TrainingDataDestination: TrainingData\n    m_LightProbeSampleCountMultiplier: 4\n  m_LightingDataAsset: {fileID: 0}\n  m_LightingSettings: {fileID: 4890085278179872738, guid: 814185d368762ed45a2298d112780689,\n    type: 2}\n--- !u!196 &4\nNavMeshSettings:\n  serializedVersion: 2\n  m_ObjectHideFlags: 0\n  m_BuildSettings:\n    serializedVersion: 3\n    agentTypeID: 0\n    agentRadius: 0.5\n    agentHeight: 2\n    agentSlope: 45\n    agentClimb: 0.4\n    ledgeDropHeight: 0\n    maxJumpAcrossDistance: 0\n    minRegionArea: 2\n    manualCellSize: 0\n    cellSize: 0.16666667\n    manualTileSize: 0\n    tileSize: 256\n    buildHeightMesh: 0\n    maxJobWorkers: 0\n    preserveTilesOutsideBounds: 0\n    debug:\n      m_Flags: 0\n  m_NavMeshData: {fileID: 0}\n--- !u!1 &16537670\nGameObject:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  serializedVersion: 6\n  m_Component:\n  - component: {fileID: 16537671}\n  - component: {fileID: 16537674}\n  - component: {fileID: 16537673}\n  - component: {fileID: 16537672}\n  m_Layer: 0\n  m_Name: StartButton\n  m_TagString: Untagged\n  m_Icon: {fileID: 0}\n  m_NavMeshLayer: 0\n  m_StaticEditorFlags: 0\n  m_IsActive: 1\n--- !u!224 &16537671\nRectTransform:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 16537670}\n  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}\n  m_LocalPosition: {x: 0, y: 0, z: 0}\n  m_LocalScale: {x: 1, y: 1, z: 1}\n  m_ConstrainProportionsScale: 0\n  m_Children:\n  - {fileID: 1584557232}\n  m_Father: {fileID: 1556045508}\n  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}\n  m_AnchorMin: {x: 0.5, y: 0.5}\n  m_AnchorMax: {x: 0.5, y: 0.5}\n  m_AnchoredPosition: {x: -7, y: 226}\n  m_SizeDelta: {x: 160, y: 30}\n  m_Pivot: {x: 0.5, y: 0.5}\n--- !u!114 &16537672\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 16537670}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_Navigation:\n    m_Mode: 3\n    m_WrapAround: 0\n    m_SelectOnUp: {fileID: 0}\n    m_SelectOnDown: {fileID: 0}\n    m_SelectOnLeft: {fileID: 0}\n    m_SelectOnRight: {fileID: 0}\n  m_Transition: 1\n  m_Colors:\n    m_NormalColor: {r: 1, g: 1, b: 1, a: 1}\n    m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}\n    m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}\n    m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}\n    m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}\n    m_ColorMultiplier: 1\n    m_FadeDuration: 0.1\n  m_SpriteState:\n    m_HighlightedSprite: {fileID: 0}\n    m_PressedSprite: {fileID: 0}\n    m_SelectedSprite: {fileID: 0}\n    m_DisabledSprite: {fileID: 0}\n  m_AnimationTriggers:\n    m_NormalTrigger: Normal\n    m_HighlightedTrigger: Highlighted\n    m_PressedTrigger: Pressed\n    m_SelectedTrigger: Selected\n    m_DisabledTrigger: Disabled\n  m_Interactable: 1\n  m_TargetGraphic: {fileID: 16537673}\n  m_OnClick:\n    m_PersistentCalls:\n      m_Calls: []\n--- !u!114 &16537673\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 16537670}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_Material: {fileID: 0}\n  m_Color: {r: 1, g: 1, b: 1, a: 1}\n  m_RaycastTarget: 1\n  m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}\n  m_Maskable: 1\n  m_OnCullStateChanged:\n    m_PersistentCalls:\n      m_Calls: []\n  m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}\n  m_Type: 1\n  m_PreserveAspect: 0\n  m_FillCenter: 1\n  m_FillMethod: 4\n  m_FillAmount: 1\n  m_FillClockwise: 1\n  m_FillOrigin: 0\n  m_UseSpriteMesh: 0\n  m_PixelsPerUnitMultiplier: 1\n--- !u!222 &16537674\nCanvasRenderer:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 16537670}\n  m_CullTransparentMesh: 0\n--- !u!1 &518730348\nGameObject:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  serializedVersion: 6\n  m_Component:\n  - component: {fileID: 518730350}\n  - component: {fileID: 518730349}\n  m_Layer: 0\n  m_Name: Camera\n  m_TagString: Untagged\n  m_Icon: {fileID: 0}\n  m_NavMeshLayer: 0\n  m_StaticEditorFlags: 0\n  m_IsActive: 1\n--- !u!20 &518730349\nCamera:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 518730348}\n  m_Enabled: 1\n  serializedVersion: 2\n  m_ClearFlags: 1\n  m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}\n  m_projectionMatrixMode: 1\n  m_GateFitMode: 2\n  m_FOVAxisMode: 0\n  m_Iso: 200\n  m_ShutterSpeed: 0.005\n  m_Aperture: 16\n  m_FocusDistance: 10\n  m_FocalLength: 50\n  m_BladeCount: 5\n  m_Curvature: {x: 2, y: 11}\n  m_BarrelClipping: 0.25\n  m_Anamorphism: 0\n  m_SensorSize: {x: 36, y: 24}\n  m_LensShift: {x: 0, y: 0}\n  m_NormalizedViewPortRect:\n    serializedVersion: 2\n    x: 0\n    y: 0\n    width: 1\n    height: 1\n  near clip plane: 0.3\n  far clip plane: 1000\n  field of view: 60\n  orthographic: 0\n  orthographic size: 5\n  m_Depth: 0\n  m_CullingMask:\n    serializedVersion: 2\n    m_Bits: 4294967295\n  m_RenderingPath: -1\n  m_TargetTexture: {fileID: 0}\n  m_TargetDisplay: 0\n  m_TargetEye: 3\n  m_HDR: 1\n  m_AllowMSAA: 1\n  m_AllowDynamicResolution: 0\n  m_ForceIntoRT: 0\n  m_OcclusionCulling: 1\n  m_StereoConvergence: 10\n  m_StereoSeparation: 0.022\n--- !u!4 &518730350\nTransform:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 518730348}\n  serializedVersion: 2\n  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}\n  m_LocalPosition: {x: 488, y: 418, z: 0}\n  m_LocalScale: {x: 1, y: 1, z: 1}\n  m_ConstrainProportionsScale: 0\n  m_Children: []\n  m_Father: {fileID: 0}\n  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}\n--- !u!1 &519420028\nGameObject:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  serializedVersion: 6\n  m_Component:\n  - component: {fileID: 519420032}\n  - component: {fileID: 519420031}\n  - component: {fileID: 519420029}\n  - component: {fileID: 519420030}\n  m_Layer: 0\n  m_Name: Main Camera\n  m_TagString: MainCamera\n  m_Icon: {fileID: 0}\n  m_NavMeshLayer: 0\n  m_StaticEditorFlags: 0\n  m_IsActive: 1\n--- !u!81 &519420029\nAudioListener:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 519420028}\n  m_Enabled: 1\n--- !u!114 &519420030\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 519420028}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: f0bc6c75abb2e0b47a25aa49bfd488ed, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  mycamera: {fileID: 0}\n  okButton: {fileID: 16537672}\n  cancelButton: {fileID: 628393011}\n  RP1:\n    latestValue: 0\n  text: {fileID: 2101290655}\n  button: {fileID: 0}\n--- !u!20 &519420031\nCamera:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 519420028}\n  m_Enabled: 1\n  serializedVersion: 2\n  m_ClearFlags: 2\n  m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}\n  m_projectionMatrixMode: 1\n  m_GateFitMode: 2\n  m_FOVAxisMode: 0\n  m_Iso: 200\n  m_ShutterSpeed: 0.005\n  m_Aperture: 16\n  m_FocusDistance: 10\n  m_FocalLength: 50\n  m_BladeCount: 5\n  m_Curvature: {x: 2, y: 11}\n  m_BarrelClipping: 0.25\n  m_Anamorphism: 0\n  m_SensorSize: {x: 36, y: 24}\n  m_LensShift: {x: 0, y: 0}\n  m_NormalizedViewPortRect:\n    serializedVersion: 2\n    x: 0\n    y: 0\n    width: 1\n    height: 1\n  near clip plane: 0.3\n  far clip plane: 1000\n  field of view: 60\n  orthographic: 1\n  orthographic size: 5\n  m_Depth: -1\n  m_CullingMask:\n    serializedVersion: 2\n    m_Bits: 4294967295\n  m_RenderingPath: -1\n  m_TargetTexture: {fileID: 0}\n  m_TargetDisplay: 0\n  m_TargetEye: 0\n  m_HDR: 1\n  m_AllowMSAA: 0\n  m_AllowDynamicResolution: 0\n  m_ForceIntoRT: 0\n  m_OcclusionCulling: 0\n  m_StereoConvergence: 10\n  m_StereoSeparation: 0.022\n--- !u!4 &519420032\nTransform:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 519420028}\n  serializedVersion: 2\n  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}\n  m_LocalPosition: {x: 0, y: 0, z: -10}\n  m_LocalScale: {x: 1, y: 1, z: 1}\n  m_ConstrainProportionsScale: 0\n  m_Children: []\n  m_Father: {fileID: 0}\n  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}\n--- !u!1 &628393009\nGameObject:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  serializedVersion: 6\n  m_Component:\n  - component: {fileID: 628393010}\n  - component: {fileID: 628393013}\n  - component: {fileID: 628393012}\n  - component: {fileID: 628393011}\n  m_Layer: 0\n  m_Name: CancelButton\n  m_TagString: Untagged\n  m_Icon: {fileID: 0}\n  m_NavMeshLayer: 0\n  m_StaticEditorFlags: 0\n  m_IsActive: 1\n--- !u!224 &628393010\nRectTransform:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 628393009}\n  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}\n  m_LocalPosition: {x: 0, y: 0, z: 0}\n  m_LocalScale: {x: 1, y: 1, z: 1}\n  m_ConstrainProportionsScale: 0\n  m_Children:\n  - {fileID: 865871445}\n  m_Father: {fileID: 1556045508}\n  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}\n  m_AnchorMin: {x: 0.5, y: 0.5}\n  m_AnchorMax: {x: 0.5, y: 0.5}\n  m_AnchoredPosition: {x: -4.9, y: 179}\n  m_SizeDelta: {x: 160, y: 30}\n  m_Pivot: {x: 0.5, y: 0.5}\n--- !u!114 &628393011\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 628393009}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_Navigation:\n    m_Mode: 3\n    m_WrapAround: 0\n    m_SelectOnUp: {fileID: 0}\n    m_SelectOnDown: {fileID: 0}\n    m_SelectOnLeft: {fileID: 0}\n    m_SelectOnRight: {fileID: 0}\n  m_Transition: 1\n  m_Colors:\n    m_NormalColor: {r: 1, g: 1, b: 1, a: 1}\n    m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}\n    m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}\n    m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}\n    m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}\n    m_ColorMultiplier: 1\n    m_FadeDuration: 0.1\n  m_SpriteState:\n    m_HighlightedSprite: {fileID: 0}\n    m_PressedSprite: {fileID: 0}\n    m_SelectedSprite: {fileID: 0}\n    m_DisabledSprite: {fileID: 0}\n  m_AnimationTriggers:\n    m_NormalTrigger: Normal\n    m_HighlightedTrigger: Highlighted\n    m_PressedTrigger: Pressed\n    m_SelectedTrigger: Selected\n    m_DisabledTrigger: Disabled\n  m_Interactable: 1\n  m_TargetGraphic: {fileID: 628393012}\n  m_OnClick:\n    m_PersistentCalls:\n      m_Calls: []\n--- !u!114 &628393012\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 628393009}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_Material: {fileID: 0}\n  m_Color: {r: 1, g: 1, b: 1, a: 1}\n  m_RaycastTarget: 1\n  m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}\n  m_Maskable: 1\n  m_OnCullStateChanged:\n    m_PersistentCalls:\n      m_Calls: []\n  m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}\n  m_Type: 1\n  m_PreserveAspect: 0\n  m_FillCenter: 1\n  m_FillMethod: 4\n  m_FillAmount: 1\n  m_FillClockwise: 1\n  m_FillOrigin: 0\n  m_UseSpriteMesh: 0\n  m_PixelsPerUnitMultiplier: 1\n--- !u!222 &628393013\nCanvasRenderer:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 628393009}\n  m_CullTransparentMesh: 0\n--- !u!1 &865871444\nGameObject:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  serializedVersion: 6\n  m_Component:\n  - component: {fileID: 865871445}\n  - component: {fileID: 865871447}\n  - component: {fileID: 865871446}\n  m_Layer: 0\n  m_Name: Text\n  m_TagString: Untagged\n  m_Icon: {fileID: 0}\n  m_NavMeshLayer: 0\n  m_StaticEditorFlags: 0\n  m_IsActive: 1\n--- !u!224 &865871445\nRectTransform:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 865871444}\n  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}\n  m_LocalPosition: {x: 0, y: 0, z: 0}\n  m_LocalScale: {x: 1, y: 1, z: 1}\n  m_ConstrainProportionsScale: 0\n  m_Children: []\n  m_Father: {fileID: 628393010}\n  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}\n  m_AnchorMin: {x: 0, y: 0}\n  m_AnchorMax: {x: 1, y: 1}\n  m_AnchoredPosition: {x: 0, y: 0}\n  m_SizeDelta: {x: 0, y: 0}\n  m_Pivot: {x: 0.5, y: 0.5}\n--- !u!114 &865871446\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 865871444}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_Material: {fileID: 0}\n  m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}\n  m_RaycastTarget: 1\n  m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}\n  m_Maskable: 1\n  m_OnCullStateChanged:\n    m_PersistentCalls:\n      m_Calls: []\n  m_FontData:\n    m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}\n    m_FontSize: 14\n    m_FontStyle: 0\n    m_BestFit: 0\n    m_MinSize: 10\n    m_MaxSize: 40\n    m_Alignment: 4\n    m_AlignByGeometry: 0\n    m_RichText: 1\n    m_HorizontalOverflow: 0\n    m_VerticalOverflow: 0\n    m_LineSpacing: 1\n  m_Text: Cancel\n--- !u!222 &865871447\nCanvasRenderer:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 865871444}\n  m_CullTransparentMesh: 0\n--- !u!1 &872009839\nGameObject:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  serializedVersion: 6\n  m_Component:\n  - component: {fileID: 872009842}\n  - component: {fileID: 872009841}\n  - component: {fileID: 872009840}\n  m_Layer: 0\n  m_Name: EventSystem\n  m_TagString: Untagged\n  m_Icon: {fileID: 0}\n  m_NavMeshLayer: 0\n  m_StaticEditorFlags: 0\n  m_IsActive: 1\n--- !u!114 &872009840\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 872009839}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_SendPointerHoverToParent: 1\n  m_HorizontalAxis: Horizontal\n  m_VerticalAxis: Vertical\n  m_SubmitButton: Submit\n  m_CancelButton: Cancel\n  m_InputActionsPerSecond: 10\n  m_RepeatDelay: 0.5\n  m_ForceModuleActive: 0\n--- !u!114 &872009841\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 872009839}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_FirstSelected: {fileID: 0}\n  m_sendNavigationEvents: 1\n  m_DragThreshold: 10\n--- !u!4 &872009842\nTransform:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 872009839}\n  serializedVersion: 2\n  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}\n  m_LocalPosition: {x: 0, y: 0, z: 0}\n  m_LocalScale: {x: 1, y: 1, z: 1}\n  m_ConstrainProportionsScale: 0\n  m_Children: []\n  m_Father: {fileID: 0}\n  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}\n--- !u!1 &1556045504\nGameObject:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  serializedVersion: 6\n  m_Component:\n  - component: {fileID: 1556045508}\n  - component: {fileID: 1556045507}\n  - component: {fileID: 1556045506}\n  - component: {fileID: 1556045505}\n  m_Layer: 0\n  m_Name: Canvas\n  m_TagString: Untagged\n  m_Icon: {fileID: 0}\n  m_NavMeshLayer: 0\n  m_StaticEditorFlags: 0\n  m_IsActive: 1\n--- !u!114 &1556045505\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 1556045504}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_IgnoreReversedGraphics: 1\n  m_BlockingObjects: 0\n  m_BlockingMask:\n    serializedVersion: 2\n    m_Bits: 4294967295\n--- !u!114 &1556045506\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 1556045504}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_UiScaleMode: 0\n  m_ReferencePixelsPerUnit: 100\n  m_ScaleFactor: 1\n  m_ReferenceResolution: {x: 800, y: 600}\n  m_ScreenMatchMode: 0\n  m_MatchWidthOrHeight: 0\n  m_PhysicalUnit: 3\n  m_FallbackScreenDPI: 96\n  m_DefaultSpriteDPI: 96\n  m_DynamicPixelsPerUnit: 1\n  m_PresetInfoIsWorld: 0\n--- !u!223 &1556045507\nCanvas:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 1556045504}\n  m_Enabled: 1\n  serializedVersion: 3\n  m_RenderMode: 0\n  m_Camera: {fileID: 0}\n  m_PlaneDistance: 100\n  m_PixelPerfect: 0\n  m_ReceivesEvents: 1\n  m_OverrideSorting: 0\n  m_OverridePixelPerfect: 0\n  m_SortingBucketNormalizedSize: 0\n  m_VertexColorAlwaysGammaSpace: 0\n  m_AdditionalShaderChannelsFlag: 0\n  m_UpdateRectTransformForStandalone: 0\n  m_SortingLayerID: 0\n  m_SortingOrder: 0\n  m_TargetDisplay: 0\n--- !u!224 &1556045508\nRectTransform:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 1556045504}\n  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}\n  m_LocalPosition: {x: 0, y: 0, z: 0}\n  m_LocalScale: {x: 0, y: 0, z: 0}\n  m_ConstrainProportionsScale: 0\n  m_Children:\n  - {fileID: 16537671}\n  - {fileID: 628393010}\n  - {fileID: 2101290654}\n  m_Father: {fileID: 0}\n  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}\n  m_AnchorMin: {x: 0, y: 0}\n  m_AnchorMax: {x: 0, y: 0}\n  m_AnchoredPosition: {x: 0, y: 0}\n  m_SizeDelta: {x: 0, y: 0}\n  m_Pivot: {x: 0, y: 0}\n--- !u!1 &1584557231\nGameObject:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  serializedVersion: 6\n  m_Component:\n  - component: {fileID: 1584557232}\n  - component: {fileID: 1584557234}\n  - component: {fileID: 1584557233}\n  m_Layer: 0\n  m_Name: Text\n  m_TagString: Untagged\n  m_Icon: {fileID: 0}\n  m_NavMeshLayer: 0\n  m_StaticEditorFlags: 0\n  m_IsActive: 1\n--- !u!224 &1584557232\nRectTransform:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 1584557231}\n  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}\n  m_LocalPosition: {x: 0, y: 0, z: 0}\n  m_LocalScale: {x: 1, y: 1, z: 1}\n  m_ConstrainProportionsScale: 0\n  m_Children: []\n  m_Father: {fileID: 16537671}\n  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}\n  m_AnchorMin: {x: 0, y: 0}\n  m_AnchorMax: {x: 1, y: 1}\n  m_AnchoredPosition: {x: 0, y: 0}\n  m_SizeDelta: {x: 0, y: 0}\n  m_Pivot: {x: 0.5, y: 0.5}\n--- !u!114 &1584557233\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 1584557231}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_Material: {fileID: 0}\n  m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}\n  m_RaycastTarget: 1\n  m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}\n  m_Maskable: 1\n  m_OnCullStateChanged:\n    m_PersistentCalls:\n      m_Calls: []\n  m_FontData:\n    m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}\n    m_FontSize: 14\n    m_FontStyle: 0\n    m_BestFit: 0\n    m_MinSize: 10\n    m_MaxSize: 40\n    m_Alignment: 4\n    m_AlignByGeometry: 0\n    m_RichText: 1\n    m_HorizontalOverflow: 0\n    m_VerticalOverflow: 0\n    m_LineSpacing: 1\n  m_Text: 'Start\n\n'\n--- !u!222 &1584557234\nCanvasRenderer:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 1584557231}\n  m_CullTransparentMesh: 0\n--- !u!1 &2101290653\nGameObject:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  serializedVersion: 6\n  m_Component:\n  - component: {fileID: 2101290654}\n  - component: {fileID: 2101290656}\n  - component: {fileID: 2101290655}\n  m_Layer: 0\n  m_Name: Text\n  m_TagString: Untagged\n  m_Icon: {fileID: 0}\n  m_NavMeshLayer: 0\n  m_StaticEditorFlags: 0\n  m_IsActive: 1\n--- !u!224 &2101290654\nRectTransform:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 2101290653}\n  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}\n  m_LocalPosition: {x: 0, y: 0, z: 0}\n  m_LocalScale: {x: 1, y: 1, z: 1}\n  m_ConstrainProportionsScale: 0\n  m_Children: []\n  m_Father: {fileID: 1556045508}\n  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}\n  m_AnchorMin: {x: 0.5, y: 0.5}\n  m_AnchorMax: {x: 0.5, y: 0.5}\n  m_AnchoredPosition: {x: 1.5, y: -61.4}\n  m_SizeDelta: {x: 588.7, y: 398.7}\n  m_Pivot: {x: 0.5, y: 0.5}\n--- !u!114 &2101290655\nMonoBehaviour:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 2101290653}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_Material: {fileID: 0}\n  m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}\n  m_RaycastTarget: 1\n  m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}\n  m_Maskable: 1\n  m_OnCullStateChanged:\n    m_PersistentCalls:\n      m_Calls: []\n  m_FontData:\n    m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}\n    m_FontSize: 14\n    m_FontStyle: 0\n    m_BestFit: 0\n    m_MinSize: 10\n    m_MaxSize: 40\n    m_Alignment: 0\n    m_AlignByGeometry: 0\n    m_RichText: 1\n    m_HorizontalOverflow: 0\n    m_VerticalOverflow: 0\n    m_LineSpacing: 1\n  m_Text: New Text\n--- !u!222 &2101290656\nCanvasRenderer:\n  m_ObjectHideFlags: 0\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 2101290653}\n  m_CullTransparentMesh: 0\n--- !u!1660057539 &9223372036854775807\nSceneRoots:\n  m_ObjectHideFlags: 0\n  m_Roots:\n  - {fileID: 519420032}\n  - {fileID: 518730350}\n  - {fileID: 872009842}\n  - {fileID: 1556045508}\n"
  },
  {
    "path": "src/UniTask/Assets/Scenes/SandboxMain.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 2cda990e2423bbf4892e6590ba056729\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Scenes/WaitWhileTest.cs",
    "content": "using Cysharp.Threading.Tasks;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Threading;\nusing UnityEngine;\n\n// https://github.com/Cysharp/UniTask/issues/617\n\npublic class WaitWhileTest : MonoBehaviour\n{\n    private const float c_CallInterval = 0.3f;\n    private float m_JustBeforeCallTime;\n\n    private TaskObj m_TestObj;\n\n    // Start is called before the first frame update\n    void Start()\n    {\n        m_JustBeforeCallTime = Time.unscaledTime;\n        m_TestObj = new TaskObj();\n        // m_TestObj.Test(CancellationToken.None).Forget();\n    }\n\n    // Update is called once per frame\n    void Update()\n    {\n        if (Time.unscaledTime - m_JustBeforeCallTime > c_CallInterval)\n        {\n            m_JustBeforeCallTime = Time.unscaledTime;\n            m_TestObj.Test(CancellationToken.None).Forget();\n        }\n    }\n}\n\n\npublic class TaskObj\n{\n    private CancellationTokenSource m_CancelTokenSource;\n    private const float c_FinishElapsedTime = 0.1f;\n    private float m_StartTime;\n    public async UniTask Test(CancellationToken token)\n    {\n        try\n        {\n            CancelAndDisposeTokenSource();\n            m_CancelTokenSource = CancellationTokenSource.CreateLinkedTokenSource(token);\n            m_StartTime = Time.unscaledTime;\n            await UniTask.WaitWhile(IsContinued, cancellationToken: m_CancelTokenSource.Token, cancelImmediately: true);\n            Debug.Log(\"Task Finished\");\n        }\n        catch (OperationCanceledException)\n        {\n            Debug.LogWarning(\"Task Canceled\");\n        }\n        finally\n        {\n            CancelAndDisposeTokenSource();\n        }\n    }\n\n    private void CancelAndDisposeTokenSource()\n    {\n        m_CancelTokenSource?.Cancel();\n        m_CancelTokenSource?.Dispose();\n        m_CancelTokenSource = null;\n    }\n\n    private bool IsContinued()\n    {\n        return Time.unscaledTime - m_StartTime > c_FinishElapsedTime;\n    }\n}\n\n"
  },
  {
    "path": "src/UniTask/Assets/Scenes/WaitWhileTest.cs.meta",
    "content": "fileFormatVersion: 2\nguid: a478e5f6126dc184ca902adfb35401b4\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Scenes.meta",
    "content": "fileFormatVersion: 2\nguid: 3e4672a57ce755a44805bc58b4ddea29\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/StreamingAssets/test.txt",
    "content": "﻿MyTEST"
  },
  {
    "path": "src/UniTask/Assets/StreamingAssets/test.txt.meta",
    "content": "fileFormatVersion: 2\nguid: 7fc83f79aef22a2449d5e9ca4964b2e0\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/StreamingAssets.meta",
    "content": "fileFormatVersion: 2\nguid: 7bb6ff9f1f0d0cd4da5ba7623f10dd6b\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/TempAsm/FooMonoBehaviour.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\nusing UnityEngine.Networking;\n\npublic class FooMonoBehaviour : MonoBehaviour\n{\n    // Start is called before the first frame update\n    void Start()\n    {\n\n    }\n\n    //private async UniTask Download(UnityWebRequest req, string filePath)\n    //{\n    //    _ = req.SendWebRequest();\n\n\n\n\n    //    // var aaa = await foo;\n    //    // Debug.Log(aaa);\n    //    await UniTask.Yield();\n    //    //File.WriteAllText(filePath, req.downloadHandler.text ?? string.Empty);\n    //}\n}\n"
  },
  {
    "path": "src/UniTask/Assets/TempAsm/FooMonoBehaviour.cs.meta",
    "content": "fileFormatVersion: 2\nguid: de703bd72a8720b47b7c3d993786aaae\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/TempAsm/TempAsm.asmdef",
    "content": "{\n    \"name\": \"TempAsm\",\n    \"references\": [\n        \"UniTask\",\n        \"\"\n    ],\n    \"includePlatforms\": [],\n    \"excludePlatforms\": [],\n    \"allowUnsafeCode\": false,\n    \"overrideReferences\": false,\n    \"precompiledReferences\": [],\n    \"autoReferenced\": true,\n    \"defineConstraints\": [],\n    \"versionDefines\": [],\n    \"noEngineReferences\": false\n}"
  },
  {
    "path": "src/UniTask/Assets/TempAsm/TempAsm.asmdef.meta",
    "content": "fileFormatVersion: 2\nguid: d076e9cb44bf59e41ab73add08e510cf\nAssemblyDefinitionImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/TempAsm.meta",
    "content": "fileFormatVersion: 2\nguid: 56fb2352cb532934f82d1590ce377e5c\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/AsyncOperationTest.cs",
    "content": "using System.Collections;\nusing System.Threading;\nusing Cysharp.Threading.Tasks;\nusing FluentAssertions;\nusing NUnit.Framework;\nusing UnityEngine;\nusing UnityEngine.Networking;\nusing UnityEngine.TestTools;\n\n#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nnamespace Cysharp.Threading.TasksTests\n{\n    public class AsyncOperationTest\n    {\n        [UnityTest]\n        public IEnumerator ResourcesLoad_Completed() => UniTask.ToCoroutine(async () =>\n        {\n            var asyncOperation = Resources.LoadAsync<Texture2D>(\"sample_texture\");\n            await asyncOperation.ToUniTask();\n            asyncOperation.isDone.Should().BeTrue();\n            asyncOperation.asset.GetType().Should().Be(typeof(Texture2D));\n        });\n        \n        [UnityTest]\n        public IEnumerator ResourcesLoad_CancelOnPlayerLoop() => UniTask.ToCoroutine(async () =>\n        {\n            var cts = new CancellationTokenSource();\n            var task = Resources.LoadAsync<Texture>(\"sample_texture\").ToUniTask(cancellationToken: cts.Token, cancelImmediately: false);\n            \n            cts.Cancel();\n            task.Status.Should().Be(UniTaskStatus.Pending);\n\n            await UniTask.NextFrame();\n            task.Status.Should().Be(UniTaskStatus.Canceled);\n        });\n        \n        [Test]\n        public void ResourcesLoad_CancelImmediately()\n        {\n            {\n                var cts = new CancellationTokenSource();\n                var task = Resources.LoadAsync<Texture>(\"sample_texture\").ToUniTask(cancellationToken: cts.Token, cancelImmediately: true);\n\n                cts.Cancel();\n                task.Status.Should().Be(UniTaskStatus.Canceled);\n            }\n        }\n\n#if ENABLE_UNITYWEBREQUEST && (!UNITY_2019_1_OR_NEWER || UNITASK_WEBREQUEST_SUPPORT)\n        [UnityTest]\n        public IEnumerator UnityWebRequest_Completed() => UniTask.ToCoroutine(async () =>\n        {\n            var filePath = System.IO.Path.Combine(Application.dataPath, \"Tests\", \"Resources\", \"sample_texture.png\");\n            var asyncOperation = UnityWebRequest.Get($\"file://{filePath}\").SendWebRequest();\n            await asyncOperation.ToUniTask();\n\n            asyncOperation.isDone.Should().BeTrue();\n            asyncOperation.webRequest.result.Should().Be(UnityWebRequest.Result.Success);\n        });\n        \n        [UnityTest]\n        public IEnumerator UnityWebRequest_CancelOnPlayerLoop() => UniTask.ToCoroutine(async () =>\n        {\n            var cts = new CancellationTokenSource();\n            var filePath = System.IO.Path.Combine(Application.dataPath, \"Tests\", \"Resources\", \"sample_texture.png\");\n            var task = UnityWebRequest.Get($\"file://{filePath}\").SendWebRequest().ToUniTask(cancellationToken: cts.Token);\n            \n            cts.Cancel();\n            task.Status.Should().Be(UniTaskStatus.Pending);\n            \n            await UniTask.NextFrame();\n            task.Status.Should().Be(UniTaskStatus.Canceled);\n        });\n        \n        [Test]\n        public void UnityWebRequest_CancelImmediately()\n        {\n            var cts = new CancellationTokenSource();\n            cts.Cancel();\n            var filePath = System.IO.Path.Combine(Application.dataPath, \"Tests\", \"Resources\", \"sample_texture.png\");\n            var task = UnityWebRequest.Get($\"file://{filePath}\").SendWebRequest().ToUniTask(cancellationToken: cts.Token, cancelImmediately: true);\n            \n            task.Status.Should().Be(UniTaskStatus.Canceled);\n        }\n#endif\n    }\n}\n#endif\n"
  },
  {
    "path": "src/UniTask/Assets/Tests/AsyncOperationTest.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 295d574a16494d6aa4d02fcb32179e39\ntimeCreated: 1698887128"
  },
  {
    "path": "src/UniTask/Assets/Tests/AsyncTest.cs",
    "content": "﻿#if !(UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2)\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing UnityEngine;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing UnityEngine.UI;\nusing UnityEngine.Scripting;\nusing Cysharp.Threading.Tasks;\nusing UnityEngine.SceneManagement;\n#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))\nusing System.Threading.Tasks;\n#endif\nusing UnityEngine.Networking;\n\n#if !UNITY_2019_3_OR_NEWER\nusing UnityEngine.Experimental.LowLevel;\n#else\nusing UnityEngine.LowLevel;\n#endif\n\n#if !UNITY_WSA\nusing Unity.Jobs;\n#endif\nusing Unity.Collections;\nusing System.Threading;\nusing NUnit.Framework;\nusing UnityEngine.TestTools;\nusing FluentAssertions;\n\nnamespace Cysharp.Threading.TasksTests\n{\n    public class AsyncTest\n    {\n#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))\n#if !UNITY_WSA\n\n        public struct MyJob : IJob\n        {\n            public int loopCount;\n            public NativeArray<int> inOut;\n            public int result;\n\n            public void Execute()\n            {\n                result = 0;\n                for (int i = 0; i < loopCount; i++)\n                {\n                    result++;\n                }\n                inOut[0] = result;\n            }\n        }\n\n#if !UNITY_WEBGL\n\n        [UnityTest]\n        public IEnumerator DelayAnd() => UniTask.ToCoroutine(async () =>\n        {\n            await UniTask.Yield(PlayerLoopTiming.PostLateUpdate);\n\n            var time = Time.realtimeSinceStartup;\n\n            Time.timeScale = 0.5f;\n            try\n            {\n                await UniTask.Delay(TimeSpan.FromSeconds(3));\n\n                var elapsed = Time.realtimeSinceStartup - time;\n                ((int)Math.Round(TimeSpan.FromSeconds(elapsed).TotalSeconds, MidpointRounding.ToEven)).Should().Be(6);\n            }\n            finally\n            {\n                Time.timeScale = 1.0f;\n            }\n        });\n\n#endif\n\n        [UnityTest]\n        public IEnumerator DelayIgnore() => UniTask.ToCoroutine(async () =>\n        {\n            var time = Time.realtimeSinceStartup;\n\n            Time.timeScale = 0.5f;\n            try\n            {\n                await UniTask.Delay(TimeSpan.FromSeconds(3), ignoreTimeScale: true);\n\n                var elapsed = Time.realtimeSinceStartup - time;\n                ((int)Math.Round(TimeSpan.FromSeconds(elapsed).TotalSeconds, MidpointRounding.ToEven)).Should().Be(3);\n            }\n            finally\n            {\n                Time.timeScale = 1.0f;\n            }\n        });\n\n        [UnityTest]\n        public IEnumerator WhenAll() => UniTask.ToCoroutine(async () =>\n        {\n            var a = UniTask.FromResult(999);\n            var b = UniTask.Yield(PlayerLoopTiming.Update, CancellationToken.None).AsAsyncUnitUniTask();\n            var c = UniTask.DelayFrame(99).AsAsyncUnitUniTask();\n\n            var (a2, b2, c2) = await UniTask.WhenAll(a, b, c);\n            a2.Should().Be(999);\n            b2.Should().Be(AsyncUnit.Default);\n            c2.Should().Be(AsyncUnit.Default);\n        });\n\n        [UnityTest]\n        public IEnumerator WhenAny() => UniTask.ToCoroutine(async () =>\n        {\n            var a = UniTask.FromResult(999);\n            var b = UniTask.Yield(PlayerLoopTiming.Update, CancellationToken.None).AsAsyncUnitUniTask();\n            var c = UniTask.DelayFrame(99).AsAsyncUnitUniTask();\n\n            var (win, a2, b2, c2) = await UniTask.WhenAny(a, b, c);\n            win.Should().Be(0);\n            a2.Should().Be(999);\n        });\n\n        [UnityTest]\n        public IEnumerator BothEnumeratorCheck() => UniTask.ToCoroutine(async () =>\n        {\n            await ToaruCoroutineEnumerator(); // wait 5 frame:)\n        });\n\n        //[UnityTest]\n        //public IEnumerator JobSystem() => UniTask.ToCoroutine(async () =>\n        //{\n        //    var job = new MyJob() { loopCount = 999, inOut = new NativeArray<int>(1, Allocator.TempJob) };\n        //    JobHandle.ScheduleBatchedJobs();\n        //    await job.Schedule();\n        //    job.inOut[0].Should().Be(999);\n        //    job.inOut.Dispose();\n        //});\n\n        class MyMyClass\n        {\n            public int MyProperty { get; set; }\n        }\n\n        class MyBooleanClass\n        {\n            public bool MyProperty { get; set; }\n        }\n\n        [UnityTest]\n        public IEnumerator WaitUntil() => UniTask.ToCoroutine(async () =>\n        {\n            bool t = false;\n\n            UniTask.DelayFrame(10, PlayerLoopTiming.PostLateUpdate).ContinueWith(() => t = true).Forget();\n\n            var startFrame = Time.frameCount;\n            await UniTask.WaitUntil(() => t, PlayerLoopTiming.EarlyUpdate);\n\n            var diff = Time.frameCount - startFrame;\n            diff.Should().Be(11);\n        });\n\n        [UnityTest]\n        public IEnumerator WaitUntilWithState() => UniTask.ToCoroutine(async () =>\n        {\n            var v = new MyBooleanClass { MyProperty = false };\n\n            UniTask.DelayFrame(10, PlayerLoopTiming.PostLateUpdate).ContinueWith(() => v.MyProperty = true).Forget();\n\n            var startFrame = Time.frameCount;\n            await UniTask.WaitUntil(v, static v => v.MyProperty, PlayerLoopTiming.EarlyUpdate);\n\n            var diff = Time.frameCount - startFrame;\n            diff.Should().Be(11);\n        });\n\n        [UnityTest]\n        public IEnumerator WaitWhile() => UniTask.ToCoroutine(async () =>\n        {\n            bool t = true;\n\n            UniTask.DelayFrame(10, PlayerLoopTiming.PostLateUpdate).ContinueWith(() => t = false).Forget();\n\n            var startFrame = Time.frameCount;\n            await UniTask.WaitWhile(() => t, PlayerLoopTiming.EarlyUpdate);\n\n            var diff = Time.frameCount - startFrame;\n            diff.Should().Be(11);\n        });\n\n        [UnityTest]\n        public IEnumerator WaitWhileWithState() => UniTask.ToCoroutine(async () =>\n        {\n            var v = new MyBooleanClass { MyProperty = true };\n\n            UniTask.DelayFrame(10, PlayerLoopTiming.PostLateUpdate).ContinueWith(() => v.MyProperty = false).Forget();\n\n            var startFrame = Time.frameCount;\n            await UniTask.WaitWhile(v, static v => v.MyProperty, PlayerLoopTiming.EarlyUpdate);\n\n            var diff = Time.frameCount - startFrame;\n            diff.Should().Be(11);\n        });\n\n        [UnityTest]\n        public IEnumerator WaitUntilValueChanged() => UniTask.ToCoroutine(async () =>\n        {\n            var v = new MyMyClass { MyProperty = 99 };\n\n            UniTask.DelayFrame(10, PlayerLoopTiming.PostLateUpdate).ContinueWith(() => v.MyProperty = 1000).Forget();\n\n            var startFrame = Time.frameCount;\n            await UniTask.WaitUntilValueChanged(v, x => x.MyProperty, PlayerLoopTiming.EarlyUpdate);\n\n            var diff = Time.frameCount - startFrame;\n            diff.Should().Be(11);\n        });\n\n#if !UNITY_WEBGL\n\n        [UnityTest]\n        public IEnumerator SwitchTo() => UniTask.ToCoroutine(async () =>\n        {\n            await UniTask.Yield();\n\n            var currentThreadId = Thread.CurrentThread.ManagedThreadId;\n\n\n\n            await UniTask.SwitchToThreadPool();\n            //await UniTask.SwitchToThreadPool();\n            //await UniTask.SwitchToThreadPool();\n\n\n\n\n\n\n            var switchedThreadId = Thread.CurrentThread.ManagedThreadId;\n\n\n\n            currentThreadId.Should().NotBe(switchedThreadId);\n\n\n            await UniTask.Yield();\n\n            var switchedThreadId2 = Thread.CurrentThread.ManagedThreadId;\n\n            currentThreadId.Should().Be(switchedThreadId2);\n        });\n\n#endif\n\n        //[UnityTest]\n        //public IEnumerator ObservableConversion() => UniTask.ToCoroutine(async () =>\n        //{\n        //    var v = await Observable.Range(1, 10).ToUniTask();\n        //    v.Is(10);\n\n        //    v = await Observable.Range(1, 10).ToUniTask(useFirstValue: true);\n        //    v.Is(1);\n\n        //    v = await UniTask.DelayFrame(10).ToObservable().ToTask();\n        //    v.Is(10);\n\n        //    v = await UniTask.FromResult(99).ToObservable();\n        //    v.Is(99);\n        //});\n\n        //[UnityTest]\n        //public IEnumerator AwaitableReactiveProperty() => UniTask.ToCoroutine(async () =>\n        //{\n        //    var rp1 = new ReactiveProperty<int>(99);\n\n        //    UniTask.DelayFrame(100).ContinueWith(x => rp1.Value = x).Forget();\n\n        //    await rp1;\n\n        //    rp1.Value.Is(100);\n\n        //    // var delay2 = UniTask.DelayFrame(10);\n        //    // var (a, b ) = await UniTask.WhenAll(rp1.WaitUntilValueChangedAsync(), delay2);\n\n        //});\n\n        //[UnityTest]\n        //public IEnumerator AwaitableReactiveCommand() => UniTask.ToCoroutine(async () =>\n        //{\n        //    var rc = new ReactiveCommand<int>();\n\n        //    UniTask.DelayFrame(100).ContinueWith(x => rc.Execute(x)).Forget();\n\n        //    var v = await rc;\n\n        //    v.Is(100);\n        //});\n\n        [UnityTest]\n        public IEnumerator ExceptionlessCancellation() => UniTask.ToCoroutine(async () =>\n        {\n            var cts = new CancellationTokenSource();\n\n            UniTask.DelayFrame(10).ContinueWith(() => cts.Cancel()).Forget();\n\n            var first = Time.frameCount;\n            var canceled = await UniTask.DelayFrame(100, cancellationToken: cts.Token).SuppressCancellationThrow();\n\n            var r = (Time.frameCount - first);\n            (9 < r && r < 11).Should().BeTrue();\n            canceled.Should().Be(true);\n        });\n\n        [UnityTest]\n        public IEnumerator ExceptionCancellation() => UniTask.ToCoroutine(async () =>\n        {\n            var cts = new CancellationTokenSource();\n\n            UniTask.DelayFrame(10).ContinueWith(() => cts.Cancel()).Forget();\n\n            bool occur = false;\n            try\n            {\n                await UniTask.DelayFrame(100, cancellationToken: cts.Token);\n            }\n            catch (OperationCanceledException)\n            {\n                occur = true;\n            }\n            occur.Should().BeTrue();\n        });\n\n        IEnumerator ToaruCoroutineEnumerator()\n        {\n            yield return null;\n            yield return null;\n            yield return null;\n            yield return null;\n            yield return null;\n        }\n\n        //[UnityTest]\n        //public IEnumerator ExceptionUnobserved1() => UniTask.ToCoroutine(async () =>\n        //{\n        //    bool calledEx = false;\n        //    Action<Exception> action = exx =>\n        //    {\n        //        calledEx = true;\n        //        exx.Message.Should().Be(\"MyException\");\n        //    };\n\n        //    UniTaskScheduler.UnobservedTaskException += action;\n\n        //    var ex = InException1();\n        //    ex = default(UniTask);\n\n        //    await UniTask.DelayFrame(3);\n\n        //    GC.Collect();\n        //    GC.WaitForPendingFinalizers();\n        //    GC.Collect();\n\n        //    await UniTask.DelayFrame(1);\n\n        //    calledEx.Should().BeTrue();\n\n        //    UniTaskScheduler.UnobservedTaskException -= action;\n        //});\n\n        [UnityTest]\n        public IEnumerator ExceptionUnobserved2() => UniTask.ToCoroutine(async () =>\n        {\n            bool calledEx = false;\n            Action<Exception> action = exx =>\n            {\n                calledEx = true;\n                exx.Message.Should().Be(\"MyException\");\n            };\n\n            UniTaskScheduler.UnobservedTaskException += action;\n\n            var ex = InException2();\n            ex = default(UniTask<int>);\n\n            await UniTask.DelayFrame(3);\n\n            GC.Collect();\n            GC.WaitForPendingFinalizers();\n            GC.Collect();\n\n            await UniTask.DelayFrame(1);\n\n            calledEx.Should().BeTrue();\n\n            UniTaskScheduler.UnobservedTaskException -= action;\n        });\n\n        // can not run on RuntimeUnitTestToolkit so ignore...\n        //        [UnityTest]\n        //        public IEnumerator ThrowExceptionUnawaited() => UniTask.ToCoroutine(async () =>\n        //        {\n        //            LogAssert.Expect(LogType.Exception, \"Exception: MyException\");\n\n        //#pragma warning disable 1998\n        //            async UniTask Throw() => throw new Exception(\"MyException\");\n        //#pragma warning restore 1998\n\n        //#pragma warning disable 4014\n        //            Throw();\n        //#pragma warning restore 4014\n\n        //            await UniTask.DelayFrame(3);\n\n        //            GC.Collect();\n        //            GC.WaitForPendingFinalizers();\n        //            GC.Collect();\n\n        //            await UniTask.DelayFrame(1);\n        //        });\n\n        async UniTask InException1()\n        {\n            await UniTask.Yield();\n            throw new Exception(\"MyException\");\n        }\n\n        async UniTask<int> InException2()\n        {\n            await UniTask.Yield();\n            throw new Exception(\"MyException\");\n        }\n\n        [UnityTest]\n        public IEnumerator NextFrame1() => UniTask.ToCoroutine(async () =>\n        {\n            await UniTask.Yield(PlayerLoopTiming.LastUpdate);\n            var frame = Time.frameCount;\n            await UniTask.NextFrame();\n            Time.frameCount.Should().Be(frame + 1);\n        });\n\n        [UnityTest]\n        public IEnumerator NextFrame2() => UniTask.ToCoroutine(async () =>\n        {\n            await UniTask.Yield(PlayerLoopTiming.PreUpdate);\n            var frame = Time.frameCount;\n            await UniTask.NextFrame();\n            Time.frameCount.Should().Be(frame + 1);\n        });\n\n        [UnityTest]\n        public IEnumerator NestedEnumerator() => UniTask.ToCoroutine(async () =>\n        {\n            var time = Time.realtimeSinceStartup;\n\n            await ParentCoroutineEnumerator();\n\n            var elapsed = Time.realtimeSinceStartup - time;\n            ((int)Math.Round(TimeSpan.FromSeconds(elapsed).TotalSeconds, MidpointRounding.ToEven)).Should().Be(3);\n        });\n\n        IEnumerator ParentCoroutineEnumerator()\n        {\n            yield return ChildCoroutineEnumerator();\n        }\n\n        IEnumerator ChildCoroutineEnumerator()\n        {\n            yield return new WaitForSeconds(3);\n        }\n\n        [UnityTest]\n        public IEnumerator ToObservable() => UniTask.ToCoroutine(async () =>\n        {\n            var completedTaskObserver = new ToObservableObserver<AsyncUnit>();\n            completedTaskObserver.OnNextCalled.Should().BeFalse();\n            completedTaskObserver.OnCompletedCalled.Should().BeFalse();\n            completedTaskObserver.OnErrorCalled.Should().BeFalse();\n            UniTask.CompletedTask.ToObservable().Subscribe(completedTaskObserver);\n            completedTaskObserver.OnNextCalled.Should().BeTrue();\n            completedTaskObserver.OnCompletedCalled.Should().BeTrue();\n            completedTaskObserver.OnErrorCalled.Should().BeFalse();\n\n            var delayFrameTaskObserver = new ToObservableObserver<AsyncUnit>();\n            UniTask.DelayFrame(1).ToObservable().Subscribe(delayFrameTaskObserver);\n            delayFrameTaskObserver.OnNextCalled.Should().BeFalse();\n            delayFrameTaskObserver.OnCompletedCalled.Should().BeFalse();\n            delayFrameTaskObserver.OnErrorCalled.Should().BeFalse();\n            await UniTask.DelayFrame(1);\n            delayFrameTaskObserver.OnNextCalled.Should().BeTrue();\n            delayFrameTaskObserver.OnCompletedCalled.Should().BeTrue();\n            delayFrameTaskObserver.OnErrorCalled.Should().BeFalse();\n        });\n\n        class ToObservableObserver<T> : IObserver<T>\n        {\n            public bool OnNextCalled { get; private set; }\n            public bool OnCompletedCalled { get; private set; }\n            public bool OnErrorCalled { get; private set; }\n\n            public void OnNext(T value) => OnNextCalled = true;\n            public void OnCompleted() => OnCompletedCalled = true;\n            public void OnError(Exception error) => OnErrorCalled = true;\n        }\n\n\n#endif\n#endif\n    }\n}\n\n#endif"
  },
  {
    "path": "src/UniTask/Assets/Tests/AsyncTest.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 5e9960810a8f0634cb4aea38c563d947\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/CachelikeTest.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing NUnit.Framework;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing UnityEngine;\nusing UnityEngine.TestTools;\n\nnamespace Cysharp.Threading.TasksTests\n{\n    public class Cachelike\n    {\n        [UnityTest]\n        public IEnumerator Check() => UniTask.ToCoroutine(async () =>\n        {\n            {\n                var v = await CachedCheck(\"foo\", 10);\n                v.Should().Be(10);\n\n                var v2 = await CachedCheck(\"bar\", 20);\n                v2.Should().Be(20);\n\n                var v3 = await CachedCheck(\"baz\", 30);\n                v3.Should().Be(30);\n            }\n            {\n                var v = await CachedCheck(\"foo\", 10);\n                v.Should().Be(10);\n\n                var v2 = await CachedCheck(\"bar\", 20);\n                v2.Should().Be(20);\n\n                var v3 = await CachedCheck(\"baz\", 30);\n                v3.Should().Be(30);\n            }\n            {\n                var v = CachedCheck(\"foo\", 10);\n                var v2 = CachedCheck(\"bar\", 20);\n                var v3 = CachedCheck(\"baz\", 30);\n\n                (await v).Should().Be(10);\n                (await v2).Should().Be(20);\n                (await v3).Should().Be(30);\n            }\n            {\n                var v = CachedCheck(\"foo\", 10, true);\n                var v2 = CachedCheck(\"bar\", 20, true);\n                var v3 = CachedCheck(\"baz\", 30, true);\n\n                (await v).Should().Be(10);\n                (await v2).Should().Be(20);\n                (await v3).Should().Be(30);\n            }\n        });\n\n\n        static Dictionary<string, int> cacheDict = new Dictionary<string, int>();\n\n        async UniTask<int> CachedCheck(string cache, int value, bool yield = false)\n        {\n            if (!cacheDict.ContainsKey(cache))\n            {\n                await UniTask.Yield();\n            }\n\n            if (yield)\n            {\n                await UniTask.Yield();\n            }\n\n            if (cacheDict.TryGetValue(cache, out var v))\n            {\n                return v;\n            }\n\n            cacheDict.Add(cache, value);\n\n            return value;\n        }\n\n     \n    }\n\n\n\n\n\n\n\n\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Tests/CachelikeTest.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 416e0e77b4408b0498792eb218ed2870\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/CoroutineToUniTaskTest.cs",
    "content": "﻿#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing UnityEngine;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing UnityEngine.UI;\nusing UnityEngine.Scripting;\nusing Cysharp.Threading.Tasks;\nusing Unity.Collections;\nusing System.Threading;\nusing NUnit.Framework;\nusing UnityEngine.TestTools;\nusing FluentAssertions;\n\nnamespace Cysharp.Threading.TasksTests\n{\n    public class CoroutineToUniTaskTest\n    {\n        [UnityTest]\n        public IEnumerator EarlyUpdate() => UniTask.ToCoroutine(async () =>\n        {\n            await UniTask.Yield(PlayerLoopTiming.EarlyUpdate);\n\n            var l = new List<(int, int)>();\n            var currentFrame = Time.frameCount;\n            var t = Worker(l).ToUniTask();\n\n            l.Count.Should().Be(1);\n            l[0].Should().Be((0, currentFrame));\n\n            await t;\n\n            l[1].Should().Be((1, Time.frameCount));\n            l[1].Item2.Should().NotBe(currentFrame);\n        });\n\n        [UnityTest]\n        public IEnumerator LateUpdate() => UniTask.ToCoroutine(async () =>\n        {\n            await UniTask.Yield(PlayerLoopTiming.PostLateUpdate);\n\n            var l = new List<(int, int)>();\n            var currentFrame = Time.frameCount;\n            var t = Worker(l).ToUniTask();\n\n            l.Count.Should().Be(1);\n            l[0].Should().Be((0, currentFrame));\n\n            await t;\n\n            l[1].Should().Be((1, Time.frameCount));\n            l[1].Item2.Should().NotBe(currentFrame);\n        });\n\n        //[UnityTest]\n        //public IEnumerator TestCoroutine()\n        //{\n        //    yield return UniTask.Yield(PlayerLoopTiming.EarlyUpdate).ToUniTask().ToCoroutine();\n\n        //    var nanika = (UnityEngine.MonoBehaviour)GameObject.FindObjectOfType(typeof(UnityEngine.MonoBehaviour));\n\n        //    var l = new List<(int, int)>();\n        //    var currentFrame = Time.frameCount;\n        //    var t = nanika.StartCoroutine(Worker(l));\n\n        //    l.Count.Should().Be(1);\n        //    l[0].Should().Be((0, currentFrame));\n\n        //    yield return t;\n\n        //    l[1].Should().Be((1, Time.frameCount));\n        //    l[1].Item2.Should().NotBe(currentFrame);\n        //}\n\n        //[UnityTest]\n        //public IEnumerator TestCoroutine2()\n        //{\n        //    yield return UniTask.Yield(PlayerLoopTiming.PostLateUpdate).ToUniTask().ToCoroutine();\n\n        //    var nanika = (UnityEngine.MonoBehaviour)GameObject.FindObjectOfType(typeof(UnityEngine.MonoBehaviour));\n\n        //    var l = new List<(int, int)>();\n        //    var currentFrame = Time.frameCount;\n        //    var t = nanika.StartCoroutine(Worker(l));\n\n        //    l.Count.Should().Be(1);\n        //    l[0].Should().Be((0, currentFrame));\n\n        //    yield return t;\n\n        //    l[1].Should().Be((1, Time.frameCount));\n        //    l[1].Item2.Should().NotBe(currentFrame);\n        //}\n\n        [UnityTest]\n        public IEnumerator ImmediateRunTest() => UniTask.ToCoroutine(async () =>\n        {\n            var l = new List<int>();\n            var x1 = Immediate(l);\n            var x2 = Immediate(l);\n            var x3 = DelayOne(l);\n\n            var t1 = x1.ToUniTask();\n            CollectionAssert.AreEqual(l, new[] { 1, 2, 3 });\n            await t1;\n\n            var t2 = x2.ToUniTask();\n            CollectionAssert.AreEqual(l, new[] { 1, 2, 3, 1, 2, 3 });\n\n            var t3 = x3.ToUniTask();\n            CollectionAssert.AreEqual(l, new[] { 1, 2, 3, 1, 2, 3, 10 });\n\n            await UniTask.WhenAll(t2, t3);\n            CollectionAssert.AreEqual(l, new[] { 1, 2, 3, 1, 2, 3, 10, 20, 30 });\n\n        });\n\n        IEnumerator Immediate(List<int> l)\n        {\n            l.Add(1);\n            l.Add(2);\n            l.Add(3);\n            yield break;\n        }\n\n        IEnumerator DelayOne(List<int> l)\n        {\n            l.Add(10);\n            yield return null;\n            l.Add(20);\n            l.Add(30);\n        }\n\n#if !UNITY_WEBGL\n\n        [UnityTest]\n        public IEnumerator WaitForSecondsTest() => UniTask.ToCoroutine(async () =>\n        {\n            await UniTask.Yield(PlayerLoopTiming.PostLateUpdate);\n\n            Time.timeScale = 0.5f;\n            try\n            {\n                var now = DateTimeOffset.UtcNow;\n\n                await WaitFor();\n\n                var elapsed = DateTimeOffset.UtcNow - now;\n\n                (5.8f <= elapsed.TotalSeconds && elapsed.TotalSeconds <= 6.2f).Should().BeTrue();\n            }\n            finally\n            {\n                Time.timeScale = 1.0f;\n            }\n        });\n\n        IEnumerator WaitFor()\n        {\n            yield return new WaitForSeconds(3.0f);\n        }\n\n#endif\n\n        IEnumerator Worker(List<(int, int)> l)\n        {\n            l.Add((0, Time.frameCount));\n            yield return null;\n            l.Add((1, Time.frameCount));\n        }\n\n        public async UniTask Foo()\n        {\n            var tasks = new List<UniTask>();\n            var t = Bar<int>();\n            tasks.Add(t);\n\n            t = Bar<int>();\n            tasks.Add(t);\n\n            await UniTask.WhenAll(tasks);\n        }\n\n        public async UniTask<T> Bar<T>()\n        {\n            await UniTask.Yield();\n            return default(T);\n        }\n    }\n}\n\n#endif"
  },
  {
    "path": "src/UniTask/Assets/Tests/CoroutineToUniTaskTest.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 43ffb719370515746932af3732ce073e\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/DelayTest.cs",
    "content": "﻿#pragma warning disable CS0618\n\nusing Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing NUnit.Framework;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing UnityEngine;\nusing UnityEngine.TestTools;\n\nnamespace Cysharp.Threading.TasksTests\n{\n    public class DelayTest\n    {\n        [UnityTest]\n        public IEnumerator DelayFrame() => UniTask.ToCoroutine(async () =>\n        {\n            for (int i = 1; i < 5; i++)\n            {\n                await UniTask.Yield(PlayerLoopTiming.PreUpdate);\n                var frameCount = Time.frameCount;\n                await UniTask.DelayFrame(i);\n                Time.frameCount.Should().Be(frameCount + i);\n            }\n\n            for (int i = 1; i < 5; i++)\n            {\n                await UniTask.Yield(PlayerLoopTiming.PostLateUpdate);\n                var frameCount = Time.frameCount;\n                await UniTask.DelayFrame(i);\n                Time.frameCount.Should().Be(frameCount + i);\n            }\n        });\n\n        [UnityTest]\n        public IEnumerator DelayFrameZero() => UniTask.ToCoroutine(async () =>\n        {\n            {\n                await UniTask.Yield(PlayerLoopTiming.PreUpdate);\n                var frameCount = Time.frameCount;\n                await UniTask.DelayFrame(0);\n                Time.frameCount.Should().Be(frameCount); // same frame\n            }\n            {\n                await UniTask.Yield(PlayerLoopTiming.PostLateUpdate);\n                var frameCount = Time.frameCount;\n                await UniTask.DelayFrame(0);\n                Time.frameCount.Should().Be(frameCount + 1); // next frame\n            }\n        });\n\n\n\n        [UnityTest]\n        public IEnumerator TimerFramePre() => UniTask.ToCoroutine(async () =>\n        {\n            await UniTask.Yield(PlayerLoopTiming.PreUpdate);\n\n            var initialFrame = Time.frameCount;\n            var xs = await UniTaskAsyncEnumerable.TimerFrame(2, 3).Take(5).Select(_ => Time.frameCount).ToArrayAsync();\n\n            xs[0].Should().Be(initialFrame + 2);\n            xs[1].Should().Be(initialFrame + 2 + (3 * 1));\n            xs[2].Should().Be(initialFrame + 2 + (3 * 2));\n            xs[3].Should().Be(initialFrame + 2 + (3 * 3));\n            xs[4].Should().Be(initialFrame + 2 + (3 * 4));\n        });\n\n\n        [UnityTest]\n        public IEnumerator TimerFramePost() => UniTask.ToCoroutine(async () =>\n        {\n            await UniTask.Yield(PlayerLoopTiming.PostLateUpdate);\n\n            var initialFrame = Time.frameCount;\n            var xs = await UniTaskAsyncEnumerable.TimerFrame(2, 3).Take(5).Select(_ => Time.frameCount).ToArrayAsync();\n\n            xs[0].Should().Be(initialFrame + 2);\n            xs[1].Should().Be(initialFrame + 2 + (3 * 1));\n            xs[2].Should().Be(initialFrame + 2 + (3 * 2));\n            xs[3].Should().Be(initialFrame + 2 + (3 * 3));\n            xs[4].Should().Be(initialFrame + 2 + (3 * 4));\n        });\n\n\n        [UnityTest]\n        public IEnumerator TimerFrameTest() => UniTask.ToCoroutine(async () =>\n        {\n            await UniTask.Yield(PlayerLoopTiming.PreUpdate);\n\n            var initialFrame = Time.frameCount;\n            var xs = await UniTaskAsyncEnumerable.TimerFrame(0, 0).Take(5).Select(_ => Time.frameCount).ToArrayAsync();\n\n            xs[0].Should().Be(initialFrame);\n            xs[1].Should().Be(initialFrame + 1);\n            xs[2].Should().Be(initialFrame + 2);\n            xs[3].Should().Be(initialFrame + 3);\n            xs[4].Should().Be(initialFrame + 4);\n        });\n\n\n        [UnityTest]\n        public IEnumerator TimerFrameSinglePre() => UniTask.ToCoroutine(async () =>\n        {\n            {\n                await UniTask.Yield(PlayerLoopTiming.PreUpdate);\n                var initialFrame = Time.frameCount;\n                var xs = await UniTaskAsyncEnumerable.TimerFrame(0).Select(_ => Time.frameCount).ToArrayAsync();\n                xs[0].Should().Be(initialFrame);\n\n            }\n            {\n                await UniTask.Yield(PlayerLoopTiming.PreUpdate);\n                var initialFrame = Time.frameCount;\n\n                var xs = await UniTaskAsyncEnumerable.TimerFrame(1).Select(_ =>\n                {\n                    var t = Time.frameCount;\n\n                    return t;\n                }).ToArrayAsync();\n\n                xs[0].Should().Be(initialFrame + 1);\n            }\n            {\n                await UniTask.Yield(PlayerLoopTiming.PreUpdate);\n                var initialFrame = Time.frameCount;\n                var xs = await UniTaskAsyncEnumerable.TimerFrame(2).Select(_ => Time.frameCount).ToArrayAsync();\n                xs[0].Should().Be(initialFrame + 2);\n            }\n        });\n\n\n        [UnityTest]\n        public IEnumerator TimerFrameSinglePost() => UniTask.ToCoroutine(async () =>\n        {\n            {\n                //await UniTask.Yield(PlayerLoopTiming.PostLateUpdate);\n                //var initialFrame = Time.frameCount;\n                //var xs = await UniTaskAsyncEnumerable.TimerFrame(0).Select(_ => Time.frameCount).ToArrayAsync();\n                //xs[0].Should().Be(initialFrame);\n            }\n            {\n                //await UniTask.Yield(PlayerLoopTiming.PostLateUpdate);\n                var initialFrame = Time.frameCount;\n                var xs = await UniTaskAsyncEnumerable.TimerFrame(1).Select(_ => Time.frameCount).ToArrayAsync();\n                xs[0].Should().Be(initialFrame + 1);\n            }\n            {\n                //await UniTask.Yield(PlayerLoopTiming.PostLateUpdate);\n                var initialFrame = Time.frameCount;\n                var xs = await UniTaskAsyncEnumerable.TimerFrame(2).Select(_ => Time.frameCount).ToArrayAsync();\n                xs[0].Should().Be(initialFrame + 2);\n            }\n        });\n\n\n\n        [UnityTest]\n        public IEnumerator Timer() => UniTask.ToCoroutine(async () =>\n        {\n            await UniTask.Yield(PlayerLoopTiming.PreUpdate);\n\n            {\n                var initialSeconds = Time.realtimeSinceStartup;\n                var xs = await UniTaskAsyncEnumerable.Timer(TimeSpan.FromSeconds(2)).Select(_ => Time.realtimeSinceStartup).ToArrayAsync();\n\n                Mathf.Approximately(initialSeconds, xs[0]).Should().BeFalse();\n                Debug.Log(\"Init:\" + initialSeconds);\n                Debug.Log(\"After:\" + xs[0]);\n            }\n        });\n\n#if !UNITY_WEBGL\n\n        [UnityTest]\n        public IEnumerator DelayInThreadPool() => UniTask.ToCoroutine(async () =>\n        {\n            await UniTask.Run(async () =>\n            {\n                await UniTask.Delay(TimeSpan.FromSeconds(2));\n            });\n        });\n\n#endif\n\n        [UnityTest]\n        public IEnumerator DelayRealtime() => UniTask.ToCoroutine(async () =>\n        {\n            var now = DateTimeOffset.UtcNow;\n\n            await UniTask.Delay(TimeSpan.FromSeconds(2), DelayType.Realtime);\n\n            var elapsed = DateTimeOffset.UtcNow - now;\n\n            var okay1 = TimeSpan.FromSeconds(1.80) <= elapsed;\n            var okay2 = elapsed <= TimeSpan.FromSeconds(2.20);\n\n            okay1.Should().Be(true);\n            okay2.Should().Be(true);\n        });\n\n\n        [UnityTest]\n        public IEnumerator LoopTest() => UniTask.ToCoroutine(async () =>\n        {\n            for (int i = 0; i < 20; ++i)\n            {\n                UniTask.DelayFrame(100).Forget();\n                await UniTask.DelayFrame(1);\n            }\n        });\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Tests/DelayTest.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 1376b93d9e1083a4a9b4081e08f3a7b7\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/Editor/AsyncTestEditor.cs",
    "content": "﻿//#if !(UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2)\n//#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\n//using UnityEngine;\n//using System;\n//using System.Collections;\n//using System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n//using UnityEngine.UI;\n//using UnityEngine.Scripting;\n//using Cysharp.Threading.Tasks;\n//using UnityEngine.SceneManagement;\n//#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))\n//using System.Threading.Tasks;\n//#endif\n//using UnityEngine.Networking;\n\n//#if !UNITY_2019_3_OR_NEWER\n//using UnityEngine.Experimental.LowLevel;\n//#else\n//using UnityEngine.LowLevel;\n//#endif\n\n//#if !UNITY_WSA\n//using Unity.Jobs;\n//#endif\n//using Unity.Collections;\n//using System.Threading;\n//using NUnit.Framework;\n//using UnityEngine.TestTools;\n//using FluentAssertions;\n\n//namespace Cysharp.Threading.TasksTests\n//{\n//    public class AsyncTest\n//    {\n//#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))\n//#if !UNITY_WSA\n\n//        public struct MyJob : IJob\n//        {\n//            public int loopCount;\n//            public NativeArray<int> inOut;\n//            public int result;\n\n//            public void Execute()\n//            {\n//                result = 0;\n//                for (int i = 0; i < loopCount; i++)\n//                {\n//                    result++;\n//                }\n//                inOut[0] = result;\n//            }\n//        }\n\n//        [UnityTest]\n//        public IEnumerator DelayAnd() => UniTask.ToCoroutine(async () =>\n//        {\n//            await UniTask.Yield(PlayerLoopTiming.PostLateUpdate);\n\n//            var time = Time.realtimeSinceStartup;\n\n//            Time.timeScale = 0.5f;\n//            try\n//            {\n//                await UniTask.Delay(TimeSpan.FromSeconds(3));\n\n//                var elapsed = Time.realtimeSinceStartup - time;\n//                ((int)Math.Round(TimeSpan.FromSeconds(elapsed).TotalSeconds, MidpointRounding.ToEven)).Should().Be(6);\n//            }\n//            finally\n//            {\n//                Time.timeScale = 1.0f;\n//            }\n//        });\n\n//        [UnityTest]\n//        public IEnumerator DelayIgnore() => UniTask.ToCoroutine(async () =>\n//        {\n//            var time = Time.realtimeSinceStartup;\n\n//            Time.timeScale = 0.5f;\n//            try\n//            {\n//                await UniTask.Delay(TimeSpan.FromSeconds(3), ignoreTimeScale: true);\n\n//                var elapsed = Time.realtimeSinceStartup - time;\n//                ((int)Math.Round(TimeSpan.FromSeconds(elapsed).TotalSeconds, MidpointRounding.ToEven)).Should().Be(3);\n//            }\n//            finally\n//            {\n//                Time.timeScale = 1.0f;\n//            }\n//        });\n\n//        [UnityTest]\n//        public IEnumerator WhenAll() => UniTask.ToCoroutine(async () =>\n//        {\n//            var a = UniTask.FromResult(999);\n//            var b = UniTask.Yield(PlayerLoopTiming.Update, CancellationToken.None).AsAsyncUnitUniTask();\n//            var c = UniTask.DelayFrame(99).AsAsyncUnitUniTask();\n\n//            var (a2, b2, c2) = await UniTask.WhenAll(a, b, c);\n//            a2.Should().Be(999);\n//            b2.Should().Be(AsyncUnit.Default);\n//            c2.Should().Be(AsyncUnit.Default);\n//        });\n\n//        [UnityTest]\n//        public IEnumerator WhenAny() => UniTask.ToCoroutine(async () =>\n//        {\n//            var a = UniTask.FromResult(999);\n//            var b = UniTask.Yield(PlayerLoopTiming.Update, CancellationToken.None).AsAsyncUnitUniTask();\n//            var c = UniTask.DelayFrame(99).AsAsyncUnitUniTask();\n\n//            var (win, a2, b2, c2) = await UniTask.WhenAny(a, b, c);\n//            win.Should().Be(0);\n//            a2.Should().Be(999);\n//        });\n\n//        [UnityTest]\n//        public IEnumerator BothEnumeratorCheck() => UniTask.ToCoroutine(async () =>\n//        {\n//            await ToaruCoroutineEnumerator(); // wait 5 frame:)\n//        });\n\n//        [UnityTest]\n//        public IEnumerator JobSystem() => UniTask.ToCoroutine(async () =>\n//        {\n//            var job = new MyJob() { loopCount = 999, inOut = new NativeArray<int>(1, Allocator.TempJob) };\n//            JobHandle.ScheduleBatchedJobs();\n//            await job.Schedule();\n//            job.inOut[0].Should().Be(999);\n//            job.inOut.Dispose();\n//        });\n\n//        class MyMyClass\n//        {\n//            public int MyProperty { get; set; }\n//        }\n\n//        [UnityTest]\n//        public IEnumerator WaitUntil() => UniTask.ToCoroutine(async () =>\n//        {\n//            bool t = false;\n\n//            await UniTask.Yield(PlayerLoopTiming.PostLateUpdate);\n\n//            UniTask.DelayFrame(10,PlayerLoopTiming.PostLateUpdate).ContinueWith(() => t = true).Forget();\n\n//            var startFrame = Time.frameCount;\n//            await UniTask.WaitUntil(() => t, PlayerLoopTiming.EarlyUpdate);\n\n//            var diff = Time.frameCount - startFrame;\n//            diff.Should().Be(11);\n//        });\n\n//        [UnityTest]\n//        public IEnumerator WaitWhile() => UniTask.ToCoroutine(async () =>\n//        {\n//            bool t = true;\n\n//            UniTask.DelayFrame(10, PlayerLoopTiming.PostLateUpdate).ContinueWith(() => t = false).Forget();\n\n//            var startFrame = Time.frameCount;\n//            await UniTask.WaitWhile(() => t, PlayerLoopTiming.EarlyUpdate);\n\n//            var diff = Time.frameCount - startFrame;\n//            diff.Should().Be(11);\n//        });\n\n//        [UnityTest]\n//        public IEnumerator WaitUntilValueChanged() => UniTask.ToCoroutine(async () =>\n//        {\n//            var v = new MyMyClass { MyProperty = 99 };\n\n//            UniTask.DelayFrame(10, PlayerLoopTiming.PostLateUpdate).ContinueWith(() => v.MyProperty = 1000).Forget();\n\n//            var startFrame = Time.frameCount;\n//            await UniTask.WaitUntilValueChanged(v, x => x.MyProperty, PlayerLoopTiming.EarlyUpdate);\n\n//            var diff = Time.frameCount - startFrame;\n//            diff.Should().Be(11);\n//        });\n\n//        [UnityTest]\n//        public IEnumerator SwitchTo() => UniTask.ToCoroutine(async () =>\n//        {\n//            await UniTask.Yield();\n\n//            var currentThreadId = Thread.CurrentThread.ManagedThreadId;\n\n\n\n//            await UniTask.SwitchToThreadPool();\n//            //await UniTask.SwitchToThreadPool();\n//            //await UniTask.SwitchToThreadPool();\n\n\n            \n\n\n\n//            var switchedThreadId = Thread.CurrentThread.ManagedThreadId;\n\n\n\n//            currentThreadId.Should().NotBe(switchedThreadId);\n\n\n//            await UniTask.Yield();\n\n//            var switchedThreadId2 = Thread.CurrentThread.ManagedThreadId;\n\n//            currentThreadId.Should().Be(switchedThreadId2);\n//        });\n\n//        //[UnityTest]\n//        //public IEnumerator ObservableConversion() => UniTask.ToCoroutine(async () =>\n//        //{\n//        //    var v = await Observable.Range(1, 10).ToUniTask();\n//        //    v.Is(10);\n\n//        //    v = await Observable.Range(1, 10).ToUniTask(useFirstValue: true);\n//        //    v.Is(1);\n\n//        //    v = await UniTask.DelayFrame(10).ToObservable().ToTask();\n//        //    v.Is(10);\n\n//        //    v = await UniTask.FromResult(99).ToObservable();\n//        //    v.Is(99);\n//        //});\n\n//        //[UnityTest]\n//        //public IEnumerator AwaitableReactiveProperty() => UniTask.ToCoroutine(async () =>\n//        //{\n//        //    var rp1 = new ReactiveProperty<int>(99);\n\n//        //    UniTask.DelayFrame(100).ContinueWith(x => rp1.Value = x).Forget();\n\n//        //    await rp1;\n\n//        //    rp1.Value.Is(100);\n\n//        //    // var delay2 = UniTask.DelayFrame(10);\n//        //    // var (a, b ) = await UniTask.WhenAll(rp1.WaitUntilValueChangedAsync(), delay2);\n\n//        //});\n\n//        //[UnityTest]\n//        //public IEnumerator AwaitableReactiveCommand() => UniTask.ToCoroutine(async () =>\n//        //{\n//        //    var rc = new ReactiveCommand<int>();\n\n//        //    UniTask.DelayFrame(100).ContinueWith(x => rc.Execute(x)).Forget();\n\n//        //    var v = await rc;\n\n//        //    v.Is(100);\n//        //});\n\n//        [UnityTest]\n//        public IEnumerator ExceptionlessCancellation() => UniTask.ToCoroutine(async () =>\n//        {\n//            var cts = new CancellationTokenSource();\n\n//            UniTask.DelayFrame(10).ContinueWith(() => cts.Cancel()).Forget();\n\n//            var first = Time.frameCount;\n//            var canceled = await UniTask.DelayFrame(100, cancellationToken: cts.Token).SuppressCancellationThrow();\n\n//            (Time.frameCount - first).Should().Be(11); // 10 frame canceled\n//            canceled.Should().Be(true);\n//        });\n\n//        [UnityTest]\n//        public IEnumerator ExceptionCancellation() => UniTask.ToCoroutine(async () =>\n//        {\n//            var cts = new CancellationTokenSource();\n\n//            UniTask.DelayFrame(10).ContinueWith(() => cts.Cancel()).Forget();\n\n//            bool occur = false;\n//            try\n//            {\n//                await UniTask.DelayFrame(100, cancellationToken: cts.Token);\n//            }\n//            catch (OperationCanceledException)\n//            {\n//                occur = true;\n//            }\n//            occur.Should().BeTrue();\n//        });\n\n//        IEnumerator ToaruCoroutineEnumerator()\n//        {\n//            yield return null;\n//            yield return null;\n//            yield return null;\n//            yield return null;\n//            yield return null;\n//        }\n\n//        [UnityTest]\n//        public IEnumerator ExceptionUnobserved1() => UniTask.ToCoroutine(async () =>\n//        {\n//            bool calledEx = false;\n//            Action<Exception> action = exx =>\n//            {\n//                calledEx = true;\n//                exx.Message.Should().Be(\"MyException\");\n//            };\n\n//            UniTaskScheduler.UnobservedTaskException += action;\n\n//            var ex = InException1();\n//            ex = default(UniTask);\n\n//            await UniTask.DelayFrame(3);\n\n//            GC.Collect();\n//            GC.WaitForPendingFinalizers();\n//            GC.Collect();\n\n//            await UniTask.DelayFrame(1);\n\n//            calledEx.Should().BeTrue();\n\n//            UniTaskScheduler.UnobservedTaskException -= action;\n//        });\n\n//        [UnityTest]\n//        public IEnumerator ExceptionUnobserved2() => UniTask.ToCoroutine(async () =>\n//        {\n//            bool calledEx = false;\n//            Action<Exception> action = exx =>\n//            {\n//                calledEx = true;\n//                exx.Message.Should().Be(\"MyException\");\n//            };\n\n//            UniTaskScheduler.UnobservedTaskException += action;\n\n//            var ex = InException2();\n//            ex = default(UniTask<int>);\n\n//            await UniTask.DelayFrame(3);\n\n//            GC.Collect();\n//            GC.WaitForPendingFinalizers();\n//            GC.Collect();\n\n//            await UniTask.DelayFrame(1);\n\n//            calledEx.Should().BeTrue();\n\n//            UniTaskScheduler.UnobservedTaskException -= action;\n//        });\n\n//        async UniTask InException1()\n//        {\n//            await UniTask.Yield();\n//            throw new Exception(\"MyException\");\n//        }\n\n//        async UniTask<int> InException2()\n//        {\n//            await UniTask.Yield();\n//            throw new Exception(\"MyException\");\n//        }\n\n//        [UnityTest]\n//        public IEnumerator NestedEnumerator() => UniTask.ToCoroutine(async () =>\n//        {\n//            var time = Time.realtimeSinceStartup;\n\n//            await ParentCoroutineEnumerator();\n\n//            var elapsed = Time.realtimeSinceStartup - time;\n//            ((int)Math.Round(TimeSpan.FromSeconds(elapsed).TotalSeconds, MidpointRounding.ToEven)).Should().Be(3);\n//        });\n\n//        IEnumerator ParentCoroutineEnumerator()\n//        {\n//            yield return ChildCoroutineEnumerator();\n//        }\n\n//        IEnumerator ChildCoroutineEnumerator()\n//        {\n//            yield return new WaitForSeconds(3);\n//        }\n\n//#endif\n//#endif\n//    }\n//}\n\n//#endif"
  },
  {
    "path": "src/UniTask/Assets/Tests/Editor/AsyncTestEditor.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 851899ba3337ac24a8331cb18fabe771\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/Editor/RunTestEditor.cs",
    "content": "﻿//#if !(UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2)\n//#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\n//using UnityEngine;\n//using System;\n//using System.Collections;\n//using System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n//using UnityEngine.UI;\n//using UnityEngine.Scripting;\n//using Cysharp.Threading.Tasks;\n//using UnityEngine.SceneManagement;\n//#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))\n//using System.Threading.Tasks;\n//#endif\n//using UnityEngine.Networking;\n\n//#if !UNITY_2019_3_OR_NEWER\n//using UnityEngine.Experimental.LowLevel;\n//#else\n//using UnityEngine.LowLevel;\n//#endif\n\n//#if !UNITY_WSA\n//using Unity.Jobs;\n//#endif\n//using Unity.Collections;\n//using System.Threading;\n//using NUnit.Framework;\n//using UnityEngine.TestTools;\n//using FluentAssertions;\n\n//namespace Cysharp.Threading.TasksTests\n//{\n//    public class RunTest\n//    {\n//#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))\n//#if !UNITY_WSA\n\n//        //[UnityTest]\n//        //public IEnumerator RunThread() => UniTask.ToCoroutine(async () =>\n//        //{\n//        //    var main = Thread.CurrentThread.ManagedThreadId;\n//        //    var v = await UniTask.Run(() => { return System.Threading.Thread.CurrentThread.ManagedThreadId; }, false);\n//        //    UnityEngine.Debug.Log(\"Ret Value is:\" + v);\n//        //    UnityEngine.Debug.Log(\"Run Here and id:\" + System.Threading.Thread.CurrentThread.ManagedThreadId);\n//        //    //v.Should().Be(3);\n//        //    main.Should().NotBe(Thread.CurrentThread.ManagedThreadId);\n//        //});\n\n//        [UnityTest]\n//        public IEnumerator RunThreadConfigure() => UniTask.ToCoroutine(async () =>\n//        {\n//            var main = Thread.CurrentThread.ManagedThreadId;\n//            var v = await UniTask.Run(() => 3, true);\n//            v.Should().Be(3);\n//            main.Should().Be(Thread.CurrentThread.ManagedThreadId);\n//        });\n\n//        //[UnityTest]\n//        //public IEnumerator RunThreadException() => UniTask.ToCoroutine(async () =>\n//        //{\n//        //    var main = Thread.CurrentThread.ManagedThreadId;\n//        //    try\n//        //    {\n//        //        await UniTask.Run<int>(() => throw new Exception(), false);\n//        //    }\n//        //    catch\n//        //    {\n//        //        main.Should().NotBe(Thread.CurrentThread.ManagedThreadId);\n//        //    }\n//        //});\n\n//        [UnityTest]\n//        public IEnumerator RunThreadExceptionConfigure() => UniTask.ToCoroutine(async () =>\n//        {\n//            var main = Thread.CurrentThread.ManagedThreadId;\n//            try\n//            {\n//                await UniTask.Run<int>(() => throw new Exception(), true);\n//            }\n//            catch\n//            {\n//                main.Should().Be(Thread.CurrentThread.ManagedThreadId);\n//            }\n//        });\n\n\n//#endif\n//#endif\n//    }\n//}\n\n//#endif"
  },
  {
    "path": "src/UniTask/Assets/Tests/Editor/RunTestEditor.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 76d078e5d960ac2429ce67a930c29ade\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/Editor/UniTask.Tests.Editor.asmdef",
    "content": "{\n    \"name\": \"UniTask.Tests.Editor\",\n    \"references\": [\n        \"UnityEngine.TestRunner\",\n        \"UnityEditor.TestRunner\",\n        \"UniTask.Tests\",\n        \"UniTask\",\n        \"Unity.ResourceManager\",\n        \"DOTween.Modules\"\n    ],\n    \"includePlatforms\": [\n        \"Editor\"\n    ],\n    \"excludePlatforms\": [],\n    \"allowUnsafeCode\": false,\n    \"overrideReferences\": true,\n    \"precompiledReferences\": [\n        \"nunit.framework.dll\",\n        \"DOTween.dll\"\n    ],\n    \"autoReferenced\": false,\n    \"defineConstraints\": [\n        \"UNITY_INCLUDE_TESTS\"\n    ],\n    \"versionDefines\": [],\n    \"noEngineReferences\": false\n}"
  },
  {
    "path": "src/UniTask/Assets/Tests/Editor/UniTask.Tests.Editor.asmdef.meta",
    "content": "fileFormatVersion: 2\nguid: c2431de67d1d97a48afcaf18f333a0b4\nAssemblyDefinitionImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/Editor/WhenAnyTestEditor.cs",
    "content": "﻿//#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))\n//#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\n//using UnityEngine;\n//using System;\n//using System.Collections;\n//using System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n//using UnityEngine.UI;\n//using UnityEngine.Scripting;\n//using Cysharp.Threading.Tasks;\n//using Unity.Collections;\n//using System.Threading;\n//using NUnit.Framework;\n//using UnityEngine.TestTools;\n//using FluentAssertions;\n\n//namespace Cysharp.Threading.TasksTests\n//{\n//    public class WhenAnyTest\n//    {\n//        [UnityTest]\n//        public IEnumerator WhenAnyCanceled() => UniTask.ToCoroutine(async () =>\n//        {\n//            var cts = new CancellationTokenSource();\n//            var successDelayTask = UniTask.Delay(TimeSpan.FromSeconds(1));\n//            var cancelTask = UniTask.Delay(TimeSpan.FromSeconds(1), cancellationToken: cts.Token);\n//            cts.CancelAfterSlim(200);\n\n//            try\n//            {\n//                var r = await UniTask.WhenAny(new[] { successDelayTask, cancelTask });\n//            }\n//            catch (Exception ex)\n//            {\n//                ex.Should().BeAssignableTo<OperationCanceledException>();\n//            }\n//        });\n//    }\n//}\n\n//#endif"
  },
  {
    "path": "src/UniTask/Assets/Tests/Editor/WhenAnyTestEditor.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b5addd9aa1a794441af032a71208b495\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/Editor.meta",
    "content": "fileFormatVersion: 2\nguid: 649f696fcc0c3104a8de82a2550d248c\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/GenericsWhenAllAny.cs",
    "content": "﻿#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing UnityEngine;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing UnityEngine.UI;\nusing UnityEngine.Scripting;\nusing Cysharp.Threading.Tasks;\nusing Unity.Collections;\nusing System.Threading;\nusing NUnit.Framework;\nusing UnityEngine.TestTools;\nusing FluentAssertions;\n\nnamespace Cysharp.Threading.TasksTests\n{\n    public class GenericsWhenAllAny\n    {\n\n        [UnityTest]\n        public IEnumerator WhenAllT15() => UniTask.ToCoroutine(async () =>\n        {\n            var t01 = Tes<int>();\n            var t02 = Tes<int>();\n            var t03 = Tes<int>();\n            var t04 = Tes<int>();\n            var t05 = Tes<int>();\n            var t06 = Tes<int>();\n            var t07 = Tes<int>();\n            var t08 = Tes<int>();\n            var t09 = Tes<int>();\n            var t10 = Tes<int>();\n            var t11 = Tes<int>();\n            var t12 = Tes<int>();\n            var t13 = Tes<int>();\n            var t14 = Tes<int>();\n            var t15 = Tes<int>();\n\n            await UniTask.WhenAll(t01, t02, t03, t04, t05, t06, t07, t08, t09, t10, t11, t12, t13, t14, t15);\n        });\n\n        [UnityTest]\n        public IEnumerator WhenAllT01_Generics1() => UniTask.ToCoroutine(async () =>\n        {\n            var t01 = Tes<MyGenerics<int>>();\n\n            await UniTask.WhenAll(t01);\n        });\n\n        [UnityTest]\n        public IEnumerator WhenAllT02_Generics1() => UniTask.ToCoroutine(async () =>\n        {\n            var t01 = Tes<MyGenerics<int>>();\n            var t02 = Tes<MyGenerics<int>>();\n\n            await UniTask.WhenAll(t01, t02);\n        });\n\n        [UnityTest]\n        public IEnumerator WhenAllT03_Generics1() => UniTask.ToCoroutine(async () =>\n        {\n            var t01 = Tes<MyGenerics<int>>();\n            var t02 = Tes<MyGenerics<int>>();\n            var t03 = Tes<MyGenerics<int>>();\n\n            await UniTask.WhenAll(t01, t02, t03);\n        });\n\n        [UnityTest]\n        public IEnumerator WhenAllT04_Generics1() => UniTask.ToCoroutine(async () =>\n        {\n            var t01 = Tes<MyGenerics<int>>();\n            var t02 = Tes<MyGenerics<int>>();\n            var t03 = Tes<MyGenerics<int>>();\n            var t04 = Tes<MyGenerics<int>>();\n\n            await UniTask.WhenAll(t01, t02, t03, t04);\n        });\n\n        // will fail.\n\n        //[UnityTest]\n        //public IEnumerator WhenAllT05_Generics1() => UniTask.ToCoroutine(async () =>\n        //{\n        //    var t01 = Tes<MyGenerics<int>>();\n        //    var t02 = Tes<MyGenerics<int>>();\n        //    var t03 = Tes<MyGenerics<int>>();\n        //    var t04 = Tes<MyGenerics<int>>();\n        //    var t05 = Tes<MyGenerics<int>>();\n\n        //    await UniTask.WhenAll(t01, t02, t03, t04, t05);\n        //});\n\n        //[UnityTest]\n        //public IEnumerator WhenAllT06_Generics1() => UniTask.ToCoroutine(async () =>\n        //{\n        //    var t01 = Tes<MyGenerics<int>>();\n        //    var t02 = Tes<MyGenerics<int>>();\n        //    var t03 = Tes<MyGenerics<int>>();\n        //    var t04 = Tes<MyGenerics<int>>();\n        //    var t05 = Tes<MyGenerics<int>>();\n        //    var t06 = Tes<MyGenerics<int>>();\n\n        //    await UniTask.WhenAll(t01, t02, t03, t04, t05, t06);\n        //});\n\n        //[UnityTest]\n        //public IEnumerator WhenAllT07_Generics1() => UniTask.ToCoroutine(async () =>\n        //{\n        //    var t01 = Tes<MyGenerics<int>>();\n        //    var t02 = Tes<MyGenerics<int>>();\n        //    var t03 = Tes<MyGenerics<int>>();\n        //    var t04 = Tes<MyGenerics<int>>();\n        //    var t05 = Tes<MyGenerics<int>>();\n        //    var t06 = Tes<MyGenerics<int>>();\n        //    var t07 = Tes<MyGenerics<int>>();\n\n        //    await UniTask.WhenAll(t01, t02, t03, t04, t05, t06, t07);\n        //});\n\n        //[UnityTest]\n        //public IEnumerator WhenAllT15_Generics1() => UniTask.ToCoroutine(async () =>\n        //{\n        //    var t01 = Tes<MyGenerics<int>>();\n        //    var t02 = Tes<MyGenerics<int>>();\n        //    var t03 = Tes<MyGenerics<int>>();\n        //    var t04 = Tes<MyGenerics<int>>();\n        //    var t05 = Tes<MyGenerics<int>>();\n        //    var t06 = Tes<MyGenerics<int>>();\n        //    var t07 = Tes<MyGenerics<int>>();\n        //    var t08 = Tes<MyGenerics<int>>();\n        //    var t09 = Tes<MyGenerics<int>>();\n        //    var t10 = Tes<MyGenerics<int>>();\n        //    var t11 = Tes<MyGenerics<int>>();\n        //    var t12 = Tes<MyGenerics<int>>();\n        //    var t13 = Tes<MyGenerics<int>>();\n        //    var t14 = Tes<MyGenerics<int>>();\n        //    var t15 = Tes<MyGenerics<int>>();\n\n        //    await UniTask.WhenAll(t01, t02, t03, t04, t05, t06, t07, t08, t09, t10, t11, t12, t13, t14, t15);\n        //});\n\n        async UniTask<T> Tes<T>()\n        {\n            await UniTask.Yield();\n            return default;\n        }\n    }\n\n    public class MyGenerics<T>\n    {\n\n    }\n\n    public class MyGenerics2\n    {\n\n    }\n}\n\n#endif"
  },
  {
    "path": "src/UniTask/Assets/Tests/GenericsWhenAllAny.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 6ce87069a3c0ebb47b26dca280a07756\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/PlayerLoopTimerTest.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing FluentAssertions;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing UnityEngine.TestTools;\n\nnamespace Cysharp.Threading.TasksTests\n{\n    public class PlayerLoopTimerTest\n    {\n        void Between(TimeSpan l, TimeSpan data, TimeSpan r)\n        {\n            NUnit.Framework.Assert.AreEqual(l < data, true, \"{0} < {1} failed.\", l, data);\n            NUnit.Framework.Assert.AreEqual(data < r, true, \"{0} < {1} failed.\", data, r);\n        }\n\n        [UnityTest]\n        public IEnumerator StandardTicks() => UniTask.ToCoroutine(async () =>\n        {\n            foreach (var delay in new[] { DelayType.DeltaTime, DelayType.Realtime, DelayType.UnscaledDeltaTime })\n            {\n                var raisedTimeout = new UniTaskCompletionSource();\n                PlayerLoopTimer.StartNew(TimeSpan.FromSeconds(1), false, delay, PlayerLoopTiming.Update, CancellationToken.None, _ =>\n                {\n                    raisedTimeout.TrySetResult();\n                }, null);\n\n\n                var sw = Stopwatch.StartNew();\n                await raisedTimeout.Task;\n                sw.Stop();\n\n                Between(TimeSpan.FromSeconds(0.9), sw.Elapsed, TimeSpan.FromSeconds(1.1));\n            }\n        });\n\n\n        [UnityTest]\n        public IEnumerator Periodic() => UniTask.ToCoroutine(async () =>\n        {\n            var raisedTime = new List<DateTime>();\n            var count = 0;\n            var complete = new UniTaskCompletionSource();\n\n            PlayerLoopTimer timer = null;\n            timer = PlayerLoopTimer.StartNew(TimeSpan.FromSeconds(1), true, DelayType.DeltaTime, PlayerLoopTiming.Update, CancellationToken.None, _ =>\n            {\n                raisedTime.Add(DateTime.UtcNow);\n                count++;\n                if (count == 3)\n                {\n                    complete.TrySetResult();\n                    timer.Dispose();\n                }\n            }, null);\n\n            var start = DateTime.UtcNow;\n            await complete.Task;\n\n            Between(TimeSpan.FromSeconds(0.9), raisedTime[0] - start, TimeSpan.FromSeconds(1.1));\n            Between(TimeSpan.FromSeconds(1.9), raisedTime[1] - start, TimeSpan.FromSeconds(2.1));\n            Between(TimeSpan.FromSeconds(2.9), raisedTime[2] - start, TimeSpan.FromSeconds(3.1));\n        });\n\n        [UnityTest]\n        public IEnumerator CancelAfterSlimTest() => UniTask.ToCoroutine(async () =>\n        {\n            var cts = new CancellationTokenSource();\n            var complete = new UniTaskCompletionSource();\n            cts.Token.RegisterWithoutCaptureExecutionContext(() =>\n            {\n                complete.TrySetResult();\n            });\n\n            cts.CancelAfterSlim(TimeSpan.FromSeconds(1));\n\n            var sw = Stopwatch.StartNew();\n            await complete.Task;\n\n            Between(TimeSpan.FromSeconds(0.9), sw.Elapsed, TimeSpan.FromSeconds(1.1));\n        });\n\n        [UnityTest]\n        public IEnumerator CancelAfterSlimCancelTest() => UniTask.ToCoroutine(async () =>\n        {\n            var cts = new CancellationTokenSource();\n            var complete = new UniTaskCompletionSource();\n            cts.Token.RegisterWithoutCaptureExecutionContext(() =>\n            {\n                complete.TrySetResult();\n            });\n\n            var d = cts.CancelAfterSlim(TimeSpan.FromSeconds(1));\n\n            var sw = Stopwatch.StartNew();\n\n            await UniTask.Delay(TimeSpan.FromMilliseconds(100));\n            d.Dispose();\n\n            await UniTask.Delay(TimeSpan.FromSeconds(2));\n\n            complete.Task.Status.Should().Be(UniTaskStatus.Pending);\n        });\n\n        [UnityTest]\n        public IEnumerator TimeoutController() => UniTask.ToCoroutine(async () =>\n        {\n            var controller = new TimeoutController();\n\n            var token = controller.Timeout(TimeSpan.FromSeconds(1));\n\n            var complete = new UniTaskCompletionSource();\n            token.RegisterWithoutCaptureExecutionContext(() =>\n            {\n                complete.TrySetResult();\n            });\n\n            var sw = Stopwatch.StartNew();\n            await complete.Task;\n            Between(TimeSpan.FromSeconds(0.9), sw.Elapsed, TimeSpan.FromSeconds(1.1));\n\n            controller.IsTimeout().Should().BeTrue();\n        });\n\n\n        [UnityTest]\n        public IEnumerator TimeoutReuse() => UniTask.ToCoroutine(async () =>\n        {\n            var controller = new TimeoutController(DelayType.DeltaTime);\n\n            var token = controller.Timeout(TimeSpan.FromSeconds(2));\n\n            var complete = new UniTaskCompletionSource();\n            token.RegisterWithoutCaptureExecutionContext(() =>\n            {\n                complete.TrySetResult(); // reuse, used same token?\n            });\n\n            await UniTask.Delay(TimeSpan.FromMilliseconds(100));\n            controller.Reset();\n\n            controller.IsTimeout().Should().BeFalse();\n\n            var sw = Stopwatch.StartNew();\n\n            controller.Timeout(TimeSpan.FromSeconds(5));\n\n            await complete.Task;\n\n            UnityEngine.Debug.Log(UnityEngine.Time.timeScale);\n            Between(TimeSpan.FromSeconds(4.9), sw.Elapsed, TimeSpan.FromSeconds(5.1));\n\n            controller.IsTimeout().Should().BeTrue();\n        });\n\n        [UnityTest]\n        public IEnumerator LinkedTokenTest() => UniTask.ToCoroutine(async () =>\n        {\n            var cts = new CancellationTokenSource();\n\n            var controller = new TimeoutController(cts);\n            var token = controller.Timeout(TimeSpan.FromSeconds(2));\n\n            await UniTask.DelayFrame(3);\n\n            cts.Cancel();\n\n            token.IsCancellationRequested.Should().BeTrue();\n\n            controller.Dispose();\n        });\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Tests/PlayerLoopTimerTest.cs.meta",
    "content": "fileFormatVersion: 2\nguid: c0c49de697f829f44aa8709b4d1eff3e\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/Preserve.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing FluentAssertions;\nusing NUnit.Framework;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing UnityEngine;\nusing UnityEngine.TestTools;\n\nnamespace Cysharp.Threading.TasksTests\n{\n    public class Preserve\n    {\n        public Preserve()\n        {\n            // TaskPool.SetMaxPoolSize(0);\n        }\n\n        [UnityTest]\n        public IEnumerator AwaitTwice() => UniTask.ToCoroutine(async () =>\n        {\n            var delay = UniTask.DelayFrame(5);\n            await delay;\n\n            try\n            {\n                await delay;\n                Assert.Fail(\"should throw exception.\");\n            }\n            catch (InvalidOperationException)\n            {\n\n            }\n        });\n\n        [UnityTest]\n        public IEnumerator PreserveAllowTwice() => UniTask.ToCoroutine(async () =>\n        {\n            await UniTask.Yield(PlayerLoopTiming.Update);\n\n            var delay = UniTask.DelayFrame(5, PlayerLoopTiming.PostLateUpdate).Preserve();\n\n            var before = UnityEngine.Time.frameCount; // 0\n\n            await delay;\n            var afterOne = UnityEngine.Time.frameCount; // 5\n\n            await delay;\n            var afterTwo = UnityEngine.Time.frameCount; // 5\n\n            (afterOne - before).Should().Be(5);\n            afterOne.Should().Be(afterTwo);\n        });\n    }\n}\n"
  },
  {
    "path": "src/UniTask/Assets/Tests/Preserve.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 418f4974867e1294b81020613a0b1032\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/Resources/sample_texture.png.meta",
    "content": "fileFormatVersion: 2\nguid: 535006a83baed4ebda99d24a909a2efe\nTextureImporter:\n  internalIDToNameTable:\n  - first:\n      213: -2664112245596591751\n    second: sample_texture_0\n  - first:\n      213: -4606777057269188692\n    second: sample_texture_1\n  - first:\n      213: 1950921086533113773\n    second: sample_texture_2\n  externalObjects: {}\n  serializedVersion: 13\n  mipmaps:\n    mipMapMode: 0\n    enableMipMap: 0\n    sRGBTexture: 1\n    linearTexture: 0\n    fadeOut: 0\n    borderMipMap: 0\n    mipMapsPreserveCoverage: 0\n    alphaTestReferenceValue: 0.5\n    mipMapFadeDistanceStart: 1\n    mipMapFadeDistanceEnd: 3\n  bumpmap:\n    convertToNormalMap: 0\n    externalNormalMap: 0\n    heightScale: 0.25\n    normalMapFilter: 0\n    flipGreenChannel: 0\n  isReadable: 0\n  streamingMipmaps: 0\n  streamingMipmapsPriority: 0\n  vTOnly: 0\n  ignoreMipmapLimit: 0\n  grayScaleToAlpha: 0\n  generateCubemap: 6\n  cubemapConvolution: 0\n  seamlessCubemap: 0\n  textureFormat: 1\n  maxTextureSize: 2048\n  textureSettings:\n    serializedVersion: 2\n    filterMode: 1\n    aniso: 1\n    mipBias: 0\n    wrapU: 1\n    wrapV: 1\n    wrapW: 1\n  nPOTScale: 0\n  lightmap: 0\n  compressionQuality: 50\n  spriteMode: 2\n  spriteExtrude: 1\n  spriteMeshType: 1\n  alignment: 0\n  spritePivot: {x: 0.5, y: 0.5}\n  spritePixelsToUnits: 100\n  spriteBorder: {x: 0, y: 0, z: 0, w: 0}\n  spriteGenerateFallbackPhysicsShape: 1\n  alphaUsage: 1\n  alphaIsTransparency: 1\n  spriteTessellationDetail: -1\n  textureType: 8\n  textureShape: 1\n  singleChannelComponent: 0\n  flipbookRows: 1\n  flipbookColumns: 1\n  maxTextureSizeSet: 0\n  compressionQualitySet: 0\n  textureFormatSet: 0\n  ignorePngGamma: 0\n  applyGammaDecoding: 0\n  swizzle: 50462976\n  cookieLightType: 0\n  platformSettings:\n  - serializedVersion: 3\n    buildTarget: DefaultTexturePlatform\n    maxTextureSize: 2048\n    resizeAlgorithm: 0\n    textureFormat: -1\n    textureCompression: 1\n    compressionQuality: 50\n    crunchedCompression: 0\n    allowsAlphaSplitting: 0\n    overridden: 0\n    ignorePlatformSupport: 0\n    androidETC2FallbackOverride: 0\n    forceMaximumCompressionQuality_BC6H_BC7: 0\n  - serializedVersion: 3\n    buildTarget: WebGL\n    maxTextureSize: 2048\n    resizeAlgorithm: 0\n    textureFormat: -1\n    textureCompression: 1\n    compressionQuality: 50\n    crunchedCompression: 0\n    allowsAlphaSplitting: 0\n    overridden: 0\n    ignorePlatformSupport: 0\n    androidETC2FallbackOverride: 0\n    forceMaximumCompressionQuality_BC6H_BC7: 0\n  - serializedVersion: 3\n    buildTarget: Standalone\n    maxTextureSize: 2048\n    resizeAlgorithm: 0\n    textureFormat: -1\n    textureCompression: 1\n    compressionQuality: 50\n    crunchedCompression: 0\n    allowsAlphaSplitting: 0\n    overridden: 0\n    ignorePlatformSupport: 0\n    androidETC2FallbackOverride: 0\n    forceMaximumCompressionQuality_BC6H_BC7: 0\n  - serializedVersion: 3\n    buildTarget: iPhone\n    maxTextureSize: 2048\n    resizeAlgorithm: 0\n    textureFormat: -1\n    textureCompression: 1\n    compressionQuality: 50\n    crunchedCompression: 0\n    allowsAlphaSplitting: 0\n    overridden: 0\n    ignorePlatformSupport: 0\n    androidETC2FallbackOverride: 0\n    forceMaximumCompressionQuality_BC6H_BC7: 0\n  spriteSheet:\n    serializedVersion: 2\n    sprites:\n    - serializedVersion: 2\n      name: sample_texture_0\n      rect:\n        serializedVersion: 2\n        x: 0\n        y: 76\n        width: 243\n        height: 251\n      alignment: 0\n      pivot: {x: 0, y: 0}\n      border: {x: 0, y: 0, z: 0, w: 0}\n      outline: []\n      physicsShape: []\n      tessellationDetail: -1\n      bones: []\n      spriteID: 9796277170c270bd0800000000000000\n      internalID: -2664112245596591751\n      vertices: []\n      indices: \n      edges: []\n      weights: []\n    - serializedVersion: 2\n      name: sample_texture_1\n      rect:\n        serializedVersion: 2\n        x: 227\n        y: 0\n        width: 190\n        height: 231\n      alignment: 0\n      pivot: {x: 0, y: 0}\n      border: {x: 0, y: 0, z: 0, w: 0}\n      outline: []\n      physicsShape: []\n      tessellationDetail: -1\n      bones: []\n      spriteID: ca7fc069ca07110c0800000000000000\n      internalID: -4606777057269188692\n      vertices: []\n      indices: \n      edges: []\n      weights: []\n    - serializedVersion: 2\n      name: sample_texture_2\n      rect:\n        serializedVersion: 2\n        x: 398\n        y: 87\n        width: 202\n        height: 188\n      alignment: 0\n      pivot: {x: 0, y: 0}\n      border: {x: 0, y: 0, z: 0, w: 0}\n      outline: []\n      physicsShape: []\n      tessellationDetail: -1\n      bones: []\n      spriteID: da710ab4460131b10800000000000000\n      internalID: 1950921086533113773\n      vertices: []\n      indices: \n      edges: []\n      weights: []\n    outline: []\n    physicsShape: []\n    bones: []\n    spriteID: \n    internalID: 0\n    vertices: []\n    indices: \n    edges: []\n    weights: []\n    secondaryTextures: []\n    nameFileIdTable:\n      sample_texture_0: -2664112245596591751\n      sample_texture_1: -4606777057269188692\n      sample_texture_2: 1950921086533113773\n  mipmapLimitGroupName: \n  pSDRemoveMatte: 0\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/Resources.meta",
    "content": "fileFormatVersion: 2\nguid: 8d82913edf6ac48aca30f66ae9ba42d6\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/RunTest.cs",
    "content": "﻿#pragma warning disable CS0618\n\n#if !(UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2)\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing UnityEngine;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing UnityEngine.UI;\nusing UnityEngine.Scripting;\nusing Cysharp.Threading.Tasks;\nusing UnityEngine.SceneManagement;\n#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))\nusing System.Threading.Tasks;\n#endif\nusing UnityEngine.Networking;\n\n#if !UNITY_2019_3_OR_NEWER\nusing UnityEngine.Experimental.LowLevel;\n#else\nusing UnityEngine.LowLevel;\n#endif\n\n#if !UNITY_WSA\nusing Unity.Jobs;\n#endif\nusing Unity.Collections;\nusing System.Threading;\nusing NUnit.Framework;\nusing UnityEngine.TestTools;\nusing FluentAssertions;\n\nnamespace Cysharp.Threading.TasksTests\n{\n    public class RunTest\n    {\n#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))\n#if !UNITY_WSA\n#if !UNITY_WEBGL\n\n        //[UnityTest]\n        //public IEnumerator RunThread() => UniTask.ToCoroutine(async () =>\n        //{\n        //    var main = Thread.CurrentThread.ManagedThreadId;\n        //    var v = await UniTask.Run(() => { return System.Threading.Thread.CurrentThread.ManagedThreadId; }, false);\n        //    UnityEngine.Debug.Log(\"Ret Value is:\" + v);\n        //    UnityEngine.Debug.Log(\"Run Here and id:\" + System.Threading.Thread.CurrentThread.ManagedThreadId);\n        //    //v.Should().Be(3);\n        //    main.Should().NotBe(Thread.CurrentThread.ManagedThreadId);\n        //});\n\n        [UnityTest]\n        public IEnumerator RunThreadConfigure() => UniTask.ToCoroutine(async () =>\n        {\n            var main = Thread.CurrentThread.ManagedThreadId;\n            var v = await UniTask.Run(() => 3, true);\n            v.Should().Be(3);\n            main.Should().Be(Thread.CurrentThread.ManagedThreadId);\n        });\n\n        //[UnityTest]\n        //public IEnumerator RunThreadException() => UniTask.ToCoroutine(async () =>\n        //{\n        //    var main = Thread.CurrentThread.ManagedThreadId;\n        //    try\n        //    {\n        //        await UniTask.Run<int>(() => throw new Exception(), false);\n        //    }\n        //    catch\n        //    {\n        //        main.Should().NotBe(Thread.CurrentThread.ManagedThreadId);\n        //    }\n        //});\n\n        [UnityTest]\n        public IEnumerator RunThreadExceptionConfigure() => UniTask.ToCoroutine(async () =>\n        {\n            var main = Thread.CurrentThread.ManagedThreadId;\n            try\n            {\n#pragma warning disable CS1998\n                await UniTask.Run<int>(async () => throw new Exception(), true);\n#pragma warning restore CS1998\n            }\n            catch\n            {\n                main.Should().Be(Thread.CurrentThread.ManagedThreadId);\n            }\n        });\n\n#endif\n#endif\n#endif\n    }\n}\n\n#endif"
  },
  {
    "path": "src/UniTask/Assets/Tests/RunTest.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 3510f39953ed3074cb2e0f04d3a3f807\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/Shims.cs",
    "content": "﻿using NUnit.Framework;\nusing System;\n\nnamespace Xunit\n{\n    public class FactAttribute : TestAttribute\n    {\n\n    }\n}\n\n// Shims of FluentAssertions\nnamespace FluentAssertions\n{\n    public static class FluentAssertionsExtensions\n    {\n        public static Int Should(this int value)\n        {\n            return new Int(value);\n        }\n\n        public static Bool Should(this bool value)\n        {\n            return new Bool(value);\n        }\n\n        public static ExceptionAssertion Should(this Exception value)\n        {\n            return new ExceptionAssertion(value);\n        }\n\n        public static Generic<T> Should<T>(this T value)\n        {\n            return new Generic<T>(value);\n        }\n\n        public class Generic<T>\n        {\n            readonly T actual;\n\n            public Generic(T value)\n            {\n                actual = value;\n            }\n\n            public void Be(T expected)\n            {\n                Assert.AreEqual(expected, actual);\n            }\n\n            public void NotBe(T expected)\n            {\n                Assert.AreNotEqual(expected, actual);\n            }\n\n            public void BeNull()\n            {\n                Assert.IsNull(actual);\n            }\n\n            public void NotBeNull()\n            {\n                Assert.IsNotNull(actual);\n            }\n        }\n\n        public class Bool\n        {\n            readonly bool actual;\n\n            public Bool(bool value)\n            {\n                actual = value;\n            }\n\n            public void Be(bool expected)\n            {\n                Assert.AreEqual(expected, actual);\n            }\n\n            public void NotBe(bool expected)\n            {\n                Assert.AreNotEqual(expected, actual);\n            }\n\n            public void BeTrue()\n            {\n                Assert.AreEqual(true, actual);\n            }\n\n            public void BeFalse()\n            {\n                Assert.AreEqual(false, actual);\n            }\n        }\n\n        public class Int\n        {\n            readonly int actual;\n\n            public Int(int value)\n            {\n                actual = value;\n            }\n\n            public void Be(int expected)\n            {\n                Assert.AreEqual(expected, actual);\n            }\n\n            public void NotBe(int expected)\n            {\n                Assert.AreNotEqual(expected, actual);\n            }\n\n            public void BeCloseTo(int expected, int delta)\n            {\n                if (expected - delta <= actual && actual <= expected + delta)\n                {\n                    // OK.\n                }\n                else\n                {\n                    Assert.Fail($\"Fail BeCloseTo, actual {actual} but expected:{expected} +- {delta}\");\n                }\n            }\n        }\n\n        public class ExceptionAssertion\n        {\n            readonly Exception actual;\n\n            public ExceptionAssertion(Exception actual)\n            {\n                this.actual = actual;\n            }\n\n            public void BeAssignableTo<T>()\n            {\n                typeof(T).IsAssignableFrom(actual.GetType());\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask/Assets/Tests/Shims.cs.meta",
    "content": "fileFormatVersion: 2\nguid: f76a88025d2f76a4bae09aaa268da103\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/UniTask.Tests.asmdef",
    "content": "{\n    \"name\": \"UniTask.Tests\",\n    \"references\": [\n        \"UnityEngine.TestRunner\",\n        \"UnityEditor.TestRunner\",\n        \"UniTask\",\n        \"Unity.ResourceManager\",\n        \"DOTween.Modules\",\n        \"UniTask.Linq\"\n    ],\n    \"includePlatforms\": [],\n    \"excludePlatforms\": [],\n    \"allowUnsafeCode\": false,\n    \"overrideReferences\": true,\n    \"precompiledReferences\": [\n        \"nunit.framework.dll\",\n        \"DOTween.dll\"\n    ],\n    \"autoReferenced\": false,\n    \"defineConstraints\": [\n        \"UNITY_INCLUDE_TESTS\"\n    ],\n    \"versionDefines\": [],\n    \"noEngineReferences\": false\n}"
  },
  {
    "path": "src/UniTask/Assets/Tests/UniTask.Tests.asmdef.meta",
    "content": "fileFormatVersion: 2\nguid: 9fbc684c31ac15b42809d42b62f6eb5f\nAssemblyDefinitionImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests/WhenAnyTest.cs",
    "content": "﻿#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))\n#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member\n\nusing UnityEngine;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing UnityEngine.UI;\nusing UnityEngine.Scripting;\nusing Cysharp.Threading.Tasks;\nusing Unity.Collections;\nusing System.Threading;\nusing NUnit.Framework;\nusing UnityEngine.TestTools;\nusing FluentAssertions;\n\nnamespace Cysharp.Threading.TasksTests\n{\n    public class WhenAnyTest\n    {\n        [UnityTest]\n        public IEnumerator WhenAnyCanceled() => UniTask.ToCoroutine(async () =>\n        {\n            var cts = new CancellationTokenSource();\n            var successDelayTask = UniTask.Delay(TimeSpan.FromSeconds(1));\n            var cancelTask = UniTask.Delay(TimeSpan.FromSeconds(1), cancellationToken: cts.Token);\n            cts.CancelAfterSlim(200);\n\n            try\n            {\n                var r = await UniTask.WhenAny(new[] { successDelayTask, cancelTask });\n            }\n            catch (Exception ex)\n            {\n                ex.Should().BeAssignableTo<OperationCanceledException>();\n            }\n        });\n    }\n}\n\n#endif"
  },
  {
    "path": "src/UniTask/Assets/Tests/WhenAnyTest.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 0a07d2ea8baf390408279a29510f4953\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Assets/Tests.meta",
    "content": "fileFormatVersion: 2\nguid: b831a4cf04cbe4b48ae74498484ec8c1\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "src/UniTask/Packages/manifest.json",
    "content": "{\n  \"dependencies\": {\n    \"com.cysharp.runtimeunittesttoolkit\": \"https://github.com/Cysharp/RuntimeUnitTestToolkit.git?path=RuntimeUnitTestToolkit/Assets/RuntimeUnitTestToolkit#2.6.0\",\n    \"com.unity.collab-proxy\": \"2.4.3\",\n    \"com.unity.ide.rider\": \"3.0.31\",\n    \"com.unity.ide.visualstudio\": \"2.0.22\",\n    \"com.unity.ide.vscode\": \"1.2.5\",\n    \"com.unity.test-framework\": \"1.1.33\",\n    \"com.unity.textmeshpro\": \"3.0.6\",\n    \"com.unity.timeline\": \"1.7.6\",\n    \"com.unity.toolchain.win-x86_64-linux-x86_64\": \"2.0.9\",\n    \"com.unity.ugui\": \"1.0.0\",\n    \"com.unity.modules.ai\": \"1.0.0\",\n    \"com.unity.modules.androidjni\": \"1.0.0\",\n    \"com.unity.modules.animation\": \"1.0.0\",\n    \"com.unity.modules.assetbundle\": \"1.0.0\",\n    \"com.unity.modules.audio\": \"1.0.0\",\n    \"com.unity.modules.cloth\": \"1.0.0\",\n    \"com.unity.modules.director\": \"1.0.0\",\n    \"com.unity.modules.imageconversion\": \"1.0.0\",\n    \"com.unity.modules.imgui\": \"1.0.0\",\n    \"com.unity.modules.jsonserialize\": \"1.0.0\",\n    \"com.unity.modules.particlesystem\": \"1.0.0\",\n    \"com.unity.modules.physics\": \"1.0.0\",\n    \"com.unity.modules.physics2d\": \"1.0.0\",\n    \"com.unity.modules.screencapture\": \"1.0.0\",\n    \"com.unity.modules.terrain\": \"1.0.0\",\n    \"com.unity.modules.terrainphysics\": \"1.0.0\",\n    \"com.unity.modules.tilemap\": \"1.0.0\",\n    \"com.unity.modules.ui\": \"1.0.0\",\n    \"com.unity.modules.uielements\": \"1.0.0\",\n    \"com.unity.modules.umbra\": \"1.0.0\",\n    \"com.unity.modules.unityanalytics\": \"1.0.0\",\n    \"com.unity.modules.unitywebrequest\": \"1.0.0\",\n    \"com.unity.modules.unitywebrequestassetbundle\": \"1.0.0\",\n    \"com.unity.modules.unitywebrequestaudio\": \"1.0.0\",\n    \"com.unity.modules.unitywebrequesttexture\": \"1.0.0\",\n    \"com.unity.modules.unitywebrequestwww\": \"1.0.0\",\n    \"com.unity.modules.vehicles\": \"1.0.0\",\n    \"com.unity.modules.video\": \"1.0.0\",\n    \"com.unity.modules.vr\": \"1.0.0\",\n    \"com.unity.modules.wind\": \"1.0.0\",\n    \"com.unity.modules.xr\": \"1.0.0\"\n  }\n}\n"
  },
  {
    "path": "src/UniTask/Packages/packages-lock.json",
    "content": "{\n  \"dependencies\": {\n    \"com.cysharp.runtimeunittesttoolkit\": {\n      \"version\": \"https://github.com/Cysharp/RuntimeUnitTestToolkit.git?path=RuntimeUnitTestToolkit/Assets/RuntimeUnitTestToolkit#2.6.0\",\n      \"depth\": 0,\n      \"source\": \"git\",\n      \"dependencies\": {},\n      \"hash\": \"4e3dbfaa9c40b5cfdcb71a1d4e8bca0d45ca1055\"\n    },\n    \"com.unity.collab-proxy\": {\n      \"version\": \"2.4.3\",\n      \"depth\": 0,\n      \"source\": \"registry\",\n      \"dependencies\": {},\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.ext.nunit\": {\n      \"version\": \"1.0.6\",\n      \"depth\": 1,\n      \"source\": \"registry\",\n      \"dependencies\": {},\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.ide.rider\": {\n      \"version\": \"3.0.31\",\n      \"depth\": 0,\n      \"source\": \"registry\",\n      \"dependencies\": {\n        \"com.unity.ext.nunit\": \"1.0.6\"\n      },\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.ide.visualstudio\": {\n      \"version\": \"2.0.22\",\n      \"depth\": 0,\n      \"source\": \"registry\",\n      \"dependencies\": {\n        \"com.unity.test-framework\": \"1.1.9\"\n      },\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.ide.vscode\": {\n      \"version\": \"1.2.5\",\n      \"depth\": 0,\n      \"source\": \"registry\",\n      \"dependencies\": {},\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.sysroot\": {\n      \"version\": \"2.0.10\",\n      \"depth\": 1,\n      \"source\": \"registry\",\n      \"dependencies\": {},\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.sysroot.linux-x86_64\": {\n      \"version\": \"2.0.9\",\n      \"depth\": 1,\n      \"source\": \"registry\",\n      \"dependencies\": {\n        \"com.unity.sysroot\": \"2.0.10\"\n      },\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.test-framework\": {\n      \"version\": \"1.1.33\",\n      \"depth\": 0,\n      \"source\": \"registry\",\n      \"dependencies\": {\n        \"com.unity.ext.nunit\": \"1.0.6\",\n        \"com.unity.modules.imgui\": \"1.0.0\",\n        \"com.unity.modules.jsonserialize\": \"1.0.0\"\n      },\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.textmeshpro\": {\n      \"version\": \"3.0.6\",\n      \"depth\": 0,\n      \"source\": \"registry\",\n      \"dependencies\": {\n        \"com.unity.ugui\": \"1.0.0\"\n      },\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.timeline\": {\n      \"version\": \"1.7.6\",\n      \"depth\": 0,\n      \"source\": \"registry\",\n      \"dependencies\": {\n        \"com.unity.modules.director\": \"1.0.0\",\n        \"com.unity.modules.animation\": \"1.0.0\",\n        \"com.unity.modules.audio\": \"1.0.0\",\n        \"com.unity.modules.particlesystem\": \"1.0.0\"\n      },\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.toolchain.win-x86_64-linux-x86_64\": {\n      \"version\": \"2.0.9\",\n      \"depth\": 0,\n      \"source\": \"registry\",\n      \"dependencies\": {\n        \"com.unity.sysroot\": \"2.0.10\",\n        \"com.unity.sysroot.linux-x86_64\": \"2.0.9\"\n      },\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.ugui\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.ui\": \"1.0.0\",\n        \"com.unity.modules.imgui\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.ai\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.androidjni\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.animation\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.assetbundle\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.audio\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.cloth\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.physics\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.director\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.audio\": \"1.0.0\",\n        \"com.unity.modules.animation\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.imageconversion\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.imgui\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.jsonserialize\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.particlesystem\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.physics\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.physics2d\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.screencapture\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.imageconversion\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.subsystems\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 1,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.jsonserialize\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.terrain\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.terrainphysics\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.physics\": \"1.0.0\",\n        \"com.unity.modules.terrain\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.tilemap\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.physics2d\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.ui\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.uielements\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.ui\": \"1.0.0\",\n        \"com.unity.modules.imgui\": \"1.0.0\",\n        \"com.unity.modules.jsonserialize\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.umbra\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.unityanalytics\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.unitywebrequest\": \"1.0.0\",\n        \"com.unity.modules.jsonserialize\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.unitywebrequest\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.unitywebrequestassetbundle\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.assetbundle\": \"1.0.0\",\n        \"com.unity.modules.unitywebrequest\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.unitywebrequestaudio\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.unitywebrequest\": \"1.0.0\",\n        \"com.unity.modules.audio\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.unitywebrequesttexture\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.unitywebrequest\": \"1.0.0\",\n        \"com.unity.modules.imageconversion\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.unitywebrequestwww\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.unitywebrequest\": \"1.0.0\",\n        \"com.unity.modules.unitywebrequestassetbundle\": \"1.0.0\",\n        \"com.unity.modules.unitywebrequestaudio\": \"1.0.0\",\n        \"com.unity.modules.audio\": \"1.0.0\",\n        \"com.unity.modules.assetbundle\": \"1.0.0\",\n        \"com.unity.modules.imageconversion\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.vehicles\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.physics\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.video\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.audio\": \"1.0.0\",\n        \"com.unity.modules.ui\": \"1.0.0\",\n        \"com.unity.modules.unitywebrequest\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.vr\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.jsonserialize\": \"1.0.0\",\n        \"com.unity.modules.physics\": \"1.0.0\",\n        \"com.unity.modules.xr\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.wind\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.xr\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.physics\": \"1.0.0\",\n        \"com.unity.modules.jsonserialize\": \"1.0.0\",\n        \"com.unity.modules.subsystems\": \"1.0.0\"\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/AudioManager.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!11 &1\nAudioManager:\n  m_ObjectHideFlags: 0\n  m_Volume: 1\n  Rolloff Scale: 1\n  Doppler Factor: 1\n  Default Speaker Mode: 2\n  m_SampleRate: 0\n  m_DSPBufferSize: 1024\n  m_VirtualVoiceCount: 512\n  m_RealVoiceCount: 32\n  m_SpatializerPlugin: \n  m_AmbisonicDecoderPlugin: \n  m_DisableAudio: 0\n  m_VirtualizeEffects: 1\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/ClusterInputManager.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!236 &1\nClusterInputManager:\n  m_ObjectHideFlags: 0\n  m_Inputs: []\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/DynamicsManager.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!55 &1\nPhysicsManager:\n  m_ObjectHideFlags: 0\n  serializedVersion: 7\n  m_Gravity: {x: 0, y: -9.81, z: 0}\n  m_DefaultMaterial: {fileID: 0}\n  m_BounceThreshold: 2\n  m_SleepThreshold: 0.005\n  m_DefaultContactOffset: 0.01\n  m_DefaultSolverIterations: 6\n  m_DefaultSolverVelocityIterations: 1\n  m_QueriesHitBackfaces: 0\n  m_QueriesHitTriggers: 1\n  m_EnableAdaptiveForce: 0\n  m_ClothInterCollisionDistance: 0\n  m_ClothInterCollisionStiffness: 0\n  m_ContactsGeneration: 1\n  m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\n  m_AutoSimulation: 1\n  m_AutoSyncTransforms: 0\n  m_ReuseCollisionCallbacks: 1\n  m_ClothInterCollisionSettingsToggle: 0\n  m_ContactPairsMode: 0\n  m_BroadphaseType: 0\n  m_WorldBounds:\n    m_Center: {x: 0, y: 0, z: 0}\n    m_Extent: {x: 250, y: 250, z: 250}\n  m_WorldSubdivisions: 8\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/EditorBuildSettings.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!1045 &1\nEditorBuildSettings:\n  m_ObjectHideFlags: 0\n  serializedVersion: 2\n  m_Scenes:\n  - enabled: 1\n    path: Assets/Scenes/SandboxMain.unity\n    guid: 2cda990e2423bbf4892e6590ba056729\n  - enabled: 1\n    path: Assets/Scenes/ExceptionExamples.unity\n    guid: b5fed17e3ece238439bc796d8747df5d\n  m_configObjects: {}\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/EditorSettings.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!159 &1\nEditorSettings:\n  m_ObjectHideFlags: 0\n  serializedVersion: 9\n  m_ExternalVersionControlSupport: Visible Meta Files\n  m_SerializationMode: 2\n  m_LineEndingsForNewScripts: 2\n  m_DefaultBehaviorMode: 1\n  m_PrefabRegularEnvironment: {fileID: 0}\n  m_PrefabUIEnvironment: {fileID: 0}\n  m_SpritePackerMode: 4\n  m_SpritePackerPaddingPower: 1\n  m_EtcTextureCompressorBehavior: 1\n  m_EtcTextureFastCompressor: 1\n  m_EtcTextureNormalCompressor: 2\n  m_EtcTextureBestCompressor: 4\n  m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmref\n  m_ProjectGenerationRootNamespace: \n  m_CollabEditorSettings:\n    inProgressEnabled: 1\n  m_EnableTextureStreamingInEditMode: 1\n  m_EnableTextureStreamingInPlayMode: 1\n  m_AsyncShaderCompilation: 1\n  m_EnterPlayModeOptionsEnabled: 0\n  m_EnterPlayModeOptions: 3\n  m_ShowLightmapResolutionOverlay: 1\n  m_UseLegacyProbeSampleCount: 1\n  m_AssetPipelineMode: 1\n  m_CacheServerMode: 0\n  m_CacheServerEndpoint: \n  m_CacheServerNamespacePrefix: default\n  m_CacheServerEnableDownload: 1\n  m_CacheServerEnableUpload: 1\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/GraphicsSettings.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!30 &1\nGraphicsSettings:\n  m_ObjectHideFlags: 0\n  serializedVersion: 12\n  m_Deferred:\n    m_Mode: 1\n    m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0}\n  m_DeferredReflections:\n    m_Mode: 1\n    m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0}\n  m_ScreenSpaceShadows:\n    m_Mode: 1\n    m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0}\n  m_LegacyDeferred:\n    m_Mode: 1\n    m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0}\n  m_DepthNormals:\n    m_Mode: 1\n    m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0}\n  m_MotionVectors:\n    m_Mode: 1\n    m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0}\n  m_LightHalo:\n    m_Mode: 1\n    m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0}\n  m_LensFlare:\n    m_Mode: 1\n    m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0}\n  m_AlwaysIncludedShaders:\n  - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}\n  - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}\n  - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}\n  - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}\n  - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}\n  m_PreloadedShaders: []\n  m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,\n    type: 0}\n  m_CustomRenderPipeline: {fileID: 0}\n  m_TransparencySortMode: 0\n  m_TransparencySortAxis: {x: 0, y: 0, z: 1}\n  m_DefaultRenderingPath: 1\n  m_DefaultMobileRenderingPath: 1\n  m_TierSettings: []\n  m_LightmapStripping: 0\n  m_FogStripping: 0\n  m_InstancingStripping: 0\n  m_LightmapKeepPlain: 1\n  m_LightmapKeepDirCombined: 1\n  m_LightmapKeepDynamicPlain: 1\n  m_LightmapKeepDynamicDirCombined: 1\n  m_LightmapKeepShadowMask: 1\n  m_LightmapKeepSubtractive: 1\n  m_FogKeepLinear: 1\n  m_FogKeepExp: 1\n  m_FogKeepExp2: 1\n  m_AlbedoSwatchInfos: []\n  m_LightsUseLinearIntensity: 0\n  m_LightsUseColorTemperature: 0\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/InputManager.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!13 &1\nInputManager:\n  m_ObjectHideFlags: 0\n  serializedVersion: 2\n  m_Axes:\n  - serializedVersion: 3\n    m_Name: Horizontal\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: left\n    positiveButton: right\n    altNegativeButton: a\n    altPositiveButton: d\n    gravity: 3\n    dead: 0.001\n    sensitivity: 3\n    snap: 1\n    invert: 0\n    type: 0\n    axis: 0\n    joyNum: 0\n  - serializedVersion: 3\n    m_Name: Vertical\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: down\n    positiveButton: up\n    altNegativeButton: s\n    altPositiveButton: w\n    gravity: 3\n    dead: 0.001\n    sensitivity: 3\n    snap: 1\n    invert: 0\n    type: 0\n    axis: 0\n    joyNum: 0\n  - serializedVersion: 3\n    m_Name: Fire1\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: \n    positiveButton: left ctrl\n    altNegativeButton: \n    altPositiveButton: mouse 0\n    gravity: 1000\n    dead: 0.001\n    sensitivity: 1000\n    snap: 0\n    invert: 0\n    type: 0\n    axis: 0\n    joyNum: 0\n  - serializedVersion: 3\n    m_Name: Fire2\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: \n    positiveButton: left alt\n    altNegativeButton: \n    altPositiveButton: mouse 1\n    gravity: 1000\n    dead: 0.001\n    sensitivity: 1000\n    snap: 0\n    invert: 0\n    type: 0\n    axis: 0\n    joyNum: 0\n  - serializedVersion: 3\n    m_Name: Fire3\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: \n    positiveButton: left shift\n    altNegativeButton: \n    altPositiveButton: mouse 2\n    gravity: 1000\n    dead: 0.001\n    sensitivity: 1000\n    snap: 0\n    invert: 0\n    type: 0\n    axis: 0\n    joyNum: 0\n  - serializedVersion: 3\n    m_Name: Jump\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: \n    positiveButton: space\n    altNegativeButton: \n    altPositiveButton: \n    gravity: 1000\n    dead: 0.001\n    sensitivity: 1000\n    snap: 0\n    invert: 0\n    type: 0\n    axis: 0\n    joyNum: 0\n  - serializedVersion: 3\n    m_Name: Mouse X\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: \n    positiveButton: \n    altNegativeButton: \n    altPositiveButton: \n    gravity: 0\n    dead: 0\n    sensitivity: 0.1\n    snap: 0\n    invert: 0\n    type: 1\n    axis: 0\n    joyNum: 0\n  - serializedVersion: 3\n    m_Name: Mouse Y\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: \n    positiveButton: \n    altNegativeButton: \n    altPositiveButton: \n    gravity: 0\n    dead: 0\n    sensitivity: 0.1\n    snap: 0\n    invert: 0\n    type: 1\n    axis: 1\n    joyNum: 0\n  - serializedVersion: 3\n    m_Name: Mouse ScrollWheel\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: \n    positiveButton: \n    altNegativeButton: \n    altPositiveButton: \n    gravity: 0\n    dead: 0\n    sensitivity: 0.1\n    snap: 0\n    invert: 0\n    type: 1\n    axis: 2\n    joyNum: 0\n  - serializedVersion: 3\n    m_Name: Horizontal\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: \n    positiveButton: \n    altNegativeButton: \n    altPositiveButton: \n    gravity: 0\n    dead: 0.19\n    sensitivity: 1\n    snap: 0\n    invert: 0\n    type: 2\n    axis: 0\n    joyNum: 0\n  - serializedVersion: 3\n    m_Name: Vertical\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: \n    positiveButton: \n    altNegativeButton: \n    altPositiveButton: \n    gravity: 0\n    dead: 0.19\n    sensitivity: 1\n    snap: 0\n    invert: 1\n    type: 2\n    axis: 1\n    joyNum: 0\n  - serializedVersion: 3\n    m_Name: Fire1\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: \n    positiveButton: joystick button 0\n    altNegativeButton: \n    altPositiveButton: \n    gravity: 1000\n    dead: 0.001\n    sensitivity: 1000\n    snap: 0\n    invert: 0\n    type: 0\n    axis: 0\n    joyNum: 0\n  - serializedVersion: 3\n    m_Name: Fire2\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: \n    positiveButton: joystick button 1\n    altNegativeButton: \n    altPositiveButton: \n    gravity: 1000\n    dead: 0.001\n    sensitivity: 1000\n    snap: 0\n    invert: 0\n    type: 0\n    axis: 0\n    joyNum: 0\n  - serializedVersion: 3\n    m_Name: Fire3\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: \n    positiveButton: joystick button 2\n    altNegativeButton: \n    altPositiveButton: \n    gravity: 1000\n    dead: 0.001\n    sensitivity: 1000\n    snap: 0\n    invert: 0\n    type: 0\n    axis: 0\n    joyNum: 0\n  - serializedVersion: 3\n    m_Name: Jump\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: \n    positiveButton: joystick button 3\n    altNegativeButton: \n    altPositiveButton: \n    gravity: 1000\n    dead: 0.001\n    sensitivity: 1000\n    snap: 0\n    invert: 0\n    type: 0\n    axis: 0\n    joyNum: 0\n  - serializedVersion: 3\n    m_Name: Submit\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: \n    positiveButton: return\n    altNegativeButton: \n    altPositiveButton: joystick button 0\n    gravity: 1000\n    dead: 0.001\n    sensitivity: 1000\n    snap: 0\n    invert: 0\n    type: 0\n    axis: 0\n    joyNum: 0\n  - serializedVersion: 3\n    m_Name: Submit\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: \n    positiveButton: enter\n    altNegativeButton: \n    altPositiveButton: space\n    gravity: 1000\n    dead: 0.001\n    sensitivity: 1000\n    snap: 0\n    invert: 0\n    type: 0\n    axis: 0\n    joyNum: 0\n  - serializedVersion: 3\n    m_Name: Cancel\n    descriptiveName: \n    descriptiveNegativeName: \n    negativeButton: \n    positiveButton: escape\n    altNegativeButton: \n    altPositiveButton: joystick button 1\n    gravity: 1000\n    dead: 0.001\n    sensitivity: 1000\n    snap: 0\n    invert: 0\n    type: 0\n    axis: 0\n    joyNum: 0\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/MemorySettings.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!387306366 &1\nMemorySettings:\n  m_ObjectHideFlags: 0\n  m_EditorMemorySettings:\n    m_MainAllocatorBlockSize: -1\n    m_ThreadAllocatorBlockSize: -1\n    m_MainGfxBlockSize: -1\n    m_ThreadGfxBlockSize: -1\n    m_CacheBlockSize: -1\n    m_TypetreeBlockSize: -1\n    m_ProfilerBlockSize: -1\n    m_ProfilerEditorBlockSize: -1\n    m_BucketAllocatorGranularity: -1\n    m_BucketAllocatorBucketsCount: -1\n    m_BucketAllocatorBlockSize: -1\n    m_BucketAllocatorBlockCount: -1\n    m_ProfilerBucketAllocatorGranularity: -1\n    m_ProfilerBucketAllocatorBucketsCount: -1\n    m_ProfilerBucketAllocatorBlockSize: -1\n    m_ProfilerBucketAllocatorBlockCount: -1\n    m_TempAllocatorSizeMain: -1\n    m_JobTempAllocatorBlockSize: -1\n    m_BackgroundJobTempAllocatorBlockSize: -1\n    m_JobTempAllocatorReducedBlockSize: -1\n    m_TempAllocatorSizeGIBakingWorker: -1\n    m_TempAllocatorSizeNavMeshWorker: -1\n    m_TempAllocatorSizeAudioWorker: -1\n    m_TempAllocatorSizeCloudWorker: -1\n    m_TempAllocatorSizeGfx: -1\n    m_TempAllocatorSizeJobWorker: -1\n    m_TempAllocatorSizeBackgroundWorker: -1\n    m_TempAllocatorSizePreloadManager: -1\n  m_PlatformMemorySettings: {}\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/NavMeshAreas.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!126 &1\nNavMeshProjectSettings:\n  m_ObjectHideFlags: 0\n  serializedVersion: 2\n  areas:\n  - name: Walkable\n    cost: 1\n  - name: Not Walkable\n    cost: 1\n  - name: Jump\n    cost: 2\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  - name: \n    cost: 1\n  m_LastAgentTypeID: -887442657\n  m_Settings:\n  - serializedVersion: 2\n    agentTypeID: 0\n    agentRadius: 0.5\n    agentHeight: 2\n    agentSlope: 45\n    agentClimb: 0.75\n    ledgeDropHeight: 0\n    maxJumpAcrossDistance: 0\n    minRegionArea: 2\n    manualCellSize: 0\n    cellSize: 0.16666667\n    manualTileSize: 0\n    tileSize: 256\n    accuratePlacement: 0\n    debug:\n      m_Flags: 0\n  m_SettingNames:\n  - Humanoid\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/NetworkManager.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!149 &1\nNetworkManager:\n  m_ObjectHideFlags: 0\n  m_DebugLevel: 0\n  m_Sendrate: 15\n  m_AssetToPrefab: {}\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/PackageManagerSettings.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!114 &1\nMonoBehaviour:\n  m_ObjectHideFlags: 61\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 0}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_EnablePreviewPackages: 0\n  m_EnablePackageDependencies: 0\n  m_AdvancedSettingsExpanded: 1\n  m_ScopedRegistriesSettingsExpanded: 1\n  oneTimeWarningShown: 0\n  m_Registries:\n  - m_Id: main\n    m_Name: \n    m_Url: https://packages.unity.com\n    m_Scopes: []\n    m_IsDefault: 1\n    m_Capabilities: 7\n  m_UserSelectedRegistryName: \n  m_UserAddingNewScopedRegistry: 0\n  m_RegistryInfoDraft:\n    m_ErrorMessage: \n    m_Original:\n      m_Id: \n      m_Name: \n      m_Url: \n      m_Scopes: []\n      m_IsDefault: 0\n      m_Capabilities: 0\n    m_Modified: 0\n    m_Name: \n    m_Url: \n    m_Scopes:\n    - \n    m_SelectedScopeIndex: 0\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/Physics2DSettings.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!19 &1\nPhysics2DSettings:\n  m_ObjectHideFlags: 0\n  serializedVersion: 4\n  m_Gravity: {x: 0, y: -9.81}\n  m_DefaultMaterial: {fileID: 0}\n  m_VelocityIterations: 8\n  m_PositionIterations: 3\n  m_VelocityThreshold: 1\n  m_MaxLinearCorrection: 0.2\n  m_MaxAngularCorrection: 8\n  m_MaxTranslationSpeed: 100\n  m_MaxRotationSpeed: 360\n  m_BaumgarteScale: 0.2\n  m_BaumgarteTimeOfImpactScale: 0.75\n  m_TimeToSleep: 0.5\n  m_LinearSleepTolerance: 0.01\n  m_AngularSleepTolerance: 2\n  m_DefaultContactOffset: 0.01\n  m_JobOptions:\n    serializedVersion: 2\n    useMultithreading: 0\n    useConsistencySorting: 0\n    m_InterpolationPosesPerJob: 100\n    m_NewContactsPerJob: 30\n    m_CollideContactsPerJob: 100\n    m_ClearFlagsPerJob: 200\n    m_ClearBodyForcesPerJob: 200\n    m_SyncDiscreteFixturesPerJob: 50\n    m_SyncContinuousFixturesPerJob: 50\n    m_FindNearestContactsPerJob: 100\n    m_UpdateTriggerContactsPerJob: 100\n    m_IslandSolverCostThreshold: 100\n    m_IslandSolverBodyCostScale: 1\n    m_IslandSolverContactCostScale: 10\n    m_IslandSolverJointCostScale: 10\n    m_IslandSolverBodiesPerJob: 50\n    m_IslandSolverContactsPerJob: 50\n  m_AutoSimulation: 1\n  m_QueriesHitTriggers: 1\n  m_QueriesStartInColliders: 1\n  m_CallbacksOnDisable: 1\n  m_ReuseCollisionCallbacks: 0\n  m_AutoSyncTransforms: 0\n  m_AlwaysShowColliders: 0\n  m_ShowColliderSleep: 1\n  m_ShowColliderContacts: 0\n  m_ShowColliderAABB: 0\n  m_ContactArrowScale: 0.2\n  m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412}\n  m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432}\n  m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745}\n  m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804}\n  m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/PresetManager.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!1386491679 &1\nPresetManager:\n  m_ObjectHideFlags: 0\n  m_DefaultList: []\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/ProjectSettings.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!129 &1\nPlayerSettings:\n  m_ObjectHideFlags: 0\n  serializedVersion: 26\n  productGUID: 904cd7a3163037f42a9204c0e2f2b7bd\n  AndroidProfiler: 0\n  AndroidFilterTouchesWhenObscured: 0\n  AndroidEnableSustainedPerformanceMode: 0\n  defaultScreenOrientation: 4\n  targetDevice: 2\n  useOnDemandResources: 0\n  accelerometerFrequency: 60\n  companyName: DefaultCompany\n  productName: UniTask\n  defaultCursor: {fileID: 0}\n  cursorHotspot: {x: 0, y: 0}\n  m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}\n  m_ShowUnitySplashScreen: 1\n  m_ShowUnitySplashLogo: 1\n  m_SplashScreenOverlayOpacity: 1\n  m_SplashScreenAnimation: 1\n  m_SplashScreenLogoStyle: 1\n  m_SplashScreenDrawMode: 0\n  m_SplashScreenBackgroundAnimationZoom: 1\n  m_SplashScreenLogoAnimationZoom: 1\n  m_SplashScreenBackgroundLandscapeAspect: 1\n  m_SplashScreenBackgroundPortraitAspect: 1\n  m_SplashScreenBackgroundLandscapeUvs:\n    serializedVersion: 2\n    x: 0\n    y: 0\n    width: 1\n    height: 1\n  m_SplashScreenBackgroundPortraitUvs:\n    serializedVersion: 2\n    x: 0\n    y: 0\n    width: 1\n    height: 1\n  m_SplashScreenLogos: []\n  m_VirtualRealitySplashScreen: {fileID: 0}\n  m_HolographicTrackingLossScreen: {fileID: 0}\n  defaultScreenWidth: 1024\n  defaultScreenHeight: 768\n  defaultScreenWidthWeb: 960\n  defaultScreenHeightWeb: 600\n  m_StereoRenderingPath: 0\n  m_ActiveColorSpace: 0\n  unsupportedMSAAFallback: 0\n  m_SpriteBatchVertexThreshold: 300\n  m_MTRendering: 1\n  mipStripping: 0\n  numberOfMipsStripped: 0\n  numberOfMipsStrippedPerMipmapLimitGroup: {}\n  m_StackTraceTypes: 010000000100000001000000010000000100000001000000\n  iosShowActivityIndicatorOnLoading: -1\n  androidShowActivityIndicatorOnLoading: -1\n  iosUseCustomAppBackgroundBehavior: 0\n  allowedAutorotateToPortrait: 1\n  allowedAutorotateToPortraitUpsideDown: 1\n  allowedAutorotateToLandscapeRight: 1\n  allowedAutorotateToLandscapeLeft: 1\n  useOSAutorotation: 1\n  use32BitDisplayBuffer: 1\n  preserveFramebufferAlpha: 0\n  disableDepthAndStencilBuffers: 0\n  androidStartInFullscreen: 1\n  androidRenderOutsideSafeArea: 1\n  androidUseSwappy: 0\n  androidBlitType: 0\n  androidResizableWindow: 0\n  androidDefaultWindowWidth: 1920\n  androidDefaultWindowHeight: 1080\n  androidMinimumWindowWidth: 400\n  androidMinimumWindowHeight: 300\n  androidFullscreenMode: 1\n  androidAutoRotationBehavior: 1\n  defaultIsNativeResolution: 1\n  macRetinaSupport: 1\n  runInBackground: 1\n  captureSingleScreen: 0\n  muteOtherAudioSources: 0\n  Prepare IOS For Recording: 0\n  Force IOS Speakers When Recording: 0\n  deferSystemGesturesMode: 0\n  hideHomeButton: 0\n  submitAnalytics: 1\n  usePlayerLog: 1\n  dedicatedServerOptimizations: 0\n  bakeCollisionMeshes: 0\n  forceSingleInstance: 0\n  useFlipModelSwapchain: 1\n  resizableWindow: 1\n  useMacAppStoreValidation: 0\n  macAppStoreCategory: public.app-category.games\n  gpuSkinning: 0\n  xboxPIXTextureCapture: 0\n  xboxEnableAvatar: 0\n  xboxEnableKinect: 0\n  xboxEnableKinectAutoTracking: 0\n  xboxEnableFitness: 0\n  visibleInBackground: 1\n  allowFullscreenSwitch: 1\n  fullscreenMode: 3\n  xboxSpeechDB: 0\n  xboxEnableHeadOrientation: 0\n  xboxEnableGuest: 0\n  xboxEnablePIXSampling: 0\n  metalFramebufferOnly: 0\n  xboxOneResolution: 0\n  xboxOneSResolution: 0\n  xboxOneXResolution: 3\n  xboxOneMonoLoggingLevel: 0\n  xboxOneLoggingLevel: 1\n  xboxOneDisableEsram: 0\n  xboxOneEnableTypeOptimization: 0\n  xboxOnePresentImmediateThreshold: 0\n  switchQueueCommandMemory: 0\n  switchQueueControlMemory: 16384\n  switchQueueComputeMemory: 262144\n  switchNVNShaderPoolsGranularity: 33554432\n  switchNVNDefaultPoolsGranularity: 16777216\n  switchNVNOtherPoolsGranularity: 16777216\n  switchGpuScratchPoolGranularity: 2097152\n  switchAllowGpuScratchShrinking: 0\n  switchNVNMaxPublicTextureIDCount: 0\n  switchNVNMaxPublicSamplerIDCount: 0\n  switchNVNGraphicsFirmwareMemory: 32\n  switchMaxWorkerMultiple: 8\n  stadiaPresentMode: 0\n  stadiaTargetFramerate: 0\n  vulkanNumSwapchainBuffers: 3\n  vulkanEnableSetSRGBWrite: 0\n  vulkanEnablePreTransform: 0\n  vulkanEnableLateAcquireNextImage: 0\n  vulkanEnableCommandBufferRecycling: 1\n  loadStoreDebugModeEnabled: 0\n  visionOSBundleVersion: 1.0\n  tvOSBundleVersion: 1.0\n  bundleVersion: 0.1\n  preloadedAssets: []\n  metroInputSource: 0\n  wsaTransparentSwapchain: 0\n  m_HolographicPauseOnTrackingLoss: 1\n  xboxOneDisableKinectGpuReservation: 1\n  xboxOneEnable7thCore: 1\n  vrSettings:\n    enable360StereoCapture: 0\n  isWsaHolographicRemotingEnabled: 0\n  enableFrameTimingStats: 0\n  enableOpenGLProfilerGPURecorders: 1\n  allowHDRDisplaySupport: 0\n  useHDRDisplay: 0\n  hdrBitDepth: 0\n  m_ColorGamuts: 00000000\n  targetPixelDensity: 30\n  resolutionScalingMode: 0\n  resetResolutionOnWindowResize: 0\n  androidSupportedAspectRatio: 1\n  androidMaxAspectRatio: 2.1\n  applicationIdentifier:\n    Standalone: com.DefaultCompany.UniTask\n  buildNumber:\n    Standalone: 0\n    VisionOS: 0\n    iPhone: 0\n    tvOS: 0\n  overrideDefaultApplicationIdentifier: 0\n  AndroidBundleVersionCode: 1\n  AndroidMinSdkVersion: 22\n  AndroidTargetSdkVersion: 0\n  AndroidPreferredInstallLocation: 1\n  aotOptions: \n  stripEngineCode: 1\n  iPhoneStrippingLevel: 0\n  iPhoneScriptCallOptimization: 0\n  ForceInternetPermission: 0\n  ForceSDCardPermission: 0\n  CreateWallpaper: 0\n  APKExpansionFiles: 0\n  keepLoadedShadersAlive: 0\n  StripUnusedMeshComponents: 1\n  strictShaderVariantMatching: 0\n  VertexChannelCompressionMask: 4054\n  iPhoneSdkVersion: 988\n  iOSTargetOSVersionString: 12.0\n  tvOSSdkVersion: 0\n  tvOSRequireExtendedGameController: 0\n  tvOSTargetOSVersionString: 12.0\n  VisionOSSdkVersion: 0\n  VisionOSTargetOSVersionString: 1.0\n  uIPrerenderedIcon: 0\n  uIRequiresPersistentWiFi: 0\n  uIRequiresFullScreen: 1\n  uIStatusBarHidden: 1\n  uIExitOnSuspend: 0\n  uIStatusBarStyle: 0\n  appleTVSplashScreen: {fileID: 0}\n  appleTVSplashScreen2x: {fileID: 0}\n  tvOSSmallIconLayers: []\n  tvOSSmallIconLayers2x: []\n  tvOSLargeIconLayers: []\n  tvOSLargeIconLayers2x: []\n  tvOSTopShelfImageLayers: []\n  tvOSTopShelfImageLayers2x: []\n  tvOSTopShelfImageWideLayers: []\n  tvOSTopShelfImageWideLayers2x: []\n  iOSLaunchScreenType: 0\n  iOSLaunchScreenPortrait: {fileID: 0}\n  iOSLaunchScreenLandscape: {fileID: 0}\n  iOSLaunchScreenBackgroundColor:\n    serializedVersion: 2\n    rgba: 0\n  iOSLaunchScreenFillPct: 100\n  iOSLaunchScreenSize: 100\n  iOSLaunchScreenCustomXibPath: \n  iOSLaunchScreeniPadType: 0\n  iOSLaunchScreeniPadImage: {fileID: 0}\n  iOSLaunchScreeniPadBackgroundColor:\n    serializedVersion: 2\n    rgba: 0\n  iOSLaunchScreeniPadFillPct: 100\n  iOSLaunchScreeniPadSize: 100\n  iOSLaunchScreeniPadCustomXibPath: \n  iOSLaunchScreenCustomStoryboardPath: \n  iOSLaunchScreeniPadCustomStoryboardPath: \n  iOSDeviceRequirements: []\n  iOSURLSchemes: []\n  macOSURLSchemes: []\n  iOSBackgroundModes: 0\n  iOSMetalForceHardShadows: 0\n  metalEditorSupport: 1\n  metalAPIValidation: 1\n  metalCompileShaderBinary: 0\n  iOSRenderExtraFrameOnPause: 0\n  iosCopyPluginsCodeInsteadOfSymlink: 0\n  appleDeveloperTeamID: \n  iOSManualSigningProvisioningProfileID: \n  tvOSManualSigningProvisioningProfileID: \n  VisionOSManualSigningProvisioningProfileID: \n  iOSManualSigningProvisioningProfileType: 0\n  tvOSManualSigningProvisioningProfileType: 0\n  VisionOSManualSigningProvisioningProfileType: 0\n  appleEnableAutomaticSigning: 0\n  iOSRequireARKit: 0\n  iOSAutomaticallyDetectAndAddCapabilities: 1\n  appleEnableProMotion: 0\n  shaderPrecisionModel: 0\n  clonedFromGUID: 5f34be1353de5cf4398729fda238591b\n  templatePackageId: com.unity.template.2d@3.1.0\n  templateDefaultScene: Assets/Scenes/SampleScene.unity\n  useCustomMainManifest: 0\n  useCustomLauncherManifest: 0\n  useCustomMainGradleTemplate: 0\n  useCustomLauncherGradleManifest: 0\n  useCustomBaseGradleTemplate: 0\n  useCustomGradlePropertiesTemplate: 0\n  useCustomGradleSettingsTemplate: 0\n  useCustomProguardFile: 0\n  AndroidTargetArchitectures: 1\n  AndroidTargetDevices: 0\n  AndroidSplashScreenScale: 0\n  androidSplashScreen: {fileID: 0}\n  AndroidKeystoreName: '{inproject}: '\n  AndroidKeyaliasName: \n  AndroidEnableArmv9SecurityFeatures: 0\n  AndroidBuildApkPerCpuArchitecture: 0\n  AndroidTVCompatibility: 0\n  AndroidIsGame: 1\n  AndroidEnableTango: 0\n  androidEnableBanner: 1\n  androidUseLowAccuracyLocation: 0\n  androidUseCustomKeystore: 0\n  m_AndroidBanners:\n  - width: 320\n    height: 180\n    banner: {fileID: 0}\n  androidGamepadSupportLevel: 0\n  chromeosInputEmulation: 1\n  AndroidMinifyRelease: 0\n  AndroidMinifyDebug: 0\n  AndroidValidateAppBundleSize: 1\n  AndroidAppBundleSizeToValidate: 100\n  m_BuildTargetIcons: []\n  m_BuildTargetPlatformIcons: []\n  m_BuildTargetBatching: []\n  m_BuildTargetShaderSettings: []\n  m_BuildTargetGraphicsJobs:\n  - m_BuildTarget: MacStandaloneSupport\n    m_GraphicsJobs: 0\n  - m_BuildTarget: Switch\n    m_GraphicsJobs: 0\n  - m_BuildTarget: MetroSupport\n    m_GraphicsJobs: 0\n  - m_BuildTarget: AppleTVSupport\n    m_GraphicsJobs: 0\n  - m_BuildTarget: BJMSupport\n    m_GraphicsJobs: 0\n  - m_BuildTarget: LinuxStandaloneSupport\n    m_GraphicsJobs: 0\n  - m_BuildTarget: PS4Player\n    m_GraphicsJobs: 0\n  - m_BuildTarget: iOSSupport\n    m_GraphicsJobs: 0\n  - m_BuildTarget: WindowsStandaloneSupport\n    m_GraphicsJobs: 0\n  - m_BuildTarget: XboxOnePlayer\n    m_GraphicsJobs: 0\n  - m_BuildTarget: LuminSupport\n    m_GraphicsJobs: 0\n  - m_BuildTarget: AndroidPlayer\n    m_GraphicsJobs: 0\n  - m_BuildTarget: WebGLSupport\n    m_GraphicsJobs: 0\n  m_BuildTargetGraphicsJobMode:\n  - m_BuildTarget: PS4Player\n    m_GraphicsJobMode: 0\n  - m_BuildTarget: XboxOnePlayer\n    m_GraphicsJobMode: 0\n  m_BuildTargetGraphicsAPIs:\n  - m_BuildTarget: AndroidPlayer\n    m_APIs: 150000000b000000\n    m_Automatic: 1\n  - m_BuildTarget: iOSSupport\n    m_APIs: 10000000\n    m_Automatic: 1\n  m_BuildTargetVRSettings: []\n  m_DefaultShaderChunkSizeInMB: 16\n  m_DefaultShaderChunkCount: 0\n  openGLRequireES31: 0\n  openGLRequireES31AEP: 0\n  openGLRequireES32: 0\n  m_TemplateCustomTags: {}\n  mobileMTRendering:\n    Android: 1\n    iPhone: 1\n    tvOS: 1\n  m_BuildTargetGroupLightmapEncodingQuality: []\n  m_BuildTargetGroupHDRCubemapEncodingQuality: []\n  m_BuildTargetGroupLightmapSettings: []\n  m_BuildTargetGroupLoadStoreDebugModeSettings: []\n  m_BuildTargetNormalMapEncoding: []\n  m_BuildTargetDefaultTextureCompressionFormat: []\n  playModeTestRunnerEnabled: 0\n  runPlayModeTestAsEditModeTest: 0\n  actionOnDotNetUnhandledException: 1\n  enableInternalProfiler: 0\n  logObjCUncaughtExceptions: 1\n  enableCrashReportAPI: 0\n  cameraUsageDescription: \n  locationUsageDescription: \n  microphoneUsageDescription: \n  bluetoothUsageDescription: \n  macOSTargetOSVersion: 10.13.0\n  switchNMETAOverride: \n  switchNetLibKey: \n  switchSocketMemoryPoolSize: 6144\n  switchSocketAllocatorPoolSize: 128\n  switchSocketConcurrencyLimit: 14\n  switchScreenResolutionBehavior: 2\n  switchUseCPUProfiler: 0\n  switchEnableFileSystemTrace: 0\n  switchLTOSetting: 0\n  switchApplicationID: 0x01004b9000490000\n  switchNSODependencies: \n  switchCompilerFlags: \n  switchTitleNames_0: \n  switchTitleNames_1: \n  switchTitleNames_2: \n  switchTitleNames_3: \n  switchTitleNames_4: \n  switchTitleNames_5: \n  switchTitleNames_6: \n  switchTitleNames_7: \n  switchTitleNames_8: \n  switchTitleNames_9: \n  switchTitleNames_10: \n  switchTitleNames_11: \n  switchTitleNames_12: \n  switchTitleNames_13: \n  switchTitleNames_14: \n  switchTitleNames_15: \n  switchPublisherNames_0: \n  switchPublisherNames_1: \n  switchPublisherNames_2: \n  switchPublisherNames_3: \n  switchPublisherNames_4: \n  switchPublisherNames_5: \n  switchPublisherNames_6: \n  switchPublisherNames_7: \n  switchPublisherNames_8: \n  switchPublisherNames_9: \n  switchPublisherNames_10: \n  switchPublisherNames_11: \n  switchPublisherNames_12: \n  switchPublisherNames_13: \n  switchPublisherNames_14: \n  switchPublisherNames_15: \n  switchIcons_0: {fileID: 0}\n  switchIcons_1: {fileID: 0}\n  switchIcons_2: {fileID: 0}\n  switchIcons_3: {fileID: 0}\n  switchIcons_4: {fileID: 0}\n  switchIcons_5: {fileID: 0}\n  switchIcons_6: {fileID: 0}\n  switchIcons_7: {fileID: 0}\n  switchIcons_8: {fileID: 0}\n  switchIcons_9: {fileID: 0}\n  switchIcons_10: {fileID: 0}\n  switchIcons_11: {fileID: 0}\n  switchIcons_12: {fileID: 0}\n  switchIcons_13: {fileID: 0}\n  switchIcons_14: {fileID: 0}\n  switchIcons_15: {fileID: 0}\n  switchSmallIcons_0: {fileID: 0}\n  switchSmallIcons_1: {fileID: 0}\n  switchSmallIcons_2: {fileID: 0}\n  switchSmallIcons_3: {fileID: 0}\n  switchSmallIcons_4: {fileID: 0}\n  switchSmallIcons_5: {fileID: 0}\n  switchSmallIcons_6: {fileID: 0}\n  switchSmallIcons_7: {fileID: 0}\n  switchSmallIcons_8: {fileID: 0}\n  switchSmallIcons_9: {fileID: 0}\n  switchSmallIcons_10: {fileID: 0}\n  switchSmallIcons_11: {fileID: 0}\n  switchSmallIcons_12: {fileID: 0}\n  switchSmallIcons_13: {fileID: 0}\n  switchSmallIcons_14: {fileID: 0}\n  switchSmallIcons_15: {fileID: 0}\n  switchManualHTML: \n  switchAccessibleURLs: \n  switchLegalInformation: \n  switchMainThreadStackSize: 1048576\n  switchPresenceGroupId: \n  switchLogoHandling: 0\n  switchReleaseVersion: 0\n  switchDisplayVersion: 1.0.0\n  switchStartupUserAccount: 0\n  switchSupportedLanguagesMask: 0\n  switchLogoType: 0\n  switchApplicationErrorCodeCategory: \n  switchUserAccountSaveDataSize: 0\n  switchUserAccountSaveDataJournalSize: 0\n  switchApplicationAttribute: 0\n  switchCardSpecSize: -1\n  switchCardSpecClock: -1\n  switchRatingsMask: 0\n  switchRatingsInt_0: 0\n  switchRatingsInt_1: 0\n  switchRatingsInt_2: 0\n  switchRatingsInt_3: 0\n  switchRatingsInt_4: 0\n  switchRatingsInt_5: 0\n  switchRatingsInt_6: 0\n  switchRatingsInt_7: 0\n  switchRatingsInt_8: 0\n  switchRatingsInt_9: 0\n  switchRatingsInt_10: 0\n  switchRatingsInt_11: 0\n  switchRatingsInt_12: 0\n  switchLocalCommunicationIds_0: \n  switchLocalCommunicationIds_1: \n  switchLocalCommunicationIds_2: \n  switchLocalCommunicationIds_3: \n  switchLocalCommunicationIds_4: \n  switchLocalCommunicationIds_5: \n  switchLocalCommunicationIds_6: \n  switchLocalCommunicationIds_7: \n  switchParentalControl: 0\n  switchAllowsScreenshot: 1\n  switchAllowsVideoCapturing: 1\n  switchAllowsRuntimeAddOnContentInstall: 0\n  switchDataLossConfirmation: 0\n  switchUserAccountLockEnabled: 0\n  switchSystemResourceMemory: 16777216\n  switchSupportedNpadStyles: 3\n  switchNativeFsCacheSize: 32\n  switchIsHoldTypeHorizontal: 0\n  switchSupportedNpadCount: 8\n  switchEnableTouchScreen: 1\n  switchSocketConfigEnabled: 0\n  switchTcpInitialSendBufferSize: 32\n  switchTcpInitialReceiveBufferSize: 64\n  switchTcpAutoSendBufferSizeMax: 256\n  switchTcpAutoReceiveBufferSizeMax: 256\n  switchUdpSendBufferSize: 9\n  switchUdpReceiveBufferSize: 42\n  switchSocketBufferEfficiency: 4\n  switchSocketInitializeEnabled: 1\n  switchNetworkInterfaceManagerInitializeEnabled: 1\n  switchUseNewStyleFilepaths: 0\n  switchUseLegacyFmodPriorities: 0\n  switchUseMicroSleepForYield: 1\n  switchEnableRamDiskSupport: 0\n  switchMicroSleepForYieldTime: 25\n  switchRamDiskSpaceSize: 12\n  ps4NPAgeRating: 12\n  ps4NPTitleSecret: \n  ps4NPTrophyPackPath: \n  ps4ParentalLevel: 11\n  ps4ContentID: ED1633-NPXX51362_00-0000000000000000\n  ps4Category: 0\n  ps4MasterVersion: 01.00\n  ps4AppVersion: 01.00\n  ps4AppType: 0\n  ps4ParamSfxPath: \n  ps4VideoOutPixelFormat: 0\n  ps4VideoOutInitialWidth: 1920\n  ps4VideoOutBaseModeInitialWidth: 1920\n  ps4VideoOutReprojectionRate: 60\n  ps4PronunciationXMLPath: \n  ps4PronunciationSIGPath: \n  ps4BackgroundImagePath: \n  ps4StartupImagePath: \n  ps4StartupImagesFolder: \n  ps4IconImagesFolder: \n  ps4SaveDataImagePath: \n  ps4SdkOverride: \n  ps4BGMPath: \n  ps4ShareFilePath: \n  ps4ShareOverlayImagePath: \n  ps4PrivacyGuardImagePath: \n  ps4ExtraSceSysFile: \n  ps4NPtitleDatPath: \n  ps4RemotePlayKeyAssignment: -1\n  ps4RemotePlayKeyMappingDir: \n  ps4PlayTogetherPlayerCount: 0\n  ps4EnterButtonAssignment: 1\n  ps4ApplicationParam1: 0\n  ps4ApplicationParam2: 0\n  ps4ApplicationParam3: 0\n  ps4ApplicationParam4: 0\n  ps4DownloadDataSize: 0\n  ps4GarlicHeapSize: 2048\n  ps4ProGarlicHeapSize: 2560\n  playerPrefsMaxSize: 32768\n  ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ\n  ps4pnSessions: 1\n  ps4pnPresence: 1\n  ps4pnFriends: 1\n  ps4pnGameCustomData: 1\n  playerPrefsSupport: 0\n  enableApplicationExit: 0\n  resetTempFolder: 1\n  restrictedAudioUsageRights: 0\n  ps4UseResolutionFallback: 0\n  ps4ReprojectionSupport: 0\n  ps4UseAudio3dBackend: 0\n  ps4UseLowGarlicFragmentationMode: 1\n  ps4SocialScreenEnabled: 0\n  ps4ScriptOptimizationLevel: 0\n  ps4Audio3dVirtualSpeakerCount: 14\n  ps4attribCpuUsage: 0\n  ps4PatchPkgPath: \n  ps4PatchLatestPkgPath: \n  ps4PatchChangeinfoPath: \n  ps4PatchDayOne: 0\n  ps4attribUserManagement: 0\n  ps4attribMoveSupport: 0\n  ps4attrib3DSupport: 0\n  ps4attribShareSupport: 0\n  ps4attribExclusiveVR: 0\n  ps4disableAutoHideSplash: 0\n  ps4videoRecordingFeaturesUsed: 0\n  ps4contentSearchFeaturesUsed: 0\n  ps4CompatibilityPS5: 0\n  ps4AllowPS5Detection: 0\n  ps4GPU800MHz: 1\n  ps4attribEyeToEyeDistanceSettingVR: 0\n  ps4IncludedModules: []\n  ps4attribVROutputEnabled: 0\n  monoEnv: \n  splashScreenBackgroundSourceLandscape: {fileID: 0}\n  splashScreenBackgroundSourcePortrait: {fileID: 0}\n  blurSplashScreenBackground: 1\n  spritePackerPolicy: \n  webGLMemorySize: 16\n  webGLExceptionSupport: 1\n  webGLNameFilesAsHashes: 0\n  webGLShowDiagnostics: 0\n  webGLDataCaching: 1\n  webGLDebugSymbols: 0\n  webGLEmscriptenArgs: \n  webGLModulesDirectory: \n  webGLTemplate: APPLICATION:Default\n  webGLAnalyzeBuildSize: 0\n  webGLUseEmbeddedResources: 0\n  webGLCompressionFormat: 1\n  webGLWasmArithmeticExceptions: 0\n  webGLLinkerTarget: 1\n  webGLThreadsSupport: 0\n  webGLDecompressionFallback: 0\n  webGLInitialMemorySize: 32\n  webGLMaximumMemorySize: 2048\n  webGLMemoryGrowthMode: 2\n  webGLMemoryLinearGrowthStep: 16\n  webGLMemoryGeometricGrowthStep: 0.2\n  webGLMemoryGeometricGrowthCap: 96\n  webGLPowerPreference: 2\n  scriptingDefineSymbols: {}\n  additionalCompilerArguments: {}\n  platformArchitecture: {}\n  scriptingBackend:\n    Android: 1\n    Server: 1\n    Standalone: 1\n  il2cppCompilerConfiguration: {}\n  il2cppCodeGeneration: {}\n  managedStrippingLevel:\n    Android: 1\n    EmbeddedLinux: 1\n    GameCoreScarlett: 1\n    GameCoreXboxOne: 1\n    Nintendo Switch: 1\n    PS4: 1\n    PS5: 1\n    QNX: 1\n    Stadia: 1\n    Standalone: 1\n    VisionOS: 1\n    WebGL: 1\n    Windows Store Apps: 1\n    XboxOne: 1\n    iPhone: 1\n    tvOS: 1\n  incrementalIl2cppBuild: {}\n  suppressCommonWarnings: 1\n  allowUnsafeCode: 0\n  useDeterministicCompilation: 1\n  additionalIl2CppArgs: \n  scriptingRuntimeVersion: 1\n  gcIncremental: 0\n  gcWBarrierValidation: 0\n  apiCompatibilityLevelPerPlatform:\n    Standalone: 6\n  m_RenderingPath: 1\n  m_MobileRenderingPath: 1\n  metroPackageName: Template_2D\n  metroPackageVersion: \n  metroCertificatePath: \n  metroCertificatePassword: \n  metroCertificateSubject: \n  metroCertificateIssuer: \n  metroCertificateNotAfter: 0000000000000000\n  metroApplicationDescription: Template_2D\n  wsaImages: {}\n  metroTileShortName: \n  metroTileShowName: 0\n  metroMediumTileShowName: 0\n  metroLargeTileShowName: 0\n  metroWideTileShowName: 0\n  metroSupportStreamingInstall: 0\n  metroLastRequiredScene: 0\n  metroDefaultTileSize: 1\n  metroTileForegroundText: 2\n  metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0}\n  metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628,\n    a: 1}\n  metroSplashScreenUseBackgroundColor: 0\n  syncCapabilities: 0\n  platformCapabilities: {}\n  metroTargetDeviceFamilies: {}\n  metroFTAName: \n  metroFTAFileTypes: []\n  metroProtocolName: \n  vcxProjDefaultLanguage: \n  XboxOneProductId: \n  XboxOneUpdateKey: \n  XboxOneSandboxId: \n  XboxOneContentId: \n  XboxOneTitleId: \n  XboxOneSCId: \n  XboxOneGameOsOverridePath: \n  XboxOnePackagingOverridePath: \n  XboxOneAppManifestOverridePath: \n  XboxOneVersion: 1.0.0.0\n  XboxOnePackageEncryption: 0\n  XboxOnePackageUpdateGranularity: 2\n  XboxOneDescription: \n  XboxOneLanguage:\n  - enus\n  XboxOneCapability: []\n  XboxOneGameRating: {}\n  XboxOneIsContentPackage: 0\n  XboxOneEnhancedXboxCompatibilityMode: 0\n  XboxOneEnableGPUVariability: 1\n  XboxOneSockets: {}\n  XboxOneSplashScreen: {fileID: 0}\n  XboxOneAllowedProductIds: []\n  XboxOnePersistentLocalStorageSize: 0\n  XboxOneXTitleMemory: 8\n  XboxOneOverrideIdentityName: \n  XboxOneOverrideIdentityPublisher: \n  vrEditorSettings: {}\n  cloudServicesEnabled:\n    UNet: 1\n  luminIcon:\n    m_Name: \n    m_ModelFolderPath: \n    m_PortalFolderPath: \n  luminCert:\n    m_CertPath: \n    m_SignPackage: 1\n  luminIsChannelApp: 0\n  luminVersion:\n    m_VersionCode: 1\n    m_VersionName: \n  hmiPlayerDataPath: \n  hmiForceSRGBBlit: 1\n  embeddedLinuxEnableGamepadInput: 1\n  hmiLogStartupTiming: 0\n  hmiCpuConfiguration: \n  apiCompatibilityLevel: 6\n  activeInputHandler: 0\n  windowsGamepadBackendHint: 0\n  cloudProjectId: \n  framebufferDepthMemorylessMode: 0\n  qualitySettingsNames: []\n  projectName: \n  organizationId: \n  cloudEnabled: 0\n  legacyClampBlendShapeWeights: 1\n  hmiLoadingImage: {fileID: 0}\n  platformRequiresReadableAssets: 0\n  virtualTexturingSupportEnabled: 0\n  insecureHttpOption: 0\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/ProjectVersion.txt",
    "content": "m_EditorVersion: 2022.3.39f1\nm_EditorVersionWithRevision: 2022.3.39f1 (4e1b0f82c39a)\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/QualitySettings.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!47 &1\nQualitySettings:\n  m_ObjectHideFlags: 0\n  serializedVersion: 5\n  m_CurrentQuality: 3\n  m_QualitySettings:\n  - serializedVersion: 2\n    name: Very Low\n    pixelLightCount: 0\n    shadows: 0\n    shadowResolution: 0\n    shadowProjection: 1\n    shadowCascades: 1\n    shadowDistance: 15\n    shadowNearPlaneOffset: 3\n    shadowCascade2Split: 0.33333334\n    shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}\n    shadowmaskMode: 0\n    blendWeights: 1\n    textureQuality: 1\n    anisotropicTextures: 0\n    antiAliasing: 0\n    softParticles: 0\n    softVegetation: 0\n    realtimeReflectionProbes: 0\n    billboardsFaceCameraPosition: 0\n    vSyncCount: 0\n    lodBias: 0.3\n    maximumLODLevel: 0\n    particleRaycastBudget: 4\n    asyncUploadTimeSlice: 2\n    asyncUploadBufferSize: 16\n    resolutionScalingFixedDPIFactor: 1\n    excludedTargetPlatforms: []\n  - serializedVersion: 2\n    name: Low\n    pixelLightCount: 0\n    shadows: 0\n    shadowResolution: 0\n    shadowProjection: 1\n    shadowCascades: 1\n    shadowDistance: 20\n    shadowNearPlaneOffset: 3\n    shadowCascade2Split: 0.33333334\n    shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}\n    shadowmaskMode: 0\n    blendWeights: 2\n    textureQuality: 0\n    anisotropicTextures: 0\n    antiAliasing: 0\n    softParticles: 0\n    softVegetation: 0\n    realtimeReflectionProbes: 0\n    billboardsFaceCameraPosition: 0\n    vSyncCount: 0\n    lodBias: 0.4\n    maximumLODLevel: 0\n    particleRaycastBudget: 16\n    asyncUploadTimeSlice: 2\n    asyncUploadBufferSize: 16\n    resolutionScalingFixedDPIFactor: 1\n    excludedTargetPlatforms: []\n  - serializedVersion: 2\n    name: Medium\n    pixelLightCount: 1\n    shadows: 0\n    shadowResolution: 0\n    shadowProjection: 1\n    shadowCascades: 1\n    shadowDistance: 20\n    shadowNearPlaneOffset: 3\n    shadowCascade2Split: 0.33333334\n    shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}\n    shadowmaskMode: 0\n    blendWeights: 2\n    textureQuality: 0\n    anisotropicTextures: 0\n    antiAliasing: 0\n    softParticles: 0\n    softVegetation: 0\n    realtimeReflectionProbes: 0\n    billboardsFaceCameraPosition: 0\n    vSyncCount: 1\n    lodBias: 0.7\n    maximumLODLevel: 0\n    particleRaycastBudget: 64\n    asyncUploadTimeSlice: 2\n    asyncUploadBufferSize: 16\n    resolutionScalingFixedDPIFactor: 1\n    excludedTargetPlatforms: []\n  - serializedVersion: 2\n    name: High\n    pixelLightCount: 2\n    shadows: 0\n    shadowResolution: 1\n    shadowProjection: 1\n    shadowCascades: 2\n    shadowDistance: 40\n    shadowNearPlaneOffset: 3\n    shadowCascade2Split: 0.33333334\n    shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}\n    shadowmaskMode: 1\n    blendWeights: 2\n    textureQuality: 0\n    anisotropicTextures: 0\n    antiAliasing: 0\n    softParticles: 0\n    softVegetation: 1\n    realtimeReflectionProbes: 0\n    billboardsFaceCameraPosition: 0\n    vSyncCount: 1\n    lodBias: 1\n    maximumLODLevel: 0\n    particleRaycastBudget: 256\n    asyncUploadTimeSlice: 2\n    asyncUploadBufferSize: 16\n    resolutionScalingFixedDPIFactor: 1\n    excludedTargetPlatforms: []\n  - serializedVersion: 2\n    name: Very High\n    pixelLightCount: 3\n    shadows: 0\n    shadowResolution: 2\n    shadowProjection: 1\n    shadowCascades: 2\n    shadowDistance: 70\n    shadowNearPlaneOffset: 3\n    shadowCascade2Split: 0.33333334\n    shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}\n    shadowmaskMode: 1\n    blendWeights: 4\n    textureQuality: 0\n    anisotropicTextures: 0\n    antiAliasing: 0\n    softParticles: 0\n    softVegetation: 1\n    realtimeReflectionProbes: 0\n    billboardsFaceCameraPosition: 0\n    vSyncCount: 1\n    lodBias: 1.5\n    maximumLODLevel: 0\n    particleRaycastBudget: 1024\n    asyncUploadTimeSlice: 2\n    asyncUploadBufferSize: 16\n    resolutionScalingFixedDPIFactor: 1\n    excludedTargetPlatforms: []\n  - serializedVersion: 2\n    name: Ultra\n    pixelLightCount: 4\n    shadows: 0\n    shadowResolution: 0\n    shadowProjection: 1\n    shadowCascades: 4\n    shadowDistance: 150\n    shadowNearPlaneOffset: 3\n    shadowCascade2Split: 0.33333334\n    shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}\n    shadowmaskMode: 1\n    blendWeights: 4\n    textureQuality: 0\n    anisotropicTextures: 0\n    antiAliasing: 0\n    softParticles: 0\n    softVegetation: 1\n    realtimeReflectionProbes: 0\n    billboardsFaceCameraPosition: 0\n    vSyncCount: 1\n    lodBias: 2\n    maximumLODLevel: 0\n    particleRaycastBudget: 4096\n    asyncUploadTimeSlice: 2\n    asyncUploadBufferSize: 16\n    resolutionScalingFixedDPIFactor: 1\n    excludedTargetPlatforms: []\n  m_PerPlatformDefaultQuality:\n    Android: 2\n    Nintendo 3DS: 5\n    Nintendo Switch: 5\n    PS4: 5\n    PSM: 5\n    PSP2: 2\n    Standalone: 5\n    Tizen: 2\n    WebGL: 3\n    WiiU: 5\n    Windows Store Apps: 5\n    XboxOne: 5\n    iPhone: 2\n    tvOS: 2\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/SceneTemplateSettings.json",
    "content": "{\n    \"templatePinStates\": [],\n    \"dependencyTypeInfos\": [\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEngine.AnimationClip\",\n            \"defaultInstantiationMode\": 0\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEditor.Animations.AnimatorController\",\n            \"defaultInstantiationMode\": 0\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEngine.AnimatorOverrideController\",\n            \"defaultInstantiationMode\": 0\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEditor.Audio.AudioMixerController\",\n            \"defaultInstantiationMode\": 0\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEngine.ComputeShader\",\n            \"defaultInstantiationMode\": 1\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEngine.Cubemap\",\n            \"defaultInstantiationMode\": 0\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEngine.GameObject\",\n            \"defaultInstantiationMode\": 0\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEditor.LightingDataAsset\",\n            \"defaultInstantiationMode\": 0\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEngine.LightingSettings\",\n            \"defaultInstantiationMode\": 0\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEngine.Material\",\n            \"defaultInstantiationMode\": 0\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEditor.MonoScript\",\n            \"defaultInstantiationMode\": 1\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEngine.PhysicMaterial\",\n            \"defaultInstantiationMode\": 0\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEngine.PhysicsMaterial2D\",\n            \"defaultInstantiationMode\": 0\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEngine.Rendering.PostProcessing.PostProcessProfile\",\n            \"defaultInstantiationMode\": 0\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEngine.Rendering.PostProcessing.PostProcessResources\",\n            \"defaultInstantiationMode\": 0\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEngine.Rendering.VolumeProfile\",\n            \"defaultInstantiationMode\": 0\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEditor.SceneAsset\",\n            \"defaultInstantiationMode\": 1\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEngine.Shader\",\n            \"defaultInstantiationMode\": 1\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEngine.ShaderVariantCollection\",\n            \"defaultInstantiationMode\": 1\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEngine.Texture\",\n            \"defaultInstantiationMode\": 0\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEngine.Texture2D\",\n            \"defaultInstantiationMode\": 0\n        },\n        {\n            \"userAdded\": false,\n            \"type\": \"UnityEngine.Timeline.TimelineAsset\",\n            \"defaultInstantiationMode\": 0\n        }\n    ],\n    \"defaultDependencyTypeInfo\": {\n        \"userAdded\": false,\n        \"type\": \"<default_scene_template_dependencies>\",\n        \"defaultInstantiationMode\": 1\n    },\n    \"newSceneOverride\": 0\n}"
  },
  {
    "path": "src/UniTask/ProjectSettings/TagManager.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!78 &1\nTagManager:\n  serializedVersion: 2\n  tags: []\n  layers:\n  - Default\n  - TransparentFX\n  - Ignore Raycast\n  - \n  - Water\n  - UI\n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  - \n  m_SortingLayers:\n  - name: Default\n    uniqueID: 0\n    locked: 0\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/TimeManager.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!5 &1\nTimeManager:\n  m_ObjectHideFlags: 0\n  Fixed Timestep: 0.02\n  Maximum Allowed Timestep: 0.1\n  m_TimeScale: 1\n  Maximum Particle Timestep: 0.03\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/UnityConnectSettings.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!310 &1\nUnityConnectSettings:\n  m_ObjectHideFlags: 0\n  serializedVersion: 1\n  m_Enabled: 0\n  m_TestMode: 0\n  m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events\n  m_EventUrl: https://cdp.cloud.unity3d.com/v1/events\n  m_ConfigUrl: https://config.uca.cloud.unity3d.com\n  m_DashboardUrl: https://dashboard.unity3d.com\n  m_TestInitMode: 0\n  CrashReportingSettings:\n    m_EventUrl: https://perf-events.cloud.unity3d.com\n    m_Enabled: 0\n    m_LogBufferSize: 10\n    m_CaptureEditorExceptions: 1\n  UnityPurchasingSettings:\n    m_Enabled: 0\n    m_TestMode: 0\n  UnityAnalyticsSettings:\n    m_Enabled: 0\n    m_TestMode: 0\n    m_InitializeOnStartup: 1\n    m_PackageRequiringCoreStatsPresent: 0\n  UnityAdsSettings:\n    m_Enabled: 0\n    m_InitializeOnStartup: 1\n    m_TestMode: 0\n    m_IosGameId: \n    m_AndroidGameId: \n    m_GameIds: {}\n    m_GameId: \n  PerformanceReportingSettings:\n    m_Enabled: 0\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/VFXManager.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!937362698 &1\nVFXManager:\n  m_ObjectHideFlags: 0\n  m_IndirectShader: {fileID: 0}\n  m_RenderPipeSettingsPath: \n"
  },
  {
    "path": "src/UniTask/ProjectSettings/VersionControlSettings.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!890905787 &1\nVersionControlSettings:\n  m_ObjectHideFlags: 0\n  m_Mode: Visible Meta Files\n  m_CollabEditorSettings:\n    inProgressEnabled: 1\n"
  },
  {
    "path": "src/UniTask/ProjectSettings/XRSettings.asset",
    "content": "{\n    \"m_SettingKeys\": [\n        \"VR Device Disabled\",\n        \"VR Device User Alert\"\n    ],\n    \"m_SettingValues\": [\n        \"False\",\n        \"False\"\n    ]\n}"
  },
  {
    "path": "src/UniTask.Analyzer/Properties/launchSettings.json",
    "content": "{\n  \"profiles\": {\n    \"UniTask.Analyzer\": {\n      \"commandName\": \"DebugRoslynComponent\",\n      \"targetProject\": \"..\\\\UniTask.NetCoreSandbox\\\\UniTask.NetCoreSandbox.csproj\"\n    }\n  }\n}"
  },
  {
    "path": "src/UniTask.Analyzer/UniTask.Analyzer.csproj",
    "content": "<Project Sdk=\"Microsoft.NET.Sdk\">\n  <PropertyGroup>\n    <OutputType>library</OutputType>\n    <TargetFramework>netstandard2.0</TargetFramework>\n    <LangVersion>latest</LangVersion>\n    <Nullable>enable</Nullable>\n    <IsRoslynComponent>true</IsRoslynComponent>\n    <TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackBuildOutputs</TargetsForTfmSpecificContentInPackage>\n    <IncludeBuildOutput>false</IncludeBuildOutput>\n    <IncludeSymbols>false</IncludeSymbols>\n    <SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>\n    <DevelopmentDependency>true</DevelopmentDependency>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"Microsoft.CodeAnalysis.Analyzers\" Version=\"3.3.2\">\n      <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>\n      <PrivateAssets>all</PrivateAssets>\n    </PackageReference>\n    <PackageReference Include=\"Microsoft.CodeAnalysis.CSharp\" Version=\"3.8.0\" />\n  </ItemGroup>\n\n  <Target Name=\"PackBuildOutputs\" DependsOnTargets=\"SatelliteDllsProjectOutputGroup;DebugSymbolsProjectOutputGroup\">\n    <ItemGroup>\n      <TfmSpecificPackageFile Include=\"$(TargetDir)\\*.dll\" PackagePath=\"analyzers\\dotnet\\cs\" />\n      <TfmSpecificPackageFile Include=\"@(SatelliteDllsProjectOutputGroupOutput->'%(FinalOutputPath)')\" PackagePath=\"analyzers\\dotnet\\cs\\%(SatelliteDllsProjectOutputGroupOutput.Culture)\\\" />\n    </ItemGroup>\n  </Target>\n</Project>\n"
  },
  {
    "path": "src/UniTask.Analyzer/UniTaskAnalyzer.cs",
    "content": "﻿#pragma warning disable RS2008\n\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.Diagnostics;\nusing Microsoft.CodeAnalysis.Operations;\nusing System.Collections.Immutable;\nusing System.Threading;\n\nnamespace UniTask.Analyzer\n{\n    [DiagnosticAnalyzer(LanguageNames.CSharp)]\n    public class UniTaskAnalyzer : DiagnosticAnalyzer\n    {\n        private static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(\n            id: \"UNITASK001\",\n            title: \"UniTaskAnalyzer001: Must pass CancellationToken\",\n            messageFormat: \"Must pass CancellationToken\",\n            category: \"Usage\",\n            defaultSeverity: DiagnosticSeverity.Error,\n            isEnabledByDefault: true,\n            description: \"Pass CancellationToken or CancellationToken.None.\");\n\n        public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { return ImmutableArray.Create(Rule); } }\n\n        public override void Initialize(AnalysisContext context)\n        {\n            context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);\n            context.EnableConcurrentExecution();\n\n            context.RegisterOperationAction(AnalyzeOperation, OperationKind.Invocation);\n        }\n\n        private static void AnalyzeOperation(OperationAnalysisContext context)\n        {\n            var token = context.Compilation.GetTypeByMetadataName(typeof(CancellationToken).FullName);\n            if (token == null) return;\n\n            if (context.Operation is IInvocationOperation invocation)\n            {\n                foreach (var arg in invocation.Arguments)\n                {\n                    if (arg.ArgumentKind == ArgumentKind.DefaultValue)\n                    {\n                        if (SymbolEqualityComparer.Default.Equals(arg.Parameter.Type, token))\n                        {\n                            var diagnostic = Diagnostic.Create(Rule, arg.Syntax.GetLocation());\n                            context.ReportDiagnostic(diagnostic);\n                        }\n                    }\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask.NetCore/NetCore/AsyncEnumerableExtensions.cs",
    "content": "﻿#if !NETSTANDARD2_0\n\n#pragma warning disable 0649\n\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing System.Threading.Tasks.Sources;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public static class AsyncEnumerableExtensions\n    {\n        public static IUniTaskAsyncEnumerable<T> AsUniTaskAsyncEnumerable<T>(this IAsyncEnumerable<T> source)\n        {\n            return new AsyncEnumerableToUniTaskAsyncEnumerable<T>(source);\n        }\n\n        public static IAsyncEnumerable<T> AsAsyncEnumerable<T>(this IUniTaskAsyncEnumerable<T> source)\n        {\n            return new UniTaskAsyncEnumerableToAsyncEnumerable<T>(source);\n        }\n\n        sealed class AsyncEnumerableToUniTaskAsyncEnumerable<T> : IUniTaskAsyncEnumerable<T>\n        {\n            readonly IAsyncEnumerable<T> source;\n\n            public AsyncEnumerableToUniTaskAsyncEnumerable(IAsyncEnumerable<T> source)\n            {\n                this.source = source;\n            }\n\n            public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n            {\n                return new Enumerator(source.GetAsyncEnumerator(cancellationToken));\n            }\n\n            sealed class Enumerator : IUniTaskAsyncEnumerator<T>\n            {\n                readonly IAsyncEnumerator<T> enumerator;\n\n                public Enumerator(IAsyncEnumerator<T> enumerator)\n                {\n                    this.enumerator = enumerator;\n                }\n\n                public T Current => enumerator.Current;\n\n                public async UniTask DisposeAsync()\n                {\n                    await enumerator.DisposeAsync();\n                }\n\n                public async UniTask<bool> MoveNextAsync()\n                {\n                    return await enumerator.MoveNextAsync();\n                }\n            }\n        }\n\n        sealed class UniTaskAsyncEnumerableToAsyncEnumerable<T> : IAsyncEnumerable<T>\n        {\n            readonly IUniTaskAsyncEnumerable<T> source;\n\n            public UniTaskAsyncEnumerableToAsyncEnumerable(IUniTaskAsyncEnumerable<T> source)\n            {\n                this.source = source;\n            }\n\n            public IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n            {\n                return new Enumerator(source.GetAsyncEnumerator(cancellationToken));\n            }\n\n            sealed class Enumerator : IAsyncEnumerator<T>\n            {\n                readonly IUniTaskAsyncEnumerator<T> enumerator;\n\n                public Enumerator(IUniTaskAsyncEnumerator<T> enumerator)\n                {\n                    this.enumerator = enumerator;\n                }\n\n                public T Current => enumerator.Current;\n\n                public ValueTask DisposeAsync()\n                {\n                    return enumerator.DisposeAsync();\n                }\n\n                public ValueTask<bool> MoveNextAsync()\n                {\n                    return enumerator.MoveNextAsync();\n                }\n            }\n        }\n    }\n}\n\n#endif"
  },
  {
    "path": "src/UniTask.NetCore/NetCore/UniTask.Delay.cs",
    "content": "﻿//using Cysharp.Threading.Tasks.Internal;\n//using System;\n//using System.Collections.Concurrent;\n//using System.Runtime.CompilerServices;\n//using System.Threading;\n\n//namespace Cysharp.Threading.Tasks\n//{\n//    public partial struct UniTask\n//    {\n//        public static UniTask Delay()\n//        {\n//            return default;\n//        }\n\n//        sealed class DelayPromise : IUniTaskSource\n//        {\n//            public void GetResult(short token)\n//            {\n//                throw new NotImplementedException();\n//            }\n\n//            public UniTaskStatus GetStatus(short token)\n//            {\n//                throw new NotImplementedException();\n//            }\n\n//            public void OnCompleted(Action<object> continuation, object state, short token)\n//            {\n//                throw new NotImplementedException();\n//            }\n\n//            public UniTaskStatus UnsafeGetStatus()\n//            {\n//                throw new NotImplementedException();\n//            }\n//        }\n//    }\n//}"
  },
  {
    "path": "src/UniTask.NetCore/NetCore/UniTask.Run.cs",
    "content": "﻿using System;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public partial struct UniTask\n    {\n        /// <summary>Run action on the threadPool and return to current SynchronizationContext if configureAwait = true.</summary>\n        public static async UniTask Run(Action action, bool configureAwait = true)\n        {\n            if (configureAwait)\n            {\n                var current = SynchronizationContext.Current;\n                await UniTask.SwitchToThreadPool();\n                try\n                {\n                    action();\n                }\n                finally\n                {\n                    if (current != null)\n                    {\n                        await UniTask.SwitchToSynchronizationContext(current);\n                    }\n                }\n            }\n            else\n            {\n                await UniTask.SwitchToThreadPool();\n                action();\n            }\n        }\n\n        /// <summary>Run action on the threadPool and return to current SynchronizationContext if configureAwait = true.</summary>\n        public static async UniTask Run(Action<object> action, object state, bool configureAwait = true)\n        {\n            if (configureAwait)\n            {\n                var current = SynchronizationContext.Current;\n                await UniTask.SwitchToThreadPool();\n                try\n                {\n                    action(state);\n                }\n                finally\n                {\n                    if (current != null)\n                    {\n                        await UniTask.SwitchToSynchronizationContext(current);\n                    }\n                }\n            }\n            else\n            {\n                await UniTask.SwitchToThreadPool();\n                action(state);\n            }\n        }\n\n        /// <summary>Run action on the threadPool and return to current SynchronizationContext if configureAwait = true.</summary>\n        public static async UniTask<T> Run<T>(Func<T> func, bool configureAwait = true)\n        {\n            if (configureAwait)\n            {\n                var current = SynchronizationContext.Current;\n                await UniTask.SwitchToThreadPool();\n                try\n                {\n                    return func();\n                }\n                finally\n                {\n                    if (current != null)\n                    {\n                        await UniTask.SwitchToSynchronizationContext(current);\n                    }\n                }\n            }\n            else\n            {\n                await UniTask.SwitchToThreadPool();\n                return func();\n            }\n        }\n\n        /// <summary>Run action on the threadPool and return to current SynchronizationContext if configureAwait = true.</summary>\n        public static async UniTask<T> Run<T>(Func<object, T> func, object state, bool configureAwait = true)\n        {\n            if (configureAwait)\n            {\n                var current = SynchronizationContext.Current;\n                await UniTask.SwitchToThreadPool();\n                try\n                {\n                    return func(state);\n                }\n                finally\n                {\n                    if (current != null)\n                    {\n                        await UniTask.SwitchToSynchronizationContext(current);\n                    }\n                }\n            }\n            else\n            {\n                await UniTask.SwitchToThreadPool();\n                return func(state);\n            }\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask.NetCore/NetCore/UniTask.Yield.cs",
    "content": "﻿using Cysharp.Threading.Tasks.Internal;\nusing System;\nusing System.Collections.Concurrent;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\n\nnamespace Cysharp.Threading.Tasks\n{\n    public partial struct UniTask\n    {\n        public static UniTask.YieldAwaitable Yield()\n        {\n            return default;\n        }\n\n        public readonly struct YieldAwaitable\n        {\n            public Awaiter GetAwaiter()\n            {\n                return default;\n            }\n\n            public readonly struct Awaiter : ICriticalNotifyCompletion\n            {\n                static readonly SendOrPostCallback SendOrPostCallbackDelegate = Continuation;\n                static readonly WaitCallback WaitCallbackDelegate = Continuation;\n\n                public bool IsCompleted => false;\n\n                public void GetResult() { }\n\n                public void OnCompleted(Action continuation)\n                {\n                    UnsafeOnCompleted(continuation);\n                }\n\n                public void UnsafeOnCompleted(Action continuation)\n                {\n                    var syncContext = SynchronizationContext.Current;\n                    if (syncContext != null)\n                    {\n                        syncContext.Post(SendOrPostCallbackDelegate, continuation);\n                    }\n                    else\n                    {\n#if NETCOREAPP3_1\n                        ThreadPool.UnsafeQueueUserWorkItem(ThreadPoolWorkItem.Create(continuation), false);\n#else\n                        ThreadPool.UnsafeQueueUserWorkItem(WaitCallbackDelegate, continuation);\n#endif\n                    }\n                }\n\n                static void Continuation(object state)\n                {\n                    ((Action)state).Invoke();\n                }\n            }\n\n#if NETCOREAPP3_1\n\n            sealed class ThreadPoolWorkItem : IThreadPoolWorkItem, ITaskPoolNode<ThreadPoolWorkItem>\n            {\n                static TaskPool<ThreadPoolWorkItem> pool;\n                ThreadPoolWorkItem nextNode;\n                public ref ThreadPoolWorkItem NextNode => ref nextNode;\n\n                static ThreadPoolWorkItem()\n                {\n                    TaskPool.RegisterSizeGetter(typeof(ThreadPoolWorkItem), () => pool.Size);\n                }\n\n                Action continuation;\n\n                [MethodImpl(MethodImplOptions.AggressiveInlining)]\n                public static ThreadPoolWorkItem Create(Action continuation)\n                {\n                    if (!pool.TryPop(out var item))\n                    {\n                        item = new ThreadPoolWorkItem();\n                    }\n\n                    item.continuation = continuation;\n                    return item;\n                }\n\n                [MethodImpl(MethodImplOptions.AggressiveInlining)]\n                public void Execute()\n                {\n                    var call = continuation;\n                    continuation = null;\n                    if (call != null)\n                    {\n                        pool.TryPush(this);\n                        call.Invoke();\n                    }\n                }\n            }\n\n#endif\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask.NetCore/UniTask.NetCore.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFrameworks>net6.0;net7.0;netstandard2.1;netstandard2.0</TargetFrameworks>\n    <AssemblyName>UniTask</AssemblyName>\n    <LangVersion>8.0</LangVersion>\n    <RootNamespace>Cysharp.Threading.Tasks</RootNamespace>\n    <DefineConstants>UNITASK_NETCORE</DefineConstants>\n    <GenerateDocumentationFile>true</GenerateDocumentationFile>\n    <NoWarn>$(NoWarn);CS1591</NoWarn>\n\n    <!-- NuGet Packaging -->\n    <IsPackable>true</IsPackable>\n    <Id>UniTask</Id>\n    <Description>Provides an efficient async/await integration to Unity and .NET Core.</Description>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <Compile Include=\"..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\**\\*.cs\" Exclude=\"&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Editor\\*.cs;&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\Triggers\\*.cs;&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\Linq\\UnityExtensions\\*.cs;&#xD;&#xA;  &#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\Internal\\UnityEqualityComparer.cs;&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\Internal\\DiagnosticsExtensions.cs;&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\Internal\\PlayerLoopRunner.cs;&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\Internal\\ContinuationQueue.cs;&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\Internal\\UnityWebRequestExtensions.cs;&#xD;&#xA;  &#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\UniTaskSynchronizationContext.cs;&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\CancellationTokenSourceExtensions.cs;&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\EnumeratorAsyncExtensions.cs;&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\TimeoutController.cs;&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\PlayerLoopHelper.cs;&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\PlayerLoopTimer.cs;&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\UniTask.Delay.cs;&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\UniTask.Run.cs;&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\UniTask.Bridge.cs;&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\UniTask.WaitUntil.cs;&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\UnityAsyncExtensions.*;&#xD;&#xA;..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\UnityBindingExtensions.cs;&#xD;&#xA;\" />\n    <Compile Remove=\"..\\UniTask\\Assets\\Plugins\\UniTask\\Runtime\\_InternalVisibleTo.cs\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"System.Threading.Tasks.Extensions\" Version=\"4.5.4\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "src/UniTask.NetCoreSandbox/Program.cs",
    "content": "﻿#pragma warning disable CS1998\n\nusing Cysharp.Threading.Tasks;\n\nusing System.Linq;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing System.Collections;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Runtime.CompilerServices;\nusing Cysharp.Threading.Tasks.Linq;\nusing System.Reactive.Linq;\nusing System.Reactive.Concurrency;\n\nnamespace NetCoreSandbox\n{\n    public class Program\n    {\n        static async Task Main(string[] args)\n        {\n            var cts = new CancellationTokenSource();\n\n\n            // OK.\n            await FooAsync(10, cts.Token);\n\n            // NG(Compiler Error)\n            // await FooAsync(10);\n\n\n\n            \n\n\n\n\n\n\n        }\n\n        static async UniTask FooAsync(int x, CancellationToken cancellationToken = default)\n        {\n            await UniTask.Yield();\n        }\n    }\n\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreSandbox/UniTask.NetCoreSandbox.csproj",
    "content": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <OutputType>Exe</OutputType>\n    <TargetFramework>net7.0</TargetFramework>\n    <RootNamespace>NetCoreSandbox</RootNamespace>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"BenchmarkDotNet\" Version=\"0.12.1\" />\n    <PackageReference Include=\"PooledAwait\" Version=\"1.0.49\" />\n    <PackageReference Include=\"System.Interactive.Async\" Version=\"4.1.1\" />\n    <PackageReference Include=\"System.Reactive\" Version=\"4.4.1\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\UniTask.NetCore\\UniTask.NetCore.csproj\" />\n    <ProjectReference Include=\"..\\UniTask.Analyzer\\UniTask.Analyzer.csproj\">\n      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>\n      <OutputItemType>Analyzer</OutputItemType>\n    </ProjectReference>\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/AsyncLazyTest.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Channels;\nusing Cysharp.Threading.Tasks.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests\n{\n    public class AsyncLazyTest\n    {\n        [Fact]\n        public async Task LazyLazy()\n        {\n            {\n                var l = UniTask.Lazy(() => After());\n                var a = AwaitAwait(l.Task);\n                var b = AwaitAwait(l.Task);\n                var c = AwaitAwait(l.Task);\n\n                await a;\n                await b;\n                await c;\n            }\n            {\n                var l = UniTask.Lazy(() => AfterException());\n                var a = AwaitAwait(l.Task);\n                var b = AwaitAwait(l.Task);\n                var c = AwaitAwait(l.Task);\n\n                await Assert.ThrowsAsync<TaskTestException>(async () => await a);\n                await Assert.ThrowsAsync<TaskTestException>(async () => await b);\n                await Assert.ThrowsAsync<TaskTestException>(async () => await c);\n            }\n        }\n\n        [Fact]\n        public async Task LazyImmediate()\n        {\n            {\n                var l = UniTask.Lazy(() => UniTask.FromResult(1).AsUniTask());\n                var a = AwaitAwait(l.Task);\n                var b = AwaitAwait(l.Task);\n                var c = AwaitAwait(l.Task);\n\n                await a;\n                await b;\n                await c;\n            }\n            {\n                var l = UniTask.Lazy(() => UniTask.FromException(new TaskTestException()));\n                var a = AwaitAwait(l.Task);\n                var b = AwaitAwait(l.Task);\n                var c = AwaitAwait(l.Task);\n\n                await Assert.ThrowsAsync<TaskTestException>(async () => await a);\n                await Assert.ThrowsAsync<TaskTestException>(async () => await b);\n                await Assert.ThrowsAsync<TaskTestException>(async () => await c);\n            }\n        }\n\n        static async UniTask AwaitAwait(UniTask t)\n        {\n            await t;\n        }\n\n\n        async UniTask After()\n        {\n            await UniTask.Yield();\n            Thread.Sleep(TimeSpan.FromSeconds(1));\n            await UniTask.Yield();\n            await UniTask.Yield();\n        }\n\n        async UniTask AfterException()\n        {\n            await UniTask.Yield();\n            Thread.Sleep(TimeSpan.FromSeconds(1));\n            await UniTask.Yield();\n            throw new TaskTestException();\n        }\n    }\n\n    public class AsyncLazyTest2\n    {\n        [Fact]\n        public async Task LazyLazy()\n        {\n            {\n                var l = UniTask.Lazy(() => After());\n                var a = AwaitAwait(l.Task);\n                var b = AwaitAwait(l.Task);\n                var c = AwaitAwait(l.Task);\n\n                var a2 = await a;\n                var b2 = await b;\n                var c2 = await c;\n                (a2, b2, c2).Should().Be((10, 10, 10));\n            }\n            {\n                var l = UniTask.Lazy(() => AfterException());\n                var a = AwaitAwait(l.Task);\n                var b = AwaitAwait(l.Task);\n                var c = AwaitAwait(l.Task);\n\n                await Assert.ThrowsAsync<TaskTestException>(async () => await a);\n                await Assert.ThrowsAsync<TaskTestException>(async () => await b);\n                await Assert.ThrowsAsync<TaskTestException>(async () => await c);\n            }\n        }\n\n        [Fact]\n        public async Task LazyImmediate()\n        {\n            {\n                var l = UniTask.Lazy(() => UniTask.FromResult(1));\n                var a = AwaitAwait(l.Task);\n                var b = AwaitAwait(l.Task);\n                var c = AwaitAwait(l.Task);\n\n                var a2 = await a;\n                var b2 = await b;\n                var c2 = await c;\n                (a2, b2, c2).Should().Be((1, 1, 1));\n            }\n            {\n                var l = UniTask.Lazy(() => UniTask.FromException<int>(new TaskTestException()));\n                var a = AwaitAwait(l.Task);\n                var b = AwaitAwait(l.Task);\n                var c = AwaitAwait(l.Task);\n\n                await Assert.ThrowsAsync<TaskTestException>(async () => await a);\n                await Assert.ThrowsAsync<TaskTestException>(async () => await b);\n                await Assert.ThrowsAsync<TaskTestException>(async () => await c);\n            }\n        }\n\n        static async UniTask<int> AwaitAwait(UniTask<int> t)\n        {\n            return await t;\n        }\n\n\n        async UniTask<int> After()\n        {\n            await UniTask.Yield();\n            Thread.Sleep(TimeSpan.FromSeconds(1));\n            await UniTask.Yield();\n            await UniTask.Yield();\n            return 10;\n        }\n\n        async UniTask<int> AfterException()\n        {\n            await UniTask.Yield();\n            Thread.Sleep(TimeSpan.FromSeconds(1));\n            await UniTask.Yield();\n            throw new TaskTestException();\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/AsyncReactivePropertyTest.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Channels;\nusing Cysharp.Threading.Tasks.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests\n{\n    public class AsyncReactivePropertyTest\n    {\n        [Fact]\n        public async Task Iteration()\n        {\n            var rp = new AsyncReactiveProperty<int>(99);\n\n            var f = await rp.FirstAsync();\n            f.Should().Be(99);\n\n            var array = rp.Take(5).ToArrayAsync();\n\n            rp.Value = 100;\n            rp.Value = 100;\n            rp.Value = 100;\n            rp.Value = 131;\n\n            var ar = await array;\n\n            ar.Should().Equal(new[] { 99, 100, 100, 100, 131 });\n        }\n\n        [Fact]\n        public async Task WithoutCurrent()\n        {\n            var rp = new AsyncReactiveProperty<int>(99);\n\n            var array = rp.WithoutCurrent().Take(5).ToArrayAsync();\n\n            rp.Value = 100;\n            rp.Value = 100;\n            rp.Value = 100;\n            rp.Value = 131;\n            rp.Value = 191;\n\n            var ar = await array;\n\n            ar.Should().Equal(new[] { 100, 100, 100, 131, 191 });\n        }\n\n        //[Fact]\n        //public async Task StateIteration()\n        //{\n        //    var rp = new ReadOnlyAsyncReactiveProperty<int>(99);\n        //    var setter = rp.GetSetter();\n\n        //    var f = await rp.FirstAsync();\n        //    f.Should().Be(99);\n\n        //    var array = rp.Take(5).ToArrayAsync();\n\n        //    setter(100);\n        //    setter(100);\n        //    setter(100);\n        //    setter(131);\n\n        //    var ar = await array;\n\n        //    ar.Should().Equal(new[] { 99, 100, 100, 100, 131 });\n        //}\n\n        //[Fact]\n        //public async Task StateWithoutCurrent()\n        //{\n        //    var rp = new ReadOnlyAsyncReactiveProperty<int>(99);\n        //    var setter = rp.GetSetter();\n\n        //    var array = rp.WithoutCurrent().Take(5).ToArrayAsync();\n        //    setter(100);\n        //    setter(100);\n        //    setter(100);\n        //    setter(131);\n        //    setter(191);\n\n        //    var ar = await array;\n\n        //    ar.Should().Equal(new[] { 100, 100, 100, 131, 191 });\n        //}\n\n\n\n        [Fact]\n        public void StateFromEnumeration()\n        {\n            var rp = new AsyncReactiveProperty<int>(10);\n\n            var state = rp.ToReadOnlyAsyncReactiveProperty(CancellationToken.None);\n\n            rp.Value = 10;\n            state.Value.Should().Be(10);\n\n            rp.Value = 20;\n            state.Value.Should().Be(20);\n\n            state.Dispose();\n\n            rp.Value = 30;\n            state.Value.Should().Be(20);\n        }\n\n        [Fact]\n        public async Task WaitAsyncTest()\n        {\n            var rp = new AsyncReactiveProperty<int>(128);\n\n            var f = await rp.FirstAsync();\n            f.Should().Be(128);\n\n            {\n                var t = rp.WaitAsync();\n                rp.Value = 99;\n                rp.Value = 100;\n                var v = await t;\n\n                v.Should().Be(99);\n            }\n\n            {\n                var t = rp.WaitAsync();\n                rp.Value = 99;\n                rp.Value = 100;\n                var v = await t;\n\n                v.Should().Be(99);\n            }\n        }\n\n\n        [Fact]\n        public async Task WaitAsyncCancellationTest()\n        {\n            var cts = new CancellationTokenSource();\n\n            var rp = new AsyncReactiveProperty<int>(128);\n\n            var t = rp.WaitAsync(cts.Token);\n\n            cts.Cancel();\n\n            rp.Value = 99;\n            rp.Value = 100;\n\n            await Assert.ThrowsAsync<OperationCanceledException>(async () => { await t; });\n        }\n\n\n        [Fact]\n        public async Task ReadOnlyWaitAsyncTest()\n        {\n            var rp = new AsyncReactiveProperty<int>(128);\n            var rrp = rp.ToReadOnlyAsyncReactiveProperty(CancellationToken.None);\n\n            var t = rrp.WaitAsync();\n            rp.Value = 99;\n            rp.Value = 100;\n            var v = await t;\n\n            v.Should().Be(99);\n        }\n\n\n        [Fact]\n        public async Task ReadOnlyWaitAsyncCancellationTest()\n        {\n            var cts = new CancellationTokenSource();\n\n            var rp = new AsyncReactiveProperty<int>(128);\n            var rrp = rp.ToReadOnlyAsyncReactiveProperty(CancellationToken.None);\n\n            var t = rrp.WaitAsync(cts.Token);\n\n            cts.Cancel();\n\n            rp.Value = 99;\n            rp.Value = 100;\n\n            await Assert.ThrowsAsync<OperationCanceledException>(async () => { await t; });\n        }\n\n    }\n\n\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/CancellationTokenTest.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Channels;\nusing Cysharp.Threading.Tasks.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests\n{\n    public class CancellationTokenTest\n    {\n        [Fact]\n        public async Task WaitUntilCanceled()\n        {\n            var cts = new CancellationTokenSource();\n\n            cts.CancelAfter(TimeSpan.FromSeconds(1.5));\n\n            var now = DateTime.UtcNow;\n\n            await cts.Token.WaitUntilCanceled();\n\n            var elapsed = DateTime.UtcNow - now;\n\n            elapsed.Should().BeGreaterThan(TimeSpan.FromSeconds(1));\n        }\n\n        [Fact]\n        public void AlreadyCanceled()\n        {\n            var cts = new CancellationTokenSource();\n\n            cts.Cancel();\n\n            cts.Token.WaitUntilCanceled().GetAwaiter().IsCompleted.Should().BeTrue();\n        }\n\n        [Fact]\n        public void None()\n        {\n            CancellationToken.None.WaitUntilCanceled().GetAwaiter().IsCompleted.Should().BeTrue();\n        }\n    }\n\n\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/ChannelTest.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Channels;\nusing Cysharp.Threading.Tasks.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests\n{\n    public class ChannelTest\n    {\n        (System.Threading.Channels.Channel<int>, Cysharp.Threading.Tasks.Channel<int>) CreateChannel()\n        {\n            var reference = System.Threading.Channels.Channel.CreateUnbounded<int>(new UnboundedChannelOptions\n            {\n                AllowSynchronousContinuations = true,\n                SingleReader = true,\n                SingleWriter = false\n            });\n\n            var channel = Cysharp.Threading.Tasks.Channel.CreateSingleConsumerUnbounded<int>();\n\n            return (reference, channel);\n        }\n\n        [Fact]\n        public async Task SingleWriteSingleRead()\n        {\n            var (reference, channel) = CreateChannel();\n\n            foreach (var item in new[] { 10, 20, 30 })\n            {\n                var t1 = reference.Reader.WaitToReadAsync();\n                var t2 = channel.Reader.WaitToReadAsync();\n\n                t1.IsCompleted.Should().BeFalse();\n                t2.Status.IsCompleted().Should().BeFalse();\n\n                reference.Writer.TryWrite(item);\n                channel.Writer.TryWrite(item);\n\n                (await t1).Should().BeTrue();\n                (await t2).Should().BeTrue();\n\n                reference.Reader.TryRead(out var refitem).Should().BeTrue();\n                channel.Reader.TryRead(out var chanitem).Should().BeTrue();\n                refitem.Should().Be(item);\n                chanitem.Should().Be(item);\n            }\n        }\n\n        [Fact]\n        public async Task MultiWrite()\n        {\n            var (reference, channel) = CreateChannel();\n\n            foreach (var item in new[] { 10, 20, 30 })\n            {\n                var t1 = reference.Reader.WaitToReadAsync();\n                var t2 = channel.Reader.WaitToReadAsync();\n\n                t1.IsCompleted.Should().BeFalse();\n                t2.Status.IsCompleted().Should().BeFalse();\n\n                foreach (var i in Enumerable.Range(1, 3))\n                {\n                    reference.Writer.TryWrite(item * i);\n                    channel.Writer.TryWrite(item * i);\n                }\n\n                (await t1).Should().BeTrue();\n                (await t2).Should().BeTrue();\n\n                foreach (var i in Enumerable.Range(1, 3))\n                {\n                    (await reference.Reader.WaitToReadAsync()).Should().BeTrue();\n                    (await channel.Reader.WaitToReadAsync()).Should().BeTrue();\n\n                    reference.Reader.TryRead(out var refitem).Should().BeTrue();\n                    channel.Reader.TryRead(out var chanitem).Should().BeTrue();\n                    refitem.Should().Be(item * i);\n                    chanitem.Should().Be(item * i);\n                }\n            }\n        }\n\n        [Fact]\n        public async Task CompleteOnEmpty()\n        {\n            var (reference, channel) = CreateChannel();\n\n            foreach (var item in new[] { 10, 20, 30 })\n            {\n                reference.Writer.TryWrite(item);\n                channel.Writer.TryWrite(item);\n                reference.Reader.TryRead(out var refitem);\n                channel.Reader.TryRead(out var chanitem);\n            }\n\n            // Empty.\n\n            var completion1 = reference.Reader.Completion;\n            var wait1 = reference.Reader.WaitToReadAsync();\n\n            var completion2 = channel.Reader.Completion;\n            var wait2 = channel.Reader.WaitToReadAsync();\n\n            reference.Writer.TryComplete();\n            channel.Writer.TryComplete();\n\n            completion1.Status.Should().Be(TaskStatus.RanToCompletion);\n            completion2.Status.Should().Be(UniTaskStatus.Succeeded);\n\n            (await wait1).Should().BeFalse();\n            (await wait2).Should().BeFalse();\n        }\n\n        [Fact]\n        public async Task CompleteErrorOnEmpty()\n        {\n            var (reference, channel) = CreateChannel();\n\n            foreach (var item in new[] { 10, 20, 30 })\n            {\n                reference.Writer.TryWrite(item);\n                channel.Writer.TryWrite(item);\n                reference.Reader.TryRead(out var refitem);\n                channel.Reader.TryRead(out var chanitem);\n            }\n\n            // Empty.\n\n            var completion1 = reference.Reader.Completion;\n            var wait1 = reference.Reader.WaitToReadAsync();\n\n            var completion2 = channel.Reader.Completion;\n            var wait2 = channel.Reader.WaitToReadAsync();\n\n            var ex = new Exception();\n            reference.Writer.TryComplete(ex);\n            channel.Writer.TryComplete(ex);\n\n            completion1.Status.Should().Be(TaskStatus.Faulted);\n            completion2.Status.Should().Be(UniTaskStatus.Faulted);\n\n            (await Assert.ThrowsAsync<Exception>(async () => await wait1)).Should().Be(ex);\n            (await Assert.ThrowsAsync<Exception>(async () => await wait2)).Should().Be(ex);\n        }\n\n        [Fact]\n        public async Task CompleteWithRest()\n        {\n            var (reference, channel) = CreateChannel();\n\n            foreach (var item in new[] { 10, 20, 30 })\n            {\n                reference.Writer.TryWrite(item);\n                channel.Writer.TryWrite(item);\n            }\n\n            // Three Item2.\n\n            var completion1 = reference.Reader.Completion;\n            var wait1 = reference.Reader.WaitToReadAsync();\n\n            var completion2 = channel.Reader.Completion;\n            var wait2 = channel.Reader.WaitToReadAsync();\n\n            reference.Writer.TryComplete();\n            channel.Writer.TryComplete();\n\n            // completion1.Status.Should().Be(TaskStatus.WaitingForActivation);\n            completion2.Status.Should().Be(UniTaskStatus.Pending);\n\n            (await wait1).Should().BeTrue();\n            (await wait2).Should().BeTrue();\n\n            foreach (var item in new[] { 10, 20, 30 })\n            {\n                reference.Reader.TryRead(out var i1).Should().BeTrue();\n                channel.Reader.TryRead(out var i2).Should().BeTrue();\n                i1.Should().Be(item);\n                i2.Should().Be(item);\n            }\n\n            (await reference.Reader.WaitToReadAsync()).Should().BeFalse();\n            (await channel.Reader.WaitToReadAsync()).Should().BeFalse();\n\n            completion1.Status.Should().Be(TaskStatus.RanToCompletion);\n            completion2.Status.Should().Be(UniTaskStatus.Succeeded);\n        }\n\n\n        [Fact]\n        public async Task CompleteErrorWithRest()\n        {\n            var (reference, channel) = CreateChannel();\n\n            foreach (var item in new[] { 10, 20, 30 })\n            {\n                reference.Writer.TryWrite(item);\n                channel.Writer.TryWrite(item);\n            }\n\n            // Three Item2.\n\n            var completion1 = reference.Reader.Completion;\n            var wait1 = reference.Reader.WaitToReadAsync();\n\n            var completion2 = channel.Reader.Completion;\n            var wait2 = channel.Reader.WaitToReadAsync();\n\n            var ex = new Exception();\n            reference.Writer.TryComplete(ex);\n            channel.Writer.TryComplete(ex);\n\n            // completion1.Status.Should().Be(TaskStatus.WaitingForActivation);\n            completion2.Status.Should().Be(UniTaskStatus.Pending);\n\n            (await wait1).Should().BeTrue();\n            (await wait2).Should().BeTrue();\n\n            foreach (var item in new[] { 10, 20, 30 })\n            {\n                reference.Reader.TryRead(out var i1).Should().BeTrue();\n                channel.Reader.TryRead(out var i2).Should().BeTrue();\n                i1.Should().Be(item);\n                i2.Should().Be(item);\n            }\n\n            wait1 = reference.Reader.WaitToReadAsync();\n            wait2 = channel.Reader.WaitToReadAsync();\n\n            (await Assert.ThrowsAsync<Exception>(async () => await wait1)).Should().Be(ex);\n            (await Assert.ThrowsAsync<Exception>(async () => await wait2)).Should().Be(ex);\n\n            completion1.Status.Should().Be(TaskStatus.Faulted);\n            completion2.Status.Should().Be(UniTaskStatus.Faulted);\n        }\n\n        [Fact]\n        public async Task Cancellation()\n        {\n            var (reference, channel) = CreateChannel();\n\n            var cts = new CancellationTokenSource();\n\n            var wait1 = reference.Reader.WaitToReadAsync(cts.Token);\n            var wait2 = channel.Reader.WaitToReadAsync(cts.Token);\n\n            cts.Cancel();\n\n            (await Assert.ThrowsAsync<OperationCanceledException>(async () => await wait1)).CancellationToken.Should().Be(cts.Token);\n            (await Assert.ThrowsAsync<OperationCanceledException>(async () => await wait2)).CancellationToken.Should().Be(cts.Token);\n        }\n\n        [Fact]\n        public async Task AsyncEnumerator()\n        {\n            var (reference, channel) = CreateChannel();\n\n            var ta1 = reference.Reader.ReadAllAsync().ToArrayAsync();\n            var ta2 = channel.Reader.ReadAllAsync().ToArrayAsync();\n\n            foreach (var item in new[] { 10, 20, 30 })\n            {\n                reference.Writer.TryWrite(item);\n                channel.Writer.TryWrite(item);\n            }\n\n            reference.Writer.TryComplete();\n            channel.Writer.TryComplete();\n\n            (await ta1).Should().Equal(new[] { 10, 20, 30 });\n            (await ta2).Should().Equal(new[] { 10, 20, 30 });\n        }\n\n        [Fact]\n        public async Task AsyncEnumeratorCancellation()\n        {\n            // Token1, Token2 and Cancel1\n            {\n                var cts1 = new CancellationTokenSource();\n                var cts2 = new CancellationTokenSource();\n\n                var (reference, channel) = CreateChannel();\n\n                var ta1 = reference.Reader.ReadAllAsync(cts1.Token).ToArrayAsync(cts2.Token);\n                var ta2 = channel.Reader.ReadAllAsync(cts1.Token).ToArrayAsync(cts2.Token);\n\n                foreach (var item in new[] { 10, 20, 30 })\n                {\n                    reference.Writer.TryWrite(item);\n                    channel.Writer.TryWrite(item);\n                }\n\n                cts1.Cancel();\n\n                await Assert.ThrowsAsync<OperationCanceledException>(async () => await ta1);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await ta2)).CancellationToken.Should().Be(cts1.Token);\n            }\n            // Token1, Token2 and Cancel2\n            {\n                var cts1 = new CancellationTokenSource();\n                var cts2 = new CancellationTokenSource();\n\n                var (reference, channel) = CreateChannel();\n\n                var ta1 = reference.Reader.ReadAllAsync(cts1.Token).ToArrayAsync(cts2.Token);\n                var ta2 = channel.Reader.ReadAllAsync(cts1.Token).ToArrayAsync(cts2.Token);\n\n                foreach (var item in new[] { 10, 20, 30 })\n                {\n                    reference.Writer.TryWrite(item);\n                    channel.Writer.TryWrite(item);\n                }\n\n                cts2.Cancel();\n\n                await Assert.ThrowsAsync<OperationCanceledException>(async () => await ta1);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await ta2)).CancellationToken.Should().Be(cts2.Token);\n            }\n            // Token1 and Cancel1\n            {\n                var cts1 = new CancellationTokenSource();\n\n                var (reference, channel) = CreateChannel();\n\n                var ta1 = reference.Reader.ReadAllAsync(cts1.Token).ToArrayAsync();\n                var ta2 = channel.Reader.ReadAllAsync(cts1.Token).ToArrayAsync();\n\n                foreach (var item in new[] { 10, 20, 30 })\n                {\n                    reference.Writer.TryWrite(item);\n                    channel.Writer.TryWrite(item);\n                }\n\n                cts1.Cancel();\n\n                await Assert.ThrowsAsync<OperationCanceledException>(async () => await ta1);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await ta2)).CancellationToken.Should().Be(cts1.Token);\n            }\n            // Token2 and Cancel2\n            {\n                var cts2 = new CancellationTokenSource();\n\n                var (reference, channel) = CreateChannel();\n\n                var ta1 = reference.Reader.ReadAllAsync().ToArrayAsync(cts2.Token);\n                var ta2 = channel.Reader.ReadAllAsync().ToArrayAsync(cts2.Token);\n\n                foreach (var item in new[] { 10, 20, 30 })\n                {\n                    reference.Writer.TryWrite(item);\n                    channel.Writer.TryWrite(item);\n                }\n\n                cts2.Cancel();\n\n                await Assert.ThrowsAsync<OperationCanceledException>(async () => await ta1);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await ta2)).CancellationToken.Should().Be(cts2.Token);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/CompletionSourceTest.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Channels;\nusing Cysharp.Threading.Tasks.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests\n{\n    public class CompletionSourceTest\n    {\n        [Fact]\n        public async Task SetFirst()\n        {\n            {\n                var tcs = new UniTaskCompletionSource();\n\n                tcs.TrySetResult();\n                await tcs.Task; // ok.\n                await tcs.Task; // ok.\n                tcs.Task.Status.Should().Be(UniTaskStatus.Succeeded);\n            }\n\n            {\n                var tcs = new UniTaskCompletionSource();\n\n                tcs.TrySetException(new TestException());\n\n                await Assert.ThrowsAsync<TestException>(async () => await tcs.Task);\n                await Assert.ThrowsAsync<TestException>(async () => await tcs.Task);\n\n                tcs.Task.Status.Should().Be(UniTaskStatus.Faulted);\n            }\n\n            var cts = new CancellationTokenSource();\n\n            {\n                var tcs = new UniTaskCompletionSource();\n\n                tcs.TrySetException(new OperationCanceledException(cts.Token));\n\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n\n                tcs.Task.Status.Should().Be(UniTaskStatus.Canceled);\n            }\n\n            {\n                var tcs = new UniTaskCompletionSource();\n\n                tcs.TrySetCanceled(cts.Token);\n\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n\n                tcs.Task.Status.Should().Be(UniTaskStatus.Canceled);\n            }\n        }\n\n        [Fact]\n        public async Task SingleOnFirst()\n        {\n            {\n                var tcs = new UniTaskCompletionSource();\n\n                async UniTask Await()\n                {\n                    await tcs.Task;\n                }\n\n                var a = Await();\n\n                tcs.TrySetResult();\n                await a;\n                await tcs.Task; // ok.\n                tcs.Task.Status.Should().Be(UniTaskStatus.Succeeded);\n            }\n\n            {\n                var tcs = new UniTaskCompletionSource();\n\n                async UniTask Await()\n                {\n                    await tcs.Task;\n                }\n\n                var a = Await();\n\n                tcs.TrySetException(new TestException());\n                await Assert.ThrowsAsync<TestException>(async () => await a);\n                await Assert.ThrowsAsync<TestException>(async () => await tcs.Task);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Faulted);\n            }\n\n            var cts = new CancellationTokenSource();\n\n            {\n                var tcs = new UniTaskCompletionSource();\n\n                async UniTask Await()\n                {\n                    await tcs.Task;\n                }\n\n                var a = Await();\n\n                tcs.TrySetException(new OperationCanceledException(cts.Token));\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await a)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Canceled);\n            }\n            {\n                var tcs = new UniTaskCompletionSource();\n\n                async UniTask Await()\n                {\n                    await tcs.Task;\n                }\n\n                var a = Await();\n\n                tcs.TrySetCanceled(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await a)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Canceled);\n            }\n        }\n\n        [Fact]\n        public async Task MultiOne()\n        {\n            {\n                var tcs = new UniTaskCompletionSource();\n\n                async UniTask Await()\n                {\n                    await tcs.Task;\n                }\n\n                var a = Await();\n                var b = Await();\n                tcs.TrySetResult();\n                await a;\n                await b;\n                await tcs.Task; // ok.\n                tcs.Task.Status.Should().Be(UniTaskStatus.Succeeded);\n            }\n\n            {\n                var tcs = new UniTaskCompletionSource();\n\n                async UniTask Await()\n                {\n                    await tcs.Task;\n                }\n\n                var a = Await();\n                var b = Await();\n\n                tcs.TrySetException(new TestException());\n                await Assert.ThrowsAsync<TestException>(async () => await a);\n                await Assert.ThrowsAsync<TestException>(async () => await b);\n                await Assert.ThrowsAsync<TestException>(async () => await tcs.Task);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Faulted);\n            }\n\n            var cts = new CancellationTokenSource();\n\n            {\n                var tcs = new UniTaskCompletionSource();\n\n                async UniTask Await()\n                {\n                    await tcs.Task;\n                }\n\n                var a = Await();\n                var b = Await();\n\n                tcs.TrySetException(new OperationCanceledException(cts.Token));\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await a)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await b)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Canceled);\n            }\n            {\n                var tcs = new UniTaskCompletionSource();\n\n                async UniTask Await()\n                {\n                    await tcs.Task;\n                }\n\n                var a = Await();\n                var b = Await();\n\n                tcs.TrySetCanceled(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await a)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await b)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Canceled);\n            }\n        }\n\n        [Fact]\n        public async Task MultiTwo()\n        {\n            {\n                var tcs = new UniTaskCompletionSource();\n\n                async UniTask Await()\n                {\n                    await tcs.Task;\n                }\n\n                var a = Await();\n                var b = Await();\n                var c = Await();\n                tcs.TrySetResult();\n                await a;\n                await b;\n                await c;\n                await tcs.Task; // ok.\n                tcs.Task.Status.Should().Be(UniTaskStatus.Succeeded);\n            }\n\n            {\n                var tcs = new UniTaskCompletionSource();\n\n                async UniTask Await()\n                {\n                    await tcs.Task;\n                }\n\n                var a = Await();\n                var b = Await();\n                var c = Await();\n\n                tcs.TrySetException(new TestException());\n                await Assert.ThrowsAsync<TestException>(async () => await a);\n                await Assert.ThrowsAsync<TestException>(async () => await b);\n                await Assert.ThrowsAsync<TestException>(async () => await c);\n                await Assert.ThrowsAsync<TestException>(async () => await tcs.Task);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Faulted);\n            }\n\n            var cts = new CancellationTokenSource();\n\n            {\n                var tcs = new UniTaskCompletionSource();\n\n                async UniTask Await()\n                {\n                    await tcs.Task;\n                }\n\n                var a = Await();\n                var b = Await();\n                var c = Await();\n\n                tcs.TrySetException(new OperationCanceledException(cts.Token));\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await a)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await b)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await c)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Canceled);\n            }\n            {\n                var tcs = new UniTaskCompletionSource();\n\n                async UniTask Await()\n                {\n                    await tcs.Task;\n                }\n\n                var a = Await();\n                var b = Await();\n                var c = Await();\n\n                tcs.TrySetCanceled(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await a)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await b)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await c)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Canceled);\n            }\n        }\n\n        class TestException : Exception\n        {\n\n        }\n    }\n\n    public class CompletionSourceTest2\n    {\n        [Fact]\n        public async Task SetFirst()\n        {\n            {\n                var tcs = new UniTaskCompletionSource<int>();\n\n                tcs.TrySetResult(10);\n                var a = await tcs.Task; // ok.\n                var b = await tcs.Task; // ok.\n                a.Should().Be(10);\n                b.Should().Be(10);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Succeeded);\n            }\n\n            {\n                var tcs = new UniTaskCompletionSource<int>();\n\n                tcs.TrySetException(new TestException());\n\n                await Assert.ThrowsAsync<TestException>(async () => await tcs.Task);\n                await Assert.ThrowsAsync<TestException>(async () => await tcs.Task);\n\n                tcs.Task.Status.Should().Be(UniTaskStatus.Faulted);\n            }\n\n            var cts = new CancellationTokenSource();\n\n            {\n                var tcs = new UniTaskCompletionSource<int>();\n\n                tcs.TrySetException(new OperationCanceledException(cts.Token));\n\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n\n                tcs.Task.Status.Should().Be(UniTaskStatus.Canceled);\n            }\n\n            {\n                var tcs = new UniTaskCompletionSource<int>();\n\n                tcs.TrySetCanceled(cts.Token);\n\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n\n                tcs.Task.Status.Should().Be(UniTaskStatus.Canceled);\n            }\n        }\n\n        [Fact]\n        public async Task SingleOnFirst()\n        {\n            {\n                var tcs = new UniTaskCompletionSource<int>();\n\n                async UniTask<int> Await()\n                {\n                    return await tcs.Task;\n                }\n\n                var a = Await();\n\n                tcs.TrySetResult(10);\n                var r1 = await a;\n                var r2 = await tcs.Task; // ok.\n                r1.Should().Be(10);\n                r2.Should().Be(10);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Succeeded);\n            }\n\n            {\n                var tcs = new UniTaskCompletionSource<int>();\n\n                async UniTask<int> Await()\n                {\n                    return await tcs.Task;\n                }\n\n                var a = Await();\n\n                tcs.TrySetException(new TestException());\n                await Assert.ThrowsAsync<TestException>(async () => await a);\n                await Assert.ThrowsAsync<TestException>(async () => await tcs.Task);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Faulted);\n            }\n\n            var cts = new CancellationTokenSource();\n\n            {\n                var tcs = new UniTaskCompletionSource<int>();\n\n                async UniTask<int> Await()\n                {\n                    return await tcs.Task;\n                }\n\n                var a = Await();\n\n                tcs.TrySetException(new OperationCanceledException(cts.Token));\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await a)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Canceled);\n            }\n            {\n                var tcs = new UniTaskCompletionSource<int>();\n\n                async UniTask<int> Await()\n                {\n                    return await tcs.Task;\n                }\n\n                var a = Await();\n\n                tcs.TrySetCanceled(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await a)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Canceled);\n            }\n        }\n\n        [Fact]\n        public async Task MultiOne()\n        {\n            {\n                var tcs = new UniTaskCompletionSource<int>();\n\n                async UniTask<int> Await()\n                {\n                    return await tcs.Task;\n                }\n\n                var a = Await();\n                var b = Await();\n                tcs.TrySetResult(10);\n                var r1 = await a;\n                var r2 = await b;\n                var r3 = await tcs.Task; // ok.\n                (r1, r2, r3).Should().Be((10, 10, 10));\n                tcs.Task.Status.Should().Be(UniTaskStatus.Succeeded);\n            }\n\n            {\n                var tcs = new UniTaskCompletionSource<int>();\n\n                async UniTask<int> Await()\n                {\n                    return await tcs.Task;\n                }\n\n                var a = Await();\n                var b = Await();\n\n                tcs.TrySetException(new TestException());\n                await Assert.ThrowsAsync<TestException>(async () => await a);\n                await Assert.ThrowsAsync<TestException>(async () => await b);\n                await Assert.ThrowsAsync<TestException>(async () => await tcs.Task);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Faulted);\n            }\n\n            var cts = new CancellationTokenSource();\n\n            {\n                var tcs = new UniTaskCompletionSource<int>();\n\n                async UniTask<int> Await()\n                {\n                    return await tcs.Task;\n                }\n\n                var a = Await();\n                var b = Await();\n\n                tcs.TrySetException(new OperationCanceledException(cts.Token));\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await a)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await b)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Canceled);\n            }\n            {\n                var tcs = new UniTaskCompletionSource<int>();\n\n                async UniTask<int> Await()\n                {\n                    return await tcs.Task;\n                }\n\n                var a = Await();\n                var b = Await();\n\n                tcs.TrySetCanceled(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await a)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await b)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Canceled);\n            }\n        }\n\n        [Fact]\n        public async Task MultiTwo()\n        {\n            {\n                var tcs = new UniTaskCompletionSource<int>();\n\n                async UniTask<int> Await()\n                {\n                    return await tcs.Task;\n                }\n\n                var a = Await();\n                var b = Await();\n                var c = Await();\n                tcs.TrySetResult(10);\n                var r1 = await a;\n                var r2 = await b;\n                var r3 = await c;\n                var r4 = await tcs.Task; // ok.\n                (r1, r2, r3, r4).Should().Be((10, 10, 10, 10));\n                tcs.Task.Status.Should().Be(UniTaskStatus.Succeeded);\n            }\n\n            {\n                var tcs = new UniTaskCompletionSource<int>();\n\n                async UniTask<int> Await()\n                {\n                    return await tcs.Task;\n                }\n\n                var a = Await();\n                var b = Await();\n                var c = Await();\n\n                tcs.TrySetException(new TestException());\n                await Assert.ThrowsAsync<TestException>(async () => await a);\n                await Assert.ThrowsAsync<TestException>(async () => await b);\n                await Assert.ThrowsAsync<TestException>(async () => await c);\n                await Assert.ThrowsAsync<TestException>(async () => await tcs.Task);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Faulted);\n            }\n\n            var cts = new CancellationTokenSource();\n\n            {\n                var tcs = new UniTaskCompletionSource<int>();\n\n                async UniTask<int> Await()\n                {\n                    return await tcs.Task;\n                }\n\n                var a = Await();\n                var b = Await();\n                var c = Await();\n\n                tcs.TrySetException(new OperationCanceledException(cts.Token));\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await a)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await b)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await c)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Canceled);\n            }\n            {\n                var tcs = new UniTaskCompletionSource<int>();\n\n                async UniTask<int> Await()\n                {\n                    return await tcs.Task;\n                }\n\n                var a = Await();\n                var b = Await();\n                var c = Await();\n\n                tcs.TrySetCanceled(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await a)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await b)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await c)).CancellationToken.Should().Be(cts.Token);\n                (await Assert.ThrowsAsync<OperationCanceledException>(async () => await tcs.Task)).CancellationToken.Should().Be(cts.Token);\n                tcs.Task.Status.Should().Be(UniTaskStatus.Canceled);\n            }\n        }\n\n        class TestException : Exception\n        {\n\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/DeferTest.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Channels;\nusing Cysharp.Threading.Tasks.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests\n{\n    public class DeferTest\n    {\n        [Fact]\n        public async Task D()\n        {\n            var created = false;\n            var v = UniTask.Defer(() => { created = true; return UniTask.Run(() => 10); });\n\n            created.Should().BeFalse();\n\n            var t = await v;\n\n            created.Should().BeTrue();\n\n            t.Should().Be(10);\n        }\n\n        [Fact]\n        public async Task D2()\n        {\n            var created = false;\n            var v = UniTask.Defer(() => { created = true; return UniTask.Run(() => 10).AsUniTask(); });\n\n            created.Should().BeFalse();\n\n            await v;\n\n            created.Should().BeTrue();\n        }\n    }\n\n\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/Aggregate.cs",
    "content": "using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests.Linq\n{\n    public class Aggregate\n    {\n        [Theory]\n        [InlineData(0, 10)]\n        [InlineData(0, 1)]\n        [InlineData(10, 0)]\n        [InlineData(1, 11)]\n        public async Task Sum(int start, int count)\n        {\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(start, count).SumAsync();\n                var ys = Enumerable.Range(start, count).Sum();\n                xs.Should().Be(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(start, count).SumAsync(x => x * 2);\n                var ys = Enumerable.Range(start, count).Sum(x => x * 2);\n                xs.Should().Be(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(start, count).SumAwaitAsync(x => UniTask.Run(() => x));\n                var ys = Enumerable.Range(start, count).Sum(x => x);\n                xs.Should().Be(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(start, count).SumAwaitWithCancellationAsync((x, _) => UniTask.Run(() => x));\n                var ys = Enumerable.Range(start, count).Sum(x => x);\n                xs.Should().Be(ys);\n            }\n        }\n\n        public static IEnumerable<object[]> array1 = new object[][]\n        {\n            new object[]{new int[] { 1, 10, 100 } },\n            new object[]{new int?[] { 1, null, 100 } },\n            new object[]{new float[] { 1, 10, 100 } },\n            new object[]{new float?[] { 1, null, 100 } },\n            new object[]{new double[] { 1, 10, 100 } },\n            new object[]{new double?[] { 1, null, 100 } },\n            new object[]{new decimal[] { 1, 10, 100 } },\n            new object[]{new decimal?[] { 1, null, 100 } },\n        };\n\n        [Theory]\n        [MemberData(nameof(array1))]\n        public async Task Average<T>(T arr)\n        {\n            switch (arr)\n            {\n                case int[] array:\n                    {\n                        var xs = await array.ToUniTaskAsyncEnumerable().AverageAsync();\n                        var ys = array.Average();\n                        xs.Should().Be(ys);\n                    }\n                    break;\n                case int?[] array:\n                    {\n                        var xs = await array.ToUniTaskAsyncEnumerable().AverageAsync();\n                        var ys = array.Average();\n                        xs.Should().Be(ys);\n                    }\n                    break;\n                case float[] array:\n                    {\n                        var xs = await array.ToUniTaskAsyncEnumerable().AverageAsync();\n                        var ys = array.Average();\n                        xs.Should().Be(ys);\n                    }\n                    break;\n                case float?[] array:\n                    {\n                        var xs = await array.ToUniTaskAsyncEnumerable().AverageAsync();\n                        var ys = array.Average();\n                        xs.Should().Be(ys);\n                    }\n                    break;\n                case double[] array:\n                    {\n                        var xs = await array.ToUniTaskAsyncEnumerable().AverageAsync();\n                        var ys = array.Average();\n                        xs.Should().Be(ys);\n                    }\n                    break;\n                case double?[] array:\n                    {\n                        var xs = await array.ToUniTaskAsyncEnumerable().AverageAsync();\n                        var ys = array.Average();\n                        xs.Should().Be(ys);\n                    }\n                    break;\n                case decimal[] array:\n                    {\n                        var xs = await array.ToUniTaskAsyncEnumerable().AverageAsync();\n                        var ys = array.Average();\n                        xs.Should().Be(ys);\n                    }\n                    break;\n                case decimal?[] array:\n                    {\n                        var xs = await array.ToUniTaskAsyncEnumerable().AverageAsync();\n                        var ys = array.Average();\n                        xs.Should().Be(ys);\n                    }\n                    break;\n                default:\n                    break;\n            }\n        }\n\n\n        public static IEnumerable<object[]> array2 = new object[][]\n        {\n            new object[]{new int[] { } },\n            new object[]{new int[] { 5 } },\n            new object[]{new int[] { 5, 10, 100 } },\n            new object[]{new int[] { 10, 5,100 } },\n            new object[]{new int[] { 100, 10, 5 } },\n\n            new object[]{new int?[] { } },\n            new object[]{new int?[] { 5 } },\n            new object[]{new int?[] { null, null, null } },\n            new object[]{new int?[] { null, 5, 10, 100 } },\n            new object[]{new int?[] { 10, 5,100, null } },\n            new object[]{new int?[] { 100, 10, 5 } },\n\n            new object[]{new X[] { } },\n            new object[]{new X[] { new X(5) } },\n            new object[]{new X[] { new X(5), new X(10), new X(100) } },\n            new object[]{new X[] { new X(10),new X( 5),new X(100) } },\n            new object[]{new X[] { new X(100), new X(10),new X(5) } },\n\n            new object[]{new XX[] { } },\n            new object[]{new XX[] { new XX(new X(5)) } },\n            new object[]{new XX[] { new XX(new X(5)), new XX(new X(10)), new XX(new X(100)) } },\n            new object[]{new XX[] { new XX(new X(10)),new XX(new X( 5)),new XX(new X(100)) } },\n            new object[]{new XX[] { new XX(new X(100)), new XX(new X(10)),new XX(new X(5)) } },\n        };\n\n        [Theory]\n        [MemberData(nameof(array2))]\n        public async Task Min<T>(T arr)\n        {\n            switch (arr)\n            {\n                case int[] array:\n                    {\n                        {\n                            if (array.Length == 0)\n                            {\n                                await Assert.ThrowsAsync<InvalidOperationException>(async () => await array.ToUniTaskAsyncEnumerable().MinAsync());\n                                Assert.Throws<InvalidOperationException>(() => array.Min());\n                            }\n                            else\n                            {\n                                var xs = await array.ToUniTaskAsyncEnumerable().MinAsync();\n                                var ys = array.Min();\n                                xs.Should().Be(ys);\n                            }\n                        }\n                        {\n                            if (array.Length == 0)\n                            {\n                                await Assert.ThrowsAsync<InvalidOperationException>(async () => await array.ToUniTaskAsyncEnumerable().MinAsync(x => x * 2));\n                                Assert.Throws<InvalidOperationException>(() => array.Min(x => x * 2));\n                            }\n                            else\n                            {\n                                var xs = await array.ToUniTaskAsyncEnumerable().MinAsync(x => x * 2);\n                                var ys = array.Min(x => x * 2);\n                                xs.Should().Be(ys);\n                            }\n                        }\n                    }\n                    break;\n                case int?[] array:\n                    {\n                        {\n                            var xs = await array.ToUniTaskAsyncEnumerable().MinAsync();\n                            var ys = array.Min();\n                            xs.Should().Be(ys);\n                        }\n                        {\n                            var xs = await array.ToUniTaskAsyncEnumerable().MinAsync(x => x);\n                            var ys = array.Min(x => x);\n                            xs.Should().Be(ys);\n                        }\n                    }\n                    break;\n                case X[] array:\n                    {\n                        {\n                            var xs = await array.ToUniTaskAsyncEnumerable().MinAsync();\n                            var ys = array.Min();\n                            xs.Should().Be(ys);\n                        }\n                        {\n\n                            if (array.Length == 0)\n                            {\n                                await Assert.ThrowsAsync<InvalidOperationException>(async () => await array.ToUniTaskAsyncEnumerable().MinAsync(x => x.Value));\n                                Assert.Throws<InvalidOperationException>(() => array.Min(x => x.Value));\n                            }\n                            else\n                            {\n                                var xs = await array.ToUniTaskAsyncEnumerable().MinAsync(x => x.Value);\n                                var ys = array.Min(x => x.Value);\n                                xs.Should().Be(ys);\n                            }\n                        }\n                    }\n                    break;\n                case XX[] array:\n                    {\n                        var xs = await array.ToUniTaskAsyncEnumerable().MinAsync(x => x.Value);\n                        var ys = array.Min(x => x.Value);\n                        xs.Should().Be(ys);\n                    }\n                    break;\n                default:\n                    break;\n            }\n        }\n\n\n\n        [Theory]\n        [MemberData(nameof(array2))]\n        public async Task Max<T>(T arr)\n        {\n            switch (arr)\n            {\n                case int[] array:\n                    {\n                        {\n                            if (array.Length == 0)\n                            {\n                                await Assert.ThrowsAsync<InvalidOperationException>(async () => await array.ToUniTaskAsyncEnumerable().MaxAsync());\n                                Assert.Throws<InvalidOperationException>(() => array.Max());\n                            }\n                            else\n                            {\n                                var xs = await array.ToUniTaskAsyncEnumerable().MaxAsync();\n                                var ys = array.Max();\n                                xs.Should().Be(ys);\n                            }\n                        }\n                        {\n                            if (array.Length == 0)\n                            {\n                                await Assert.ThrowsAsync<InvalidOperationException>(async () => await array.ToUniTaskAsyncEnumerable().MaxAsync(x => x * 2));\n                                Assert.Throws<InvalidOperationException>(() => array.Max(x => x * 2));\n                            }\n                            else\n                            {\n                                var xs = await array.ToUniTaskAsyncEnumerable().MaxAsync(x => x * 2);\n                                var ys = array.Max(x => x * 2);\n                                xs.Should().Be(ys);\n                            }\n                        }\n                    }\n                    break;\n                case int?[] array:\n                    {\n                        {\n                            var xs = await array.ToUniTaskAsyncEnumerable().MaxAsync();\n                            var ys = array.Max();\n                            xs.Should().Be(ys);\n                        }\n                        {\n                            var xs = await array.ToUniTaskAsyncEnumerable().MaxAsync(x => x);\n                            var ys = array.Max(x => x);\n                            xs.Should().Be(ys);\n                        }\n                    }\n                    break;\n                case X[] array:\n                    {\n                        {\n                            var xs = await array.ToUniTaskAsyncEnumerable().MaxAsync();\n                            var ys = array.Max();\n                            xs.Should().Be(ys);\n                        }\n                        {\n\n                            if (array.Length == 0)\n                            {\n                                await Assert.ThrowsAsync<InvalidOperationException>(async () => await array.ToUniTaskAsyncEnumerable().MaxAsync(x => x.Value));\n                                Assert.Throws<InvalidOperationException>(() => array.Max(x => x.Value));\n                            }\n                            else\n                            {\n                                var xs = await array.ToUniTaskAsyncEnumerable().MaxAsync(x => x.Value);\n                                var ys = array.Max(x => x.Value);\n                                xs.Should().Be(ys);\n                            }\n                        }\n                    }\n                    break;\n                case XX[] array:\n                    {\n                        var xs = await array.ToUniTaskAsyncEnumerable().MaxAsync(x => x.Value);\n                        var ys = array.Max(x => x.Value);\n                        xs.Should().Be(ys);\n                    }\n                    break;\n                default:\n                    break;\n            }\n        }\n\n        public class XX\n        {\n            public readonly X Value;\n\n            public XX(X value)\n            {\n                this.Value = value;\n            }\n        }\n\n        public class X : IComparable<X>\n        {\n            public readonly int Value;\n\n            public X(int value)\n            {\n                Value = value;\n            }\n\n            public int CompareTo([AllowNull] X other)\n            {\n                return Comparer<int>.Default.Compare(Value, other.Value);\n            }\n        }\n\n\n        [Theory]\n        [InlineData(0, 10)]\n        [InlineData(0, 1)]\n        [InlineData(10, 0)]\n        [InlineData(1, 11)]\n        public async Task Count(int start, int count)\n        {\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(start, count).CountAsync();\n                var ys = Enumerable.Range(start, count).Count();\n                xs.Should().Be(ys);\n            }\n\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(start, count).CountAsync(x => x % 2 == 0);\n                var ys = Enumerable.Range(start, count).Count(x => x % 2 == 0);\n                xs.Should().Be(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(start, count).LongCountAsync();\n                var ys = Enumerable.Range(start, count).LongCount();\n                xs.Should().Be(ys);\n            }\n\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(start, count).LongCountAsync(x => x % 2 == 0);\n                var ys = Enumerable.Range(start, count).LongCount(x => x % 2 == 0);\n                xs.Should().Be(ys);\n            }\n        }\n\n\n        [Fact]\n        public async Task AggregateTest1()\n        {\n            // 0\n            await Assert.ThrowsAsync<InvalidOperationException>(async () => await new int[] { }.ToUniTaskAsyncEnumerable().AggregateAsync((x, y) => x + y));\n            Assert.Throws<InvalidOperationException>(() => new int[] { }.Aggregate((x, y) => x + y));\n\n            // 1\n            {\n                var a = await Enumerable.Range(1, 1).ToUniTaskAsyncEnumerable().AggregateAsync((x, y) => x + y);\n                var b = Enumerable.Range(1, 1).Aggregate((x, y) => x + y);\n                a.Should().Be(b);\n            }\n\n            // 2\n            {\n                var a = await Enumerable.Range(1, 2).ToUniTaskAsyncEnumerable().AggregateAsync((x, y) => x + y);\n                var b = Enumerable.Range(1, 2).Aggregate((x, y) => x + y);\n                a.Should().Be(b);\n            }\n\n            // 10\n            {\n                var a = await Enumerable.Range(1, 10).ToUniTaskAsyncEnumerable().AggregateAsync((x, y) => x + y);\n                var b = Enumerable.Range(1, 10).Aggregate((x, y) => x + y);\n                a.Should().Be(b);\n            }\n        }\n\n        [Fact]\n        public async Task AggregateTest2()\n        {\n            // 0\n            {\n                var a = await Enumerable.Range(1, 1).ToUniTaskAsyncEnumerable().AggregateAsync(1000, (x, y) => x + y);\n                var b = Enumerable.Range(1, 1).Aggregate(1000, (x, y) => x + y);\n                a.Should().Be(b);\n            }\n\n            // 1\n            {\n                var a = await Enumerable.Range(1, 1).ToUniTaskAsyncEnumerable().AggregateAsync(1000, (x, y) => x + y);\n                var b = Enumerable.Range(1, 1).Aggregate(1000, (x, y) => x + y);\n                a.Should().Be(b);\n            }\n\n            // 2\n            {\n                var a = await Enumerable.Range(1, 2).ToUniTaskAsyncEnumerable().AggregateAsync(1000, (x, y) => x + y);\n                var b = Enumerable.Range(1, 2).Aggregate(1000, (x, y) => x + y);\n                a.Should().Be(b);\n            }\n\n            // 10\n            {\n                var a = await Enumerable.Range(1, 10).ToUniTaskAsyncEnumerable().AggregateAsync(1000, (x, y) => x + y);\n                var b = Enumerable.Range(1, 10).Aggregate(1000, (x, y) => x + y);\n                a.Should().Be(b);\n            }\n        }\n\n        [Fact]\n        public async Task AggregateTest3()\n        {\n            // 0\n            {\n                var a = await Enumerable.Range(1, 1).ToUniTaskAsyncEnumerable().AggregateAsync(1000, (x, y) => x + y, x => (x * 99).ToString());\n                var b = Enumerable.Range(1, 1).Aggregate(1000, (x, y) => x + y, x => (x * 99).ToString());\n                a.Should().Be(b);\n            }\n\n            // 1\n            {\n                var a = await Enumerable.Range(1, 1).ToUniTaskAsyncEnumerable().AggregateAsync(1000, (x, y) => x + y, x => (x * 99).ToString());\n                var b = Enumerable.Range(1, 1).Aggregate(1000, (x, y) => x + y, x => (x * 99).ToString());\n                a.Should().Be(b);\n            }\n\n            // 2\n            {\n                var a = await Enumerable.Range(1, 2).ToUniTaskAsyncEnumerable().AggregateAsync(1000, (x, y) => x + y, x => (x * 99).ToString());\n                var b = Enumerable.Range(1, 2).Aggregate(1000, (x, y) => x + y, x => (x * 99).ToString());\n                a.Should().Be(b);\n            }\n\n            // 10\n            {\n                var a = await Enumerable.Range(1, 10).ToUniTaskAsyncEnumerable().AggregateAsync(1000, (x, y) => x + y, x => (x * 99).ToString());\n                var b = Enumerable.Range(1, 10).Aggregate(1000, (x, y) => x + y, x => (x * 99).ToString());\n                a.Should().Be(b);\n            }\n        }\n\n        [Fact]\n        public async Task ForEach()\n        {\n            var list = new List<int>();\n            await Enumerable.Range(1, 10).ToUniTaskAsyncEnumerable().ForEachAsync(x =>\n            {\n                list.Add(x);\n            });\n\n            list.Should().Equal(Enumerable.Range(1, 10));\n\n            var list2 = new List<(int, int)>();\n            await Enumerable.Range(5, 10).ToUniTaskAsyncEnumerable().ForEachAsync((index, x) =>\n            {\n                list2.Add((index, x));\n            });\n\n            var list3 = Enumerable.Range(5, 10).Select((index, x) => (index, x)).ToArray();\n            list2.Should().Equal(list3);\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/AllAny.cs",
    "content": "using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reactive.Concurrency;\nusing System.Reactive.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\n\nnamespace NetCoreTests.Linq\n{\n    public class AllAny\n    {\n        [Theory]\n        [InlineData(0, 0)]\n        [InlineData(1, 1)]\n        [InlineData(1, 2)]\n        [InlineData(1, 3)]\n        [InlineData(0, 10)]\n        [InlineData(0, 11)]\n        public async Task AllTest(int start, int count)\n        {\n            var range = Enumerable.Range(start, count);\n            var x = await range.ToUniTaskAsyncEnumerable().AllAsync(x => x % 2 == 0);\n            var y = range.All(x => x % 2 == 0);\n\n            x.Should().Be(y);\n        }\n\n        [Theory]\n        [InlineData(0, 0)]\n        [InlineData(1, 1)]\n        [InlineData(1, 2)]\n        [InlineData(1, 3)]\n        [InlineData(0, 10)]\n        [InlineData(0, 11)]\n        public async Task AnyTest(int start, int count)\n        {\n            var range = Enumerable.Range(start, count);\n            {\n                var x = await range.ToUniTaskAsyncEnumerable().AnyAsync();\n                var y = range.Any();\n\n                x.Should().Be(y);\n            }\n            {\n                var x = await range.ToUniTaskAsyncEnumerable().AnyAsync(x => x % 2 == 0);\n                var y = range.Any(x => x % 2 == 0);\n\n                x.Should().Be(y);\n            }\n        }\n\n        [Theory]\n        [InlineData(0, 0)]\n        [InlineData(1, 1)]\n        [InlineData(1, 2)]\n        [InlineData(1, 3)]\n        [InlineData(0, 10)]\n        [InlineData(0, 11)]\n        public async Task ContainsTest(int start, int count)\n        {\n            var range = Enumerable.Range(start, count);\n            foreach (var c in Enumerable.Range(0, 15))\n            {\n                var x = await range.ToUniTaskAsyncEnumerable().ContainsAsync(c);\n                var y = range.Contains(c);\n                x.Should().Be(y);\n            }\n        }\n\n        [Fact]\n        public async Task SequenceEqual()\n        {\n            // empty and empty\n            (await new int[0].ToUniTaskAsyncEnumerable().SequenceEqualAsync(new int[0].ToUniTaskAsyncEnumerable())).Should().BeTrue();\n            (new int[0].SequenceEqual(new int[0])).Should().BeTrue();\n\n            // empty and exists\n            (await new int[0].ToUniTaskAsyncEnumerable().SequenceEqualAsync(new int[] { 1 }.ToUniTaskAsyncEnumerable())).Should().BeFalse();\n            (new int[0].SequenceEqual(new int[] { 1 })).Should().BeFalse();\n\n            // exists and empty\n            (await new int[] { 1 }.ToUniTaskAsyncEnumerable().SequenceEqualAsync(new int[0].ToUniTaskAsyncEnumerable())).Should().BeFalse();\n            (new int[] { 1 }.SequenceEqual(new int[] { })).Should().BeFalse();\n\n            // samelength same value\n            (await new int[] { 1, 2, 3 }.ToUniTaskAsyncEnumerable().SequenceEqualAsync(new int[] { 1, 2, 3 }.ToUniTaskAsyncEnumerable())).Should().BeTrue();\n            (new int[] { 1, 2, 3 }.SequenceEqual(new int[] { 1, 2, 3 })).Should().BeTrue();\n\n            // samelength different value(first)\n            (await new int[] { 5, 2, 3 }.ToUniTaskAsyncEnumerable().SequenceEqualAsync(new int[] { 1, 2, 3 }.ToUniTaskAsyncEnumerable())).Should().BeFalse();\n\n            // samelength different value(middle)\n            (await new int[] { 1, 2, 3 }.ToUniTaskAsyncEnumerable().SequenceEqualAsync(new int[] { 1, 5, 3 }.ToUniTaskAsyncEnumerable())).Should().BeFalse();\n\n            // samelength different value(last)\n            (await new int[] { 1, 2, 3 }.ToUniTaskAsyncEnumerable().SequenceEqualAsync(new int[] { 1, 2, 5 }.ToUniTaskAsyncEnumerable())).Should().BeFalse();\n\n            // left is long\n            (await new int[] { 1, 2, 3, 4 }.ToUniTaskAsyncEnumerable().SequenceEqualAsync(new int[] { 1, 2, 3 }.ToUniTaskAsyncEnumerable())).Should().BeFalse();\n            (new int[] { 1, 2, 3, 4 }.SequenceEqual(new int[] { 1, 2, 3 })).Should().BeFalse();\n\n            // right is long\n            (await new int[] { 1, 2, 3 }.ToUniTaskAsyncEnumerable().SequenceEqualAsync(new int[] { 1, 2, 3, 4 }.ToUniTaskAsyncEnumerable())).Should().BeFalse();\n            (new int[] { 1, 2, 3 }.SequenceEqual(new int[] { 1, 2, 3, 4 })).Should().BeFalse();\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/Concat.cs",
    "content": "using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reactive.Concurrency;\nusing System.Reactive.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\n\nnamespace NetCoreTests.Linq\n{\n    public class Concat\n    {\n        [Theory]\n        [InlineData(0, 0)]\n        [InlineData(0, 1)]\n        [InlineData(0, 2)]\n        [InlineData(0, 10)]\n        public async Task Append(int start, int count)\n        {\n            var xs = await Enumerable.Range(start, count).ToUniTaskAsyncEnumerable().Append(99).ToArrayAsync();\n            var ys = Enumerable.Range(start, count).Append(99).ToArray();\n\n            xs.Should().Equal(ys);\n        }\n\n        [Fact]\n        public async Task AppendThrow()\n        {\n            var xs = UniTaskTestException.ThrowImmediate().Append(99).ToArrayAsync();\n            await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n\n            var ys = UniTaskTestException.ThrowAfter().Append(99).ToArrayAsync();\n            await Assert.ThrowsAsync<UniTaskTestException>(async () => await ys);\n\n            var zs = UniTaskTestException.ThrowInMoveNext().Append(99).ToArrayAsync();\n            await Assert.ThrowsAsync<UniTaskTestException>(async () => await zs);\n        }\n\n        [Theory]\n        [InlineData(0, 0)]\n        [InlineData(0, 1)]\n        [InlineData(0, 2)]\n        [InlineData(0, 10)]\n        public async Task Prepend(int start, int count)\n        {\n            var xs = await Enumerable.Range(start, count).ToUniTaskAsyncEnumerable().Prepend(99).ToArrayAsync();\n            var ys = Enumerable.Range(start, count).Prepend(99).ToArray();\n\n            xs.Should().Equal(ys);\n        }\n\n        [Fact]\n        public async Task PrependThrow()\n        {\n            var xs = UniTaskTestException.ThrowImmediate().Prepend(99).ToArrayAsync();\n            await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n\n            var ys = UniTaskTestException.ThrowAfter().Prepend(99).ToArrayAsync();\n            await Assert.ThrowsAsync<UniTaskTestException>(async () => await ys);\n\n            var zs = UniTaskTestException.ThrowInMoveNext().Prepend(99).ToArrayAsync();\n            await Assert.ThrowsAsync<UniTaskTestException>(async () => await zs);\n        }\n\n        public static IEnumerable<object[]> array1 = new object[][]\n        {\n            new object[] { (0, 0), (0, 0) }, // empty + empty\n            new object[] { (0, 1), (0, 0) }, // 1 + empty\n            new object[] { (0, 0), (0, 1) }, // empty + 1\n            new object[] { (0, 5), (0, 0) }, // 5 + empty\n            new object[] { (0, 0), (0, 5) }, // empty + 5\n            new object[] { (0, 5), (0, 5) }, // 5 + 5\n        };\n\n        [Theory]\n        [MemberData(nameof(array1))]\n        public async Task ConcatTest((int, int) left, (int, int) right)\n        {\n            var l = Enumerable.Range(left.Item1, left.Item2);\n            var r = Enumerable.Range(right.Item1, right.Item2);\n\n            var xs = await l.ToUniTaskAsyncEnumerable().Concat(r.ToUniTaskAsyncEnumerable()).ToArrayAsync();\n            var ys = l.Concat(r).ToArray();\n            xs.Should().Equal(ys);\n        }\n\n        [Fact]\n        public async Task ConcatThrow()\n        {\n            {\n                var xs = UniTaskTestException.ThrowImmediate().Concat(UniTaskAsyncEnumerable.Range(1, 10)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n\n                var ys = UniTaskTestException.ThrowAfter().Concat(UniTaskAsyncEnumerable.Range(1, 10)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await ys);\n\n                var zs = UniTaskTestException.ThrowInMoveNext().Concat(UniTaskAsyncEnumerable.Range(1, 10)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await zs);\n            }\n            {\n                var xs = UniTaskAsyncEnumerable.Range(1, 10).Concat(UniTaskTestException.ThrowImmediate()).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n\n                var ys = UniTaskAsyncEnumerable.Range(1, 10).Concat(UniTaskTestException.ThrowAfter()).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await ys);\n\n                var zs = UniTaskAsyncEnumerable.Range(1, 10).Concat(UniTaskTestException.ThrowInMoveNext()).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await zs);\n            }\n        }\n\n        [Fact]\n        public async Task DefaultIfEmpty()\n        {\n            {\n                var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().DefaultIfEmpty(99).ToArrayAsync();\n                var ys = Enumerable.Range(1, 0).DefaultIfEmpty(99).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await Enumerable.Range(1, 1).ToUniTaskAsyncEnumerable().DefaultIfEmpty(99).ToArrayAsync();\n                var ys = Enumerable.Range(1, 1).DefaultIfEmpty(99).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await Enumerable.Range(1, 10).ToUniTaskAsyncEnumerable().DefaultIfEmpty(99).ToArrayAsync();\n                var ys = Enumerable.Range(1, 10).DefaultIfEmpty(99).ToArray();\n                xs.Should().Equal(ys);\n            }\n            // Throw\n            {\n                foreach (var item in UniTaskTestException.Throws())\n                {\n                    var xs = item.DefaultIfEmpty().ToArrayAsync();\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/Convert.cs",
    "content": "using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reactive.Concurrency;\nusing System.Reactive.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests.Linq\n{\n    public class Convert\n    {\n        [Fact]\n        public async Task ToAsyncEnumerable()\n        {\n            {\n                var xs = await Enumerable.Range(1, 100).ToUniTaskAsyncEnumerable().ToArrayAsync();\n\n                xs.Length.Should().Be(100);\n            }\n            {\n                var xs = await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().ToArrayAsync();\n\n                xs.Length.Should().Be(0);\n            }\n        }\n\n\n        [Fact]\n        public async Task ToObservable()\n        {\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, 10).ToObservable().ToArray();\n                xs.Should().Equal(Enumerable.Range(1, 10));\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, 0).ToObservable().ToArray();\n                xs.Should().Equal(Enumerable.Range(1, 0));\n            }\n        }\n\n\n        [Fact]\n        public async Task ToAsyncEnumerableTask()\n        {\n            var t = Task.FromResult(100);\n            var xs = await t.ToUniTaskAsyncEnumerable().ToArrayAsync();\n\n            xs.Length.Should().Be(1);\n            xs[0].Should().Be(100);\n        }\n\n        [Fact]\n        public async Task ToAsyncEnumerableUniTask()\n        {\n            var t = UniTask.FromResult(100);\n            var xs = await t.ToUniTaskAsyncEnumerable().ToArrayAsync();\n\n            xs.Length.Should().Be(1);\n            xs[0].Should().Be(100);\n        }\n\n        [Fact]\n        public async Task ToAsyncEnumerableObservable()\n        {\n            {\n                var xs = await Observable.Range(1, 100).ToUniTaskAsyncEnumerable().ToArrayAsync();\n                var ys = await Observable.Range(1, 100).ToArray();\n\n                xs.Should().Equal(ys);\n            }\n\n            {\n                var xs = await Observable.Range(1, 100, ThreadPoolScheduler.Instance).ToUniTaskAsyncEnumerable().ToArrayAsync();\n                var ys = await Observable.Range(1, 100, ThreadPoolScheduler.Instance).ToArray();\n\n                xs.Should().Equal(ys);\n            }\n\n            {\n                var xs = await Observable.Empty<int>(ThreadPoolScheduler.Instance).ToUniTaskAsyncEnumerable().ToArrayAsync();\n                var ys = await Observable.Empty<int>(ThreadPoolScheduler.Instance).ToArray();\n\n                xs.Should().Equal(ys);\n            }\n        }\n\n        [Fact]\n        public async Task ToDictionary()\n        {\n            {\n                var xs = await Enumerable.Range(1, 100).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x);\n                var ys = Enumerable.Range(1, 100).ToDictionary(x => x);\n\n                xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));\n            }\n            {\n                var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x);\n                var ys = Enumerable.Range(1, 0).ToDictionary(x => x);\n\n                xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));\n            }\n            {\n                var xs = await Enumerable.Range(1, 100).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x, x => x * 2);\n                var ys = Enumerable.Range(1, 100).ToDictionary(x => x, x => x * 2);\n\n                xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));\n            }\n            {\n                var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToDictionaryAsync(x => x, x => x * 2);\n                var ys = Enumerable.Range(1, 0).ToDictionary(x => x, x => x * 2);\n\n                xs.OrderBy(x => x.Key).Should().Equal(ys.OrderBy(x => x.Key));\n            }\n        }\n\n        [Fact]\n        public async Task ToLookup()\n        {\n            var arr = new[] { 1, 4, 10, 10, 4, 5, 10, 9 };\n            {\n                var xs = await arr.ToUniTaskAsyncEnumerable().ToLookupAsync(x => x);\n                var ys = arr.ToLookup(x => x);\n\n                xs.Count.Should().Be(ys.Count);\n                xs.Should().BeEquivalentTo(ys);\n                foreach (var key in xs.Select(x => x.Key))\n                {\n                    xs[key].Should().Equal(ys[key]);\n                }\n            }\n            {\n                var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToLookupAsync(x => x);\n                var ys = Enumerable.Range(1, 0).ToLookup(x => x);\n\n                xs.Should().BeEquivalentTo(ys);\n            }\n            {\n                var xs = await arr.ToUniTaskAsyncEnumerable().ToLookupAsync(x => x, x => x * 2);\n                var ys = arr.ToLookup(x => x, x => x * 2);\n\n                xs.Count.Should().Be(ys.Count);\n                xs.Should().BeEquivalentTo(ys);\n                foreach (var key in xs.Select(x => x.Key))\n                {\n                    xs[key].Should().Equal(ys[key]);\n                }\n            }\n            {\n                var xs = await Enumerable.Range(1, 0).ToUniTaskAsyncEnumerable().ToLookupAsync(x => x, x => x * 2);\n                var ys = Enumerable.Range(1, 0).ToLookup(x => x, x => x * 2);\n\n                xs.Should().BeEquivalentTo(ys);\n            }\n        }\n\n        [Fact]\n        public async Task ToList()\n        {\n            {\n                var xs = await Enumerable.Range(1, 100).ToUniTaskAsyncEnumerable().ToListAsync();\n                var ys = Enumerable.Range(1, 100).ToList();\n\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().ToListAsync();\n                var ys = Enumerable.Empty<int>().ToList();\n\n                xs.Should().Equal(ys);\n            }\n        }\n\n        [Fact]\n        public async Task ToHashSet()\n        {\n            {\n                var xs = await new[] { 1, 20, 4, 5, 20, 4, 6 }.ToUniTaskAsyncEnumerable().ToHashSetAsync();\n                var ys = new[] { 1, 20, 4, 5, 20, 4, 6 }.ToHashSet();\n\n                xs.OrderBy(x => x).Should().Equal(ys.OrderBy(x => x));\n            }\n            {\n                var xs = await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().ToHashSetAsync();\n                var ys = Enumerable.Empty<int>().ToHashSet();\n\n                xs.Should().Equal(ys);\n            }\n        }\n    }\n\n\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/CreateTest.cs",
    "content": "﻿#pragma warning disable CS1998\n#pragma warning disable CS0162\n\nusing Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests.Linq\n{\n    public class CreateTest\n    {\n        [Fact]\n        public async Task SyncCreation()\n        {\n            var from = 10;\n            var count = 100;\n\n            var xs = await UniTaskAsyncEnumerable.Create<int>(async (writer, token) =>\n            {\n                for (int i = 0; i < count; i++)\n                {\n                    await writer.YieldAsync(from + i);\n                }\n            }).ToArrayAsync();\n\n            var ys = await Range(from, count).AsUniTaskAsyncEnumerable().ToArrayAsync();\n\n            xs.Should().Equal(ys);\n        }\n\n        [Fact]\n        public async Task SyncManually()\n        {\n            var list = new List<int>();\n            var xs = UniTaskAsyncEnumerable.Create<int>(async (writer, token) =>\n            {\n                list.Add(100);\n                await writer.YieldAsync(10);\n                \n                list.Add(200);\n                await writer.YieldAsync(20);\n\n                list.Add(300);\n                await writer.YieldAsync(30);\n            \n                list.Add(400);\n            });\n\n            list.Should().BeEmpty();\n            var e = xs.GetAsyncEnumerator();\n\n            list.Should().BeEmpty();\n\n            await e.MoveNextAsync();\n            list.Should().Equal(100);\n            e.Current.Should().Be(10);\n\n            await e.MoveNextAsync();\n            list.Should().Equal(100, 200);\n            e.Current.Should().Be(20);\n\n            await e.MoveNextAsync();\n            list.Should().Equal(100, 200, 300);\n            e.Current.Should().Be(30);\n\n            (await e.MoveNextAsync()).Should().BeFalse();\n            list.Should().Equal(100, 200, 300, 400);\n        }\n\n        [Fact]\n        public async Task SyncExceptionFirst()\n        {\n            var from = 10;\n            var count = 100;\n\n            var xs = UniTaskAsyncEnumerable.Create<int>(async (writer, token) =>\n            {\n                for (int i = 0; i < count; i++)\n                {\n                    throw new UniTaskTestException();\n                    await writer.YieldAsync(from + i);\n                }\n            });\n\n            await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs.ToArrayAsync());\n        }\n\n        [Fact]\n        public async Task SyncException()\n        {\n            var from = 10;\n            var count = 100;\n\n            var xs = UniTaskAsyncEnumerable.Create<int>(async (writer, token) =>\n            {\n                for (int i = 0; i < count; i++)\n                {\n                    await writer.YieldAsync(from + i);\n\n                    if (i == 15)\n                    {\n                        throw new UniTaskTestException();\n                    }\n                }\n            });\n\n            await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs.ToArrayAsync());\n        }\n\n        [Fact]\n        public async Task ASyncManually()\n        {\n            var list = new List<int>();\n            var xs = UniTaskAsyncEnumerable.Create<int>(async (writer, token) =>\n            {\n                await UniTask.Yield();\n\n                list.Add(100);\n                await writer.YieldAsync(10);\n\n                await UniTask.Yield();\n\n                list.Add(200);\n                await writer.YieldAsync(20);\n\n                await UniTask.Yield();\n                list.Add(300);\n                await UniTask.Yield();\n                await writer.YieldAsync(30);\n\n                await UniTask.Yield();\n\n                list.Add(400);\n            });\n\n            list.Should().BeEmpty();\n            var e = xs.GetAsyncEnumerator();\n\n            list.Should().BeEmpty();\n\n            await e.MoveNextAsync();\n            list.Should().Equal(100);\n            e.Current.Should().Be(10);\n\n            await e.MoveNextAsync();\n            list.Should().Equal(100, 200);\n            e.Current.Should().Be(20);\n\n            await e.MoveNextAsync();\n            list.Should().Equal(100, 200, 300);\n            e.Current.Should().Be(30);\n\n            (await e.MoveNextAsync()).Should().BeFalse();\n            list.Should().Equal(100, 200, 300, 400);\n        }\n\n        [Fact]\n        public async Task AwaitForeachBreak()\n        {\n            var finallyCalled = false;\n            var enumerable = UniTaskAsyncEnumerable.Create<int>(async (writer, _) =>\n            {\n                try\n                {\n                    await writer.YieldAsync(1);\n                }\n                finally\n                {\n                    finallyCalled = true;\n                }\n            });\n\n            await foreach (var x in enumerable)\n            {\n                x.Should().Be(1);\n                break;\n            }\n            finallyCalled.Should().BeTrue();\n        }\n\n        async IAsyncEnumerable<int> Range(int from, int count)\n        {\n            for (int i = 0; i < count; i++)\n            {\n                yield return from + i;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/Factory.cs",
    "content": "using Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests.Linq\n{\n    public class Factory\n    {\n        [Theory]\n        [InlineData(0, 10)]\n        [InlineData(0, 0)]\n        [InlineData(1, 5)]\n        [InlineData(1, 0)]\n        [InlineData(0, 11)]\n        [InlineData(1, 11)]\n        public async Task RangeTest(int start, int count)\n        {\n            var xs = await UniTaskAsyncEnumerable.Range(start, count).ToArrayAsync();\n            var ys = Enumerable.Range(start, count).ToArray();\n\n            xs.Should().Equal(ys);\n        }\n\n        [Theory]\n        [InlineData(\"foo\", 0)]\n        [InlineData(\"bar\", 1)]\n        [InlineData(\"baz\", 3)]\n        [InlineData(\"foobar\", 10)]\n        [InlineData(\"foobarbaz\", 11)]\n        public async Task RepeatTest(string value, int count)\n        {\n            var xs = await UniTaskAsyncEnumerable.Repeat(value, count).ToArrayAsync();\n            var ys = Enumerable.Repeat(value, count).ToArray();\n\n            xs.Should().Equal(ys);\n        }\n\n        [Fact]\n        public async Task EmptyTest()\n        {\n            var xs = await UniTaskAsyncEnumerable.Empty<int>().ToArrayAsync();\n            var ys = Enumerable.Empty<int>().ToArray();\n\n            xs.Should().Equal(ys);\n        }\n\n        [Theory]\n        [InlineData(100)]\n        [InlineData((string)null)]\n        [InlineData(\"foo\")]\n        public async Task ReturnTest<T>(T value)\n        {\n            var xs = await UniTaskAsyncEnumerable.Return(value).ToArrayAsync();\n\n            xs.Length.Should().Be(1);\n            xs[0].Should().Be(value);\n        }\n\n    }\n\n\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/Filtering.cs",
    "content": "using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reactive.Concurrency;\nusing System.Reactive.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\n\nnamespace NetCoreTests.Linq\n{\n    public class Filtering\n    {\n        [Fact]\n        public async Task Where()\n        {\n            var range = Enumerable.Range(1, 10);\n            var src = range.ToUniTaskAsyncEnumerable();\n\n            {\n                var a = await src.Where(x => x % 2 == 0).ToArrayAsync();\n                var expected = range.Where(x => x % 2 == 0).ToArray();\n                a.Should().Equal(expected);\n            }\n            {\n                var a = await src.Where((x, i) => (x + i) % 2 == 0).ToArrayAsync();\n                var expected = range.Where((x, i) => (x + i) % 2 == 0).ToArray();\n                a.Should().Equal(expected);\n            }\n            {\n                var a = await src.WhereAwait(x => UniTask.Run(() => x % 2 == 0)).ToArrayAsync();\n                var b = await src.WhereAwait(x => UniTask.FromResult(x % 2 == 0)).ToArrayAsync();\n                var expected = range.Where(x => x % 2 == 0).ToArray();\n                a.Should().Equal(expected);\n                b.Should().Equal(expected);\n            }\n            {\n                var a = await src.WhereAwait((x, i) => UniTask.Run(() => (x + i) % 2 == 0)).ToArrayAsync();\n                var b = await src.WhereAwait((x, i) => UniTask.FromResult((x + i) % 2 == 0)).ToArrayAsync();\n                var expected = range.Where((x, i) => (x + i) % 2 == 0).ToArray();\n                a.Should().Equal(expected);\n                b.Should().Equal(expected);\n            }\n        }\n\n\n        [Fact]\n        public async Task WhereException()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                {\n                    var xs = item.Where(x => x % 2 == 0).ToArrayAsync();\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                }\n                {\n                    var xs = item.Where((x, i) => x % 2 == 0).ToArrayAsync();\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                }\n                {\n                    var xs = item.WhereAwait(x => UniTask.FromResult(x % 2 == 0)).ToArrayAsync();\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                }\n                {\n                    var xs = item.WhereAwait((x, i) => UniTask.FromResult(x % 2 == 0)).ToArrayAsync();\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                }\n            }\n        }\n\n        [Fact]\n        public async Task OfType()\n        {\n            var data = new object[] { 0, null, 10, 30, null, \"foo\", 99 };\n\n            var a = await data.ToUniTaskAsyncEnumerable().OfType<int>().ToArrayAsync();\n            var b = data.OfType<int>().ToArray();\n\n            a.Should().Equal(b);\n        }\n\n\n        [Fact]\n        public async Task OfTypeException()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.Select(x => (object)x).OfType<int>().ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n        }\n\n        [Fact]\n        public async Task Cast()\n        {\n            var data = new object[] { 0, 10, 30, 99 };\n\n            var a = await data.ToUniTaskAsyncEnumerable().Cast<int>().ToArrayAsync();\n            var b = data.Cast<int>().ToArray();\n\n            a.Should().Equal(b);\n        }\n\n\n        [Fact]\n        public async Task CastException()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.Select(x => (object)x).Cast<int>().ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/FirstLast.cs",
    "content": "using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reactive.Concurrency;\nusing System.Reactive.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests.Linq\n{\n    public class FirstLast\n    {\n        [Fact]\n        public async Task FirstTest()\n        {\n            {\n                await Assert.ThrowsAsync<InvalidOperationException>(async () => await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().FirstAsync());\n                Assert.Throws<InvalidOperationException>(() => Enumerable.Empty<int>().First());\n\n                var x = await new[] { 99 }.ToUniTaskAsyncEnumerable().FirstAsync();\n                var y = new[] { 99 }.First();\n                x.Should().Be(y);\n            }\n            {\n                var array = new[] { 99, 11, 135, 10, 144, 800 };\n                await Assert.ThrowsAsync<InvalidOperationException>(async () => await array.ToUniTaskAsyncEnumerable().FirstAsync(x => x % 98 == 0));\n                Assert.Throws<InvalidOperationException>(() => array.First(x => x % 98 == 0));\n\n                var x = await array.ToUniTaskAsyncEnumerable().FirstAsync(x => x % 2 == 0);\n                var y = array.First(x => x % 2 == 0);\n                x.Should().Be(y);\n            }\n\n            {\n                var x = await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().FirstOrDefaultAsync();\n                var y = Enumerable.Empty<int>().FirstOrDefault();\n                x.Should().Be(y);\n            }\n            {\n                var x = await new[] { 99 }.ToUniTaskAsyncEnumerable().FirstOrDefaultAsync();\n                var y = new[] { 99 }.FirstOrDefault();\n                x.Should().Be(y);\n            }\n            {\n                var array = new[] { 99, 11, 135, 10, 144, 800 };\n                var x = await array.ToUniTaskAsyncEnumerable().FirstOrDefaultAsync(x => x % 98 == 0);\n                var y = array.FirstOrDefault(x => x % 98 == 0);\n                x.Should().Be(y);\n            }\n            {\n                var array = new[] { 99, 11, 135, 10, 144, 800 };\n                var x = await array.ToUniTaskAsyncEnumerable().FirstAsync(x => x % 2 == 0);\n                var y = array.FirstOrDefault(x => x % 2 == 0);\n                x.Should().Be(y);\n            }\n        }\n\n        [Fact]\n        public async Task LastTest()\n        {\n            {\n                await Assert.ThrowsAsync<InvalidOperationException>(async () => await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().LastAsync());\n                Assert.Throws<InvalidOperationException>(() => Enumerable.Empty<int>().Last());\n\n                var x = await new[] { 99 }.ToUniTaskAsyncEnumerable().LastAsync();\n                var y = new[] { 99 }.Last();\n                x.Should().Be(y);\n            }\n            {\n                var array = new[] { 99, 11, 135, 10, 144, 800 };\n                await Assert.ThrowsAsync<InvalidOperationException>(async () => await array.ToUniTaskAsyncEnumerable().LastAsync(x => x % 98 == 0));\n                Assert.Throws<InvalidOperationException>(() => array.Last(x => x % 98 == 0));\n\n                var x = await array.ToUniTaskAsyncEnumerable().LastAsync(x => x % 2 == 0);\n                var y = array.Last(x => x % 2 == 0);\n                x.Should().Be(y);\n            }\n\n            {\n                var x = await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().LastOrDefaultAsync();\n                var y = Enumerable.Empty<int>().LastOrDefault();\n                x.Should().Be(y);\n            }\n            {\n                var x = await new[] { 99 }.ToUniTaskAsyncEnumerable().LastOrDefaultAsync();\n                var y = new[] { 99 }.LastOrDefault();\n                x.Should().Be(y);\n            }\n            {\n                var array = new[] { 99, 11, 135, 10, 144, 800 };\n                var x = await array.ToUniTaskAsyncEnumerable().LastOrDefaultAsync(x => x % 98 == 0);\n                var y = array.LastOrDefault(x => x % 98 == 0);\n                x.Should().Be(y);\n            }\n            {\n                var array = new[] { 99, 11, 135, 10, 144, 800 };\n                var x = await array.ToUniTaskAsyncEnumerable().LastOrDefaultAsync(x => x % 2 == 0);\n                var y = array.LastOrDefault(x => x % 2 == 0);\n                x.Should().Be(y);\n            }\n        }\n\n        [Fact]\n        public async Task SingleTest()\n        {\n            {\n                await Assert.ThrowsAsync<InvalidOperationException>(async () => await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().SingleAsync());\n                Assert.Throws<InvalidOperationException>(() => Enumerable.Empty<int>().Single());\n\n                var x = await new[] { 99 }.ToUniTaskAsyncEnumerable().SingleAsync();\n                var y = new[] { 99 }.Single();\n                x.Should().Be(y);\n\n                var array = new[] { 99, 11, 135, 10, 144, 800 };\n                await Assert.ThrowsAsync<InvalidOperationException>(async () => await array.ToUniTaskAsyncEnumerable().SingleAsync());\n                Assert.Throws<InvalidOperationException>(() => array.Single());\n            }\n            {\n                var array = new[] { 99, 11, 135, 10, 144, 800 };\n                // not found\n                await Assert.ThrowsAsync<InvalidOperationException>(async () => await array.ToUniTaskAsyncEnumerable().SingleAsync(x => x % 999 == 0));\n                Assert.Throws<InvalidOperationException>(() => array.Single(x => x % 999 == 0));\n                // found multi\n                await Assert.ThrowsAsync<InvalidOperationException>(async () => await array.ToUniTaskAsyncEnumerable().SingleAsync(x => x % 2 == 0));\n                Assert.Throws<InvalidOperationException>(() => array.Single(x => x % 2 == 0));\n\n                {\n                    var x = await array.ToUniTaskAsyncEnumerable().SingleAsync(x => x % 144 == 0);\n                    var y = array.Single(x => x % 144 == 0);\n                    x.Should().Be(y);\n                }\n                {\n                    var x = await array.ToUniTaskAsyncEnumerable().SingleAsync(x => x % 800 == 0);\n                    var y = array.Single(x => x % 800 == 0);\n                    x.Should().Be(y);\n                }\n            }\n\n            {\n                {\n                    var x = await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().SingleOrDefaultAsync();\n                    var y = Enumerable.Empty<int>().SingleOrDefault();\n                    x.Should().Be(y);\n                }\n                {\n                    var x = await new[] { 99 }.ToUniTaskAsyncEnumerable().SingleOrDefaultAsync();\n                    var y = new[] { 99 }.SingleOrDefault();\n                    x.Should().Be(y);\n\n                    var array = new[] { 99, 11, 135, 10, 144, 800 };\n                    await Assert.ThrowsAsync<InvalidOperationException>(async () => await array.ToUniTaskAsyncEnumerable().SingleOrDefaultAsync());\n                    Assert.Throws<InvalidOperationException>(() => array.SingleOrDefault());\n                }\n                {\n                    var array = new[] { 99, 11, 135, 10, 144, 800 };\n                    // not found\n                    {\n                        var x = await array.ToUniTaskAsyncEnumerable().SingleOrDefaultAsync(x => x % 999 == 0);\n                        var y = array.SingleOrDefault(x => x % 999 == 0);\n                        x.Should().Be(y);\n                    }\n                    // found multi\n                    await Assert.ThrowsAsync<InvalidOperationException>(async () => await array.ToUniTaskAsyncEnumerable().SingleOrDefaultAsync(x => x % 2 == 0));\n                    Assert.Throws<InvalidOperationException>(() => array.SingleOrDefault(x => x % 2 == 0));\n\n                    // normal\n                    {\n                        var x = await array.ToUniTaskAsyncEnumerable().SingleOrDefaultAsync(x => x % 144 == 0);\n                        var y = array.SingleOrDefault(x => x % 144 == 0);\n                        x.Should().Be(y);\n                    }\n                    {\n                        var x = await array.ToUniTaskAsyncEnumerable().SingleOrDefaultAsync(x => x % 800 == 0);\n                        var y = array.SingleOrDefault(x => x % 800 == 0);\n                        x.Should().Be(y);\n                    }\n                }\n            }\n        }\n\n\n        [Fact]\n        public async Task ElementAtTest()\n        {\n            {\n                await Assert.ThrowsAsync<ArgumentOutOfRangeException>(async () => await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().ElementAtAsync(0));\n                Assert.Throws<ArgumentOutOfRangeException>(() => Enumerable.Empty<int>().ElementAt(0));\n\n                var x = await new[] { 99 }.ToUniTaskAsyncEnumerable().ElementAtAsync(0);\n                var y = new[] { 99 }.ElementAt(0);\n                x.Should().Be(y);\n            }\n            {\n                var array = new[] { 99, 11, 135, 10, 144, 800 };\n                await Assert.ThrowsAsync<ArgumentOutOfRangeException>(async () => await array.ToUniTaskAsyncEnumerable().ElementAtAsync(10));\n                Assert.Throws<ArgumentOutOfRangeException>(() => array.ElementAt(10));\n\n                {\n                    var x = await array.ToUniTaskAsyncEnumerable().ElementAtAsync(0);\n                    var y = array.ElementAt(0);\n                    x.Should().Be(y);\n                }\n                {\n                    var x = await array.ToUniTaskAsyncEnumerable().ElementAtAsync(3);\n                    var y = array.ElementAt(3);\n                    x.Should().Be(y);\n                }\n                {\n                    var x = await array.ToUniTaskAsyncEnumerable().ElementAtAsync(5);\n                    var y = array.ElementAt(5);\n                    x.Should().Be(y);\n                }\n            }\n\n\n            {\n                {\n                    var x = await Enumerable.Empty<int>().ToUniTaskAsyncEnumerable().ElementAtOrDefaultAsync(0);\n                    var y = Enumerable.Empty<int>().ElementAtOrDefault(0);\n                    x.Should().Be(y);\n                }\n                {\n                    var x = await new[] { 99 }.ToUniTaskAsyncEnumerable().ElementAtOrDefaultAsync(0);\n                    var y = new[] { 99 }.ElementAtOrDefault(0);\n                    x.Should().Be(y);\n                }\n            }\n            {\n                var array = new[] { 99, 11, 135, 10, 144, 800 };\n                {\n                    var x = await array.ToUniTaskAsyncEnumerable().ElementAtOrDefaultAsync(10);\n                    var y = array.ElementAtOrDefault(10);\n                    x.Should().Be(y);\n                }\n                {\n                    var x = await array.ToUniTaskAsyncEnumerable().ElementAtOrDefaultAsync(0);\n                    var y = array.ElementAtOrDefault(0);\n                    x.Should().Be(y);\n                }\n                {\n                    var x = await array.ToUniTaskAsyncEnumerable().ElementAtOrDefaultAsync(3);\n                    var y = array.ElementAtOrDefault(3);\n                    x.Should().Be(y);\n                }\n                {\n                    var x = await array.ToUniTaskAsyncEnumerable().ElementAtOrDefaultAsync(5);\n                    var y = array.ElementAtOrDefault(5);\n                    x.Should().Be(y);\n                }\n            }\n        }\n    }\n\n\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/Joins.cs",
    "content": "using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reactive.Concurrency;\nusing System.Reactive.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Xunit;\n\n\nnamespace NetCoreTests.Linq\n{\n    public class Joins\n    {\n        static int rd;\n\n        static UniTask<T> RandomRun<T>(T value)\n        {\n            if (Interlocked.Increment(ref rd) % 2 == 0)\n            {\n                return UniTask.Run(() => value);\n            }\n            else\n            {\n                return UniTask.FromResult(value);\n            }\n        }\n\n        [Fact]\n        public async Task Join()\n        {\n            var outer = new[] { 1, 2, 4, 5, 8, 10, 14, 4, 8, 1, 2, 10 };\n            var inner = new[] { 1, 2, 1, 2, 1, 14, 2 };\n\n            var xs = await outer.ToUniTaskAsyncEnumerable().Join(inner.ToUniTaskAsyncEnumerable(), x => x, x => x, (x, y) => (x, y)).ToArrayAsync();\n            var ys = outer.Join(inner, x => x, x => x, (x, y) => (x, y)).ToArray();\n\n            xs.Should().Equal(ys);\n        }\n\n\n        [Fact]\n        public async Task JoinThrow()\n        {\n            var outer = new[] { 1, 2, 4, 5, 8, 10, 14, 4, 8, 1, 2, 10 };\n            var inner = new[] { 1, 2, 1, 2, 1, 14, 2 };\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = outer.ToUniTaskAsyncEnumerable().Join(item, x => x, x => x, (x, y) => x + y).ToArrayAsync();\n                var ys = item.Join(inner.ToUniTaskAsyncEnumerable(), x => x, x => x, (x, y) => x + y).ToArrayAsync();\n\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await ys);\n            }\n        }\n\n        [Fact]\n        public async Task JoinAwait()\n        {\n            var outer = new[] { 1, 2, 4, 5, 8, 10, 14, 4, 8, 1, 2, 10 };\n            var inner = new[] { 1, 2, 1, 2, 1, 14, 2 };\n\n            var xs = await outer.ToUniTaskAsyncEnumerable().JoinAwait(inner.ToUniTaskAsyncEnumerable(), x => RandomRun(x), x => RandomRun(x), (x, y) => RandomRun((x, y))).ToArrayAsync();\n            var ys = outer.Join(inner, x => x, x => x, (x, y) => (x, y)).ToArray();\n\n            xs.Should().Equal(ys);\n        }\n\n\n        [Fact]\n        public async Task JoinAwaitThrow()\n        {\n            var outer = new[] { 1, 2, 4, 5, 8, 10, 14, 4, 8, 1, 2, 10 };\n            var inner = new[] { 1, 2, 1, 2, 1, 14, 2 };\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = outer.ToUniTaskAsyncEnumerable().JoinAwait(item, x => RandomRun(x), x => RandomRun(x), (x, y) => RandomRun(x + y)).ToArrayAsync();\n                var ys = item.Join(inner.ToUniTaskAsyncEnumerable(), x => x, x => x, (x, y) => x + y).ToArrayAsync();\n\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await ys);\n            }\n        }\n\n        [Fact]\n        public async Task JoinAwaitCt()\n        {\n            var outer = new[] { 1, 2, 4, 5, 8, 10, 14, 4, 8, 1, 2, 10 };\n            var inner = new[] { 1, 2, 1, 2, 1, 14, 2 };\n\n            var xs = await outer.ToUniTaskAsyncEnumerable().JoinAwaitWithCancellation(inner.ToUniTaskAsyncEnumerable(), (x, _) => RandomRun(x), (x, _) => RandomRun(x), (x, y, _) => RandomRun((x, y))).ToArrayAsync();\n            var ys = outer.Join(inner, x => x, x => x, (x, y) => (x, y)).ToArray();\n\n            xs.Should().Equal(ys);\n        }\n\n\n        [Fact]\n        public async Task JoinAwaitCtThrow()\n        {\n            var outer = new[] { 1, 2, 4, 5, 8, 10, 14, 4, 8, 1, 2, 10 };\n            var inner = new[] { 1, 2, 1, 2, 1, 14, 2 };\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = outer.ToUniTaskAsyncEnumerable().JoinAwaitWithCancellation(item, (x, _) => RandomRun(x), (x, _) => RandomRun(x), (x, y, _) => RandomRun(x + y)).ToArrayAsync();\n                var ys = item.JoinAwaitWithCancellation(inner.ToUniTaskAsyncEnumerable(), (x, _) => RandomRun(x), (x, _) => RandomRun(x), (x, y, _) => RandomRun(x + y)).ToArrayAsync();\n\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await ys);\n            }\n        }\n\n\n        [Fact]\n        public async Task GroupBy()\n        {\n            var arr = new[] { 1, 4, 10, 10, 4, 5, 10, 9 };\n            {\n                var xs = await arr.ToUniTaskAsyncEnumerable().GroupBy(x => x).ToArrayAsync();\n                var ys = arr.GroupBy(x => x).ToArray();\n\n                xs.Length.Should().Be(ys.Length);\n                xs.Should().BeEquivalentTo(ys);\n            }\n\n            {\n                var xs = await arr.ToUniTaskAsyncEnumerable().GroupBy(x => x, (key, xs) => (key, xs.ToArray())).ToArrayAsync();\n                var ys = arr.GroupBy(x => x, (key, xs) => (key, xs.ToArray())).ToArray();\n\n                xs.Length.Should().Be(ys.Length);\n                xs.OrderBy(x => x.key).SelectMany(x => x.Item2).Should().Equal(ys.OrderBy(x => x.key).SelectMany(x => x.Item2));\n            }\n\n            {\n                var xs = await arr.ToUniTaskAsyncEnumerable().GroupByAwait(x => RandomRun(x)).ToArrayAsync();\n                var ys = arr.GroupBy(x => x).ToArray();\n\n                xs.Length.Should().Be(ys.Length);\n                xs.Should().BeEquivalentTo(ys);\n            }\n\n            {\n                var xs = await arr.ToUniTaskAsyncEnumerable().GroupByAwait(x => RandomRun(x), (key, xs) => RandomRun((key, xs.ToArray()))).ToArrayAsync();\n                var ys = arr.GroupBy(x => x, (key, xs) => (key, xs.ToArray())).ToArray();\n\n                xs.Length.Should().Be(ys.Length);\n                xs.OrderBy(x => x.key).SelectMany(x => x.Item2).Should().Equal(ys.OrderBy(x => x.key).SelectMany(x => x.Item2));\n            }\n\n            {\n                var xs = await arr.ToUniTaskAsyncEnumerable().GroupByAwaitWithCancellation((x, _) => RandomRun(x)).ToArrayAsync();\n                var ys = arr.GroupBy(x => x).ToArray();\n\n                xs.Length.Should().Be(ys.Length);\n                xs.Should().BeEquivalentTo(ys);\n            }\n\n            {\n                var xs = await arr.ToUniTaskAsyncEnumerable().GroupByAwaitWithCancellation((x, _) => RandomRun(x), (key, xs, _) => RandomRun((key, xs.ToArray()))).ToArrayAsync();\n                var ys = arr.GroupBy(x => x, (key, xs) => (key, xs.ToArray())).ToArray();\n\n                xs.Length.Should().Be(ys.Length);\n                xs.OrderBy(x => x.key).SelectMany(x => x.Item2).Should().Equal(ys.OrderBy(x => x.key).SelectMany(x => x.Item2));\n            }\n        }\n\n\n\n\n        [Fact]\n        public async Task GroupByThrow()\n        {\n            var arr = new[] { 1, 4, 10, 10, 4, 5, 10, 9 };\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.GroupBy(x => x).ToArrayAsync();\n                var ys = item.GroupByAwait(x => RandomRun(x)).ToArrayAsync();\n                var zs = item.GroupByAwaitWithCancellation((x, _) => RandomRun(x)).ToArrayAsync();\n\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await ys);\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await zs);\n            }\n        }\n\n\n\n        [Fact]\n        public async Task GroupJoin()\n        {\n            var outer = new[] { 1, 2, 4, 5, 8, 10, 14, 4, 8, 1, 2, 10 };\n            var inner = new[] { 1, 2, 1, 2, 1, 14, 2 };\n            \n            {\n                var xs = await outer.ToUniTaskAsyncEnumerable().GroupJoin(inner.ToUniTaskAsyncEnumerable(), x => x, x => x, (x, y) => (x, string.Join(\", \", y))).ToArrayAsync();\n                var ys = outer.GroupJoin(inner, x => x, x => x, (x, y) => (x, string.Join(\", \", y))).ToArray();\n\n                xs.Length.Should().Be(ys.Length);\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await outer.ToUniTaskAsyncEnumerable().GroupJoinAwait(inner.ToUniTaskAsyncEnumerable(), x => RandomRun(x), x => RandomRun(x), (x, y) => RandomRun((x, string.Join(\", \", y)))).ToArrayAsync();\n                var ys = outer.GroupJoin(inner, x => x, x => x, (x, y) => (x, string.Join(\", \", y))).ToArray();\n\n                xs.Length.Should().Be(ys.Length);\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await outer.ToUniTaskAsyncEnumerable().GroupJoinAwaitWithCancellation(inner.ToUniTaskAsyncEnumerable(), (x, _) => RandomRun(x), (x, _) => RandomRun(x), (x, y, _) => RandomRun((x, string.Join(\", \", y)))).ToArrayAsync();\n                var ys = outer.GroupJoin(inner, x => x, x => x, (x, y) => (x, string.Join(\", \", y))).ToArray();\n\n                xs.Length.Should().Be(ys.Length);\n                xs.Should().Equal(ys);\n            }\n        }\n\n\n        [Fact]\n        public async Task GroupJoinThrow()\n        {\n\n            var outer = new[] { 1, 2, 4, 5, 8, 10, 14, 4, 8, 1, 2, 10 }.ToUniTaskAsyncEnumerable();\n            var inner = new[] { 1, 2, 1, 2, 1, 14, 2 }.ToUniTaskAsyncEnumerable();\n\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                {\n                    var xs = item.GroupJoin(outer, x => x, x => x, (x, y) => x).ToArrayAsync();\n                    var ys = inner.GroupJoin(item, x => x, x => x, (x, y) => x).ToArrayAsync();\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await ys);\n                }\n                {\n                    var xs = item.GroupJoinAwait(outer, x => RandomRun(x), x => RandomRun(x), (x, y) => RandomRun(x)).ToArrayAsync();\n                    var ys = inner.GroupJoinAwait(item, x => RandomRun(x), x => RandomRun(x), (x, y) => RandomRun(x)).ToArrayAsync();\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await ys);\n                }\n                {\n                    var xs = item.GroupJoinAwaitWithCancellation(outer, (x, _) => RandomRun(x), (x, _) => RandomRun(x), (x, y, _) => RandomRun(x)).ToArrayAsync();\n                    var ys = inner.GroupJoinAwaitWithCancellation(item, (x, _) => RandomRun(x), (x, _) => RandomRun(x), (x, y, _) => RandomRun(x)).ToArrayAsync();\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await ys);\n                }\n            }\n        }\n\n\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/Merge.cs",
    "content": "#pragma warning disable CS1998\n\nusing System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing Xunit;\n\nnamespace NetCoreTests.Linq\n{\n    public class MergeTest\n    {\n        [Fact]\n        public async Task TwoSource()\n        {\n            var semaphore = new SemaphoreSlim(1, 1);\n\n            var a = UniTaskAsyncEnumerable.Create<string>(async (writer, _) =>\n            {\n                await UniTask.SwitchToThreadPool();\n\n                await semaphore.WaitAsync();\n                await writer.YieldAsync(\"A1\");\n                semaphore.Release();\n\n                await semaphore.WaitAsync();\n                await writer.YieldAsync(\"A2\");\n                semaphore.Release();\n            });\n\n            var b = UniTaskAsyncEnumerable.Create<string>(async (writer, _) =>\n            {\n                await UniTask.SwitchToThreadPool();\n\n                await semaphore.WaitAsync();\n                await writer.YieldAsync(\"B1\");\n                await writer.YieldAsync(\"B2\");\n                semaphore.Release();\n\n                await semaphore.WaitAsync();\n                await writer.YieldAsync(\"B3\");\n                semaphore.Release();\n            });\n\n            var result = await a.Merge(b).ToArrayAsync();\n            result.Should().Equal(\"A1\", \"B1\", \"B2\", \"A2\", \"B3\");\n        }\n\n        [Fact]\n        public async Task ThreeSource()\n        {\n            var semaphore = new SemaphoreSlim(0, 1);\n\n            var a = UniTaskAsyncEnumerable.Create<string>(async (writer, _) =>\n            {\n                await UniTask.SwitchToThreadPool();\n\n                await semaphore.WaitAsync();\n                await writer.YieldAsync(\"A1\");\n                semaphore.Release();\n\n                await semaphore.WaitAsync();\n                await writer.YieldAsync(\"A2\");\n                semaphore.Release();\n            });\n\n            var b = UniTaskAsyncEnumerable.Create<string>(async (writer, _) =>\n            {\n                await UniTask.SwitchToThreadPool();\n\n                await semaphore.WaitAsync();\n                await writer.YieldAsync(\"B1\");\n                await writer.YieldAsync(\"B2\");\n                semaphore.Release();\n\n                await semaphore.WaitAsync();\n                await writer.YieldAsync(\"B3\");\n                semaphore.Release();\n            });\n\n            var c = UniTaskAsyncEnumerable.Create<string>(async (writer, _) =>\n            {\n                await UniTask.SwitchToThreadPool();\n\n                await writer.YieldAsync(\"C1\");\n                semaphore.Release();\n            });\n\n            var result = await a.Merge(b, c).ToArrayAsync();\n            result.Should().Equal(\"C1\", \"A1\", \"B1\", \"B2\", \"A2\", \"B3\");\n        }\n\n        [Fact]\n        public async Task Throw()\n        {\n            var a = UniTaskAsyncEnumerable.Create<string>(async (writer, _) =>\n            {\n                await writer.YieldAsync(\"A1\");\n\n            });\n\n            var b = UniTaskAsyncEnumerable.Create<string>(async (writer, _) =>\n            {\n                throw new UniTaskTestException();\n            });\n\n            var enumerator = a.Merge(b).GetAsyncEnumerator();\n            (await enumerator.MoveNextAsync()).Should().Be(true);\n            enumerator.Current.Should().Be(\"A1\");\n\n            await Assert.ThrowsAsync<UniTaskTestException>(async () => await enumerator.MoveNextAsync());\n        }\n\n        [Fact]\n        public async Task Cancel()\n        {\n            var cts = new CancellationTokenSource();\n\n            var a = UniTaskAsyncEnumerable.Create<string>(async (writer, _) =>\n            {\n                await writer.YieldAsync(\"A1\");\n            });\n\n            var b = UniTaskAsyncEnumerable.Create<string>(async (writer, _) =>\n            {\n                await writer.YieldAsync(\"B1\");\n            });\n\n            var enumerator = a.Merge(b).GetAsyncEnumerator(cts.Token);\n            (await enumerator.MoveNextAsync()).Should().Be(true);\n            enumerator.Current.Should().Be(\"A1\");\n\n            cts.Cancel();\n            await Assert.ThrowsAsync<OperationCanceledException>(async () => await enumerator.MoveNextAsync());\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/Paging.cs",
    "content": "using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reactive.Concurrency;\nusing System.Reactive.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\n\nnamespace NetCoreTests.Linq\n{\n    public class Paging\n    {\n        [Theory]\n        [InlineData(0, 0)]\n        [InlineData(0, 1)]\n        [InlineData(9, 0)]\n        [InlineData(9, 1)]\n        [InlineData(9, 5)]\n        [InlineData(9, 9)]\n        [InlineData(9, 15)]\n        public async Task Skip(int collection, int skipCount)\n        {\n            var xs = await UniTaskAsyncEnumerable.Range(1, collection).Skip(skipCount).ToArrayAsync();\n            var ys = Enumerable.Range(1, collection).Skip(skipCount).ToArray();\n\n            xs.Should().Equal(ys);\n        }\n\n        [Fact]\n        public async Task SkipException()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.Skip(5).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n        }\n        [Theory]\n        [InlineData(0, 0)]\n        [InlineData(0, 1)]\n        [InlineData(9, 0)]\n        [InlineData(9, 1)]\n        [InlineData(9, 5)]\n        [InlineData(9, 9)]\n        [InlineData(9, 15)]\n        public async Task SkipLast(int collection, int skipCount)\n        {\n            var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipLast(skipCount).ToArrayAsync();\n            var ys = Enumerable.Range(1, collection).SkipLast(skipCount).ToArray();\n\n            xs.Should().Equal(ys);\n        }\n\n        [Fact]\n        public async Task SkipLastException()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.SkipLast(5).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n        }\n        [Theory]\n        [InlineData(0, 0)]\n        [InlineData(0, 1)]\n        [InlineData(9, 0)]\n        [InlineData(9, 1)]\n        [InlineData(9, 5)]\n        [InlineData(9, 9)]\n        [InlineData(9, 15)]\n        public async Task TakeLast(int collection, int takeCount)\n        {\n            var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeLast(takeCount).ToArrayAsync();\n            var ys = Enumerable.Range(1, collection).TakeLast(takeCount).ToArray();\n\n            xs.Should().Equal(ys);\n        }\n\n        [Fact]\n        public async Task TakeLastException()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.TakeLast(5).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n        }\n\n        [Theory]\n        [InlineData(0, 0)]\n        [InlineData(0, 1)]\n        [InlineData(9, 0)]\n        [InlineData(9, 1)]\n        [InlineData(9, 5)]\n        [InlineData(9, 9)]\n        [InlineData(9, 15)]\n        public async Task Take(int collection, int takeCount)\n        {\n            var xs = await UniTaskAsyncEnumerable.Range(1, collection).Take(takeCount).ToArrayAsync();\n            var ys = Enumerable.Range(1, collection).Take(takeCount).ToArray();\n\n            xs.Should().Equal(ys);\n        }\n\n        [Fact]\n        public async Task TakeException()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.Take(5).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n        }\n\n        [Theory]\n        [InlineData(0, 0)]\n        [InlineData(0, 1)]\n        [InlineData(9, 0)]\n        [InlineData(9, 1)]\n        [InlineData(9, 5)]\n        [InlineData(9, 9)]\n        [InlineData(9, 15)]\n        public async Task SkipWhile(int collection, int skipCount)\n        {\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArrayAsync();\n                var ys = Enumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArray();\n\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArrayAsync();\n                var ys = Enumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArray();\n\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwait(x => UniTask.Run(() => x < skipCount)).ToArrayAsync();\n                var ys = Enumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArray();\n\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwait((x, i) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync();\n                var ys = Enumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArray();\n\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwaitWithCancellation((x, _) => UniTask.Run(() => x < skipCount)).ToArrayAsync();\n                var ys = Enumerable.Range(1, collection).SkipWhile(x => x < skipCount).ToArray();\n\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, collection).SkipWhileAwaitWithCancellation((x, i, _) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync();\n                var ys = Enumerable.Range(1, collection).SkipWhile((x, i) => x < (skipCount - i)).ToArray();\n\n                xs.Should().Equal(ys);\n            }\n        }\n\n        [Fact]\n        public async Task SkipWhileException()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.SkipWhile(x => x < 2).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.SkipWhile((x, i) => x < 2).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.SkipWhileAwait((x) => UniTask.Run(() => x < 2)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.SkipWhileAwait((x, i) => UniTask.Run(() => x < 2)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.SkipWhileAwaitWithCancellation((x, _) => UniTask.Run(() => x < 2)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.SkipWhileAwaitWithCancellation((x, i, _) => UniTask.Run(() => x < 2)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n        }\n\n        [Theory]\n        [InlineData(0, 0)]\n        [InlineData(0, 1)]\n        [InlineData(9, 0)]\n        [InlineData(9, 1)]\n        [InlineData(9, 5)]\n        [InlineData(9, 9)]\n        [InlineData(9, 15)]\n        public async Task TakeWhile(int collection, int skipCount)\n        {\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArrayAsync();\n                var ys = Enumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArray();\n\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArrayAsync();\n                var ys = Enumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArray();\n\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwait(x => UniTask.Run(() => x < skipCount)).ToArrayAsync();\n                var ys = Enumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArray();\n\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwait((x, i) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync();\n                var ys = Enumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArray();\n\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwaitWithCancellation((x, _) => UniTask.Run(() => x < skipCount)).ToArrayAsync();\n                var ys = Enumerable.Range(1, collection).TakeWhile(x => x < skipCount).ToArray();\n\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, collection).TakeWhileAwaitWithCancellation((x, i, _) => UniTask.Run(() => x < (skipCount - i))).ToArrayAsync();\n                var ys = Enumerable.Range(1, collection).TakeWhile((x, i) => x < (skipCount - i)).ToArray();\n\n                xs.Should().Equal(ys);\n            }\n        }\n\n        [Fact]\n        public async Task TakeWhileException()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.TakeWhile(x => x < 5).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.TakeWhile((x, i) => x < 5).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.TakeWhileAwait((x) => UniTask.Run(() => x < 5)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.TakeWhileAwait((x, i) => UniTask.Run(() => x < 5)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.TakeWhileAwaitWithCancellation((x, _) => UniTask.Run(() => x < 5)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.TakeWhileAwaitWithCancellation((x, i, _) => UniTask.Run(() => x < 5)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/Projection.cs",
    "content": "using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reactive.Concurrency;\nusing System.Reactive.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\n\nnamespace NetCoreTests.Linq\n{\n    public class Projection\n    {\n        [Theory]\n        [InlineData(0, 0)]\n        [InlineData(0, 1)]\n        [InlineData(0, 2)]\n        [InlineData(0, 10)]\n        public async Task Reverse(int start, int count)\n        {\n            var xs = await Enumerable.Range(start, count).ToUniTaskAsyncEnumerable().Reverse().ToArrayAsync();\n            var ys = Enumerable.Range(start, count).Reverse().ToArray();\n\n            xs.Should().Equal(ys);\n        }\n\n        [Fact]\n        public async Task ReverseException()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.Reverse().ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n        }\n\n        [Theory]\n        [InlineData(0)]\n        [InlineData(1)]\n        [InlineData(9)]\n        public async Task Select(int count)\n        {\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, count).Select(x => x * x).ToArrayAsync();\n                var ys = Enumerable.Range(1, count).Select(x => x * x).ToArray();\n                xs.Should().Equal(ys);\n\n                var zs = await UniTaskAsyncEnumerable.Range(1, count).SelectAwait((x) => UniTask.Run(() => x * x)).ToArrayAsync();\n                zs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, count).Select((x, i) => x * x * i).ToArrayAsync();\n                var ys = Enumerable.Range(1, count).Select((x, i) => x * x * i).ToArray();\n                xs.Should().Equal(ys);\n\n                var zs = await UniTaskAsyncEnumerable.Range(1, count).SelectAwait((x, i) => UniTask.Run(() => x * x * i)).ToArrayAsync();\n                zs.Should().Equal(ys);\n            }\n        }\n\n\n        [Fact]\n        public async Task SelectException()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.Select(x => UniTaskAsyncEnumerable.Range(0, 1)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n\n            // await\n\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.SelectAwait(x => UniTask.Run(() => UniTaskAsyncEnumerable.Range(0, 1))).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n\n            // cancel\n\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.SelectAwaitWithCancellation((x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(0, 1))).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n        }\n\n\n        [Theory]\n        [InlineData(0, 9)] // empty + exists\n        [InlineData(9, 0)] // exists + empty\n        [InlineData(9, 9)] // exists + exists\n        public async Task SelectMany(int leftCount, int rightCount)\n        {\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany(x => UniTaskAsyncEnumerable.Range(99, rightCount * x)).ToArrayAsync();\n                var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x)).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany((i, x) => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x)).ToArrayAsync();\n                var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x)).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany(x => UniTaskAsyncEnumerable.Range(99, rightCount * x), (x, y) => x * y).ToArrayAsync();\n                var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x), (x, y) => x * y).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectMany((i, x) => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArrayAsync();\n                var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArray();\n                xs.Should().Equal(ys);\n            }\n\n            // await\n\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait(x => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x))).ToArrayAsync();\n                var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x)).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait((i, x) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x))).ToArrayAsync();\n                var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x)).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait(x => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x)), (x, y) => UniTask.Run(() => x * y)).ToArrayAsync();\n                var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x), (x, y) => x * y).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwait((i, x) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x)), (x, y) => UniTask.Run(() => x * y)).ToArrayAsync();\n                var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArray();\n                xs.Should().Equal(ys);\n            }\n\n            // with cancel\n\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x))).ToArrayAsync();\n                var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x)).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((i, x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x))).ToArrayAsync();\n                var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x)).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99, rightCount * x)), (x, y, _) => UniTask.Run(() => x * y)).ToArrayAsync();\n                var ys = Enumerable.Range(1, leftCount).SelectMany(x => Enumerable.Range(99, rightCount * x), (x, y) => x * y).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).SelectManyAwaitWithCancellation((i, x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(99 * i, rightCount * x)), (x, y, _) => UniTask.Run(() => x * y)).ToArrayAsync();\n                var ys = Enumerable.Range(1, leftCount).SelectMany((i, x) => Enumerable.Range(99 * i, rightCount * x), (x, y) => x * y).ToArray();\n                xs.Should().Equal(ys);\n            }\n        }\n\n        [Fact]\n        public async Task SelectManyException()\n        {\n            // error + exists\n            // exists + error\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.SelectMany(x => UniTaskAsyncEnumerable.Range(0, 1)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = UniTaskAsyncEnumerable.Range(0, 1).SelectMany(x => item).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n\n            // await\n\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.SelectManyAwait(x => UniTask.Run(() => UniTaskAsyncEnumerable.Range(0, 1))).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = UniTaskAsyncEnumerable.Range(0, 1).SelectManyAwait(x => UniTask.Run(() => item)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n\n            // with c\n\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.SelectManyAwaitWithCancellation((x, _) => UniTask.Run(() => UniTaskAsyncEnumerable.Range(0, 1))).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = UniTaskAsyncEnumerable.Range(0, 1).SelectManyAwaitWithCancellation((x, _) => UniTask.Run(() => item)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n        }\n\n\n\n        [Theory]\n        [InlineData(0, 9)] // empty + exists\n        [InlineData(9, 0)] // exists + empty\n        [InlineData(9, 9)] // same\n        [InlineData(9, 4)] // leftlong\n        [InlineData(4, 9)] // rightlong\n        public async Task Zip(int leftCount, int rightCount)\n        {\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).Zip(UniTaskAsyncEnumerable.Range(99, rightCount)).ToArrayAsync();\n                var ys = Enumerable.Range(1, leftCount).Zip(Enumerable.Range(99, rightCount)).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).ZipAwait(UniTaskAsyncEnumerable.Range(99, rightCount), (x, y) => UniTask.Run(() => (x, y))).ToArrayAsync();\n                var ys = Enumerable.Range(1, leftCount).Zip(Enumerable.Range(99, rightCount)).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await UniTaskAsyncEnumerable.Range(1, leftCount).ZipAwaitWithCancellation(UniTaskAsyncEnumerable.Range(99, rightCount), (x, y, _) => UniTask.Run(() => (x, y))).ToArrayAsync();\n                var ys = Enumerable.Range(1, leftCount).Zip(Enumerable.Range(99, rightCount)).ToArray();\n                xs.Should().Equal(ys);\n            }\n        }\n        [Fact]\n        public async Task ZipException()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.Zip(UniTaskAsyncEnumerable.Range(1, 10)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = UniTaskAsyncEnumerable.Range(1, 10).Zip(item).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n\n            // a\n\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.ZipAwait(UniTaskAsyncEnumerable.Range(1, 10), (x, y) => UniTask.Run(() => (x, y))).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = UniTaskAsyncEnumerable.Range(1, 10).ZipAwait(item, (x, y) => UniTask.Run(() => (x, y))).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n\n            // c\n\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.ZipAwaitWithCancellation(UniTaskAsyncEnumerable.Range(1, 10), (x, y, c) => UniTask.Run(() => (x, y))).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = UniTaskAsyncEnumerable.Range(1, 10).ZipAwaitWithCancellation(item, (x, y, c) => UniTask.Run(() => (x, y))).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n        }\n\n        [Theory]\n        // [InlineData(0, 0)]\n        [InlineData(0, 3)]\n        [InlineData(9, 1)]\n        [InlineData(9, 2)]\n        [InlineData(9, 3)]\n        [InlineData(17, 3)]\n        [InlineData(17, 16)]\n        [InlineData(17, 17)]\n        [InlineData(17, 27)]\n        public async Task Buffer(int rangeCount, int bufferCount)\n        {\n            var xs = await UniTaskAsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount).Select(x => string.Join(\",\", x)).ToArrayAsync();\n            var ys = await AsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount).Select(x => string.Join(\",\", x)).ToArrayAsync();\n\n            xs.Should().Equal(ys);\n        }\n\n        [Theory]\n        // [InlineData(0, 0)]\n        [InlineData(0, 3, 2)]\n        [InlineData(9, 1, 1)]\n        [InlineData(9, 2, 3)]\n        [InlineData(9, 3, 4)]\n        [InlineData(17, 3, 3)]\n        [InlineData(17, 16, 5)]\n        [InlineData(17, 17, 19)]\n        public async Task BufferSkip(int rangeCount, int bufferCount, int skipCount)\n        {\n            var xs = await UniTaskAsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount, skipCount).Select(x => string.Join(\",\", x)).ToArrayAsync();\n            var ys = await AsyncEnumerable.Range(0, rangeCount).Buffer(bufferCount, skipCount).Select(x => string.Join(\",\", x)).ToArrayAsync();\n\n            xs.Should().Equal(ys);\n        }\n\n        [Fact]\n        public async Task BufferError()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.Buffer(3).ToArrayAsync();\n                var ys = item.Buffer(3, 2).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await ys);\n            }\n        }\n\n        [Fact]\n        public async Task CombineLatestOK()\n        {\n            var a = new AsyncReactiveProperty<int>(0);\n            var b = new AsyncReactiveProperty<int>(0);\n\n            var list = new List<(int, int)>();\n            var complete = a.WithoutCurrent().CombineLatest(b.WithoutCurrent(), (x, y) => (x, y)).ForEachAsync(x => list.Add(x));\n\n            list.Count.Should().Be(0);\n\n            a.Value = 10;\n            list.Count.Should().Be(0);\n\n            a.Value = 20;\n            list.Count.Should().Be(0);\n\n            b.Value = 1;\n            list.Count.Should().Be(1);\n\n            list[0].Should().Be((20, 1));\n\n            a.Value = 30;\n            list.Last().Should().Be((30, 1));\n\n            b.Value = 2;\n            list.Last().Should().Be((30, 2));\n\n            a.Dispose();\n            b.Value = 3;\n            list.Last().Should().Be((30, 3));\n\n            b.Dispose();\n\n            await complete;\n        }\n\n        [Fact]\n        public async Task CombineLatestLong()\n        {\n            var a = UniTaskAsyncEnumerable.Range(1, 100000);\n            var b = new AsyncReactiveProperty<int>(0);\n\n            var list = new List<(int, int)>();\n            var complete = a.CombineLatest(b.WithoutCurrent(), (x, y) => (x, y)).ForEachAsync(x => list.Add(x));\n\n            b.Value = 1;\n\n            list[0].Should().Be((100000, 1));\n\n            b.Dispose();\n\n            await complete;\n        }\n\n        [Fact]\n        public async Task CombineLatestError()\n        {\n            var a = new AsyncReactiveProperty<int>(0);\n            var b = new AsyncReactiveProperty<int>(0);\n\n            var list = new List<(int, int)>();\n            var complete = a.WithoutCurrent()\n                .Select(x => { if (x == 0) { throw new MyException(); } return x; })\n                .CombineLatest(b.WithoutCurrent(), (x, y) => (x, y)).ForEachAsync(x => list.Add(x));\n\n\n            a.Value = 10;\n            b.Value = 1;\n            list.Last().Should().Be((10, 1));\n\n            a.Value = 0;\n\n            await Assert.ThrowsAsync<MyException>(async () => await complete);\n        }\n\n\n\n        [Fact]\n        public async Task PariwiseImmediate()\n        {\n            var xs = await UniTaskAsyncEnumerable.Range(1, 5).Pairwise().ToArrayAsync();\n            xs.Should().Equal((1, 2), (2, 3), (3, 4), (4, 5));\n        }\n\n        [Fact]\n        public async Task Pariwise()\n        {\n            var a = new AsyncReactiveProperty<int>(0);\n\n            var list = new List<(int, int)>();\n            var complete = a.WithoutCurrent().Pairwise().ForEachAsync(x => list.Add(x));\n\n            list.Count.Should().Be(0);\n            a.Value = 10;\n            list.Count.Should().Be(0);\n            a.Value = 20;\n            list.Count.Should().Be(1);\n            a.Value = 30;\n            a.Value = 40;\n            a.Value = 50;\n\n            a.Dispose();\n\n            await complete;\n\n            list.Should().Equal((10, 20), (20, 30), (30, 40), (40, 50));\n        }\n\n        class MyException : Exception\n        {\n\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/PulbishTest.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests.Linq\n{\n    public class PublishTest\n    {\n        [Fact]\n        public async Task Normal()\n        {\n            var rp = new AsyncReactiveProperty<int>(1);\n\n            var multicast = rp.Publish();\n\n            var a = multicast.ToArrayAsync();\n            var b = multicast.Take(2).ToArrayAsync();\n\n            var disp = multicast.Connect();\n\n            rp.Value = 2;\n\n            (await b).Should().Equal(1, 2);\n\n            var c = multicast.ToArrayAsync();\n\n            rp.Value = 3;\n            rp.Value = 4;\n            rp.Value = 5;\n\n            rp.Dispose();\n\n            (await a).Should().Equal(1, 2, 3, 4, 5);\n            (await c).Should().Equal(3, 4, 5);\n\n            disp.Dispose();\n        }\n\n        [Fact]\n        public async Task Cancel()\n        {\n            var rp = new AsyncReactiveProperty<int>(1);\n\n            var multicast = rp.Publish();\n\n            var a = multicast.ToArrayAsync();\n            var b = multicast.Take(2).ToArrayAsync();\n\n            var disp = multicast.Connect();\n\n            rp.Value = 2;\n\n            (await b).Should().Equal(1, 2);\n\n            var c = multicast.ToArrayAsync();\n\n            rp.Value = 3;\n\n            disp.Dispose();\n\n            rp.Value = 4;\n            rp.Value = 5;\n\n            rp.Dispose();\n\n            await Assert.ThrowsAsync<OperationCanceledException>(async () => await a);\n            await Assert.ThrowsAsync<OperationCanceledException>(async () => await c);\n        }\n\n\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/QueueTest.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests.Linq\n{\n    public class QueueTest\n    {\n        [Fact]\n        public async Task Q()\n        {\n            var rp = new AsyncReactiveProperty<int>(100);\n\n            var l = new List<int>();\n            await rp.Take(10).Queue().ForEachAsync(x =>\n            {\n                rp.Value += 10;\n                l.Add(x);\n            });\n\n            l.Should().Equal(100, 110, 120, 130, 140, 150, 160, 170, 180, 190);\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/Sets.cs",
    "content": "using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reactive.Concurrency;\nusing System.Reactive.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\n\nnamespace NetCoreTests.Linq\n{\n    public class Sets\n    {\n        public static IEnumerable<object[]> array1 = new object[][]\n        {\n            new object[] { new int[] { } }, // empty\n            new object[] { new int[] { 1, 2, 3 } }, // no dup\n            new object[] { new int[] { 1, 2, 3, 3, 4, 5, 2 } }, // dup\n        };\n\n        public static IEnumerable<object[]> array2 = new object[][]\n        {\n            new object[] { new int[] { } }, // empty\n            new object[] { new int[] { 1, 2 } },\n            new object[] { new int[] { 1, 2, 4, 5, 9 } }, // dup\n        };\n\n        [Theory]\n        [MemberData(nameof(array1))]\n        public async Task Distinct(int[] array)\n        {\n            var ys = array.Distinct().ToArray();\n            {\n                (await array.ToUniTaskAsyncEnumerable().Distinct().ToArrayAsync()).Should().Equal(ys);\n                (await array.ToUniTaskAsyncEnumerable().Distinct(x => x).ToArrayAsync()).Should().Equal(ys);\n                (await array.ToUniTaskAsyncEnumerable().DistinctAwait(x => UniTask.Run(() => x)).ToArrayAsync()).Should().Equal(ys);\n                (await array.ToUniTaskAsyncEnumerable().DistinctAwaitWithCancellation((x, _) => UniTask.Run(() => x)).ToArrayAsync()).Should().Equal(ys);\n            }\n        }\n\n        [Fact]\n        public async Task DistinctThrow()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                {\n                    var xs = item.Distinct().ToArrayAsync();\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                }\n                {\n                    var xs = item.Distinct(x => x).ToArrayAsync();\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                }\n                {\n                    var xs = item.DistinctAwait(x => UniTask.Run(() => x)).ToArrayAsync();\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                }\n                {\n                    var xs = item.DistinctAwaitWithCancellation((x, _) => UniTask.Run(() => x)).ToArrayAsync();\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                }\n            }\n        }\n\n        [Theory]\n        [MemberData(nameof(array1))]\n        public async Task DistinctUntilChanged(int[] array)\n        {\n            var ys = await array.ToAsyncEnumerable().DistinctUntilChanged().ToArrayAsync();\n            {\n                (await array.ToUniTaskAsyncEnumerable().DistinctUntilChanged().ToArrayAsync()).Should().Equal(ys);\n                (await array.ToUniTaskAsyncEnumerable().DistinctUntilChanged(x => x).ToArrayAsync()).Should().Equal(ys);\n                (await array.ToUniTaskAsyncEnumerable().DistinctUntilChangedAwait(x => UniTask.Run(() => x)).ToArrayAsync()).Should().Equal(ys);\n                (await array.ToUniTaskAsyncEnumerable().DistinctUntilChangedAwaitWithCancellation((x, _) => UniTask.Run(() => x)).ToArrayAsync()).Should().Equal(ys);\n            }\n        }\n\n        [Fact]\n        public async Task DistinctUntilChangedThrow()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                {\n                    var xs = item.DistinctUntilChanged().ToArrayAsync();\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                }\n                {\n                    var xs = item.DistinctUntilChanged(x => x).ToArrayAsync();\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                }\n                {\n                    var xs = item.DistinctUntilChangedAwait(x => UniTask.Run(() => x)).ToArrayAsync();\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                }\n                {\n                    var xs = item.DistinctUntilChangedAwaitWithCancellation((x, _) => UniTask.Run(() => x)).ToArrayAsync();\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n                }\n            }\n        }\n\n\n        [Fact]\n        public async Task Except()\n        {\n            foreach (var a1 in array1.First().Cast<int[]>())\n            {\n                foreach (var a2 in array2.First().Cast<int[]>())\n                {\n                    var xs = await a1.ToUniTaskAsyncEnumerable().Except(a2.ToUniTaskAsyncEnumerable()).ToArrayAsync();\n                    var ys = a1.Except(a2).ToArray();\n                    xs.Should().Equal(ys);\n                }\n            }\n        }\n\n        [Fact]\n        public async Task ExceptThrow()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.Except(UniTaskAsyncEnumerable.Return(10)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = UniTaskAsyncEnumerable.Return(10).Except(item).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n        }\n\n        [Fact]\n        public async Task Intersect()\n        {\n            foreach (var a1 in array1.First().Cast<int[]>())\n            {\n                foreach (var a2 in array2.First().Cast<int[]>())\n                {\n                    var xs = await a1.ToUniTaskAsyncEnumerable().Intersect(a2.ToUniTaskAsyncEnumerable()).ToArrayAsync();\n                    var ys = a1.Intersect(a2).ToArray();\n                    xs.Should().Equal(ys);\n                }\n            }\n        }\n\n        [Fact]\n        public async Task IntersectThrow()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.Intersect(UniTaskAsyncEnumerable.Return(10)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = UniTaskAsyncEnumerable.Return(10).Intersect(item).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n        }\n\n        [Fact]\n        public async Task Union()\n        {\n            foreach (var a1 in array1.First().Cast<int[]>())\n            {\n                foreach (var a2 in array2.First().Cast<int[]>())\n                {\n                    var xs = await a1.ToUniTaskAsyncEnumerable().Union(a2.ToUniTaskAsyncEnumerable()).ToArrayAsync();\n                    var ys = a1.Union(a2).ToArray();\n                    xs.Should().Equal(ys);\n                }\n            }\n        }\n\n        [Fact]\n        public async Task UnionThrow()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = item.Union(UniTaskAsyncEnumerable.Return(10)).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                var xs = UniTaskAsyncEnumerable.Return(10).Union(item).ToArrayAsync();\n                await Assert.ThrowsAsync<UniTaskTestException>(async () => await xs);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/Sort.cs",
    "content": "using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reactive.Concurrency;\nusing System.Reactive.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Xunit;\n\n\nnamespace NetCoreTests.Linq\n{\n    public class SortCheck\n    {\n        public int Age { get; set; }\n        public string FirstName { get; set; }\n        public string LastName { get; set; }\n\n        public override string ToString()\n        {\n            return (Age, FirstName, LastName).ToString();\n        }\n    }\n\n    public class Sort\n    {\n        static int rd;\n\n        static UniTask<T> RandomRun<T>(T value)\n        {\n            if (Interlocked.Increment(ref rd) % 2 == 0)\n            {\n                return UniTask.Run(() => value);\n            }\n            else\n            {\n                return UniTask.FromResult(value);\n            }\n        }\n        static UniTask<T> RandomRun<T>(T value, CancellationToken ct)\n        {\n            if (Interlocked.Increment(ref rd) % 2 == 0)\n            {\n                return UniTask.Run(() => value);\n            }\n            else\n            {\n                return UniTask.FromResult(value);\n            }\n        }\n\n        [Fact]\n        public async Task OrderBy()\n        {\n            var array = new[] { 1, 99, 32, 4, 536, 7, 8 };\n            {\n                var xs = await array.ToUniTaskAsyncEnumerable().OrderBy(x => x).ToArrayAsync();\n                var ys = array.OrderBy(x => x).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await array.ToUniTaskAsyncEnumerable().OrderByDescending(x => x).ToArrayAsync();\n                var ys = array.OrderByDescending(x => x).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await array.ToUniTaskAsyncEnumerable().OrderByAwait(RandomRun).ToArrayAsync();\n                var ys = array.OrderBy(x => x).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwait(RandomRun).ToArrayAsync();\n                var ys = array.OrderByDescending(x => x).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await array.ToUniTaskAsyncEnumerable().OrderByAwaitWithCancellation(RandomRun).ToArrayAsync();\n                var ys = array.OrderBy(x => x).ToArray();\n                xs.Should().Equal(ys);\n            }\n            {\n                var xs = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwaitWithCancellation(RandomRun).ToArrayAsync();\n                var ys = array.OrderByDescending(x => x).ToArray();\n                xs.Should().Equal(ys);\n            }\n        }\n\n        [Fact]\n        public async Task ThenBy()\n        {\n            var array = new[]\n            {\n                new SortCheck { Age = 99, FirstName = \"ABC\", LastName = \"DEF\" },\n                new SortCheck { Age = 49, FirstName = \"ABC\", LastName = \"DEF\" },\n                new SortCheck { Age = 49, FirstName = \"ABC\", LastName = \"ZKH\" },\n                new SortCheck { Age = 12, FirstName = \"ABC\", LastName = \"DEF\" },\n                new SortCheck { Age = 49, FirstName = \"ABC\", LastName = \"MEF\" },\n                new SortCheck { Age = 12, FirstName = \"QQQ\", LastName = \"DEF\" },\n                new SortCheck { Age = 19, FirstName = \"ZKN\", LastName = \"DEF\" },\n                new SortCheck { Age = 39, FirstName = \"APO\", LastName = \"REF\" },\n                new SortCheck { Age = 59, FirstName = \"ABC\", LastName = \"DEF\" },\n                new SortCheck { Age = 99, FirstName = \"DBC\", LastName = \"DEF\" },\n                new SortCheck { Age = 99, FirstName = \"DBC\", LastName = \"MEF\" },\n            };\n            {\n                var a = array.OrderBy(x => x.Age).ThenBy(x => x.FirstName).ThenBy(x => x.LastName).ToArray();\n                var b = array.OrderBy(x => x.Age).ThenBy(x => x.FirstName).ThenByDescending(x => x.LastName).ToArray();\n                var c = array.OrderBy(x => x.Age).ThenByDescending(x => x.FirstName).ThenBy(x => x.LastName).ToArray();\n                var d = array.OrderBy(x => x.Age).ThenByDescending(x => x.FirstName).ThenByDescending(x => x.LastName).ToArray();\n                var e = array.OrderByDescending(x => x.Age).ThenBy(x => x.FirstName).ThenBy(x => x.LastName).ToArray();\n                var f = array.OrderByDescending(x => x.Age).ThenBy(x => x.FirstName).ThenByDescending(x => x.LastName).ToArray();\n                var g = array.OrderByDescending(x => x.Age).ThenByDescending(x => x.FirstName).ThenBy(x => x.LastName).ToArray();\n                var h = array.OrderByDescending(x => x.Age).ThenByDescending(x => x.FirstName).ThenByDescending(x => x.LastName).ToArray();\n\n                {\n                    var a2 = await array.ToUniTaskAsyncEnumerable().OrderBy(x => x.Age).ThenBy(x => x.FirstName).ThenBy(x => x.LastName).ToArrayAsync();\n                    var b2 = await array.ToUniTaskAsyncEnumerable().OrderBy(x => x.Age).ThenBy(x => x.FirstName).ThenByDescending(x => x.LastName).ToArrayAsync();\n                    var c2 = await array.ToUniTaskAsyncEnumerable().OrderBy(x => x.Age).ThenByDescending(x => x.FirstName).ThenBy(x => x.LastName).ToArrayAsync();\n                    var d2 = await array.ToUniTaskAsyncEnumerable().OrderBy(x => x.Age).ThenByDescending(x => x.FirstName).ThenByDescending(x => x.LastName).ToArrayAsync();\n                    var e2 = await array.ToUniTaskAsyncEnumerable().OrderByDescending(x => x.Age).ThenBy(x => x.FirstName).ThenBy(x => x.LastName).ToArrayAsync();\n                    var f2 = await array.ToUniTaskAsyncEnumerable().OrderByDescending(x => x.Age).ThenBy(x => x.FirstName).ThenByDescending(x => x.LastName).ToArrayAsync();\n                    var g2 = await array.ToUniTaskAsyncEnumerable().OrderByDescending(x => x.Age).ThenByDescending(x => x.FirstName).ThenBy(x => x.LastName).ToArrayAsync();\n                    var h2 = await array.ToUniTaskAsyncEnumerable().OrderByDescending(x => x.Age).ThenByDescending(x => x.FirstName).ThenByDescending(x => x.LastName).ToArrayAsync();\n\n                    a.Should().Equal(a2);\n                    b.Should().Equal(b2);\n                    c.Should().Equal(c2);\n                    d.Should().Equal(d2);\n                    e.Should().Equal(e2);\n                    f.Should().Equal(f2);\n                    g.Should().Equal(g2);\n                    h.Should().Equal(h2);\n                }\n                {\n                    var a2 = await array.ToUniTaskAsyncEnumerable().OrderByAwait(x => RandomRun(x.Age)).ThenByAwait(x => RandomRun(x.FirstName)).ThenByAwait(x => RandomRun(x.LastName)).ToArrayAsync();\n                    var b2 = await array.ToUniTaskAsyncEnumerable().OrderByAwait(x => RandomRun(x.Age)).ThenByAwait(x => RandomRun(x.FirstName)).ThenByDescendingAwait(x => RandomRun(x.LastName)).ToArrayAsync();\n                    var c2 = await array.ToUniTaskAsyncEnumerable().OrderByAwait(x => RandomRun(x.Age)).ThenByDescendingAwait(x => RandomRun(x.FirstName)).ThenByAwait(x => RandomRun(x.LastName)).ToArrayAsync();\n                    var d2 = await array.ToUniTaskAsyncEnumerable().OrderByAwait(x => RandomRun(x.Age)).ThenByDescendingAwait(x => RandomRun(x.FirstName)).ThenByDescendingAwait(x => RandomRun(x.LastName)).ToArrayAsync();\n                    var e2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwait(x => RandomRun(x.Age)).ThenByAwait(x => RandomRun(x.FirstName)).ThenByAwait(x => RandomRun(x.LastName)).ToArrayAsync();\n                    var f2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwait(x => RandomRun(x.Age)).ThenByAwait(x => RandomRun(x.FirstName)).ThenByDescendingAwait(x => RandomRun(x.LastName)).ToArrayAsync();\n                    var g2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwait(x => RandomRun(x.Age)).ThenByDescendingAwait(x => RandomRun(x.FirstName)).ThenByAwait(x => RandomRun(x.LastName)).ToArrayAsync();\n                    var h2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwait(x => RandomRun(x.Age)).ThenByDescendingAwait(x => RandomRun(x.FirstName)).ThenByDescendingAwait(x => RandomRun(x.LastName)).ToArrayAsync();\n\n                    a.Should().Equal(a2);\n                    b.Should().Equal(b2);\n                    c.Should().Equal(c2);\n                    d.Should().Equal(d2);\n                    e.Should().Equal(e2);\n                    f.Should().Equal(f2);\n                    g.Should().Equal(g2);\n                    h.Should().Equal(h2);\n                }\n                {\n                    var a2 = await array.ToUniTaskAsyncEnumerable().OrderByAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync();\n                    var b2 = await array.ToUniTaskAsyncEnumerable().OrderByAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync();\n                    var c2 = await array.ToUniTaskAsyncEnumerable().OrderByAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync();\n                    var d2 = await array.ToUniTaskAsyncEnumerable().OrderByAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync();\n                    var e2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync();\n                    var f2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync();\n                    var g2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync();\n                    var h2 = await array.ToUniTaskAsyncEnumerable().OrderByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.Age)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.FirstName)).ThenByDescendingAwaitWithCancellation((x, ct) => RandomRun(x.LastName)).ToArrayAsync();\n\n                    a.Should().Equal(a2);\n                    b.Should().Equal(b2);\n                    c.Should().Equal(c2);\n                    d.Should().Equal(d2);\n                    e.Should().Equal(e2);\n                    f.Should().Equal(f2);\n                    g.Should().Equal(g2);\n                    h.Should().Equal(h2);\n                }\n            }\n        }\n\n\n        [Fact]\n        public async Task Throws()\n        {\n            foreach (var item in UniTaskTestException.Throws())\n            {\n                {\n                    var a = item.OrderBy(x => x).ToArrayAsync();\n                    var b = item.OrderByDescending(x => x).ToArrayAsync();\n                    var c = item.OrderBy(x => x).ThenBy(x => x).ToArrayAsync();\n                    var d = item.OrderBy(x => x).ThenByDescending(x => x).ToArrayAsync();\n\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await a);\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await b);\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await c);\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await d);\n                }\n                {\n                    var a = item.OrderByAwait(RandomRun).ToArrayAsync();\n                    var b = item.OrderByDescendingAwait(RandomRun).ToArrayAsync();\n                    var c = item.OrderByAwait(RandomRun).ThenByAwait(RandomRun).ToArrayAsync();\n                    var d = item.OrderByAwait(RandomRun).ThenByDescendingAwait(RandomRun).ToArrayAsync();\n\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await a);\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await b);\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await c);\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await d);\n                }\n                {\n                    var a = item.OrderByAwaitWithCancellation(RandomRun).ToArrayAsync();\n                    var b = item.OrderByDescendingAwaitWithCancellation(RandomRun).ToArrayAsync();\n                    var c = item.OrderByAwaitWithCancellation(RandomRun).ThenByAwaitWithCancellation(RandomRun).ToArrayAsync();\n                    var d = item.OrderByAwaitWithCancellation(RandomRun).ThenByDescendingAwaitWithCancellation(RandomRun).ToArrayAsync();\n\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await a);\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await b);\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await c);\n                    await Assert.ThrowsAsync<UniTaskTestException>(async () => await d);\n                }\n            }\n\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/TakeInfinityTest.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests.Linq\n{\n    public class TakeInfinityTest\n    {\n        [Fact]\n        public async Task Take()\n        {\n            var rp = new AsyncReactiveProperty<int>(1);\n\n            var xs = rp.Take(5).ToArrayAsync();\n\n            rp.Value = 2;\n            rp.Value = 3;\n            rp.Value = 4;\n            rp.Value = 5;\n\n            (await xs).Should().Equal(1, 2, 3, 4, 5);\n        }\n\n        [Fact]\n        public async Task TakeWhile()\n        {\n            var rp = new AsyncReactiveProperty<int>(1);\n\n            var xs = rp.TakeWhile(x => x != 5).ToArrayAsync();\n\n            rp.Value = 2;\n            rp.Value = 3;\n            rp.Value = 4;\n            rp.Value = 5;\n\n            (await xs).Should().Equal(1, 2, 3, 4);\n        }\n\n        [Fact]\n        public async Task TakeUntilCanceled()\n        {\n            var cts = new CancellationTokenSource();\n\n            var rp = new AsyncReactiveProperty<int>(1);\n\n            var xs = rp.TakeUntilCanceled(cts.Token).ToArrayAsync();\n\n            var c = CancelAsync();\n\n            await c;\n            var foo = await xs;\n\n            foo.Should().Equal(new[] { 1, 10, 20 });\n\n            async Task CancelAsync()\n            {\n                rp.Value = 10;\n                await Task.Yield();\n                rp.Value = 20;\n                await Task.Yield();\n                cts.Cancel();\n                rp.Value = 30;\n                await Task.Yield();\n                rp.Value = 40;\n            }\n        }\n\n        [Fact]\n        public async Task SkipUntilCanceled()\n        {\n            var cts = new CancellationTokenSource();\n\n            var rp = new AsyncReactiveProperty<int>(1);\n\n            var xs = rp.SkipUntilCanceled(cts.Token).ToArrayAsync();\n\n            var c = CancelAsync();\n\n            await c;\n            var foo = await xs;\n\n            foo.Should().Equal(new[] { 20, 30, 40 });\n\n            async Task CancelAsync()\n            {\n                rp.Value = 10;\n                await Task.Yield();\n                rp.Value = 20;\n                await Task.Yield();\n                cts.Cancel();\n                rp.Value = 30;\n                await Task.Yield();\n                rp.Value = 40;\n\n                rp.Dispose(); // complete.\n            }\n        }\n\n        [Fact]\n        public async Task TakeUntil()\n        {\n            var cts = new AsyncReactiveProperty<int>(0);\n\n            var rp = new AsyncReactiveProperty<int>(1);\n\n            var xs = rp.TakeUntil(cts.WaitAsync()).ToArrayAsync();\n\n            var c = CancelAsync();\n\n            await c;\n            var foo = await xs;\n\n            foo.Should().Equal(new[] { 1, 10, 20 });\n\n            async Task CancelAsync()\n            {\n                rp.Value = 10;\n                await Task.Yield();\n                rp.Value = 20;\n                await Task.Yield();\n                cts.Value = 9999;\n                rp.Value = 30;\n                await Task.Yield();\n                rp.Value = 40;\n            }\n        }\n\n        [Fact]\n        public async Task SkipUntil()\n        {\n            var cts = new AsyncReactiveProperty<int>(0);\n\n            var rp = new AsyncReactiveProperty<int>(1);\n\n            var xs = rp.SkipUntil(cts.WaitAsync()).ToArrayAsync();\n\n            var c = CancelAsync();\n\n            await c;\n            var foo = await xs;\n\n            foo.Should().Equal(new[] { 20, 30, 40 });\n\n            async Task CancelAsync()\n            {\n                rp.Value = 10;\n                await Task.Yield();\n                rp.Value = 20;\n                await Task.Yield();\n                cts.Value = 9999;\n                rp.Value = 30;\n                await Task.Yield();\n                rp.Value = 40;\n\n                rp.Dispose(); // complete.\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/Linq/_Exception.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing Cysharp.Threading.Tasks.Linq;\nusing System;\nusing System.Collections.Generic;\nusing System.Runtime.ExceptionServices;\nusing System.Threading;\n\nnamespace NetCoreTests.Linq\n{\n    public class UniTaskTestException : Exception\n    {\n        public static IUniTaskAsyncEnumerable<int> ThrowImmediate()\n        {\n            return UniTaskAsyncEnumerable.Throw<int>(new UniTaskTestException());\n        }\n        public static IUniTaskAsyncEnumerable<int> ThrowAfter()\n        {\n            return new ThrowAfter<int>(new UniTaskTestException());\n        }\n        public static IUniTaskAsyncEnumerable<int> ThrowInMoveNext()\n        {\n            return new ThrowIn<int>(new UniTaskTestException());\n        }\n\n\n        public static IEnumerable<IUniTaskAsyncEnumerable<int>> Throws(int count = 3)\n        {\n            yield return ThrowImmediate();\n            yield return ThrowAfter();\n            yield return ThrowInMoveNext();\n            yield return UniTaskAsyncEnumerable.Range(1, count).Concat(ThrowImmediate());\n            yield return UniTaskAsyncEnumerable.Range(1, count).Concat(ThrowAfter());\n            yield return UniTaskAsyncEnumerable.Range(1, count).Concat(ThrowInMoveNext());\n        }\n    }\n\n    internal class ThrowIn<TValue> : IUniTaskAsyncEnumerable<TValue>\n    {\n        readonly Exception exception;\n\n        public ThrowIn(Exception exception)\n        {\n            this.exception = exception;\n        }\n\n        public IUniTaskAsyncEnumerator<TValue> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new Enumerator(exception, cancellationToken);\n        }\n\n        class Enumerator : IUniTaskAsyncEnumerator<TValue>\n        {\n            readonly Exception exception;\n            CancellationToken cancellationToken;\n\n            public Enumerator(Exception exception, CancellationToken cancellationToken)\n            {\n                this.exception = exception;\n                this.cancellationToken = cancellationToken;\n            }\n\n            public TValue Current => default;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                ExceptionDispatchInfo.Capture(exception).Throw();\n                return new UniTask<bool>(false);\n            }\n\n            public UniTask DisposeAsync()\n            {\n                return default;\n            }\n        }\n    }\n\n    internal class ThrowAfter<TValue> : IUniTaskAsyncEnumerable<TValue>\n    {\n        readonly Exception exception;\n\n        public ThrowAfter(Exception exception)\n        {\n            this.exception = exception;\n        }\n\n        public IUniTaskAsyncEnumerator<TValue> GetAsyncEnumerator(CancellationToken cancellationToken = default)\n        {\n            return new Enumerator(exception, cancellationToken);\n        }\n\n        class Enumerator : IUniTaskAsyncEnumerator<TValue>\n        {\n            readonly Exception exception;\n            CancellationToken cancellationToken;\n\n            public Enumerator(Exception exception, CancellationToken cancellationToken)\n            {\n                this.exception = exception;\n                this.cancellationToken = cancellationToken;\n            }\n\n            public TValue Current => default;\n\n            public UniTask<bool> MoveNextAsync()\n            {\n                cancellationToken.ThrowIfCancellationRequested();\n\n                var tcs = new UniTaskCompletionSource<bool>();\n\n                var awaiter = UniTask.Yield().GetAwaiter();\n                awaiter.UnsafeOnCompleted(() =>\n                {\n                    Thread.Sleep(1);\n                    tcs.TrySetException(exception);\n                });\n\n                return tcs.Task;\n            }\n\n            public UniTask DisposeAsync()\n            {\n                return default;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/TaskBuilderCases.cs",
    "content": "﻿#pragma warning disable CS1998 \n\nusing Cysharp.Threading.Tasks;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Channels;\nusing Cysharp.Threading.Tasks.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\nusing System.Runtime.CompilerServices;\n\nnamespace NetCoreTests\n{\n    public class UniTaskBuilderTest\n    {\n        [Fact]\n        public async Task Empty()\n        {\n            await Core();\n\n            static async UniTask Core()\n            {\n            }\n        }\n\n        [Fact]\n        public async Task EmptyThrow()\n        {\n            await Assert.ThrowsAsync<TaskTestException>(async () => await Core());\n\n            static async UniTask Core()\n            {\n                throw new TaskTestException();\n            }\n        }\n\n        [Fact]\n        public async Task Task_Done()\n        {\n            await Core();\n\n            static async UniTask Core()\n            {\n                await new TestAwaiter(true, UniTaskStatus.Succeeded);\n            }\n        }\n\n        [Fact]\n        public async Task Task_Fail()\n        {\n            await Assert.ThrowsAsync<TaskTestException>(async () => await Core());\n\n            static async UniTask Core()\n            {\n                await new TestAwaiter(true, UniTaskStatus.Faulted);\n            }\n        }\n\n        [Fact]\n        public async Task Task_Cancel()\n        {\n            await Assert.ThrowsAsync<OperationCanceledException>(async () => await Core());\n\n            static async UniTask Core()\n            {\n                await new TestAwaiter(true, UniTaskStatus.Canceled);\n            }\n        }\n\n        [Fact]\n        public async Task AwaitUnsafeOnCompletedCall_Task_SetResult()\n        {\n            await Core();\n\n            static async UniTask Core()\n            {\n                await new TestAwaiter(false, UniTaskStatus.Succeeded);\n                await new TestAwaiter(false, UniTaskStatus.Succeeded);\n                await new TestAwaiter(false, UniTaskStatus.Succeeded);\n            }\n        }\n\n        [Fact]\n        public async Task AwaitUnsafeOnCompletedCall_Task_SetException()\n        {\n            await Assert.ThrowsAsync<TaskTestException>(async () => await Core());\n\n            static async UniTask Core()\n            {\n                await new TestAwaiter(false, UniTaskStatus.Succeeded);\n                await new TestAwaiter(false, UniTaskStatus.Faulted);\n                throw new InvalidOperationException();\n            }\n        }\n\n        [Fact]\n        public async Task AwaitUnsafeOnCompletedCall_Task_SetCancelException()\n        {\n            await Assert.ThrowsAsync<OperationCanceledException>(async () => await Core());\n\n            static async UniTask Core()\n            {\n                await new TestAwaiter(false, UniTaskStatus.Succeeded);\n                await new TestAwaiter(false, UniTaskStatus.Canceled);\n                throw new InvalidOperationException();\n            }\n        }\n    }\n\n    public class UniTask_T_BuilderTest\n    {\n        [Fact]\n        public async Task Empty()\n        {\n            (await Core()).Should().Be(10);\n\n            static async UniTask<int> Core()\n            {\n                return 10;\n            }\n        }\n\n        [Fact]\n        public async Task EmptyThrow()\n        {\n            await Assert.ThrowsAsync<TaskTestException>(async () => await Core());\n\n            static async UniTask<int> Core()\n            {\n                throw new TaskTestException();\n            }\n        }\n\n        [Fact]\n        public async Task Task_Done()\n        {\n            (await Core()).Should().Be(10);\n\n            static async UniTask<int> Core()\n            {\n                return await new TestAwaiter<int>(true, UniTaskStatus.Succeeded, 10);\n            }\n        }\n\n        [Fact]\n        public async Task Task_Fail()\n        {\n            await Assert.ThrowsAsync<TaskTestException>(async () => await Core());\n\n            static async UniTask<int> Core()\n            {\n                return await new TestAwaiter<int>(true, UniTaskStatus.Faulted, 10);\n            }\n        }\n\n        [Fact]\n        public async Task Task_Cancel()\n        {\n            await Assert.ThrowsAsync<OperationCanceledException>(async () => await Core());\n\n            static async UniTask<int> Core()\n            {\n                return await new TestAwaiter<int>(true, UniTaskStatus.Canceled, 10);\n            }\n        }\n\n        [Fact]\n        public async Task AwaitUnsafeOnCompletedCall_Task_SetResult()\n        {\n            (await Core()).Should().Be(6);\n\n            static async UniTask<int> Core()\n            {\n                var sum = 0;\n                sum += await new TestAwaiter<int>(false, UniTaskStatus.Succeeded, 1);\n                sum += await new TestAwaiter<int>(false, UniTaskStatus.Succeeded, 2);\n                sum += await new TestAwaiter<int>(false, UniTaskStatus.Succeeded, 3);\n                return sum;\n            }\n        }\n\n        [Fact]\n        public async Task AwaitUnsafeOnCompletedCall_Task_SetException()\n        {\n            await Assert.ThrowsAsync<TaskTestException>(async () => await Core());\n\n            static async UniTask<int> Core()\n            {\n                await new TestAwaiter<int>(false, UniTaskStatus.Succeeded, 10);\n                await new TestAwaiter<int>(false, UniTaskStatus.Faulted, 10);\n                throw new InvalidOperationException();\n            }\n        }\n\n        [Fact]\n        public async Task AwaitUnsafeOnCompletedCall_Task_SetCancelException()\n        {\n            await Assert.ThrowsAsync<OperationCanceledException>(async () => await Core());\n\n            static async UniTask<int> Core()\n            {\n                await new TestAwaiter<int>(false, UniTaskStatus.Succeeded, 10);\n                await new TestAwaiter<int>(false, UniTaskStatus.Canceled, 10);\n                throw new InvalidOperationException();\n            }\n        }\n    }\n\n    public class TaskTestException : Exception\n    {\n\n    }\n\n    public struct TestAwaiter : ICriticalNotifyCompletion\n    {\n        readonly UniTaskStatus status;\n        readonly bool isCompleted;\n\n        public TestAwaiter(bool isCompleted, UniTaskStatus status)\n        {\n            this.isCompleted = isCompleted;\n            this.status = status;\n        }\n\n        public TestAwaiter GetAwaiter() => this;\n\n        public bool IsCompleted => isCompleted;\n\n        public void GetResult()\n        {\n            switch (status)\n            {\n                case UniTaskStatus.Faulted:\n                    throw new TaskTestException();\n                case UniTaskStatus.Canceled:\n                    throw new OperationCanceledException();\n                case UniTaskStatus.Pending:\n                case UniTaskStatus.Succeeded:\n                default:\n                    break;\n            }\n        }\n\n        public void OnCompleted(Action continuation)\n        {\n            ThreadPool.QueueUserWorkItem(_ => continuation(), null);\n        }\n\n        public void UnsafeOnCompleted(Action continuation)\n        {\n            ThreadPool.UnsafeQueueUserWorkItem(_ => continuation(), null);\n        }\n    }\n\n    public struct TestAwaiter<T> : ICriticalNotifyCompletion\n    {\n        readonly UniTaskStatus status;\n        readonly bool isCompleted;\n        readonly T value;\n\n        public TestAwaiter(bool isCompleted, UniTaskStatus status, T value)\n        {\n            this.isCompleted = isCompleted;\n            this.status = status;\n            this.value = value;\n        }\n\n        public TestAwaiter<T> GetAwaiter() => this;\n\n        public bool IsCompleted => isCompleted;\n\n        public T GetResult()\n        {\n            switch (status)\n            {\n                case UniTaskStatus.Faulted:\n                    throw new TaskTestException();\n                case UniTaskStatus.Canceled:\n                    throw new OperationCanceledException();\n                case UniTaskStatus.Pending:\n                case UniTaskStatus.Succeeded:\n                default:\n                    return value;\n            }\n        }\n\n        public void OnCompleted(Action continuation)\n        {\n            ThreadPool.QueueUserWorkItem(_ => continuation(), null);\n        }\n\n        public void UnsafeOnCompleted(Action continuation)\n        {\n            ThreadPool.UnsafeQueueUserWorkItem(_ => continuation(), null);\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/TaskExtensionsTest.cs",
    "content": "#pragma warning disable CS1998\n\nusing System;\nusing System.Threading.Tasks;\nusing Cysharp.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests\n{\n    public class TaskExtensionsTest\n    {\n        [Fact]\n        public async Task PropagateException()\n        {\n            await Assert.ThrowsAsync<InvalidOperationException>(async () =>\n            {\n                await ThrowAsync().AsUniTask();\n            });\n            \n            await Assert.ThrowsAsync<InvalidOperationException>(async () =>\n            {\n                await ThrowOrValueAsync().AsUniTask();\n            });\n        }\n\n        [Fact]\n        public async Task PropagateExceptionWhenAll()\n        {\n            await Assert.ThrowsAsync<InvalidOperationException>(async () =>\n            {\n                await Task.WhenAll(ThrowAsync(), ThrowAsync()).AsUniTask();\n            });\n        }\n \n        async Task ThrowAsync()\n        {\n            throw new InvalidOperationException();\n        }\n\n        async Task<int> ThrowOrValueAsync()\n        {\n            throw new InvalidOperationException();\n        }\n   }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/TriggerEventTest.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Channels;\nusing Cysharp.Threading.Tasks.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests\n{\n    public class TriggerEventTest\n    {\n        [Fact]\n        public void SimpleAdd()\n        {\n            var ev = new TriggerEvent<int>();\n\n            // do nothing\n            ev.SetResult(0);\n            ev.SetError(null);\n            ev.SetCompleted();\n            ev.SetCanceled(default);\n\n            {\n                var one = new TestEvent(1);\n\n                ev.Add(one);\n\n                ev.SetResult(10);\n                ev.SetResult(20);\n                ev.SetResult(30);\n\n                one.NextCalled.Should().Equal(10, 20, 30);\n\n                ev.SetCompleted();\n\n                one.CompletedCalled.Count.Should().Be(1);\n\n                // do nothing\n                ev.SetResult(0);\n                ev.SetError(null);\n                ev.SetCompleted();\n                ev.SetCanceled(default);\n\n                one.NextCalled.Should().Equal(10, 20, 30);\n                one.CompletedCalled.Count.Should().Be(1);\n            }\n            // after removed, onemore\n            {\n                var one = new TestEvent(1);\n\n                ev.Add(one);\n\n                ev.SetResult(10);\n                ev.SetResult(20);\n                ev.SetResult(30);\n\n                one.NextCalled.Should().Equal(10, 20, 30);\n\n                ev.SetCompleted();\n\n                one.CompletedCalled.Count.Should().Be(1);\n\n                // do nothing\n                ev.SetResult(0);\n                ev.SetError(null);\n                ev.SetCompleted();\n                ev.SetCanceled(default);\n\n                one.NextCalled.Should().Equal(10, 20, 30);\n                one.CompletedCalled.Count.Should().Be(1);\n            }\n        }\n\n        [Fact]\n        public void AddFour()\n        {\n            var ev = new TriggerEvent<int>();\n\n            // do nothing\n            ev.SetResult(0);\n            ev.SetError(null);\n            ev.SetCompleted();\n            ev.SetCanceled(default);\n\n            {\n                var one = new TestEvent(1);\n                var two = new TestEvent(2);\n                var three = new TestEvent(3);\n                var four = new TestEvent(4);\n\n                ev.Add(one);\n                ev.Add(two);\n                ev.Add(three);\n                ev.Add(four);\n\n                ev.SetResult(10);\n                ev.SetResult(20);\n                ev.SetResult(30);\n\n                one.NextCalled.Should().Equal(10, 20, 30);\n                two.NextCalled.Should().Equal(10, 20, 30);\n                three.NextCalled.Should().Equal(10, 20, 30);\n                four.NextCalled.Should().Equal(10, 20, 30);\n\n                ev.SetCompleted();\n\n                one.CompletedCalled.Count.Should().Be(1);\n                two.CompletedCalled.Count.Should().Be(1);\n                three.CompletedCalled.Count.Should().Be(1);\n\n\n                // do nothing\n                ev.SetResult(0);\n                ev.SetError(null);\n                ev.SetCompleted();\n                ev.SetCanceled(default);\n\n                one.NextCalled.Should().Equal(10, 20, 30);\n                one.CompletedCalled.Count.Should().Be(1);\n                two.NextCalled.Should().Equal(10, 20, 30);\n                three.CompletedCalled.Count.Should().Be(1);\n                two.NextCalled.Should().Equal(10, 20, 30);\n                three.CompletedCalled.Count.Should().Be(1);\n            }\n\n            // after removed, onemore.\n            {\n                var one = new TestEvent(1);\n                var two = new TestEvent(2);\n                var three = new TestEvent(3);\n                var four = new TestEvent(4);\n\n                ev.Add(one);\n                ev.Add(two);\n                ev.Add(three);\n                ev.Add(four);\n\n                ev.SetResult(10);\n                ev.SetResult(20);\n                ev.SetResult(30);\n                ev.Add(four);\n\n                one.NextCalled.Should().Equal(10, 20, 30);\n                two.NextCalled.Should().Equal(10, 20, 30);\n                three.NextCalled.Should().Equal(10, 20, 30);\n                four.NextCalled.Should().Equal(10, 20, 30);\n\n                ev.SetCompleted();\n\n                one.CompletedCalled.Count.Should().Be(1);\n                two.CompletedCalled.Count.Should().Be(1);\n                three.CompletedCalled.Count.Should().Be(1);\n\n\n                // do nothing\n                ev.SetResult(0);\n                ev.SetError(null);\n                ev.SetCompleted();\n                ev.SetCanceled(default);\n\n                one.NextCalled.Should().Equal(10, 20, 30);\n                one.CompletedCalled.Count.Should().Be(1);\n                two.NextCalled.Should().Equal(10, 20, 30);\n                three.CompletedCalled.Count.Should().Be(1);\n                two.NextCalled.Should().Equal(10, 20, 30);\n                three.CompletedCalled.Count.Should().Be(1);\n            }\n        }\n\n\n        [Fact]\n        public void OneRemove()\n        {\n            var ev = new TriggerEvent<int>();\n            {\n                var one = new TestEvent(1);\n                var two = new TestEvent(2);\n                var three = new TestEvent(3);\n\n                ev.Add(one);\n                ev.Add(two);\n                ev.Add(three);\n\n                ev.SetResult(10);\n                ev.SetResult(20);\n                ev.SetResult(30);\n\n                one.NextCalled.Should().Equal(10, 20, 30);\n                two.NextCalled.Should().Equal(10, 20, 30);\n                three.NextCalled.Should().Equal(10, 20, 30);\n\n                ev.Remove(one);\n\n                ev.SetResult(40);\n                ev.SetResult(50);\n                ev.SetResult(60);\n\n                one.NextCalled.Should().Equal(10, 20, 30);\n                two.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);\n                three.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);\n            }\n        }\n        [Fact]\n        public void TwoRemove()\n        {\n            var ev = new TriggerEvent<int>();\n            {\n                var one = new TestEvent(1);\n                var two = new TestEvent(2);\n                var three = new TestEvent(3);\n\n                ev.Add(one);\n                ev.Add(two);\n                ev.Add(three);\n\n                ev.SetResult(10);\n                ev.SetResult(20);\n                ev.SetResult(30);\n\n                one.NextCalled.Should().Equal(10, 20, 30);\n                two.NextCalled.Should().Equal(10, 20, 30);\n                three.NextCalled.Should().Equal(10, 20, 30);\n\n                ev.Remove(two);\n\n                ev.SetResult(40);\n                ev.SetResult(50);\n                ev.SetResult(60);\n\n                one.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);\n                two.NextCalled.Should().Equal(10, 20, 30);\n                three.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);\n            }\n        }\n        [Fact]\n        public void ThreeRemove()\n        {\n            var ev = new TriggerEvent<int>();\n            {\n                var one = new TestEvent(1);\n                var two = new TestEvent(2);\n                var three = new TestEvent(3);\n\n                ev.Add(one);\n                ev.Add(two);\n                ev.Add(three);\n\n                ev.SetResult(10);\n                ev.SetResult(20);\n                ev.SetResult(30);\n\n                one.NextCalled.Should().Equal(10, 20, 30);\n                two.NextCalled.Should().Equal(10, 20, 30);\n                three.NextCalled.Should().Equal(10, 20, 30);\n\n                ev.Remove(three);\n\n                ev.SetResult(40);\n                ev.SetResult(50);\n                ev.SetResult(60);\n\n                one.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);\n                two.NextCalled.Should().Equal(10, 20, 30, 40, 50, 60);\n                three.NextCalled.Should().Equal(10, 20, 30);\n            }\n        }\n\n        [Fact]\n        public void RemoveSelf()\n        {\n            new RemoveMe().Run1();\n            new RemoveMe().Run2();\n            new RemoveMe().Run3();\n        }\n\n        [Fact]\n        public void RemoveNextInIterating()\n        {\n            new RemoveNext().Run1();\n            new RemoveNext().Run2();\n            new RemoveNext().Run3();\n        }\n\n        [Fact]\n        public void RemoveNextNextTest()\n        {\n            new RemoveNextNext().Run1();\n            new RemoveNextNext().Run2();\n        }\n\n\n        [Fact]\n        public void AddTest()\n        {\n            new AddMe().Run1();\n            new AddMe().Run2();\n        }\n\n        public class RemoveMe\n        {\n            TriggerEvent<int> ev;\n\n            public void Run1()\n            {\n                TestEvent one = default;\n                one = new TestEvent(1, () => ev.Remove(one));\n\n                var two = new TestEvent(2);\n                var three = new TestEvent(3);\n\n                ev.Add(one);\n                ev.Add(two);\n                ev.Add(three);\n\n                ev.SetResult(10);\n                ev.SetResult(20);\n                ev.SetResult(30);\n\n                one.NextCalled.Should().Equal(10);\n                two.NextCalled.Should().Equal(10, 20, 30);\n                three.NextCalled.Should().Equal(10, 20, 30);\n            }\n\n            public void Run2()\n            {\n                TestEvent one = default;\n                one = new TestEvent(1, () => ev.Remove(one));\n\n                var two = new TestEvent(2);\n                var three = new TestEvent(3);\n\n                ev.Add(two);\n                ev.Add(one); // add second.\n                ev.Add(three);\n\n                ev.SetResult(10);\n                ev.SetResult(20);\n                ev.SetResult(30);\n\n                one.NextCalled.Should().Equal(10);\n                two.NextCalled.Should().Equal(10, 20, 30);\n                three.NextCalled.Should().Equal(10, 20, 30);\n            }\n\n            public void Run3()\n            {\n                TestEvent one = default;\n                one = new TestEvent(1, () => ev.Remove(one));\n\n                var two = new TestEvent(2);\n                var three = new TestEvent(3);\n\n                ev.Add(two);\n                ev.Add(three);\n                ev.Add(one); // add thired.\n\n                ev.SetResult(10);\n                ev.SetResult(20);\n                ev.SetResult(30);\n\n                one.NextCalled.Should().Equal(10);\n                two.NextCalled.Should().Equal(10, 20, 30);\n                three.NextCalled.Should().Equal(10, 20, 30);\n            }\n        }\n\n        public class RemoveNext\n        {\n            TriggerEvent<int> ev;\n\n            public void Run1()\n            {\n                TestEvent one = default;\n                TestEvent two = default;\n                TestEvent three = default;\n                one = new TestEvent(1, () => ev.Remove(two));\n                two = new TestEvent(2);\n                three = new TestEvent(3);\n\n                ev.Add(one);\n                ev.Add(two);\n                ev.Add(three);\n\n                ev.SetResult(10);\n                ev.SetResult(20);\n                ev.SetResult(30);\n\n                one.NextCalled.Should().Equal(10, 20, 30);\n                two.NextCalled.Count.Should().Be(0);\n                three.NextCalled.Should().Equal(10, 20, 30);\n            }\n\n            public void Run2()\n            {\n                TestEvent one = default;\n                TestEvent two = default;\n                TestEvent three = default;\n                one = new TestEvent(1, () => ev.Remove(two));\n                two = new TestEvent(2);\n                three = new TestEvent(3);\n\n                ev.Add(two);\n                ev.Add(one); // add second\n                ev.Add(three);\n\n                ev.SetResult(10);\n                ev.SetResult(20);\n                ev.SetResult(30);\n\n                one.NextCalled.Should().Equal(10, 20, 30);\n                two.NextCalled.Should().Equal(10);\n                three.NextCalled.Should().Equal(10, 20, 30);\n            }\n\n            public void Run3()\n            {\n                TestEvent one = default;\n                TestEvent two = default;\n                TestEvent three = default;\n                one = new TestEvent(1, () => ev.Remove(two));\n                two = new TestEvent(2);\n                three = new TestEvent(3);\n\n                ev.Add(two);\n                ev.Add(three);\n                ev.Add(one); // add thired.\n\n                ev.SetResult(10);\n                ev.SetResult(20);\n                ev.SetResult(30);\n\n                one.NextCalled.Should().Equal(10, 20, 30);\n                two.NextCalled.Should().Equal(10);\n                three.NextCalled.Should().Equal(10, 20, 30);\n            }\n        }\n\n        public class RemoveNextNext\n        {\n            TriggerEvent<int> ev;\n\n            public void Run1()\n            {\n                TestEvent one = default;\n                TestEvent two = default;\n                TestEvent three = default;\n                TestEvent four = default;\n                one = new TestEvent(1, () => { ev.Remove(two); ev.Remove(three); });\n                two = new TestEvent(2);\n                three = new TestEvent(3);\n                four = new TestEvent(4);\n\n                ev.Add(one);\n                ev.Add(two);\n                ev.Add(three);\n                ev.Add(four);\n\n                ev.SetResult(10);\n                ev.SetResult(20);\n                ev.SetResult(30);\n\n                one.NextCalled.Should().Equal(10, 20, 30);\n                two.NextCalled.Count.Should().Be(0);\n                three.NextCalled.Count.Should().Be(0);\n                four.NextCalled.Should().Equal(10, 20, 30);\n            }\n\n            public void Run2()\n            {\n                TestEvent one = default;\n                TestEvent two = default;\n                TestEvent three = default;\n                TestEvent four = default;\n                one = new TestEvent(1, () => { ev.Remove(one); ev.Remove(two); ev.Remove(three); });\n                two = new TestEvent(2);\n                three = new TestEvent(3);\n                four = new TestEvent(4);\n\n                ev.Add(one);\n                ev.Add(two);\n                ev.Add(three);\n                ev.Add(four);\n\n                ev.SetResult(10);\n                ev.SetResult(20);\n                ev.SetResult(30);\n\n                one.NextCalled.Should().Equal(10);\n                two.NextCalled.Count.Should().Be(0);\n                three.NextCalled.Count.Should().Be(0);\n                four.NextCalled.Should().Equal(10, 20, 30);\n            }\n\n\n        }\n\n        public class AddMe\n        {\n            TriggerEvent<int> ev;\n\n            public void Run1()\n            {\n                TestEvent one = default;\n                TestEvent two = default;\n                TestEvent three = default;\n                TestEvent four = default;\n\n                one = new TestEvent(1, () =>\n                {\n                    if (two == null)\n                    {\n                        ev.Add(two = new TestEvent(2));\n                    }\n                    else if (three == null)\n                    {\n                        ev.Add(three = new TestEvent(3));\n                    }\n                    else if (four == null)\n                    {\n                        ev.Add(four = new TestEvent(4));\n                    }\n                });\n\n                ev.Add(one);\n\n                ev.SetResult(10);\n                ev.SetResult(20);\n                ev.SetResult(30);\n                ev.SetResult(40);\n\n                one.NextCalled.Should().Equal(10, 20, 30, 40);\n                two.NextCalled.Should().Equal(20, 30, 40);\n                three.NextCalled.Should().Equal(30, 40);\n                four.NextCalled.Should().Equal(40);\n            }\n\n            public void Run2()\n            {\n                TestEvent one = default;\n                TestEvent two = default;\n                TestEvent three = default;\n                TestEvent four = default;\n\n                one = new TestEvent(1, () =>\n                {\n                    if (two == null)\n                    {\n                        ev.Add(two = new TestEvent(2, () =>\n                        {\n                            if (three == null)\n                            {\n                                ev.Add(three = new TestEvent(3, () =>\n                                {\n                                    if (four == null)\n                                    {\n                                        ev.Add(four = new TestEvent(4));\n                                    }\n                                }));\n                            }\n                        }));\n                    }\n                });\n\n                ev.Add(one);\n\n                ev.SetResult(10);\n                ev.SetResult(20);\n                ev.SetResult(30);\n                ev.SetResult(40);\n\n                one.NextCalled.Should().Equal(10, 20, 30, 40);\n                two.NextCalled.Should().Equal(20, 30, 40);\n                three.NextCalled.Should().Equal(30, 40);\n                four.NextCalled.Should().Equal(40);\n            }\n        }\n    }\n\n    public class TestEvent : ITriggerHandler<int>\n    {\n        public readonly int Id;\n        readonly Action iteratingEvent;\n\n        public TestEvent(int id)\n        {\n            this.Id = id;\n        }\n\n        public TestEvent(int id, Action iteratingEvent)\n        {\n            this.Id = id;\n            this.iteratingEvent = iteratingEvent;\n        }\n\n        public List<int> NextCalled = new List<int>();\n        public List<Exception> ErrorCalled = new List<Exception>();\n        public List<object> CompletedCalled = new List<object>();\n        public List<CancellationToken> CancelCalled = new List<CancellationToken>();\n\n        public ITriggerHandler<int> Prev { get; set; }\n        public ITriggerHandler<int> Next { get; set; }\n\n        public void OnCanceled(CancellationToken cancellationToken)\n        {\n            CancelCalled.Add(cancellationToken);\n\n        }\n\n        public void OnCompleted()\n        {\n            CompletedCalled.Add(new object());\n        }\n\n        public void OnError(Exception ex)\n        {\n            ErrorCalled.Add(ex);\n        }\n\n        public void OnNext(int value)\n        {\n            NextCalled.Add(value);\n            iteratingEvent?.Invoke();\n        }\n\n        public override string ToString()\n        {\n            return Id.ToString();\n        }\n    }\n\n\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/UniTask.NetCoreTests.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFramework>net7.0</TargetFramework>\n    <RootNamespace>NetCoreTests</RootNamespace>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"FluentAssertions\" Version=\"5.10.3\" />\n    <PackageReference Include=\"Microsoft.NET.Test.Sdk\" Version=\"16.6.1\" />\n    <PackageReference Include=\"System.Interactive.Async\" Version=\"4.1.1\" />\n    <PackageReference Include=\"System.Linq.Async\" Version=\"4.1.1\" />\n    <PackageReference Include=\"System.Reactive\" Version=\"4.4.1\" />\n    <PackageReference Include=\"xunit\" Version=\"2.4.1\" />\n    <PackageReference Include=\"xunit.runner.visualstudio\" Version=\"2.4.1\">\n      <PrivateAssets>all</PrivateAssets>\n      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>\n    </PackageReference>\n  </ItemGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\UniTask.NetCore\\UniTask.NetCore.csproj\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/UniTaskCompletionSourceTest.cs",
    "content": "using System.Threading.Tasks;\nusing Cysharp.Threading.Tasks;\nusing FluentAssertions;\nusing NetCoreTests.Linq;\nusing Xunit;\n\nnamespace NetCoreTests\n{\n    public class AutoResetUniTaskCompletionSourceTest\n    {\n        [Fact]\n        public async Task SetResultAfterReturn()\n        {\n            var source1 = AutoResetUniTaskCompletionSource.Create();\n            source1.TrySetResult();\n            await source1.Task;\n            \n            source1.TrySetResult().Should().BeFalse();\n            \n            var source2 = AutoResetUniTaskCompletionSource.Create();\n            source2.TrySetResult();\n            await source2.Task;\n\n            source2.TrySetResult().Should().BeFalse();\n        }\n\n        [Fact]\n        public async Task SetCancelAfterReturn()\n        {\n            var source = AutoResetUniTaskCompletionSource.Create();\n            source.TrySetResult();\n            await source.Task;\n            \n            source.TrySetCanceled().Should().BeFalse();\n        }\n        \n        [Fact]\n        public async Task SetExceptionAfterReturn()\n        {\n            var source = AutoResetUniTaskCompletionSource.Create();\n            source.TrySetResult();\n            await source.Task;\n            \n            source.TrySetException(new UniTaskTestException()).Should().BeFalse();\n        }\n        \n        [Fact]\n        public async Task SetResultWithValueAfterReturn()\n        {\n            var source1 = AutoResetUniTaskCompletionSource<int>.Create();\n            source1.TrySetResult(100);\n            (await source1.Task).Should().Be(100);\n            \n            source1.TrySetResult(100).Should().BeFalse();\n            \n            var source2 = AutoResetUniTaskCompletionSource.Create();\n            source2.TrySetResult();\n            await source2.Task;\n            source2.TrySetResult().Should().BeFalse();\n        }\n\n        [Fact]\n        public async Task SetCancelWithValueAfterReturn()\n        {\n            var source = AutoResetUniTaskCompletionSource<int>.Create();\n            source.TrySetResult(100);\n            (await source.Task).Should().Be(100);\n            source.TrySetCanceled().Should().BeFalse();\n        }\n        \n        [Fact]\n        public async Task SetExceptionWithValueAfterReturn()\n        {\n            var source = AutoResetUniTaskCompletionSource<int>.Create();\n            source.TrySetResult(100);\n            (await source.Task).Should().Be(100);\n            source.TrySetException(new UniTaskTestException()).Should().BeFalse();\n        }\n    }\n}"
  },
  {
    "path": "src/UniTask.NetCoreTests/WhenEachTest.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests\n{\n    public class WhenEachTest\n    {\n        [Fact]\n        public async Task Each()\n        {\n            var a = Delay(1, 3000);\n            var b = Delay(2, 1000);\n            var c = Delay(3, 2000);\n\n            var l = new List<int>();\n            await foreach (var item in UniTask.WhenEach(a, b, c))\n            {\n                l.Add(item.Result);\n            }\n\n            l.Should().Equal(2, 3, 1);\n        }\n\n        [Fact]\n        public async Task Error()\n        {\n            var a = Delay2(1, 3000);\n            var b = Delay2(2, 1000);\n            var c = Delay2(3, 2000);\n\n            var l = new List<WhenEachResult<int>>();\n            await foreach (var item in UniTask.WhenEach(a, b, c))\n            {\n                l.Add(item);\n            }\n\n            l[0].IsCompletedSuccessfully.Should().BeTrue();\n            l[0].IsFaulted.Should().BeFalse();\n            l[0].Result.Should().Be(2);\n\n            l[1].IsCompletedSuccessfully.Should().BeFalse();\n            l[1].IsFaulted.Should().BeTrue();\n            l[1].Exception.Message.Should().Be(\"ERROR\");\n\n            l[2].IsCompletedSuccessfully.Should().BeTrue();\n            l[2].IsFaulted.Should().BeFalse();\n            l[2].Result.Should().Be(1);\n        }\n\n        async UniTask<int> Delay(int id, int sleep)\n        {\n            await Task.Delay(sleep);\n            return id;\n        }\n\n        async UniTask<int> Delay2(int id, int sleep)\n        {\n            await Task.Delay(sleep);\n            if (id == 3) throw new Exception(\"ERROR\");\n            return id;\n        }\n    }\n}\n"
  },
  {
    "path": "src/UniTask.NetCoreTests/WithCancellationTest.cs",
    "content": "﻿using Cysharp.Threading.Tasks;\nusing FluentAssertions;\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace NetCoreTests\n{\n    public class WithCancellationTest\n    {\n        [Fact]\n        public async Task Standard()\n        {\n            CancellationTokenSource cts = new CancellationTokenSource();\n\n            var v = await UniTask.Run(() => 10).AttachExternalCancellation(cts.Token);\n\n            v.Should().Be(10);\n        }\n\n        [Fact]\n        public async Task Cancel()\n        {\n            CancellationTokenSource cts = new CancellationTokenSource();\n\n            var t = UniTask.Create(async () =>\n            {\n                await Task.Delay(TimeSpan.FromSeconds(1));\n                return 10;\n            }).AttachExternalCancellation(cts.Token);\n\n            cts.Cancel();\n\n            (await Assert.ThrowsAsync<OperationCanceledException>(async () => await t)).CancellationToken.Should().Be(cts.Token);\n        }\n    }\n}\n"
  }
]