{
    "version": "1.19.10302.0",
    "description": "The new Windows Terminal, and the original Windows console host - all in the same place!",
    "homepage": "https://github.com/microsoft/terminal",
    "license": "MIT",
    "notes": "Add Windows Terminal as a context menu option by running `reg import \"$dir\\install-context.reg\"`",
    "suggest": {
        "vcredist": "extras/vcredist2022"
    },
    "architecture": {
        "64bit": {
            "url": "https://github.com/microsoft/terminal/releases/download/v1.19.10302.0/Microsoft.WindowsTerminal_1.19.10302.0_x64.zip",
            "hash": "899b60d9145fce8ce7b18c0e53a80c2362fa67c3eab5d0823543041a7e10f0d3"
        },
        "32bit": {
            "url": "https://github.com/microsoft/terminal/releases/download/v1.19.10302.0/Microsoft.WindowsTerminal_1.19.10302.0_x86.zip",
            "hash": "27dcb0951cd83c7551f7b3ec3e997a1928d395d985015833ed11ca9976f5c48a"
        },
        "arm64": {
            "url": "https://github.com/microsoft/terminal/releases/download/v1.19.10302.0/Microsoft.WindowsTerminal_1.19.10302.0_arm64.zip",
            "hash": "9a3b3ef52f887518fb58ab79d14f54ab177f4d7fd42de5c37c921e30e7a9d259"
        }
    },
    "extract_dir": "terminal-1.19.10302.0",
    "pre_install": [
        "# Remove this hint in 2023-12-01",
        "$settings_path = \"$env:LOCALAPPDATA\\Packages\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\LocalState\"",
        "if (!(Test-Path \"$persist_dir\\settings\") -and (Test-Path $settings_path)) {",
        "  $current_setings = $dir.Replace($version, 'current') + \"\\settings\"",
        "  warn \"Portable mode is enabled from version 1.17.11391.0, please migrate the settings manually:\"",
        "  warn \"Original settings dir: `'$settings_path`'\"",
        "  warn \"Portable settings dir: `'$current_setings`'\"",
        "}"
    ],
    "installer": {
        "script": [
            "$winVer = [Environment]::OSVersion.Version",
            "if (($winver.Major -lt '10') -or ($winVer.Build -lt 19041)) { warn 'At least Windows 10 20H1 (build 19041) is required.' }",
            "if (!(Test-Path \"$persist_dir\\.portable\")) { Add-Content \"$dir\\.portable\" '' -Encoding Ascii }"
        ]
    },
    "post_install": [
        "'install-context', 'uninstall-context' | ForEach-Object {",
        "    if (Test-Path \"$bucketsdir\\extras\\scripts\\windows-terminal\\$_.reg\") {",
        "        $wtPath = \"$dir\\wt.exe\".Replace('\\', '\\\\')",
        "        $content = (Get-Content \"$bucketsdir\\extras\\scripts\\windows-terminal\\$_.reg\").Replace('$wt', $wtPath)",
        "        if ($global) { $content = $content.Replace('HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE') }",
        "        Set-Content \"$dir\\$_.reg\" $content -Encoding Ascii -Force",
        "    }",
        "}"
    ],
    "bin": [
        "WindowsTerminal.exe",
        "wt.exe"
    ],
    "shortcuts": [
        [
            "WindowsTerminal.exe",
            "Windows Terminal"
        ]
    ],
    "persist": [
        ".portable",
        "settings"
    ],
    "pre_uninstall": "if ($cmd -eq 'uninstall') { reg import \"$dir\\uninstall-context.reg\" }",
    "checkver": "github",
    "autoupdate": {
        "architecture": {
            "64bit": {
                "url": "https://github.com/microsoft/terminal/releases/download/v$version/Microsoft.WindowsTerminal_$version_x64.zip"
            },
            "32bit": {
                "url": "https://github.com/microsoft/terminal/releases/download/v$version/Microsoft.WindowsTerminal_$version_x86.zip"
            },
            "arm64": {
                "url": "https://github.com/microsoft/terminal/releases/download/v$version/Microsoft.WindowsTerminal_$version_arm64.zip"
            }
        },
        "hash": {
            "url": "https://github.com/microsoft/terminal/releases/tag/v$version",
            "regex": "(?s)$basename.*?$sha256"
        },
        "extract_dir": "terminal-$version"
    }
}
